From dd9b8e2bd3dce0caa45bb0bd3d05fbc0d0e90669 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:26:05 +0800 Subject: [PATCH 01/18] add bufman proto idl --- pkg/bufman/proto/audit/v1alpha1/event.proto | 420 +++++++++++++++++ pkg/bufman/proto/audit/v1alpha1/service.proto | 35 ++ pkg/bufman/proto/breaking/v1/config.proto | 39 ++ pkg/bufman/proto/buf.yaml | 39 ++ pkg/bufman/proto/image/v1/image.proto | 115 +++++ pkg/bufman/proto/lint/v1/config.proto | 48 ++ pkg/bufman/proto/module/v1alpha1/module.proto | 94 ++++ .../proto/registry/v1alpha1/admin.proto | 185 ++++++++ .../proto/registry/v1alpha1/authn.proto | 39 ++ .../proto/registry/v1alpha1/authz.proto | 342 ++++++++++++++ .../proto/registry/v1alpha1/convert.proto | 39 ++ .../proto/registry/v1alpha1/display.proto | 147 ++++++ pkg/bufman/proto/registry/v1alpha1/doc.proto | 397 ++++++++++++++++ .../proto/registry/v1alpha1/docker.proto | 131 ++++++ .../proto/registry/v1alpha1/download.proto | 48 ++ .../proto/registry/v1alpha1/generate.proto | 125 +++++ .../registry/v1alpha1/git_metadata.proto | 31 ++ .../proto/registry/v1alpha1/github.proto | 23 + .../proto/registry/v1alpha1/image.proto | 67 +++ .../proto/registry/v1alpha1/jsonschema.proto | 34 ++ .../proto/registry/v1alpha1/labels.proto | 70 +++ .../proto/registry/v1alpha1/module.proto | 34 ++ .../registry/v1alpha1/organization.proto | 264 +++++++++++ .../proto/registry/v1alpha1/owner.proto | 36 ++ .../proto/registry/v1alpha1/plugin.proto | 408 +++++++++++++++++ .../registry/v1alpha1/plugin_curation.proto | 426 ++++++++++++++++++ pkg/bufman/proto/registry/v1alpha1/push.proto | 67 +++ .../registry/v1alpha1/recommendation.proto | 82 ++++ .../proto/registry/v1alpha1/reference.proto | 84 ++++ .../proto/registry/v1alpha1/repository.proto | 351 +++++++++++++++ .../registry/v1alpha1/repository_branch.proto | 42 ++ .../registry/v1alpha1/repository_commit.proto | 171 +++++++ .../registry/v1alpha1/repository_tag.proto | 84 ++++ .../proto/registry/v1alpha1/resolve.proto | 176 ++++++++ .../proto/registry/v1alpha1/resource.proto | 35 ++ pkg/bufman/proto/registry/v1alpha1/role.proto | 59 +++ .../proto/registry/v1alpha1/schema.proto | 165 +++++++ .../proto/registry/v1alpha1/scim_token.proto | 63 +++ .../proto/registry/v1alpha1/search.proto | 207 +++++++++ .../proto/registry/v1alpha1/studio.proto | 44 ++ .../registry/v1alpha1/studio_request.proto | 154 +++++++ pkg/bufman/proto/registry/v1alpha1/sync.proto | 72 +++ .../proto/registry/v1alpha1/token.proto | 87 ++++ pkg/bufman/proto/registry/v1alpha1/user.proto | 190 ++++++++ .../v1alpha1/verification_status.proto | 16 + .../proto/registry/v1alpha1/webhook.proto | 108 +++++ pkg/bufman/proto/studio/v1alpha1/invoke.proto | 64 +++ .../proto/wasmplugin/v1/wasmplugin.proto | 44 ++ pkg/bufman/proto/webhook/v1alpha1/event.proto | 47 ++ 49 files changed, 6048 insertions(+) create mode 100644 pkg/bufman/proto/audit/v1alpha1/event.proto create mode 100644 pkg/bufman/proto/audit/v1alpha1/service.proto create mode 100644 pkg/bufman/proto/breaking/v1/config.proto create mode 100644 pkg/bufman/proto/buf.yaml create mode 100644 pkg/bufman/proto/image/v1/image.proto create mode 100644 pkg/bufman/proto/lint/v1/config.proto create mode 100644 pkg/bufman/proto/module/v1alpha1/module.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/admin.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/authn.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/authz.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/convert.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/display.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/doc.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/docker.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/download.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/generate.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/git_metadata.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/github.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/image.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/jsonschema.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/labels.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/module.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/organization.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/owner.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/plugin.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/plugin_curation.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/push.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/recommendation.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/reference.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/repository.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/repository_branch.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/repository_commit.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/repository_tag.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/resolve.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/resource.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/role.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/schema.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/scim_token.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/search.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/studio.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/studio_request.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/sync.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/token.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/user.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/verification_status.proto create mode 100644 pkg/bufman/proto/registry/v1alpha1/webhook.proto create mode 100644 pkg/bufman/proto/studio/v1alpha1/invoke.proto create mode 100644 pkg/bufman/proto/wasmplugin/v1/wasmplugin.proto create mode 100644 pkg/bufman/proto/webhook/v1alpha1/event.proto diff --git a/pkg/bufman/proto/audit/v1alpha1/event.proto b/pkg/bufman/proto/audit/v1alpha1/event.proto new file mode 100644 index 000000000..ebd0028e4 --- /dev/null +++ b/pkg/bufman/proto/audit/v1alpha1/event.proto @@ -0,0 +1,420 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.audit.v1alpha1; + +import "registry/v1alpha1/admin.proto"; +import "registry/v1alpha1/plugin.proto"; +import "registry/v1alpha1/repository.proto"; +import "registry/v1alpha1/role.proto"; +import "google/protobuf/timestamp.proto"; + +// ActorType is the type of actor that caused the audited event. +enum ActorType { + ACTOR_TYPE_UNSPECIFIED = 0; + ACTOR_TYPE_USER = 1; + ACTOR_TYPE_SYSTEM = 2; +} + +// Actor is the actor who caused the audited event. +message Actor { + // Type of actor who caused the audited event. + ActorType type = 1; + // Id of the actor who caused the audited event. + string id = 2; + // Name of the actor who caused the audited event. + string name = 3; +} + +// ResourceType is the type of the resource that was affected by the audited +// event. +enum ResourceType { + RESOURCE_TYPE_UNSPECIFIED = 0; + RESOURCE_TYPE_USER = 1; + RESOURCE_TYPE_ORGANIZATION = 2; + RESOURCE_TYPE_ORGANIZATION_MEMBER = 3; + RESOURCE_TYPE_ORGANIZATION_IDP_GROUP = 9; + RESOURCE_TYPE_REPOSITORY = 4; + RESOURCE_TYPE_REPOSITORY_CONTRIBUTOR = 5; + RESOURCE_TYPE_REPOSITORY_COMMIT = 6; + RESOURCE_TYPE_PLUGIN = 7 [deprecated = true]; + RESOURCE_TYPE_CURATED_PLUGIN = 8; + RESOURCE_TYPE_TOKEN = 10; + RESOURCE_TYPE_SCIM_TOKEN = 11; + RESOURCE_TYPE_REPOSITORY_LABEL = 12; + RESOURCE_TYPE_SERVER = 13; +} + +// Resource is the affected resource by the audited event. +message Resource { + // Type of resource that was affected by the audited event. + ResourceType type = 1; + // Id of the affected resource by the audited event. + string id = 2; + // Name of the affected resource by the audited event. + string name = 3; +} + +// EventType is the type of audited event. +enum EventType { + EVENT_TYPE_UNSPECIFIED = 0; + EVENT_TYPE_ORGANIZATION_CREATED = 1; + EVENT_TYPE_ORGANIZATION_DELETED = 2; + EVENT_TYPE_ORGANIZATION_MEMBER_ADDED = 3; + EVENT_TYPE_ORGANIZATION_MEMBER_ROLE_CHANGED = 4; + EVENT_TYPE_ORGANIZATION_MEMBER_REMOVED = 5; + EVENT_TYPE_ORGANIZATION_IDP_GROUP_ADDED = 21; + EVENT_TYPE_ORGANIZATION_IDP_GROUP_REMOVED = 22; + EVENT_TYPE_REPOSITORY_CREATED = 6; + EVENT_TYPE_REPOSITORY_DELETED = 7; + EVENT_TYPE_REPOSITORY_COMMIT_PUSHED = 8; + EVENT_TYPE_REPOSITORY_CONTRIBUTOR_ADDED = 9; + EVENT_TYPE_REPOSITORY_CONTRIBUTOR_ROLE_CHANGED = 10; + EVENT_TYPE_REPOSITORY_CONTRIBUTOR_REMOVED = 11; + EVENT_TYPE_REPOSITORY_VISIBILITY_CHANGED = 12; + EVENT_TYPE_PLUGIN_CREATED = 13 [deprecated = true]; + EVENT_TYPE_PLUGIN_DELETED = 14 [deprecated = true]; + EVENT_TYPE_CURATED_PLUGIN_CREATED = 20; + EVENT_TYPE_CURATED_PLUGIN_DELETED = 31; + EVENT_TYPE_USER_CREATED = 15; + EVENT_TYPE_USER_DELETED = 16; + EVENT_TYPE_USER_DEACTIVATED = 17; + EVENT_TYPE_USER_LOGGED_IN = 18; + EVENT_TYPE_USER_LOGGED_OUT = 19; + EVENT_TYPE_TOKEN_CREATED = 23; + EVENT_TYPE_TOKEN_DELETED = 24; + EVENT_TYPE_USER_REACTIVATED = 25; + EVENT_TYPE_SCIM_TOKEN_CREATED = 26; + EVENT_TYPE_SCIM_TOKEN_DELETED = 27; + EVENT_TYPE_REPOSITORY_COMMIT_DELETED = 28; + EVENT_TYPE_REPOSITORY_LABEL_CREATED = 29; + EVENT_TYPE_REPOSITORY_LABEL_MOVED = 30; + EVENT_TYPE_SERVER_BREAKING_CHANGE_POLICY_ENABLED = 32; + EVENT_TYPE_SERVER_BREAKING_CHANGE_POLICY_DISABLED = 33; +} + +// EventMetadata provides additional details about the audited event. +message EventMetadata { + // UserAgent is the User-Agent header associated with the request that triggered the audited event, if any. + string user_agent = 1; + // IP is the IP address associated with the request that triggered the audited event, if any. + string ip = 2; + // TraceID is the ID of the trace associated with the audited event, if any. + string trace_id = 3; +} + +// Event is an audited action that happened in the BSR, with the information of +// what happened, when it happened, who did it, which resource was affected, and +// more contextual information on the event. +message Event { + // Unique id of the audited event. + string event_id = 1; + // Type of the audited event. It specifies "what" happened. + EventType type = 2; + // Actor of the audited event. It specifies "who" did it. + Actor actor = 3; + // Resource of the audited event. It specifies "which resource" was affected. + Resource resource = 4; + // Time of the audited event. It specifies "when" it happened. + google.protobuf.Timestamp event_time = 5; + // Metadata about the audited event. It specifies any additional details about the audited event. + EventMetadata metadata = 6; + // Payload of the audited event. It specifies additional context on the event. + oneof payload { + PayloadOrganizationCreated organization_created = 7; + PayloadOrganizationDeleted organization_deleted = 8; + PayloadOrganizationMemberAdded organization_member_added = 9; + PayloadOrganizationMemberRoleChanged organization_member_role_changed = 10; + PayloadOrganizationMemberRemoved organization_member_removed = 11; + PayloadRepositoryCreated repository_created = 12; + PayloadRepositoryDeleted repository_deleted = 13; + PayloadRepositoryCommitPushed repository_commit_pushed = 14; + PayloadRepositoryContributorAdded repository_contributor_added = 15; + PayloadRepositoryContributorRoleChanged repository_contributor_role_changed = 16; + PayloadRepositoryContributorRemoved repository_contributor_removed = 17; + PayloadRepositoryVisibilityChanged repository_visibility_changed = 18; + PayloadPluginCreated plugin_created = 19 [deprecated = true]; + PayloadPluginDeleted plugin_deleted = 20 [deprecated = true]; + PayloadUserCreated user_created = 21; + PayloadUserDeactivated user_deactivated = 22; + PayloadUserDeleted user_deleted = 23; + PayloadUserLoggedIn user_logged_in = 24; + PayloadUserLoggedOut user_logged_out = 25; + PayloadCuratedPluginCreated curated_plugin_created = 26; + PayloadOrganizationIDPGroupAdded idp_group_added = 27; + PayloadOrganizationIDPGroupRemoved idp_group_removed = 28; + PayloadTokenCreated token_created = 29; + PayloadTokenDeleted token_deleted = 30; + PayloadUserReactivated user_reactivated = 31; + PayloadSCIMTokenCreated scim_token_created = 32; + PayloadSCIMTokenDeleted scim_token_deleted = 33; + PayloadRepositoryCommitDeleted repository_commit_deleted = 34; + PayloadRepositoryLabelCreated repository_label_created = 35; + PayloadRepositoryLabelMoved repository_label_moved = 36; + PayloadCuratedPluginDeleted curated_plugin_deleted = 37; + PayloadServerBreakingChangePolicyEnabled payload_server_breaking_change_policy_enabled = 38; + PayloadServerBreakingChangePolicyDisabled payload_server_breaking_change_policy_disabled = 39; + } +} + +message PayloadOrganizationCreated {} + +message PayloadOrganizationDeleted {} + +message PayloadOrganizationMemberAdded { + // organization_id is the id of the organization with the new member. + string organization_id = 1; + // organization_name is the name of the organization with the new member. + string organization_name = 2; + // member_role is the role granted to the member added to the organization. + bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole member_role = 3; + // member_role_source is the source of the role granted to the member. + bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource member_role_source = 4; +} + +message PayloadOrganizationMemberRoleChanged { + // organization_id is the id of the organization within which the role was changed. + string organization_id = 1; + // organization_name is the name of the organization within which the role was changed. + string organization_name = 2; + // old_role is the old role of the member whose role was changed. + bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole old_role = 3; + // new_role is the new role of the member whose role was changed. + bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole new_role = 4; + // old_member_role_source is the old source of the role granted to the member. + bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource old_member_role_source = 5; + // new_member_role_source is the new source of the role granted to the member. + bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource new_member_role_source = 6; +} + +message PayloadOrganizationMemberRemoved { + // organization_id is the id of the organization that the member was removed from. + string organization_id = 1; + // organization_name is the name of the organization that the member was removed from. + string organization_name = 2; + // member_role is the role that the member had when removed from the organization. + bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole member_role = 3; + // member_role_source is the source of the role granted to the member. + bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource member_role_source = 4; +} + +message PayloadOrganizationIDPGroupAdded { + // organization_id is the id of the organization with the new IDP group. + string organization_id = 1; + // organization_name is the name of the organization with the new IDP group. + string organization_name = 2; +} + +message PayloadOrganizationIDPGroupRemoved { + // organization_id is the id of the organization with the removed IDP group. + string organization_id = 1; + // organization_name is the name of the organization with the removed IDP group. + string organization_name = 2; +} + +message PayloadRepositoryCreated { + // owner_id is the id of the owner of the repository. + string owner_id = 1; + // owner_name is the name of the owner of the repository. + string owner_name = 2; + // visibility is the visibility of the repository. + bufman.dubbo.apache.org.registry.v1alpha1.Visibility visibility = 3; +} + +message PayloadRepositoryDeleted { + // owner_id is the id of the owner of the repository. + string owner_id = 1; + // owner_name is the name of the owner of the repository. + string owner_name = 2; + // visibility is the visibility of the repository. + bufman.dubbo.apache.org.registry.v1alpha1.Visibility visibility = 3; +} + +message PayloadRepositoryCommitPushed { + // owner_id is the id of the owner of the repository. + string owner_id = 1; + // owner_name is the name of the owner of the repository. + string owner_name = 2; + // repository_id is the id of the repository within which the commit was created. + string repository_id = 3; + // repository_name is the name of the repository within which the commit was created. + string repository_name = 4; + // tags are the tags included in the push. Optional. + repeated string tags = 5; + // draft_name is the name of the draft. Optional. + string draft_name = 6; + // manifest_digest is the module's manifest digest. + string manifest_digest = 7; +} + +message PayloadRepositoryContributorAdded { + // owner_id is the id of the owner of the repository. + string owner_id = 1; + // owner_name is the name of the owner of the repository. + string owner_name = 2; + // repository_id is the id of the repository with the new contributor. + string repository_id = 3; + // repository_name is the name of the repository with the new contributor. + string repository_name = 4; + // contributor_role is the role granted to the contributor added to the repository. + bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole contributor_role = 5; +} + +message PayloadRepositoryContributorRoleChanged { + // owner_id is the id of the owner of the repository. + string owner_id = 1; + // owner_name is the name of the owner of the repository. + string owner_name = 2; + // repository_id is the id of the repository within which the role was changed. + string repository_id = 3; + // repository_name is the name of the repository within which the role was changed. + string repository_name = 4; + // old_role is the old role of the contributor whose role was changed. + bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole old_role = 5; + // new_role is the new role of the contributor whose role was changed. + bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole new_role = 6; +} + +message PayloadRepositoryContributorRemoved { + // owner_id is the id of the owner of the repository. + string owner_id = 1; + // owner_name is the name of the owner of the repository. + string owner_name = 2; + // repository_id is the id of the repository that the contributor was removed from. + string repository_id = 3; + // repository_name is the name of the repository that the contributor was removed from. + string repository_name = 4; + // contributor_role is the role that the contributor had when removed from the repository. + bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole contributor_role = 5; +} + +message PayloadRepositoryVisibilityChanged { + // owner_id is the id of the owner of the repository. + string owner_id = 1; + // owner_name is the name of the owner of the repository. + string owner_name = 2; + // old_visibility is the old visibility of the repository. + bufman.dubbo.apache.org.registry.v1alpha1.Visibility old_visibility = 3; + // new_visibility is the new visibility of the repository. + bufman.dubbo.apache.org.registry.v1alpha1.Visibility new_visibility = 4; +} + +message PayloadPluginCreated { + option deprecated = true; + // owner_id is the id of the owner of the plugin. + string owner_id = 1; + // owner_name is the name of the owner of the plugin. + string owner_name = 2; + // visibility is the visibility of the plugin. + bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility visibility = 3; +} + +message PayloadPluginDeleted { + option deprecated = true; + // owner_id is the id of the owner of the plugin. + string owner_id = 1; + // owner_name is the name of the owner of the plugin. + string owner_name = 2; + // visibility is the visibility of the plugin. + bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility visibility = 3; +} + +message PayloadUserCreated {} + +message PayloadUserReactivated {} + +message PayloadUserDeactivated {} + +message PayloadUserDeleted {} + +message PayloadUserLoggedIn {} + +message PayloadUserLoggedOut {} + +message PayloadCuratedPluginCreated { + // owner_id is the id of the owner of the plugin. + string owner_id = 1; + // owner_name is the name of the owner of the plugin. + string owner_name = 2; +} + +message PayloadCuratedPluginDeleted { + // owner_id is the id of the owner of the plugin. + string owner_id = 1; + // owner_name is the name of the owner of the plugin. + string owner_name = 2; +} + +message PayloadTokenCreated { + // owner_id is the id of the owner of the token. + string owner_id = 1; + // token_expiry_time is the expiry time of the token. + google.protobuf.Timestamp token_expiry_time = 2; +} + +message PayloadTokenDeleted { + // owner_id is the id of the owner of the token. + string owner_id = 1; +} + +message PayloadSCIMTokenCreated { + // token_expiry_time is the expiry time of the token. + google.protobuf.Timestamp token_expiry_time = 1; +} + +message PayloadSCIMTokenDeleted {} + +message PayloadRepositoryCommitDeleted { + // owner_id is the id of the owner of the repository from which the commit will be deleted. + string owner_id = 1; + // owner_name is the name of the owner of the repository from which the commit will be deleted. + string owner_name = 2; + // repository_id is the id of the repository from which the commit will be deleted. + string repository_id = 3; + // repository_name is the name of the repository from which the commit will be deleted. + string repository_name = 4; + // draft_name is the name of the draft. Optional. + string draft_name = 5; +} + +message PayloadRepositoryLabelCreated { + // owner_id is the id of the owner of the repository on which the label will be created. + string owner_id = 1; + // owner_name is the name of the owner of the repository on which the label will be created. + string owner_name = 2; + // repository_id is the id of the repository on which the label will be created. + string repository_id = 3; + // repository_name is the name of the repository from which the label will be created. + string repository_name = 4; + // label_namespace is the namespace of the label that was created. + string label_namespace = 5; + // commit_id is the id of the commit on which the label was created. + string commit_id = 6; +} + +message PayloadRepositoryLabelMoved { + // owner_id is the id of the owner of the repository on which the label will be moved. + string owner_id = 1; + // owner_name is the name of the owner of the repository on which the label will be moved. + string owner_name = 2; + // repository_id is the id of the repository on which the label will be moved. + string repository_id = 3; + // repository_name is the name of the repository from which the label will be moved. + string repository_name = 4; + // label_namespace is the namespace of the label that was moved. + string label_namespace = 5; + // to_commit_id is the id of the commit on which the label was moved to. + string to_commit_id = 6; + // from_commit_id is the id of the commit on which the label was moved from. + string from_commit_id = 7; +} + +message PayloadServerBreakingChangePolicyEnabled { + // category is the category of breaking changes. + bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangeCategory category = 1; + // ignore_unstable_packages tracks breaking change enforcement for unstable packages. + optional bool ignore_unstable_packages = 2; +} + +message PayloadServerBreakingChangePolicyDisabled {} diff --git a/pkg/bufman/proto/audit/v1alpha1/service.proto b/pkg/bufman/proto/audit/v1alpha1/service.proto new file mode 100644 index 000000000..861a4c5bd --- /dev/null +++ b/pkg/bufman/proto/audit/v1alpha1/service.proto @@ -0,0 +1,35 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.audit.v1alpha1; + +import "audit/v1alpha1/event.proto"; +import "google/protobuf/timestamp.proto"; + +// AuditService is the Audit service. +service AuditService { + // ListAuditedEvents lists audited events recorded in the BSR instance. + rpc ListAuditedEvents(ListAuditedEventsRequest) returns (ListAuditedEventsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message ListAuditedEventsRequest { + // The page size for listing audited events, values between 1-250. + uint32 page_size = 1; + // The page token for paginating. The first page is returned if this is empty. + string page_token = 2; + // The start timestamp to filter events from. + google.protobuf.Timestamp start = 3; + // The end timestamp to filter events to. + google.protobuf.Timestamp end = 4; +} + +message ListAuditedEventsResponse { + // The list of audited events in the current page. + repeated dubbo.apache.org.audit.v1alpha1.Event events = 1; + // The token for the next page of audited events. There are no more pages if + // this is empty. + string next_page_token = 2; +} diff --git a/pkg/bufman/proto/breaking/v1/config.proto b/pkg/bufman/proto/breaking/v1/config.proto new file mode 100644 index 000000000..4e23b5b2f --- /dev/null +++ b/pkg/bufman/proto/breaking/v1/config.proto @@ -0,0 +1,39 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.breaking.v1; + +// Config represents the breaking change configuration for a module. The rule and category IDs are defined +// by the version and apply across the config. The version is independent of the version of +// the package. The package version refers to the config shape, the version encoded in the Config message +// indicates which rule and category IDs should be used. +// +// The rule and category IDs are not encoded as enums in this package because we may want to support custom rule +// and category IDs in the future. Callers will need to resolve the rule and category ID strings. +message Config { + // version represents the version of the breaking change rule and category IDs that should be used with this config. + string version = 1; + // use_ids lists the rule and/or category IDs that are included in the breaking change check. + repeated string use_ids = 2; + // except_ids lists the rule and/or category IDs that are excluded from the breaking change check. + repeated string except_ids = 3; + // ignore_paths lists the paths of directories and/or files that should be ignored by the breaking change check. + // All paths are relative to the root of the module. + repeated string ignore_paths = 4; + // ignore_id_paths is a map of rule and/or category IDs to directory and/or file paths to exclude from the + // breaking change check. This corresponds with the ignore_only configuration key. + repeated IDPaths ignore_id_paths = 5; + // ignore_unstable_packages ignores packages with a last component that is one of the unstable forms recognised + // by the PACKAGE_VERSION_SUFFIX: + // v\d+test.* + // v\d+(alpha|beta)\d+ + // v\d+p\d+(alpha|beta)\d+ + bool ignore_unstable_packages = 6; +} + +// IDPaths represents a rule or category ID and the file and/or directory paths that are ignored for the rule. +message IDPaths { + string id = 1; + repeated string paths = 2; +} diff --git a/pkg/bufman/proto/buf.yaml b/pkg/bufman/proto/buf.yaml new file mode 100644 index 000000000..c51d1a914 --- /dev/null +++ b/pkg/bufman/proto/buf.yaml @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - DEFAULT + - UNARY_RPC +breaking: + use: + - FILE + ignore_unstable_packages: true diff --git a/pkg/bufman/proto/image/v1/image.proto b/pkg/bufman/proto/image/v1/image.proto new file mode 100644 index 000000000..7252f5425 --- /dev/null +++ b/pkg/bufman/proto/image/v1/image.proto @@ -0,0 +1,115 @@ + + +syntax = "proto2"; + +package bufman.dubbo.apache.org.image.v1; + +import "google/protobuf/descriptor.proto"; + +option cc_enable_arenas = true; +option optimize_for = SPEED; + +// Image is an extended FileDescriptorSet. +// +// See https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto +message Image { + repeated ImageFile file = 1; +} + +// ImageFile is an extended FileDescriptorProto. +// +// Since FileDescriptorProto does not have extensions, we copy the fields from +// FileDescriptorProto, and then add our own extensions via the buf_extension +// field. This is compatible with a FileDescriptorProto. +// +// See https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto +message ImageFile { + optional string name = 1; + optional string package = 2; + repeated string dependency = 3; + repeated int32 public_dependency = 10; + repeated int32 weak_dependency = 11; + repeated google.protobuf.DescriptorProto message_type = 4; + repeated google.protobuf.EnumDescriptorProto enum_type = 5; + repeated google.protobuf.ServiceDescriptorProto service = 6; + repeated google.protobuf.FieldDescriptorProto extension = 7; + optional google.protobuf.FileOptions options = 8; + optional google.protobuf.SourceCodeInfo source_code_info = 9; + optional string syntax = 12; + optional string edition = 13; + + // buf_extension contains buf-specific extensions to FileDescriptorProtos. + // + // The prefixed name and high tag value is used to all but guarantee there + // will never be any conflict with Google's FileDescriptorProto definition. + // The definition of a FileDescriptorProto has not changed in years, so + // we're not too worried about a conflict here. + optional ImageFileExtension buf_extension = 8042; +} + +// ImageFileExtension contains extensions to ImageFiles. +// +// The fields are not included directly on the ImageFile so that we can both +// detect if extensions exist, which signifies this was created by buf and not +// by protoc, and so that we can add fields in a freeform manner without +// worrying about conflicts with FileDescriptorProto. +message ImageFileExtension { + // is_import denotes whether this file is considered an "import". + // + // An import is a file which was not derived from the local source files. + // There are two cases where this could be true: + // + // 1. A Well-Known Type included from the compiler. + // 2. A file that was included from a Buf module dependency. + // + // We use "import" as this matches with the protoc concept of + // --include_imports, however import is a bit of an overloaded term. + // + // This will always be set. + optional bool is_import = 1; + // ModuleInfo contains information about the Buf module this file belongs to. + // + // This field is optional and will not be set if the module is not known. + optional ModuleInfo module_info = 2; + // is_syntax_unspecified denotes whether the file did not have a syntax + // explicitly specified. + // + // Per the FileDescriptorProto spec, it would be fine in this case to just + // leave the syntax field unset to denote this and to set the syntax field + // to "proto2" if it is specified. However, protoc does not set the syntax + // field if it was "proto2", and plugins may (incorrectly) depend on this. + // We also want to maintain consistency with protoc as much as possible. + // So instead, we have this field which will denote whether syntax was not + // specified. + // + // This will always be set. + optional bool is_syntax_unspecified = 3; + // unused_dependency are the indexes within the dependency field on + // FileDescriptorProto for those dependencies that are not used. + // + // This matches the shape of the public_dependency and weak_dependency + // fields. + repeated int32 unused_dependency = 4; +} + +// ModuleInfo contains information about a Buf module that an ImageFile +// belongs to. +message ModuleInfo { + // name is the name of the Buf module. + // + // This will always be set. + optional ModuleName name = 1; + // commit is the repository commit. + // + // This field is optional and will not be set if the commit is not known. + optional string commit = 2; +} + +// ModuleName is a module name. +// +// All fields will always be set. +message ModuleName { + optional string remote = 1; + optional string owner = 2; + optional string repository = 3; +} diff --git a/pkg/bufman/proto/lint/v1/config.proto b/pkg/bufman/proto/lint/v1/config.proto new file mode 100644 index 000000000..03f856ea0 --- /dev/null +++ b/pkg/bufman/proto/lint/v1/config.proto @@ -0,0 +1,48 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.lint.v1; + +// Config represents the lint configuration for a module. The rule and category IDs are defined +// by the version and apply across the config. The version is independent of the version of +// the package. The package version refers to the config shape, the version encoded in the Config message +// indicates which rule and category IDs should be used. +// +// The rule and category IDs are not encoded as enums in this package because we may want to support custom rule +// and category IDs in the future. Callers will need to resolve the rule and category ID strings. +message Config { + // version represents the version of the lint rule and category IDs that should be used with this config. + string version = 1; + // use_ids lists the rule and/or category IDs that are included in the lint check. + repeated string use_ids = 2; + // except_ids lists the rule and/or category IDs that are excluded from the lint check. + repeated string except_ids = 3; + // ignore_paths lists the paths of directories and/or files that should be ignored by the lint check. + // All paths are relative to the root of the module. + repeated string ignore_paths = 4; + // ignore_id_paths is a map of rule and/or category IDs to directory and/or file paths to exclude from the + // lint check. This corresponds with the ignore_only configuration key. + repeated IDPaths ignore_id_paths = 5; + // enum_zero_value_suffix controls the behavior of the ENUM_ZERO_VALUE lint rule ID. By default, this rule + // verifies that the zero value of all enums ends in _UNSPECIFIED. This config allows the user to override + // this value with the given string. + string enum_zero_value_suffix = 6; + // rpc_allow_same_request_response allows the same message type for both the request and response of an RPC. + bool rpc_allow_same_request_response = 7; + // rpc_allow_google_protobuf_empty_requests allows the RPC requests to use the google.protobuf.Empty message. + bool rpc_allow_google_protobuf_empty_requests = 8; + // rpc_allow_google_protobuf_empty_responses allows the RPC responses to use the google.protobuf.Empty message. + bool rpc_allow_google_protobuf_empty_responses = 9; + // service_suffix applies to the SERVICE_SUFFIX rule ID. By default, the rule verifies that all service names + // end with the suffix Service. This allows users to override the value with the given string. + string service_suffix = 10; + // allow_comment_ignores turns on comment-driven ignores. + bool allow_comment_ignores = 11; +} + +// IDPaths represents a rule or category ID and the file and/or directory paths that are ignored for the rule. +message IDPaths { + string id = 1; + repeated string paths = 2; +} diff --git a/pkg/bufman/proto/module/v1alpha1/module.proto b/pkg/bufman/proto/module/v1alpha1/module.proto new file mode 100644 index 000000000..a1e61f9af --- /dev/null +++ b/pkg/bufman/proto/module/v1alpha1/module.proto @@ -0,0 +1,94 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.module.v1alpha1; + +import "breaking/v1/config.proto"; +import "lint/v1/config.proto"; +import "google/protobuf/timestamp.proto"; + +enum DigestType { + DIGEST_TYPE_UNSPECIFIED = 0; + DIGEST_TYPE_SHAKE256 = 1; +} + +// Digest represents a hash function's value. +message Digest { + // digest_type describes the hash algorithm. e.g. "SHAKE256" + DigestType digest_type = 1; + // digest is the hash's output without encoding. + bytes digest = 2; +} + +// Blob represents some module content with an associated hash. +message Blob { + // Digest of the content. + Digest digest = 1; + // Content of the blob. Optional when Blob is used as a content pointer. + bytes content = 2; +} + +// Module is a module. +message Module { + // files are the files that make up the set. + // + // Sorted by path. + // Path must be unique. + // Only the target files. No imports. + // + // Maximum total size of all content: 32MB. + repeated ModuleFile files = 1; + // dependencies are the dependencies. + repeated ModulePin dependencies = 2; + // documentation is the string representation of the contents of the file at documentation_path. + // + // string is used to enforce UTF-8 encoding or 7-bit ASCII text. + string documentation = 3; + // breaking_config is the breaking change detection configuration set for the module. + bufman.dubbo.apache.org.breaking.v1.Config breaking_config = 4; + // lint_config is the lint configuration set for the module. + bufman.dubbo.apache.org.lint.v1.Config lint_config = 5; + // license is the string representation of the contents of the `LICENSE` file. + // + // string is used to enforce UTF-8 encoding or 7-bit ASCII text. + string license = 6; + // documentation_path is the path of the file which contains the module documentation. + // + // either `buf.md`, `README.md` or `README.markdown`. + // if empty, assumes buf.md. + string documentation_path = 7; +} + +// ModuleFile is a file within a FileSet. +message ModuleFile { + // path is the relative path of the file. + // Path can only use '/' as the separator character, and includes no ".." components. + string path = 1; + // content is the content of the file. + bytes content = 2; +} + +// ModuleReference is a module reference. +message ModuleReference { + string remote = 1; + string owner = 2; + string repository = 3; + // either tag, or commit + string reference = 4; +} + +// ModulePin is a module pin. +message ModulePin { + reserved 6; + reserved "digest"; + + string remote = 1; + string owner = 2; + string repository = 3; + string branch = 4; + string commit = 5; + google.protobuf.Timestamp create_time = 7; + // Module's manifest digest. Replacement for previous b1/b3 digests. + string manifest_digest = 8; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/admin.proto b/pkg/bufman/proto/registry/v1alpha1/admin.proto new file mode 100644 index 000000000..683f51d09 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/admin.proto @@ -0,0 +1,185 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/organization.proto"; +import "registry/v1alpha1/plugin.proto"; +import "registry/v1alpha1/repository.proto"; +import "registry/v1alpha1/user.proto"; +import "registry/v1alpha1/verification_status.proto"; + +// BreakingChangeCategory is the allowed list of categories for breaking rule settings. +enum BreakingChangeCategory { + BREAKING_CHANGE_CATEGORY_UNSPECIFIED = 0; + BREAKING_CHANGE_CATEGORY_FILE = 1; + BREAKING_CHANGE_CATEGORY_WIRE_JSON = 2; +} + +message BreakingChangePolicy { + optional bool enabled = 1; + optional bool ignore_unstable_packages = 2; + BreakingChangeCategory category = 3; +} + +// UniquenessPolicy is the policy for uniqueness on the server. +message UniquenessPolicy { + // Whether uniqueness policy is enforced. + bool enabled = 1; +} + +// Collision is a collision that has occurred. +message Collision { + // The reference that has collisions. + string reference = 1; + // The type of collision. + CollisionType type = 2; + // The sources of the collision that the user is authorized to see. + repeated CollisionSource sources = 3; + // Whether there are other collision sources that the user is not authorized to see. + // The user should contact a server admin for more information about these collisions. + bool has_other_collision_sources = 4; +} + +// CollisionSource is the source of a collision +message CollisionSource { + // The name of the owner of the source. + string owner_name = 1; + // The name of the repository of the source. + string repository_name = 2; + // The path of the file that is the source of the collision. + string path = 3; +} + +// CollisionType is the type of collisions that can occur. +enum CollisionType { + // Unspecified collision type. + COLLISION_TYPE_UNSPECIFIED = 0; + // A fully qualified proto name + COLLISION_TYPE_FULLY_QUALIFIED_NAME = 1; + // A proto file path + COLLISION_TYPE_PATH = 2; +} + +// AdminService is the Admin service. +service AdminService { + // ForceDeleteUser forces to delete a user. Resources and organizations that are + // solely owned by the user will also be deleted. + rpc ForceDeleteUser(ForceDeleteUserRequest) returns (ForceDeleteUserResponse) { + option idempotency_level = IDEMPOTENT; + } + // Update a user's verification status. + rpc UpdateUserVerificationStatus(UpdateUserVerificationStatusRequest) returns (UpdateUserVerificationStatusResponse); + // Update a organization's verification. + rpc UpdateOrganizationVerificationStatus(UpdateOrganizationVerificationStatusRequest) returns (UpdateOrganizationVerificationStatusResponse); + // Create a new machine user on the server. + rpc CreateMachineUser(CreateMachineUserRequest) returns (CreateMachineUserResponse) { + option idempotency_level = IDEMPOTENT; + } + // Get breaking change policy for the server. + rpc GetBreakingChangePolicy(GetBreakingChangePolicyRequest) returns (GetBreakingChangePolicyResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // Update breaking change policy for the server. + rpc UpdateBreakingChangePolicy(UpdateBreakingChangePolicyRequest) returns (UpdateBreakingChangePolicyResponse); + // Get uniqueness policy for the server. + rpc GetUniquenessPolicy(GetUniquenessPolicyRequest) returns (GetUniquenessPolicyResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // Update uniqueness policy enforcement for the server. + rpc UpdateUniquenessPolicy(UpdateUniquenessPolicyRequest) returns (UpdateUniquenessPolicyResponse); + // Get state of uniqueness collisions for the server + rpc ListServerUniquenessCollisions(ListServerUniquenessCollisionsRequest) returns (ListServerUniquenessCollisionsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message ForceDeleteUserRequest { + string user_id = 1; +} + +message ForceDeleteUserResponse { + // The deleted user. + User user = 1; + // The deleted organizations. + repeated Organization organizations = 2; + // The deleted repositories. + repeated Repository repositories = 3; + // The deleted plugins. + repeated Plugin plugins = 4 [deprecated = true]; + // The deleted templates. + repeated Template templates = 5 [deprecated = true]; +} + +message UpdateUserVerificationStatusRequest { + string user_id = 1; + VerificationStatus verification_status = 2; +} + +message UpdateUserVerificationStatusResponse {} + +message UpdateOrganizationVerificationStatusRequest { + string organization_id = 1; + VerificationStatus verification_status = 2; +} + +message UpdateOrganizationVerificationStatusResponse {} + +message CreateMachineUserRequest { + string username = 1; +} + +message CreateMachineUserResponse { + User user = 1; +} + +message GetBreakingChangePolicyRequest {} + +message GetBreakingChangePolicyResponse { + BreakingChangePolicy policy = 1; +} + +message UpdateBreakingChangePolicyRequest { + BreakingChangePolicy policy = 1; +} + +message UpdateBreakingChangePolicyResponse {} + +message GetUniquenessPolicyRequest {} + +message GetUniquenessPolicyResponse { + UniquenessPolicy policy = 1; +} + +message UpdateUniquenessPolicyRequest { + UniquenessPolicy policy = 1; +} + +message UpdateUniquenessPolicyResponse {} + +message ListServerUniquenessCollisionsRequest { + // Token of the page to retrieve. If not specified, the first page of + // results will be returned. Use the value obtained from `next_page_token` + // in the previous response in order to request the next page of results. + string page_token = 1; + // Number of elements to retrieve in a single page. + // When too large a page is requested, the server may decide to further + // limit the number of returned resources. + uint32 page_size = 2; + // The desired collision type to filter by. + // This must be specified. Only collisions of the specified type will be returned, + // continue to page through results until no more collisions of the specified + // type are returned. + CollisionType collision_type = 3; +} + +message ListServerUniquenessCollisionsResponse { + // The collisions. + repeated Collision collisions = 1; + // Pagination token used to retrieve the next page of results. + // Pass the content of this string as the `page_token` attribute of + // the next request. `next_page_token` is not returned for the last + // page. + string next_page_token = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/authn.proto b/pkg/bufman/proto/registry/v1alpha1/authn.proto new file mode 100644 index 000000000..0c78f7169 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/authn.proto @@ -0,0 +1,39 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/user.proto"; + +// AuthnService supplies authenication helpers. +service AuthnService { + // GetCurrentUser gets information associated with the current user. + // + // The user's ID is retrieved from the request's authentication header. + rpc GetCurrentUser(GetCurrentUserRequest) returns (GetCurrentUserResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetCurrentUserSubject gets the currently logged in users subject. + // + // The user's ID is retrieved from the request's authentication header. + rpc GetCurrentUserSubject(GetCurrentUserSubjectRequest) returns (GetCurrentUserSubjectResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message GetCurrentUserRequest {} + +message GetCurrentUserResponse { + bufman.dubbo.apache.org.registry.v1alpha1.User user = 1; +} + +message GetCurrentUserSubjectRequest {} + +message GetCurrentUserSubjectResponse { + // The user's subject for mapping to user in identity provider. + // Note: we do not want to make it part of the User response as + // it contains potentially sensitive information and the User + // response is shared with other users. + string subject = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/authz.proto b/pkg/bufman/proto/registry/v1alpha1/authz.proto new file mode 100644 index 000000000..b9dd7b55d --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/authz.proto @@ -0,0 +1,342 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/role.proto"; + +// AuthzService supplies authorization helpers. +service AuthzService { + // UserCanCreateOrganizationRepository returns whether the user is authorized + // to create repositories in an organization. + rpc UserCanCreateOrganizationRepository(UserCanCreateOrganizationRepositoryRequest) returns (UserCanCreateOrganizationRepositoryResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanSeeRepositorySettings returns whether the user is authorized + // to see repository settings. + rpc UserCanSeeRepositorySettings(UserCanSeeRepositorySettingsRequest) returns (UserCanSeeRepositorySettingsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanSeeOrganizationSettings returns whether the user is authorized + // to see organization settings. + rpc UserCanSeeOrganizationSettings(UserCanSeeOrganizationSettingsRequest) returns (UserCanSeeOrganizationSettingsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanReadPlugin returns whether the user has read access to the specified plugin. + rpc UserCanReadPlugin(UserCanReadPluginRequest) returns (UserCanReadPluginResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanCreatePluginVersion returns whether the user is authorized + // to create a plugin version under the specified plugin. + rpc UserCanCreatePluginVersion(UserCanCreatePluginVersionRequest) returns (UserCanCreatePluginVersionResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanCreateTemplateVersion returns whether the user is authorized + // to create a template version under the specified template. + rpc UserCanCreateTemplateVersion(UserCanCreateTemplateVersionRequest) returns (UserCanCreateTemplateVersionResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a plugin in an organization. + rpc UserCanCreateOrganizationPlugin(UserCanCreateOrganizationPluginRequest) returns (UserCanCreateOrganizationPluginResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a template in an organization. + rpc UserCanCreateOrganizationTemplate(UserCanCreateOrganizationTemplateRequest) returns (UserCanCreateOrganizationTemplateResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanSeePluginSettings returns whether the user is authorized + // to see plugin settings. + rpc UserCanSeePluginSettings(UserCanSeePluginSettingsRequest) returns (UserCanSeePluginSettingsResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanSeeTemplateSettings returns whether the user is authorized + // to see template settings. + rpc UserCanSeeTemplateSettings(UserCanSeeTemplateSettingsRequest) returns (UserCanSeeTemplateSettingsResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanAddOrganizationMember returns whether the user is authorized to add + // any members to the organization and the list of roles they can add. + rpc UserCanAddOrganizationMember(UserCanAddOrganizationMemberRequest) returns (UserCanAddOrganizationMemberResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanUpdateOrganizationMember returns whether the user is authorized to update + // any members' membership information in the organization and the list of roles they can update. + rpc UserCanUpdateOrganizationMember(UserCanUpdateOrganizationMemberRequest) returns (UserCanUpdateOrganizationMemberResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanRemoveOrganizationMember returns whether the user is authorized to remove + // any members from the organization and the list of roles they can remove. + rpc UserCanRemoveOrganizationMember(UserCanRemoveOrganizationMemberRequest) returns (UserCanRemoveOrganizationMemberResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanDeleteOrganization returns whether the user is authorized + // to delete an organization. + rpc UserCanDeleteOrganization(UserCanDeleteOrganizationRequest) returns (UserCanDeleteOrganizationResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanDeleteRepository returns whether the user is authorized + // to delete a repository. + rpc UserCanDeleteRepository(UserCanDeleteRepositoryRequest) returns (UserCanDeleteRepositoryResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanDeleteTemplate returns whether the user is authorized + // to delete a template. + rpc UserCanDeleteTemplate(UserCanDeleteTemplateRequest) returns (UserCanDeleteTemplateResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanDeletePlugin returns whether the user is authorized + // to delete a plugin. + rpc UserCanDeletePlugin(UserCanDeletePluginRequest) returns (UserCanDeletePluginResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanDeleteUser returns whether the user is authorized + // to delete a user. + rpc UserCanDeleteUser(UserCanDeleteUserRequest) returns (UserCanDeleteUserResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanSeeServerAdminPanel returns whether the user is authorized + // to see server admin panel. + rpc UserCanSeeServerAdminPanel(UserCanSeeServerAdminPanelRequest) returns (UserCanSeeServerAdminPanelResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UserCanManageRepositoryContributors returns whether the user is authorized to manage + // any contributors to the repository and the list of roles they can manage. + rpc UserCanManageRepositoryContributors(UserCanManageRepositoryContributorsRequest) returns (UserCanManageRepositoryContributorsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message UserCanCreateOrganizationRepositoryRequest { + // The ID of the organization for which to check + // whether the user is authorized. + string organization_id = 1; +} + +message UserCanCreateOrganizationRepositoryResponse { + bool authorized = 1; +} + +message UserCanSeeRepositorySettingsRequest { + // The ID of the repository for which to check + // whether the user is authorized. + string repository_id = 1; +} + +message UserCanSeeRepositorySettingsResponse { + bool authorized = 1; +} + +message UserCanSeeOrganizationSettingsRequest { + // The ID of the organization for which to check + // whether the user is authorized. + string organization_id = 1; +} + +message UserCanSeeOrganizationSettingsResponse { + bool authorized = 1; +} + +message UserCanReadPluginRequest { + option deprecated = true; + // The owner of the plugin. + string owner = 1; + // The name of the plugin. + string name = 2; +} + +message UserCanReadPluginResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanCreatePluginVersionRequest { + option deprecated = true; + // The owner of the plugin. + string owner = 1; + // The name of the plugin. + string name = 2; +} + +message UserCanCreatePluginVersionResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanCreateTemplateVersionRequest { + option deprecated = true; + // The owner of the template. + string owner = 1; + // The name of the template. + string name = 2; +} + +message UserCanCreateTemplateVersionResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanCreateOrganizationPluginRequest { + option deprecated = true; + // The ID of the organization for which to check + // whether the user is authorized. + string organization_id = 1; +} + +message UserCanCreateOrganizationPluginResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanCreateOrganizationTemplateRequest { + option deprecated = true; + // The ID of the organization for which to check + // whether the user is authorized. + string organization_id = 1; +} + +message UserCanCreateOrganizationTemplateResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanSeePluginSettingsRequest { + option deprecated = true; + // The owner of the plugin. + string owner = 1; + // The name of the plugin. + string name = 2; +} + +message UserCanSeePluginSettingsResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanSeeTemplateSettingsRequest { + option deprecated = true; + // The owner of the template. + string owner = 1; + // The name of the template. + string name = 2; +} + +message UserCanSeeTemplateSettingsResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanAddOrganizationMemberRequest { + // The ID of the organization for which to check + // whether the user is authorized. + string organization_id = 1; +} + +message UserCanAddOrganizationMemberResponse { + // The list of roles that the user is authorized to add, empty list means the user is + // not authorized to add any members. + repeated OrganizationRole authorized_roles = 1; +} + +message UserCanUpdateOrganizationMemberRequest { + // The ID of the organization for which to check + // whether the user is authorized. + string organization_id = 1; +} + +message UserCanUpdateOrganizationMemberResponse { + // The list of roles that the user is authorized to update (from and to), empty list means the user is + // not authorized to update any members' role. + repeated OrganizationRole authorized_roles = 1; +} + +message UserCanRemoveOrganizationMemberRequest { + // The ID of the organization for which to check + // whether the user is authorized. + string organization_id = 1; +} + +message UserCanRemoveOrganizationMemberResponse { + // The list of roles that the user is authorized to remove, empty list means the user is + // not authorized to remove any members. + repeated OrganizationRole authorized_roles = 1; +} + +message UserCanDeleteOrganizationRequest { + // The ID of the organization for which to check + // whether the user is authorized. + string organization_id = 1; +} + +message UserCanDeleteOrganizationResponse { + bool authorized = 1; +} + +message UserCanDeleteRepositoryRequest { + // The ID of the repository for which to check + // whether the user is authorized. + string repository_id = 1; +} + +message UserCanDeleteRepositoryResponse { + bool authorized = 1; +} + +message UserCanDeleteTemplateRequest { + option deprecated = true; + // The ID of the template for which to check + // whether the user is authorized. + string template_id = 1; +} + +message UserCanDeleteTemplateResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanDeletePluginRequest { + option deprecated = true; + // The ID of the plugin for which to check + // whether the user is authorized. + string plugin_id = 1; +} + +message UserCanDeletePluginResponse { + option deprecated = true; + bool authorized = 1; +} + +message UserCanDeleteUserRequest {} + +message UserCanDeleteUserResponse { + bool authorized = 1; +} + +message UserCanSeeServerAdminPanelRequest {} + +message UserCanSeeServerAdminPanelResponse { + bool authorized = 1; +} + +message UserCanManageRepositoryContributorsRequest { + // The ID of the repository for which to check + // whether the user is authorized. + string repository_id = 1; +} + +message UserCanManageRepositoryContributorsResponse { + // The list of roles that the user is authorized to manage, empty list means the user is + // not authorized to manage any contributors. + repeated RepositoryRole authorized_roles = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/convert.proto b/pkg/bufman/proto/registry/v1alpha1/convert.proto new file mode 100644 index 000000000..46584e6e2 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/convert.proto @@ -0,0 +1,39 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "image/v1/image.proto"; + +// The supported formats for the serialized message conversion. +enum ConvertFormat { + CONVERT_FORMAT_UNSPECIFIED = 0; + CONVERT_FORMAT_BIN = 1; + CONVERT_FORMAT_JSON = 2; +} + +// ConvertService coverts serialized messages +service ConvertService { + // Convert converts a serialized message according to + // the provided type name using an image. + rpc Convert(ConvertRequest) returns (ConvertResponse); +} + +message ConvertRequest { + // type_name is the full type name of the serialized message (like acme.weather.v1.Units). + string type_name = 1; + // image is the image source that defines the serialized message. + bufman.dubbo.apache.org.image.v1.Image image = 2; + // payload is the serialized Protobuf message. + bytes payload = 3; + // request_format is the format of the payload. + ConvertFormat request_format = 4; + // response_format is the desired format of the output result. + ConvertFormat response_format = 5; +} + +message ConvertResponse { + // payload is the converted serialized message in one of the supported formats. + bytes payload = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/display.proto b/pkg/bufman/proto/registry/v1alpha1/display.proto new file mode 100644 index 000000000..e367c70d6 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/display.proto @@ -0,0 +1,147 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/role.proto"; + +// DisplayService provides information regarding +// UI element displaying based on the users roles. +service DisplayService { + // DisplayOrganizationElements returns which organization elements should be displayed to the user. + rpc DisplayOrganizationElements(DisplayOrganizationElementsRequest) returns (DisplayOrganizationElementsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DisplayRepositoryElements returns which repository elements should be displayed to the user. + rpc DisplayRepositoryElements(DisplayRepositoryElementsRequest) returns (DisplayRepositoryElementsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DisplayUserElements returns which user elements should be displayed to the user. + rpc DisplayUserElements(DisplayUserElementsRequest) returns (DisplayUserElementsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DisplayServerElements returns which server elements should be displayed to the user. + rpc DisplayServerElements(DisplayServerElementsRequest) returns (DisplayServerElementsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + + // DisplayOwnerEntitledElements returns which owner elements are entitled to be displayed to the user. + rpc DisplayOwnerEntitledElements(DisplayOwnerEntitledElementsRequest) returns (DisplayOwnerEntitledElementsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DisplayRepositoryEntitledElements returns which repository elements are entitled to be displayed to the user. + rpc DisplayRepositoryEntitledElements(DisplayRepositoryEntitledElementsRequest) returns (DisplayRepositoryEntitledElementsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + + // ListManageableRepositoryRoles returns which roles should be displayed + // to the user when they are managing contributors on the repository. + rpc ListManageableRepositoryRoles(ListManageableRepositoryRolesRequest) returns (ListManageableRepositoryRolesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListManageableUserRepositoryRoles returns which roles should be displayed + // to the user when they are managing a specific contributor on the repository. + rpc ListManageableUserRepositoryRoles(ListManageableUserRepositoryRolesRequest) returns (ListManageableUserRepositoryRolesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message DisplayOrganizationElementsRequest { + // The ID of the organization for which to check + // which elements should be displayed. + string organization_id = 1; +} + +message DisplayOrganizationElementsResponse { + // Display create organization repository element if true. + bool create_repository = 1; + // Display create organization plugin element if true. + bool create_plugin = 2 [deprecated = true]; + // Display create organization template element if true. + bool create_template = 3 [deprecated = true]; + // Display organization settings element if true. + bool settings = 4; + // Display update organization settings element if true. + bool update_settings = 5; + // Display delete organization element if true. + bool delete = 6; +} + +message DisplayRepositoryElementsRequest { + // The ID of the repository for which to check + // which elements should be displayed. + string repository_id = 1; +} + +message DisplayRepositoryElementsResponse { + // Display repository settings element if true. + bool settings = 1; + // Display delete repository element if true. + bool delete = 2; + // Display write repository element if true. + bool write = 3; +} + +message DisplayUserElementsRequest {} + +message DisplayUserElementsResponse { + // Display delete user element if true. + bool delete = 1; +} + +message DisplayServerElementsRequest {} + +message DisplayServerElementsResponse { + // Display server admin panel element if true. + bool admin_panel = 1; +} + +message DisplayOwnerEntitledElementsRequest { + // The name of the owner for which to check + // which elements are entitled to be displayed. + string owner_name = 1; +} + +message DisplayOwnerEntitledElementsResponse { + // Display create private repository element if true. + bool create_private_repository = 1; +} + +message DisplayRepositoryEntitledElementsRequest { + // The ID of the repository for which to check + // which elements are entitled to be displayed. + string repository_id = 1; +} + +message DisplayRepositoryEntitledElementsResponse { + // Display repository change to private setting element if true. + bool set_private = 1; +} + +message ListManageableRepositoryRolesRequest { + // The ID of the repository for which to check + // which roles should be displayed as manageable. + string repository_id = 1; +} + +message ListManageableRepositoryRolesResponse { + // The list of roles that should be displayed + // to the user as manageable. + repeated RepositoryRole roles = 1; +} + +message ListManageableUserRepositoryRolesRequest { + // The ID of the repository for which to check + // which roles should be displayed as manageable. + string repository_id = 1; + // The ID of the target user for which to check + // which roles are manageable. + string user_id = 2; +} + +message ListManageableUserRepositoryRolesResponse { + // The list of roles that should be displayed + // to the user as manageable. + repeated RepositoryRole roles = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/doc.proto b/pkg/bufman/proto/registry/v1alpha1/doc.proto new file mode 100644 index 000000000..8acfeaa6c --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/doc.proto @@ -0,0 +1,397 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +// DocService defines a set of APIs that are intended for use by bufwebd only. +// This is not intended for general use; changes and use cases are subject to executive approval. +service DocService { + // GetSourceDirectoryInfo retrieves the directory and file structure for the + // given owner, repository and reference. + // + // The purpose of this is to get a representation of the file tree for a given + // module to enable exploring the module by navigating through its contents. + rpc GetSourceDirectoryInfo(GetSourceDirectoryInfoRequest) returns (GetSourceDirectoryInfoResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetSourceFile retrieves the source contents for the given owner, repository, + // reference, and path. + rpc GetSourceFile(GetSourceFileRequest) returns (GetSourceFileResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetModulePackages retrieves the list of packages for the module based on the given + // owner, repository, and reference. + rpc GetModulePackages(GetModulePackagesRequest) returns (GetModulePackagesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetModuleDocumentation retrieves the documentations including buf.md and LICENSE files + // for module based on the given owner, repository, and reference. + rpc GetModuleDocumentation(GetModuleDocumentationRequest) returns (GetModuleDocumentationResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetPackageDocumentation retrieves a a slice of documentation structures + // for the given owner, repository, reference, and package name. + rpc GetPackageDocumentation(GetPackageDocumentationRequest) returns (GetPackageDocumentationResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +// GetSourceDirectoryInfoRequest takes an owner, repository, and reference. +message GetSourceDirectoryInfoRequest { + string owner = 1; + string repository = 2; + string reference = 3; +} + +// GetSourceDirectoryInfoResponse returns the root FileInfo for the requested module. +message GetSourceDirectoryInfoResponse { + FileInfo root = 1; +} + +// FileInfo is a nested structure that contains the file path, whether or not it's a directory, +// and if so, the FileInfo children of that directory. +message FileInfo { + // the normalized path of the directory, relative to the root of the module. + string path = 1; + bool is_dir = 2; + repeated FileInfo children = 3; +} + +// GetSourceFileRequest takes an owner, repository, reference, and normalized path. +message GetSourceFileRequest { + string owner = 1; + string repository = 2; + string reference = 3; + // the normalized path to the requested file, relative to the root of the module. + string path = 4; +} + +// GetSourceFileResponse returns the source code contents of the requested file. +message GetSourceFileResponse { + // content is the content of the file. + bytes content = 1; +} + +// GetModulePackagesRequest takes an owner, repository, and reference. +message GetModulePackagesRequest { + string owner = 1; + string repository = 2; + string reference = 3; +} + +// GetModulePackagesResponse returns the list of ModulePackages for the requested module. +message GetModulePackagesResponse { + string name = 1; + repeated ModulePackage module_packages = 2; +} + +// ModulePackage provides the details about a module's associated package. +message ModulePackage { + string name = 1; + string description = 2; +} + +// GetModuleDocumentationRequest takes an owner, repository, and reference. +message GetModuleDocumentationRequest { + string owner = 1; + string repository = 2; + string reference = 3; +} + +// GetModuleDocumentationResponse returns the ModuleDocumentation for the requested module. +message GetModuleDocumentationResponse { + ModuleDocumentation module_documentation = 1; +} + +// ModuleDocumentation provides the name of the module and associated documentations. +message ModuleDocumentation { + string name = 1; + // This is the string representation of the contents of the buf.md file for module-level documentation. + // + // The buf.md file is a part of the module. + // string is used to enforce UTF-8 encoding or 7-bit ASCII text. + string documentation = 3; + // This is the string representation of the contents of the LICENSE file for module-level license. + // + // The LICENSE file is a part of the module. + // string is used to enforce UTF-8 encoding or 7-bit ASCII text. + string license = 4; + // documentation_path is the path of the file which contains the module documentation. + // + // either `buf.md`, `README.md` or `README.markdown`. + // if empty, assumes buf.md. + string documentation_path = 5; +} + +// GetPackageDocumentationRequest takes an owner, repository, reference, and package name. +message GetPackageDocumentationRequest { + string owner = 1; + string repository = 2; + string reference = 3; + // this is the fully qualified package name. + string package_name = 4; +} + +// GetPackageDocumentationReponse returns the documentation for the requested package. +message GetPackageDocumentationResponse { + PackageDocumentation package_documentation = 1; +} + +// PackageDocumentation provides the name, description, and top level types defined in the package. +message PackageDocumentation { + string name = 1; + // description contains the package-level comment documentation. + // There is currently no convention for this. + // + // This is derived from the leading comments at the top level of the package. + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + string description = 2; + // services contains all the services defined in the package in alphabetical order. + repeated Service services = 3; + // enums contains all the enums defined in the package in alphabetical order. + repeated Enum enums = 4; + // messages contains all the messages defined in the package in alphabetical order. + repeated Message messages = 5; + // extensions contains all the file level extensions in the package in alphabetical order. + repeated FileExtension file_extensions = 6; +} + +// Location provides the location information for the source code. +// +// This does not provide the leading or trailing comments as these will +// be parsed into descriptions or dropped respectively. +message Location { + int32 start_line = 1; + int32 start_column = 2; + int32 end_line = 3; + int32 end_column = 4; +} + +// Service provides information for the documentation for a given service type in a file. +message Service { + string name = 1; + // nested_name includes the nested types for a given type definition. + string nested_name = 2; + // full_name includes the package name and nested types for a given type definition. + string full_name = 3; + // description is derived from the leading comments of a given service. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + string description = 4; + // file_path is the normalized path of the file containing the service. + // This is used for navigating to the source code for the service. + string file_path = 5; + Location location = 6; + repeated Method methods = 7; + ServiceOptions service_options = 8; + // implicitly_deprecated is true if its enclosing file is deprecated. + bool implicitly_deprecated = 9; +} + +// ServiceOptions provides information for the documentation of options for a given service. +message ServiceOptions { + bool deprecated = 1; +} + +// Method provides information for the documentation for a method of a given service. +message Method { + string name = 1; + // description is derived from the leading comments of a given method. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + string description = 2; + MethodRequestResponse request = 3; + MethodRequestResponse response = 4; + MethodOptions method_options = 5; + // implicitly_deprecated is true if its enclosing file or parent element is deprecated. + bool implicitly_deprecated = 6; +} + +// MethodOptions provides information for the documentation of options for a method. +message MethodOptions { + bool deprecated = 1; + // idempotency_level holds a value of the enumeration `google.protobuf.MethodOptions.IdempotencyLevel. + int32 idempotency_level = 2; +} + +// MethodRequestResponse provides information for the documentation of a Method request or response message. +message MethodRequestResponse { + // nested_type is the nested name of the message of the request or response. This includes nested definitions. + string nested_type = 1; + // full_type is the fully qualified name of the message of the request or response. This includes package and nested definitions. + string full_type = 2; + // boolean flag for whether the streaming label is set on an method request or response. + bool streaming = 3; + Message message = 4; + // import_module_ref is included if the request or response is an imported type. + // It contains all the metadata for the import. + ImportModuleRef import_module_ref = 5; +} + +// Enum provides information for the documentation of an enum. +message Enum { + string name = 1; + // nested_name includes the nested types for a given type definition. + string nested_name = 2; + // full_name includes the package name and nested types for a given type definition. + string full_name = 3; + // description is derived from the leading comments of a given Enum. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + string description = 4; + // file_path is the normalized path of the file containing the enum. + string file_path = 5; + Location location = 6; + repeated EnumValue values = 7; + EnumOptions enum_options = 8; + // implicitly_deprecated is true if its enclosing file or parent element is deprecated. + bool implicitly_deprecated = 9; +} + +// EnumOptions provides information for the documentation of options for an enum. +message EnumOptions { + bool deprecated = 1; + bool allow_alias = 2; +} + +// EnumValue provides information for the documentation of an enum value. +message EnumValue { + string name = 1; + int32 number = 2; + // description is derived from the leading comments of a given enum value. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + string description = 3; + EnumValueOptions enum_value_options = 4; +} + +// EnumValueOptions provides information for the documentation of options for an enum value. +message EnumValueOptions { + bool deprecated = 1; +} + +// ImportRef provides the import metadata if a type is imported. +message ImportModuleRef { + string remote = 1; + string owner = 2; + string repository = 3; + // the commit is based on the module commit of the imported type provided + // by the image. + string commit = 4; + string package_name = 5; +} + +// Message provides information for the documentation of a protobuf message. +message Message { + string name = 1; + // nested_name includes the nested types for a given type definition. + string nested_name = 2; + // full_name includes the package name and nested types for a given type definition. + string full_name = 3; + // description is derived from the leading comments of a given message. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + string description = 4; + // file_path is the normalized path of the file containing the message. + string file_path = 5; + bool is_map_entry = 6; + repeated MessageField fields = 7; + Location location = 8; + repeated Field message_extensions = 9; + MessageOptions message_options = 10; + // implicitly_deprecated is true if its enclosing file or parent element is deprecated. + bool implicitly_deprecated = 11; +} + +// MessageField can be either a single field or a oneof set of fields. +message MessageField { + oneof message_field { + Field field = 1; + Oneof oneof = 2; + } +} + +// MessageOptions provides information for the documentation of options for a message. +message MessageOptions { + bool deprecated = 1; +} + +// Oneof represents a oneof set of fields. +message Oneof { + string name = 1; + repeated Field fields = 2; +} + +// Field provides information for the documentation of a message field. +message Field { + string name = 1; + // description is derived from the leading comments of a given message field. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + string description = 2; + string label = 3; + // string representation of the nested name of the field type, which includes nested definitions. + string nested_type = 4; + // string representation of the full name of the field type, which includes package name + // and nested definitions. + string full_type = 5; + uint32 tag = 6; + // MapEntry is present if the field is a map type. + MapEntry map_entry = 7; + // import_module_ref is included if the field is an imported type. + // It contains all the metadata for the import. + ImportModuleRef import_module_ref = 8; + // Extendee is the name of the type that is being extended if the field is an extension. + // This is an empty string for fields that are not extenions. + string extendee = 9; + FieldOptions field_options = 10; +} + +// FieldOptions provides information for the documentation of options for a field. +message FieldOptions { + bool deprecated = 1; + optional bool packed = 2; + // ctype holds a value of the enumeration `google.protobuf.FieldOptions.CType. + int32 ctype = 3; + // jstype holds a value of the enumeration `google.protobuf.FieldOptions.JSType. + int32 jstype = 4; +} + +// MapEntry provides the key and value types for the MapEntry type for a map field. +message MapEntry { + // string representation of the full name of the type for the map key. keys can only be + // scalar types: https://developers.google.com/protocol-buffers/docs/overview#maps + string key_full_type = 1; + // string representation of the nested name of the type for the map value. + string value_nested_type = 2; + // string representation of the full name of the type for the map value. + string value_full_type = 3; + // if the value is an imported type, this is the import module ref + ImportModuleRef value_import_module_ref = 4; +} + +// FileExtension provides the information for the documentation of a file extension. +message FileExtension { + // extension_type is the string representation of the type being extended. + string extension_type = 1; + // description is derived from the leading comments of a given message field. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + string description = 2; + // file_path is the normalized path of the file containing the message. + string file_path = 3; + Location location = 4; + // fields are all the fields that are associated with the extension. + repeated Field fields = 5; + // implicitly_deprecated is true if its enclosing file or parent element is deprecated. + bool implicitly_deprecated = 6; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/docker.proto b/pkg/bufman/proto/registry/v1alpha1/docker.proto new file mode 100644 index 000000000..03d109656 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/docker.proto @@ -0,0 +1,131 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +// manage docker repo access service +service DockerRepoService { + // CreateDockerRepo create a docker repo for user + // + // This method requires authentication. + rpc CreateDockerRepo(CreateDockerRepoRequest) returns (CreateDockerRepoResponse) { + option idempotency_level = IDEMPOTENT; + } + // GetDockerRepo get a user's docker repo by id + // + // This method requires authentication. + rpc GetDockerRepo(GetDockerRepoRequest) returns (GetDockerRepoResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetDockerRepoByName get a user's docker repo by name + // + // This method requires authentication. + rpc GetDockerRepoByName(GetDockerRepoByNameRequest) returns (GetDockerRepoByNameResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListDockerRepos lists the user's all docker repo entries + // + // This method requires authentication. + rpc ListDockerRepos(ListDockerReposRequest) returns (ListDockerReposResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UpdateDockerRepoByName given a name, to update address、username、password + // + // This method requires authentication. + rpc UpdateDockerRepoByName(UpdateDockerRepoByNameRequest) returns (UpdateDockerRepoByNameResponse) { + option idempotency_level = IDEMPOTENT; + } + // UpdateDockerRepoByName given a id, to update address、username、password + // + // This method requires authentication. + rpc UpdateDockerRepoByID(UpdateDockerRepoByIDRequest) returns (UpdateDockerRepoByIDResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +message DockerRepo { + string id = 1; + string name = 2; + string address = 3; + string username = 4; + google.protobuf.Timestamp create_time = 5; + google.protobuf.Timestamp update_time = 6; + string note = 7; +} + +message CreateDockerRepoRequest { + string name = 1; + string address = 2; + string username = 3; + string password = 4; + string note = 5; +} + +message CreateDockerRepoResponse { + DockerRepo docker_repo = 1; +} + +message GetDockerRepoRequest { + string id = 1; +} + +message GetDockerRepoResponse { + DockerRepo docker_repo = 1; +} + +message GetDockerRepoByNameRequest { + string name = 1; +} + +message GetDockerRepoByNameResponse { + DockerRepo docker_repo = 1; +} + +message ListDockerReposRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; +} + +message ListDockerReposResponse { + repeated DockerRepo docker_repos = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message UpdateDockerRepoByIDRequest { + // given a id, to update address、username、password + string id = 1; + string address = 3; + string username = 4; + string password = 5; +} + +message UpdateDockerRepoByIDResponse {} + +message UpdateDockerRepoByNameRequest { + // given a name, to update address、username、password + string name = 1; + string address = 3; + string username = 4; + string password = 5; +} + +message UpdateDockerRepoByNameResponse {} \ No newline at end of file diff --git a/pkg/bufman/proto/registry/v1alpha1/download.proto b/pkg/bufman/proto/registry/v1alpha1/download.proto new file mode 100644 index 000000000..4177ccdc1 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/download.proto @@ -0,0 +1,48 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "module/v1alpha1/module.proto"; + +// DownloadService is the download service. +service DownloadService { + // Download downloads a BSR module. + // NOTE: Newer clients should use DownloadManifestAndBlobs instead. + rpc Download(DownloadRequest) returns (DownloadResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DownloadManifestAndBlobs downloads a module in the manifest+blobs encoding format. + rpc DownloadManifestAndBlobs(DownloadManifestAndBlobsRequest) returns (DownloadManifestAndBlobsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +// DownloadRequest specifies the module to download. +message DownloadRequest { + string owner = 1; + string repository = 2; + string reference = 3; +} + +// DownloadResponse contains the remote module. +message DownloadResponse { + bufman.dubbo.apache.org.module.v1alpha1.Module module = 1; +} + +// DownloadManifestAndBlobsRequest specifies the module to download. +message DownloadManifestAndBlobsRequest { + string owner = 1; + string repository = 2; + string reference = 3; +} + +// DownloadManifestAndBlobsResponse is the returned resolved remote module. +message DownloadManifestAndBlobsResponse { + // manifest is the manifest of the module's content. + bufman.dubbo.apache.org.module.v1alpha1.Blob manifest = 1; + // blobs is a set of blobs that closes on the module's manifest to form the + // complete module's content. + repeated bufman.dubbo.apache.org.module.v1alpha1.Blob blobs = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/generate.proto b/pkg/bufman/proto/registry/v1alpha1/generate.proto new file mode 100644 index 000000000..4c282cbbe --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/generate.proto @@ -0,0 +1,125 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "image/v1/image.proto"; +import "google/protobuf/compiler/plugin.proto"; + +// replaced with CodeGenerationService in plugin_curation.proto. +option deprecated = true; + +// File defines a file with a path and some content. +message File { + // path is the relative path of the file. + // Path can only use '/' as the separator character, and includes no ".." components. + string path = 1; + // content is the content of the file. + bytes content = 2; +} + +// RuntimeLibrary describes a pinned runtime library dependency of the generated code. +message RuntimeLibrary { + // The name of the runtime library dependency. The format should match the + // format used for dependencies in the dependency management tooling of the + // associated language ecosystem. This is set by the user using Dockerfile Labels. + // For example, for the plugin "protoc-gen-go", this might be "google.golang.org/protobuf". + string name = 1; + // The version of the runtime library dependency associated with the generated + // code. The format should match the format used for dependency versions in the + // dependency management tooling of the associated language ecosystem. + // This is set by the user using Dockerfile Labels. + // For example, for the plugin "protoc-gen-go", this might be "v1.26.0". + string version = 2; +} + +message PluginReference { + // The owner of the plugin which identifies the + // plugins to use with this generation. + string owner = 1; + // The name of the plugin which identifies the + // plugins to use with this generation. + string name = 2; + // The plugin version to use with this generation. + string version = 3; + // The parameters to pass to the plugin. These will + // be merged into a single, comma-separated string. + repeated string parameters = 4; +} + +// GenerateService manages remote generation requests. +service GenerateService { + // GeneratePlugins generates an array of files given the provided + // module reference and plugin version and option tuples. No attempt + // is made at merging insertion points. + rpc GeneratePlugins(GeneratePluginsRequest) returns (GeneratePluginsResponse); + // GenerateTemplate generates an array of files given the provided + // module reference and template version. + rpc GenerateTemplate(GenerateTemplateRequest) returns (GenerateTemplateResponse); +} + +message GeneratePluginsRequest { + // The image to run plugins against to generate the desired file outputs. + // + // All image files that are not imports and not well-known types will be generated. + // If you want to filter what files are generated, modify the image. + // If you want to include imports, set include_imports. + bufman.dubbo.apache.org.image.v1.Image image = 1; + // The array of plugins to use. + repeated PluginReference plugins = 2; + // Include imports from the Image in generation. + bool include_imports = 3; + // Include Well-Known Types from the Image in generation. + // + // include_imports must be set if include_well_known_types is set. + bool include_well_known_types = 4; +} + +message GeneratePluginsResponse { + // Contains all the responses from the generated plugins. The order + // is defined by the order of the plugins in the request. + repeated google.protobuf.compiler.CodeGeneratorResponse responses = 1; + // An optional array defining runtime libraries that the generated code + // requires to run, as specified by the plugin author. This may contain + // duplicate entries as the generation can be the result of multiple plugins, + // each of which declares its own runtime library dependencies. The libraries + // returned are lexicographically ordered by their name, but not deduplicated. + // How to handle duplicate libraries is left to the user. + repeated RuntimeLibrary runtime_libraries = 2; +} + +message GenerateTemplateRequest { + // The image to run plugins against to generate the desired file outputs. + // + // All image files that are not imports and not well-known types will be generated. + // If you want to filter what files are generated, modify the image. + // If you want to include imports, set include_imports. + bufman.dubbo.apache.org.image.v1.Image image = 1; + // The owner of the template which identifies the + // plugins to use with this generation. + string template_owner = 2; + // The name of the template which identifies the + // plugins to use with this generation. + string template_name = 3; + // The template version to use to determine the + // plugin versions in the template. + string template_version = 4; + // Include imports from the Image in generation. + bool include_imports = 5; + // Include Well-Known Types from the Image in generation. + // + // include_imports must be set if include_well_known_types is set. + bool include_well_known_types = 6; +} + +message GenerateTemplateResponse { + // files contains all the files output by the generation, + // in lexicographical order. + repeated File files = 1; + // An optional array defining runtime libraries that the generated code + // requires to run. This may contain duplicate entries as the generation + // can be the result of multiple plugins, each of which declares its own + // runtime library dependencies. + repeated RuntimeLibrary runtime_libraries = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/git_metadata.proto b/pkg/bufman/proto/registry/v1alpha1/git_metadata.proto new file mode 100644 index 000000000..98a68ada5 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/git_metadata.proto @@ -0,0 +1,31 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +// GitIdentity is a Git user identity, typically either an author or a commiter. +message GitIdentity { + // Name is the name of the Git identity. This is not the BSR user's username. + string name = 1; + // Email is the email of the Git identity. This is not the BSR user's email. + string email = 2; + // Time is the time at which this identity was captured. + google.protobuf.Timestamp time = 3; +} + +// GitCommitMetadata is Git metadata associated with a BSR commit. +message GitCommitMetadata { + // Hash is the SHA1 has of the Git commit. + string hash = 1; + // Author is the author of the Git commit. This is typically an end-user. + GitIdentity author = 2; + // Commiter is the commiter of the Git commit. This typically a CI system. + GitIdentity commiter = 3; + // Branch is the Git branch to which this Git commit belongs. + string branch = 4; + // Tags are the Git tags which point to this commit. + repeated string tags = 5; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/github.proto b/pkg/bufman/proto/registry/v1alpha1/github.proto new file mode 100644 index 000000000..12b6f03f9 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/github.proto @@ -0,0 +1,23 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +message GithubAppConfig { + string app_id = 1; +} + +message GetGithubAppConfigRequest {} + +message GetGithubAppConfigResponse { + GithubAppConfig app_config = 1; +} + +// GithubService is the service used to interact with Github-related information +service GithubService { + // GetGithubAppConfig returns a Github Application Configuration. + rpc GetGithubAppConfig(GetGithubAppConfigRequest) returns (GetGithubAppConfigResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} diff --git a/pkg/bufman/proto/registry/v1alpha1/image.proto b/pkg/bufman/proto/registry/v1alpha1/image.proto new file mode 100644 index 000000000..cb7b8b960 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/image.proto @@ -0,0 +1,67 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "image/v1/image.proto"; + +// ImageService serves compiled images. +service ImageService { + // GetImage serves a compiled image for the local module. It automatically + // downloads dependencies if necessary. + rpc GetImage(GetImageRequest) returns (GetImageResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +// ImageMask is used in GetImageRequest to specify which parts of an image +// should be masked in responses. +enum ImageMask { + IMAGE_MASK_UNSPECIFIED = 0; + + // IMAGE_MASK_MESSAGES refers to ImageFile's `google.protobuf.DescriptorProto + // message_type` field. + IMAGE_MASK_MESSAGES = 1; + + // IMAGE_MASK_ENUMS refers to ImageFile's `google.protobuf.EnumDescriptorProto + // enum_type` field. + IMAGE_MASK_ENUMS = 2; + + // IMAGE_MASK_SERVICES refers to ImageFile's + // `google.protobuf.ServiceDescriptorProto service` field. + IMAGE_MASK_SERVICES = 3; +} + +message GetImageRequest { + string owner = 1; + string repository = 2; + string reference = 3; + + // Exclude files from imported buf modules in this image. + bool exclude_imports = 4; + + // Exclude source_code_info fields from each ImageFile. + bool exclude_source_info = 5; + + // When specified the returned image will only contain the necessary files and + // descriptors in those files to describe these types. Accepts messages, enums + // and services. All types must be defined in the buf module, types in + // dependencies are not accepted. + // + // At this time specifying `types` requires `exclude_source_info` to be set to + // true. + repeated string types = 6; + + // When not empty, the returned image's files will only include + // *DescriptorProto fields for the elements specified here. The masks are + // applied without regard for dependencies between types. For example, if + // `IMAGE_MASK_MESSAGES` is specified without `IMAGE_MASK_ENUMS` the resulting + // image will NOT contain enum definitions even if they are referenced from + // message fields. + repeated ImageMask include_mask = 7; +} + +message GetImageResponse { + bufman.dubbo.apache.org.image.v1.Image image = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/jsonschema.proto b/pkg/bufman/proto/registry/v1alpha1/jsonschema.proto new file mode 100644 index 000000000..43c1b9e77 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/jsonschema.proto @@ -0,0 +1,34 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +// JSONSchemaService serves JSONSchemas describing protobuf types in buf +// modules. +service JSONSchemaService { + // GetJSONSchema allows users to get an (approximate) json schema for a + // protobuf type. + rpc GetJSONSchema(GetJSONSchemaRequest) returns (GetJSONSchemaResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message GetJSONSchemaRequest { + string owner = 1; + string repository = 2; + string reference = 3; + + // A fully qualified name of the type to generate a JSONSchema for, e.g. + // "pkg.foo.Bar". The type needs to resolve in the referenced module or any of + // its dependencies. Currently only messages types are supported. + string type_name = 4; +} + +message GetJSONSchemaResponse { + // A json schema representing what the json encoded payload for type_name + // should conform to. This schema is an approximation to be used by editors + // for validation and autocompletion, not a lossless representation of the + // type's descriptor. + bytes json_schema = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/labels.proto b/pkg/bufman/proto/registry/v1alpha1/labels.proto new file mode 100644 index 000000000..82702ce53 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/labels.proto @@ -0,0 +1,70 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +enum LabelNamespace { + LABEL_NAMESPACE_UNSPECIFIED = 0; + LABEL_NAMESPACE_TAG = 1; + LABEL_NAMESPACE_BRANCH = 2; + LABEL_NAMESPACE_GIT_COMMIT = 3; + LABEL_NAMESPACE_REVIEW = 4; + LABEL_NAMESPACE_BSR_HEAD = 5; +} + +message Label { + LabelName label_name = 1; + LabelValue label_value = 2; +} + +message LabelName { + LabelNamespace namespace = 1; + string name = 2; +} + +message LabelValue { + string commit_id = 1; +} + +service LabelService { + rpc CreateLabel(CreateLabelRequest) returns (CreateLabelResponse) { + option idempotency_level = IDEMPOTENT; + } + rpc MoveLabel(MoveLabelRequest) returns (MoveLabelResponse); + rpc GetLabels(GetLabelsRequest) returns (GetLabelsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message CreateLabelRequest { + LabelName label_name = 1; + LabelValue label_value = 2; + optional string author = 3; + optional google.protobuf.Timestamp create_time = 4; +} + +message CreateLabelResponse { + LabelValue commit_id = 1; +} + +message MoveLabelRequest { + LabelName label_name = 1; + optional LabelValue from = 2; + LabelValue to = 3; +} + +message MoveLabelResponse {} + +message GetLabelsRequest { + string repository_owner = 1; + string repository_name = 2; + optional LabelName label_name = 3; + optional LabelValue label_value = 4; +} + +message GetLabelsResponse { + repeated Label labels = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/module.proto b/pkg/bufman/proto/registry/v1alpha1/module.proto new file mode 100644 index 000000000..56ca58db1 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/module.proto @@ -0,0 +1,34 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +// LocalModuleReference is a local module reference. +// +// It does not include a remote. +message LocalModuleReference { + string owner = 1; + string repository = 2; + // either branch or commit + string reference = 3; +} + +// LocalModulePin is a local module pin. +// +// It does not include a remote. +message LocalModulePin { + reserved 5; + reserved "digest"; + + string owner = 1; + string repository = 2; + string branch = 3; + string commit = 4; + // Module's manifest digest. Replacement for previous b1/b3 digests. + string manifest_digest = 6; + google.protobuf.Timestamp create_time = 7; + string draft_name = 8; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/organization.proto b/pkg/bufman/proto/registry/v1alpha1/organization.proto new file mode 100644 index 000000000..b745df778 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/organization.proto @@ -0,0 +1,264 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/role.proto"; +import "registry/v1alpha1/verification_status.proto"; +import "google/protobuf/timestamp.proto"; + +message Organization { + // primary key, unique, immutable + string id = 1; + // immutable + google.protobuf.Timestamp create_time = 2; + // mutable + google.protobuf.Timestamp update_time = 3; + // unique, mutable + string name = 4; + // description is the user configurable description of the organization. + string description = 5; + // url is the user configurable URL in the description of the organization, + // always included the scheme and will not have a #fragment suffix. + string url = 6; + // verification status of the organization, configurable by server admin. + VerificationStatus verification_status = 7; +} + +// OrganizationMembership is a nested structure that contains +// the organization and user membership information on that organization. +message OrganizationMembership { + Organization organization = 1; + OrganizationRole organization_role = 2; +} + +// OrganizationService is the Organization service. +service OrganizationService { + // GetOrganization gets a organization by ID. + rpc GetOrganization(GetOrganizationRequest) returns (GetOrganizationResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetOrganizationByName gets a organization by name. + rpc GetOrganizationByName(GetOrganizationByNameRequest) returns (GetOrganizationByNameResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListOrganizations lists all organizations. + rpc ListOrganizations(ListOrganizationsRequest) returns (ListOrganizationsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListUserOrganizations lists all organizations a user is member of. + rpc ListUserOrganizations(ListUserOrganizationsRequest) returns (ListUserOrganizationsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + rpc GetUserOrganization(GetUserOrganizationRequest) returns (GetUserOrganizationResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // CreateOrganization creates a new organization. + rpc CreateOrganization(CreateOrganizationRequest) returns (CreateOrganizationResponse) { + option idempotency_level = IDEMPOTENT; + } + // DeleteOrganization deletes a organization. + rpc DeleteOrganization(DeleteOrganizationRequest) returns (DeleteOrganizationResponse) { + option idempotency_level = IDEMPOTENT; + } + // DeleteOrganizationByName deletes a organization by name. + rpc DeleteOrganizationByName(DeleteOrganizationByNameRequest) returns (DeleteOrganizationByNameResponse) { + option idempotency_level = IDEMPOTENT; + } + // AddOrganizationMember add a role to an user in the organization. + rpc AddOrganizationMember(AddOrganizationMemberRequest) returns (AddOrganizationMemberResponse) { + option idempotency_level = IDEMPOTENT; + } + // UpdateOrganizationMember update the user's membership information in the organization. + rpc UpdateOrganizationMember(UpdateOrganizationMemberRequest) returns (UpdateOrganizationMemberResponse); + // RemoveOrganizationMember remove the role of an user in the organization. + rpc RemoveOrganizationMember(RemoveOrganizationMemberRequest) returns (RemoveOrganizationMemberResponse) { + option idempotency_level = IDEMPOTENT; + } + // SetOrganizationMember sets the role of a user in the organization. + rpc SetOrganizationMember(SetOrganizationMemberRequest) returns (SetOrganizationMemberResponse); + // GetOrganizationSettings gets the settings of an organization, including organization base roles. + rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (GetOrganizationSettingsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UpdateOrganizationSettings update the organization settings including base roles. + rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (UpdateOrganizationSettingsResponse); + // AddOrganizationGroup adds an IdP Group to the organization. + rpc AddOrganizationGroup(AddOrganizationGroupRequest) returns (AddOrganizationGroupResponse) { + option idempotency_level = IDEMPOTENT; + } + // RemoveOrganizationGroup removes an IdP Group from the organization. + rpc RemoveOrganizationGroup(RemoveOrganizationGroupRequest) returns (RemoveOrganizationGroupResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +message GetOrganizationRequest { + string id = 1; +} + +message GetOrganizationResponse { + Organization organization = 1; +} + +message GetOrganizationByNameRequest { + string name = 1; +} + +message GetOrganizationByNameResponse { + Organization organization = 1; +} + +message ListOrganizationsRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; +} + +message ListOrganizationsResponse { + repeated Organization organizations = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListUserOrganizationsRequest { + // The ID of the user whose organizations should be listed. + string user_id = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListUserOrganizationsResponse { + repeated OrganizationMembership organizations = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message GetUserOrganizationRequest { + // The ID of the user whose membership should be retrieved. + string user_id = 1; + // The ID of the organization. + string organization_id = 2; +} + +message GetUserOrganizationResponse { + OrganizationMembership organization_membership = 1; +} + +message CreateOrganizationRequest { + // Must be unique across organizations. + string name = 1; +} + +message CreateOrganizationResponse { + Organization organization = 1; +} + +message DeleteOrganizationRequest { + string id = 1; +} + +message DeleteOrganizationResponse {} + +message DeleteOrganizationByNameRequest { + string name = 1; +} + +message DeleteOrganizationByNameResponse {} + +message AddOrganizationMemberRequest { + // The ID of the organization for which the user will be added to. + string organization_id = 1; + // The ID of the user for which to be added to the organization. + string user_id = 2; + // The new role of the user in the organization. + OrganizationRole organization_role = 3; +} + +message AddOrganizationMemberResponse {} + +message UpdateOrganizationMemberRequest { + // The ID of the organization for which the member belongs to. + string organization_id = 1; + // The ID of the user for which to be updated the role. + string user_id = 2; + // The new role of the user in the organization. + OrganizationRole organization_role = 3; +} + +message UpdateOrganizationMemberResponse {} + +message RemoveOrganizationMemberRequest { + // The ID of the organization for which the member belongs to. + string organization_id = 1; + // The ID of the user for which to be removed the role. + string user_id = 2; +} + +message RemoveOrganizationMemberResponse {} + +message SetOrganizationMemberRequest { + // The ID of the organization for which the user's role will be set. + string organization_id = 1; + // The ID of the user whose role will be set. + string user_id = 2; + // The role to assign to the user. + // Setting UNSPECIFIED means removing the user's role. + OrganizationRole organization_role = 3; +} + +message SetOrganizationMemberResponse {} + +message GetOrganizationSettingsRequest { + // The ID of the organization for which to get the settings. + string organization_id = 1; +} + +message GetOrganizationSettingsResponse { + RepositoryRole repository_base_role = 1; + PluginRole plugin_base_role = 2 [deprecated = true]; + TemplateRole template_base_role = 3 [deprecated = true]; + // The number of members in the organization. + uint32 members_count = 4; + // The IdP groups associated with the organization. + repeated string idp_groups = 5; +} + +message UpdateOrganizationSettingsRequest { + // The ID of the organization for which to update the base roles. + string organization_id = 1; + // optional, no update to this base role will be made if this is unspecified. + RepositoryRole repository_base_role = 2; + // optional, no update to this base role will be made if this is unspecified. + PluginRole plugin_base_role = 3 [deprecated = true]; + // optional, no update to this base role will be made if this is unspecified. + TemplateRole template_base_role = 4 [deprecated = true]; + // optional, update to description will only be made when this is present + optional string description = 5; + // optional, update to url will only be made when this is present + optional string url = 6; +} + +message UpdateOrganizationSettingsResponse {} + +message AddOrganizationGroupRequest { + // The ID of the organization for which to add the group. + string organization_id = 1; + // The name of the group to add. + string group_name = 2; +} + +message AddOrganizationGroupResponse {} + +message RemoveOrganizationGroupRequest { + // The ID of the organization for which to remove the group. + string organization_id = 1; + // The name of the group to remove. + string group_name = 2; +} + +message RemoveOrganizationGroupResponse {} diff --git a/pkg/bufman/proto/registry/v1alpha1/owner.proto b/pkg/bufman/proto/registry/v1alpha1/owner.proto new file mode 100644 index 000000000..e4fe7c866 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/owner.proto @@ -0,0 +1,36 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/organization.proto"; +import "registry/v1alpha1/user.proto"; + +message Owner { + oneof owner { + // The requested owner is a `User`. + User user = 1; + // The requested owner is a `Organization`. + Organization organization = 2; + } +} + +// OwnerService is a service that provides RPCs that allow the BSR to query +// for owner information. +service OwnerService { + // GetOwnerByName takes an owner name and returns the owner as + // either a user or organization. + rpc GetOwnerByName(GetOwnerByNameRequest) returns (GetOwnerByNameResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message GetOwnerByNameRequest { + // Name of the requested owner. + string name = 1; +} + +message GetOwnerByNameResponse { + Owner owner = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/plugin.proto b/pkg/bufman/proto/registry/v1alpha1/plugin.proto new file mode 100644 index 000000000..1202007f2 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/plugin.proto @@ -0,0 +1,408 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/generate.proto"; +import "google/protobuf/timestamp.proto"; + +option deprecated = true; + +// Plugin represents a protoc plugin, such as protoc-gen-go. +message Plugin { + // The ID of the plugin, which uniquely identifies the plugin. + string id = 1; + // The name of the plugin, i.e. "protoc-gen-go". + string name = 2; + // The name of the owner of the plugin. Either a username or + // organization name. + string owner = 3; + // The visibility of the plugin. + PluginVisibility visibility = 4; + // deprecated means this plugin is deprecated. + bool deprecated = 5; + // deprecation_message is the message shown if the plugin is deprecated. + string deprecation_message = 6; + // The creation time of the plugin. + google.protobuf.Timestamp create_time = 7; + // The last update time of the plugin object. + google.protobuf.Timestamp update_time = 8; +} + +// PluginVersion represents a specific build of a plugin, +// such as protoc-gen-go v1.4.0. +message PluginVersion { + // The ID of the plugin version, which uniquely identifies the plugin version. + // Mostly used for pagination. + string id = 1; + // The name of the version, i.e. "v1.4.0". + string name = 2; + // The name of the plugin to which this version relates. + string plugin_name = 3; + // The owner of the plugin to which this version relates. + string plugin_owner = 4; + // The full container image digest associated with this plugin version including + // the algorithm. + // Ref: https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests + string container_image_digest = 5; + // Optionally define the runtime libraries. + repeated RuntimeLibrary runtime_libraries = 6; +} + +// PluginVisibility defines the visibility options available +// for Plugins and Templates. +enum PluginVisibility { + PLUGIN_VISIBILITY_UNSPECIFIED = 0; + PLUGIN_VISIBILITY_PUBLIC = 1; + PLUGIN_VISIBILITY_PRIVATE = 2; +} + +// Template defines a set of plugins that should be used together +// i.e. "go-grpc" would include protoc-gen-go and protoc-gen-go-grpc. +message Template { + // The ID of the template, which uniquely identifies the template. + string id = 1; + // The name of the template, i.e. "grpc-go". + string name = 2; + // The name of the owner of the template. Either a + // username or organization name. + string owner = 3; + // Must not contain duplicate plugins. Order of plugin configs + // dictates insertion point order. Note that we're + // intentionally putting most of the plugin configuration + // in the template, so that template versions are + // less likely to cause breakages for users. + repeated PluginConfig plugin_configs = 4; + // The visibility of the template. + PluginVisibility visibility = 5; + // deprecated means this template is deprecated. + bool deprecated = 8; + // deprecation_message is the message shown if the template is deprecated. + string deprecation_message = 9; + // The creation time of the template. + google.protobuf.Timestamp create_time = 10; + // The last update time of the template object. + google.protobuf.Timestamp update_time = 11; +} + +// PluginConfig defines a runtime configuration for a plugin. +message PluginConfig { + // deleted is no longer used and should be replaced by inaccessible. + reserved "deleted"; + reserved 4; + // The owner of the plugin to which this config relates. + string plugin_owner = 1; + // The name of the plugin to which this config relates. + string plugin_name = 2; + // Parameters that should be provided to the plugin. These are + // joined with a "," before being provided to the plugin at runtime. + repeated string parameters = 3; + // True if the source plugin is inaccessible by the user. + bool inaccessible = 5; +} + +// TemplateVersion defines a template at a +// specific set of versions for the contained plugins. +message TemplateVersion { + // The ID of the template version, which uniquely identifies the template version. + // Mostly used for pagination. + string id = 1; + // The name of the template version, i.e. "v1". + string name = 2; + // The owner of the template to which this version relates. + string template_owner = 3; + // The name of the template to which this version relates. + string template_name = 4; + // A map from plugin owner and name to version for the plugins + // defined in the template. Every plugin in the template + // must have a corresponding version in this array. + repeated PluginVersionMapping plugin_versions = 5; +} + +// PluginVersionMapping maps a plugin_id to a version. +message PluginVersionMapping { + // deleted is no longer used and should be replaced by inaccessible. + reserved "deleted"; + reserved 4; + // The owner of the plugin to which this mapping relates. + string plugin_owner = 1; + // The name of the plugin to which this mapping relates. + string plugin_name = 2; + // The version of the plugin to use, i.e. "v1.4.0". + string version = 3; + // True if the source plugin is inaccessible by the user. + bool inaccessible = 5; +} + +// PluginService manages plugins. +service PluginService { + // ListPlugins returns all the plugins available to the user. This includes + // public plugins, those uploaded to organizations the user is part of, + // and any plugins uploaded directly by the user. + rpc ListPlugins(ListPluginsRequest) returns (ListPluginsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListUserPlugins lists all plugins belonging to a user. + rpc ListUserPlugins(ListUserPluginsRequest) returns (ListUserPluginsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListOrganizationPlugins lists all plugins for an organization. + rpc ListOrganizationPlugins(ListOrganizationPluginsRequest) returns (ListOrganizationPluginsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetPluginVersion returns the plugin version, if found. + rpc GetPluginVersion(GetPluginVersionRequest) returns (GetPluginVersionResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListPluginVersions lists all the versions available for the specified plugin. + rpc ListPluginVersions(ListPluginVersionsRequest) returns (ListPluginVersionsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetPlugin returns the plugin, if found. + rpc GetPlugin(GetPluginRequest) returns (GetPluginResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DeletePlugin deletes the plugin, if it exists. Note that deleting + // a plugin may cause breaking changes for templates using that plugin, + // and should be done with extreme care. + rpc DeletePlugin(DeletePluginRequest) returns (DeletePluginResponse) { + option idempotency_level = IDEMPOTENT; + } + // GetTemplate returns the template, if found. + rpc GetTemplate(GetTemplateRequest) returns (GetTemplateResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListTemplates returns all the templates available to the user. This includes + // public templates, those owned by organizations the user is part of, + // and any created directly by the user. + rpc ListTemplates(ListTemplatesRequest) returns (ListTemplatesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListTemplatesUserCanAccess is like ListTemplates, but does not return + // public templates. + rpc ListTemplatesUserCanAccess(ListTemplatesUserCanAccessRequest) returns (ListTemplatesUserCanAccessResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListUserPlugins lists all templates belonging to a user. + rpc ListUserTemplates(ListUserTemplatesRequest) returns (ListUserTemplatesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListOrganizationTemplates lists all templates for an organization. + rpc ListOrganizationTemplates(ListOrganizationTemplatesRequest) returns (ListOrganizationTemplatesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetTemplateVersion returns the template version, if found. + rpc GetTemplateVersion(GetTemplateVersionRequest) returns (GetTemplateVersionResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListTemplateVersions lists all the template versions available for the specified template. + rpc ListTemplateVersions(ListTemplateVersionsRequest) returns (ListTemplateVersionsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DeleteTemplate deletes the template, if it exists. + rpc DeleteTemplate(DeleteTemplateRequest) returns (DeleteTemplateResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +message ListPluginsRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; +} + +message ListPluginsResponse { + repeated Plugin plugins = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListUserPluginsRequest { + // The owner to list plugins for. + string owner = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListUserPluginsResponse { + repeated Plugin plugins = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListOrganizationPluginsRequest { + // The organization to list plugins for. + string organization = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListOrganizationPluginsResponse { + repeated Plugin plugins = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message GetPluginVersionRequest { + // The owner of the plugin the version belongs to. + string owner = 1; + // The name of the plugin the version belongs to. + string name = 2; + // The name of the version. + string version = 3; +} + +message GetPluginVersionResponse { + PluginVersion plugin_version = 1; +} + +message ListPluginVersionsRequest { + // The owner of the plugin to list versions for. + string owner = 1; + // The name of the plugin to list versions for. + string name = 2; + // The number of items to return. + uint32 page_size = 3; + // The first page is returned if this is empty. + string page_token = 4; + bool reverse = 5; +} + +message ListPluginVersionsResponse { + repeated PluginVersion plugin_versions = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message GetPluginRequest { + // The owner of the plugin. + string owner = 1; + // The name of the plugin. + string name = 2; +} + +message GetPluginResponse { + Plugin plugin = 1; +} + +message DeletePluginRequest { + // The owner of the plugin to delete. + string owner = 1; + // The name of the plugin to delete. + string name = 2; +} + +message DeletePluginResponse {} + +message GetTemplateRequest { + // The owner of the template. + string owner = 1; + // The name of the template. + string name = 2; +} + +message GetTemplateResponse { + Template template = 1; +} + +message ListTemplatesRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; +} + +message ListTemplatesResponse { + repeated Template templates = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListTemplatesUserCanAccessRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; +} + +message ListTemplatesUserCanAccessResponse { + repeated Template templates = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListUserTemplatesRequest { + // The owner of the templates to list for. + string owner = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListUserTemplatesResponse { + repeated Template templates = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message GetTemplateVersionRequest { + // The owner of the template the version belongs to. + string owner = 1; + // The name of the template the version belongs to. + string name = 2; + // The name of the version. + string version = 3; +} + +message GetTemplateVersionResponse { + TemplateVersion template_version = 1; +} + +message ListOrganizationTemplatesRequest { + // The organization of the templates to list for. + string organization = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListOrganizationTemplatesResponse { + repeated Template templates = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListTemplateVersionsRequest { + // The owner of the template to list versions for. + string owner = 1; + // The name of the template to list versions for. + string name = 2; + // The number of items to return. + uint32 page_size = 3; + // The first page is returned if this is empty. + string page_token = 4; + bool reverse = 5; +} + +message ListTemplateVersionsResponse { + repeated TemplateVersion template_versions = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message DeleteTemplateRequest { + // The owner of the template to delete. + string owner = 1; + // The name of the template to delete. + string name = 2; +} + +message DeleteTemplateResponse {} diff --git a/pkg/bufman/proto/registry/v1alpha1/plugin_curation.proto b/pkg/bufman/proto/registry/v1alpha1/plugin_curation.proto new file mode 100644 index 000000000..bcf6c48a7 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/plugin_curation.proto @@ -0,0 +1,426 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "image/v1/image.proto"; +import "google/protobuf/compiler/plugin.proto"; +import "google/protobuf/timestamp.proto"; + +// CuratedPluginVisibility defines the visibility options available +// for Curated Plugins. +enum CuratedPluginVisibility { + CURATED_PLUGIN_VISIBILITY_UNSPECIFIED = 0; + CURATED_PLUGIN_VISIBILITY_PUBLIC = 1; + CURATED_PLUGIN_VISIBILITY_PRIVATE = 2; +} + +// The supported plugin registries for curated plugins. +enum PluginRegistryType { + PLUGIN_REGISTRY_TYPE_UNSPECIFIED = 0; + PLUGIN_REGISTRY_TYPE_GO = 1; + PLUGIN_REGISTRY_TYPE_NPM = 2; + PLUGIN_REGISTRY_TYPE_MAVEN = 3; + PLUGIN_REGISTRY_TYPE_SWIFT = 4; +} + +// PluginLanguage is used to specify the output languages a plugin supports. +enum PluginLanguage { + PLUGIN_LANGUAGE_UNSPECIFIED = 0; + PLUGIN_LANGUAGE_GO = 1; + PLUGIN_LANGUAGE_JAVASCRIPT = 2; + PLUGIN_LANGUAGE_TYPESCRIPT = 3; + PLUGIN_LANGUAGE_SWIFT = 4; + PLUGIN_LANGUAGE_CPP = 5; + PLUGIN_LANGUAGE_JAVA = 6; + PLUGIN_LANGUAGE_DART = 7; + PLUGIN_LANGUAGE_RUST = 8; + PLUGIN_LANGUAGE_PYTHON = 9; + PLUGIN_LANGUAGE_RUBY = 10; + PLUGIN_LANGUAGE_KOTLIN = 11; + PLUGIN_LANGUAGE_OBJECTIVE_C = 12; + PLUGIN_LANGUAGE_PHP = 13; + PLUGIN_LANGUAGE_CSHARP = 14; + PLUGIN_LANGUAGE_SCALA = 15; +} + +// NPMImportStyle is used to specify the import style the plugin supports. +enum NPMImportStyle { + NPM_IMPORT_STYLE_UNSPECIFIED = 0; + NPM_IMPORT_STYLE_MODULE = 1; + NPM_IMPORT_STYLE_COMMONJS = 2; +} + +// SwiftPlatformType is used to specify the platform type for a Swift plugins minimum compatible version. +enum SwiftPlatformType { + SWIFT_PLATFORM_TYPE_UNSPECIFIED = 0; + SWIFT_PLATFORM_TYPE_MACOS = 1; + SWIFT_PLATFORM_TYPE_IOS = 2; + SWIFT_PLATFORM_TYPE_WATCHOS = 3; + SWIFT_PLATFORM_TYPE_TVOS = 4; +} + +// GoConfig is the configuration for a Go plugin. +message GoConfig { + // RuntimeLibrary describes the runtime library dependency of the generated code. + message RuntimeLibrary { + // The name of the runtime library module, i.e. "google.golang.org/protobuf". + string module = 1; + // The version of the runtime library, i.e. "v1.27.1". + string version = 2; + } + // Optionally define the runtime libraries for the plugin. + repeated RuntimeLibrary runtime_libraries = 1; + // The minimum Go version required by the plugin. + string minimum_version = 2; +} + +// NPMConfig is the configuration for a JavaScript NPM plugin. +message NPMConfig { + // RuntimeLibrary describes the runtime library dependency of the generated code. + message RuntimeLibrary { + // The name of the runtime library package, i.e. "@grpc/grpc-js". + string package = 1; + // The version of the runtime library, i.e. "^1.27.1". + string version = 2; + } + // Optionally define the runtime libraries for the plugin. + repeated RuntimeLibrary runtime_libraries = 1; + // Optionally define a configuration for rewriting import paths, a feature mainly + // used for remote code generation in the BSR npm registry, which makes it possible + // to serve the output of a BSR module and a plugin in an individual package. + // + // All plugins based on @bufbuild/protoplugin support the option "rewrite_imports". + // Setting this value, i.e. "connectweb.js" or "pb.js", informs the BSR npm registry + // that the plugin supports import rewrites with the given import suffix. + string rewrite_import_path_suffix = 2; + // The import style used for the "type" field in the package.json file. + // This exists to support legacy plugins that require "commonjs" support. + NPMImportStyle import_style = 3; +} + +// MavenConfig is the configuration for a Maven plugin. +message MavenConfig { + // RuntimeLibrary describes a runtime dependency of the generated code. + message RuntimeLibrary { + string group_id = 1; + string artifact_id = 2; + string version = 3; + string classifier = 4; + string extension = 5; + } + // CompilerConfig contains configuration for the Java and/or Kotlin compiler used when compiling the generated code. + message CompilerConfig { + CompilerJavaConfig java = 1; + CompilerKotlinConfig kotlin = 2; + } + // CompilerJavaConfig contains settings for the Java compiler. + message CompilerJavaConfig { + // File encoding (default: UTF-8). + string encoding = 1; + // Release version (default: 8). + int32 release = 2; + // Source version (default: 8). + int32 source = 3; + // Target version (default: 8). + int32 target = 4; + } + // CompilerKotlinConfig contains settings for the Kotlin compiler. + message CompilerKotlinConfig { + // Version of the Kotlin compiler used to compile the generated code. + string version = 1; + // Version of the Kotlin API to target. + string api_version = 2; + // Target version of the JVM bytecode (default: 1.8). + string jvm_target = 3; + // Kotlin language version used for source compatibility. + string language_version = 4; + } + // RuntimeConfig allows configuring additional runtimes (like the 'lite' runtime). + // They can use different runtime dependencies and plugin options. + message RuntimeConfig { + string name = 1; + repeated RuntimeLibrary runtime_libraries = 2; + // The options to pass to the plugin. These will + // be merged into a single, comma-separated string. + repeated string options = 3; + } + + // Optionally define the runtime libraries for the plugin. + repeated RuntimeLibrary runtime_libraries = 1; + // Settings for the Java/Kotlin compiler used to compile the generated code. + CompilerConfig compiler = 2; + // Optional additional runtimes supported by the plugin. + repeated RuntimeConfig additional_runtimes = 3; +} + +message SwiftConfig { + // RuntimeLibrary describes a runtime library dependency of the generated code. + message RuntimeLibrary { + // The source of the runtime library package, e.g. https://github.com/apple/swift-protobuf.git. + string source = 1; + // The name of the runtime library package, e.g. "swift-protobuf". + string package = 2; + // The version of the runtime library, e.g. "1.21.0". + string version = 3; + // The products exported by the runtime library, e.g. "SwiftProtobuf". + repeated string products = 4; + // The minimum compatible platform versions of the runtime library. + message Platform { + // The name of the platform. + SwiftPlatformType name = 1; + // The minimum compatible version of the platform. + string version = 2; + } + // The minimum compatible platform versions of the runtime library. + repeated Platform platforms = 5; + // The supported Swift language versions of the runtime library, e.g. ".v5". + repeated string swift_versions = 6; + } + // Optionally define the runtime libraries for the plugin. + repeated RuntimeLibrary runtime_libraries = 1; +} + +// RegistryConfig is the configuration for the remote registry of a plugin. +message RegistryConfig { + oneof registry_config { + GoConfig go_config = 1; + NPMConfig npm_config = 2; + MavenConfig maven_config = 3; + SwiftConfig swift_config = 4; + } + // Reserved for future remote registry types. + reserved 5 to 9; + // The options to pass to the plugin. These will + // be merged into a single, comma-separated string. + repeated string options = 10; +} + +message CuratedPluginReference { + // The owner of the plugin, i.e. "library". + string owner = 1; + // The name of the plugin, i.e. "connect-go". + string name = 2; + // Semver-formatted plugin version. + string version = 3; + // The revision for this plugin version. + uint32 revision = 4; +} + +// CuratedPlugin represents a protoc plugin curated by Buf, such as protoc-gen-go. +message CuratedPlugin { + // The ID of the plugin, which uniquely identifies the plugin. + string id = 1; + // The owner of the plugin, i.e. "library". + string owner = 2; + // The name of the plugin, i.e. "connect-go". + string name = 3; + // The optional registry type of the plugin. + PluginRegistryType registry_type = 4; + // Semver-formatted plugin version. + string version = 5; + // The full container image digest associated with this plugin version including + // the algorithm. + // Ref: https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests + string container_image_digest = 6; + // The creation time of the plugin. + google.protobuf.Timestamp create_time = 8; + // List of plugin dependencies. + repeated CuratedPluginReference dependencies = 9; + // Optionally specify the URL leading to the source code of the plugin, if available. + string source_url = 10; + // Optionally specify a brief description of the plugin functionality. + string description = 11; + // The configuration for the remote registry of the plugin. + RegistryConfig registry_config = 12; + // The revision for this plugin version. + uint32 revision = 13; + // The output languages supported by the plugin. + repeated PluginLanguage output_languages = 14; + // spdx_license_id is the license of the plugin, which should be one of the identifiers + // defined in https://spdx.org/licenses + string spdx_license_id = 15; + // license_url specifies an optional URL for the plugin's license (if not using a standard spdx_license_id). + string license_url = 16; + // verified indicates the plugin has been verified. Verification is a property + // of the BSR and cannot be set by end-users. + bool verified = 17; + // Visibility indicates whether the plugin is public or private. + CuratedPluginVisibility visibility = 18; + // Deprecated indicates whether the plugin is deprecated. + bool deprecated = 19; + // Optionally specify a message to be displayed when the plugin is deprecated. + string deprecation_message = 20; +} + +// PluginCurationService manages curated plugins. +service PluginCurationService { + // ListCuratedPlugins returns all the curated plugins available. + rpc ListCuratedPlugins(ListCuratedPluginsRequest) returns (ListCuratedPluginsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // CreateCuratedPlugin creates a new curated plugin. + rpc CreateCuratedPlugin(CreateCuratedPluginRequest) returns (CreateCuratedPluginResponse) { + option idempotency_level = IDEMPOTENT; + } + // GetLatestCuratedPlugin returns the latest version of a plugin matching given parameters. + rpc GetLatestCuratedPlugin(GetLatestCuratedPluginRequest) returns (GetLatestCuratedPluginResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DeleteCuratedPlugin deletes a curated plugin based on the given parameters. + rpc DeleteCuratedPlugin(DeleteCuratedPluginRequest) returns (DeleteCuratedPluginResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +// CodeGenerationService generates code using remote plugins. +service CodeGenerationService { + // GenerateCode generates code using the specified remote plugins. + rpc GenerateCode(GenerateCodeRequest) returns (GenerateCodeResponse); +} + +message GenerateCodeRequest { + // The image to run plugins against to generate the desired file outputs. + // + // All image files that are not imports and not well-known types will be generated. + // If you want to filter what files are generated, modify the image. + // If you want to include imports, set include_imports. + bufman.dubbo.apache.org.image.v1.Image image = 1; + repeated PluginGenerationRequest requests = 2; + // Include imports from the Image in generation. If include_imports is also set + // in one of requests, use the request's value for that plugin. + bool include_imports = 3; + // Include Well-Known Types from the Image in generation. + // + // include_imports must be set if include_well_known_types is set. If include_well_known_types + // is also set in one of requests, use the request's value for that plugin. + bool include_well_known_types = 4; +} + +message GenerateCodeResponse { + // Responses from each plugin execution. + // The order of each response matches the order in the GenerateCodeRequest. + repeated PluginGenerationResponse responses = 1; +} + +// Request for performing code generation using the specified plugin. +message PluginGenerationRequest { + // The plugin to execute. + CuratedPluginReference plugin_reference = 1; + // The options to pass to the plugin. These will + // be merged into a single, comma-separated string. + repeated string options = 2; + // Include imports from the Image in generation. + optional bool include_imports = 3; + // Include Well-Known Types from the Image in generation. + // + // include_imports must be set if include_well_known_types is set. + optional bool include_well_known_types = 4; +} + +// Response from code generation for a given plugin. +message PluginGenerationResponse { + // Generated code from the plugin. + google.protobuf.compiler.CodeGeneratorResponse response = 1; +} + +message DeleteCuratedPluginRequest { + // The owner of the plugin to delete. + string owner = 1; + // The name of the plugin to delete. + string name = 2; + // Version is the plugin version and is optional. If this field is not set then delete all versions, + // otherwise delete only the specified version which includes all revisions. + string version = 3; +} + +message DeleteCuratedPluginResponse {} + +message CreateCuratedPluginRequest { + // The owner of the plugin, i.e. "library". + string owner = 1; + // The name of the plugin, i.e. "connect-go". + string name = 2; + // The optional registry type of the plugin. + PluginRegistryType registry_type = 3; + // Semver-formatted plugin version. + string version = 4; + // Image Name and Image Digest define a unique plugin image + // Image Digest is like sha256:febcf61cd6e1ac9628f6ac14fa40836d16f3c6ddef3b303ff0321606e55ddd0b + string image_digest = 5; + // List of plugin dependencies. + repeated CuratedPluginReference dependencies = 7; + // The URL leading to the source code of the plugin, if available. + string source_url = 8; + // A brief description of the plugin functionality. + string description = 9; + // The configuration for the remote registry of the plugin. + RegistryConfig registry_config = 12; + // The revision for this plugin version. + uint32 revision = 13; + // The output languages supported by the plugin. + repeated PluginLanguage output_languages = 14; + // spdx_license_id is the license of the plugin, which should be one of the identifiers + // defined in https://spdx.org/licenses + string spdx_license_id = 15; + // license_url specifies an optional URL for the plugin's license (if not using a standard spdx_license_id). + string license_url = 16; + // Visibility indicates whether the plugin is public or private. + CuratedPluginVisibility visibility = 17; + // Image Name and Image Digest define a unique plugin image + string image_name = 18; + // Docker Repo Name is define to access user's docker hub + string docker_repo_name = 19; +} + +message CreateCuratedPluginResponse { + // The created plugin. + CuratedPlugin configuration = 1; +} + +message ListCuratedPluginsRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; + // If true, will only return plugins which support remote packages (registry_type is set). + bool supports_remote_packages = 4; + // If true, will include deprecated plugins. + bool include_deprecated = 5; +} + +message ListCuratedPluginsResponse { + repeated CuratedPlugin plugins = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message GetLatestCuratedPluginRequest { + // The owner of the plugin, i.e. "library". + string owner = 1; + // The name of the plugin, i.e. "connect-go". + string name = 2; + // Both version (semver-formatted) and revision are optional, which means + // return the latest plugin. + // If version is set, but revision is omitted, then return the latest + // revision for that version. + // If version and revision are both set, return specific plugin. + // It is an error to set a revision without a corresponding version. + string version = 3; + uint32 revision = 4; + // If true, will only return versions (and revisions) which support remote packages (registry_type is set). + bool supports_remote_packages = 5; +} + +message GetLatestCuratedPluginResponse { + CuratedPlugin plugin = 1; + // versions is a semver-sorted list in descending order. + repeated CuratedPluginVersionRevisions versions = 2; +} + +message CuratedPluginVersionRevisions { + string version = 1; + // revisions is a sorted list in descending order. + repeated uint32 revisions = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/push.proto b/pkg/bufman/proto/registry/v1alpha1/push.proto new file mode 100644 index 000000000..40efae3e3 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/push.proto @@ -0,0 +1,67 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "module/v1alpha1/module.proto"; +import "registry/v1alpha1/module.proto"; + +// PushService is the Push service. +service PushService { + // Push pushes. + // NOTE: Newer clients should use PushManifestAndBlobs. + rpc Push(PushRequest) returns (PushResponse) { + option idempotency_level = IDEMPOTENT; + } + // PushManifestAndBlobs pushes a module by encoding it in a manifest and blobs format. + rpc PushManifestAndBlobs(PushManifestAndBlobsRequest) returns (PushManifestAndBlobsResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +// PushRequest specifies the module to push to the BSR. +message PushRequest { + string owner = 1; + string repository = 2; + string branch = 3 [deprecated = true]; + bufman.dubbo.apache.org.module.v1alpha1.Module module = 4; + // Optional; if provided, the provided tags + // are created for the pushed commit. + repeated string tags = 5; + // Optional; if provided, the pushed commit + // will be appended to these tracks. If the + // tracks do not exist, they will be created. + repeated string tracks = 6 [deprecated = true]; + // If non-empty, the push creates a draft commit with this name. + string draft_name = 7; +} + +// PushResponse is the pushed module pin, local to the used remote. +message PushResponse { + LocalModulePin local_module_pin = 5; +} + +// PushManifestAndBlobsRequest holds the module to push in the manifest+blobs +// encoding format. +message PushManifestAndBlobsRequest { + string owner = 1; + string repository = 2; + // Manifest with all the module files being pushed. + bufman.dubbo.apache.org.module.v1alpha1.Blob manifest = 3; + // Referenced blobs in the manifest. Keep in mind there is not necessarily one + // blob per file, but one blob per digest, so for files with exactly the same + // content, you can send just one blob. + repeated bufman.dubbo.apache.org.module.v1alpha1.Blob blobs = 4; + // Optional; if provided, the provided tags + // are created for the pushed commit. + repeated string tags = 5; + // If non-empty, the push creates a draft commit with this name. + string draft_name = 6; +} + +// PushManifestAndBlobsResponse is the pushed module pin, local to the used +// remote. +message PushManifestAndBlobsResponse { + LocalModulePin local_module_pin = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/recommendation.proto b/pkg/bufman/proto/registry/v1alpha1/recommendation.proto new file mode 100644 index 000000000..2f8a79c5d --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/recommendation.proto @@ -0,0 +1,82 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/resource.proto"; +import "google/protobuf/timestamp.proto"; + +// RecommendedRepository is the information about a repository needed to link to +// its owner page. +message RecommendedRepository { + string owner = 1; + string name = 2; + google.protobuf.Timestamp create_time = 3; + string description = 4; + string repository_id = 5; +} + +// RecommendedTemplate is the information needed to recommend a template and link +// to its owner page. +message RecommendedTemplate { + option deprecated = true; + string owner = 1; + string name = 2; + string description = 3; + string template_id = 4; +} + +// SetRecommendedResource is the information needed to configure a resource recommendation +message SetRecommendedResource { + string owner = 1; + string name = 2; +} + +// RecommendationService is the recommendation service. +service RecommendationService { + // RecommendedRepositories returns a list of recommended repositories. + rpc RecommendedRepositories(RecommendedRepositoriesRequest) returns (RecommendedRepositoriesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // RecommendedTemplates returns a list of recommended templates. + rpc RecommendedTemplates(RecommendedTemplatesRequest) returns (RecommendedTemplatesResponse) { + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListRecommendedResources returns a list of recommended resources. + rpc ListRecommendedResources(ListRecommendedResourcesRequest) returns (ListRecommendedResourcesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // SetRecommendedResources set the list of recommended resources in the server. + rpc SetRecommendedResources(SetRecommendedResourcesRequest) returns (SetRecommendedResourcesResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +message RecommendedRepositoriesRequest {} + +message RecommendedRepositoriesResponse { + repeated RecommendedRepository repositories = 1; +} + +message RecommendedTemplatesRequest { + option deprecated = true; +} + +message RecommendedTemplatesResponse { + option deprecated = true; + repeated RecommendedTemplate templates = 1; +} + +message ListRecommendedResourcesRequest {} + +message ListRecommendedResourcesResponse { + repeated Resource resources = 1; +} + +message SetRecommendedResourcesRequest { + repeated SetRecommendedResource resources = 1; +} + +message SetRecommendedResourcesResponse {} diff --git a/pkg/bufman/proto/registry/v1alpha1/reference.proto b/pkg/bufman/proto/registry/v1alpha1/reference.proto new file mode 100644 index 000000000..87fdd363c --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/reference.proto @@ -0,0 +1,84 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/git_metadata.proto"; +import "registry/v1alpha1/repository_commit.proto"; +import "registry/v1alpha1/repository_tag.proto"; + +message Reference { + reserved 1, 4; + reserved "branch", "track"; + + oneof reference { + // The requested reference is a tag. + RepositoryTag tag = 2; + // The requested reference is a commit. + RepositoryCommit commit = 3; + // The requested reference is the default reference. + RepositoryMainReference main = 5; + // The requested reference is a draft commit. + RepositoryDraft draft = 6; + } +} + +message RepositoryMainReference { + // Name is always 'main'. + string name = 1; + // The latest commit in this repository. If the repository has no commits, + // this will be empty. + RepositoryCommit commit = 2; +} + +message RepositoryDraft { + // The name of the draft + string name = 1; + // The commit this draft points to. + RepositoryCommit commit = 2; +} + +// ReferenceService is a service that provides RPCs that allow the BSR to query +// for reference information. +service ReferenceService { + // GetReferenceByName takes a reference name and returns the + // reference either as 'main', a tag, or commit. + rpc GetReferenceByName(GetReferenceByNameRequest) returns (GetReferenceByNameResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListGitCommitMetadataForReference takes a string reference and returns all the git commit + // metadata associated with the resolved reference commit. + rpc ListGitCommitMetadataForReference(ListGitCommitMetadataForReferenceRequest) returns (ListGitCommitMetadataForReferenceResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message GetReferenceByNameRequest { + // Name of the requested reference. + string name = 1; + // Owner of the repository the reference belongs to. + string owner = 2; + // Name of the repository the reference belongs to. + string repository_name = 3; +} + +message GetReferenceByNameResponse { + Reference reference = 1; +} + +message ListGitCommitMetadataForReferenceRequest { + // String that represents the name of the reference. + string reference = 1; + // Owner of the repository the reference belongs to. + string owner = 2; + // Name of the repository the reference belongs to. + string repository_name = 3; +} + +message ListGitCommitMetadataForReferenceResponse { + // ID of the BSR commit the reference resolved to. + string commit_id = 1; + // List of git commits and metadata associated with the resolved reference. + repeated GitCommitMetadata git_commit_metadatas = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/repository.proto b/pkg/bufman/proto/registry/v1alpha1/repository.proto new file mode 100644 index 000000000..bf085f66d --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/repository.proto @@ -0,0 +1,351 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/role.proto"; +import "registry/v1alpha1/user.proto"; +import "registry/v1alpha1/verification_status.proto"; +import "google/protobuf/timestamp.proto"; + +enum Visibility { + VISIBILITY_UNSPECIFIED = 0; + VISIBILITY_PUBLIC = 1; + VISIBILITY_PRIVATE = 2; +} + +message Repository { + // primary key, unique, immutable + string id = 1; + // immutable + google.protobuf.Timestamp create_time = 2; + // mutable + google.protobuf.Timestamp update_time = 3; + // unique, mutable + string name = 4; + oneof owner { + // foreign key, mutable + string user_id = 5; + // foreign key, mutable + string organization_id = 6; + } + Visibility visibility = 7; + // deprecated means this repository is deprecated. + bool deprecated = 8; + // deprecation_message is the message shown if the repository is deprecated. + string deprecation_message = 9; + // owner_name is the name of the owner of the repository, + // either a username or organization name. + string owner_name = 10; + // description is the user configurable description of the repository. + string description = 11; + // url is the user configurable URL in the description of the repository, + // always included the scheme and will not have a #fragment suffix. + string url = 12; +} + +message RepositoryCounts { + reserved 2; + reserved "tracks_count"; + + uint32 tags_count = 1; + uint32 drafts_count = 3; +} + +message RepositoryContributor { + User user = 1; + // The ID of the for which the role belongs to. + string repository_id = 2; + // The role that the user has been explicitly assigned against the repository. + RepositoryRole explicit_role = 3; + // Optionally defines the role that the user has implicitly against the repository through the owning organization. + // If the repository does not belong to an organization or the user is not part of the owning organization, this is unset. + RepositoryRole implicit_role = 4; +} + +message RepositoryMetadata { + // The ID of the repository. + string id = 1; + // The name of the repository. + string name = 2; + // The owner name of the repository. + string owner_name = 3; + // The verification status of the owner of the repository. + VerificationStatus owner_verification_status = 4; + // The commit time of the latest main commit in the repository. + google.protobuf.Timestamp latest_commit_time = 5; + // The SPDX license ID of the latest main commit in the repository. + string latest_spdx_license_id = 6; +} + +// RepositoryService is the Repository service. +service RepositoryService { + // GetRepository gets a repository by ID. + rpc GetRepository(GetRepositoryRequest) returns (GetRepositoryResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetRepositoryByFullName gets a repository by full name. + rpc GetRepositoryByFullName(GetRepositoryByFullNameRequest) returns (GetRepositoryByFullNameResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListRepositories lists all repositories. + rpc ListRepositories(ListRepositoriesRequest) returns (ListRepositoriesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListUserRepositories lists all repositories belonging to a user. + rpc ListUserRepositories(ListUserRepositoriesRequest) returns (ListUserRepositoriesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListRepositoriesUserCanAccess lists all repositories a user can access. + rpc ListRepositoriesUserCanAccess(ListRepositoriesUserCanAccessRequest) returns (ListRepositoriesUserCanAccessResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListOrganizationRepositories lists all repositories for an organization. + rpc ListOrganizationRepositories(ListOrganizationRepositoriesRequest) returns (ListOrganizationRepositoriesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // CreateRepositoryByFullName creates a new repository by full name. + rpc CreateRepositoryByFullName(CreateRepositoryByFullNameRequest) returns (CreateRepositoryByFullNameResponse) { + option idempotency_level = IDEMPOTENT; + } + // DeleteRepository deletes a repository. + rpc DeleteRepository(DeleteRepositoryRequest) returns (DeleteRepositoryResponse) { + option idempotency_level = IDEMPOTENT; + } + // DeleteRepositoryByFullName deletes a repository by full name. + rpc DeleteRepositoryByFullName(DeleteRepositoryByFullNameRequest) returns (DeleteRepositoryByFullNameResponse) { + option idempotency_level = IDEMPOTENT; + } + // DeprecateRepositoryByName deprecates the repository. + rpc DeprecateRepositoryByName(DeprecateRepositoryByNameRequest) returns (DeprecateRepositoryByNameResponse); + // UndeprecateRepositoryByName makes the repository not deprecated and removes any deprecation_message. + rpc UndeprecateRepositoryByName(UndeprecateRepositoryByNameRequest) returns (UndeprecateRepositoryByNameResponse); + // GetRepositoriesByFullName gets repositories by full name. Response order is unspecified. + // Errors if any of the repositories don't exist or the caller does not have access to any of the repositories. + rpc GetRepositoriesByFullName(GetRepositoriesByFullNameRequest) returns (GetRepositoriesByFullNameResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // SetRepositoryContributor sets the role of a user in the repository. + rpc SetRepositoryContributor(SetRepositoryContributorRequest) returns (SetRepositoryContributorResponse); + // ListRepositoryContributors returns the list of contributors that has an explicit role against the repository. + // This does not include users who have implicit roles against the repository, unless they have also been + // assigned a role explicitly. + rpc ListRepositoryContributors(ListRepositoryContributorsRequest) returns (ListRepositoryContributorsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetRepositoryContributor returns the contributor information of a user in a repository. + rpc GetRepositoryContributor(GetRepositoryContributorRequest) returns (GetRepositoryContributorResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetRepositorySettings gets the settings of a repository. + rpc GetRepositorySettings(GetRepositorySettingsRequest) returns (GetRepositorySettingsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UpdateRepositorySettingsByName updates the settings of a repository. + rpc UpdateRepositorySettingsByName(UpdateRepositorySettingsByNameRequest) returns (UpdateRepositorySettingsByNameResponse); + // GetRepositoriesMetadata gets the metadata of the repositories in the request, the length of repositories in the + // request should match the length of the metadata in the response, and the order of repositories in the response + // should match the order of the metadata in the request. + rpc GetRepositoriesMetadata(GetRepositoriesMetadataRequest) returns (GetRepositoriesMetadataResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message GetRepositoriesByFullNameRequest { + // minimum length is 1 + // maximum length is 250 + repeated string full_names = 1; +} + +message GetRepositoriesByFullNameResponse { + repeated Repository repositories = 1; +} + +message GetRepositoryRequest { + string id = 1; +} + +message GetRepositoryResponse { + Repository repository = 1; + RepositoryCounts counts = 2; +} + +message GetRepositoryByFullNameRequest { + string full_name = 1; +} + +message GetRepositoryByFullNameResponse { + Repository repository = 1; + RepositoryCounts counts = 2; +} + +message ListRepositoriesRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; +} + +message ListRepositoriesResponse { + repeated Repository repositories = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListUserRepositoriesRequest { + // The ID of the user whose repositories should be listed. + string user_id = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListUserRepositoriesResponse { + repeated Repository repositories = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListRepositoriesUserCanAccessRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; +} + +message ListRepositoriesUserCanAccessResponse { + repeated Repository repositories = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListOrganizationRepositoriesRequest { + // The ID of the organization whose repositories should be listed. + string organization_id = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListOrganizationRepositoriesResponse { + repeated Repository repositories = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message CreateRepositoryByFullNameRequest { + // Must be unique across repositories. + string full_name = 1; + Visibility visibility = 2; +} + +message CreateRepositoryByFullNameResponse { + Repository repository = 1; +} + +message DeleteRepositoryRequest { + string id = 1; +} + +message DeleteRepositoryResponse {} + +message DeleteRepositoryByFullNameRequest { + string full_name = 1; +} + +message DeleteRepositoryByFullNameResponse {} + +message DeprecateRepositoryByNameRequest { + string owner_name = 1; + string repository_name = 2; + // A message shown along with the deprecation warning for this repository. + // It must be a utf8 encoded string containing 256 or fewer characters. + string deprecation_message = 3; +} + +message DeprecateRepositoryByNameResponse { + Repository repository = 1; +} + +message UndeprecateRepositoryByNameRequest { + string owner_name = 1; + string repository_name = 2; +} + +message UndeprecateRepositoryByNameResponse { + Repository repository = 1; +} + +message SetRepositoryContributorRequest { + // The ID of the repository for which the user's role will be set. + string repository_id = 1; + // The ID of the user whose role will be set. + string user_id = 2; + // The role to assign to the user. + // Setting UNSPECIFIED means removing the user's role. + RepositoryRole repository_role = 3; +} + +message SetRepositoryContributorResponse {} + +message ListRepositoryContributorsRequest { + string repository_id = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListRepositoryContributorsResponse { + repeated RepositoryContributor users = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message GetRepositoryContributorRequest { + // The ID of the repository for which to get the contributor information. + string repository_id = 1; + // The ID of the user for which to get the contributor information. + string user_id = 2; +} + +message GetRepositoryContributorResponse { + // The contributor information of the user in the repository. + RepositoryContributor user = 1; +} + +message GetRepositorySettingsRequest { + // The ID of the repository for which to get the settings. + string repository_id = 1; +} + +message GetRepositorySettingsResponse { + // The number of outside contributors in the repository, + // excluding owning-organization's members that have an explicit role. + uint32 contributors_count = 1; +} + +message UpdateRepositorySettingsByNameRequest { + string owner_name = 1; + string repository_name = 2; + // optional, update to visibility will only be made if this is specified. + Visibility visibility = 3; + // optional, update to description will only be made when this is present + optional string description = 4; + // optional, update to url will only be made when this is present + optional string url = 5; +} + +message UpdateRepositorySettingsByNameResponse {} + +message GetRepositoriesMetadataRequest { + // The list of repository IDs to request the metadata. + repeated string ids = 1; +} + +message GetRepositoriesMetadataResponse { + repeated RepositoryMetadata metadata = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/repository_branch.proto b/pkg/bufman/proto/registry/v1alpha1/repository_branch.proto new file mode 100644 index 000000000..ba85325d5 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/repository_branch.proto @@ -0,0 +1,42 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +message RepositoryBranch { + // primary key, unique, immutable + string id = 1; + // The name of the repository branch. + string name = 2; + // The name of the latest commit on the branch. + string latest_commit_name = 3; + // is_main_branch denotes whether this branch is considered the main branch of the repository. + bool is_main_branch = 4; + // The last update time of the branch. + google.protobuf.Timestamp last_update_time = 5; +} + +// RepositoryBranchService is the Repository branch service. +service RepositoryBranchService { + // ListRepositoryBranchs lists the repository branches associated with a Repository. + rpc ListRepositoryBranches(ListRepositoryBranchesRequest) returns (ListRepositoryBranchesResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message ListRepositoryBranchesRequest { + // The ID of the repository whose branches should be listed. + string repository_id = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; +} + +message ListRepositoryBranchesResponse { + repeated RepositoryBranch repository_branches = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/repository_commit.proto b/pkg/bufman/proto/registry/v1alpha1/repository_commit.proto new file mode 100644 index 000000000..b2630b073 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/repository_commit.proto @@ -0,0 +1,171 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/repository_tag.proto"; +import "google/protobuf/timestamp.proto"; + +message RepositoryCommit { + // primary key, unique, immutable + string id = 1; + // immutable + google.protobuf.Timestamp create_time = 2; + // The digest of the commit. + string digest = 3; + // The name of the commit. + // This is what is referenced by users. + // Unique, immutable. + string name = 4; + // The branch on which this commit was created. + string branch = 5 [deprecated = true]; + // The commit sequence ID for this commit. This + // is essentially what number commit this is on + // the branch. + int64 commit_sequence_id = 6; + // The username of the user who authored this commit. + string author = 7; + // The tags associated with this commit + repeated bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag tags = 8; + // The commit's draft name, if it is a draft commit. + string draft_name = 9; + // spdx_license_id is the license of the commit, based on the + // license file pushed, which should be one of the identifier defined in + // https://spdx.org/licenses, and will be not set if the license file is not + // presented or cannot be classified into a known license. + string spdx_license_id = 10; + // The manifest digest of the commit. + string manifest_digest = 11; +} + +// RepositoryCommitService is the Repository commit service. +service RepositoryCommitService { + // ListRepositoryCommitsByBranch lists the repository commits associated + // with a repository branch on a repository, ordered by their create time. + rpc ListRepositoryCommitsByBranch(ListRepositoryCommitsByBranchRequest) returns (ListRepositoryCommitsByBranchResponse) { + // ListRepositoryCommitsByBranch has been deprecated, use + // ListRepositoryCommitsByReference instead. + option deprecated = true; + option idempotency_level = NO_SIDE_EFFECTS; + } + + // ListRepositoryCommitsByReference returns repository commits up-to and including + // the provided reference. + rpc ListRepositoryCommitsByReference(ListRepositoryCommitsByReferenceRequest) returns (ListRepositoryCommitsByReferenceResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetRepositoryCommitByReference returns the repository commit matching + // the provided reference, if it exists. + rpc GetRepositoryCommitByReference(GetRepositoryCommitByReferenceRequest) returns (GetRepositoryCommitByReferenceResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetRepositoryCommitBySequenceId returns the repository commit matching + // the provided sequence ID and branch, if it exists. + rpc GetRepositoryCommitBySequenceId(GetRepositoryCommitBySequenceIdRequest) returns (GetRepositoryCommitBySequenceIdResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListRepositoryDraftCommits lists draft commits in a repository. + rpc ListRepositoryDraftCommits(ListRepositoryDraftCommitsRequest) returns (ListRepositoryDraftCommitsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DeleteRepositoryDraftCommit deletes a draft. + rpc DeleteRepositoryDraftCommit(DeleteRepositoryDraftCommitRequest) returns (DeleteRepositoryDraftCommitResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +message ListRepositoryCommitsByBranchRequest { + // The owner of the repository which the repository branch belongs to. + string repository_owner = 1; + // The name of the repository which the repository branch belongs to. + string repository_name = 2; + // The name of the repository branch whose commits should be listed. + string repository_branch_name = 3; + uint32 page_size = 4; + // For now this is the id of he last commit returned in the previous page. + // This is directly set by the frontend when listing track history starting with a + // specific commit. If we page_token to be anything other than a commit id + // we need to change the frontend as well. + string page_token = 5; + bool reverse = 6; +} + +message ListRepositoryCommitsByBranchResponse { + repeated RepositoryCommit repository_commits = 1; + string next_page_token = 2; +} + +message ListRepositoryCommitsByReferenceRequest { + // The owner of the repository which the repository reference belongs to. + string repository_owner = 1; + // The name of the repository which the repository reference belongs to. + string repository_name = 2; + // The reference used to resolve repository commits. Can be a tag or commit. + string reference = 3; + uint32 page_size = 4; + string page_token = 5; + bool reverse = 6; +} + +message ListRepositoryCommitsByReferenceResponse { + repeated RepositoryCommit repository_commits = 1; + string next_page_token = 2; +} + +message GetRepositoryCommitByReferenceRequest { + // The owner of the repository which the reference belongs to. + string repository_owner = 1; + // The name of the repository which the reference belongs to. + string repository_name = 2; + // The reference that should be resolved to a commit. Can be a tag or commit. + string reference = 3; +} + +message GetRepositoryCommitByReferenceResponse { + RepositoryCommit repository_commit = 1; +} + +message GetRepositoryCommitBySequenceIdRequest { + // The owner of the repository which the repository branch belongs to. + string repository_owner = 1; + // The name of the repository which the repository branch belongs to. + string repository_name = 2; + // The name of the repository branch which the sequence ID is relative to. + string repository_branch_name = 3; + // The sequence ID to look up. + int64 commit_sequence_id = 4; +} + +message GetRepositoryCommitBySequenceIdResponse { + RepositoryCommit repository_commit = 1; +} + +message ListRepositoryDraftCommitsRequest { + // The owner of the repository which the repository branch belongs to. + string repository_owner = 1; + // The name of the repository which the repository branch belongs to. + string repository_name = 2; + uint32 page_size = 3; + string page_token = 4; + // By default, draft commits are ordered by last update time descending. + // Reverse orders them ascending. + bool reverse = 5; +} + +message ListRepositoryDraftCommitsResponse { + // Each commit will have draft_name set. + repeated RepositoryCommit repository_commits = 1; + string next_page_token = 2; +} + +message DeleteRepositoryDraftCommitRequest { + // The owner of the repository which the repository branch belongs to. + string repository_owner = 1; + // The name of the repository which the repository branch belongs to. + string repository_name = 2; + // The name of the draft to delete. + string draft_name = 3; +} + +message DeleteRepositoryDraftCommitResponse {} diff --git a/pkg/bufman/proto/registry/v1alpha1/repository_tag.proto b/pkg/bufman/proto/registry/v1alpha1/repository_tag.proto new file mode 100644 index 000000000..227b5e875 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/repository_tag.proto @@ -0,0 +1,84 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +message RepositoryTag { + // primary key, unique, immutable + string id = 1; + // immutable + google.protobuf.Timestamp create_time = 2; + // We reserve field number '3' for the update_time. + // google.protobuf.Timestamp update_time = 3; + // The name of the repository tag, e.g. "6e2e7f24718a76caa32a80d0e2b1841ef2c61403". + string name = 4; + // The name of the commit this tag belongs to. + string commit_name = 5; + // The username of the author of the tag. + string author = 6; +} + +// RepositoryTagService is the Repository tag service. +service RepositoryTagService { + // CreateRepositoryTag creates a new repository tag. + rpc CreateRepositoryTag(CreateRepositoryTagRequest) returns (CreateRepositoryTagResponse) { + option idempotency_level = IDEMPOTENT; + } + // ListRepositoryTags lists the repository tags associated with a Repository. + rpc ListRepositoryTags(ListRepositoryTagsRequest) returns (ListRepositoryTagsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListRepositoryTagsForReference lists the repository tags associated with a repository + // reference name. + rpc ListRepositoryTagsForReference(ListRepositoryTagsForReferenceRequest) returns (ListRepositoryTagsForReferenceResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message CreateRepositoryTagRequest { + // The ID of the repository this tag should be created on. + string repository_id = 1; + // The name of the repository tag, e.g. "6e2e7f24718a76caa32a80d0e2b1841ef2c61403". + string name = 2; + // The name of the commit this tag should be created for. + string commit_name = 3; +} + +message CreateRepositoryTagResponse { + RepositoryTag repository_tag = 1; +} + +message ListRepositoryTagsRequest { + // The ID of the repository whose tags should be listed. + string repository_id = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListRepositoryTagsResponse { + repeated RepositoryTag repository_tags = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListRepositoryTagsForReferenceRequest { + // The ID of the repository whose tags should be listed. + string repository_id = 1; + // The name of the reference. + string reference = 2; + uint32 page_size = 3; + // The first page is returned if this is empty. + string page_token = 4; + bool reverse = 5; +} + +message ListRepositoryTagsForReferenceResponse { + repeated RepositoryTag repository_tags = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/resolve.proto b/pkg/bufman/proto/registry/v1alpha1/resolve.proto new file mode 100644 index 000000000..bcb880330 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/resolve.proto @@ -0,0 +1,176 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "module/v1alpha1/module.proto"; +import "registry/v1alpha1/module.proto"; + +// ResolveService is the resolve service. +// +// This is the public service. +service ResolveService { + // GetModulePins finds all the latest digests and respective dependencies of + // the provided module references and picks a set of distinct modules pins. + // + // Note that module references with commits should still be passed to this function + // to make sure this function can do dependency resolution. + // + // This function also deals with tiebreaking what ModulePin wins for the same repository. + rpc GetModulePins(GetModulePinsRequest) returns (GetModulePinsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetGoVersion resolves the given plugin and module references to a version. + rpc GetGoVersion(GetGoVersionRequest) returns (GetGoVersionResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetSwiftVersion resolves the given plugin and module references to a version. + rpc GetSwiftVersion(GetSwiftVersionRequest) returns (GetSwiftVersionResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetMavenVersion resolves the given plugin and module references to a version. + rpc GetMavenVersion(GetMavenVersionRequest) returns (GetMavenVersionResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetNPMVersion resolves the given plugin and module references to a version. + rpc GetNPMVersion(GetNPMVersionRequest) returns (GetNPMVersionResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message GetModulePinsRequest { + repeated bufman.dubbo.apache.org.module.v1alpha1.ModuleReference module_references = 1; + + // current_module_pins allows for partial dependency updates by letting clients + // send a request with the pins for their current module and only the + // identities of the dependencies they want to update in module_references. + // + // When resolving, if a client supplied module pin is: + // - in the transitive closure of pins resolved from the module_references, + // the client supplied module pin will be an extra candidate for tie + // breaking. + // - NOT in the in the transitive closure of pins resolved from the + // module_references, it will be returned as is. + repeated bufman.dubbo.apache.org.module.v1alpha1.ModulePin current_module_pins = 2; +} + +message GetModulePinsResponse { + repeated bufman.dubbo.apache.org.module.v1alpha1.ModulePin module_pins = 1; +} + +// LocalResolveService is the local resolve service. +// +// This is called by ResolveService implementations, and is enterprise. +service LocalResolveService { + // GetLocalModulePins gets the latest pins for the specified local module references. + // It also includes all of the modules transitive dependencies for the specified references. + // + // We want this for two reasons: + // + // 1. It makes it easy to say "we know we're looking for owner/repo on this specific remote". + // While we could just do this in GetModulePins by being aware of what our remote is + // (something we probably still need to know, DNS problems aside, which are more + // theoretical), this helps. + // 2. Having a separate method makes us able to say "do not make decisions about what + // wins between competing pins for the same repo". This should only be done in + // GetModulePins, not in this function, i.e. only done at the top level. + rpc GetLocalModulePins(GetLocalModulePinsRequest) returns (GetLocalModulePinsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message GetLocalModulePinsRequest { + repeated bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference local_module_references = 1; +} + +enum ResolvedReferenceType { + RESOLVED_REFERENCE_TYPE_UNSPECIFIED = 0; + RESOLVED_REFERENCE_TYPE_COMMIT = 1; + RESOLVED_REFERENCE_TYPE_TAG = 3; + RESOLVED_REFERENCE_TYPE_DRAFT = 5; + + reserved 2, 4; + reserved "RESOLVED_REFERENCE_TYPE_BRANCH", "RESOLVED_REFERENCE_TYPE_TRACK"; +} + +message LocalModuleResolveResult { + // A copy of the reference that was resolved. + bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference reference = 1; + // The pin the reference resolved to. + bufman.dubbo.apache.org.registry.v1alpha1.LocalModulePin pin = 2; + // The type the reference resolved as. + ResolvedReferenceType resolved_reference_type = 3; +} + +message GetLocalModulePinsResponse { + repeated LocalModuleResolveResult local_module_resolve_results = 1; + + // dependencies are the dependencies of the LocalModulePins. + // + // This includes the transitive deps. + repeated bufman.dubbo.apache.org.module.v1alpha1.ModulePin dependencies = 2; +} + +message GetGoVersionRequest { + // The plugin reference to resolve. + GetRemotePackageVersionPlugin plugin_reference = 1; + // The module reference to resolve. + LocalModuleReference module_reference = 2; +} + +message GetGoVersionResponse { + // version is the resolved version to be used with the go module proxy. + string version = 1; +} + +message GetMavenVersionRequest { + // The plugin reference to resolve. + GetRemotePackageVersionPlugin plugin_reference = 1; + // The module reference to resolve. + LocalModuleReference module_reference = 2; +} + +message GetMavenVersionResponse { + // version is the resolved version to be used with the maven repository. + string version = 1; +} + +message GetNPMVersionRequest { + // The plugin reference to resolve. + GetRemotePackageVersionPlugin plugin_reference = 1; + // The module reference to resolve. + LocalModuleReference module_reference = 2; +} + +message GetNPMVersionResponse { + // version is the resolved version to be used with the npm registryv1alpha1. + string version = 1; +} + +message GetSwiftVersionRequest { + // The plugin reference to resolve. + GetRemotePackageVersionPlugin plugin_reference = 1; + // The module reference to resolve. + LocalModuleReference module_reference = 2; +} + +message GetSwiftVersionResponse { + // version is the resolved version to be used with the swift registryv1alpha1. + string version = 1; +} + +// GetRemotePackageVersionPlugin is a plugin reference. +// If the version is empty, this is a reference to the latest version. +message GetRemotePackageVersionPlugin { + // The owner of the plugin. + // example: bufbuild + string owner = 1; + // The name of the plugin. + // example: connect-go + string name = 2; + // The version of the plugin. + // If empty, this is a reference to the latest version. + // example: v1.0.0 + string version = 3; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/resource.proto b/pkg/bufman/proto/registry/v1alpha1/resource.proto new file mode 100644 index 000000000..a6ad1b9bd --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/resource.proto @@ -0,0 +1,35 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/plugin_curation.proto"; +import "registry/v1alpha1/repository.proto"; + +message Resource { + oneof resource { + Repository repository = 1; + CuratedPlugin plugin = 2; + } +} + +// ResourceService manages resources. +service ResourceService { + // GetResourceByName takes a resource name and returns the + // resource either as a repository or a plugin. + rpc GetResourceByName(GetResourceByNameRequest) returns (GetResourceByNameResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message GetResourceByNameRequest { + // Owner of the requested resource. + string owner = 1; + // Name of the requested resource. + string name = 2; +} + +message GetResourceByNameResponse { + Resource resource = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/role.proto b/pkg/bufman/proto/registry/v1alpha1/role.proto new file mode 100644 index 000000000..83159b853 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/role.proto @@ -0,0 +1,59 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +// The roles that users can have in a Server. +enum ServerRole { + SERVER_ROLE_UNSPECIFIED = 0; + SERVER_ROLE_ADMIN = 1; + SERVER_ROLE_MEMBER = 2; +} + +// The roles that users can have in a Organization. +enum OrganizationRole { + ORGANIZATION_ROLE_UNSPECIFIED = 0; + ORGANIZATION_ROLE_OWNER = 1; + ORGANIZATION_ROLE_ADMIN = 2; + ORGANIZATION_ROLE_MEMBER = 3; + ORGANIZATION_ROLE_MACHINE = 4; +} + +// The source of a user's role in an Organization. +enum OrganizationRoleSource { + ORGANIZATION_ROLE_SOURCE_UNSPECIFIED = 0; + ORGANIZATION_ROLE_SOURCE_DIRECT = 1; + ORGANIZATION_ROLE_SOURCE_JIT = 2; + ORGANIZATION_ROLE_SOURCE_IDP_GROUP = 3; +} + +// The roles that users can have for a Repository. +enum RepositoryRole { + REPOSITORY_ROLE_UNSPECIFIED = 0; + REPOSITORY_ROLE_OWNER = 1; + REPOSITORY_ROLE_ADMIN = 2; + REPOSITORY_ROLE_WRITE = 3; + REPOSITORY_ROLE_READ = 4; + REPOSITORY_ROLE_LIMITED_WRITE = 5; +} + +// The roles that users can have for a Template. +enum TemplateRole { + option deprecated = true; + TEMPLATE_ROLE_UNSPECIFIED = 0; + TEMPLATE_ROLE_OWNER = 1; + TEMPLATE_ROLE_ADMIN = 2; + TEMPLATE_ROLE_WRITE = 3; + TEMPLATE_ROLE_READ = 4; +} + +// The roles that users can have for a Plugin. +enum PluginRole { + option deprecated = true; + PLUGIN_ROLE_UNSPECIFIED = 0; + PLUGIN_ROLE_OWNER = 1; + PLUGIN_ROLE_ADMIN = 2; + PLUGIN_ROLE_WRITE = 3; + PLUGIN_ROLE_READ = 4; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/schema.proto b/pkg/bufman/proto/registry/v1alpha1/schema.proto new file mode 100644 index 000000000..6835758da --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/schema.proto @@ -0,0 +1,165 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/descriptor.proto"; + +// Provides endpoints for downloading dynamic schemas and for using schemas +// in validation and data transformation functions. +service SchemaService { + // GetSchema allows the caller to download a schema for one or more requested + // types, RPC services, or RPC methods. + rpc GetSchema(GetSchemaRequest) returns (GetSchemaResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + + // ConvertMessage allows the caller to convert a given message data blob from + // one format to another by referring to a type schema for the blob. + rpc ConvertMessage(ConvertMessageRequest) returns (ConvertMessageResponse); + // TODO: move this to ConvertService and remove its existing, unused endpoint. + + // TODO: batch or streaming endpoint, for more efficient conversion of many messages +} + +message GetSchemaRequest { + // The owner of the repo that contains the schema to retrieve (a user name or + // organization name). + string owner = 1; + // The name of the repo that contains the schema to retrieve. + string repository = 2; + // Optional version of the repo. If unspecified, defaults to latest version on + // the repo's "main" branch. + string version = 3; + + // Zero or more types names. The names may refer to messages, enums, services, + // methods, or extensions. All names must be fully-qualified. If any name + // is unknown, the request will fail and no schema will be returned. + // + // If no names are provided, the full schema for the module is returned. + // Otherwise, the resulting schema contains only the named elements and all of + // their dependencies. This is enough information for the caller to construct + // a dynamic message for any requested message types or to dynamically invoke + // an RPC for any requested methods or services. + repeated string types = 4; + + // If present, this is a commit that the client already has cached. So if the + // given module version resolves to this same commit, the server should not + // send back any descriptors since the client already has them. + // + // This allows a client to efficiently poll for updates: after the initial RPC + // to get a schema, the client can cache the descriptors and the resolved + // commit. It then includes that commit in subsequent requests in this field, + // and the server will only reply with a schema (and new commit) if/when the + // resolved commit changes. + string if_not_commit = 5; + + // If true, the returned schema will not include extension definitions for custom + // options that appear on schema elements. When filtering the schema based on the + // given element names, options on all encountered elements are usually examined + // as well. But that is not the case if excluding custom options. + // + // This flag is ignored if element_names is empty as the entire schema is always + // returned in that case. + bool exclude_custom_options = 6; + + // If true, the returned schema will not include known extensions for extendable + // messages for schema elements. If exclude_custom_options is true, such extensions + // may still be returned if the applicable descriptor options type is part of the + // requested schema. + // + // This flag is ignored if element_names is empty as the entire schema is always + // returned in that case. + bool exclude_known_extensions = 7; + + // TODO: consider providing a way for client to indicate what files the server + // can exclude, to reduce response size when caller already knows things + // (for example, usually no need to include google/protobuf/descriptor.proto) +} + +message GetSchemaResponse { + // The resolved version of the schema. If the requested version was a commit, + // this value is the same as that. If the requested version referred to a tag + // or branch, this is the commit for that tag or latest commit for that + // branch. If the request did not include any version, this is the latest + // version for the module's main branch. + string commit = 1; + // The schema, which is a set of file descriptors that include the requested elements + // and their dependencies. + google.protobuf.FileDescriptorSet schema_files = 2; +} + +message ConvertMessageRequest { + // The owner of the repo that contains the schema to retrieve (a user name or + // organization name). + string owner = 1; + // The name of the repo that contains the schema to retrieve. + string repository = 2; + // Optional version of the repo. This can be a tag or branch name or a commit. + // If unspecified, defaults to latest version on the repo's "main" branch. + string version = 3; + + // The fully-qualified name of the message. Required. + string message_name = 4; + + // The format of the input data. Required. + Format input_format = 5; + + // The input data that is to be converted. Required. This must be + // a valid encoding of type indicated by message_name in the format + // indicated by input_format. + bytes input_data = 6; + + // If true, any unresolvable fields in the input are discarded. For + // formats other than FORMAT_BINARY, this means that the operation + // will fail if the input contains unrecognized field names. For + // FORMAT_BINARY, unrecognized fields can be retained and possibly + // included in the reformatted output (depending on the requested + // output format). + bool discard_unknown = 7; + + oneof output_format { + BinaryOutputOptions output_binary = 8; + JSONOutputOptions output_json = 9; + TextOutputOptions output_text = 10; + } +} + +enum Format { + FORMAT_UNSPECIFIED = 0; + + FORMAT_BINARY = 1; + FORMAT_JSON = 2; + FORMAT_TEXT = 3; +} + +message BinaryOutputOptions {} + +message JSONOutputOptions { + // Enum fields will be emitted as numeric values. If false (the dafault), enum + // fields are emitted as strings that are the enum values' names. + bool use_enum_numbers = 3; + // Includes fields that have their default values. This applies only to fields + // defined in proto3 syntax that have no explicit "optional" keyword. Other + // optional fields will be included if present in the input data. + bool include_defaults = 4; +} + +message TextOutputOptions { + // If true and the input data includes unrecognized fields, the unrecognized + // fields will be preserved in the text output (using field numbers and raw + // values). + bool include_unrecognized = 2; +} + +message ConvertMessageResponse { + // The resolved version of the schema. If the requested version was a commit, + // this value is the same as that. If the requested version referred to a tag + // or branch, this is the commit for that tag or latest commit for that + // branch. If the request did not include any version, this is the latest + // version for the module's main branch. + string commit = 1; + // The reformatted data. + bytes output_data = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/scim_token.proto b/pkg/bufman/proto/registry/v1alpha1/scim_token.proto new file mode 100644 index 000000000..8bcbb55df --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/scim_token.proto @@ -0,0 +1,63 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +message SCIMToken { + string id = 1; + google.protobuf.Timestamp create_time = 2; + google.protobuf.Timestamp expire_time = 3; +} + +// TokenSCIMService is the SCIM Token service. +service SCIMTokenService { + // CreateToken creates a new token suitable for authentication to the SCIM API. + // + // This method requires authentication. + rpc CreateSCIMToken(CreateSCIMTokenRequest) returns (CreateSCIMTokenResponse); + // ListTokens lists all active SCIM tokens. + // + // This method requires authentication. + rpc ListSCIMTokens(ListSCIMTokensRequest) returns (ListSCIMTokensResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DeleteToken deletes an existing token. + // + // This method requires authentication. + rpc DeleteSCIMToken(DeleteSCIMTokenRequest) returns (DeleteSCIMTokenResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +message CreateSCIMTokenRequest { + // The time until which the token should be valid. + // Must be in the future. May be null for no expiry. + google.protobuf.Timestamp expire_time = 1; +} + +message CreateSCIMTokenResponse { + // The plaintext token to use for authentication. + string token = 1; +} + +message ListSCIMTokensRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; +} + +message ListSCIMTokensResponse { + repeated SCIMToken tokens = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message DeleteSCIMTokenRequest { + string token_id = 1; +} + +message DeleteSCIMTokenResponse {} diff --git a/pkg/bufman/proto/registry/v1alpha1/search.proto b/pkg/bufman/proto/registry/v1alpha1/search.proto new file mode 100644 index 000000000..0b2718728 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/search.proto @@ -0,0 +1,207 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/plugin.proto"; +import "registry/v1alpha1/repository.proto"; +import "registry/v1alpha1/repository_commit.proto"; +import "registry/v1alpha1/repository_tag.proto"; + +enum OrderBy { + ORDER_BY_UNSPECIFIED = 0; + ORDER_BY_CREATE_TIME = 1; + ORDER_BY_UPDATE_TIME = 2; + ORDER_BY_NAME = 3; +} + +message RepositorySearchResult { + string id = 1; + string name = 2; + // The name of the user + // who is the owner of this repository. + string owner = 3; + // The visibility of the repository. + Visibility visibility = 4; + bool deprecated = 5; +} + +message CommitSearchResult { + string id = 1; // commit id + string name = 2; // commit name + // The name of the user + // who is the owner of this repository. + string owner = 3; + // The name of the repository. + string repository_name = 4; +} + +message UserSearchResult { + string id = 1; + string username = 2; + bool deactivated = 3; +} + + +message CuratedPluginSearchResult { + string id = 1; + string name = 2; + // The name of the user or organization + // who is the owner of this plugin. + string owner = 3; + bool deprecated = 4; +} + +// SearchService is the search service. +service SearchService { + + // SearchUser searches users by username + rpc SearchUser(SearchUserRequest) returns (SearchUserResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + + // SearchRepository searches repositories by name or description + rpc SearchRepository(SearchRepositoryRequest) returns (SearchRepositoryResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + + // SearchCommitByContent searches last commit in same repo by idl content + // that means, for a repo, search results only record last matched commit + rpc SearchLastCommitByContent(SearchLastCommitByContentRequest) returns (SearchLastCommitByContentResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + + // SearchCurationPlugin search plugins by name or description + rpc SearchCurationPlugin(SearchCuratedPluginRequest) returns (SearchCuratedPluginResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + + // SearchTag searches for tags in a repository + rpc SearchTag(SearchTagRequest) returns (SearchTagResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // SearchDraft searches for drafts in a repository + rpc SearchDraft(SearchDraftRequest) returns (SearchDraftResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +message SearchUserRequest { + // The search string. + string query = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + // The field to order results by. + OrderBy order_by = 4; + // Reverse orders results in descending order. + bool reverse = 5; +} + +message SearchUserResponse { + repeated UserSearchResult users = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message SearchRepositoryRequest { + // The search string. + string query = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + // The field to order results by. + OrderBy order_by = 4; + // Reverse orders results in descending order. + bool reverse = 5; +} + +message SearchRepositoryResponse { + repeated RepositorySearchResult repositories = 1; + // There are no more pages if this is empty. + string next_page_token = 2; + +} + +message SearchLastCommitByContentRequest { + // The search string. + string query = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + // The field to order results by. + OrderBy order_by = 4; + // Reverse orders results in descending order. + bool reverse = 5; +} + +message SearchLastCommitByContentResponse { + repeated CommitSearchResult commits = 1; + // There are no more pages if this is empty. + string next_page_token = 2; + +} + +message SearchCuratedPluginRequest { + // The search string. + string query = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + // The field to order results by. + OrderBy order_by = 4; + // Reverse orders results in descending order. + bool reverse = 5; +} + +message SearchCuratedPluginResponse { + repeated CuratedPluginSearchResult plugins = 1; + // There are no more pages if this is empty. + string next_page_token = 2; + +} + +message SearchTagRequest { + // The owner of the repository. + string repository_owner = 1; + // The name of the repository. + string repository_name = 2; + // The search string. + string query = 3; + uint32 page_size = 4; + // The first page is returned if this is empty. + string page_token = 5; + // The field to order results by. + OrderBy order_by = 6; + // Reverse orders results in descending order. + bool reverse = 7; +} + +message SearchTagResponse { + repeated RepositoryTag repository_tags = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message SearchDraftRequest { + // The owner of the repository. + string repository_owner = 1; + // The name of the repository. + string repository_name = 2; + // The search string. + string query = 3; + uint32 page_size = 4; + // The first page is returned if this is empty. + string page_token = 5; + // The field to order results by. + OrderBy order_by = 6; + // Reverse orders results in descending order. + bool reverse = 7; +} + +message SearchDraftResponse { + repeated RepositoryCommit repository_commits = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/studio.proto b/pkg/bufman/proto/registry/v1alpha1/studio.proto new file mode 100644 index 000000000..1b8e53daa --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/studio.proto @@ -0,0 +1,44 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +// The protocols supported by Studio agent. +enum StudioAgentProtocol { + STUDIO_AGENT_PROTOCOL_UNSPECIFIED = 0; + STUDIO_AGENT_PROTOCOL_GRPC = 1; + STUDIO_AGENT_PROTOCOL_CONNECT = 2; +} + +// StudioAgentPreset is the information about an agent preset in the Studio. +message StudioAgentPreset { + // The target agent URL in the Studio. + string url = 1; + // The optional alias of the agent URL. + string alias = 2; + // The protocol the agent should use to forward requests. + StudioAgentProtocol protocol = 3; +} + +// StudioService is the Studio service. +service StudioService { + // ListStudioAgentPresets returns a list of agent presets in the server. + rpc ListStudioAgentPresets(ListStudioAgentPresetsRequest) returns (ListStudioAgentPresetsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // SetStudioAgentPresets sets the list of agent presets in the server. + rpc SetStudioAgentPresets(SetStudioAgentPresetsRequest) returns (SetStudioAgentPresetsResponse); +} + +message ListStudioAgentPresetsRequest {} + +message ListStudioAgentPresetsResponse { + repeated StudioAgentPreset agents = 1; +} + +message SetStudioAgentPresetsRequest { + repeated StudioAgentPreset agents = 1; +} + +message SetStudioAgentPresetsResponse {} diff --git a/pkg/bufman/proto/registry/v1alpha1/studio_request.proto b/pkg/bufman/proto/registry/v1alpha1/studio_request.proto new file mode 100644 index 000000000..f4a30bede --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/studio_request.proto @@ -0,0 +1,154 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +// StudioRequestService exposes the functionality to manage favorited Requests +// from Studio. +service StudioRequestService { + // CreateStudioRequest registers a favorite Studio Requests to the caller's + // BSR profile. + rpc CreateStudioRequest(CreateStudioRequestRequest) returns (CreateStudioRequestResponse) {} + // RenameStudioRequest renames an existing Studio Request. + rpc RenameStudioRequest(RenameStudioRequestRequest) returns (RenameStudioRequestResponse) {} + // DeleteStudioRequest removes a favorite Studio Request from the caller's BSR + // profile. + rpc DeleteStudioRequest(DeleteStudioRequestRequest) returns (DeleteStudioRequestResponse) { + option idempotency_level = IDEMPOTENT; + } + // ListStudioRequests shows the caller's favorited Studio Requests. + rpc ListStudioRequests(ListStudioRequestsRequest) returns (ListStudioRequestsResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +// StudioProtocol are the supported protocols for Studio Requests. +enum StudioProtocol { + // STUDIO_PROTOCOL_UNSPECIFIED is a safe default for requests with no protocol + // defined. + STUDIO_PROTOCOL_UNSPECIFIED = 0; + // STUDIO_PROTOCOL_CONNECT is the Connect protocol in Studio. + STUDIO_PROTOCOL_CONNECT = 1; + // STUDIO_PROTOCOL_GRPC is the gRPC protocol in Studio. + STUDIO_PROTOCOL_GRPC = 2; + // STUDIO_PROTOCOL_GRPC_WEB is the gRPC-web protocol in Studio. + STUDIO_PROTOCOL_GRPC_WEB = 3; +} + +// CreateStudioRequestRequest is the proto request representation of the +// CreateStudioRequest method. +message CreateStudioRequestRequest { + // The linked BSR repository owner name (user or organization). + string repository_owner = 1; + // The linked BSR repository name. + string repository_name = 2; + // The friendly name of this request. + string name = 3; + // The target base URL of this request. + string target_base_url = 4; + // The target service name as defined in the BSR repository. + string service = 5; + // The target RPC method name as defined in the BSR repository. + string method = 6; + // The request body as defined in Studio. + string body = 7; + // The request headers as defined in Studio. + map headers = 8; + // Should this request include cookies from the Studio current session? + bool include_cookies = 9; + // The protocol that Studio uses to send this request. + StudioProtocol protocol = 10; + // The agent url (if any) used by Studio to send the request. See + // https://docs.buf.build/bsr/studio#via-buf-studio-agent for details. + string agent_url = 11; +} + +// CreateStudioRequestResponse returns the created StudioRequest. +message CreateStudioRequestResponse { + // Created Studio Request. + StudioRequest created_request = 1; +} + +// RenameStudioRequestRequest is the proto request representation of the +// RenameStudioRequest method. +message RenameStudioRequestRequest { + // The Studio Request ID that will be renamed. + string id = 1; + // The new name for the request. + string new_name = 2; +} + +// RenameStudioRequestResponse returns empty on successful renaming. +message RenameStudioRequestResponse {} + +// DeleteStudioRequestRequest is the proto request representation of the +// DeleteStudioRequest method. +message DeleteStudioRequestRequest { + // The Studio Request ID that will be deleted. + string id = 1; +} + +// DeleteStudioRequestResponse returns empty on successful deletions. +message DeleteStudioRequestResponse {} + +// ListStudioRequestsRequest is the proto request representation of the +// ListStudioRequests method. +message ListStudioRequestsRequest { + // The page size for listing studio requests, values between 1-250. + uint32 page_size = 1; + // The page token for paginating. The first page is returned if this is empty. + string page_token = 2; + // The listed studio requests are order by created time in ascending order. + // You can reverse that order setting this value to true. + bool reverse = 3; +} + +// ListStudioRequestsResponse is the proto response representation of the +// ListStudioRequests method. +message ListStudioRequestsResponse { + // The list of requests in the current page. + repeated StudioRequest requests = 1; + // The requests' next page token. There are no more pages if this is empty. + string next_page_token = 2; +} + +// StudioRequest represents a saved request in Studio, that is synced to a BSR +// user's profile. +message StudioRequest { + // The ID of this Studio Request. + string id = 1; + // The request creation timestamp. + google.protobuf.Timestamp create_time = 2; + // The request last updated timestamp. + google.protobuf.Timestamp update_time = 3; + // User ID who created and saved this request. + string author_user_id = 4; + // BSR repository ID this request is linked to. + string repository_id = 5; + // The friendly name of this request. + string name = 6; + // The target base URL of this request. + string target_base_url = 7; + // The BSR repository owner name (user or organization). + string repository_owner = 8; + // The BSR repository name. + string repository_name = 9; + // The target service name as defined in the BSR repository. + string service = 10; + // The target RPC method name as defined in the BSR repository. + string method = 11; + // The request body as defined in Studio. + string body = 12; + // The request headers as defined in Studio. + map headers = 13; + // Should this request include cookies from the Studio current session? + bool include_cookies = 14; + // The protocol that Studio uses to send this request. + StudioProtocol protocol = 15; + // The agent url (if any) used by Studio to send the request. See + // https://docs.buf.build/bsr/studio#via-buf-studio-agent for details. + string agent_url = 16; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/sync.proto b/pkg/bufman/proto/registry/v1alpha1/sync.proto new file mode 100644 index 000000000..ef4e46d8e --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/sync.proto @@ -0,0 +1,72 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "module/v1alpha1/module.proto"; +import "registry/v1alpha1/git_metadata.proto"; + +// GitSyncPoint is the sync point for a particular module contained in a Git repository. +message GitSyncPoint { + string owner = 1; + string repository = 2; + string branch = 3; + string git_commit_hash = 4; + string bsr_commit_name = 5; +} + +// SyncService is the Sync service. +service SyncService { + // GetGitSyncPoint retrieves the Git sync point for the named repository + // on the specified branch. + rpc GetGitSyncPoint(GetGitSyncPointRequest) returns (GetGitSyncPointResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // SyncGitCommit syncs a Git commit containing a module to a named repository. + rpc SyncGitCommit(SyncGitCommitRequest) returns (SyncGitCommitResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +message GetGitSyncPointRequest { + // Owner is the owner of the BSR repository. + string owner = 1; + // Repository is the name of the BSR repository. + string repository = 2; + // Branch is the Git branch for which to look up the commit. + string branch = 3; +} + +message GetGitSyncPointResponse { + // SyncPoint is the latest syncpoint for the specified owner/repo/branch. + GitSyncPoint sync_point = 1; +} + +message SyncGitCommitRequest { + // Owner is the owner of the BSR repository. + string owner = 1; + // Repository is the name of the BSR repository. + string repository = 2; + // Branch is the Git branch that this commit belongs to. + string branch = 3; + // Manifest with all the module files being pushed. + bufman.dubbo.apache.org.module.v1alpha1.Blob manifest = 4; + // Referenced blobs in the manifest. Keep in mind there is not necessarily one + // blob per file, but one blob per digest, so for files with exactly the same + // content, you can send just one blob. + repeated bufman.dubbo.apache.org.module.v1alpha1.Blob blobs = 5; + // Hash is the SHA1 hash of the Git commit. + string hash = 6; + // Author is the author of the Git commit. This is typically an end-user. + GitIdentity author = 7; + // Commiter is the commiter of the Git commit. This typically a CI system. + GitIdentity commiter = 8; + // Tags are the Git tags which point to this commit. + repeated string tags = 9; +} + +message SyncGitCommitResponse { + // SyncPoint is the latest syncpoint for the SyncGitCommit request. + GitSyncPoint sync_point = 1; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/token.proto b/pkg/bufman/proto/registry/v1alpha1/token.proto new file mode 100644 index 000000000..f1cce9163 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/token.proto @@ -0,0 +1,87 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +message Token { + string id = 1; + google.protobuf.Timestamp create_time = 2; + google.protobuf.Timestamp expire_time = 3; + string note = 4; +} + +// TokenService is the Token service. +service TokenService { + // CreateToken creates a new token suitable for machine-to-machine authentication. + rpc CreateToken(CreateTokenRequest) returns (CreateTokenResponse); + // GetToken gets the specific token for the user + // + // This method requires authentication. + rpc GetToken(GetTokenRequest) returns (GetTokenResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListTokens lists the users active tokens + // + // This method requires authentication. + rpc ListTokens(ListTokensRequest) returns (ListTokensResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DeleteToken deletes an existing token. + // + // This method requires authentication. + rpc DeleteToken(DeleteTokenRequest) returns (DeleteTokenResponse) { + option idempotency_level = IDEMPOTENT; + } +} + +message CreateTokenRequest { + string note = 1; + // The time until which the token should be valid. + // Must be in the future. May be null for no expiry. + google.protobuf.Timestamp expire_time = 2; + // The ID of the user to create a new token, can only be + // the user who perform this action, or a machine user. + // Default to the user who perform this action if this is empty. + string user_id = 3; + string username = 4; + string password = 5; +} + +message CreateTokenResponse { + // The plaintext token to use for authentication. + string token = 1; +} + +message GetTokenRequest { + string token_id = 1; +} + +message GetTokenResponse { + Token token = 1; +} + +message ListTokensRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; + // The ID of the user to list tokens, can only be + // the user who perform this action, or a machine user. + // Default to the user who perform this action if this is empty. + string user_id = 4; +} + +message ListTokensResponse { + repeated Token tokens = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message DeleteTokenRequest { + string token_id = 1; +} + +message DeleteTokenResponse {} diff --git a/pkg/bufman/proto/registry/v1alpha1/user.proto b/pkg/bufman/proto/registry/v1alpha1/user.proto new file mode 100644 index 000000000..ee795d80a --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/user.proto @@ -0,0 +1,190 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "registry/v1alpha1/role.proto"; +import "registry/v1alpha1/verification_status.proto"; +import "google/protobuf/timestamp.proto"; + +message User { + // primary key, unique, immutable + string id = 1; + // immutable + google.protobuf.Timestamp create_time = 2; + // mutable + google.protobuf.Timestamp update_time = 3; + // unique, mutable + string username = 4; + // mutable + bool deactivated = 5; + // description is the user configurable description of the user. + string description = 6; + // url is the user configurable URL in the description of the user, + // always included the scheme and will not have a #fragment suffix. + string url = 7; + // verification status of the user, configurable by server admin. + VerificationStatus verification_status = 8; + // user type of the user, depends on how the user was created. + UserType user_type = 9; +} + +// TODO: #663 move this to organization service +message OrganizationUser { + User user = 1; + // The ID of the organization for which the role belongs to. + string organization_id = 2; + // The role that the user has in the organization above. + OrganizationRole organization_role = 3; + // The source of the user's role in the organization above. + OrganizationRoleSource organization_role_source = 4; +} + +enum UserState { + USER_STATE_UNSPECIFIED = 0; + USER_STATE_ACTIVE = 1; + USER_STATE_DEACTIVATED = 2; +} + +enum UserType { + USER_TYPE_UNSPECIFIED = 0; + USER_TYPE_PERSONAL = 1; + USER_TYPE_MACHINE = 2; + USER_TYPE_SYSTEM = 3; +} + +// UserService is the User service. +service UserService { + // CreateUser creates a new user with the given username. + rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) { + option idempotency_level = IDEMPOTENT; + } + // GetUser gets a user by ID. + rpc GetUser(GetUserRequest) returns (GetUserResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // GetUserByUsername gets a user by username. + rpc GetUserByUsername(GetUserByUsernameRequest) returns (GetUserByUsernameResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListUsers lists all users. + rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // ListOrganizationUsers lists all users for an organization. + // TODO: #663 move this to organization service + rpc ListOrganizationUsers(ListOrganizationUsersRequest) returns (ListOrganizationUsersResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // DeleteUser deletes a user. + rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse) { + option idempotency_level = IDEMPOTENT; + } + // Deactivate user deactivates a user. + rpc DeactivateUser(DeactivateUserRequest) returns (DeactivateUserResponse) { + option idempotency_level = IDEMPOTENT; + } + // UpdateUserServerRole update the role of an user in the server. + rpc UpdateUserServerRole(UpdateUserServerRoleRequest) returns (UpdateUserServerRoleResponse); + // CountUsers returns the number of users in the server by the user state provided. + rpc CountUsers(CountUsersRequest) returns (CountUsersResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } + // UpdateUserSettings update the user settings including description. + rpc UpdateUserSettings(UpdateUserSettingsRequest) returns (UpdateUserSettingsResponse); +} + +message CreateUserRequest { + string username = 1; + string password = 2; +} + +message CreateUserResponse { + User user = 1; +} + +message GetUserRequest { + string id = 1; +} + +message GetUserResponse { + User user = 1; +} + +message GetUserByUsernameRequest { + string username = 1; +} + +message GetUserByUsernameResponse { + User user = 1; +} + +message ListUsersRequest { + uint32 page_size = 1; + // The first page is returned if this is empty. + string page_token = 2; + bool reverse = 3; + // If the user_state_filter is unspecified, users of all states are included. + UserState user_state_filter = 4; + // If the user_type_filters is empty, users of all types are included. + repeated UserType user_type_filters = 5; +} + +message ListUsersResponse { + repeated User users = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message ListOrganizationUsersRequest { + string organization_id = 1; + uint32 page_size = 2; + // The first page is returned if this is empty. + string page_token = 3; + bool reverse = 4; +} + +message ListOrganizationUsersResponse { + repeated OrganizationUser users = 1; + // There are no more pages if this is empty. + string next_page_token = 2; +} + +message DeleteUserRequest {} + +message DeleteUserResponse {} + +message DeactivateUserRequest { + string id = 1; +} + +message DeactivateUserResponse {} + +message UpdateUserServerRoleRequest { + // The ID of the user for which to be updated a role. + string user_id = 1; + // The new role of the user in the server. + ServerRole server_role = 2; +} + +message UpdateUserServerRoleResponse {} + +message CountUsersRequest { + // If the user_state_filter is unspecified, all users are included. + UserState user_state_filter = 1; +} + +message CountUsersResponse { + uint32 total_count = 1; +} + +message UpdateUserSettingsRequest { + string user_id = 1; + // optional, update to description will only be made when this is present + optional string description = 2; + // optional, update to url will only be made when this is present + optional string url = 3; +} + +message UpdateUserSettingsResponse {} diff --git a/pkg/bufman/proto/registry/v1alpha1/verification_status.proto b/pkg/bufman/proto/registry/v1alpha1/verification_status.proto new file mode 100644 index 000000000..96a2ad991 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/verification_status.proto @@ -0,0 +1,16 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +// VerificationStatus is the verification status of an owner on if we recognize them, +// an owner can be either user or organization. +enum VerificationStatus { + VERIFICATION_STATUS_UNSPECIFIED = 0; + // OFFICIAL indicates that the owner is maintained by Buf. + VERIFICATION_STATUS_OFFICIAL = 1; + // VERIFIED_PUBLISHER indicates that the owner is a third-party that has been + // verified by Buf. + VERIFICATION_STATUS_VERIFIED_PUBLISHER = 2; +} diff --git a/pkg/bufman/proto/registry/v1alpha1/webhook.proto b/pkg/bufman/proto/registry/v1alpha1/webhook.proto new file mode 100644 index 000000000..1ebf5f265 --- /dev/null +++ b/pkg/bufman/proto/registry/v1alpha1/webhook.proto @@ -0,0 +1,108 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.registry.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +// WebhookService exposes the functionality for a caller to +// create/delete/list Webhooks for a given repository event. +service WebhookService { + // Create a webhook, subscribes to a given repository event for a callback URL + // invocation. + rpc CreateWebhook(CreateWebhookRequest) returns (CreateWebhookResponse) { + option idempotency_level = IDEMPOTENT; + } + // Delete a webhook removes the event subscription. + rpc DeleteWebhook(DeleteWebhookRequest) returns (DeleteWebhookResponse) { + option idempotency_level = IDEMPOTENT; + } + // Lists the webhooks subscriptions for a given repository. + rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} + +// CreateWebhookRequest is the proto request representation of a +// webhook request body. +message CreateWebhookRequest { + // The event to subscribe to for the given repository. + WebhookEvent webhook_event = 1; + // The owner name of the repository in the corresponding subscription request. + string owner_name = 2; + // The repository name that the subscriber wishes create a subscription for. + string repository_name = 3; + // The subscriber's callback URL where notifications should be delivered. + string callback_url = 4; +} + +// WebhookEvent contains the currently supported webhook event types. +enum WebhookEvent { + // WEBHOOK_EVENT_UNSPECIFIED is a safe noop default for webhook events + // subscription. It will trigger an error if trying to register a webhook with + // this event. + WEBHOOK_EVENT_UNSPECIFIED = 0; + // WEBHOOK_EVENT_REPOSITORY_PUSH is emitted whenever a successful buf push is + // completed for a specific repository. + WEBHOOK_EVENT_REPOSITORY_PUSH = 1; +} + +// CreateWebhookResponse is the proto response representation +// of a webhook request. +message CreateWebhookResponse { + // Created webhook subscription. + Webhook webhook = 1; +} + +// DeleteWebhookRequest is the request for unsubscribing to a webhook. +message DeleteWebhookRequest { + // The id of the webhook subscription to delete. + string webhook_id = 1; +} + +// DeleteWebhookResponse is the response for unsubscribing +// from a webhook. +message DeleteWebhookResponse {} + +// ListWebhooksRequest is the request to get the +// list of subscribed webhooks for a given repository. +message ListWebhooksRequest { + // The repository name given in the corresponding subscription request. + string repository_name = 1; + // The owner associated with the repository. + string owner_name = 2; + // The page token for paginating. + string page_token = 3; +} + +// ListWebhooksResponse is the response for the list of +// subscribed webhooks for a given repository. +message ListWebhooksResponse { + // The list of subscribed webhooks for a given repository. + repeated Webhook webhooks = 1; + // The next page token for paginating. + string next_page_token = 2; +} + +// Webhook is the representation of a webhook repository event subscription. +message Webhook { + // The event associated with the subscription id. + WebhookEvent event = 1; + // The id of the associated subscription. + string webhook_id = 2; + // The webhook creation timestamp. + google.protobuf.Timestamp create_time = 3; + // The webhook last updated timestamp. + google.protobuf.Timestamp update_time = 4; + // The webhook repository name. + string repository_name = 5; + // The webhook repository owner name. + string owner_name = 6; + // The subscriber's callback URL where notifications are delivered. Currently + // we only support Connect-powered backends with application/proto as the + // content type. Make sure that your URL ends with + // "/bufman.dubbo.apache.org.webhook.v1alpha1.EventService/Event". For more information + // about Connect, see https://connect.build. + string callback_url = 7; +} diff --git a/pkg/bufman/proto/studio/v1alpha1/invoke.proto b/pkg/bufman/proto/studio/v1alpha1/invoke.proto new file mode 100644 index 000000000..52382efb6 --- /dev/null +++ b/pkg/bufman/proto/studio/v1alpha1/invoke.proto @@ -0,0 +1,64 @@ + + +syntax = "proto3"; + +// The bufman.dubbo.apache.org.studio.v1alpha1 package contains types used by the buf studio +// agent. Because browsers are not capable of sending gRPC requests directly, +// users can run a studio agent to that receives enveloped requests from the +// browser and forwards them as gRPC requests. +// +// Ideally the agent would be simple protocol translating HTTP proxy without +// requiring any custom envelope. Unfortunately, js in the browser cannot set +// per request proxy configuration and we cannot specify that we want to open a +// connection to the request agent while specifying a different server in the +// request's Host header. The studio agent and UI could communicate this through +// a custom header instead, but reading custom headers requires a CORS-preflight +// request. +// +// To facilitate easier deployment it in environments with complicated edge +// configuration, it is a goal for the agent and UI to communicate without the +// need for a CORS-preflight requests. This limits our ability to use custom +// headers and restricts allowed values for the Content-Type header. Due to this +// we cannot simply use gRPC-Web with an additional header, but instead rely on +// enveloping the request and responses in a base64 encoded binary proto message +// sent over a POST endpoint with text/plain as Content-Type. +// +// We may explore other transports such as WebSockets or WebTransport, at which +// point we should define proper proto services and methods here as well. +package bufman.dubbo.apache.org.studio.v1alpha1; + +// Headers encode HTTP headers. +message Headers { + string key = 1; + repeated string value = 2; +} + +// InvokeRequest encodes an enveloped RPC request. See the package documentation +// for more information. +message InvokeRequest { + // Target server the agent should forward this request to, e.g. + // "https://api.acme.corp/pkg.Service/Method". Using the "http" scheme will + // cause the request to be forwarded as h2c, whereas "https" forwards the + // request with regular h2. + string target = 1; + + // Headers to send with the request. If body is set, a Content-Type header + // must be specified. + repeated Headers headers = 2; + + // The message to be sent in the request (without any protocol specific framing). + bytes body = 3; +} + +// InvokeResponse encodes an enveloped RPC response. See the package documentation +// for more information. +message InvokeResponse { + // Headers received in the response. + repeated Headers headers = 1; + + // The encoded message received in the response (without protocol specific framing). + bytes body = 2; + + // Trailers received in the response. + repeated Headers trailers = 3; +} diff --git a/pkg/bufman/proto/wasmplugin/v1/wasmplugin.proto b/pkg/bufman/proto/wasmplugin/v1/wasmplugin.proto new file mode 100644 index 000000000..ac95375e6 --- /dev/null +++ b/pkg/bufman/proto/wasmplugin/v1/wasmplugin.proto @@ -0,0 +1,44 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.wasmplugin.v1; + +// ExecConfig describes buf specific extensions for a wasm plugin. A ExecConfig may +// be encoded in a custom WASM section named ".bufplugin", see +// (https://webassembly.github.io/spec/core/binary/modules.html#binary-customsec) +// for more info. +message ExecConfig { + // When no ABI is provided, buf will make a best effort guess based on + // the functions the wasm module exports. + WasmABI wasm_abi = 1; + + // The arguments that should be passed when running this plugin. Useful + // for interpreted languages where the main wasm bundle is only the + // interpreter. + repeated string args = 2; + + // Files that should be made available to the WASI fs when running this + // plugin. Useful for interpreted languages where the main wasm bundle + // is only the interpreter. + repeated File files = 3; +} + +// WASM_ABI specifies the abi this module expects buf to provide. +enum WasmABI { + WASM_ABI_UNSPECIFIED = 0; + + // Plugins compiled against + // https://github.com/WebAssembly/WASI/releases/tag/snapshot-01. + WASM_ABI_WASI_SNAPSHOT_PREVIEW1 = 1; + + // Plugins compiled with `GOOS=js` and `GOARCH=wasm`. + WASM_ABI_GOJS = 2; +} + +// File represents a file that must be made available to the wasi plugin. +message File { + // Normalized path with `/` as directory separator. + string path = 1; + bytes contents = 2; +} diff --git a/pkg/bufman/proto/webhook/v1alpha1/event.proto b/pkg/bufman/proto/webhook/v1alpha1/event.proto new file mode 100644 index 000000000..de7e5d857 --- /dev/null +++ b/pkg/bufman/proto/webhook/v1alpha1/event.proto @@ -0,0 +1,47 @@ + + +syntax = "proto3"; + +package bufman.dubbo.apache.org.webhook.v1alpha1; + +import "registry/v1alpha1/repository.proto"; +import "registry/v1alpha1/repository_commit.proto"; +import "registry/v1alpha1/webhook.proto"; +import "google/protobuf/timestamp.proto"; + +// EventService is the service which receives webhook events from Buf. +service EventService { + // Event is the rpc which receives webhook events. + rpc Event(EventRequest) returns (EventResponse); +} + +// EventRequest is the request payload that will be sent to the customer +// that is subscribed to webhook events in the BSR. +message EventRequest { + // The webhook event that was triggered. This event is the same one that is + // registered when creating a webhook in the BSR. + bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent event = 1; + // The event payload of the event was triggered. + EventPayload payload = 2; +} + +// EventPayload contains the actual event payload for all possible +// webhook event types. +message EventPayload { + oneof payload { + RepositoryPushEvent repository_push = 1; + } +} + +// EventResponse is the empty response payload from the customer to Buf. +message EventResponse {} + +// Payload for the event WEBHOOK_EVENT_REPOSITORY_PUSH. +message RepositoryPushEvent { + // The timestamp of the commit push. + google.protobuf.Timestamp event_time = 1; + // The repository commit that was pushed. + bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit repository_commit = 2; + // The repository that was pushed. + bufman.dubbo.apache.org.registry.v1alpha1.Repository repository = 3; +} From 4ce1d134cd880897c624f51c038aeb236e255a64 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:26:59 +0800 Subject: [PATCH 02/18] bufman generate code by buf build --- pkg/bufman/buf.gen.yaml | 31 + pkg/bufman/gen/data/dataspdx/dataspdx.gen.go | 1537 ++++++++++++++++++ pkg/bufman/gen/data/datawkt/datawkt.gen.go | 174 ++ 3 files changed, 1742 insertions(+) create mode 100644 pkg/bufman/buf.gen.yaml create mode 100644 pkg/bufman/gen/data/dataspdx/dataspdx.gen.go create mode 100644 pkg/bufman/gen/data/datawkt/datawkt.gen.go diff --git a/pkg/bufman/buf.gen.yaml b/pkg/bufman/buf.gen.yaml new file mode 100644 index 000000000..dcf5124a6 --- /dev/null +++ b/pkg/bufman/buf.gen.yaml @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +version: v1 +managed: + enabled: true + go_package_prefix: + default: github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go +plugins: + - plugin: go + out: gen/proto/go + opt: paths=source_relative + - plugin: buf.build/grpc/go + out: gen/proto/go + opt: paths=source_relative + - plugin: buf.build/bufbuild/connect-go + out: gen/proto/connect + opt: paths=source_relative \ No newline at end of file diff --git a/pkg/bufman/gen/data/dataspdx/dataspdx.gen.go b/pkg/bufman/gen/data/dataspdx/dataspdx.gen.go new file mode 100644 index 000000000..1264e8714 --- /dev/null +++ b/pkg/bufman/gen/data/dataspdx/dataspdx.gen.go @@ -0,0 +1,1537 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by spdx-go-data. DO NOT EDIT. + +package dataspdx + +import "strings" + +// LicenseInfo is SPDX license information. +// +// See https://spdx.org/licenses. +type LicenseInfo interface { + // The SPDX identifier. + // + // Case-sensitive. + ID() string +} + +// GetLicenseInfo gets the LicenseInfo for the id. +// +// The parameter id is not case-sensitive. +func GetLicenseInfo(id string) (LicenseInfo, bool) { + licenseInfo, ok := lowercaseIDToLicenseInfo[strings.ToLower(id)] + return licenseInfo, ok +} + +var lowercaseIDToLicenseInfo = map[string]*licenseInfo{ + "0bsd": { + id: "0BSD", + }, + "aal": { + id: "AAL", + }, + "abstyles": { + id: "Abstyles", + }, + "adobe-2006": { + id: "Adobe-2006", + }, + "adobe-glyph": { + id: "Adobe-Glyph", + }, + "adsl": { + id: "ADSL", + }, + "afl-1.1": { + id: "AFL-1.1", + }, + "afl-1.2": { + id: "AFL-1.2", + }, + "afl-2.0": { + id: "AFL-2.0", + }, + "afl-2.1": { + id: "AFL-2.1", + }, + "afl-3.0": { + id: "AFL-3.0", + }, + "afmparse": { + id: "Afmparse", + }, + "agpl-1.0": { + id: "AGPL-1.0", + }, + "agpl-1.0-only": { + id: "AGPL-1.0-only", + }, + "agpl-1.0-or-later": { + id: "AGPL-1.0-or-later", + }, + "agpl-3.0": { + id: "AGPL-3.0", + }, + "agpl-3.0-only": { + id: "AGPL-3.0-only", + }, + "agpl-3.0-or-later": { + id: "AGPL-3.0-or-later", + }, + "aladdin": { + id: "Aladdin", + }, + "amdplpa": { + id: "AMDPLPA", + }, + "aml": { + id: "AML", + }, + "ampas": { + id: "AMPAS", + }, + "antlr-pd": { + id: "ANTLR-PD", + }, + "antlr-pd-fallback": { + id: "ANTLR-PD-fallback", + }, + "apache-1.0": { + id: "Apache-1.0", + }, + "apache-1.1": { + id: "Apache-1.1", + }, + "apache-2.0": { + id: "Apache-2.0", + }, + "apafml": { + id: "APAFML", + }, + "apl-1.0": { + id: "APL-1.0", + }, + "app-s2p": { + id: "App-s2p", + }, + "apsl-1.0": { + id: "APSL-1.0", + }, + "apsl-1.1": { + id: "APSL-1.1", + }, + "apsl-1.2": { + id: "APSL-1.2", + }, + "apsl-2.0": { + id: "APSL-2.0", + }, + "arphic-1999": { + id: "Arphic-1999", + }, + "artistic-1.0": { + id: "Artistic-1.0", + }, + "artistic-1.0-cl8": { + id: "Artistic-1.0-cl8", + }, + "artistic-1.0-perl": { + id: "Artistic-1.0-Perl", + }, + "artistic-2.0": { + id: "Artistic-2.0", + }, + "baekmuk": { + id: "Baekmuk", + }, + "bahyph": { + id: "Bahyph", + }, + "barr": { + id: "Barr", + }, + "beerware": { + id: "Beerware", + }, + "bitstream-vera": { + id: "Bitstream-Vera", + }, + "bittorrent-1.0": { + id: "BitTorrent-1.0", + }, + "bittorrent-1.1": { + id: "BitTorrent-1.1", + }, + "blessing": { + id: "blessing", + }, + "blueoak-1.0.0": { + id: "BlueOak-1.0.0", + }, + "borceux": { + id: "Borceux", + }, + "bsd-1-clause": { + id: "BSD-1-Clause", + }, + "bsd-2-clause": { + id: "BSD-2-Clause", + }, + "bsd-2-clause-freebsd": { + id: "BSD-2-Clause-FreeBSD", + }, + "bsd-2-clause-netbsd": { + id: "BSD-2-Clause-NetBSD", + }, + "bsd-2-clause-patent": { + id: "BSD-2-Clause-Patent", + }, + "bsd-2-clause-views": { + id: "BSD-2-Clause-Views", + }, + "bsd-3-clause": { + id: "BSD-3-Clause", + }, + "bsd-3-clause-attribution": { + id: "BSD-3-Clause-Attribution", + }, + "bsd-3-clause-clear": { + id: "BSD-3-Clause-Clear", + }, + "bsd-3-clause-lbnl": { + id: "BSD-3-Clause-LBNL", + }, + "bsd-3-clause-modification": { + id: "BSD-3-Clause-Modification", + }, + "bsd-3-clause-no-military-license": { + id: "BSD-3-Clause-No-Military-License", + }, + "bsd-3-clause-no-nuclear-license": { + id: "BSD-3-Clause-No-Nuclear-License", + }, + "bsd-3-clause-no-nuclear-license-2014": { + id: "BSD-3-Clause-No-Nuclear-License-2014", + }, + "bsd-3-clause-no-nuclear-warranty": { + id: "BSD-3-Clause-No-Nuclear-Warranty", + }, + "bsd-3-clause-open-mpi": { + id: "BSD-3-Clause-Open-MPI", + }, + "bsd-4-clause": { + id: "BSD-4-Clause", + }, + "bsd-4-clause-shortened": { + id: "BSD-4-Clause-Shortened", + }, + "bsd-4-clause-uc": { + id: "BSD-4-Clause-UC", + }, + "bsd-protection": { + id: "BSD-Protection", + }, + "bsd-source-code": { + id: "BSD-Source-Code", + }, + "bsl-1.0": { + id: "BSL-1.0", + }, + "busl-1.1": { + id: "BUSL-1.1", + }, + "bzip2-1.0.5": { + id: "bzip2-1.0.5", + }, + "bzip2-1.0.6": { + id: "bzip2-1.0.6", + }, + "c-uda-1.0": { + id: "C-UDA-1.0", + }, + "cal-1.0": { + id: "CAL-1.0", + }, + "cal-1.0-combined-work-exception": { + id: "CAL-1.0-Combined-Work-Exception", + }, + "caldera": { + id: "Caldera", + }, + "catosl-1.1": { + id: "CATOSL-1.1", + }, + "cc-by-1.0": { + id: "CC-BY-1.0", + }, + "cc-by-2.0": { + id: "CC-BY-2.0", + }, + "cc-by-2.5": { + id: "CC-BY-2.5", + }, + "cc-by-2.5-au": { + id: "CC-BY-2.5-AU", + }, + "cc-by-3.0": { + id: "CC-BY-3.0", + }, + "cc-by-3.0-at": { + id: "CC-BY-3.0-AT", + }, + "cc-by-3.0-de": { + id: "CC-BY-3.0-DE", + }, + "cc-by-3.0-igo": { + id: "CC-BY-3.0-IGO", + }, + "cc-by-3.0-nl": { + id: "CC-BY-3.0-NL", + }, + "cc-by-3.0-us": { + id: "CC-BY-3.0-US", + }, + "cc-by-4.0": { + id: "CC-BY-4.0", + }, + "cc-by-nc-1.0": { + id: "CC-BY-NC-1.0", + }, + "cc-by-nc-2.0": { + id: "CC-BY-NC-2.0", + }, + "cc-by-nc-2.5": { + id: "CC-BY-NC-2.5", + }, + "cc-by-nc-3.0": { + id: "CC-BY-NC-3.0", + }, + "cc-by-nc-3.0-de": { + id: "CC-BY-NC-3.0-DE", + }, + "cc-by-nc-4.0": { + id: "CC-BY-NC-4.0", + }, + "cc-by-nc-nd-1.0": { + id: "CC-BY-NC-ND-1.0", + }, + "cc-by-nc-nd-2.0": { + id: "CC-BY-NC-ND-2.0", + }, + "cc-by-nc-nd-2.5": { + id: "CC-BY-NC-ND-2.5", + }, + "cc-by-nc-nd-3.0": { + id: "CC-BY-NC-ND-3.0", + }, + "cc-by-nc-nd-3.0-de": { + id: "CC-BY-NC-ND-3.0-DE", + }, + "cc-by-nc-nd-3.0-igo": { + id: "CC-BY-NC-ND-3.0-IGO", + }, + "cc-by-nc-nd-4.0": { + id: "CC-BY-NC-ND-4.0", + }, + "cc-by-nc-sa-1.0": { + id: "CC-BY-NC-SA-1.0", + }, + "cc-by-nc-sa-2.0": { + id: "CC-BY-NC-SA-2.0", + }, + "cc-by-nc-sa-2.0-fr": { + id: "CC-BY-NC-SA-2.0-FR", + }, + "cc-by-nc-sa-2.0-uk": { + id: "CC-BY-NC-SA-2.0-UK", + }, + "cc-by-nc-sa-2.5": { + id: "CC-BY-NC-SA-2.5", + }, + "cc-by-nc-sa-3.0": { + id: "CC-BY-NC-SA-3.0", + }, + "cc-by-nc-sa-3.0-de": { + id: "CC-BY-NC-SA-3.0-DE", + }, + "cc-by-nc-sa-3.0-igo": { + id: "CC-BY-NC-SA-3.0-IGO", + }, + "cc-by-nc-sa-4.0": { + id: "CC-BY-NC-SA-4.0", + }, + "cc-by-nd-1.0": { + id: "CC-BY-ND-1.0", + }, + "cc-by-nd-2.0": { + id: "CC-BY-ND-2.0", + }, + "cc-by-nd-2.5": { + id: "CC-BY-ND-2.5", + }, + "cc-by-nd-3.0": { + id: "CC-BY-ND-3.0", + }, + "cc-by-nd-3.0-de": { + id: "CC-BY-ND-3.0-DE", + }, + "cc-by-nd-4.0": { + id: "CC-BY-ND-4.0", + }, + "cc-by-sa-1.0": { + id: "CC-BY-SA-1.0", + }, + "cc-by-sa-2.0": { + id: "CC-BY-SA-2.0", + }, + "cc-by-sa-2.0-uk": { + id: "CC-BY-SA-2.0-UK", + }, + "cc-by-sa-2.1-jp": { + id: "CC-BY-SA-2.1-JP", + }, + "cc-by-sa-2.5": { + id: "CC-BY-SA-2.5", + }, + "cc-by-sa-3.0": { + id: "CC-BY-SA-3.0", + }, + "cc-by-sa-3.0-at": { + id: "CC-BY-SA-3.0-AT", + }, + "cc-by-sa-3.0-de": { + id: "CC-BY-SA-3.0-DE", + }, + "cc-by-sa-4.0": { + id: "CC-BY-SA-4.0", + }, + "cc-pddc": { + id: "CC-PDDC", + }, + "cc0-1.0": { + id: "CC0-1.0", + }, + "cddl-1.0": { + id: "CDDL-1.0", + }, + "cddl-1.1": { + id: "CDDL-1.1", + }, + "cdl-1.0": { + id: "CDL-1.0", + }, + "cdla-permissive-1.0": { + id: "CDLA-Permissive-1.0", + }, + "cdla-permissive-2.0": { + id: "CDLA-Permissive-2.0", + }, + "cdla-sharing-1.0": { + id: "CDLA-Sharing-1.0", + }, + "cecill-1.0": { + id: "CECILL-1.0", + }, + "cecill-1.1": { + id: "CECILL-1.1", + }, + "cecill-2.0": { + id: "CECILL-2.0", + }, + "cecill-2.1": { + id: "CECILL-2.1", + }, + "cecill-b": { + id: "CECILL-B", + }, + "cecill-c": { + id: "CECILL-C", + }, + "cern-ohl-1.1": { + id: "CERN-OHL-1.1", + }, + "cern-ohl-1.2": { + id: "CERN-OHL-1.2", + }, + "cern-ohl-p-2.0": { + id: "CERN-OHL-P-2.0", + }, + "cern-ohl-s-2.0": { + id: "CERN-OHL-S-2.0", + }, + "cern-ohl-w-2.0": { + id: "CERN-OHL-W-2.0", + }, + "clartistic": { + id: "ClArtistic", + }, + "cnri-jython": { + id: "CNRI-Jython", + }, + "cnri-python": { + id: "CNRI-Python", + }, + "cnri-python-gpl-compatible": { + id: "CNRI-Python-GPL-Compatible", + }, + "coil-1.0": { + id: "COIL-1.0", + }, + "community-spec-1.0": { + id: "Community-Spec-1.0", + }, + "condor-1.1": { + id: "Condor-1.1", + }, + "copyleft-next-0.3.0": { + id: "copyleft-next-0.3.0", + }, + "copyleft-next-0.3.1": { + id: "copyleft-next-0.3.1", + }, + "cpal-1.0": { + id: "CPAL-1.0", + }, + "cpl-1.0": { + id: "CPL-1.0", + }, + "cpol-1.02": { + id: "CPOL-1.02", + }, + "crossword": { + id: "Crossword", + }, + "crystalstacker": { + id: "CrystalStacker", + }, + "cua-opl-1.0": { + id: "CUA-OPL-1.0", + }, + "cube": { + id: "Cube", + }, + "curl": { + id: "curl", + }, + "d-fsl-1.0": { + id: "D-FSL-1.0", + }, + "diffmark": { + id: "diffmark", + }, + "dl-de-by-2.0": { + id: "DL-DE-BY-2.0", + }, + "doc": { + id: "DOC", + }, + "dotseqn": { + id: "Dotseqn", + }, + "drl-1.0": { + id: "DRL-1.0", + }, + "dsdp": { + id: "DSDP", + }, + "dvipdfm": { + id: "dvipdfm", + }, + "ecl-1.0": { + id: "ECL-1.0", + }, + "ecl-2.0": { + id: "ECL-2.0", + }, + "ecos-2.0": { + id: "eCos-2.0", + }, + "efl-1.0": { + id: "EFL-1.0", + }, + "efl-2.0": { + id: "EFL-2.0", + }, + "egenix": { + id: "eGenix", + }, + "elastic-2.0": { + id: "Elastic-2.0", + }, + "entessa": { + id: "Entessa", + }, + "epics": { + id: "EPICS", + }, + "epl-1.0": { + id: "EPL-1.0", + }, + "epl-2.0": { + id: "EPL-2.0", + }, + "erlpl-1.1": { + id: "ErlPL-1.1", + }, + "etalab-2.0": { + id: "etalab-2.0", + }, + "eudatagrid": { + id: "EUDatagrid", + }, + "eupl-1.0": { + id: "EUPL-1.0", + }, + "eupl-1.1": { + id: "EUPL-1.1", + }, + "eupl-1.2": { + id: "EUPL-1.2", + }, + "eurosym": { + id: "Eurosym", + }, + "fair": { + id: "Fair", + }, + "fdk-aac": { + id: "FDK-AAC", + }, + "frameworx-1.0": { + id: "Frameworx-1.0", + }, + "freebsd-doc": { + id: "FreeBSD-DOC", + }, + "freeimage": { + id: "FreeImage", + }, + "fsfap": { + id: "FSFAP", + }, + "fsful": { + id: "FSFUL", + }, + "fsfullr": { + id: "FSFULLR", + }, + "ftl": { + id: "FTL", + }, + "gd": { + id: "GD", + }, + "gfdl-1.1": { + id: "GFDL-1.1", + }, + "gfdl-1.1-invariants-only": { + id: "GFDL-1.1-invariants-only", + }, + "gfdl-1.1-invariants-or-later": { + id: "GFDL-1.1-invariants-or-later", + }, + "gfdl-1.1-no-invariants-only": { + id: "GFDL-1.1-no-invariants-only", + }, + "gfdl-1.1-no-invariants-or-later": { + id: "GFDL-1.1-no-invariants-or-later", + }, + "gfdl-1.1-only": { + id: "GFDL-1.1-only", + }, + "gfdl-1.1-or-later": { + id: "GFDL-1.1-or-later", + }, + "gfdl-1.2": { + id: "GFDL-1.2", + }, + "gfdl-1.2-invariants-only": { + id: "GFDL-1.2-invariants-only", + }, + "gfdl-1.2-invariants-or-later": { + id: "GFDL-1.2-invariants-or-later", + }, + "gfdl-1.2-no-invariants-only": { + id: "GFDL-1.2-no-invariants-only", + }, + "gfdl-1.2-no-invariants-or-later": { + id: "GFDL-1.2-no-invariants-or-later", + }, + "gfdl-1.2-only": { + id: "GFDL-1.2-only", + }, + "gfdl-1.2-or-later": { + id: "GFDL-1.2-or-later", + }, + "gfdl-1.3": { + id: "GFDL-1.3", + }, + "gfdl-1.3-invariants-only": { + id: "GFDL-1.3-invariants-only", + }, + "gfdl-1.3-invariants-or-later": { + id: "GFDL-1.3-invariants-or-later", + }, + "gfdl-1.3-no-invariants-only": { + id: "GFDL-1.3-no-invariants-only", + }, + "gfdl-1.3-no-invariants-or-later": { + id: "GFDL-1.3-no-invariants-or-later", + }, + "gfdl-1.3-only": { + id: "GFDL-1.3-only", + }, + "gfdl-1.3-or-later": { + id: "GFDL-1.3-or-later", + }, + "giftware": { + id: "Giftware", + }, + "gl2ps": { + id: "GL2PS", + }, + "glide": { + id: "Glide", + }, + "glulxe": { + id: "Glulxe", + }, + "glwtpl": { + id: "GLWTPL", + }, + "gnuplot": { + id: "gnuplot", + }, + "gpl-1.0": { + id: "GPL-1.0", + }, + "gpl-1.0+": { + id: "GPL-1.0+", + }, + "gpl-1.0-only": { + id: "GPL-1.0-only", + }, + "gpl-1.0-or-later": { + id: "GPL-1.0-or-later", + }, + "gpl-2.0": { + id: "GPL-2.0", + }, + "gpl-2.0+": { + id: "GPL-2.0+", + }, + "gpl-2.0-only": { + id: "GPL-2.0-only", + }, + "gpl-2.0-or-later": { + id: "GPL-2.0-or-later", + }, + "gpl-2.0-with-autoconf-exception": { + id: "GPL-2.0-with-autoconf-exception", + }, + "gpl-2.0-with-bison-exception": { + id: "GPL-2.0-with-bison-exception", + }, + "gpl-2.0-with-classpath-exception": { + id: "GPL-2.0-with-classpath-exception", + }, + "gpl-2.0-with-font-exception": { + id: "GPL-2.0-with-font-exception", + }, + "gpl-2.0-with-gcc-exception": { + id: "GPL-2.0-with-GCC-exception", + }, + "gpl-3.0": { + id: "GPL-3.0", + }, + "gpl-3.0+": { + id: "GPL-3.0+", + }, + "gpl-3.0-only": { + id: "GPL-3.0-only", + }, + "gpl-3.0-or-later": { + id: "GPL-3.0-or-later", + }, + "gpl-3.0-with-autoconf-exception": { + id: "GPL-3.0-with-autoconf-exception", + }, + "gpl-3.0-with-gcc-exception": { + id: "GPL-3.0-with-GCC-exception", + }, + "gsoap-1.3b": { + id: "gSOAP-1.3b", + }, + "haskellreport": { + id: "HaskellReport", + }, + "hippocratic-2.1": { + id: "Hippocratic-2.1", + }, + "hpnd": { + id: "HPND", + }, + "hpnd-sell-variant": { + id: "HPND-sell-variant", + }, + "htmltidy": { + id: "HTMLTIDY", + }, + "ibm-pibs": { + id: "IBM-pibs", + }, + "icu": { + id: "ICU", + }, + "ijg": { + id: "IJG", + }, + "imagemagick": { + id: "ImageMagick", + }, + "imatix": { + id: "iMatix", + }, + "imlib2": { + id: "Imlib2", + }, + "info-zip": { + id: "Info-ZIP", + }, + "intel": { + id: "Intel", + }, + "intel-acpi": { + id: "Intel-ACPI", + }, + "interbase-1.0": { + id: "Interbase-1.0", + }, + "ipa": { + id: "IPA", + }, + "ipl-1.0": { + id: "IPL-1.0", + }, + "isc": { + id: "ISC", + }, + "jam": { + id: "Jam", + }, + "jasper-2.0": { + id: "JasPer-2.0", + }, + "jpnic": { + id: "JPNIC", + }, + "json": { + id: "JSON", + }, + "lal-1.2": { + id: "LAL-1.2", + }, + "lal-1.3": { + id: "LAL-1.3", + }, + "latex2e": { + id: "Latex2e", + }, + "leptonica": { + id: "Leptonica", + }, + "lgpl-2.0": { + id: "LGPL-2.0", + }, + "lgpl-2.0+": { + id: "LGPL-2.0+", + }, + "lgpl-2.0-only": { + id: "LGPL-2.0-only", + }, + "lgpl-2.0-or-later": { + id: "LGPL-2.0-or-later", + }, + "lgpl-2.1": { + id: "LGPL-2.1", + }, + "lgpl-2.1+": { + id: "LGPL-2.1+", + }, + "lgpl-2.1-only": { + id: "LGPL-2.1-only", + }, + "lgpl-2.1-or-later": { + id: "LGPL-2.1-or-later", + }, + "lgpl-3.0": { + id: "LGPL-3.0", + }, + "lgpl-3.0+": { + id: "LGPL-3.0+", + }, + "lgpl-3.0-only": { + id: "LGPL-3.0-only", + }, + "lgpl-3.0-or-later": { + id: "LGPL-3.0-or-later", + }, + "lgpllr": { + id: "LGPLLR", + }, + "libpng": { + id: "Libpng", + }, + "libpng-2.0": { + id: "libpng-2.0", + }, + "libselinux-1.0": { + id: "libselinux-1.0", + }, + "libtiff": { + id: "libtiff", + }, + "liliq-p-1.1": { + id: "LiLiQ-P-1.1", + }, + "liliq-r-1.1": { + id: "LiLiQ-R-1.1", + }, + "liliq-rplus-1.1": { + id: "LiLiQ-Rplus-1.1", + }, + "linux-man-pages-copyleft": { + id: "Linux-man-pages-copyleft", + }, + "linux-openib": { + id: "Linux-OpenIB", + }, + "lpl-1.0": { + id: "LPL-1.0", + }, + "lpl-1.02": { + id: "LPL-1.02", + }, + "lppl-1.0": { + id: "LPPL-1.0", + }, + "lppl-1.1": { + id: "LPPL-1.1", + }, + "lppl-1.2": { + id: "LPPL-1.2", + }, + "lppl-1.3a": { + id: "LPPL-1.3a", + }, + "lppl-1.3c": { + id: "LPPL-1.3c", + }, + "lzma-sdk-9.11-to-9.20": { + id: "LZMA-SDK-9.11-to-9.20", + }, + "lzma-sdk-9.22": { + id: "LZMA-SDK-9.22", + }, + "makeindex": { + id: "MakeIndex", + }, + "minpack": { + id: "Minpack", + }, + "miros": { + id: "MirOS", + }, + "mit": { + id: "MIT", + }, + "mit-0": { + id: "MIT-0", + }, + "mit-advertising": { + id: "MIT-advertising", + }, + "mit-cmu": { + id: "MIT-CMU", + }, + "mit-enna": { + id: "MIT-enna", + }, + "mit-feh": { + id: "MIT-feh", + }, + "mit-modern-variant": { + id: "MIT-Modern-Variant", + }, + "mit-open-group": { + id: "MIT-open-group", + }, + "mitnfa": { + id: "MITNFA", + }, + "motosoto": { + id: "Motosoto", + }, + "mpi-permissive": { + id: "mpi-permissive", + }, + "mpich2": { + id: "mpich2", + }, + "mpl-1.0": { + id: "MPL-1.0", + }, + "mpl-1.1": { + id: "MPL-1.1", + }, + "mpl-2.0": { + id: "MPL-2.0", + }, + "mpl-2.0-no-copyleft-exception": { + id: "MPL-2.0-no-copyleft-exception", + }, + "mplus": { + id: "mplus", + }, + "ms-lpl": { + id: "MS-LPL", + }, + "ms-pl": { + id: "MS-PL", + }, + "ms-rl": { + id: "MS-RL", + }, + "mtll": { + id: "MTLL", + }, + "mulanpsl-1.0": { + id: "MulanPSL-1.0", + }, + "mulanpsl-2.0": { + id: "MulanPSL-2.0", + }, + "multics": { + id: "Multics", + }, + "mup": { + id: "Mup", + }, + "naist-2003": { + id: "NAIST-2003", + }, + "nasa-1.3": { + id: "NASA-1.3", + }, + "naumen": { + id: "Naumen", + }, + "nbpl-1.0": { + id: "NBPL-1.0", + }, + "ncgl-uk-2.0": { + id: "NCGL-UK-2.0", + }, + "ncsa": { + id: "NCSA", + }, + "net-snmp": { + id: "Net-SNMP", + }, + "netcdf": { + id: "NetCDF", + }, + "newsletr": { + id: "Newsletr", + }, + "ngpl": { + id: "NGPL", + }, + "nicta-1.0": { + id: "NICTA-1.0", + }, + "nist-pd": { + id: "NIST-PD", + }, + "nist-pd-fallback": { + id: "NIST-PD-fallback", + }, + "nlod-1.0": { + id: "NLOD-1.0", + }, + "nlod-2.0": { + id: "NLOD-2.0", + }, + "nlpl": { + id: "NLPL", + }, + "nokia": { + id: "Nokia", + }, + "nosl": { + id: "NOSL", + }, + "noweb": { + id: "Noweb", + }, + "npl-1.0": { + id: "NPL-1.0", + }, + "npl-1.1": { + id: "NPL-1.1", + }, + "nposl-3.0": { + id: "NPOSL-3.0", + }, + "nrl": { + id: "NRL", + }, + "ntp": { + id: "NTP", + }, + "ntp-0": { + id: "NTP-0", + }, + "nunit": { + id: "Nunit", + }, + "o-uda-1.0": { + id: "O-UDA-1.0", + }, + "occt-pl": { + id: "OCCT-PL", + }, + "oclc-2.0": { + id: "OCLC-2.0", + }, + "odbl-1.0": { + id: "ODbL-1.0", + }, + "odc-by-1.0": { + id: "ODC-By-1.0", + }, + "ofl-1.0": { + id: "OFL-1.0", + }, + "ofl-1.0-no-rfn": { + id: "OFL-1.0-no-RFN", + }, + "ofl-1.0-rfn": { + id: "OFL-1.0-RFN", + }, + "ofl-1.1": { + id: "OFL-1.1", + }, + "ofl-1.1-no-rfn": { + id: "OFL-1.1-no-RFN", + }, + "ofl-1.1-rfn": { + id: "OFL-1.1-RFN", + }, + "ogc-1.0": { + id: "OGC-1.0", + }, + "ogdl-taiwan-1.0": { + id: "OGDL-Taiwan-1.0", + }, + "ogl-canada-2.0": { + id: "OGL-Canada-2.0", + }, + "ogl-uk-1.0": { + id: "OGL-UK-1.0", + }, + "ogl-uk-2.0": { + id: "OGL-UK-2.0", + }, + "ogl-uk-3.0": { + id: "OGL-UK-3.0", + }, + "ogtsl": { + id: "OGTSL", + }, + "oldap-1.1": { + id: "OLDAP-1.1", + }, + "oldap-1.2": { + id: "OLDAP-1.2", + }, + "oldap-1.3": { + id: "OLDAP-1.3", + }, + "oldap-1.4": { + id: "OLDAP-1.4", + }, + "oldap-2.0": { + id: "OLDAP-2.0", + }, + "oldap-2.0.1": { + id: "OLDAP-2.0.1", + }, + "oldap-2.1": { + id: "OLDAP-2.1", + }, + "oldap-2.2": { + id: "OLDAP-2.2", + }, + "oldap-2.2.1": { + id: "OLDAP-2.2.1", + }, + "oldap-2.2.2": { + id: "OLDAP-2.2.2", + }, + "oldap-2.3": { + id: "OLDAP-2.3", + }, + "oldap-2.4": { + id: "OLDAP-2.4", + }, + "oldap-2.5": { + id: "OLDAP-2.5", + }, + "oldap-2.6": { + id: "OLDAP-2.6", + }, + "oldap-2.7": { + id: "OLDAP-2.7", + }, + "oldap-2.8": { + id: "OLDAP-2.8", + }, + "oml": { + id: "OML", + }, + "openssl": { + id: "OpenSSL", + }, + "opl-1.0": { + id: "OPL-1.0", + }, + "opubl-1.0": { + id: "OPUBL-1.0", + }, + "oset-pl-2.1": { + id: "OSET-PL-2.1", + }, + "osl-1.0": { + id: "OSL-1.0", + }, + "osl-1.1": { + id: "OSL-1.1", + }, + "osl-2.0": { + id: "OSL-2.0", + }, + "osl-2.1": { + id: "OSL-2.1", + }, + "osl-3.0": { + id: "OSL-3.0", + }, + "parity-6.0.0": { + id: "Parity-6.0.0", + }, + "parity-7.0.0": { + id: "Parity-7.0.0", + }, + "pddl-1.0": { + id: "PDDL-1.0", + }, + "php-3.0": { + id: "PHP-3.0", + }, + "php-3.01": { + id: "PHP-3.01", + }, + "plexus": { + id: "Plexus", + }, + "polyform-noncommercial-1.0.0": { + id: "PolyForm-Noncommercial-1.0.0", + }, + "polyform-small-business-1.0.0": { + id: "PolyForm-Small-Business-1.0.0", + }, + "postgresql": { + id: "PostgreSQL", + }, + "psf-2.0": { + id: "PSF-2.0", + }, + "psfrag": { + id: "psfrag", + }, + "psutils": { + id: "psutils", + }, + "python-2.0": { + id: "Python-2.0", + }, + "python-2.0.1": { + id: "Python-2.0.1", + }, + "qhull": { + id: "Qhull", + }, + "qpl-1.0": { + id: "QPL-1.0", + }, + "rdisc": { + id: "Rdisc", + }, + "rhecos-1.1": { + id: "RHeCos-1.1", + }, + "rpl-1.1": { + id: "RPL-1.1", + }, + "rpl-1.5": { + id: "RPL-1.5", + }, + "rpsl-1.0": { + id: "RPSL-1.0", + }, + "rsa-md": { + id: "RSA-MD", + }, + "rscpl": { + id: "RSCPL", + }, + "ruby": { + id: "Ruby", + }, + "sax-pd": { + id: "SAX-PD", + }, + "saxpath": { + id: "Saxpath", + }, + "scea": { + id: "SCEA", + }, + "schemereport": { + id: "SchemeReport", + }, + "sendmail": { + id: "Sendmail", + }, + "sendmail-8.23": { + id: "Sendmail-8.23", + }, + "sgi-b-1.0": { + id: "SGI-B-1.0", + }, + "sgi-b-1.1": { + id: "SGI-B-1.1", + }, + "sgi-b-2.0": { + id: "SGI-B-2.0", + }, + "shl-0.5": { + id: "SHL-0.5", + }, + "shl-0.51": { + id: "SHL-0.51", + }, + "simpl-2.0": { + id: "SimPL-2.0", + }, + "sissl": { + id: "SISSL", + }, + "sissl-1.2": { + id: "SISSL-1.2", + }, + "sleepycat": { + id: "Sleepycat", + }, + "smlnj": { + id: "SMLNJ", + }, + "smppl": { + id: "SMPPL", + }, + "snia": { + id: "SNIA", + }, + "spencer-86": { + id: "Spencer-86", + }, + "spencer-94": { + id: "Spencer-94", + }, + "spencer-99": { + id: "Spencer-99", + }, + "spl-1.0": { + id: "SPL-1.0", + }, + "ssh-openssh": { + id: "SSH-OpenSSH", + }, + "ssh-short": { + id: "SSH-short", + }, + "sspl-1.0": { + id: "SSPL-1.0", + }, + "standardml-nj": { + id: "StandardML-NJ", + }, + "sugarcrm-1.1.3": { + id: "SugarCRM-1.1.3", + }, + "swl": { + id: "SWL", + }, + "tapr-ohl-1.0": { + id: "TAPR-OHL-1.0", + }, + "tcl": { + id: "TCL", + }, + "tcp-wrappers": { + id: "TCP-wrappers", + }, + "tmate": { + id: "TMate", + }, + "torque-1.1": { + id: "TORQUE-1.1", + }, + "tosl": { + id: "TOSL", + }, + "tu-berlin-1.0": { + id: "TU-Berlin-1.0", + }, + "tu-berlin-2.0": { + id: "TU-Berlin-2.0", + }, + "ucl-1.0": { + id: "UCL-1.0", + }, + "unicode-dfs-2015": { + id: "Unicode-DFS-2015", + }, + "unicode-dfs-2016": { + id: "Unicode-DFS-2016", + }, + "unicode-tou": { + id: "Unicode-TOU", + }, + "unlicense": { + id: "Unlicense", + }, + "upl-1.0": { + id: "UPL-1.0", + }, + "vim": { + id: "Vim", + }, + "vostrom": { + id: "VOSTROM", + }, + "vsl-1.0": { + id: "VSL-1.0", + }, + "w3c": { + id: "W3C", + }, + "w3c-19980720": { + id: "W3C-19980720", + }, + "w3c-20150513": { + id: "W3C-20150513", + }, + "watcom-1.0": { + id: "Watcom-1.0", + }, + "wsuipa": { + id: "Wsuipa", + }, + "wtfpl": { + id: "WTFPL", + }, + "wxwindows": { + id: "wxWindows", + }, + "x11": { + id: "X11", + }, + "x11-distribute-modifications-variant": { + id: "X11-distribute-modifications-variant", + }, + "xerox": { + id: "Xerox", + }, + "xfree86-1.1": { + id: "XFree86-1.1", + }, + "xinetd": { + id: "xinetd", + }, + "xnet": { + id: "Xnet", + }, + "xpp": { + id: "xpp", + }, + "xskat": { + id: "XSkat", + }, + "ypl-1.0": { + id: "YPL-1.0", + }, + "ypl-1.1": { + id: "YPL-1.1", + }, + "zed": { + id: "Zed", + }, + "zend-2.0": { + id: "Zend-2.0", + }, + "zimbra-1.3": { + id: "Zimbra-1.3", + }, + "zimbra-1.4": { + id: "Zimbra-1.4", + }, + "zlib": { + id: "Zlib", + }, + "zlib-acknowledgement": { + id: "zlib-acknowledgement", + }, + "zpl-1.1": { + id: "ZPL-1.1", + }, + "zpl-2.0": { + id: "ZPL-2.0", + }, + "zpl-2.1": { + id: "ZPL-2.1", + }, +} + +type licenseInfo struct { + id string +} + +func (l *licenseInfo) ID() string { + return l.id +} diff --git a/pkg/bufman/gen/data/datawkt/datawkt.gen.go b/pkg/bufman/gen/data/datawkt/datawkt.gen.go new file mode 100644 index 000000000..074278cff --- /dev/null +++ b/pkg/bufman/gen/data/datawkt/datawkt.gen.go @@ -0,0 +1,174 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by wkt-go-data. DO NOT EDIT. + +package datawkt + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" +) + +var ( + // ReadBucket is the storage.ReadBucket with the static data generated for this package. + ReadBucket storage.ReadBucket + + pathToData = map[string][]byte{ + "google/protobuf/any.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x61, 0x6e, 0x79, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x41, 0x6e, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x41, 0x6e, 0x79, 0x60, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x72, 0x62, 0x69, 0x74, 0x72, 0x61, 0x72, 0x79, 0x20, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x0a, 0x2f, 0x2f, 0x20, 0x55, 0x52, 0x4c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x20, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x73, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x2f, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x66, 0x20, 0x75, 0x74, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x72, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x31, 0x3a, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x43, 0x2b, 0x2b, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x46, 0x6f, 0x6f, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x61, 0x6e, 0x79, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x6e, 0x79, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x46, 0x72, 0x6f, 0x6d, 0x28, 0x66, 0x6f, 0x6f, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x6e, 0x79, 0x2e, 0x55, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x54, 0x6f, 0x28, 0x26, 0x66, 0x6f, 0x6f, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x32, 0x3a, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x46, 0x6f, 0x6f, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x3d, 0x20, 0x41, 0x6e, 0x79, 0x2e, 0x70, 0x61, 0x63, 0x6b, 0x28, 0x66, 0x6f, 0x6f, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x6e, 0x79, 0x2e, 0x69, 0x73, 0x28, 0x46, 0x6f, 0x6f, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x61, 0x6e, 0x79, 0x2e, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x28, 0x46, 0x6f, 0x6f, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x72, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x61, 0x6e, 0x79, 0x2e, 0x69, 0x73, 0x53, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x41, 0x73, 0x28, 0x46, 0x6f, 0x6f, 0x2e, 0x67, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x28, 0x29, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x61, 0x6e, 0x79, 0x2e, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x28, 0x46, 0x6f, 0x6f, 0x2e, 0x67, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x28, 0x29, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x33, 0x3a, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x46, 0x6f, 0x6f, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x3d, 0x20, 0x41, 0x6e, 0x79, 0x28, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x6e, 0x79, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x28, 0x66, 0x6f, 0x6f, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x61, 0x6e, 0x79, 0x2e, 0x49, 0x73, 0x28, 0x46, 0x6f, 0x6f, 0x2e, 0x44, 0x45, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x4f, 0x52, 0x29, 0x3a, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x6e, 0x79, 0x2e, 0x55, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x28, 0x66, 0x6f, 0x6f, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x34, 0x3a, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x47, 0x6f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3a, 0x3d, 0x20, 0x26, 0x70, 0x62, 0x2e, 0x46, 0x6f, 0x6f, 0x7b, 0x2e, 0x2e, 0x2e, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x6e, 0x79, 0x2c, 0x20, 0x65, 0x72, 0x72, 0x20, 0x3a, 0x3d, 0x20, 0x61, 0x6e, 0x79, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x77, 0x28, 0x66, 0x6f, 0x6f, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x65, 0x72, 0x72, 0x20, 0x21, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3a, 0x3d, 0x20, 0x26, 0x70, 0x62, 0x2e, 0x46, 0x6f, 0x6f, 0x7b, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x65, 0x72, 0x72, 0x20, 0x3a, 0x3d, 0x20, 0x61, 0x6e, 0x79, 0x2e, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c, 0x54, 0x6f, 0x28, 0x66, 0x6f, 0x6f, 0x29, 0x3b, 0x20, 0x65, 0x72, 0x72, 0x20, 0x21, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x20, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x79, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x75, 0x73, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x27, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x75, 0x6c, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x27, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x20, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x27, 0x2f, 0x27, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x22, 0x66, 0x6f, 0x6f, 0x2e, 0x62, 0x61, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x2f, 0x79, 0x2e, 0x7a, 0x22, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x79, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x22, 0x79, 0x2e, 0x7a, 0x22, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x60, 0x41, 0x6e, 0x79, 0x60, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x75, 0x73, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x2c, 0x20, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x60, 0x40, 0x74, 0x79, 0x70, 0x65, 0x60, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x2e, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x40, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x22, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x20, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x20, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x69, 0x73, 0x20, 0x77, 0x65, 0x6c, 0x6c, 0x2d, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x68, 0x6f, 0x6c, 0x64, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x60, 0x40, 0x74, 0x79, 0x70, 0x65, 0x60, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x28, 0x66, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x5b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5b, 0x5d, 0x29, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x40, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x31, 0x2e, 0x32, 0x31, 0x32, 0x73, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x55, 0x52, 0x4c, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x61, 0x74, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x22, 0x2f, 0x22, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x27, 0x73, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x20, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x28, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x60, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x60, 0x29, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x28, 0x65, 0x2e, 0x67, 0x2e, 0x2c, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x22, 0x2e, 0x22, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x20, 0x70, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x20, 0x75, 0x73, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x70, 0x72, 0x65, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x20, 0x69, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x41, 0x6e, 0x79, 0x2e, 0x20, 0x48, 0x6f, 0x77, 0x65, 0x76, 0x65, 0x72, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x55, 0x52, 0x4c, 0x73, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x20, 0x60, 0x68, 0x74, 0x74, 0x70, 0x60, 0x2c, 0x20, 0x60, 0x68, 0x74, 0x74, 0x70, 0x73, 0x60, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x2c, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x73, 0x65, 0x74, 0x20, 0x75, 0x70, 0x20, 0x61, 0x20, 0x74, 0x79, 0x70, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6d, 0x61, 0x70, 0x73, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x73, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2a, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x2c, 0x20, 0x60, 0x68, 0x74, 0x74, 0x70, 0x73, 0x60, 0x20, 0x69, 0x73, 0x20, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2a, 0x20, 0x41, 0x6e, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x47, 0x45, 0x54, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x79, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x61, 0x20, 0x5b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x5d, 0x5b, 0x5d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2a, 0x20, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x61, 0x63, 0x68, 0x65, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x62, 0x61, 0x73, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x55, 0x52, 0x4c, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x20, 0x70, 0x72, 0x65, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x61, 0x6e, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x2c, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x6e, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x20, 0x28, 0x55, 0x73, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x2e, 0x29, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x3a, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x66, 0x66, 0x69, 0x63, 0x69, 0x61, 0x6c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x73, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x60, 0x68, 0x74, 0x74, 0x70, 0x60, 0x2c, 0x20, 0x60, 0x68, 0x74, 0x74, 0x70, 0x73, 0x60, 0x20, 0x28, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x29, 0x20, 0x6d, 0x69, 0x67, 0x68, 0x74, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x61, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/api.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x41, 0x70, 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x70, 0x69, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x50, 0x49, 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x73, 0x6f, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x75, 0x63, 0x68, 0x20, 0x61, 0x73, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x22, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x20, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x61, 0x72, 0x65, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x41, 0x50, 0x49, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6e, 0x63, 0x72, 0x65, 0x74, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x73, 0x20, 0x6f, 0x70, 0x70, 0x6f, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x79, 0x20, 0x61, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x79, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x73, 0x6f, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x20, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x79, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x73, 0x20, 0x22, 0x41, 0x50, 0x49, 0x73, 0x22, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x2c, 0x20, 0x73, 0x75, 0x63, 0x68, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x74, 0x73, 0x65, 0x6c, 0x66, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x2f, 0x67, 0x6c, 0x6f, 0x73, 0x73, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x20, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x41, 0x70, 0x69, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x20, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x27, 0x73, 0x20, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x20, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2c, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x60, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x2d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x2d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x60, 0x2c, 0x20, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x60, 0x31, 0x2e, 0x31, 0x30, 0x60, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x7a, 0x65, 0x72, 0x6f, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x72, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x61, 0x73, 0x20, 0x6f, 0x75, 0x74, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x77, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x77, 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x75, 0x73, 0x65, 0x73, 0x20, 0x5b, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x5d, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x73, 0x65, 0x6d, 0x76, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x67, 0x29, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x76, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x20, 0x42, 0x6f, 0x74, 0x68, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x68, 0x61, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x63, 0x61, 0x72, 0x65, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x68, 0x6f, 0x73, 0x65, 0x6e, 0x20, 0x62, 0x61, 0x73, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x20, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6c, 0x73, 0x6f, 0x20, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x60, 0x76, 0x3c, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x2d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3e, 0x60, 0x2c, 0x20, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x60, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x60, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x30, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x31, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x20, 0x63, 0x61, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x20, 0x6f, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x2e, 0x20, 0x5a, 0x65, 0x72, 0x6f, 0x20, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x2c, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x47, 0x41, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x5b, 0x4d, 0x69, 0x78, 0x69, 0x6e, 0x5d, 0x5b, 0x5d, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4d, 0x69, 0x78, 0x69, 0x6e, 0x20, 0x6d, 0x69, 0x78, 0x69, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x50, 0x49, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x55, 0x52, 0x4c, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x69, 0x73, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x50, 0x49, 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x69, 0x6e, 0x67, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x2d, 0x20, 0x49, 0x66, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x68, 0x69, 0x74, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x2d, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x29, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x2d, 0x20, 0x49, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x68, 0x74, 0x74, 0x70, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x2e, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x70, 0x6c, 0x75, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x5b, 0x72, 0x6f, 0x6f, 0x74, 0x5d, 0x5b, 0x5d, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x69, 0x66, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x6d, 0x69, 0x78, 0x69, 0x6e, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x76, 0x31, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x6c, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x41, 0x43, 0x4c, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x70, 0x63, 0x20, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x28, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x28, 0x41, 0x63, 0x6c, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x29, 0x2e, 0x67, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3d, 0x2a, 0x2a, 0x7d, 0x3a, 0x67, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x22, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x70, 0x63, 0x20, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x28, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x28, 0x41, 0x63, 0x6c, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x74, 0x20, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x70, 0x63, 0x20, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x28, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x28, 0x44, 0x61, 0x74, 0x61, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x29, 0x2e, 0x67, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3d, 0x2a, 0x2a, 0x7d, 0x22, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x6d, 0x69, 0x78, 0x69, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x70, 0x69, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x69, 0x6e, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6d, 0x69, 0x78, 0x69, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x60, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x60, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x6c, 0x73, 0x6f, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x60, 0x2e, 0x20, 0x41, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x20, 0x60, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x60, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x73, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x6c, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x41, 0x43, 0x4c, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x70, 0x63, 0x20, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x28, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x28, 0x41, 0x63, 0x6c, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x29, 0x2e, 0x67, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3d, 0x2a, 0x2a, 0x7d, 0x3a, 0x67, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x22, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x60, 0x76, 0x31, 0x60, 0x20, 0x74, 0x6f, 0x20, 0x60, 0x76, 0x32, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x60, 0x72, 0x6f, 0x6f, 0x74, 0x60, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x69, 0x78, 0x69, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x61, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x65, 0x64, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x2e, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x70, 0x69, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x69, 0x6e, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x3a, 0x20, 0x61, 0x63, 0x6c, 0x73, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x65, 0x64, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x6c, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x41, 0x43, 0x4c, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x70, 0x63, 0x20, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x28, 0x47, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x28, 0x41, 0x63, 0x6c, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x29, 0x2e, 0x67, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x6c, 0x73, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3d, 0x2a, 0x2a, 0x7d, 0x3a, 0x67, 0x65, 0x74, 0x41, 0x63, 0x6c, 0x22, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x69, 0x78, 0x69, 0x6e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x20, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x61, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x65, 0x64, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x72, 0x65, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/compiler/plugin.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x3a, 0x20, 0x6b, 0x65, 0x6e, 0x74, 0x6f, 0x6e, 0x40, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x20, 0x28, 0x4b, 0x65, 0x6e, 0x74, 0x6f, 0x6e, 0x20, 0x56, 0x61, 0x72, 0x64, 0x61, 0x29, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x20, 0x28, 0x61, 0x6b, 0x61, 0x20, 0x74, 0x68, 0x65, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x29, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x76, 0x69, 0x61, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2e, 0x20, 0x20, 0x41, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x20, 0x69, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x6a, 0x75, 0x73, 0x74, 0x20, 0x61, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x72, 0x65, 0x61, 0x64, 0x73, 0x20, 0x61, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x73, 0x20, 0x61, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x2b, 0x2b, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x68, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x66, 0x20, 0x64, 0x65, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x61, 0x77, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x73, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x24, 0x4e, 0x41, 0x4d, 0x45, 0x22, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x6c, 0x61, 0x67, 0x20, 0x22, 0x2d, 0x2d, 0x24, 0x7b, 0x4e, 0x41, 0x4d, 0x45, 0x7d, 0x5f, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x0a, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x70, 0x61, 0x74, 0x63, 0x68, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2c, 0x20, 0x62, 0x65, 0x74, 0x61, 0x20, 0x6f, 0x72, 0x20, 0x72, 0x63, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2c, 0x20, 0x65, 0x2e, 0x67, 0x2e, 0x2c, 0x20, 0x22, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2d, 0x31, 0x22, 0x2c, 0x20, 0x22, 0x72, 0x63, 0x32, 0x22, 0x2e, 0x20, 0x49, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x27, 0x73, 0x20, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x20, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x27, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x77, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2c, 0x20, 0x73, 0x6f, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x73, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x20, 0x69, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x20, 0x67, 0x75, 0x61, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2c, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x6f, 0x75, 0x67, 0x68, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x74, 0x65, 0x63, 0x68, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x67, 0x75, 0x61, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x20, 0x77, 0x69, 0x72, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x6f, 0x72, 0x65, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x63, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x20, 0x61, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x62, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x72, 0x61, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x72, 0x65, 0x61, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x72, 0x65, 0x20, 0x73, 0x65, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x20, 0x61, 0x74, 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x2e, 0x20, 0x20, 0x48, 0x6f, 0x77, 0x65, 0x76, 0x65, 0x72, 0x2c, 0x20, 0x61, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, 0x72, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x69, 0x6d, 0x69, 0x6c, 0x61, 0x72, 0x6c, 0x79, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x27, 0x73, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x2d, 0x2d, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x20, 0x61, 0x74, 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x79, 0x70, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x20, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x35, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2c, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x65, 0x78, 0x69, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x7a, 0x65, 0x72, 0x6f, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x69, 0x66, 0x20, 0x69, 0x74, 0x20, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, 0x61, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x70, 0x72, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x20, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x61, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x20, 0x69, 0x74, 0x73, 0x65, 0x6c, 0x66, 0x20, 0x2d, 0x2d, 0x20, 0x73, 0x75, 0x63, 0x68, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x62, 0x65, 0x69, 0x6e, 0x67, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x2d, 0x2d, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x77, 0x72, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x20, 0x61, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x78, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x7a, 0x65, 0x72, 0x6f, 0x20, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x62, 0x69, 0x74, 0x77, 0x69, 0x73, 0x65, 0x20, 0x22, 0x6f, 0x72, 0x22, 0x20, 0x6f, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x79, 0x6e, 0x63, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x68, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x22, 0x2e, 0x22, 0x20, 0x6f, 0x72, 0x20, 0x22, 0x2e, 0x2e, 0x22, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2c, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x20, 0x28, 0x73, 0x6f, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x6c, 0x69, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x73, 0x69, 0x64, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x29, 0x2e, 0x20, 0x20, 0x22, 0x2f, 0x22, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x22, 0x5c, 0x22, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x20, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x20, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x65, 0x64, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x20, 0x73, 0x6f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x20, 0x61, 0x74, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x20, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x61, 0x73, 0x20, 0x6f, 0x66, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, 0x72, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x2d, 0x2d, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x72, 0x65, 0x61, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x77, 0x72, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x69, 0x73, 0x6b, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2c, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x61, 0x74, 0x20, 0x61, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x20, 0x62, 0x79, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x40, 0x40, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x28, 0x4e, 0x41, 0x4d, 0x45, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x72, 0x62, 0x69, 0x74, 0x72, 0x61, 0x72, 0x79, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x69, 0x74, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x20, 0x69, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x20, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x6e, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x2d, 0x2d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x77, 0x68, 0x61, 0x74, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x75, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2e, 0x20, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6d, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x28, 0x74, 0x68, 0x75, 0x73, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x61, 0x64, 0x64, 0x65, 0x64, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x2d, 0x40, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x6b, 0x65, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x79, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x20, 0x62, 0x79, 0x20, 0x61, 0x63, 0x63, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, 0x2b, 0x2b, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x68, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x74, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x73, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x40, 0x40, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x5f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x75, 0x74, 0x73, 0x69, 0x64, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x2e, 0x20, 0x20, 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x22, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x20, 0x6f, 0x72, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x68, 0x69, 0x74, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x77, 0x68, 0x69, 0x74, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x61, 0x64, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x75, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x2c, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x73, 0x2e, 0x20, 0x20, 0x49, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x69, 0x74, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x6f, 0x74, 0x68, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x61, 0x73, 0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x7c, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x7c, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x7c, 0x6e, 0x61, 0x6d, 0x65, 0x7c, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x73, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x35, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x62, 0x65, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x65, 0x64, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x69, 0x73, 0x20, 0x75, 0x73, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70, 0x72, 0x69, 0x61, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x20, 0x3d, 0x20, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x35, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/descriptor.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x3a, 0x20, 0x6b, 0x65, 0x6e, 0x74, 0x6f, 0x6e, 0x40, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x20, 0x28, 0x4b, 0x65, 0x6e, 0x74, 0x6f, 0x6e, 0x20, 0x56, 0x61, 0x72, 0x64, 0x61, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x42, 0x61, 0x73, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x20, 0x62, 0x79, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x53, 0x61, 0x6e, 0x6a, 0x61, 0x79, 0x20, 0x47, 0x68, 0x65, 0x6d, 0x61, 0x77, 0x61, 0x74, 0x2c, 0x20, 0x4a, 0x65, 0x66, 0x66, 0x20, 0x44, 0x65, 0x61, 0x6e, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x65, 0x2e, 0x67, 0x2e, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x74, 0x73, 0x20, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x29, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x70, 0x65, 0x65, 0x64, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x62, 0x61, 0x73, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, 0x20, 0x64, 0x6f, 0x6e, 0x27, 0x74, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x64, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x53, 0x50, 0x45, 0x45, 0x44, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x61, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x69, 0x74, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x73, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x74, 0x72, 0x65, 0x65, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x2e, 0x67, 0x2e, 0x20, 0x22, 0x66, 0x6f, 0x6f, 0x22, 0x2c, 0x20, 0x22, 0x66, 0x6f, 0x6f, 0x2e, 0x62, 0x61, 0x72, 0x22, 0x2c, 0x20, 0x65, 0x74, 0x63, 0x2e, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x20, 0x3d, 0x20, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x65, 0x61, 0x6b, 0x20, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x2e, 0x20, 0x44, 0x6f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x75, 0x73, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x20, 0x3d, 0x20, 0x31, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x74, 0x6f, 0x70, 0x2d, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x59, 0x6f, 0x75, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x73, 0x61, 0x66, 0x65, 0x6c, 0x79, 0x20, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x72, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x68, 0x61, 0x72, 0x6d, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x2d, 0x2d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x20, 0x3d, 0x20, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x22, 0x2c, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x22, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x60, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x60, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x22, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x31, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x70, 0x61, 0x71, 0x75, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x31, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x74, 0x61, 0x67, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x2e, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x74, 0x61, 0x67, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x62, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x2e, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x54, 0x79, 0x70, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x30, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x69, 0x73, 0x20, 0x77, 0x65, 0x69, 0x72, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x20, 0x5a, 0x69, 0x67, 0x5a, 0x61, 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x2e, 0x20, 0x20, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x74, 0x61, 0x6b, 0x65, 0x20, 0x31, 0x30, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x2e, 0x20, 0x20, 0x55, 0x73, 0x65, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x20, 0x69, 0x66, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x20, 0x5a, 0x69, 0x67, 0x5a, 0x61, 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x2e, 0x20, 0x20, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x74, 0x61, 0x6b, 0x65, 0x20, 0x31, 0x30, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x2e, 0x20, 0x20, 0x55, 0x73, 0x65, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x20, 0x69, 0x66, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x20, 0x3d, 0x20, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x61, 0x67, 0x2d, 0x64, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x20, 0x48, 0x6f, 0x77, 0x65, 0x76, 0x65, 0x72, 0x2c, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x73, 0x74, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x77, 0x69, 0x72, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x72, 0x65, 0x61, 0x74, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x73, 0x20, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x20, 0x3d, 0x20, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x20, 0x3d, 0x20, 0x31, 0x31, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2d, 0x64, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x2e, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x65, 0x77, 0x20, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x32, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x20, 0x3d, 0x20, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x20, 0x3d, 0x20, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x31, 0x37, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x73, 0x20, 0x5a, 0x69, 0x67, 0x5a, 0x61, 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x31, 0x38, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x73, 0x20, 0x5a, 0x69, 0x67, 0x5a, 0x61, 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x30, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x20, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x69, 0x73, 0x20, 0x73, 0x65, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x73, 0x65, 0x74, 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x62, 0x6f, 0x74, 0x68, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x72, 0x65, 0x20, 0x73, 0x65, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x2c, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x20, 0x6f, 0x72, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x54, 0x79, 0x70, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x20, 0x27, 0x2e, 0x27, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x2d, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2e, 0x20, 0x20, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x77, 0x69, 0x73, 0x65, 0x2c, 0x20, 0x43, 0x2b, 0x2b, 0x2d, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x73, 0x63, 0x6f, 0x70, 0x69, 0x6e, 0x67, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x28, 0x69, 0x2e, 0x65, 0x2e, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x6f, 0x6e, 0x20, 0x75, 0x70, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x62, 0x65, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x2e, 0x20, 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x6d, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x61, 0x73, 0x20, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x73, 0x2c, 0x20, 0x22, 0x74, 0x72, 0x75, 0x65, 0x22, 0x20, 0x6f, 0x72, 0x20, 0x22, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x22, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x28, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x77, 0x61, 0x79, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x3e, 0x3d, 0x20, 0x31, 0x32, 0x38, 0x20, 0x61, 0x72, 0x65, 0x20, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x73, 0x65, 0x74, 0x2c, 0x20, 0x67, 0x69, 0x76, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x79, 0x70, 0x65, 0x27, 0x73, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x69, 0x73, 0x20, 0x73, 0x65, 0x74, 0x20, 0x62, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x68, 0x61, 0x73, 0x20, 0x73, 0x65, 0x74, 0x20, 0x61, 0x20, 0x22, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x27, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x2e, 0x20, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x77, 0x69, 0x73, 0x65, 0x2c, 0x20, 0x69, 0x74, 0x27, 0x73, 0x20, 0x64, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x27, 0x73, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x62, 0x79, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x43, 0x61, 0x73, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x30, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x20, 0x22, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0x2e, 0x20, 0x57, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2c, 0x20, 0x69, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x72, 0x65, 0x67, 0x61, 0x72, 0x64, 0x6c, 0x65, 0x73, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x57, 0x68, 0x65, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x73, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x6c, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x20, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x69, 0x73, 0x20, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x69, 0x73, 0x20, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x22, 0x73, 0x79, 0x6e, 0x74, 0x68, 0x65, 0x74, 0x69, 0x63, 0x22, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x69, 0x74, 0x73, 0x20, 0x73, 0x6f, 0x6c, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x28, 0x65, 0x61, 0x63, 0x68, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x67, 0x65, 0x74, 0x73, 0x20, 0x69, 0x74, 0x73, 0x20, 0x6f, 0x77, 0x6e, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x68, 0x65, 0x74, 0x69, 0x63, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x29, 0x2e, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x68, 0x65, 0x74, 0x69, 0x63, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x6f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x41, 0x50, 0x49, 0x2e, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x68, 0x65, 0x74, 0x69, 0x63, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x22, 0x72, 0x65, 0x61, 0x6c, 0x22, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2c, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x69, 0x6e, 0x63, 0x65, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x20, 0x48, 0x6f, 0x77, 0x65, 0x76, 0x65, 0x72, 0x20, 0x69, 0x74, 0x20, 0x73, 0x74, 0x69, 0x6c, 0x6c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x20, 0x6f, 0x66, 0x20, 0x77, 0x68, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x72, 0x6f, 0x74, 0x65, 0x20, 0x22, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0x20, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x74, 0x72, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x20, 0x77, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x67, 0x69, 0x76, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x68, 0x65, 0x74, 0x69, 0x63, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x61, 0x6c, 0x73, 0x6f, 0x2c, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x6f, 0x75, 0x67, 0x68, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x65, 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x63, 0x61, 0x6e, 0x27, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x65, 0x6c, 0x6c, 0x20, 0x69, 0x66, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x2c, 0x20, 0x73, 0x6f, 0x20, 0x69, 0x74, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x68, 0x65, 0x74, 0x69, 0x63, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x64, 0x6f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x6c, 0x61, 0x67, 0x2c, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x60, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x31, 0x37, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x61, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x62, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x63, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x20, 0x73, 0x75, 0x63, 0x68, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x74, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70, 0x72, 0x69, 0x61, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x72, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x79, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x75, 0x73, 0x65, 0x64, 0x2e, 0x20, 0x41, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x61, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x77, 0x61, 0x79, 0x20, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x69, 0x66, 0x20, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x20, 0x3d, 0x20, 0x35, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x69, 0x66, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x20, 0x3d, 0x20, 0x36, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x22, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6a, 0x75, 0x73, 0x74, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6c, 0x79, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x72, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x68, 0x69, 0x6e, 0x74, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6d, 0x61, 0x6e, 0x69, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x73, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2a, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x79, 0x65, 0x74, 0x20, 0x62, 0x65, 0x20, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x61, 0x74, 0x20, 0x70, 0x61, 0x72, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x2c, 0x20, 0x73, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x2e, 0x20, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x20, 0x69, 0x74, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2a, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x2a, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x20, 0x57, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x6f, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x77, 0x65, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x20, 0x61, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2c, 0x20, 0x61, 0x74, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x62, 0x65, 0x65, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x63, 0x68, 0x6f, 0x73, 0x65, 0x6e, 0x20, 0x61, 0x73, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x20, 0x2a, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x75, 0x73, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x35, 0x30, 0x30, 0x30, 0x30, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x20, 0x39, 0x39, 0x39, 0x39, 0x39, 0x2e, 0x20, 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20, 0x75, 0x70, 0x20, 0x74, 0x6f, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x64, 0x6f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x2a, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x6c, 0x79, 0x20, 0x62, 0x79, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x2c, 0x20, 0x65, 0x2d, 0x6d, 0x61, 0x69, 0x6c, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2d, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2d, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x40, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x2e, 0x20, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x28, 0x65, 0x2e, 0x67, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2d, 0x43, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x29, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x20, 0x28, 0x69, 0x66, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x29, 0x20, 0x2d, 0x2d, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x27, 0x73, 0x20, 0x6e, 0x6f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x20, 0x68, 0x6f, 0x77, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x2e, 0x20, 0x55, 0x73, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x20, 0x59, 0x6f, 0x75, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x62, 0x79, 0x20, 0x70, 0x75, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x75, 0x62, 0x2d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x64, 0x6f, 0x63, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x23, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x70, 0x6f, 0x70, 0x75, 0x6c, 0x61, 0x72, 0x2c, 0x20, 0x61, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x73, 0x65, 0x74, 0x20, 0x75, 0x70, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x2e, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x2e, 0x20, 0x20, 0x42, 0x79, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x69, 0x73, 0x20, 0x75, 0x73, 0x65, 0x64, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x66, 0x74, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70, 0x72, 0x69, 0x61, 0x74, 0x65, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x20, 0x64, 0x6f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x77, 0x61, 0x72, 0x64, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x61, 0x74, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x67, 0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x28, 0x29, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x74, 0x6f, 0x70, 0x2d, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x20, 0x2e, 0x6a, 0x61, 0x76, 0x61, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x74, 0x6f, 0x70, 0x2d, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x75, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x2a, 0x6e, 0x6f, 0x74, 0x2a, 0x20, 0x62, 0x65, 0x20, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x20, 0x48, 0x6f, 0x77, 0x65, 0x76, 0x65, 0x72, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x73, 0x74, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x67, 0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x28, 0x29, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x61, 0x73, 0x20, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x70, 0x2d, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x30, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x20, 0x3d, 0x20, 0x32, 0x30, 0x20, 0x5b, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3d, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x32, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x72, 0x6f, 0x77, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x65, 0x76, 0x65, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x20, 0x69, 0x73, 0x20, 0x6d, 0x61, 0x64, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x20, 0x61, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x55, 0x54, 0x46, 0x2d, 0x38, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x79, 0x74, 0x65, 0x20, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x64, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x48, 0x6f, 0x77, 0x65, 0x76, 0x65, 0x72, 0x2c, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x73, 0x74, 0x69, 0x6c, 0x6c, 0x20, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x73, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x55, 0x54, 0x46, 0x2d, 0x38, 0x20, 0x62, 0x79, 0x74, 0x65, 0x20, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x68, 0x61, 0x73, 0x20, 0x6e, 0x6f, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x6f, 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x74, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x20, 0x3d, 0x20, 0x32, 0x37, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x70, 0x65, 0x65, 0x64, 0x20, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x53, 0x50, 0x45, 0x45, 0x44, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, 0x61, 0x72, 0x73, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x74, 0x63, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x20, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x74, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x74, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x39, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x53, 0x50, 0x45, 0x45, 0x44, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x6f, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x64, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x6f, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x6f, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x54, 0x68, 0x65, 0x20, 0x62, 0x61, 0x73, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x70, 0x61, 0x74, 0x68, 0x2c, 0x20, 0x69, 0x66, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x77, 0x69, 0x73, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20, 0x69, 0x66, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x77, 0x69, 0x73, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x61, 0x73, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x62, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3f, 0x20, 0x20, 0x22, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x22, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x52, 0x50, 0x43, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x79, 0x20, 0x61, 0x72, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x20, 0x28, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x6b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x61, 0x72, 0x6c, 0x79, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6e, 0x6f, 0x77, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x66, 0x61, 0x76, 0x6f, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x74, 0x6f, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x52, 0x50, 0x43, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2e, 0x20, 0x20, 0x4f, 0x6c, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x73, 0x20, 0x6f, 0x6e, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x36, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x37, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x38, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x70, 0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x34, 0x32, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x65, 0x6d, 0x69, 0x74, 0x20, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x32, 0x33, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x43, 0x2b, 0x2b, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x31, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x20, 0x63, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x20, 0x63, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x33, 0x36, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x3b, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x33, 0x37, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x42, 0x79, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x53, 0x77, 0x69, 0x66, 0x74, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x74, 0x61, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x43, 0x61, 0x6d, 0x65, 0x6c, 0x43, 0x61, 0x73, 0x65, 0x20, 0x69, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x20, 0x27, 0x2e, 0x27, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x20, 0x57, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x33, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x68, 0x70, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x68, 0x70, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x20, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x34, 0x30, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x70, 0x68, 0x70, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x20, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x20, 0x57, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x68, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x70, 0x68, 0x70, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x20, 0x57, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x34, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x75, 0x62, 0x79, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x20, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x20, 0x57, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x75, 0x62, 0x79, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x35, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x22, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x22, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x33, 0x38, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x74, 0x20, 0x74, 0x72, 0x75, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x6c, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x31, 0x20, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x20, 0x77, 0x69, 0x72, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x77, 0x61, 0x72, 0x64, 0x73, 0x2d, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x20, 0x77, 0x69, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x20, 0x20, 0x59, 0x6f, 0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x3a, 0x20, 0x20, 0x49, 0x74, 0x27, 0x73, 0x20, 0x6c, 0x65, 0x73, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x68, 0x61, 0x73, 0x20, 0x66, 0x65, 0x77, 0x65, 0x72, 0x20, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x69, 0x73, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x61, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x61, 0x73, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x6f, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x34, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x3b, 0x20, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x73, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x3b, 0x20, 0x65, 0x2e, 0x67, 0x2e, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x73, 0x2c, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x42, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x74, 0x77, 0x6f, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, 0x22, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x28, 0x29, 0x22, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x63, 0x61, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x61, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x6b, 0x65, 0x20, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x31, 0x20, 0x65, 0x61, 0x73, 0x69, 0x65, 0x72, 0x3b, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x61, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x20, 0x22, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x22, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x32, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x65, 0x6d, 0x69, 0x74, 0x20, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x33, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x34, 0x2c, 0x20, 0x35, 0x2c, 0x20, 0x36, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x4f, 0x54, 0x45, 0x3a, 0x20, 0x44, 0x6f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x20, 0x41, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x70, 0x73, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x20, 0x73, 0x65, 0x74, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x57, 0x68, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6d, 0x61, 0x70, 0x20, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x61, 0x70, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x6d, 0x61, 0x70, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x70, 0x3c, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x2c, 0x20, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x3e, 0x20, 0x6d, 0x61, 0x70, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x73, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4d, 0x61, 0x70, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x20, 0x6d, 0x61, 0x70, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x3d, 0x74, 0x72, 0x75, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x6d, 0x61, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x68, 0x6f, 0x6c, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x50, 0x49, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x75, 0x63, 0x68, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x73, 0x74, 0x69, 0x6c, 0x6c, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x38, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x6c, 0x69, 0x74, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x62, 0x6c, 0x65, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x39, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x6e, 0x61, 0x6e, 0x6f, 0x5f, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x74, 0x65, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x63, 0x61, 0x73, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x70, 0x73, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x69, 0x73, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x20, 0x74, 0x61, 0x6b, 0x65, 0x73, 0x20, 0x60, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x60, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x20, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x65, 0x6c, 0x6c, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x20, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x20, 0x61, 0x67, 0x61, 0x69, 0x6e, 0x73, 0x74, 0x20, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x6e, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x20, 0x64, 0x75, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x4f, 0x44, 0x4f, 0x28, 0x62, 0x2f, 0x32, 0x36, 0x31, 0x37, 0x35, 0x30, 0x31, 0x39, 0x30, 0x29, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x65, 0x20, 0x70, 0x6c, 0x61, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x20, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x68, 0x61, 0x64, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x31, 0x20, 0x5b, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x63, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, 0x2b, 0x2b, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x69, 0x74, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x2e, 0x20, 0x20, 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x77, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x79, 0x65, 0x74, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x2d, 0x2d, 0x20, 0x73, 0x6f, 0x72, 0x72, 0x79, 0x2c, 0x20, 0x77, 0x65, 0x27, 0x6c, 0x6c, 0x20, 0x74, 0x72, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x69, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x66, 0x75, 0x74, 0x75, 0x72, 0x65, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x21, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x43, 0x54, 0x79, 0x70, 0x65, 0x20, 0x63, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x43, 0x54, 0x79, 0x70, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x43, 0x4f, 0x52, 0x44, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, 0x45, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x65, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x20, 0x52, 0x61, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x6c, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x72, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x67, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x72, 0x65, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2d, 0x64, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x62, 0x6c, 0x6f, 0x62, 0x2e, 0x20, 0x49, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2c, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x74, 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x61, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x36, 0x34, 0x20, 0x62, 0x69, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x69, 0x78, 0x65, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x2c, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x2c, 0x20, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x2c, 0x20, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x2c, 0x20, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x29, 0x2e, 0x20, 0x20, 0x41, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x20, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61, 0x76, 0x6f, 0x69, 0x64, 0x73, 0x20, 0x6c, 0x6f, 0x73, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x70, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x68, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x69, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x61, 0x75, 0x73, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x22, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x61, 0x64, 0x64, 0x65, 0x64, 0x2c, 0x20, 0x65, 0x2e, 0x67, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x2e, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x20, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x36, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x73, 0x65, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x20, 0x6c, 0x61, 0x7a, 0x69, 0x6c, 0x79, 0x3f, 0x20, 0x20, 0x4c, 0x61, 0x7a, 0x79, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x20, 0x20, 0x49, 0x74, 0x20, 0x6d, 0x65, 0x61, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x27, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x20, 0x62, 0x75, 0x74, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x61, 0x20, 0x68, 0x69, 0x6e, 0x74, 0x2e, 0x20, 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x20, 0x77, 0x68, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x61, 0x67, 0x65, 0x72, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x70, 0x61, 0x72, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x67, 0x61, 0x72, 0x64, 0x6c, 0x65, 0x73, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x20, 0x48, 0x6f, 0x77, 0x65, 0x76, 0x65, 0x72, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x72, 0x75, 0x65, 0x20, 0x73, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x20, 0x62, 0x65, 0x6c, 0x69, 0x65, 0x76, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x70, 0x61, 0x72, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x77, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6b, 0x6b, 0x65, 0x65, 0x70, 0x69, 0x6e, 0x67, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x68, 0x65, 0x61, 0x64, 0x20, 0x74, 0x79, 0x70, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x20, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x20, 0x46, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72, 0x6d, 0x6f, 0x72, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2d, 0x73, 0x61, 0x66, 0x65, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x73, 0x61, 0x66, 0x65, 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x20, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x73, 0x75, 0x62, 0x2d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x2c, 0x20, 0x63, 0x61, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x49, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x28, 0x29, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x72, 0x75, 0x65, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x68, 0x61, 0x73, 0x20, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x65, 0x63, 0x65, 0x73, 0x73, 0x61, 0x72, 0x79, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x77, 0x69, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x2c, 0x20, 0x64, 0x65, 0x66, 0x65, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x61, 0x72, 0x73, 0x69, 0x6e, 0x67, 0x2e, 0x20, 0x20, 0x41, 0x6e, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x69, 0x74, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x73, 0x75, 0x62, 0x2d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x2a, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x2a, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x69, 0x74, 0x73, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x2a, 0x6e, 0x65, 0x76, 0x65, 0x72, 0x2a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x69, 0x74, 0x73, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2c, 0x20, 0x72, 0x65, 0x67, 0x61, 0x72, 0x64, 0x6c, 0x65, 0x73, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x77, 0x68, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x68, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x65, 0x6e, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x32, 0x30, 0x32, 0x32, 0x2c, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x79, 0x74, 0x65, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x64, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x61, 0x72, 0x73, 0x69, 0x6e, 0x67, 0x2e, 0x20, 0x20, 0x41, 0x6e, 0x20, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x62, 0x79, 0x74, 0x65, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x72, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x3d, 0x20, 0x35, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x20, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x79, 0x74, 0x65, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x68, 0x69, 0x62, 0x69, 0x74, 0x69, 0x76, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x20, 0x3d, 0x20, 0x31, 0x35, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x65, 0x6d, 0x69, 0x74, 0x20, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x73, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x33, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x2e, 0x20, 0x44, 0x6f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x75, 0x73, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x77, 0x65, 0x61, 0x6b, 0x20, 0x3d, 0x20, 0x31, 0x30, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x65, 0x62, 0x75, 0x67, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x73, 0x2c, 0x20, 0x65, 0x2e, 0x67, 0x2e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x20, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x36, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x6f, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x3a, 0x20, 0x61, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x4a, 0x61, 0x6e, 0x75, 0x61, 0x72, 0x79, 0x20, 0x32, 0x30, 0x32, 0x33, 0x2c, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x79, 0x65, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x28, 0x62, 0x2f, 0x32, 0x36, 0x34, 0x35, 0x39, 0x33, 0x34, 0x38, 0x39, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x31, 0x37, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x73, 0x65, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x66, 0x72, 0x65, 0x65, 0x6c, 0x79, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x6b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x3a, 0x20, 0x61, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x4a, 0x61, 0x6e, 0x75, 0x61, 0x72, 0x79, 0x20, 0x32, 0x30, 0x32, 0x33, 0x2c, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x79, 0x65, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x28, 0x62, 0x2f, 0x32, 0x36, 0x34, 0x35, 0x39, 0x33, 0x34, 0x38, 0x39, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x20, 0x3d, 0x20, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x38, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x34, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x20, 0x6a, 0x74, 0x79, 0x70, 0x65, 0x0a, 0x7d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x74, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x72, 0x75, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x20, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x61, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x65, 0x6d, 0x69, 0x74, 0x20, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x33, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x35, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x6e, 0x61, 0x6e, 0x6f, 0x5f, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x74, 0x65, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x63, 0x61, 0x73, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x70, 0x73, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x69, 0x73, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x20, 0x74, 0x61, 0x6b, 0x65, 0x73, 0x20, 0x60, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x60, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x20, 0x61, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x65, 0x6c, 0x6c, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x4f, 0x44, 0x4f, 0x28, 0x62, 0x2f, 0x32, 0x36, 0x31, 0x37, 0x35, 0x30, 0x31, 0x39, 0x30, 0x29, 0x20, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x20, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x20, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x20, 0x68, 0x61, 0x76, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x68, 0x61, 0x64, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x36, 0x20, 0x5b, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x65, 0x6d, 0x69, 0x74, 0x20, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x31, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x3a, 0x20, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x31, 0x20, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x20, 0x33, 0x32, 0x20, 0x61, 0x72, 0x65, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x52, 0x50, 0x43, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x20, 0x20, 0x57, 0x65, 0x20, 0x61, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x69, 0x7a, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x68, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x77, 0x65, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x77, 0x65, 0x20, 0x64, 0x65, 0x63, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2e, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x65, 0x6d, 0x69, 0x74, 0x20, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x33, 0x33, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x7b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x3a, 0x20, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x31, 0x20, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x20, 0x33, 0x32, 0x20, 0x61, 0x72, 0x65, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x52, 0x50, 0x43, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x20, 0x20, 0x57, 0x65, 0x20, 0x61, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x69, 0x7a, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x68, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x77, 0x65, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x77, 0x65, 0x20, 0x64, 0x65, 0x63, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2e, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x65, 0x6d, 0x69, 0x74, 0x20, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x33, 0x33, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x73, 0x69, 0x64, 0x65, 0x2d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x2d, 0x66, 0x72, 0x65, 0x65, 0x20, 0x28, 0x6f, 0x72, 0x20, 0x73, 0x61, 0x66, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x70, 0x61, 0x72, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x29, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x72, 0x20, 0x6e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x3f, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x62, 0x61, 0x73, 0x65, 0x64, 0x20, 0x52, 0x50, 0x43, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x20, 0x47, 0x45, 0x54, 0x20, 0x76, 0x65, 0x72, 0x62, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x61, 0x66, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x50, 0x55, 0x54, 0x20, 0x76, 0x65, 0x72, 0x62, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x50, 0x4f, 0x53, 0x54, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x73, 0x69, 0x64, 0x65, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x73, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x20, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x20, 0x3d, 0x20, 0x33, 0x34, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x39, 0x39, 0x39, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x53, 0x65, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x78, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x3a, 0x3a, 0x50, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x6f, 0x6f, 0x6c, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x20, 0x28, 0x65, 0x2e, 0x67, 0x2e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x3a, 0x3a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x28, 0x29, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x3a, 0x3a, 0x43, 0x6f, 0x70, 0x79, 0x54, 0x6f, 0x28, 0x29, 0x29, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6e, 0x65, 0x76, 0x65, 0x72, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x20, 0x64, 0x6f, 0x74, 0x2d, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x20, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x74, 0x72, 0x75, 0x65, 0x20, 0x69, 0x66, 0x66, 0x20, 0x61, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x64, 0x65, 0x6e, 0x6f, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x68, 0x65, 0x73, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x2e, 0x67, 0x2e, 0x2c, 0x7b, 0x20, 0x5b, 0x22, 0x66, 0x6f, 0x6f, 0x22, 0x2c, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x2c, 0x20, 0x5b, 0x22, 0x62, 0x61, 0x72, 0x2e, 0x62, 0x61, 0x7a, 0x22, 0x2c, 0x20, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x2c, 0x20, 0x5b, 0x22, 0x6d, 0x6f, 0x6f, 0x22, 0x2c, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x5d, 0x20, 0x7d, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x22, 0x66, 0x6f, 0x6f, 0x2e, 0x28, 0x62, 0x61, 0x72, 0x2e, 0x62, 0x61, 0x7a, 0x29, 0x2e, 0x6d, 0x6f, 0x6f, 0x22, 0x2e, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x69, 0x6e, 0x20, 0x77, 0x68, 0x61, 0x74, 0x65, 0x76, 0x65, 0x72, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x74, 0x20, 0x61, 0x73, 0x20, 0x64, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x61, 0x72, 0x73, 0x69, 0x6e, 0x67, 0x2e, 0x20, 0x45, 0x78, 0x61, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x73, 0x65, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x63, 0x61, 0x70, 0x73, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61, 0x0a, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x77, 0x61, 0x73, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x61, 0x20, 0x70, 0x69, 0x65, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x49, 0x44, 0x45, 0x73, 0x2c, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x72, 0x73, 0x2c, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x69, 0x6d, 0x69, 0x6c, 0x61, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x73, 0x61, 0x79, 0x20, 0x77, 0x65, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x6f, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4c, 0x65, 0x74, 0x27, 0x73, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x20, 0x61, 0x74, 0x20, 0x6a, 0x75, 0x73, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x5e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5e, 0x5e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5e, 0x5e, 0x20, 0x20, 0x5e, 0x20, 0x20, 0x5e, 0x5e, 0x5e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x61, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x63, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x20, 0x20, 0x66, 0x20, 0x20, 0x67, 0x68, 0x69, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x57, 0x65, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x20, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x5b, 0x61, 0x2c, 0x69, 0x29, 0x20, 0x20, 0x5b, 0x20, 0x34, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x30, 0x20, 0x5d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x77, 0x68, 0x6f, 0x6c, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x5b, 0x61, 0x2c, 0x62, 0x29, 0x20, 0x20, 0x5b, 0x20, 0x34, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x34, 0x20, 0x5d, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x20, 0x28, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x5b, 0x63, 0x2c, 0x64, 0x29, 0x20, 0x20, 0x5b, 0x20, 0x34, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x35, 0x20, 0x5d, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x28, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x5b, 0x65, 0x2c, 0x66, 0x29, 0x20, 0x20, 0x5b, 0x20, 0x34, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x31, 0x20, 0x5d, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x28, 0x66, 0x6f, 0x6f, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x5b, 0x67, 0x2c, 0x68, 0x29, 0x20, 0x20, 0x5b, 0x20, 0x34, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x33, 0x20, 0x5d, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x28, 0x31, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x73, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x20, 0x41, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x74, 0x73, 0x65, 0x6c, 0x66, 0x20, 0x28, 0x69, 0x2e, 0x65, 0x2e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x79, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x69, 0x74, 0x29, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x65, 0x76, 0x65, 0x72, 0x20, 0x61, 0x20, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x65, 0x6e, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x20, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x28, 0x70, 0x6f, 0x73, 0x73, 0x69, 0x62, 0x6c, 0x79, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x29, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x68, 0x6f, 0x73, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x22, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x20, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x68, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x73, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x72, 0x65, 0x61, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6d, 0x6f, 0x73, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x62, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x22, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x22, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x61, 0x67, 0x61, 0x69, 0x6e, 0x20, 0x2d, 0x2d, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x2c, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x6f, 0x66, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x20, 0x41, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x27, 0x73, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x61, 0x20, 0x73, 0x75, 0x62, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x27, 0x73, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x2e, 0x20, 0x20, 0x46, 0x6f, 0x72, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x22, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x22, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x73, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x22, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x22, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x69, 0x73, 0x20, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x20, 0x4a, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x61, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x27, 0x73, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x73, 0x75, 0x62, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x27, 0x73, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6d, 0x65, 0x61, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x64, 0x65, 0x73, 0x63, 0x65, 0x6e, 0x64, 0x61, 0x6e, 0x74, 0x2e, 0x20, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x61, 0x20, 0x22, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x62, 0x6f, 0x74, 0x68, 0x20, 0x61, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x75, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x69, 0x72, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2d, 0x20, 0x43, 0x6f, 0x64, 0x65, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x74, 0x72, 0x69, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x2c, 0x20, 0x61, 0x73, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x63, 0x6f, 0x75, 0x6c, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x77, 0x61, 0x73, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x69, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x20, 0x20, 0x54, 0x68, 0x65, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x61, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x70, 0x61, 0x74, 0x68, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x5b, 0x20, 0x34, 0x2c, 0x20, 0x33, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x37, 0x2c, 0x20, 0x31, 0x20, 0x5d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x73, 0x20, 0x74, 0x6f, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x28, 0x33, 0x29, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x34, 0x2c, 0x20, 0x33, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x28, 0x37, 0x29, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x32, 0x2c, 0x20, 0x37, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x28, 0x29, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x31, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x68, 0x61, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x34, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x68, 0x61, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x32, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x68, 0x61, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x31, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x75, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x67, 0x69, 0x76, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x77, 0x65, 0x20, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x5b, 0x20, 0x34, 0x2c, 0x20, 0x33, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x37, 0x20, 0x5d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x68, 0x6f, 0x6c, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x65, 0x6d, 0x69, 0x63, 0x6f, 0x6c, 0x6f, 0x6e, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x31, 0x20, 0x5b, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x68, 0x61, 0x73, 0x20, 0x65, 0x78, 0x61, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x74, 0x68, 0x72, 0x65, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x66, 0x6f, 0x75, 0x72, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x3a, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x2c, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x28, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2c, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x77, 0x69, 0x73, 0x65, 0x20, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x61, 0x73, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x29, 0x2c, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x63, 0x79, 0x2e, 0x20, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x7a, 0x65, 0x72, 0x6f, 0x2d, 0x62, 0x61, 0x73, 0x65, 0x64, 0x20, 0x2d, 0x2d, 0x20, 0x74, 0x79, 0x70, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x64, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x31, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x3d, 0x20, 0x32, 0x20, 0x5b, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x79, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x73, 0x65, 0x72, 0x69, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x74, 0x69, 0x76, 0x65, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6e, 0x6f, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x74, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6b, 0x65, 0x65, 0x70, 0x20, 0x70, 0x61, 0x72, 0x61, 0x67, 0x72, 0x61, 0x70, 0x68, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x28, 0x62, 0x75, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x29, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x70, 0x61, 0x72, 0x61, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x3b, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x20, 0x28, 0x65, 0x2e, 0x67, 0x2e, 0x20, 0x2f, 0x2f, 0x29, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x74, 0x72, 0x69, 0x70, 0x70, 0x65, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x20, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2c, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x68, 0x69, 0x74, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x73, 0x74, 0x65, 0x72, 0x69, 0x73, 0x6b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x70, 0x70, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x65, 0x77, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x3a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x66, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x66, 0x6f, 0x6f, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x61, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x62, 0x61, 0x72, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x62, 0x61, 0x7a, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x61, 0x7a, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x61, 0x7a, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x6f, 0x6f, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x6f, 0x6f, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x20, 0x6d, 0x6f, 0x6f, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x72, 0x67, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x6f, 0x6f, 0x20, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x72, 0x67, 0x65, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x20, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x62, 0x6f, 0x74, 0x68, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x72, 0x67, 0x65, 0x20, 0x70, 0x61, 0x72, 0x61, 0x67, 0x72, 0x61, 0x70, 0x68, 0x20, 0x32, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x72, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2a, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x72, 0x67, 0x65, 0x2e, 0x20, 0x20, 0x4c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x73, 0x74, 0x65, 0x72, 0x69, 0x73, 0x6b, 0x73, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x2e, 0x20, 0x2a, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2a, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x67, 0x72, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x20, 0x2a, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x67, 0x72, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x69, 0x74, 0x73, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x20, 0x41, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x20, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x73, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x61, 0x73, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x31, 0x20, 0x5b, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x5d, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x70, 0x61, 0x73, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x62, 0x79, 0x74, 0x65, 0x20, 0x28, 0x73, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x3d, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x2d, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x29, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x27, 0x73, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4e, 0x4f, 0x4e, 0x45, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x73, 0x20, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x77, 0x69, 0x73, 0x65, 0x20, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x45, 0x54, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x20, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x41, 0x4c, 0x49, 0x41, 0x53, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x20, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/duration.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x2c, 0x20, 0x66, 0x69, 0x78, 0x65, 0x64, 0x2d, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x61, 0x74, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x63, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x63, 0x65, 0x70, 0x74, 0x73, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x22, 0x64, 0x61, 0x79, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x72, 0x20, 0x22, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x22, 0x2e, 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x77, 0x6f, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x69, 0x74, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x61, 0x64, 0x64, 0x65, 0x64, 0x20, 0x6f, 0x72, 0x20, 0x73, 0x75, 0x62, 0x74, 0x72, 0x61, 0x63, 0x74, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x61, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x20, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x78, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x2b, 0x2d, 0x31, 0x30, 0x2c, 0x30, 0x30, 0x30, 0x20, 0x79, 0x65, 0x61, 0x72, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x31, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x77, 0x6f, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x73, 0x65, 0x75, 0x64, 0x6f, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x3d, 0x20, 0x65, 0x6e, 0x64, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x2d, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x65, 0x6e, 0x64, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x2d, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x3c, 0x20, 0x30, 0x20, 0x26, 0x26, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x3e, 0x20, 0x30, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x2b, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x2d, 0x3d, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x69, 0x66, 0x20, 0x28, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x3e, 0x20, 0x30, 0x20, 0x26, 0x26, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x3c, 0x20, 0x30, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x2d, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x2b, 0x3d, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x32, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x2b, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x73, 0x65, 0x75, 0x64, 0x6f, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x2b, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x2b, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x65, 0x6e, 0x64, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x3c, 0x20, 0x30, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x2d, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x2b, 0x3d, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x69, 0x66, 0x20, 0x28, 0x65, 0x6e, 0x64, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x3e, 0x3d, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x29, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2e, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x2b, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2e, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x2d, 0x3d, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x33, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x20, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x64, 0x20, 0x3d, 0x20, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x28, 0x64, 0x61, 0x79, 0x73, 0x3d, 0x33, 0x2c, 0x20, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x3d, 0x31, 0x30, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x28, 0x74, 0x64, 0x29, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x61, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x61, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x64, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x20, 0x22, 0x73, 0x22, 0x20, 0x28, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x29, 0x20, 0x61, 0x6e, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x61, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x33, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x30, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x61, 0x73, 0x20, 0x22, 0x33, 0x73, 0x22, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x33, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x31, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x61, 0x73, 0x20, 0x22, 0x33, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x73, 0x22, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x33, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x31, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x61, 0x73, 0x20, 0x22, 0x33, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x73, 0x22, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x20, 0x4d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x2d, 0x33, 0x31, 0x35, 0x2c, 0x35, 0x37, 0x36, 0x2c, 0x30, 0x30, 0x30, 0x2c, 0x30, 0x30, 0x30, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x2b, 0x33, 0x31, 0x35, 0x2c, 0x35, 0x37, 0x36, 0x2c, 0x30, 0x30, 0x30, 0x2c, 0x30, 0x30, 0x30, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x3a, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x3a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x36, 0x30, 0x20, 0x73, 0x65, 0x63, 0x2f, 0x6d, 0x69, 0x6e, 0x20, 0x2a, 0x20, 0x36, 0x30, 0x20, 0x6d, 0x69, 0x6e, 0x2f, 0x68, 0x72, 0x20, 0x2a, 0x20, 0x32, 0x34, 0x20, 0x68, 0x72, 0x2f, 0x64, 0x61, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x36, 0x35, 0x2e, 0x32, 0x35, 0x20, 0x64, 0x61, 0x79, 0x73, 0x2f, 0x79, 0x65, 0x61, 0x72, 0x20, 0x2a, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x20, 0x79, 0x65, 0x61, 0x72, 0x73, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x61, 0x74, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x70, 0x61, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x20, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6c, 0x65, 0x73, 0x73, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x61, 0x72, 0x65, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x20, 0x30, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x60, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x60, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x60, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x60, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x66, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x6f, 0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x2c, 0x20, 0x61, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x7a, 0x65, 0x72, 0x6f, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x60, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x60, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x60, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x60, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x20, 0x4d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x2d, 0x39, 0x39, 0x39, 0x2c, 0x39, 0x39, 0x39, 0x2c, 0x39, 0x39, 0x39, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x2b, 0x39, 0x39, 0x39, 0x2c, 0x39, 0x39, 0x39, 0x2c, 0x39, 0x39, 0x39, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/empty.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x72, 0x65, 0x2d, 0x75, 0x73, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x41, 0x50, 0x49, 0x73, 0x2e, 0x20, 0x41, 0x20, 0x74, 0x79, 0x70, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x74, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x50, 0x49, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x46, 0x6f, 0x6f, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x70, 0x63, 0x20, 0x42, 0x61, 0x72, 0x28, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x28, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x7b, 0x7d, 0x0a, + }, + "google/protobuf/field_mask.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x6d, 0x61, 0x73, 0x6b, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x60, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x3a, 0x20, 0x22, 0x66, 0x2e, 0x61, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x3a, 0x20, 0x22, 0x66, 0x2e, 0x62, 0x2e, 0x64, 0x22, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x48, 0x65, 0x72, 0x65, 0x20, 0x60, 0x66, 0x60, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x60, 0x61, 0x60, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x60, 0x62, 0x60, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x60, 0x66, 0x60, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x60, 0x64, 0x60, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x60, 0x66, 0x2e, 0x62, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x20, 0x61, 0x20, 0x73, 0x75, 0x62, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x20, 0x67, 0x65, 0x74, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x72, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x6e, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x73, 0x20, 0x61, 0x6c, 0x73, 0x6f, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x28, 0x73, 0x65, 0x65, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x77, 0x29, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x4d, 0x61, 0x73, 0x6b, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x6f, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x75, 0x62, 0x2d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x41, 0x50, 0x49, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x61, 0x73, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x20, 0x3a, 0x20, 0x32, 0x32, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x20, 0x3a, 0x20, 0x31, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x78, 0x20, 0x3a, 0x20, 0x32, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x79, 0x20, 0x3a, 0x20, 0x31, 0x33, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7a, 0x3a, 0x20, 0x38, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x78, 0x2c, 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x7a, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x74, 0x68, 0x65, 0x69, 0x72, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x74, 0x65, 0x78, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x29, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x20, 0x3a, 0x20, 0x32, 0x32, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x20, 0x3a, 0x20, 0x31, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x20, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x0a, 0x2f, 0x2f, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x61, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x67, 0x65, 0x74, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x28, 0x61, 0x73, 0x20, 0x69, 0x66, 0x20, 0x61, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x61, 0x64, 0x20, 0x62, 0x65, 0x65, 0x6e, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x29, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6e, 0x65, 0x63, 0x65, 0x73, 0x73, 0x61, 0x72, 0x69, 0x6c, 0x79, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x70, 0x2d, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x49, 0x6e, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x52, 0x45, 0x53, 0x54, 0x20, 0x67, 0x65, 0x74, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x52, 0x45, 0x53, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x76, 0x69, 0x64, 0x75, 0x61, 0x6c, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x20, 0x49, 0x6e, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x52, 0x45, 0x53, 0x54, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x2e, 0x20, 0x57, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x6c, 0x79, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x67, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x69, 0x74, 0x73, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x41, 0x50, 0x49, 0x2e, 0x20, 0x20, 0x49, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x63, 0x61, 0x73, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, 0x50, 0x49, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x4d, 0x61, 0x73, 0x6b, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x6e, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x65, 0x64, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x41, 0x50, 0x49, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x65, 0x61, 0x76, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x73, 0x20, 0x75, 0x6e, 0x74, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x64, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x61, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x6f, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x41, 0x50, 0x49, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6c, 0x6c, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x61, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x0a, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x20, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x60, 0x70, 0x61, 0x74, 0x68, 0x73, 0x60, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x61, 0x20, 0x73, 0x75, 0x62, 0x2d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6e, 0x65, 0x77, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x75, 0x62, 0x2d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x3a, 0x20, 0x31, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x78, 0x3a, 0x20, 0x32, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x3a, 0x20, 0x5b, 0x31, 0x5d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x64, 0x20, 0x61, 0x6e, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x3a, 0x20, 0x31, 0x30, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x3a, 0x20, 0x5b, 0x32, 0x5d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x3a, 0x20, 0x5b, 0x22, 0x66, 0x2e, 0x62, 0x22, 0x2c, 0x20, 0x22, 0x66, 0x2e, 0x63, 0x22, 0x5d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x3a, 0x20, 0x31, 0x30, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x78, 0x3a, 0x20, 0x32, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x32, 0x5d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x6e, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x73, 0x65, 0x74, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x27, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x48, 0x65, 0x6e, 0x63, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x73, 0x65, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2c, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x20, 0x61, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x65, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x64, 0x6f, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x20, 0x61, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x61, 0x73, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x77, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x66, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x20, 0x6f, 0x6e, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x28, 0x61, 0x73, 0x20, 0x69, 0x66, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x68, 0x61, 0x73, 0x20, 0x62, 0x65, 0x65, 0x6e, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x29, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x65, 0x76, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6d, 0x65, 0x61, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6b, 0x6e, 0x6f, 0x77, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x68, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x73, 0x65, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x69, 0x72, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x77, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2c, 0x20, 0x61, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x20, 0x61, 0x20, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x2c, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x67, 0x65, 0x74, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x73, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6b, 0x69, 0x6e, 0x64, 0x2e, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x63, 0x61, 0x73, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, 0x20, 0x68, 0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x41, 0x50, 0x49, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x23, 0x20, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x52, 0x45, 0x53, 0x54, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x6b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x75, 0x73, 0x65, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x62, 0x65, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x50, 0x41, 0x54, 0x43, 0x48, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x50, 0x55, 0x54, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x61, 0x74, 0x69, 0x73, 0x66, 0x79, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x50, 0x55, 0x54, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x29, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x4d, 0x61, 0x73, 0x6b, 0x73, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x2c, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x2e, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x61, 0x72, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x2f, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x2d, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x55, 0x73, 0x65, 0x72, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x20, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x55, 0x73, 0x65, 0x72, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x60, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x20, 0x61, 0x73, 0x20, 0x73, 0x75, 0x63, 0x68, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x3a, 0x20, 0x22, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x3a, 0x20, 0x22, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x65, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x77, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x3a, 0x20, 0x22, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x2c, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x4d, 0x61, 0x73, 0x6b, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x73, 0x20, 0x74, 0x72, 0x65, 0x61, 0x74, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x20, 0x6a, 0x75, 0x73, 0x74, 0x20, 0x61, 0x73, 0x20, 0x72, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x20, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x75, 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x73, 0x75, 0x62, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x39, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x3a, 0x20, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x72, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x7b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x3a, 0x20, 0x22, 0x73, 0x75, 0x62, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x74, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x28, 0x22, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x61, 0x73, 0x65, 0x29, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x23, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x4d, 0x61, 0x73, 0x6b, 0x20, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x41, 0x50, 0x49, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x61, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x41, 0x52, 0x47, 0x55, 0x4d, 0x45, 0x4e, 0x54, 0x60, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x69, 0x66, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x6d, 0x61, 0x70, 0x70, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6d, 0x61, 0x73, 0x6b, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/source_context.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x60, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x0a, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2c, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x2d, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x20, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3a, 0x20, 0x60, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/struct.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x60, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x64, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x6d, 0x61, 0x70, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x74, 0x79, 0x70, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x20, 0x49, 0x6e, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x2c, 0x20, 0x60, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x60, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x69, 0x67, 0x68, 0x74, 0x20, 0x62, 0x65, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x20, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x4a, 0x53, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x72, 0x65, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x67, 0x65, 0x74, 0x68, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x55, 0x6e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, 0x6d, 0x61, 0x70, 0x20, 0x6f, 0x66, 0x20, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x74, 0x79, 0x70, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x6d, 0x61, 0x70, 0x3c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x3e, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x74, 0x79, 0x70, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x20, 0x61, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2c, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x61, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x2c, 0x20, 0x61, 0x20, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x61, 0x0a, 0x2f, 0x2f, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x20, 0x41, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x69, 0x73, 0x20, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73, 0x2e, 0x20, 0x41, 0x62, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x6b, 0x69, 0x6e, 0x64, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x60, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x74, 0x6f, 0x6e, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x60, 0x6e, 0x75, 0x6c, 0x6c, 0x60, 0x2e, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x75, 0x6c, 0x6c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x60, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x61, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x61, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x74, 0x79, 0x70, 0x65, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/timestamp.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x61, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x7a, 0x6f, 0x6e, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x2c, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x20, 0x61, 0x74, 0x20, 0x55, 0x54, 0x43, 0x20, 0x6d, 0x69, 0x64, 0x6e, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6f, 0x6e, 0x0a, 0x2f, 0x2f, 0x20, 0x4a, 0x61, 0x6e, 0x75, 0x61, 0x72, 0x79, 0x20, 0x31, 0x2c, 0x20, 0x31, 0x39, 0x37, 0x30, 0x2c, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x6c, 0x65, 0x70, 0x74, 0x69, 0x63, 0x20, 0x47, 0x72, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x61, 0x6e, 0x20, 0x63, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x73, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x47, 0x72, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x61, 0x6e, 0x20, 0x63, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x77, 0x61, 0x72, 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x79, 0x65, 0x61, 0x72, 0x20, 0x6f, 0x6e, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x36, 0x30, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x2e, 0x20, 0x4c, 0x65, 0x61, 0x70, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x22, 0x73, 0x6d, 0x65, 0x61, 0x72, 0x65, 0x64, 0x22, 0x20, 0x73, 0x6f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6e, 0x6f, 0x20, 0x6c, 0x65, 0x61, 0x70, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x65, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x5b, 0x32, 0x34, 0x2d, 0x68, 0x6f, 0x75, 0x72, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x6d, 0x65, 0x61, 0x72, 0x5d, 0x28, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x73, 0x6d, 0x65, 0x61, 0x72, 0x29, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x69, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x30, 0x30, 0x30, 0x31, 0x2d, 0x30, 0x31, 0x2d, 0x30, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x20, 0x74, 0x6f, 0x20, 0x39, 0x39, 0x39, 0x39, 0x2d, 0x31, 0x32, 0x2d, 0x33, 0x31, 0x54, 0x32, 0x33, 0x3a, 0x35, 0x39, 0x3a, 0x35, 0x39, 0x2e, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x5a, 0x2e, 0x20, 0x42, 0x79, 0x0a, 0x2f, 0x2f, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x2c, 0x20, 0x77, 0x65, 0x20, 0x65, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x77, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x5b, 0x52, 0x46, 0x43, 0x0a, 0x2f, 0x2f, 0x20, 0x33, 0x33, 0x33, 0x39, 0x5d, 0x28, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x65, 0x74, 0x66, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x72, 0x66, 0x63, 0x2f, 0x72, 0x66, 0x63, 0x33, 0x33, 0x33, 0x39, 0x2e, 0x74, 0x78, 0x74, 0x29, 0x20, 0x64, 0x61, 0x74, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x31, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x4f, 0x53, 0x49, 0x58, 0x20, 0x60, 0x74, 0x69, 0x6d, 0x65, 0x28, 0x29, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x28, 0x74, 0x69, 0x6d, 0x65, 0x28, 0x4e, 0x55, 0x4c, 0x4c, 0x29, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x73, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x28, 0x30, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x32, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x4f, 0x53, 0x49, 0x58, 0x20, 0x60, 0x67, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x66, 0x64, 0x61, 0x79, 0x28, 0x29, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x76, 0x61, 0x6c, 0x20, 0x74, 0x76, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x67, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x66, 0x64, 0x61, 0x79, 0x28, 0x26, 0x74, 0x76, 0x2c, 0x20, 0x4e, 0x55, 0x4c, 0x4c, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x28, 0x74, 0x76, 0x2e, 0x74, 0x76, 0x5f, 0x73, 0x65, 0x63, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x73, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x28, 0x74, 0x76, 0x2e, 0x74, 0x76, 0x5f, 0x75, 0x73, 0x65, 0x63, 0x20, 0x2a, 0x20, 0x31, 0x30, 0x30, 0x30, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x33, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x57, 0x69, 0x6e, 0x33, 0x32, 0x20, 0x60, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x41, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x28, 0x29, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x46, 0x49, 0x4c, 0x45, 0x54, 0x49, 0x4d, 0x45, 0x20, 0x66, 0x74, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x41, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x28, 0x26, 0x66, 0x74, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x20, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x28, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x29, 0x66, 0x74, 0x2e, 0x64, 0x77, 0x48, 0x69, 0x67, 0x68, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x29, 0x20, 0x3c, 0x3c, 0x20, 0x33, 0x32, 0x29, 0x20, 0x7c, 0x20, 0x66, 0x74, 0x2e, 0x64, 0x77, 0x4c, 0x6f, 0x77, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x74, 0x69, 0x63, 0x6b, 0x20, 0x69, 0x73, 0x20, 0x31, 0x30, 0x30, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2e, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x20, 0x31, 0x36, 0x30, 0x31, 0x2d, 0x30, 0x31, 0x2d, 0x30, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x31, 0x31, 0x36, 0x34, 0x34, 0x34, 0x37, 0x33, 0x36, 0x30, 0x30, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x55, 0x6e, 0x69, 0x78, 0x20, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x20, 0x31, 0x39, 0x37, 0x30, 0x2d, 0x30, 0x31, 0x2d, 0x30, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x28, 0x28, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x29, 0x20, 0x28, 0x28, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x20, 0x2f, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x31, 0x36, 0x34, 0x34, 0x34, 0x37, 0x33, 0x36, 0x30, 0x30, 0x4c, 0x4c, 0x29, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x73, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x28, 0x28, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x29, 0x20, 0x28, 0x28, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x20, 0x25, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x31, 0x30, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x34, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x20, 0x60, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x28, 0x29, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x20, 0x3d, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x28, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x3d, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x6e, 0x65, 0x77, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x28, 0x29, 0x2e, 0x73, 0x65, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x28, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x20, 0x2f, 0x20, 0x31, 0x30, 0x30, 0x30, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x73, 0x65, 0x74, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x28, 0x28, 0x69, 0x6e, 0x74, 0x29, 0x20, 0x28, 0x28, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x20, 0x25, 0x20, 0x31, 0x30, 0x30, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x29, 0x29, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x28, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x35, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x20, 0x60, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x2e, 0x6e, 0x6f, 0x77, 0x28, 0x29, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x6e, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x2e, 0x6e, 0x6f, 0x77, 0x28, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x3d, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x6e, 0x65, 0x77, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x28, 0x29, 0x2e, 0x73, 0x65, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x28, 0x6e, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x28, 0x29, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2e, 0x73, 0x65, 0x74, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x28, 0x6e, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x4e, 0x61, 0x6e, 0x6f, 0x28, 0x29, 0x29, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x28, 0x29, 0x3b, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x36, 0x3a, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x3d, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x28, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x28, 0x29, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x5b, 0x52, 0x46, 0x43, 0x20, 0x33, 0x33, 0x33, 0x39, 0x5d, 0x28, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x65, 0x74, 0x66, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x72, 0x66, 0x63, 0x2f, 0x72, 0x66, 0x63, 0x33, 0x33, 0x33, 0x39, 0x2e, 0x74, 0x78, 0x74, 0x29, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x20, 0x54, 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x69, 0x73, 0x20, 0x22, 0x7b, 0x79, 0x65, 0x61, 0x72, 0x7d, 0x2d, 0x7b, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x7d, 0x2d, 0x7b, 0x64, 0x61, 0x79, 0x7d, 0x54, 0x7b, 0x68, 0x6f, 0x75, 0x72, 0x7d, 0x3a, 0x7b, 0x6d, 0x69, 0x6e, 0x7d, 0x3a, 0x7b, 0x73, 0x65, 0x63, 0x7d, 0x5b, 0x2e, 0x7b, 0x66, 0x72, 0x61, 0x63, 0x5f, 0x73, 0x65, 0x63, 0x7d, 0x5d, 0x5a, 0x22, 0x0a, 0x2f, 0x2f, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x7b, 0x79, 0x65, 0x61, 0x72, 0x7d, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x6f, 0x75, 0x72, 0x20, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x7b, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x7d, 0x2c, 0x20, 0x7b, 0x64, 0x61, 0x79, 0x7d, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x7b, 0x68, 0x6f, 0x75, 0x72, 0x7d, 0x2c, 0x20, 0x7b, 0x6d, 0x69, 0x6e, 0x7d, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x7b, 0x73, 0x65, 0x63, 0x7d, 0x20, 0x61, 0x72, 0x65, 0x20, 0x7a, 0x65, 0x72, 0x6f, 0x2d, 0x70, 0x61, 0x64, 0x64, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x77, 0x6f, 0x20, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x20, 0x65, 0x61, 0x63, 0x68, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x67, 0x6f, 0x20, 0x75, 0x70, 0x20, 0x74, 0x6f, 0x20, 0x39, 0x20, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x20, 0x28, 0x69, 0x2e, 0x65, 0x2e, 0x20, 0x75, 0x70, 0x20, 0x74, 0x6f, 0x20, 0x31, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x29, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x22, 0x5a, 0x22, 0x20, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x20, 0x28, 0x22, 0x55, 0x54, 0x43, 0x22, 0x29, 0x3b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x73, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x20, 0x41, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x20, 0x75, 0x73, 0x65, 0x20, 0x55, 0x54, 0x43, 0x20, 0x28, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x5a, 0x22, 0x29, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x20, 0x62, 0x6f, 0x74, 0x68, 0x20, 0x55, 0x54, 0x43, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x73, 0x20, 0x28, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x6e, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x29, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x22, 0x32, 0x30, 0x31, 0x37, 0x2d, 0x30, 0x31, 0x2d, 0x31, 0x35, 0x54, 0x30, 0x31, 0x3a, 0x33, 0x30, 0x3a, 0x31, 0x35, 0x2e, 0x30, 0x31, 0x5a, 0x22, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x20, 0x31, 0x35, 0x2e, 0x30, 0x31, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x70, 0x61, 0x73, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x30, 0x31, 0x3a, 0x33, 0x30, 0x20, 0x55, 0x54, 0x43, 0x20, 0x6f, 0x6e, 0x20, 0x4a, 0x61, 0x6e, 0x75, 0x61, 0x72, 0x79, 0x20, 0x31, 0x35, 0x2c, 0x20, 0x32, 0x30, 0x31, 0x37, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x49, 0x6e, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2c, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x20, 0x61, 0x20, 0x44, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x5b, 0x74, 0x6f, 0x49, 0x53, 0x4f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x28, 0x29, 0x5d, 0x28, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x2e, 0x6d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x65, 0x6e, 0x2d, 0x55, 0x53, 0x2f, 0x64, 0x6f, 0x63, 0x73, 0x2f, 0x57, 0x65, 0x62, 0x2f, 0x4a, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2f, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x44, 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, 0x49, 0x53, 0x4f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x29, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x20, 0x49, 0x6e, 0x20, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, 0x60, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x60, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x0a, 0x2f, 0x2f, 0x20, 0x5b, 0x60, 0x73, 0x74, 0x72, 0x66, 0x74, 0x69, 0x6d, 0x65, 0x60, 0x5d, 0x28, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x6f, 0x63, 0x73, 0x2e, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x32, 0x2f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x23, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x73, 0x74, 0x72, 0x66, 0x74, 0x69, 0x6d, 0x65, 0x29, 0x20, 0x77, 0x69, 0x74, 0x68, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x20, 0x27, 0x25, 0x59, 0x2d, 0x25, 0x6d, 0x2d, 0x25, 0x64, 0x54, 0x25, 0x48, 0x3a, 0x25, 0x4d, 0x3a, 0x25, 0x53, 0x2e, 0x25, 0x66, 0x5a, 0x27, 0x2e, 0x20, 0x4c, 0x69, 0x6b, 0x65, 0x77, 0x69, 0x73, 0x65, 0x2c, 0x20, 0x69, 0x6e, 0x20, 0x4a, 0x61, 0x76, 0x61, 0x2c, 0x20, 0x6f, 0x6e, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4a, 0x6f, 0x64, 0x61, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x27, 0x73, 0x20, 0x5b, 0x60, 0x49, 0x53, 0x4f, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x28, 0x29, 0x60, 0x5d, 0x28, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x6a, 0x6f, 0x64, 0x61, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6a, 0x6f, 0x64, 0x61, 0x2d, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x64, 0x6f, 0x63, 0x73, 0x2f, 0x6f, 0x72, 0x67, 0x2f, 0x6a, 0x6f, 0x64, 0x61, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2f, 0x49, 0x53, 0x4f, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x23, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x25, 0x32, 0x44, 0x25, 0x32, 0x44, 0x0a, 0x2f, 0x2f, 0x20, 0x29, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x63, 0x61, 0x70, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x55, 0x54, 0x43, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x73, 0x69, 0x6e, 0x63, 0x65, 0x20, 0x55, 0x6e, 0x69, 0x78, 0x20, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x31, 0x39, 0x37, 0x30, 0x2d, 0x30, 0x31, 0x2d, 0x30, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x2e, 0x20, 0x4d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x30, 0x30, 0x30, 0x31, 0x2d, 0x30, 0x31, 0x2d, 0x30, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x5a, 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x39, 0x39, 0x39, 0x39, 0x2d, 0x31, 0x32, 0x2d, 0x33, 0x31, 0x54, 0x32, 0x33, 0x3a, 0x35, 0x39, 0x3a, 0x35, 0x39, 0x5a, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x4e, 0x6f, 0x6e, 0x2d, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x61, 0x74, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x73, 0x74, 0x69, 0x6c, 0x6c, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x6e, 0x6f, 0x6e, 0x2d, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x20, 0x4d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x30, 0x20, 0x74, 0x6f, 0x20, 0x39, 0x39, 0x39, 0x2c, 0x39, 0x39, 0x39, 0x2c, 0x39, 0x39, 0x39, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/type.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x54, 0x79, 0x70, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x54, 0x79, 0x70, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x20, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x20, 0x60, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x60, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x42, 0x61, 0x73, 0x69, 0x63, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x20, 0x3d, 0x20, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x20, 0x3d, 0x20, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x20, 0x3d, 0x20, 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x20, 0x3d, 0x20, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x20, 0x3d, 0x20, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x20, 0x3d, 0x20, 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x20, 0x3d, 0x20, 0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x57, 0x68, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x61, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2c, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x20, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x52, 0x44, 0x49, 0x4e, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x52, 0x44, 0x49, 0x4e, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x52, 0x44, 0x49, 0x4e, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x52, 0x44, 0x49, 0x4e, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45, 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x6b, 0x69, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x55, 0x52, 0x4c, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3a, 0x20, 0x60, 0x22, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x20, 0x3d, 0x20, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x60, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x60, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x68, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x31, 0x3b, 0x20, 0x7a, 0x65, 0x72, 0x6f, 0x20, 0x6d, 0x65, 0x61, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x57, 0x68, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x77, 0x69, 0x72, 0x65, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x3d, 0x20, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x35, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x45, 0x6e, 0x75, 0x6d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x3d, 0x20, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x65, 0x74, 0x63, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x27, 0x73, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x2d, 0x69, 0x6e, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x28, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x29, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x60, 0x22, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x2d, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x60, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x22, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x27, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x2e, 0x20, 0x49, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x65, 0x6e, 0x75, 0x6d, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x41, 0x6e, 0x79, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x69, 0x6e, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x73, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x60, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x59, 0x4e, 0x54, 0x41, 0x58, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x60, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x60, 0x2e, 0x0a, 0x20, 0x20, 0x53, 0x59, 0x4e, 0x54, 0x41, 0x58, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, + }, + "google/protobuf/wrappers.proto": { + 0x2f, 0x2f, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x2f, 0x2f, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x2f, 0x2f, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x2f, 0x2f, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x2f, 0x2f, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x2f, 0x2f, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x2f, 0x2f, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x20, 0x28, 0x6e, 0x6f, 0x6e, 0x2d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x29, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x75, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x0a, 0x2f, 0x2f, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x60, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x60, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x0a, 0x2f, 0x2f, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x77, 0x65, 0x20, 0x6e, 0x65, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x75, 0x69, 0x73, 0x68, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x79, 0x70, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x69, 0x74, 0x73, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x6e, 0x6f, 0x20, 0x6d, 0x65, 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x66, 0x75, 0x6c, 0x20, 0x75, 0x73, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x6c, 0x61, 0x63, 0x6b, 0x0a, 0x2f, 0x2f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x76, 0x69, 0x64, 0x75, 0x61, 0x6c, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x6e, 0x6f, 0x20, 0x6d, 0x65, 0x61, 0x6e, 0x69, 0x6e, 0x67, 0x66, 0x75, 0x6c, 0x20, 0x75, 0x73, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x6d, 0x61, 0x70, 0x20, 0x6f, 0x72, 0x20, 0x61, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x73, 0x69, 0x6e, 0x63, 0x65, 0x0a, 0x2f, 0x2f, 0x20, 0x69, 0x6e, 0x64, 0x69, 0x76, 0x69, 0x64, 0x75, 0x61, 0x6c, 0x20, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x6d, 0x61, 0x70, 0x20, 0x6f, 0x72, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x22, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x3b, 0x0a, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x70, 0x62, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x50, 0x42, 0x22, 0x3b, 0x0a, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x62, 0x6f, 0x6f, 0x6c, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x60, 0x74, 0x72, 0x75, 0x65, 0x60, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x60, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x60, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x62, 0x6f, 0x6f, 0x6c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x2f, 0x2f, 0x20, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x62, 0x79, 0x74, 0x65, 0x73, 0x60, 0x2e, 0x0a, 0x2f, 0x2f, 0x0a, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x60, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x60, 0x20, 0x69, 0x73, 0x20, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x54, 0x68, 0x65, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x0a, 0x20, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, + }, + } + + messageNameToFilePath = map[string]string{ + "google.protobuf.Any": "google/protobuf/any.proto", + "google.protobuf.Api": "google/protobuf/api.proto", + "google.protobuf.BoolValue": "google/protobuf/wrappers.proto", + "google.protobuf.BytesValue": "google/protobuf/wrappers.proto", + "google.protobuf.DescriptorProto": "google/protobuf/descriptor.proto", + "google.protobuf.DescriptorProto.ExtensionRange": "google/protobuf/descriptor.proto", + "google.protobuf.DescriptorProto.ReservedRange": "google/protobuf/descriptor.proto", + "google.protobuf.DoubleValue": "google/protobuf/wrappers.proto", + "google.protobuf.Duration": "google/protobuf/duration.proto", + "google.protobuf.Empty": "google/protobuf/empty.proto", + "google.protobuf.Enum": "google/protobuf/type.proto", + "google.protobuf.EnumDescriptorProto": "google/protobuf/descriptor.proto", + "google.protobuf.EnumDescriptorProto.EnumReservedRange": "google/protobuf/descriptor.proto", + "google.protobuf.EnumOptions": "google/protobuf/descriptor.proto", + "google.protobuf.EnumValue": "google/protobuf/type.proto", + "google.protobuf.EnumValueDescriptorProto": "google/protobuf/descriptor.proto", + "google.protobuf.EnumValueOptions": "google/protobuf/descriptor.proto", + "google.protobuf.ExtensionRangeOptions": "google/protobuf/descriptor.proto", + "google.protobuf.Field": "google/protobuf/type.proto", + "google.protobuf.FieldDescriptorProto": "google/protobuf/descriptor.proto", + "google.protobuf.FieldMask": "google/protobuf/field_mask.proto", + "google.protobuf.FieldOptions": "google/protobuf/descriptor.proto", + "google.protobuf.FileDescriptorProto": "google/protobuf/descriptor.proto", + "google.protobuf.FileDescriptorSet": "google/protobuf/descriptor.proto", + "google.protobuf.FileOptions": "google/protobuf/descriptor.proto", + "google.protobuf.FloatValue": "google/protobuf/wrappers.proto", + "google.protobuf.GeneratedCodeInfo": "google/protobuf/descriptor.proto", + "google.protobuf.GeneratedCodeInfo.Annotation": "google/protobuf/descriptor.proto", + "google.protobuf.Int32Value": "google/protobuf/wrappers.proto", + "google.protobuf.Int64Value": "google/protobuf/wrappers.proto", + "google.protobuf.ListValue": "google/protobuf/struct.proto", + "google.protobuf.MessageOptions": "google/protobuf/descriptor.proto", + "google.protobuf.Method": "google/protobuf/api.proto", + "google.protobuf.MethodDescriptorProto": "google/protobuf/descriptor.proto", + "google.protobuf.MethodOptions": "google/protobuf/descriptor.proto", + "google.protobuf.Mixin": "google/protobuf/api.proto", + "google.protobuf.OneofDescriptorProto": "google/protobuf/descriptor.proto", + "google.protobuf.OneofOptions": "google/protobuf/descriptor.proto", + "google.protobuf.Option": "google/protobuf/type.proto", + "google.protobuf.ServiceDescriptorProto": "google/protobuf/descriptor.proto", + "google.protobuf.ServiceOptions": "google/protobuf/descriptor.proto", + "google.protobuf.SourceCodeInfo": "google/protobuf/descriptor.proto", + "google.protobuf.SourceCodeInfo.Location": "google/protobuf/descriptor.proto", + "google.protobuf.SourceContext": "google/protobuf/source_context.proto", + "google.protobuf.StringValue": "google/protobuf/wrappers.proto", + "google.protobuf.Struct": "google/protobuf/struct.proto", + "google.protobuf.Struct.FieldsEntry": "google/protobuf/struct.proto", + "google.protobuf.Timestamp": "google/protobuf/timestamp.proto", + "google.protobuf.Type": "google/protobuf/type.proto", + "google.protobuf.UInt32Value": "google/protobuf/wrappers.proto", + "google.protobuf.UInt64Value": "google/protobuf/wrappers.proto", + "google.protobuf.UninterpretedOption": "google/protobuf/descriptor.proto", + "google.protobuf.UninterpretedOption.NamePart": "google/protobuf/descriptor.proto", + "google.protobuf.Value": "google/protobuf/struct.proto", + "google.protobuf.compiler.CodeGeneratorRequest": "google/protobuf/compiler/plugin.proto", + "google.protobuf.compiler.CodeGeneratorResponse": "google/protobuf/compiler/plugin.proto", + "google.protobuf.compiler.CodeGeneratorResponse.File": "google/protobuf/compiler/plugin.proto", + "google.protobuf.compiler.Version": "google/protobuf/compiler/plugin.proto", + } + + enumNameToFilePath = map[string]string{ + "google.protobuf.Field.Cardinality": "google/protobuf/type.proto", + "google.protobuf.Field.Kind": "google/protobuf/type.proto", + "google.protobuf.FieldDescriptorProto.Label": "google/protobuf/descriptor.proto", + "google.protobuf.FieldDescriptorProto.Type": "google/protobuf/descriptor.proto", + "google.protobuf.FieldOptions.CType": "google/protobuf/descriptor.proto", + "google.protobuf.FieldOptions.JSType": "google/protobuf/descriptor.proto", + "google.protobuf.FieldOptions.OptionRetention": "google/protobuf/descriptor.proto", + "google.protobuf.FieldOptions.OptionTargetType": "google/protobuf/descriptor.proto", + "google.protobuf.FileOptions.OptimizeMode": "google/protobuf/descriptor.proto", + "google.protobuf.GeneratedCodeInfo.Annotation.Semantic": "google/protobuf/descriptor.proto", + "google.protobuf.MethodOptions.IdempotencyLevel": "google/protobuf/descriptor.proto", + "google.protobuf.NullValue": "google/protobuf/struct.proto", + "google.protobuf.Syntax": "google/protobuf/type.proto", + "google.protobuf.compiler.CodeGeneratorResponse.Feature": "google/protobuf/compiler/plugin.proto", + } +) + +func init() { + readBucket, err := storagemem.NewReadBucket(pathToData) + if err != nil { + panic(err.Error()) + } + ReadBucket = readBucket +} + +// Exists returns true if the given path exists in the static data. +// +// The path is normalized within this function. +func Exists(path string) bool { + _, ok := pathToData[normalpath.Normalize(path)] + return ok +} + +// MessageFilePath gets the file path for the given message, if the message exists. +func MessageFilePath(messageName string) (string, bool) { + filePath, ok := messageNameToFilePath[messageName] + return filePath, ok +} + +// EnumFilePath gets the file path for the given enum, if the enum exists. +func EnumFilePath(enumName string) (string, bool) { + filePath, ok := enumNameToFilePath[enumName] + return filePath, ok +} From a427255a2c9702a740c84d6b7b1f57a07f8c4874 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:27:18 +0800 Subject: [PATCH 03/18] update .licenserc.yaml --- .licenserc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.licenserc.yaml b/.licenserc.yaml index 0a9dd6a21..97b3c6b4f 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -82,6 +82,7 @@ header: - '**/deploy.tpl' - '**/docs/**' - '**/.nvmrc' + - '**/**.txtar' comment: on-failure license-location-threshold: 130 From 850b6fd0c38325e47cd0c0976f8e594c43eb7513 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:27:29 +0800 Subject: [PATCH 04/18] update go.mod --- go.mod | 14 +++++++++++--- go.sum | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d6f02a2eb..d74483ea5 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/golang-jwt/jwt/v4 v4.5.0 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/google/go-containerregistry v0.16.1 github.com/google/uuid v1.3.0 github.com/google/yamlfmt v0.9.0 @@ -59,7 +59,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.15.1 github.com/prometheus/common v0.44.0 - github.com/spf13/cobra v1.7.0 + github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 github.com/tidwall/gjson v1.14.4 @@ -140,6 +140,8 @@ require ( github.com/bits-and-blooms/bitset v1.2.0 // indirect github.com/bmatcuk/doublestar/v4 v4.6.0 // indirect github.com/braydonk/yaml v0.7.0 // indirect + github.com/bufbuild/connect-go v1.10.0 // indirect + github.com/bufbuild/protocompile v0.5.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c // indirect github.com/buildpacks/lifecycle v0.17.0 // indirect @@ -158,6 +160,7 @@ require ( github.com/containerd/typeurl v1.0.2 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/creasty/defaults v1.5.2 // indirect github.com/cyphar/filepath-securejoin v0.2.3 // indirect github.com/dgraph-io/ristretto v0.0.1 // indirect @@ -196,6 +199,7 @@ require ( github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.2 // indirect + github.com/gofrs/uuid/v5 v5.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.0.1 // indirect @@ -333,7 +337,7 @@ require ( golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect - golang.org/x/sync v0.3.0 // indirect + golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect @@ -347,6 +351,10 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c // indirect + gorm.io/gen v0.3.24 // indirect + gorm.io/hints v1.1.0 // indirect + gorm.io/plugin/dbresolver v1.3.0 // indirect k8s.io/apiserver v0.27.3 // indirect k8s.io/cli-runtime v0.27.3 // indirect k8s.io/component-base v0.27.3 // indirect diff --git a/go.sum b/go.sum index fbde080a2..0c3c13331 100644 --- a/go.sum +++ b/go.sum @@ -590,6 +590,12 @@ github.com/bmatcuk/doublestar/v4 v4.6.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTS github.com/braydonk/yaml v0.7.0 h1:ySkqO7r0MGoCNhiRJqE0Xe9yhINMyvOAB3nFjgyJn2k= github.com/braydonk/yaml v0.7.0/go.mod h1:hcm3h581tudlirk8XEUPDBAimBPbmnL0Y45hCRl47N4= github.com/bshuster-repo/logrus-logstash-hook v1.0.0 h1:e+C0SB5R1pu//O4MQ3f9cFuPGoOVeF2fE4Og9otCc70= +github.com/bufbuild/connect-go v1.10.0 h1:QAJ3G9A1OYQW2Jbk3DeoJbkCxuKArrvZgDt47mjdTbg= +github.com/bufbuild/connect-go v1.10.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8= +github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg= +github.com/bufbuild/protocompile v0.5.1/go.mod h1:G5iLmavmF4NsYtpZFvE3B/zFch2GIY8+wjsYLR/lc40= +github.com/bufbuild/protocompile v0.7.1 h1:Kd8fb6EshOHXNNRtYAmLAwy/PotlyFoN0iMbuwGNh0M= +github.com/bufbuild/protocompile v0.7.1/go.mod h1:+Etjg4guZoAqzVk2czwEQP12yaxLJ8DxuqCJ9qHdH94= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= @@ -687,6 +693,8 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -911,6 +919,8 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godror/godror v0.24.2/go.mod h1:wZv/9vPiUib6tkoDl+AZ/QLf5YZgMravZ7jxH2eQWAE= github.com/gofrs/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6rR7UHz84= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= +github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -1000,6 +1010,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-containerregistry v0.16.1 h1:rUEt426sR6nyrL3gt+18ibRcvYpKYdpsa5ZW7MA08dQ= github.com/google/go-containerregistry v0.16.1/go.mod h1:u0qB2l7mvtWVR5kNcbFIhFY1hLbf8eeGapA+vbFDCtQ= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -1196,6 +1208,8 @@ github.com/jinzhu/gorm v1.9.2/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCd github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -1345,6 +1359,7 @@ github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWV github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= @@ -1663,6 +1678,8 @@ github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJ github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -2084,6 +2101,8 @@ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2599,6 +2618,10 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1 h1:fk72uXZyuZiTtW5tgd63jyVK6582lF61nRC/kGv6vCA= +google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -2643,16 +2666,30 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c h1:jWdr7cHgl8c/ua5vYbR2WhSp+NQmzhsj0xoY3foTzW8= +gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c/go.mod h1:SH2K9R+2RMjuX1CkCONrPwoe9JzVv2hkQvEu4bXGojE= +gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= gorm.io/driver/mysql v1.5.1 h1:WUEH5VF9obL/lTtzjmML/5e6VfFR/788coz2uaVCAZw= gorm.io/driver/mysql v1.5.1/go.mod h1:Jo3Xu7mMhCyj8dlrb3WoCaRd1FhsVh+yMXb1jUInf5o= gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c= +gorm.io/driver/sqlite v1.1.6/go.mod h1:W8LmC/6UvVbHKah0+QOC7Ja66EaZXHwUTjgXY8YNWX8= gorm.io/driver/sqlite v1.5.2 h1:TpQ+/dqCY4uCigCFyrfnrJnrW9zjpelWVoEVNy5qJkc= gorm.io/driver/sqlite v1.5.2/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= +gorm.io/gen v0.3.24 h1:yL1RrCySwTWTQpkUkt2FCe42Xub2eaZP2tM5EQoFBNU= +gorm.io/gen v0.3.24/go.mod h1:G9uxGfkfNFxPoOrV5P6KQxRMgZsQSCyp9vJP8xiKTGg= gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.20.6/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.21.15/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= +gorm.io/gorm v1.22.2/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= +gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55 h1:sC1Xj4TYrLqg1n3AN10w871An7wJM0gzgcm8jkIkECQ= gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/hints v1.1.0 h1:Lp4z3rxREufSdxn4qmkK3TLDltrM10FLTHiuqwDPvXw= +gorm.io/hints v1.1.0/go.mod h1:lKQ0JjySsPBj3uslFzY3JhYDtqEwzm+G1hv8rWujB6Y= +gorm.io/plugin/dbresolver v1.3.0 h1:uFDX3bIuH9Lhj5LY2oyqR/bU6pqWuDgas35NAPF4X3M= +gorm.io/plugin/dbresolver v1.3.0/go.mod h1:Pr7p5+JFlgDaiM6sOrli5olekJD16YRunMyA2S7ZfKk= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= From 86808bc83bb72ebe7f736479f12c7394071ba9fa Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:28:17 +0800 Subject: [PATCH 05/18] bufman generate code by buf build --- .../auditv1alpha1connect/service.connect.go | 127 + .../registryv1alpha1connect/admin.connect.go | 376 ++ .../registryv1alpha1connect/authn.connect.go | 167 + .../registryv1alpha1connect/authz.connect.go | 826 +++ .../convert.connect.go | 126 + .../display.connect.go | 356 ++ .../registryv1alpha1connect/doc.connect.go | 270 + .../registryv1alpha1connect/docker.connect.go | 311 ++ .../download.connect.go | 161 + .../generate.connect.go | 161 + .../registryv1alpha1connect/github.connect.go | 128 + .../registryv1alpha1connect/image.connect.go | 128 + .../jsonschema.connect.go | 129 + .../registryv1alpha1connect/labels.connect.go | 179 + .../organization.connect.go | 600 +++ .../registryv1alpha1connect/owner.connect.go | 129 + .../registryv1alpha1connect/plugin.connect.go | 581 +++ .../plugin_curation.connect.go | 300 ++ .../registryv1alpha1connect/push.connect.go | 160 + .../recommendation.connect.go | 230 + .../reference.connect.go | 164 + .../repository.connect.go | 673 +++ .../repository_branch.connect.go | 128 + .../repository_commit.connect.go | 302 ++ .../repository_tag.connect.go | 194 + .../resolve.connect.go | 364 ++ .../resource.connect.go | 130 + .../registryv1alpha1connect/schema.connect.go | 159 + .../scim_token.connect.go | 199 + .../registryv1alpha1connect/search.connect.go | 285 + .../registryv1alpha1connect/studio.connect.go | 158 + .../studio_request.connect.go | 224 + .../registryv1alpha1connect/sync.connect.go | 160 + .../registryv1alpha1connect/token.connect.go | 228 + .../registryv1alpha1connect/user.connect.go | 402 ++ .../webhook.connect.go | 191 + .../admin.connect.go | 378 ++ .../authn.connect.go | 168 + .../authz.connect.go | 828 +++ .../convert.connect.go | 126 + .../display.connect.go | 356 ++ .../doc.connect.go | 271 + .../docker.connect.go | 312 ++ .../download.connect.go | 161 + .../generate.connect.go | 162 + .../github.connect.go | 128 + .../image.connect.go | 128 + .../jsonschema.connect.go | 130 + .../labels.connect.go | 179 + .../organization.connect.go | 600 +++ .../owner.connect.go | 130 + .../plugin.connect.go | 585 +++ .../plugin_curation.connect.go | 301 ++ .../push.connect.go | 160 + .../recommendation.connect.go | 230 + .../reference.connect.go | 164 + .../repository.connect.go | 674 +++ .../repository_branch.connect.go | 128 + .../repository_commit.connect.go | 302 ++ .../repository_tag.connect.go | 194 + .../resolve.connect.go | 368 ++ .../resource.connect.go | 130 + .../schema.connect.go | 160 + .../scim_token.connect.go | 202 + .../search.connect.go | 286 ++ .../studio.connect.go | 158 + .../studio_request.connect.go | 224 + .../sync.connect.go | 161 + .../token.connect.go | 228 + .../user.connect.go | 404 ++ .../webhook.connect.go | 193 + .../webhookv1alpha1connect/event.connect.go | 124 + .../gen/proto/go/audit/v1alpha1/event.pb.go | 4562 +++++++++++++++++ .../gen/proto/go/audit/v1alpha1/service.pb.go | 306 ++ .../go/audit/v1alpha1/service_grpc.pb.go | 111 + .../gen/proto/go/breaking/v1/config.pb.go | 310 ++ pkg/bufman/gen/proto/go/image/v1/image.pb.go | 711 +++ pkg/bufman/gen/proto/go/lint/v1/config.pb.go | 372 ++ .../gen/proto/go/module/v1alpha1/module.pb.go | 783 +++ .../proto/go/registry/v1alpha1/admin.pb.go | 1997 ++++++++ .../go/registry/v1alpha1/admin_grpc.pb.go | 425 ++ .../proto/go/registry/v1alpha1/authn.pb.go | 374 ++ .../go/registry/v1alpha1/authn_grpc.pb.go | 158 + .../proto/go/registry/v1alpha1/authz.pb.go | 3086 +++++++++++ .../go/registry/v1alpha1/authz_grpc.pb.go | 917 ++++ .../proto/go/registry/v1alpha1/convert.pb.go | 363 ++ .../go/registry/v1alpha1/convert_grpc.pb.go | 113 + .../proto/go/registry/v1alpha1/display.pb.go | 1360 +++++ .../go/registry/v1alpha1/display_grpc.pb.go | 388 ++ .../gen/proto/go/registry/v1alpha1/doc.pb.go | 3498 +++++++++++++ .../proto/go/registry/v1alpha1/doc_grpc.pb.go | 283 + .../proto/go/registry/v1alpha1/docker.pb.go | 1213 +++++ .../go/registry/v1alpha1/docker_grpc.pb.go | 345 ++ .../proto/go/registry/v1alpha1/download.pb.go | 456 ++ .../go/registry/v1alpha1/download_grpc.pb.go | 152 + .../proto/go/registry/v1alpha1/generate.pb.go | 821 +++ .../go/registry/v1alpha1/generate_grpc.pb.go | 156 + .../go/registry/v1alpha1/git_metadata.pb.go | 312 ++ .../proto/go/registry/v1alpha1/github.pb.go | 302 ++ .../go/registry/v1alpha1/github_grpc.pb.go | 111 + .../proto/go/registry/v1alpha1/image.pb.go | 398 ++ .../go/registry/v1alpha1/image_grpc.pb.go | 113 + .../go/registry/v1alpha1/jsonschema.pb.go | 281 + .../registry/v1alpha1/jsonschema_grpc.pb.go | 113 + .../proto/go/registry/v1alpha1/labels.pb.go | 934 ++++ .../go/registry/v1alpha1/labels_grpc.pb.go | 183 + .../proto/go/registry/v1alpha1/module.pb.go | 325 ++ .../go/registry/v1alpha1/organization.pb.go | 2893 +++++++++++ .../registry/v1alpha1/organization_grpc.pb.go | 694 +++ .../proto/go/registry/v1alpha1/owner.pb.go | 370 ++ .../go/registry/v1alpha1/owner_grpc.pb.go | 113 + .../proto/go/registry/v1alpha1/plugin.pb.go | 3539 +++++++++++++ .../registry/v1alpha1/plugin_curation.pb.go | 3613 +++++++++++++ .../v1alpha1/plugin_curation_grpc.pb.go | 320 ++ .../go/registry/v1alpha1/plugin_grpc.pb.go | 671 +++ .../gen/proto/go/registry/v1alpha1/push.pb.go | 543 ++ .../go/registry/v1alpha1/push_grpc.pb.go | 152 + .../go/registry/v1alpha1/recommendation.pb.go | 937 ++++ .../v1alpha1/recommendation_grpc.pb.go | 231 + .../go/registry/v1alpha1/reference.pb.go | 791 +++ .../go/registry/v1alpha1/reference_grpc.pb.go | 154 + .../go/registry/v1alpha1/repository.pb.go | 3657 +++++++++++++ .../registry/v1alpha1/repository_branch.pb.go | 404 ++ .../v1alpha1/repository_branch_grpc.pb.go | 112 + .../registry/v1alpha1/repository_commit.pb.go | 1462 ++++++ .../v1alpha1/repository_commit_grpc.pb.go | 318 ++ .../registry/v1alpha1/repository_grpc.pb.go | 784 +++ .../go/registry/v1alpha1/repository_tag.pb.go | 782 +++ .../v1alpha1/repository_tag_grpc.pb.go | 191 + .../proto/go/registry/v1alpha1/resolve.pb.go | 1381 +++++ .../go/registry/v1alpha1/resolve_grpc.pb.go | 393 ++ .../proto/go/registry/v1alpha1/resource.pb.go | 382 ++ .../go/registry/v1alpha1/resource_grpc.pb.go | 113 + .../gen/proto/go/registry/v1alpha1/role.pb.go | 500 ++ .../proto/go/registry/v1alpha1/schema.pb.go | 944 ++++ .../go/registry/v1alpha1/schema_grpc.pb.go | 154 + .../go/registry/v1alpha1/scim_token.pb.go | 645 +++ .../registry/v1alpha1/scim_token_grpc.pb.go | 201 + .../proto/go/registry/v1alpha1/search.pb.go | 1825 +++++++ .../go/registry/v1alpha1/search_grpc.pb.go | 308 ++ .../proto/go/registry/v1alpha1/studio.pb.go | 526 ++ .../go/registry/v1alpha1/studio_grpc.pb.go | 150 + .../go/registry/v1alpha1/studio_request.pb.go | 1168 +++++ .../v1alpha1/studio_request_grpc.pb.go | 232 + .../gen/proto/go/registry/v1alpha1/sync.pb.go | 632 +++ .../go/registry/v1alpha1/sync_grpc.pb.go | 152 + .../proto/go/registry/v1alpha1/token.pb.go | 843 +++ .../go/registry/v1alpha1/token_grpc.pb.go | 240 + .../gen/proto/go/registry/v1alpha1/user.pb.go | 2028 ++++++++ .../go/registry/v1alpha1/user_grpc.pb.go | 464 ++ .../v1alpha1/verification_status.pb.go | 167 + .../proto/go/registry/v1alpha1/webhook.pb.go | 816 +++ .../go/registry/v1alpha1/webhook_grpc.pb.go | 191 + .../gen/proto/go/studio/v1alpha1/invoke.pb.go | 389 ++ .../proto/go/wasmplugin/v1/wasmplugin.pb.go | 339 ++ .../gen/proto/go/webhook/v1alpha1/event.pb.go | 463 ++ .../go/webhook/v1alpha1/event_grpc.pb.go | 111 + 157 files changed, 83659 insertions(+) create mode 100644 pkg/bufman/gen/proto/connect/audit/v1alpha1/auditv1alpha1connect/service.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/admin.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/authn.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/authz.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/convert.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/display.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/doc.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/docker.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/download.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/generate.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/github.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/image.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/jsonschema.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/labels.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/organization.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/owner.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/plugin.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/plugin_curation.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/push.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/recommendation.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/reference.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_branch.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_commit.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_tag.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/resolve.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/resource.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/schema.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/scim_token.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/search.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/studio.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/studio_request.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/sync.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/token.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/user.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/webhook.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/admin.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/authn.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/authz.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/convert.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/display.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/doc.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/docker.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/download.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/generate.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/github.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/image.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/jsonschema.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/labels.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/organization.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/owner.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/plugin.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/plugin_curation.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/push.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/recommendation.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/reference.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_branch.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_commit.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_tag.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/resolve.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/resource.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/schema.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/scim_token.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/search.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/studio.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/studio_request.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/sync.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/token.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/user.connect.go create mode 100644 pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/webhook.connect.go create mode 100644 pkg/bufman/gen/proto/connect/webhook/v1alpha1/webhookv1alpha1connect/event.connect.go create mode 100644 pkg/bufman/gen/proto/go/audit/v1alpha1/event.pb.go create mode 100644 pkg/bufman/gen/proto/go/audit/v1alpha1/service.pb.go create mode 100644 pkg/bufman/gen/proto/go/audit/v1alpha1/service_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/breaking/v1/config.pb.go create mode 100644 pkg/bufman/gen/proto/go/image/v1/image.pb.go create mode 100644 pkg/bufman/gen/proto/go/lint/v1/config.pb.go create mode 100644 pkg/bufman/gen/proto/go/module/v1alpha1/module.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/admin.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/admin_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/authn.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/authn_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/authz.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/authz_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/convert.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/convert_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/display.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/display_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/doc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/doc_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/docker.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/docker_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/download.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/download_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/generate.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/generate_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/git_metadata.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/github.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/github_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/image.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/image_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/jsonschema.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/jsonschema_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/labels.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/labels_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/module.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/organization.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/organization_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/owner.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/owner_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/plugin.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_curation.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_curation_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/push.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/push_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/recommendation.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/recommendation_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/reference.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/reference_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/repository.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/repository_branch.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/repository_branch_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/repository_commit.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/repository_commit_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/repository_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/repository_tag.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/repository_tag_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/resolve.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/resolve_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/resource.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/resource_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/role.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/schema.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/schema_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/scim_token.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/scim_token_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/search.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/search_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/studio.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/studio_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/studio_request.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/studio_request_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/sync.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/sync_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/token.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/token_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/user.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/user_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/verification_status.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/webhook.pb.go create mode 100644 pkg/bufman/gen/proto/go/registry/v1alpha1/webhook_grpc.pb.go create mode 100644 pkg/bufman/gen/proto/go/studio/v1alpha1/invoke.pb.go create mode 100644 pkg/bufman/gen/proto/go/wasmplugin/v1/wasmplugin.pb.go create mode 100644 pkg/bufman/gen/proto/go/webhook/v1alpha1/event.pb.go create mode 100644 pkg/bufman/gen/proto/go/webhook/v1alpha1/event_grpc.pb.go diff --git a/pkg/bufman/gen/proto/connect/audit/v1alpha1/auditv1alpha1connect/service.connect.go b/pkg/bufman/gen/proto/connect/audit/v1alpha1/auditv1alpha1connect/service.connect.go new file mode 100644 index 000000000..3e99e2ca8 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/audit/v1alpha1/auditv1alpha1connect/service.connect.go @@ -0,0 +1,127 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: audit/v1alpha1/service.proto + +package auditv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/audit/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // AuditServiceName is the fully-qualified name of the AuditService service. + AuditServiceName = "bufman.dubbo.apache.org.audit.v1alpha1.AuditService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AuditServiceListAuditedEventsProcedure is the fully-qualified name of the AuditService's + // ListAuditedEvents RPC. + AuditServiceListAuditedEventsProcedure = "/bufman.dubbo.apache.org.audit.v1alpha1.AuditService/ListAuditedEvents" +) + +// AuditServiceClient is a client for the bufman.dubbo.apache.org.audit.v1alpha1.AuditService +// service. +type AuditServiceClient interface { + // ListAuditedEvents lists audited events recorded in the BSR instance. + ListAuditedEvents(context.Context, *connect_go.Request[v1alpha1.ListAuditedEventsRequest]) (*connect_go.Response[v1alpha1.ListAuditedEventsResponse], error) +} + +// NewAuditServiceClient constructs a client for the +// bufman.dubbo.apache.org.audit.v1alpha1.AuditService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAuditServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AuditServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &auditServiceClient{ + listAuditedEvents: connect_go.NewClient[v1alpha1.ListAuditedEventsRequest, v1alpha1.ListAuditedEventsResponse]( + httpClient, + baseURL+AuditServiceListAuditedEventsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// auditServiceClient implements AuditServiceClient. +type auditServiceClient struct { + listAuditedEvents *connect_go.Client[v1alpha1.ListAuditedEventsRequest, v1alpha1.ListAuditedEventsResponse] +} + +// ListAuditedEvents calls bufman.dubbo.apache.org.audit.v1alpha1.AuditService.ListAuditedEvents. +func (c *auditServiceClient) ListAuditedEvents(ctx context.Context, req *connect_go.Request[v1alpha1.ListAuditedEventsRequest]) (*connect_go.Response[v1alpha1.ListAuditedEventsResponse], error) { + return c.listAuditedEvents.CallUnary(ctx, req) +} + +// AuditServiceHandler is an implementation of the +// bufman.dubbo.apache.org.audit.v1alpha1.AuditService service. +type AuditServiceHandler interface { + // ListAuditedEvents lists audited events recorded in the BSR instance. + ListAuditedEvents(context.Context, *connect_go.Request[v1alpha1.ListAuditedEventsRequest]) (*connect_go.Response[v1alpha1.ListAuditedEventsResponse], error) +} + +// NewAuditServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAuditServiceHandler(svc AuditServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + auditServiceListAuditedEventsHandler := connect_go.NewUnaryHandler( + AuditServiceListAuditedEventsProcedure, + svc.ListAuditedEvents, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.audit.v1alpha1.AuditService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AuditServiceListAuditedEventsProcedure: + auditServiceListAuditedEventsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAuditServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAuditServiceHandler struct{} + +func (UnimplementedAuditServiceHandler) ListAuditedEvents(context.Context, *connect_go.Request[v1alpha1.ListAuditedEventsRequest]) (*connect_go.Response[v1alpha1.ListAuditedEventsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.audit.v1alpha1.AuditService.ListAuditedEvents is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/admin.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/admin.connect.go new file mode 100644 index 000000000..4fb043de9 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/admin.connect.go @@ -0,0 +1,376 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/admin.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // AdminServiceName is the fully-qualified name of the AdminService service. + AdminServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.AdminService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AdminServiceForceDeleteUserProcedure is the fully-qualified name of the AdminService's + // ForceDeleteUser RPC. + AdminServiceForceDeleteUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/ForceDeleteUser" + // AdminServiceUpdateUserVerificationStatusProcedure is the fully-qualified name of the + // AdminService's UpdateUserVerificationStatus RPC. + AdminServiceUpdateUserVerificationStatusProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateUserVerificationStatus" + // AdminServiceUpdateOrganizationVerificationStatusProcedure is the fully-qualified name of the + // AdminService's UpdateOrganizationVerificationStatus RPC. + AdminServiceUpdateOrganizationVerificationStatusProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateOrganizationVerificationStatus" + // AdminServiceCreateMachineUserProcedure is the fully-qualified name of the AdminService's + // CreateMachineUser RPC. + AdminServiceCreateMachineUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/CreateMachineUser" + // AdminServiceGetBreakingChangePolicyProcedure is the fully-qualified name of the AdminService's + // GetBreakingChangePolicy RPC. + AdminServiceGetBreakingChangePolicyProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/GetBreakingChangePolicy" + // AdminServiceUpdateBreakingChangePolicyProcedure is the fully-qualified name of the AdminService's + // UpdateBreakingChangePolicy RPC. + AdminServiceUpdateBreakingChangePolicyProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateBreakingChangePolicy" + // AdminServiceGetUniquenessPolicyProcedure is the fully-qualified name of the AdminService's + // GetUniquenessPolicy RPC. + AdminServiceGetUniquenessPolicyProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/GetUniquenessPolicy" + // AdminServiceUpdateUniquenessPolicyProcedure is the fully-qualified name of the AdminService's + // UpdateUniquenessPolicy RPC. + AdminServiceUpdateUniquenessPolicyProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateUniquenessPolicy" + // AdminServiceListServerUniquenessCollisionsProcedure is the fully-qualified name of the + // AdminService's ListServerUniquenessCollisions RPC. + AdminServiceListServerUniquenessCollisionsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/ListServerUniquenessCollisions" +) + +// AdminServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.AdminService +// service. +type AdminServiceClient interface { + // ForceDeleteUser forces to delete a user. Resources and organizations that are + // solely owned by the user will also be deleted. + ForceDeleteUser(context.Context, *connect_go.Request[v1alpha1.ForceDeleteUserRequest]) (*connect_go.Response[v1alpha1.ForceDeleteUserResponse], error) + // Update a user's verification status. + UpdateUserVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateUserVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateUserVerificationStatusResponse], error) + // Update a organization's verification. + UpdateOrganizationVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationVerificationStatusResponse], error) + // Create a new machine user on the server. + CreateMachineUser(context.Context, *connect_go.Request[v1alpha1.CreateMachineUserRequest]) (*connect_go.Response[v1alpha1.CreateMachineUserResponse], error) + // Get breaking change policy for the server. + GetBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.GetBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.GetBreakingChangePolicyResponse], error) + // Update breaking change policy for the server. + UpdateBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.UpdateBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.UpdateBreakingChangePolicyResponse], error) + // Get uniqueness policy for the server. + GetUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.GetUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.GetUniquenessPolicyResponse], error) + // Update uniqueness policy enforcement for the server. + UpdateUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.UpdateUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.UpdateUniquenessPolicyResponse], error) + // Get state of uniqueness collisions for the server + ListServerUniquenessCollisions(context.Context, *connect_go.Request[v1alpha1.ListServerUniquenessCollisionsRequest]) (*connect_go.Response[v1alpha1.ListServerUniquenessCollisionsResponse], error) +} + +// NewAdminServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAdminServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AdminServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &adminServiceClient{ + forceDeleteUser: connect_go.NewClient[v1alpha1.ForceDeleteUserRequest, v1alpha1.ForceDeleteUserResponse]( + httpClient, + baseURL+AdminServiceForceDeleteUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + updateUserVerificationStatus: connect_go.NewClient[v1alpha1.UpdateUserVerificationStatusRequest, v1alpha1.UpdateUserVerificationStatusResponse]( + httpClient, + baseURL+AdminServiceUpdateUserVerificationStatusProcedure, + opts..., + ), + updateOrganizationVerificationStatus: connect_go.NewClient[v1alpha1.UpdateOrganizationVerificationStatusRequest, v1alpha1.UpdateOrganizationVerificationStatusResponse]( + httpClient, + baseURL+AdminServiceUpdateOrganizationVerificationStatusProcedure, + opts..., + ), + createMachineUser: connect_go.NewClient[v1alpha1.CreateMachineUserRequest, v1alpha1.CreateMachineUserResponse]( + httpClient, + baseURL+AdminServiceCreateMachineUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getBreakingChangePolicy: connect_go.NewClient[v1alpha1.GetBreakingChangePolicyRequest, v1alpha1.GetBreakingChangePolicyResponse]( + httpClient, + baseURL+AdminServiceGetBreakingChangePolicyProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateBreakingChangePolicy: connect_go.NewClient[v1alpha1.UpdateBreakingChangePolicyRequest, v1alpha1.UpdateBreakingChangePolicyResponse]( + httpClient, + baseURL+AdminServiceUpdateBreakingChangePolicyProcedure, + opts..., + ), + getUniquenessPolicy: connect_go.NewClient[v1alpha1.GetUniquenessPolicyRequest, v1alpha1.GetUniquenessPolicyResponse]( + httpClient, + baseURL+AdminServiceGetUniquenessPolicyProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateUniquenessPolicy: connect_go.NewClient[v1alpha1.UpdateUniquenessPolicyRequest, v1alpha1.UpdateUniquenessPolicyResponse]( + httpClient, + baseURL+AdminServiceUpdateUniquenessPolicyProcedure, + opts..., + ), + listServerUniquenessCollisions: connect_go.NewClient[v1alpha1.ListServerUniquenessCollisionsRequest, v1alpha1.ListServerUniquenessCollisionsResponse]( + httpClient, + baseURL+AdminServiceListServerUniquenessCollisionsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// adminServiceClient implements AdminServiceClient. +type adminServiceClient struct { + forceDeleteUser *connect_go.Client[v1alpha1.ForceDeleteUserRequest, v1alpha1.ForceDeleteUserResponse] + updateUserVerificationStatus *connect_go.Client[v1alpha1.UpdateUserVerificationStatusRequest, v1alpha1.UpdateUserVerificationStatusResponse] + updateOrganizationVerificationStatus *connect_go.Client[v1alpha1.UpdateOrganizationVerificationStatusRequest, v1alpha1.UpdateOrganizationVerificationStatusResponse] + createMachineUser *connect_go.Client[v1alpha1.CreateMachineUserRequest, v1alpha1.CreateMachineUserResponse] + getBreakingChangePolicy *connect_go.Client[v1alpha1.GetBreakingChangePolicyRequest, v1alpha1.GetBreakingChangePolicyResponse] + updateBreakingChangePolicy *connect_go.Client[v1alpha1.UpdateBreakingChangePolicyRequest, v1alpha1.UpdateBreakingChangePolicyResponse] + getUniquenessPolicy *connect_go.Client[v1alpha1.GetUniquenessPolicyRequest, v1alpha1.GetUniquenessPolicyResponse] + updateUniquenessPolicy *connect_go.Client[v1alpha1.UpdateUniquenessPolicyRequest, v1alpha1.UpdateUniquenessPolicyResponse] + listServerUniquenessCollisions *connect_go.Client[v1alpha1.ListServerUniquenessCollisionsRequest, v1alpha1.ListServerUniquenessCollisionsResponse] +} + +// ForceDeleteUser calls bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ForceDeleteUser. +func (c *adminServiceClient) ForceDeleteUser(ctx context.Context, req *connect_go.Request[v1alpha1.ForceDeleteUserRequest]) (*connect_go.Response[v1alpha1.ForceDeleteUserResponse], error) { + return c.forceDeleteUser.CallUnary(ctx, req) +} + +// UpdateUserVerificationStatus calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUserVerificationStatus. +func (c *adminServiceClient) UpdateUserVerificationStatus(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateUserVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateUserVerificationStatusResponse], error) { + return c.updateUserVerificationStatus.CallUnary(ctx, req) +} + +// UpdateOrganizationVerificationStatus calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateOrganizationVerificationStatus. +func (c *adminServiceClient) UpdateOrganizationVerificationStatus(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateOrganizationVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationVerificationStatusResponse], error) { + return c.updateOrganizationVerificationStatus.CallUnary(ctx, req) +} + +// CreateMachineUser calls bufman.dubbo.apache.org.registry.v1alpha1.AdminService.CreateMachineUser. +func (c *adminServiceClient) CreateMachineUser(ctx context.Context, req *connect_go.Request[v1alpha1.CreateMachineUserRequest]) (*connect_go.Response[v1alpha1.CreateMachineUserResponse], error) { + return c.createMachineUser.CallUnary(ctx, req) +} + +// GetBreakingChangePolicy calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetBreakingChangePolicy. +func (c *adminServiceClient) GetBreakingChangePolicy(ctx context.Context, req *connect_go.Request[v1alpha1.GetBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.GetBreakingChangePolicyResponse], error) { + return c.getBreakingChangePolicy.CallUnary(ctx, req) +} + +// UpdateBreakingChangePolicy calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateBreakingChangePolicy. +func (c *adminServiceClient) UpdateBreakingChangePolicy(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.UpdateBreakingChangePolicyResponse], error) { + return c.updateBreakingChangePolicy.CallUnary(ctx, req) +} + +// GetUniquenessPolicy calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetUniquenessPolicy. +func (c *adminServiceClient) GetUniquenessPolicy(ctx context.Context, req *connect_go.Request[v1alpha1.GetUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.GetUniquenessPolicyResponse], error) { + return c.getUniquenessPolicy.CallUnary(ctx, req) +} + +// UpdateUniquenessPolicy calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUniquenessPolicy. +func (c *adminServiceClient) UpdateUniquenessPolicy(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.UpdateUniquenessPolicyResponse], error) { + return c.updateUniquenessPolicy.CallUnary(ctx, req) +} + +// ListServerUniquenessCollisions calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ListServerUniquenessCollisions. +func (c *adminServiceClient) ListServerUniquenessCollisions(ctx context.Context, req *connect_go.Request[v1alpha1.ListServerUniquenessCollisionsRequest]) (*connect_go.Response[v1alpha1.ListServerUniquenessCollisionsResponse], error) { + return c.listServerUniquenessCollisions.CallUnary(ctx, req) +} + +// AdminServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService service. +type AdminServiceHandler interface { + // ForceDeleteUser forces to delete a user. Resources and organizations that are + // solely owned by the user will also be deleted. + ForceDeleteUser(context.Context, *connect_go.Request[v1alpha1.ForceDeleteUserRequest]) (*connect_go.Response[v1alpha1.ForceDeleteUserResponse], error) + // Update a user's verification status. + UpdateUserVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateUserVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateUserVerificationStatusResponse], error) + // Update a organization's verification. + UpdateOrganizationVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationVerificationStatusResponse], error) + // Create a new machine user on the server. + CreateMachineUser(context.Context, *connect_go.Request[v1alpha1.CreateMachineUserRequest]) (*connect_go.Response[v1alpha1.CreateMachineUserResponse], error) + // Get breaking change policy for the server. + GetBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.GetBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.GetBreakingChangePolicyResponse], error) + // Update breaking change policy for the server. + UpdateBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.UpdateBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.UpdateBreakingChangePolicyResponse], error) + // Get uniqueness policy for the server. + GetUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.GetUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.GetUniquenessPolicyResponse], error) + // Update uniqueness policy enforcement for the server. + UpdateUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.UpdateUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.UpdateUniquenessPolicyResponse], error) + // Get state of uniqueness collisions for the server + ListServerUniquenessCollisions(context.Context, *connect_go.Request[v1alpha1.ListServerUniquenessCollisionsRequest]) (*connect_go.Response[v1alpha1.ListServerUniquenessCollisionsResponse], error) +} + +// NewAdminServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAdminServiceHandler(svc AdminServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + adminServiceForceDeleteUserHandler := connect_go.NewUnaryHandler( + AdminServiceForceDeleteUserProcedure, + svc.ForceDeleteUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + adminServiceUpdateUserVerificationStatusHandler := connect_go.NewUnaryHandler( + AdminServiceUpdateUserVerificationStatusProcedure, + svc.UpdateUserVerificationStatus, + opts..., + ) + adminServiceUpdateOrganizationVerificationStatusHandler := connect_go.NewUnaryHandler( + AdminServiceUpdateOrganizationVerificationStatusProcedure, + svc.UpdateOrganizationVerificationStatus, + opts..., + ) + adminServiceCreateMachineUserHandler := connect_go.NewUnaryHandler( + AdminServiceCreateMachineUserProcedure, + svc.CreateMachineUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + adminServiceGetBreakingChangePolicyHandler := connect_go.NewUnaryHandler( + AdminServiceGetBreakingChangePolicyProcedure, + svc.GetBreakingChangePolicy, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + adminServiceUpdateBreakingChangePolicyHandler := connect_go.NewUnaryHandler( + AdminServiceUpdateBreakingChangePolicyProcedure, + svc.UpdateBreakingChangePolicy, + opts..., + ) + adminServiceGetUniquenessPolicyHandler := connect_go.NewUnaryHandler( + AdminServiceGetUniquenessPolicyProcedure, + svc.GetUniquenessPolicy, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + adminServiceUpdateUniquenessPolicyHandler := connect_go.NewUnaryHandler( + AdminServiceUpdateUniquenessPolicyProcedure, + svc.UpdateUniquenessPolicy, + opts..., + ) + adminServiceListServerUniquenessCollisionsHandler := connect_go.NewUnaryHandler( + AdminServiceListServerUniquenessCollisionsProcedure, + svc.ListServerUniquenessCollisions, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AdminServiceForceDeleteUserProcedure: + adminServiceForceDeleteUserHandler.ServeHTTP(w, r) + case AdminServiceUpdateUserVerificationStatusProcedure: + adminServiceUpdateUserVerificationStatusHandler.ServeHTTP(w, r) + case AdminServiceUpdateOrganizationVerificationStatusProcedure: + adminServiceUpdateOrganizationVerificationStatusHandler.ServeHTTP(w, r) + case AdminServiceCreateMachineUserProcedure: + adminServiceCreateMachineUserHandler.ServeHTTP(w, r) + case AdminServiceGetBreakingChangePolicyProcedure: + adminServiceGetBreakingChangePolicyHandler.ServeHTTP(w, r) + case AdminServiceUpdateBreakingChangePolicyProcedure: + adminServiceUpdateBreakingChangePolicyHandler.ServeHTTP(w, r) + case AdminServiceGetUniquenessPolicyProcedure: + adminServiceGetUniquenessPolicyHandler.ServeHTTP(w, r) + case AdminServiceUpdateUniquenessPolicyProcedure: + adminServiceUpdateUniquenessPolicyHandler.ServeHTTP(w, r) + case AdminServiceListServerUniquenessCollisionsProcedure: + adminServiceListServerUniquenessCollisionsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAdminServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAdminServiceHandler struct{} + +func (UnimplementedAdminServiceHandler) ForceDeleteUser(context.Context, *connect_go.Request[v1alpha1.ForceDeleteUserRequest]) (*connect_go.Response[v1alpha1.ForceDeleteUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ForceDeleteUser is not implemented")) +} + +func (UnimplementedAdminServiceHandler) UpdateUserVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateUserVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateUserVerificationStatusResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUserVerificationStatus is not implemented")) +} + +func (UnimplementedAdminServiceHandler) UpdateOrganizationVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationVerificationStatusResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateOrganizationVerificationStatus is not implemented")) +} + +func (UnimplementedAdminServiceHandler) CreateMachineUser(context.Context, *connect_go.Request[v1alpha1.CreateMachineUserRequest]) (*connect_go.Response[v1alpha1.CreateMachineUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.CreateMachineUser is not implemented")) +} + +func (UnimplementedAdminServiceHandler) GetBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.GetBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.GetBreakingChangePolicyResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetBreakingChangePolicy is not implemented")) +} + +func (UnimplementedAdminServiceHandler) UpdateBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.UpdateBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.UpdateBreakingChangePolicyResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateBreakingChangePolicy is not implemented")) +} + +func (UnimplementedAdminServiceHandler) GetUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.GetUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.GetUniquenessPolicyResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetUniquenessPolicy is not implemented")) +} + +func (UnimplementedAdminServiceHandler) UpdateUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.UpdateUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.UpdateUniquenessPolicyResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUniquenessPolicy is not implemented")) +} + +func (UnimplementedAdminServiceHandler) ListServerUniquenessCollisions(context.Context, *connect_go.Request[v1alpha1.ListServerUniquenessCollisionsRequest]) (*connect_go.Response[v1alpha1.ListServerUniquenessCollisionsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ListServerUniquenessCollisions is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/authn.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/authn.connect.go new file mode 100644 index 000000000..eb96d9834 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/authn.connect.go @@ -0,0 +1,167 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/authn.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // AuthnServiceName is the fully-qualified name of the AuthnService service. + AuthnServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.AuthnService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AuthnServiceGetCurrentUserProcedure is the fully-qualified name of the AuthnService's + // GetCurrentUser RPC. + AuthnServiceGetCurrentUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthnService/GetCurrentUser" + // AuthnServiceGetCurrentUserSubjectProcedure is the fully-qualified name of the AuthnService's + // GetCurrentUserSubject RPC. + AuthnServiceGetCurrentUserSubjectProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthnService/GetCurrentUserSubject" +) + +// AuthnServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.AuthnService +// service. +type AuthnServiceClient interface { + // GetCurrentUser gets information associated with the current user. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUser(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserResponse], error) + // GetCurrentUserSubject gets the currently logged in users subject. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUserSubject(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserSubjectRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserSubjectResponse], error) +} + +// NewAuthnServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthnService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAuthnServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AuthnServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &authnServiceClient{ + getCurrentUser: connect_go.NewClient[v1alpha1.GetCurrentUserRequest, v1alpha1.GetCurrentUserResponse]( + httpClient, + baseURL+AuthnServiceGetCurrentUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getCurrentUserSubject: connect_go.NewClient[v1alpha1.GetCurrentUserSubjectRequest, v1alpha1.GetCurrentUserSubjectResponse]( + httpClient, + baseURL+AuthnServiceGetCurrentUserSubjectProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// authnServiceClient implements AuthnServiceClient. +type authnServiceClient struct { + getCurrentUser *connect_go.Client[v1alpha1.GetCurrentUserRequest, v1alpha1.GetCurrentUserResponse] + getCurrentUserSubject *connect_go.Client[v1alpha1.GetCurrentUserSubjectRequest, v1alpha1.GetCurrentUserSubjectResponse] +} + +// GetCurrentUser calls bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUser. +func (c *authnServiceClient) GetCurrentUser(ctx context.Context, req *connect_go.Request[v1alpha1.GetCurrentUserRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserResponse], error) { + return c.getCurrentUser.CallUnary(ctx, req) +} + +// GetCurrentUserSubject calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUserSubject. +func (c *authnServiceClient) GetCurrentUserSubject(ctx context.Context, req *connect_go.Request[v1alpha1.GetCurrentUserSubjectRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserSubjectResponse], error) { + return c.getCurrentUserSubject.CallUnary(ctx, req) +} + +// AuthnServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthnService service. +type AuthnServiceHandler interface { + // GetCurrentUser gets information associated with the current user. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUser(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserResponse], error) + // GetCurrentUserSubject gets the currently logged in users subject. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUserSubject(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserSubjectRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserSubjectResponse], error) +} + +// NewAuthnServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAuthnServiceHandler(svc AuthnServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + authnServiceGetCurrentUserHandler := connect_go.NewUnaryHandler( + AuthnServiceGetCurrentUserProcedure, + svc.GetCurrentUser, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authnServiceGetCurrentUserSubjectHandler := connect_go.NewUnaryHandler( + AuthnServiceGetCurrentUserSubjectProcedure, + svc.GetCurrentUserSubject, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.AuthnService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AuthnServiceGetCurrentUserProcedure: + authnServiceGetCurrentUserHandler.ServeHTTP(w, r) + case AuthnServiceGetCurrentUserSubjectProcedure: + authnServiceGetCurrentUserSubjectHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAuthnServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAuthnServiceHandler struct{} + +func (UnimplementedAuthnServiceHandler) GetCurrentUser(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUser is not implemented")) +} + +func (UnimplementedAuthnServiceHandler) GetCurrentUserSubject(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserSubjectRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserSubjectResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUserSubject is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/authz.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/authz.connect.go new file mode 100644 index 000000000..63ba51c2b --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/authz.connect.go @@ -0,0 +1,826 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/authz.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // AuthzServiceName is the fully-qualified name of the AuthzService service. + AuthzServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.AuthzService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AuthzServiceUserCanCreateOrganizationRepositoryProcedure is the fully-qualified name of the + // AuthzService's UserCanCreateOrganizationRepository RPC. + AuthzServiceUserCanCreateOrganizationRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationRepository" + // AuthzServiceUserCanSeeRepositorySettingsProcedure is the fully-qualified name of the + // AuthzService's UserCanSeeRepositorySettings RPC. + AuthzServiceUserCanSeeRepositorySettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeRepositorySettings" + // AuthzServiceUserCanSeeOrganizationSettingsProcedure is the fully-qualified name of the + // AuthzService's UserCanSeeOrganizationSettings RPC. + AuthzServiceUserCanSeeOrganizationSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeOrganizationSettings" + // AuthzServiceUserCanReadPluginProcedure is the fully-qualified name of the AuthzService's + // UserCanReadPlugin RPC. + AuthzServiceUserCanReadPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanReadPlugin" + // AuthzServiceUserCanCreatePluginVersionProcedure is the fully-qualified name of the AuthzService's + // UserCanCreatePluginVersion RPC. + AuthzServiceUserCanCreatePluginVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreatePluginVersion" + // AuthzServiceUserCanCreateTemplateVersionProcedure is the fully-qualified name of the + // AuthzService's UserCanCreateTemplateVersion RPC. + AuthzServiceUserCanCreateTemplateVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateTemplateVersion" + // AuthzServiceUserCanCreateOrganizationPluginProcedure is the fully-qualified name of the + // AuthzService's UserCanCreateOrganizationPlugin RPC. + AuthzServiceUserCanCreateOrganizationPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationPlugin" + // AuthzServiceUserCanCreateOrganizationTemplateProcedure is the fully-qualified name of the + // AuthzService's UserCanCreateOrganizationTemplate RPC. + AuthzServiceUserCanCreateOrganizationTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationTemplate" + // AuthzServiceUserCanSeePluginSettingsProcedure is the fully-qualified name of the AuthzService's + // UserCanSeePluginSettings RPC. + AuthzServiceUserCanSeePluginSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeePluginSettings" + // AuthzServiceUserCanSeeTemplateSettingsProcedure is the fully-qualified name of the AuthzService's + // UserCanSeeTemplateSettings RPC. + AuthzServiceUserCanSeeTemplateSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeTemplateSettings" + // AuthzServiceUserCanAddOrganizationMemberProcedure is the fully-qualified name of the + // AuthzService's UserCanAddOrganizationMember RPC. + AuthzServiceUserCanAddOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanAddOrganizationMember" + // AuthzServiceUserCanUpdateOrganizationMemberProcedure is the fully-qualified name of the + // AuthzService's UserCanUpdateOrganizationMember RPC. + AuthzServiceUserCanUpdateOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanUpdateOrganizationMember" + // AuthzServiceUserCanRemoveOrganizationMemberProcedure is the fully-qualified name of the + // AuthzService's UserCanRemoveOrganizationMember RPC. + AuthzServiceUserCanRemoveOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanRemoveOrganizationMember" + // AuthzServiceUserCanDeleteOrganizationProcedure is the fully-qualified name of the AuthzService's + // UserCanDeleteOrganization RPC. + AuthzServiceUserCanDeleteOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteOrganization" + // AuthzServiceUserCanDeleteRepositoryProcedure is the fully-qualified name of the AuthzService's + // UserCanDeleteRepository RPC. + AuthzServiceUserCanDeleteRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteRepository" + // AuthzServiceUserCanDeleteTemplateProcedure is the fully-qualified name of the AuthzService's + // UserCanDeleteTemplate RPC. + AuthzServiceUserCanDeleteTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteTemplate" + // AuthzServiceUserCanDeletePluginProcedure is the fully-qualified name of the AuthzService's + // UserCanDeletePlugin RPC. + AuthzServiceUserCanDeletePluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeletePlugin" + // AuthzServiceUserCanDeleteUserProcedure is the fully-qualified name of the AuthzService's + // UserCanDeleteUser RPC. + AuthzServiceUserCanDeleteUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteUser" + // AuthzServiceUserCanSeeServerAdminPanelProcedure is the fully-qualified name of the AuthzService's + // UserCanSeeServerAdminPanel RPC. + AuthzServiceUserCanSeeServerAdminPanelProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeServerAdminPanel" + // AuthzServiceUserCanManageRepositoryContributorsProcedure is the fully-qualified name of the + // AuthzService's UserCanManageRepositoryContributors RPC. + AuthzServiceUserCanManageRepositoryContributorsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanManageRepositoryContributors" +) + +// AuthzServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.AuthzService +// service. +type AuthzServiceClient interface { + // UserCanCreateOrganizationRepository returns whether the user is authorized + // to create repositories in an organization. + UserCanCreateOrganizationRepository(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationRepositoryResponse], error) + // UserCanSeeRepositorySettings returns whether the user is authorized + // to see repository settings. + UserCanSeeRepositorySettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeRepositorySettingsResponse], error) + // UserCanSeeOrganizationSettings returns whether the user is authorized + // to see organization settings. + UserCanSeeOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeOrganizationSettingsResponse], error) + // UserCanReadPlugin returns whether the user has read access to the specified plugin. + // + // Deprecated: do not use. + UserCanReadPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanReadPluginRequest]) (*connect_go.Response[v1alpha1.UserCanReadPluginResponse], error) + // UserCanCreatePluginVersion returns whether the user is authorized + // to create a plugin version under the specified plugin. + // + // Deprecated: do not use. + UserCanCreatePluginVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreatePluginVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreatePluginVersionResponse], error) + // UserCanCreateTemplateVersion returns whether the user is authorized + // to create a template version under the specified template. + // + // Deprecated: do not use. + UserCanCreateTemplateVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreateTemplateVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreateTemplateVersionResponse], error) + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a plugin in an organization. + // + // Deprecated: do not use. + UserCanCreateOrganizationPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationPluginRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationPluginResponse], error) + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a template in an organization. + // + // Deprecated: do not use. + UserCanCreateOrganizationTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationTemplateResponse], error) + // UserCanSeePluginSettings returns whether the user is authorized + // to see plugin settings. + // + // Deprecated: do not use. + UserCanSeePluginSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeePluginSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeePluginSettingsResponse], error) + // UserCanSeeTemplateSettings returns whether the user is authorized + // to see template settings. + // + // Deprecated: do not use. + UserCanSeeTemplateSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeTemplateSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeTemplateSettingsResponse], error) + // UserCanAddOrganizationMember returns whether the user is authorized to add + // any members to the organization and the list of roles they can add. + UserCanAddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanAddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanAddOrganizationMemberResponse], error) + // UserCanUpdateOrganizationMember returns whether the user is authorized to update + // any members' membership information in the organization and the list of roles they can update. + UserCanUpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanUpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanUpdateOrganizationMemberResponse], error) + // UserCanRemoveOrganizationMember returns whether the user is authorized to remove + // any members from the organization and the list of roles they can remove. + UserCanRemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanRemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanRemoveOrganizationMemberResponse], error) + // UserCanDeleteOrganization returns whether the user is authorized + // to delete an organization. + UserCanDeleteOrganization(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteOrganizationResponse], error) + // UserCanDeleteRepository returns whether the user is authorized + // to delete a repository. + UserCanDeleteRepository(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteRepositoryResponse], error) + // UserCanDeleteTemplate returns whether the user is authorized + // to delete a template. + // + // Deprecated: do not use. + UserCanDeleteTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteTemplateResponse], error) + // UserCanDeletePlugin returns whether the user is authorized + // to delete a plugin. + // + // Deprecated: do not use. + UserCanDeletePlugin(context.Context, *connect_go.Request[v1alpha1.UserCanDeletePluginRequest]) (*connect_go.Response[v1alpha1.UserCanDeletePluginResponse], error) + // UserCanDeleteUser returns whether the user is authorized + // to delete a user. + UserCanDeleteUser(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteUserRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteUserResponse], error) + // UserCanSeeServerAdminPanel returns whether the user is authorized + // to see server admin panel. + UserCanSeeServerAdminPanel(context.Context, *connect_go.Request[v1alpha1.UserCanSeeServerAdminPanelRequest]) (*connect_go.Response[v1alpha1.UserCanSeeServerAdminPanelResponse], error) + // UserCanManageRepositoryContributors returns whether the user is authorized to manage + // any contributors to the repository and the list of roles they can manage. + UserCanManageRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.UserCanManageRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.UserCanManageRepositoryContributorsResponse], error) +} + +// NewAuthzServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAuthzServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AuthzServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &authzServiceClient{ + userCanCreateOrganizationRepository: connect_go.NewClient[v1alpha1.UserCanCreateOrganizationRepositoryRequest, v1alpha1.UserCanCreateOrganizationRepositoryResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreateOrganizationRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeeRepositorySettings: connect_go.NewClient[v1alpha1.UserCanSeeRepositorySettingsRequest, v1alpha1.UserCanSeeRepositorySettingsResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeeRepositorySettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeeOrganizationSettings: connect_go.NewClient[v1alpha1.UserCanSeeOrganizationSettingsRequest, v1alpha1.UserCanSeeOrganizationSettingsResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeeOrganizationSettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanReadPlugin: connect_go.NewClient[v1alpha1.UserCanReadPluginRequest, v1alpha1.UserCanReadPluginResponse]( + httpClient, + baseURL+AuthzServiceUserCanReadPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanCreatePluginVersion: connect_go.NewClient[v1alpha1.UserCanCreatePluginVersionRequest, v1alpha1.UserCanCreatePluginVersionResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreatePluginVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanCreateTemplateVersion: connect_go.NewClient[v1alpha1.UserCanCreateTemplateVersionRequest, v1alpha1.UserCanCreateTemplateVersionResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreateTemplateVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanCreateOrganizationPlugin: connect_go.NewClient[v1alpha1.UserCanCreateOrganizationPluginRequest, v1alpha1.UserCanCreateOrganizationPluginResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreateOrganizationPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanCreateOrganizationTemplate: connect_go.NewClient[v1alpha1.UserCanCreateOrganizationTemplateRequest, v1alpha1.UserCanCreateOrganizationTemplateResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreateOrganizationTemplateProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeePluginSettings: connect_go.NewClient[v1alpha1.UserCanSeePluginSettingsRequest, v1alpha1.UserCanSeePluginSettingsResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeePluginSettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeeTemplateSettings: connect_go.NewClient[v1alpha1.UserCanSeeTemplateSettingsRequest, v1alpha1.UserCanSeeTemplateSettingsResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeeTemplateSettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanAddOrganizationMember: connect_go.NewClient[v1alpha1.UserCanAddOrganizationMemberRequest, v1alpha1.UserCanAddOrganizationMemberResponse]( + httpClient, + baseURL+AuthzServiceUserCanAddOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanUpdateOrganizationMember: connect_go.NewClient[v1alpha1.UserCanUpdateOrganizationMemberRequest, v1alpha1.UserCanUpdateOrganizationMemberResponse]( + httpClient, + baseURL+AuthzServiceUserCanUpdateOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanRemoveOrganizationMember: connect_go.NewClient[v1alpha1.UserCanRemoveOrganizationMemberRequest, v1alpha1.UserCanRemoveOrganizationMemberResponse]( + httpClient, + baseURL+AuthzServiceUserCanRemoveOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeleteOrganization: connect_go.NewClient[v1alpha1.UserCanDeleteOrganizationRequest, v1alpha1.UserCanDeleteOrganizationResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeleteOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeleteRepository: connect_go.NewClient[v1alpha1.UserCanDeleteRepositoryRequest, v1alpha1.UserCanDeleteRepositoryResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeleteRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeleteTemplate: connect_go.NewClient[v1alpha1.UserCanDeleteTemplateRequest, v1alpha1.UserCanDeleteTemplateResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeleteTemplateProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeletePlugin: connect_go.NewClient[v1alpha1.UserCanDeletePluginRequest, v1alpha1.UserCanDeletePluginResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeletePluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeleteUser: connect_go.NewClient[v1alpha1.UserCanDeleteUserRequest, v1alpha1.UserCanDeleteUserResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeleteUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeeServerAdminPanel: connect_go.NewClient[v1alpha1.UserCanSeeServerAdminPanelRequest, v1alpha1.UserCanSeeServerAdminPanelResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeeServerAdminPanelProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanManageRepositoryContributors: connect_go.NewClient[v1alpha1.UserCanManageRepositoryContributorsRequest, v1alpha1.UserCanManageRepositoryContributorsResponse]( + httpClient, + baseURL+AuthzServiceUserCanManageRepositoryContributorsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// authzServiceClient implements AuthzServiceClient. +type authzServiceClient struct { + userCanCreateOrganizationRepository *connect_go.Client[v1alpha1.UserCanCreateOrganizationRepositoryRequest, v1alpha1.UserCanCreateOrganizationRepositoryResponse] + userCanSeeRepositorySettings *connect_go.Client[v1alpha1.UserCanSeeRepositorySettingsRequest, v1alpha1.UserCanSeeRepositorySettingsResponse] + userCanSeeOrganizationSettings *connect_go.Client[v1alpha1.UserCanSeeOrganizationSettingsRequest, v1alpha1.UserCanSeeOrganizationSettingsResponse] + userCanReadPlugin *connect_go.Client[v1alpha1.UserCanReadPluginRequest, v1alpha1.UserCanReadPluginResponse] + userCanCreatePluginVersion *connect_go.Client[v1alpha1.UserCanCreatePluginVersionRequest, v1alpha1.UserCanCreatePluginVersionResponse] + userCanCreateTemplateVersion *connect_go.Client[v1alpha1.UserCanCreateTemplateVersionRequest, v1alpha1.UserCanCreateTemplateVersionResponse] + userCanCreateOrganizationPlugin *connect_go.Client[v1alpha1.UserCanCreateOrganizationPluginRequest, v1alpha1.UserCanCreateOrganizationPluginResponse] + userCanCreateOrganizationTemplate *connect_go.Client[v1alpha1.UserCanCreateOrganizationTemplateRequest, v1alpha1.UserCanCreateOrganizationTemplateResponse] + userCanSeePluginSettings *connect_go.Client[v1alpha1.UserCanSeePluginSettingsRequest, v1alpha1.UserCanSeePluginSettingsResponse] + userCanSeeTemplateSettings *connect_go.Client[v1alpha1.UserCanSeeTemplateSettingsRequest, v1alpha1.UserCanSeeTemplateSettingsResponse] + userCanAddOrganizationMember *connect_go.Client[v1alpha1.UserCanAddOrganizationMemberRequest, v1alpha1.UserCanAddOrganizationMemberResponse] + userCanUpdateOrganizationMember *connect_go.Client[v1alpha1.UserCanUpdateOrganizationMemberRequest, v1alpha1.UserCanUpdateOrganizationMemberResponse] + userCanRemoveOrganizationMember *connect_go.Client[v1alpha1.UserCanRemoveOrganizationMemberRequest, v1alpha1.UserCanRemoveOrganizationMemberResponse] + userCanDeleteOrganization *connect_go.Client[v1alpha1.UserCanDeleteOrganizationRequest, v1alpha1.UserCanDeleteOrganizationResponse] + userCanDeleteRepository *connect_go.Client[v1alpha1.UserCanDeleteRepositoryRequest, v1alpha1.UserCanDeleteRepositoryResponse] + userCanDeleteTemplate *connect_go.Client[v1alpha1.UserCanDeleteTemplateRequest, v1alpha1.UserCanDeleteTemplateResponse] + userCanDeletePlugin *connect_go.Client[v1alpha1.UserCanDeletePluginRequest, v1alpha1.UserCanDeletePluginResponse] + userCanDeleteUser *connect_go.Client[v1alpha1.UserCanDeleteUserRequest, v1alpha1.UserCanDeleteUserResponse] + userCanSeeServerAdminPanel *connect_go.Client[v1alpha1.UserCanSeeServerAdminPanelRequest, v1alpha1.UserCanSeeServerAdminPanelResponse] + userCanManageRepositoryContributors *connect_go.Client[v1alpha1.UserCanManageRepositoryContributorsRequest, v1alpha1.UserCanManageRepositoryContributorsResponse] +} + +// UserCanCreateOrganizationRepository calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationRepository. +func (c *authzServiceClient) UserCanCreateOrganizationRepository(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreateOrganizationRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationRepositoryResponse], error) { + return c.userCanCreateOrganizationRepository.CallUnary(ctx, req) +} + +// UserCanSeeRepositorySettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeRepositorySettings. +func (c *authzServiceClient) UserCanSeeRepositorySettings(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeeRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeRepositorySettingsResponse], error) { + return c.userCanSeeRepositorySettings.CallUnary(ctx, req) +} + +// UserCanSeeOrganizationSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeOrganizationSettings. +func (c *authzServiceClient) UserCanSeeOrganizationSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeeOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeOrganizationSettingsResponse], error) { + return c.userCanSeeOrganizationSettings.CallUnary(ctx, req) +} + +// UserCanReadPlugin calls bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanReadPlugin. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanReadPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanReadPluginRequest]) (*connect_go.Response[v1alpha1.UserCanReadPluginResponse], error) { + return c.userCanReadPlugin.CallUnary(ctx, req) +} + +// UserCanCreatePluginVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreatePluginVersion. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanCreatePluginVersion(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreatePluginVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreatePluginVersionResponse], error) { + return c.userCanCreatePluginVersion.CallUnary(ctx, req) +} + +// UserCanCreateTemplateVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateTemplateVersion. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanCreateTemplateVersion(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreateTemplateVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreateTemplateVersionResponse], error) { + return c.userCanCreateTemplateVersion.CallUnary(ctx, req) +} + +// UserCanCreateOrganizationPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationPlugin. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanCreateOrganizationPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreateOrganizationPluginRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationPluginResponse], error) { + return c.userCanCreateOrganizationPlugin.CallUnary(ctx, req) +} + +// UserCanCreateOrganizationTemplate calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationTemplate. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanCreateOrganizationTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreateOrganizationTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationTemplateResponse], error) { + return c.userCanCreateOrganizationTemplate.CallUnary(ctx, req) +} + +// UserCanSeePluginSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeePluginSettings. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanSeePluginSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeePluginSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeePluginSettingsResponse], error) { + return c.userCanSeePluginSettings.CallUnary(ctx, req) +} + +// UserCanSeeTemplateSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeTemplateSettings. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanSeeTemplateSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeeTemplateSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeTemplateSettingsResponse], error) { + return c.userCanSeeTemplateSettings.CallUnary(ctx, req) +} + +// UserCanAddOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanAddOrganizationMember. +func (c *authzServiceClient) UserCanAddOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanAddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanAddOrganizationMemberResponse], error) { + return c.userCanAddOrganizationMember.CallUnary(ctx, req) +} + +// UserCanUpdateOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanUpdateOrganizationMember. +func (c *authzServiceClient) UserCanUpdateOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanUpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanUpdateOrganizationMemberResponse], error) { + return c.userCanUpdateOrganizationMember.CallUnary(ctx, req) +} + +// UserCanRemoveOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanRemoveOrganizationMember. +func (c *authzServiceClient) UserCanRemoveOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanRemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanRemoveOrganizationMemberResponse], error) { + return c.userCanRemoveOrganizationMember.CallUnary(ctx, req) +} + +// UserCanDeleteOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteOrganization. +func (c *authzServiceClient) UserCanDeleteOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteOrganizationResponse], error) { + return c.userCanDeleteOrganization.CallUnary(ctx, req) +} + +// UserCanDeleteRepository calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteRepository. +func (c *authzServiceClient) UserCanDeleteRepository(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteRepositoryResponse], error) { + return c.userCanDeleteRepository.CallUnary(ctx, req) +} + +// UserCanDeleteTemplate calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteTemplate. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanDeleteTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeleteTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteTemplateResponse], error) { + return c.userCanDeleteTemplate.CallUnary(ctx, req) +} + +// UserCanDeletePlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeletePlugin. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanDeletePlugin(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeletePluginRequest]) (*connect_go.Response[v1alpha1.UserCanDeletePluginResponse], error) { + return c.userCanDeletePlugin.CallUnary(ctx, req) +} + +// UserCanDeleteUser calls bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteUser. +func (c *authzServiceClient) UserCanDeleteUser(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeleteUserRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteUserResponse], error) { + return c.userCanDeleteUser.CallUnary(ctx, req) +} + +// UserCanSeeServerAdminPanel calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeServerAdminPanel. +func (c *authzServiceClient) UserCanSeeServerAdminPanel(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeeServerAdminPanelRequest]) (*connect_go.Response[v1alpha1.UserCanSeeServerAdminPanelResponse], error) { + return c.userCanSeeServerAdminPanel.CallUnary(ctx, req) +} + +// UserCanManageRepositoryContributors calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanManageRepositoryContributors. +func (c *authzServiceClient) UserCanManageRepositoryContributors(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanManageRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.UserCanManageRepositoryContributorsResponse], error) { + return c.userCanManageRepositoryContributors.CallUnary(ctx, req) +} + +// AuthzServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService service. +type AuthzServiceHandler interface { + // UserCanCreateOrganizationRepository returns whether the user is authorized + // to create repositories in an organization. + UserCanCreateOrganizationRepository(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationRepositoryResponse], error) + // UserCanSeeRepositorySettings returns whether the user is authorized + // to see repository settings. + UserCanSeeRepositorySettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeRepositorySettingsResponse], error) + // UserCanSeeOrganizationSettings returns whether the user is authorized + // to see organization settings. + UserCanSeeOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeOrganizationSettingsResponse], error) + // UserCanReadPlugin returns whether the user has read access to the specified plugin. + // + // Deprecated: do not use. + UserCanReadPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanReadPluginRequest]) (*connect_go.Response[v1alpha1.UserCanReadPluginResponse], error) + // UserCanCreatePluginVersion returns whether the user is authorized + // to create a plugin version under the specified plugin. + // + // Deprecated: do not use. + UserCanCreatePluginVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreatePluginVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreatePluginVersionResponse], error) + // UserCanCreateTemplateVersion returns whether the user is authorized + // to create a template version under the specified template. + // + // Deprecated: do not use. + UserCanCreateTemplateVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreateTemplateVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreateTemplateVersionResponse], error) + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a plugin in an organization. + // + // Deprecated: do not use. + UserCanCreateOrganizationPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationPluginRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationPluginResponse], error) + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a template in an organization. + // + // Deprecated: do not use. + UserCanCreateOrganizationTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationTemplateResponse], error) + // UserCanSeePluginSettings returns whether the user is authorized + // to see plugin settings. + // + // Deprecated: do not use. + UserCanSeePluginSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeePluginSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeePluginSettingsResponse], error) + // UserCanSeeTemplateSettings returns whether the user is authorized + // to see template settings. + // + // Deprecated: do not use. + UserCanSeeTemplateSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeTemplateSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeTemplateSettingsResponse], error) + // UserCanAddOrganizationMember returns whether the user is authorized to add + // any members to the organization and the list of roles they can add. + UserCanAddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanAddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanAddOrganizationMemberResponse], error) + // UserCanUpdateOrganizationMember returns whether the user is authorized to update + // any members' membership information in the organization and the list of roles they can update. + UserCanUpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanUpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanUpdateOrganizationMemberResponse], error) + // UserCanRemoveOrganizationMember returns whether the user is authorized to remove + // any members from the organization and the list of roles they can remove. + UserCanRemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanRemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanRemoveOrganizationMemberResponse], error) + // UserCanDeleteOrganization returns whether the user is authorized + // to delete an organization. + UserCanDeleteOrganization(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteOrganizationResponse], error) + // UserCanDeleteRepository returns whether the user is authorized + // to delete a repository. + UserCanDeleteRepository(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteRepositoryResponse], error) + // UserCanDeleteTemplate returns whether the user is authorized + // to delete a template. + // + // Deprecated: do not use. + UserCanDeleteTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteTemplateResponse], error) + // UserCanDeletePlugin returns whether the user is authorized + // to delete a plugin. + // + // Deprecated: do not use. + UserCanDeletePlugin(context.Context, *connect_go.Request[v1alpha1.UserCanDeletePluginRequest]) (*connect_go.Response[v1alpha1.UserCanDeletePluginResponse], error) + // UserCanDeleteUser returns whether the user is authorized + // to delete a user. + UserCanDeleteUser(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteUserRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteUserResponse], error) + // UserCanSeeServerAdminPanel returns whether the user is authorized + // to see server admin panel. + UserCanSeeServerAdminPanel(context.Context, *connect_go.Request[v1alpha1.UserCanSeeServerAdminPanelRequest]) (*connect_go.Response[v1alpha1.UserCanSeeServerAdminPanelResponse], error) + // UserCanManageRepositoryContributors returns whether the user is authorized to manage + // any contributors to the repository and the list of roles they can manage. + UserCanManageRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.UserCanManageRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.UserCanManageRepositoryContributorsResponse], error) +} + +// NewAuthzServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAuthzServiceHandler(svc AuthzServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + authzServiceUserCanCreateOrganizationRepositoryHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreateOrganizationRepositoryProcedure, + svc.UserCanCreateOrganizationRepository, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeeRepositorySettingsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeeRepositorySettingsProcedure, + svc.UserCanSeeRepositorySettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeeOrganizationSettingsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeeOrganizationSettingsProcedure, + svc.UserCanSeeOrganizationSettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanReadPluginHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanReadPluginProcedure, + svc.UserCanReadPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanCreatePluginVersionHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreatePluginVersionProcedure, + svc.UserCanCreatePluginVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanCreateTemplateVersionHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreateTemplateVersionProcedure, + svc.UserCanCreateTemplateVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanCreateOrganizationPluginHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreateOrganizationPluginProcedure, + svc.UserCanCreateOrganizationPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanCreateOrganizationTemplateHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreateOrganizationTemplateProcedure, + svc.UserCanCreateOrganizationTemplate, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeePluginSettingsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeePluginSettingsProcedure, + svc.UserCanSeePluginSettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeeTemplateSettingsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeeTemplateSettingsProcedure, + svc.UserCanSeeTemplateSettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanAddOrganizationMemberHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanAddOrganizationMemberProcedure, + svc.UserCanAddOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanUpdateOrganizationMemberHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanUpdateOrganizationMemberProcedure, + svc.UserCanUpdateOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanRemoveOrganizationMemberHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanRemoveOrganizationMemberProcedure, + svc.UserCanRemoveOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeleteOrganizationHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeleteOrganizationProcedure, + svc.UserCanDeleteOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeleteRepositoryHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeleteRepositoryProcedure, + svc.UserCanDeleteRepository, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeleteTemplateHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeleteTemplateProcedure, + svc.UserCanDeleteTemplate, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeletePluginHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeletePluginProcedure, + svc.UserCanDeletePlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeleteUserHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeleteUserProcedure, + svc.UserCanDeleteUser, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeeServerAdminPanelHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeeServerAdminPanelProcedure, + svc.UserCanSeeServerAdminPanel, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanManageRepositoryContributorsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanManageRepositoryContributorsProcedure, + svc.UserCanManageRepositoryContributors, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AuthzServiceUserCanCreateOrganizationRepositoryProcedure: + authzServiceUserCanCreateOrganizationRepositoryHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeeRepositorySettingsProcedure: + authzServiceUserCanSeeRepositorySettingsHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeeOrganizationSettingsProcedure: + authzServiceUserCanSeeOrganizationSettingsHandler.ServeHTTP(w, r) + case AuthzServiceUserCanReadPluginProcedure: + authzServiceUserCanReadPluginHandler.ServeHTTP(w, r) + case AuthzServiceUserCanCreatePluginVersionProcedure: + authzServiceUserCanCreatePluginVersionHandler.ServeHTTP(w, r) + case AuthzServiceUserCanCreateTemplateVersionProcedure: + authzServiceUserCanCreateTemplateVersionHandler.ServeHTTP(w, r) + case AuthzServiceUserCanCreateOrganizationPluginProcedure: + authzServiceUserCanCreateOrganizationPluginHandler.ServeHTTP(w, r) + case AuthzServiceUserCanCreateOrganizationTemplateProcedure: + authzServiceUserCanCreateOrganizationTemplateHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeePluginSettingsProcedure: + authzServiceUserCanSeePluginSettingsHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeeTemplateSettingsProcedure: + authzServiceUserCanSeeTemplateSettingsHandler.ServeHTTP(w, r) + case AuthzServiceUserCanAddOrganizationMemberProcedure: + authzServiceUserCanAddOrganizationMemberHandler.ServeHTTP(w, r) + case AuthzServiceUserCanUpdateOrganizationMemberProcedure: + authzServiceUserCanUpdateOrganizationMemberHandler.ServeHTTP(w, r) + case AuthzServiceUserCanRemoveOrganizationMemberProcedure: + authzServiceUserCanRemoveOrganizationMemberHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeleteOrganizationProcedure: + authzServiceUserCanDeleteOrganizationHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeleteRepositoryProcedure: + authzServiceUserCanDeleteRepositoryHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeleteTemplateProcedure: + authzServiceUserCanDeleteTemplateHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeletePluginProcedure: + authzServiceUserCanDeletePluginHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeleteUserProcedure: + authzServiceUserCanDeleteUserHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeeServerAdminPanelProcedure: + authzServiceUserCanSeeServerAdminPanelHandler.ServeHTTP(w, r) + case AuthzServiceUserCanManageRepositoryContributorsProcedure: + authzServiceUserCanManageRepositoryContributorsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAuthzServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAuthzServiceHandler struct{} + +func (UnimplementedAuthzServiceHandler) UserCanCreateOrganizationRepository(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationRepository is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeeRepositorySettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeRepositorySettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeRepositorySettings is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeeOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeOrganizationSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeOrganizationSettings is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanReadPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanReadPluginRequest]) (*connect_go.Response[v1alpha1.UserCanReadPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanReadPlugin is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanCreatePluginVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreatePluginVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreatePluginVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreatePluginVersion is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanCreateTemplateVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreateTemplateVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreateTemplateVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateTemplateVersion is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanCreateOrganizationPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationPluginRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationPlugin is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanCreateOrganizationTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationTemplate is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeePluginSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeePluginSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeePluginSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeePluginSettings is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeeTemplateSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeTemplateSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeTemplateSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeTemplateSettings is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanAddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanAddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanAddOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanAddOrganizationMember is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanUpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanUpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanUpdateOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanUpdateOrganizationMember is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanRemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanRemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanRemoveOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanRemoveOrganizationMember is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeleteOrganization(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteOrganization is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeleteRepository(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteRepository is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeleteTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteTemplate is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeletePlugin(context.Context, *connect_go.Request[v1alpha1.UserCanDeletePluginRequest]) (*connect_go.Response[v1alpha1.UserCanDeletePluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeletePlugin is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeleteUser(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteUserRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteUser is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeeServerAdminPanel(context.Context, *connect_go.Request[v1alpha1.UserCanSeeServerAdminPanelRequest]) (*connect_go.Response[v1alpha1.UserCanSeeServerAdminPanelResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeServerAdminPanel is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanManageRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.UserCanManageRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.UserCanManageRepositoryContributorsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanManageRepositoryContributors is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/convert.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/convert.connect.go new file mode 100644 index 000000000..851128b5c --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/convert.connect.go @@ -0,0 +1,126 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/convert.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // ConvertServiceName is the fully-qualified name of the ConvertService service. + ConvertServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ConvertService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ConvertServiceConvertProcedure is the fully-qualified name of the ConvertService's Convert RPC. + ConvertServiceConvertProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ConvertService/Convert" +) + +// ConvertServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.ConvertService +// service. +type ConvertServiceClient interface { + // Convert converts a serialized message according to + // the provided type name using an image. + Convert(context.Context, *connect_go.Request[v1alpha1.ConvertRequest]) (*connect_go.Response[v1alpha1.ConvertResponse], error) +} + +// NewConvertServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ConvertService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewConvertServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ConvertServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &convertServiceClient{ + convert: connect_go.NewClient[v1alpha1.ConvertRequest, v1alpha1.ConvertResponse]( + httpClient, + baseURL+ConvertServiceConvertProcedure, + opts..., + ), + } +} + +// convertServiceClient implements ConvertServiceClient. +type convertServiceClient struct { + convert *connect_go.Client[v1alpha1.ConvertRequest, v1alpha1.ConvertResponse] +} + +// Convert calls bufman.dubbo.apache.org.registry.v1alpha1.ConvertService.Convert. +func (c *convertServiceClient) Convert(ctx context.Context, req *connect_go.Request[v1alpha1.ConvertRequest]) (*connect_go.Response[v1alpha1.ConvertResponse], error) { + return c.convert.CallUnary(ctx, req) +} + +// ConvertServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ConvertService service. +type ConvertServiceHandler interface { + // Convert converts a serialized message according to + // the provided type name using an image. + Convert(context.Context, *connect_go.Request[v1alpha1.ConvertRequest]) (*connect_go.Response[v1alpha1.ConvertResponse], error) +} + +// NewConvertServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewConvertServiceHandler(svc ConvertServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + convertServiceConvertHandler := connect_go.NewUnaryHandler( + ConvertServiceConvertProcedure, + svc.Convert, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ConvertService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ConvertServiceConvertProcedure: + convertServiceConvertHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedConvertServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedConvertServiceHandler struct{} + +func (UnimplementedConvertServiceHandler) Convert(context.Context, *connect_go.Request[v1alpha1.ConvertRequest]) (*connect_go.Response[v1alpha1.ConvertResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ConvertService.Convert is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/display.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/display.connect.go new file mode 100644 index 000000000..a25af0931 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/display.connect.go @@ -0,0 +1,356 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/display.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // DisplayServiceName is the fully-qualified name of the DisplayService service. + DisplayServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.DisplayService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DisplayServiceDisplayOrganizationElementsProcedure is the fully-qualified name of the + // DisplayService's DisplayOrganizationElements RPC. + DisplayServiceDisplayOrganizationElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayOrganizationElements" + // DisplayServiceDisplayRepositoryElementsProcedure is the fully-qualified name of the + // DisplayService's DisplayRepositoryElements RPC. + DisplayServiceDisplayRepositoryElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayRepositoryElements" + // DisplayServiceDisplayUserElementsProcedure is the fully-qualified name of the DisplayService's + // DisplayUserElements RPC. + DisplayServiceDisplayUserElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayUserElements" + // DisplayServiceDisplayServerElementsProcedure is the fully-qualified name of the DisplayService's + // DisplayServerElements RPC. + DisplayServiceDisplayServerElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayServerElements" + // DisplayServiceDisplayOwnerEntitledElementsProcedure is the fully-qualified name of the + // DisplayService's DisplayOwnerEntitledElements RPC. + DisplayServiceDisplayOwnerEntitledElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayOwnerEntitledElements" + // DisplayServiceDisplayRepositoryEntitledElementsProcedure is the fully-qualified name of the + // DisplayService's DisplayRepositoryEntitledElements RPC. + DisplayServiceDisplayRepositoryEntitledElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayRepositoryEntitledElements" + // DisplayServiceListManageableRepositoryRolesProcedure is the fully-qualified name of the + // DisplayService's ListManageableRepositoryRoles RPC. + DisplayServiceListManageableRepositoryRolesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/ListManageableRepositoryRoles" + // DisplayServiceListManageableUserRepositoryRolesProcedure is the fully-qualified name of the + // DisplayService's ListManageableUserRepositoryRoles RPC. + DisplayServiceListManageableUserRepositoryRolesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/ListManageableUserRepositoryRoles" +) + +// DisplayServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.DisplayService +// service. +type DisplayServiceClient interface { + // DisplayOrganizationElements returns which organization elements should be displayed to the user. + DisplayOrganizationElements(context.Context, *connect_go.Request[v1alpha1.DisplayOrganizationElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOrganizationElementsResponse], error) + // DisplayRepositoryElements returns which repository elements should be displayed to the user. + DisplayRepositoryElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryElementsResponse], error) + // DisplayUserElements returns which user elements should be displayed to the user. + DisplayUserElements(context.Context, *connect_go.Request[v1alpha1.DisplayUserElementsRequest]) (*connect_go.Response[v1alpha1.DisplayUserElementsResponse], error) + // DisplayServerElements returns which server elements should be displayed to the user. + DisplayServerElements(context.Context, *connect_go.Request[v1alpha1.DisplayServerElementsRequest]) (*connect_go.Response[v1alpha1.DisplayServerElementsResponse], error) + // DisplayOwnerEntitledElements returns which owner elements are entitled to be displayed to the user. + DisplayOwnerEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayOwnerEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOwnerEntitledElementsResponse], error) + // DisplayRepositoryEntitledElements returns which repository elements are entitled to be displayed to the user. + DisplayRepositoryEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryEntitledElementsResponse], error) + // ListManageableRepositoryRoles returns which roles should be displayed + // to the user when they are managing contributors on the repository. + ListManageableRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableRepositoryRolesResponse], error) + // ListManageableUserRepositoryRoles returns which roles should be displayed + // to the user when they are managing a specific contributor on the repository. + ListManageableUserRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableUserRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableUserRepositoryRolesResponse], error) +} + +// NewDisplayServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDisplayServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DisplayServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &displayServiceClient{ + displayOrganizationElements: connect_go.NewClient[v1alpha1.DisplayOrganizationElementsRequest, v1alpha1.DisplayOrganizationElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayOrganizationElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayRepositoryElements: connect_go.NewClient[v1alpha1.DisplayRepositoryElementsRequest, v1alpha1.DisplayRepositoryElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayRepositoryElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayUserElements: connect_go.NewClient[v1alpha1.DisplayUserElementsRequest, v1alpha1.DisplayUserElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayUserElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayServerElements: connect_go.NewClient[v1alpha1.DisplayServerElementsRequest, v1alpha1.DisplayServerElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayServerElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayOwnerEntitledElements: connect_go.NewClient[v1alpha1.DisplayOwnerEntitledElementsRequest, v1alpha1.DisplayOwnerEntitledElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayOwnerEntitledElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayRepositoryEntitledElements: connect_go.NewClient[v1alpha1.DisplayRepositoryEntitledElementsRequest, v1alpha1.DisplayRepositoryEntitledElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayRepositoryEntitledElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listManageableRepositoryRoles: connect_go.NewClient[v1alpha1.ListManageableRepositoryRolesRequest, v1alpha1.ListManageableRepositoryRolesResponse]( + httpClient, + baseURL+DisplayServiceListManageableRepositoryRolesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listManageableUserRepositoryRoles: connect_go.NewClient[v1alpha1.ListManageableUserRepositoryRolesRequest, v1alpha1.ListManageableUserRepositoryRolesResponse]( + httpClient, + baseURL+DisplayServiceListManageableUserRepositoryRolesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// displayServiceClient implements DisplayServiceClient. +type displayServiceClient struct { + displayOrganizationElements *connect_go.Client[v1alpha1.DisplayOrganizationElementsRequest, v1alpha1.DisplayOrganizationElementsResponse] + displayRepositoryElements *connect_go.Client[v1alpha1.DisplayRepositoryElementsRequest, v1alpha1.DisplayRepositoryElementsResponse] + displayUserElements *connect_go.Client[v1alpha1.DisplayUserElementsRequest, v1alpha1.DisplayUserElementsResponse] + displayServerElements *connect_go.Client[v1alpha1.DisplayServerElementsRequest, v1alpha1.DisplayServerElementsResponse] + displayOwnerEntitledElements *connect_go.Client[v1alpha1.DisplayOwnerEntitledElementsRequest, v1alpha1.DisplayOwnerEntitledElementsResponse] + displayRepositoryEntitledElements *connect_go.Client[v1alpha1.DisplayRepositoryEntitledElementsRequest, v1alpha1.DisplayRepositoryEntitledElementsResponse] + listManageableRepositoryRoles *connect_go.Client[v1alpha1.ListManageableRepositoryRolesRequest, v1alpha1.ListManageableRepositoryRolesResponse] + listManageableUserRepositoryRoles *connect_go.Client[v1alpha1.ListManageableUserRepositoryRolesRequest, v1alpha1.ListManageableUserRepositoryRolesResponse] +} + +// DisplayOrganizationElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOrganizationElements. +func (c *displayServiceClient) DisplayOrganizationElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayOrganizationElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOrganizationElementsResponse], error) { + return c.displayOrganizationElements.CallUnary(ctx, req) +} + +// DisplayRepositoryElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryElements. +func (c *displayServiceClient) DisplayRepositoryElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayRepositoryElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryElementsResponse], error) { + return c.displayRepositoryElements.CallUnary(ctx, req) +} + +// DisplayUserElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayUserElements. +func (c *displayServiceClient) DisplayUserElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayUserElementsRequest]) (*connect_go.Response[v1alpha1.DisplayUserElementsResponse], error) { + return c.displayUserElements.CallUnary(ctx, req) +} + +// DisplayServerElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayServerElements. +func (c *displayServiceClient) DisplayServerElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayServerElementsRequest]) (*connect_go.Response[v1alpha1.DisplayServerElementsResponse], error) { + return c.displayServerElements.CallUnary(ctx, req) +} + +// DisplayOwnerEntitledElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOwnerEntitledElements. +func (c *displayServiceClient) DisplayOwnerEntitledElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayOwnerEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOwnerEntitledElementsResponse], error) { + return c.displayOwnerEntitledElements.CallUnary(ctx, req) +} + +// DisplayRepositoryEntitledElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryEntitledElements. +func (c *displayServiceClient) DisplayRepositoryEntitledElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayRepositoryEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryEntitledElementsResponse], error) { + return c.displayRepositoryEntitledElements.CallUnary(ctx, req) +} + +// ListManageableRepositoryRoles calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableRepositoryRoles. +func (c *displayServiceClient) ListManageableRepositoryRoles(ctx context.Context, req *connect_go.Request[v1alpha1.ListManageableRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableRepositoryRolesResponse], error) { + return c.listManageableRepositoryRoles.CallUnary(ctx, req) +} + +// ListManageableUserRepositoryRoles calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableUserRepositoryRoles. +func (c *displayServiceClient) ListManageableUserRepositoryRoles(ctx context.Context, req *connect_go.Request[v1alpha1.ListManageableUserRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableUserRepositoryRolesResponse], error) { + return c.listManageableUserRepositoryRoles.CallUnary(ctx, req) +} + +// DisplayServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService service. +type DisplayServiceHandler interface { + // DisplayOrganizationElements returns which organization elements should be displayed to the user. + DisplayOrganizationElements(context.Context, *connect_go.Request[v1alpha1.DisplayOrganizationElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOrganizationElementsResponse], error) + // DisplayRepositoryElements returns which repository elements should be displayed to the user. + DisplayRepositoryElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryElementsResponse], error) + // DisplayUserElements returns which user elements should be displayed to the user. + DisplayUserElements(context.Context, *connect_go.Request[v1alpha1.DisplayUserElementsRequest]) (*connect_go.Response[v1alpha1.DisplayUserElementsResponse], error) + // DisplayServerElements returns which server elements should be displayed to the user. + DisplayServerElements(context.Context, *connect_go.Request[v1alpha1.DisplayServerElementsRequest]) (*connect_go.Response[v1alpha1.DisplayServerElementsResponse], error) + // DisplayOwnerEntitledElements returns which owner elements are entitled to be displayed to the user. + DisplayOwnerEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayOwnerEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOwnerEntitledElementsResponse], error) + // DisplayRepositoryEntitledElements returns which repository elements are entitled to be displayed to the user. + DisplayRepositoryEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryEntitledElementsResponse], error) + // ListManageableRepositoryRoles returns which roles should be displayed + // to the user when they are managing contributors on the repository. + ListManageableRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableRepositoryRolesResponse], error) + // ListManageableUserRepositoryRoles returns which roles should be displayed + // to the user when they are managing a specific contributor on the repository. + ListManageableUserRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableUserRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableUserRepositoryRolesResponse], error) +} + +// NewDisplayServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDisplayServiceHandler(svc DisplayServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + displayServiceDisplayOrganizationElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayOrganizationElementsProcedure, + svc.DisplayOrganizationElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayRepositoryElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayRepositoryElementsProcedure, + svc.DisplayRepositoryElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayUserElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayUserElementsProcedure, + svc.DisplayUserElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayServerElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayServerElementsProcedure, + svc.DisplayServerElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayOwnerEntitledElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayOwnerEntitledElementsProcedure, + svc.DisplayOwnerEntitledElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayRepositoryEntitledElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayRepositoryEntitledElementsProcedure, + svc.DisplayRepositoryEntitledElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceListManageableRepositoryRolesHandler := connect_go.NewUnaryHandler( + DisplayServiceListManageableRepositoryRolesProcedure, + svc.ListManageableRepositoryRoles, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceListManageableUserRepositoryRolesHandler := connect_go.NewUnaryHandler( + DisplayServiceListManageableUserRepositoryRolesProcedure, + svc.ListManageableUserRepositoryRoles, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DisplayServiceDisplayOrganizationElementsProcedure: + displayServiceDisplayOrganizationElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayRepositoryElementsProcedure: + displayServiceDisplayRepositoryElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayUserElementsProcedure: + displayServiceDisplayUserElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayServerElementsProcedure: + displayServiceDisplayServerElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayOwnerEntitledElementsProcedure: + displayServiceDisplayOwnerEntitledElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayRepositoryEntitledElementsProcedure: + displayServiceDisplayRepositoryEntitledElementsHandler.ServeHTTP(w, r) + case DisplayServiceListManageableRepositoryRolesProcedure: + displayServiceListManageableRepositoryRolesHandler.ServeHTTP(w, r) + case DisplayServiceListManageableUserRepositoryRolesProcedure: + displayServiceListManageableUserRepositoryRolesHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDisplayServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDisplayServiceHandler struct{} + +func (UnimplementedDisplayServiceHandler) DisplayOrganizationElements(context.Context, *connect_go.Request[v1alpha1.DisplayOrganizationElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOrganizationElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOrganizationElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayRepositoryElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayUserElements(context.Context, *connect_go.Request[v1alpha1.DisplayUserElementsRequest]) (*connect_go.Response[v1alpha1.DisplayUserElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayUserElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayServerElements(context.Context, *connect_go.Request[v1alpha1.DisplayServerElementsRequest]) (*connect_go.Response[v1alpha1.DisplayServerElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayServerElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayOwnerEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayOwnerEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOwnerEntitledElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOwnerEntitledElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayRepositoryEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryEntitledElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryEntitledElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) ListManageableRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableRepositoryRolesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableRepositoryRoles is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) ListManageableUserRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableUserRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableUserRepositoryRolesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableUserRepositoryRoles is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/doc.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/doc.connect.go new file mode 100644 index 000000000..1cd96ffbf --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/doc.connect.go @@ -0,0 +1,270 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/doc.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // DocServiceName is the fully-qualified name of the DocService service. + DocServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.DocService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DocServiceGetSourceDirectoryInfoProcedure is the fully-qualified name of the DocService's + // GetSourceDirectoryInfo RPC. + DocServiceGetSourceDirectoryInfoProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetSourceDirectoryInfo" + // DocServiceGetSourceFileProcedure is the fully-qualified name of the DocService's GetSourceFile + // RPC. + DocServiceGetSourceFileProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetSourceFile" + // DocServiceGetModulePackagesProcedure is the fully-qualified name of the DocService's + // GetModulePackages RPC. + DocServiceGetModulePackagesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetModulePackages" + // DocServiceGetModuleDocumentationProcedure is the fully-qualified name of the DocService's + // GetModuleDocumentation RPC. + DocServiceGetModuleDocumentationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetModuleDocumentation" + // DocServiceGetPackageDocumentationProcedure is the fully-qualified name of the DocService's + // GetPackageDocumentation RPC. + DocServiceGetPackageDocumentationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetPackageDocumentation" +) + +// DocServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.DocService +// service. +type DocServiceClient interface { + // GetSourceDirectoryInfo retrieves the directory and file structure for the + // given owner, repository and reference. + // + // The purpose of this is to get a representation of the file tree for a given + // module to enable exploring the module by navigating through its contents. + GetSourceDirectoryInfo(context.Context, *connect_go.Request[v1alpha1.GetSourceDirectoryInfoRequest]) (*connect_go.Response[v1alpha1.GetSourceDirectoryInfoResponse], error) + // GetSourceFile retrieves the source contents for the given owner, repository, + // reference, and path. + GetSourceFile(context.Context, *connect_go.Request[v1alpha1.GetSourceFileRequest]) (*connect_go.Response[v1alpha1.GetSourceFileResponse], error) + // GetModulePackages retrieves the list of packages for the module based on the given + // owner, repository, and reference. + GetModulePackages(context.Context, *connect_go.Request[v1alpha1.GetModulePackagesRequest]) (*connect_go.Response[v1alpha1.GetModulePackagesResponse], error) + // GetModuleDocumentation retrieves the documentations including buf.md and LICENSE files + // for module based on the given owner, repository, and reference. + GetModuleDocumentation(context.Context, *connect_go.Request[v1alpha1.GetModuleDocumentationRequest]) (*connect_go.Response[v1alpha1.GetModuleDocumentationResponse], error) + // GetPackageDocumentation retrieves a a slice of documentation structures + // for the given owner, repository, reference, and package name. + GetPackageDocumentation(context.Context, *connect_go.Request[v1alpha1.GetPackageDocumentationRequest]) (*connect_go.Response[v1alpha1.GetPackageDocumentationResponse], error) +} + +// NewDocServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DocService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDocServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DocServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &docServiceClient{ + getSourceDirectoryInfo: connect_go.NewClient[v1alpha1.GetSourceDirectoryInfoRequest, v1alpha1.GetSourceDirectoryInfoResponse]( + httpClient, + baseURL+DocServiceGetSourceDirectoryInfoProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getSourceFile: connect_go.NewClient[v1alpha1.GetSourceFileRequest, v1alpha1.GetSourceFileResponse]( + httpClient, + baseURL+DocServiceGetSourceFileProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getModulePackages: connect_go.NewClient[v1alpha1.GetModulePackagesRequest, v1alpha1.GetModulePackagesResponse]( + httpClient, + baseURL+DocServiceGetModulePackagesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getModuleDocumentation: connect_go.NewClient[v1alpha1.GetModuleDocumentationRequest, v1alpha1.GetModuleDocumentationResponse]( + httpClient, + baseURL+DocServiceGetModuleDocumentationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getPackageDocumentation: connect_go.NewClient[v1alpha1.GetPackageDocumentationRequest, v1alpha1.GetPackageDocumentationResponse]( + httpClient, + baseURL+DocServiceGetPackageDocumentationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// docServiceClient implements DocServiceClient. +type docServiceClient struct { + getSourceDirectoryInfo *connect_go.Client[v1alpha1.GetSourceDirectoryInfoRequest, v1alpha1.GetSourceDirectoryInfoResponse] + getSourceFile *connect_go.Client[v1alpha1.GetSourceFileRequest, v1alpha1.GetSourceFileResponse] + getModulePackages *connect_go.Client[v1alpha1.GetModulePackagesRequest, v1alpha1.GetModulePackagesResponse] + getModuleDocumentation *connect_go.Client[v1alpha1.GetModuleDocumentationRequest, v1alpha1.GetModuleDocumentationResponse] + getPackageDocumentation *connect_go.Client[v1alpha1.GetPackageDocumentationRequest, v1alpha1.GetPackageDocumentationResponse] +} + +// GetSourceDirectoryInfo calls +// bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceDirectoryInfo. +func (c *docServiceClient) GetSourceDirectoryInfo(ctx context.Context, req *connect_go.Request[v1alpha1.GetSourceDirectoryInfoRequest]) (*connect_go.Response[v1alpha1.GetSourceDirectoryInfoResponse], error) { + return c.getSourceDirectoryInfo.CallUnary(ctx, req) +} + +// GetSourceFile calls bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceFile. +func (c *docServiceClient) GetSourceFile(ctx context.Context, req *connect_go.Request[v1alpha1.GetSourceFileRequest]) (*connect_go.Response[v1alpha1.GetSourceFileResponse], error) { + return c.getSourceFile.CallUnary(ctx, req) +} + +// GetModulePackages calls bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModulePackages. +func (c *docServiceClient) GetModulePackages(ctx context.Context, req *connect_go.Request[v1alpha1.GetModulePackagesRequest]) (*connect_go.Response[v1alpha1.GetModulePackagesResponse], error) { + return c.getModulePackages.CallUnary(ctx, req) +} + +// GetModuleDocumentation calls +// bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModuleDocumentation. +func (c *docServiceClient) GetModuleDocumentation(ctx context.Context, req *connect_go.Request[v1alpha1.GetModuleDocumentationRequest]) (*connect_go.Response[v1alpha1.GetModuleDocumentationResponse], error) { + return c.getModuleDocumentation.CallUnary(ctx, req) +} + +// GetPackageDocumentation calls +// bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetPackageDocumentation. +func (c *docServiceClient) GetPackageDocumentation(ctx context.Context, req *connect_go.Request[v1alpha1.GetPackageDocumentationRequest]) (*connect_go.Response[v1alpha1.GetPackageDocumentationResponse], error) { + return c.getPackageDocumentation.CallUnary(ctx, req) +} + +// DocServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.DocService service. +type DocServiceHandler interface { + // GetSourceDirectoryInfo retrieves the directory and file structure for the + // given owner, repository and reference. + // + // The purpose of this is to get a representation of the file tree for a given + // module to enable exploring the module by navigating through its contents. + GetSourceDirectoryInfo(context.Context, *connect_go.Request[v1alpha1.GetSourceDirectoryInfoRequest]) (*connect_go.Response[v1alpha1.GetSourceDirectoryInfoResponse], error) + // GetSourceFile retrieves the source contents for the given owner, repository, + // reference, and path. + GetSourceFile(context.Context, *connect_go.Request[v1alpha1.GetSourceFileRequest]) (*connect_go.Response[v1alpha1.GetSourceFileResponse], error) + // GetModulePackages retrieves the list of packages for the module based on the given + // owner, repository, and reference. + GetModulePackages(context.Context, *connect_go.Request[v1alpha1.GetModulePackagesRequest]) (*connect_go.Response[v1alpha1.GetModulePackagesResponse], error) + // GetModuleDocumentation retrieves the documentations including buf.md and LICENSE files + // for module based on the given owner, repository, and reference. + GetModuleDocumentation(context.Context, *connect_go.Request[v1alpha1.GetModuleDocumentationRequest]) (*connect_go.Response[v1alpha1.GetModuleDocumentationResponse], error) + // GetPackageDocumentation retrieves a a slice of documentation structures + // for the given owner, repository, reference, and package name. + GetPackageDocumentation(context.Context, *connect_go.Request[v1alpha1.GetPackageDocumentationRequest]) (*connect_go.Response[v1alpha1.GetPackageDocumentationResponse], error) +} + +// NewDocServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDocServiceHandler(svc DocServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + docServiceGetSourceDirectoryInfoHandler := connect_go.NewUnaryHandler( + DocServiceGetSourceDirectoryInfoProcedure, + svc.GetSourceDirectoryInfo, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + docServiceGetSourceFileHandler := connect_go.NewUnaryHandler( + DocServiceGetSourceFileProcedure, + svc.GetSourceFile, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + docServiceGetModulePackagesHandler := connect_go.NewUnaryHandler( + DocServiceGetModulePackagesProcedure, + svc.GetModulePackages, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + docServiceGetModuleDocumentationHandler := connect_go.NewUnaryHandler( + DocServiceGetModuleDocumentationProcedure, + svc.GetModuleDocumentation, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + docServiceGetPackageDocumentationHandler := connect_go.NewUnaryHandler( + DocServiceGetPackageDocumentationProcedure, + svc.GetPackageDocumentation, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DocServiceGetSourceDirectoryInfoProcedure: + docServiceGetSourceDirectoryInfoHandler.ServeHTTP(w, r) + case DocServiceGetSourceFileProcedure: + docServiceGetSourceFileHandler.ServeHTTP(w, r) + case DocServiceGetModulePackagesProcedure: + docServiceGetModulePackagesHandler.ServeHTTP(w, r) + case DocServiceGetModuleDocumentationProcedure: + docServiceGetModuleDocumentationHandler.ServeHTTP(w, r) + case DocServiceGetPackageDocumentationProcedure: + docServiceGetPackageDocumentationHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDocServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDocServiceHandler struct{} + +func (UnimplementedDocServiceHandler) GetSourceDirectoryInfo(context.Context, *connect_go.Request[v1alpha1.GetSourceDirectoryInfoRequest]) (*connect_go.Response[v1alpha1.GetSourceDirectoryInfoResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceDirectoryInfo is not implemented")) +} + +func (UnimplementedDocServiceHandler) GetSourceFile(context.Context, *connect_go.Request[v1alpha1.GetSourceFileRequest]) (*connect_go.Response[v1alpha1.GetSourceFileResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceFile is not implemented")) +} + +func (UnimplementedDocServiceHandler) GetModulePackages(context.Context, *connect_go.Request[v1alpha1.GetModulePackagesRequest]) (*connect_go.Response[v1alpha1.GetModulePackagesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModulePackages is not implemented")) +} + +func (UnimplementedDocServiceHandler) GetModuleDocumentation(context.Context, *connect_go.Request[v1alpha1.GetModuleDocumentationRequest]) (*connect_go.Response[v1alpha1.GetModuleDocumentationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModuleDocumentation is not implemented")) +} + +func (UnimplementedDocServiceHandler) GetPackageDocumentation(context.Context, *connect_go.Request[v1alpha1.GetPackageDocumentationRequest]) (*connect_go.Response[v1alpha1.GetPackageDocumentationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetPackageDocumentation is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/docker.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/docker.connect.go new file mode 100644 index 000000000..91ba3e302 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/docker.connect.go @@ -0,0 +1,311 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/docker.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // DockerRepoServiceName is the fully-qualified name of the DockerRepoService service. + DockerRepoServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DockerRepoServiceCreateDockerRepoProcedure is the fully-qualified name of the DockerRepoService's + // CreateDockerRepo RPC. + DockerRepoServiceCreateDockerRepoProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/CreateDockerRepo" + // DockerRepoServiceGetDockerRepoProcedure is the fully-qualified name of the DockerRepoService's + // GetDockerRepo RPC. + DockerRepoServiceGetDockerRepoProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/GetDockerRepo" + // DockerRepoServiceGetDockerRepoByNameProcedure is the fully-qualified name of the + // DockerRepoService's GetDockerRepoByName RPC. + DockerRepoServiceGetDockerRepoByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/GetDockerRepoByName" + // DockerRepoServiceListDockerReposProcedure is the fully-qualified name of the DockerRepoService's + // ListDockerRepos RPC. + DockerRepoServiceListDockerReposProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/ListDockerRepos" + // DockerRepoServiceUpdateDockerRepoByNameProcedure is the fully-qualified name of the + // DockerRepoService's UpdateDockerRepoByName RPC. + DockerRepoServiceUpdateDockerRepoByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/UpdateDockerRepoByName" + // DockerRepoServiceUpdateDockerRepoByIDProcedure is the fully-qualified name of the + // DockerRepoService's UpdateDockerRepoByID RPC. + DockerRepoServiceUpdateDockerRepoByIDProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/UpdateDockerRepoByID" +) + +// DockerRepoServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService service. +type DockerRepoServiceClient interface { + // CreateDockerRepo create a docker repo for user + // + // This method requires authentication. + CreateDockerRepo(context.Context, *connect_go.Request[v1alpha1.CreateDockerRepoRequest]) (*connect_go.Response[v1alpha1.CreateDockerRepoResponse], error) + // GetDockerRepo get a user's docker repo by id + // + // This method requires authentication. + GetDockerRepo(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoResponse], error) + // GetDockerRepoByName get a user's docker repo by name + // + // This method requires authentication. + GetDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoByNameResponse], error) + // ListDockerRepos lists the user's all docker repo entries + // + // This method requires authentication. + ListDockerRepos(context.Context, *connect_go.Request[v1alpha1.ListDockerReposRequest]) (*connect_go.Response[v1alpha1.ListDockerReposResponse], error) + // UpdateDockerRepoByName given a name, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByNameResponse], error) + // UpdateDockerRepoByName given a id, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByID(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByIDRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByIDResponse], error) +} + +// NewDockerRepoServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDockerRepoServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DockerRepoServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &dockerRepoServiceClient{ + createDockerRepo: connect_go.NewClient[v1alpha1.CreateDockerRepoRequest, v1alpha1.CreateDockerRepoResponse]( + httpClient, + baseURL+DockerRepoServiceCreateDockerRepoProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getDockerRepo: connect_go.NewClient[v1alpha1.GetDockerRepoRequest, v1alpha1.GetDockerRepoResponse]( + httpClient, + baseURL+DockerRepoServiceGetDockerRepoProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getDockerRepoByName: connect_go.NewClient[v1alpha1.GetDockerRepoByNameRequest, v1alpha1.GetDockerRepoByNameResponse]( + httpClient, + baseURL+DockerRepoServiceGetDockerRepoByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listDockerRepos: connect_go.NewClient[v1alpha1.ListDockerReposRequest, v1alpha1.ListDockerReposResponse]( + httpClient, + baseURL+DockerRepoServiceListDockerReposProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateDockerRepoByName: connect_go.NewClient[v1alpha1.UpdateDockerRepoByNameRequest, v1alpha1.UpdateDockerRepoByNameResponse]( + httpClient, + baseURL+DockerRepoServiceUpdateDockerRepoByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + updateDockerRepoByID: connect_go.NewClient[v1alpha1.UpdateDockerRepoByIDRequest, v1alpha1.UpdateDockerRepoByIDResponse]( + httpClient, + baseURL+DockerRepoServiceUpdateDockerRepoByIDProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// dockerRepoServiceClient implements DockerRepoServiceClient. +type dockerRepoServiceClient struct { + createDockerRepo *connect_go.Client[v1alpha1.CreateDockerRepoRequest, v1alpha1.CreateDockerRepoResponse] + getDockerRepo *connect_go.Client[v1alpha1.GetDockerRepoRequest, v1alpha1.GetDockerRepoResponse] + getDockerRepoByName *connect_go.Client[v1alpha1.GetDockerRepoByNameRequest, v1alpha1.GetDockerRepoByNameResponse] + listDockerRepos *connect_go.Client[v1alpha1.ListDockerReposRequest, v1alpha1.ListDockerReposResponse] + updateDockerRepoByName *connect_go.Client[v1alpha1.UpdateDockerRepoByNameRequest, v1alpha1.UpdateDockerRepoByNameResponse] + updateDockerRepoByID *connect_go.Client[v1alpha1.UpdateDockerRepoByIDRequest, v1alpha1.UpdateDockerRepoByIDResponse] +} + +// CreateDockerRepo calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.CreateDockerRepo. +func (c *dockerRepoServiceClient) CreateDockerRepo(ctx context.Context, req *connect_go.Request[v1alpha1.CreateDockerRepoRequest]) (*connect_go.Response[v1alpha1.CreateDockerRepoResponse], error) { + return c.createDockerRepo.CallUnary(ctx, req) +} + +// GetDockerRepo calls bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepo. +func (c *dockerRepoServiceClient) GetDockerRepo(ctx context.Context, req *connect_go.Request[v1alpha1.GetDockerRepoRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoResponse], error) { + return c.getDockerRepo.CallUnary(ctx, req) +} + +// GetDockerRepoByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepoByName. +func (c *dockerRepoServiceClient) GetDockerRepoByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoByNameResponse], error) { + return c.getDockerRepoByName.CallUnary(ctx, req) +} + +// ListDockerRepos calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.ListDockerRepos. +func (c *dockerRepoServiceClient) ListDockerRepos(ctx context.Context, req *connect_go.Request[v1alpha1.ListDockerReposRequest]) (*connect_go.Response[v1alpha1.ListDockerReposResponse], error) { + return c.listDockerRepos.CallUnary(ctx, req) +} + +// UpdateDockerRepoByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByName. +func (c *dockerRepoServiceClient) UpdateDockerRepoByName(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByNameResponse], error) { + return c.updateDockerRepoByName.CallUnary(ctx, req) +} + +// UpdateDockerRepoByID calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByID. +func (c *dockerRepoServiceClient) UpdateDockerRepoByID(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateDockerRepoByIDRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByIDResponse], error) { + return c.updateDockerRepoByID.CallUnary(ctx, req) +} + +// DockerRepoServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService service. +type DockerRepoServiceHandler interface { + // CreateDockerRepo create a docker repo for user + // + // This method requires authentication. + CreateDockerRepo(context.Context, *connect_go.Request[v1alpha1.CreateDockerRepoRequest]) (*connect_go.Response[v1alpha1.CreateDockerRepoResponse], error) + // GetDockerRepo get a user's docker repo by id + // + // This method requires authentication. + GetDockerRepo(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoResponse], error) + // GetDockerRepoByName get a user's docker repo by name + // + // This method requires authentication. + GetDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoByNameResponse], error) + // ListDockerRepos lists the user's all docker repo entries + // + // This method requires authentication. + ListDockerRepos(context.Context, *connect_go.Request[v1alpha1.ListDockerReposRequest]) (*connect_go.Response[v1alpha1.ListDockerReposResponse], error) + // UpdateDockerRepoByName given a name, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByNameResponse], error) + // UpdateDockerRepoByName given a id, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByID(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByIDRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByIDResponse], error) +} + +// NewDockerRepoServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDockerRepoServiceHandler(svc DockerRepoServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + dockerRepoServiceCreateDockerRepoHandler := connect_go.NewUnaryHandler( + DockerRepoServiceCreateDockerRepoProcedure, + svc.CreateDockerRepo, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceGetDockerRepoHandler := connect_go.NewUnaryHandler( + DockerRepoServiceGetDockerRepoProcedure, + svc.GetDockerRepo, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceGetDockerRepoByNameHandler := connect_go.NewUnaryHandler( + DockerRepoServiceGetDockerRepoByNameProcedure, + svc.GetDockerRepoByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceListDockerReposHandler := connect_go.NewUnaryHandler( + DockerRepoServiceListDockerReposProcedure, + svc.ListDockerRepos, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceUpdateDockerRepoByNameHandler := connect_go.NewUnaryHandler( + DockerRepoServiceUpdateDockerRepoByNameProcedure, + svc.UpdateDockerRepoByName, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceUpdateDockerRepoByIDHandler := connect_go.NewUnaryHandler( + DockerRepoServiceUpdateDockerRepoByIDProcedure, + svc.UpdateDockerRepoByID, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DockerRepoServiceCreateDockerRepoProcedure: + dockerRepoServiceCreateDockerRepoHandler.ServeHTTP(w, r) + case DockerRepoServiceGetDockerRepoProcedure: + dockerRepoServiceGetDockerRepoHandler.ServeHTTP(w, r) + case DockerRepoServiceGetDockerRepoByNameProcedure: + dockerRepoServiceGetDockerRepoByNameHandler.ServeHTTP(w, r) + case DockerRepoServiceListDockerReposProcedure: + dockerRepoServiceListDockerReposHandler.ServeHTTP(w, r) + case DockerRepoServiceUpdateDockerRepoByNameProcedure: + dockerRepoServiceUpdateDockerRepoByNameHandler.ServeHTTP(w, r) + case DockerRepoServiceUpdateDockerRepoByIDProcedure: + dockerRepoServiceUpdateDockerRepoByIDHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDockerRepoServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDockerRepoServiceHandler struct{} + +func (UnimplementedDockerRepoServiceHandler) CreateDockerRepo(context.Context, *connect_go.Request[v1alpha1.CreateDockerRepoRequest]) (*connect_go.Response[v1alpha1.CreateDockerRepoResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.CreateDockerRepo is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) GetDockerRepo(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepo is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) GetDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepoByName is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) ListDockerRepos(context.Context, *connect_go.Request[v1alpha1.ListDockerReposRequest]) (*connect_go.Response[v1alpha1.ListDockerReposResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.ListDockerRepos is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) UpdateDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByName is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) UpdateDockerRepoByID(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByIDRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByIDResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByID is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/download.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/download.connect.go new file mode 100644 index 000000000..d72df0ba9 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/download.connect.go @@ -0,0 +1,161 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/download.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // DownloadServiceName is the fully-qualified name of the DownloadService service. + DownloadServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.DownloadService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DownloadServiceDownloadProcedure is the fully-qualified name of the DownloadService's Download + // RPC. + DownloadServiceDownloadProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DownloadService/Download" + // DownloadServiceDownloadManifestAndBlobsProcedure is the fully-qualified name of the + // DownloadService's DownloadManifestAndBlobs RPC. + DownloadServiceDownloadManifestAndBlobsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DownloadService/DownloadManifestAndBlobs" +) + +// DownloadServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DownloadService service. +type DownloadServiceClient interface { + // Download downloads a BSR module. + // NOTE: Newer clients should use DownloadManifestAndBlobs instead. + Download(context.Context, *connect_go.Request[v1alpha1.DownloadRequest]) (*connect_go.Response[v1alpha1.DownloadResponse], error) + // DownloadManifestAndBlobs downloads a module in the manifest+blobs encoding format. + DownloadManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.DownloadManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.DownloadManifestAndBlobsResponse], error) +} + +// NewDownloadServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DownloadService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDownloadServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DownloadServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &downloadServiceClient{ + download: connect_go.NewClient[v1alpha1.DownloadRequest, v1alpha1.DownloadResponse]( + httpClient, + baseURL+DownloadServiceDownloadProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + downloadManifestAndBlobs: connect_go.NewClient[v1alpha1.DownloadManifestAndBlobsRequest, v1alpha1.DownloadManifestAndBlobsResponse]( + httpClient, + baseURL+DownloadServiceDownloadManifestAndBlobsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// downloadServiceClient implements DownloadServiceClient. +type downloadServiceClient struct { + download *connect_go.Client[v1alpha1.DownloadRequest, v1alpha1.DownloadResponse] + downloadManifestAndBlobs *connect_go.Client[v1alpha1.DownloadManifestAndBlobsRequest, v1alpha1.DownloadManifestAndBlobsResponse] +} + +// Download calls bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.Download. +func (c *downloadServiceClient) Download(ctx context.Context, req *connect_go.Request[v1alpha1.DownloadRequest]) (*connect_go.Response[v1alpha1.DownloadResponse], error) { + return c.download.CallUnary(ctx, req) +} + +// DownloadManifestAndBlobs calls +// bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.DownloadManifestAndBlobs. +func (c *downloadServiceClient) DownloadManifestAndBlobs(ctx context.Context, req *connect_go.Request[v1alpha1.DownloadManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.DownloadManifestAndBlobsResponse], error) { + return c.downloadManifestAndBlobs.CallUnary(ctx, req) +} + +// DownloadServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.DownloadService service. +type DownloadServiceHandler interface { + // Download downloads a BSR module. + // NOTE: Newer clients should use DownloadManifestAndBlobs instead. + Download(context.Context, *connect_go.Request[v1alpha1.DownloadRequest]) (*connect_go.Response[v1alpha1.DownloadResponse], error) + // DownloadManifestAndBlobs downloads a module in the manifest+blobs encoding format. + DownloadManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.DownloadManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.DownloadManifestAndBlobsResponse], error) +} + +// NewDownloadServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDownloadServiceHandler(svc DownloadServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + downloadServiceDownloadHandler := connect_go.NewUnaryHandler( + DownloadServiceDownloadProcedure, + svc.Download, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + downloadServiceDownloadManifestAndBlobsHandler := connect_go.NewUnaryHandler( + DownloadServiceDownloadManifestAndBlobsProcedure, + svc.DownloadManifestAndBlobs, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.DownloadService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DownloadServiceDownloadProcedure: + downloadServiceDownloadHandler.ServeHTTP(w, r) + case DownloadServiceDownloadManifestAndBlobsProcedure: + downloadServiceDownloadManifestAndBlobsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDownloadServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDownloadServiceHandler struct{} + +func (UnimplementedDownloadServiceHandler) Download(context.Context, *connect_go.Request[v1alpha1.DownloadRequest]) (*connect_go.Response[v1alpha1.DownloadResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.Download is not implemented")) +} + +func (UnimplementedDownloadServiceHandler) DownloadManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.DownloadManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.DownloadManifestAndBlobsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.DownloadManifestAndBlobs is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/generate.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/generate.connect.go new file mode 100644 index 000000000..f4e18e08d --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/generate.connect.go @@ -0,0 +1,161 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// registry/v1alpha1/generate.proto is a deprecated file. + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // GenerateServiceName is the fully-qualified name of the GenerateService service. + GenerateServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.GenerateService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // GenerateServiceGeneratePluginsProcedure is the fully-qualified name of the GenerateService's + // GeneratePlugins RPC. + GenerateServiceGeneratePluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.GenerateService/GeneratePlugins" + // GenerateServiceGenerateTemplateProcedure is the fully-qualified name of the GenerateService's + // GenerateTemplate RPC. + GenerateServiceGenerateTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.GenerateService/GenerateTemplate" +) + +// GenerateServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService service. +type GenerateServiceClient interface { + // GeneratePlugins generates an array of files given the provided + // module reference and plugin version and option tuples. No attempt + // is made at merging insertion points. + GeneratePlugins(context.Context, *connect_go.Request[v1alpha1.GeneratePluginsRequest]) (*connect_go.Response[v1alpha1.GeneratePluginsResponse], error) + // GenerateTemplate generates an array of files given the provided + // module reference and template version. + GenerateTemplate(context.Context, *connect_go.Request[v1alpha1.GenerateTemplateRequest]) (*connect_go.Response[v1alpha1.GenerateTemplateResponse], error) +} + +// NewGenerateServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewGenerateServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GenerateServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &generateServiceClient{ + generatePlugins: connect_go.NewClient[v1alpha1.GeneratePluginsRequest, v1alpha1.GeneratePluginsResponse]( + httpClient, + baseURL+GenerateServiceGeneratePluginsProcedure, + opts..., + ), + generateTemplate: connect_go.NewClient[v1alpha1.GenerateTemplateRequest, v1alpha1.GenerateTemplateResponse]( + httpClient, + baseURL+GenerateServiceGenerateTemplateProcedure, + opts..., + ), + } +} + +// generateServiceClient implements GenerateServiceClient. +type generateServiceClient struct { + generatePlugins *connect_go.Client[v1alpha1.GeneratePluginsRequest, v1alpha1.GeneratePluginsResponse] + generateTemplate *connect_go.Client[v1alpha1.GenerateTemplateRequest, v1alpha1.GenerateTemplateResponse] +} + +// GeneratePlugins calls bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GeneratePlugins. +func (c *generateServiceClient) GeneratePlugins(ctx context.Context, req *connect_go.Request[v1alpha1.GeneratePluginsRequest]) (*connect_go.Response[v1alpha1.GeneratePluginsResponse], error) { + return c.generatePlugins.CallUnary(ctx, req) +} + +// GenerateTemplate calls +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GenerateTemplate. +func (c *generateServiceClient) GenerateTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.GenerateTemplateRequest]) (*connect_go.Response[v1alpha1.GenerateTemplateResponse], error) { + return c.generateTemplate.CallUnary(ctx, req) +} + +// GenerateServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService service. +type GenerateServiceHandler interface { + // GeneratePlugins generates an array of files given the provided + // module reference and plugin version and option tuples. No attempt + // is made at merging insertion points. + GeneratePlugins(context.Context, *connect_go.Request[v1alpha1.GeneratePluginsRequest]) (*connect_go.Response[v1alpha1.GeneratePluginsResponse], error) + // GenerateTemplate generates an array of files given the provided + // module reference and template version. + GenerateTemplate(context.Context, *connect_go.Request[v1alpha1.GenerateTemplateRequest]) (*connect_go.Response[v1alpha1.GenerateTemplateResponse], error) +} + +// NewGenerateServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewGenerateServiceHandler(svc GenerateServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + generateServiceGeneratePluginsHandler := connect_go.NewUnaryHandler( + GenerateServiceGeneratePluginsProcedure, + svc.GeneratePlugins, + opts..., + ) + generateServiceGenerateTemplateHandler := connect_go.NewUnaryHandler( + GenerateServiceGenerateTemplateProcedure, + svc.GenerateTemplate, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.GenerateService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case GenerateServiceGeneratePluginsProcedure: + generateServiceGeneratePluginsHandler.ServeHTTP(w, r) + case GenerateServiceGenerateTemplateProcedure: + generateServiceGenerateTemplateHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedGenerateServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedGenerateServiceHandler struct{} + +func (UnimplementedGenerateServiceHandler) GeneratePlugins(context.Context, *connect_go.Request[v1alpha1.GeneratePluginsRequest]) (*connect_go.Response[v1alpha1.GeneratePluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GeneratePlugins is not implemented")) +} + +func (UnimplementedGenerateServiceHandler) GenerateTemplate(context.Context, *connect_go.Request[v1alpha1.GenerateTemplateRequest]) (*connect_go.Response[v1alpha1.GenerateTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GenerateTemplate is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/github.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/github.connect.go new file mode 100644 index 000000000..4a110bc38 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/github.connect.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/github.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // GithubServiceName is the fully-qualified name of the GithubService service. + GithubServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.GithubService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // GithubServiceGetGithubAppConfigProcedure is the fully-qualified name of the GithubService's + // GetGithubAppConfig RPC. + GithubServiceGetGithubAppConfigProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.GithubService/GetGithubAppConfig" +) + +// GithubServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.GithubService +// service. +type GithubServiceClient interface { + // GetGithubAppConfig returns a Github Application Configuration. + GetGithubAppConfig(context.Context, *connect_go.Request[v1alpha1.GetGithubAppConfigRequest]) (*connect_go.Response[v1alpha1.GetGithubAppConfigResponse], error) +} + +// NewGithubServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.GithubService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewGithubServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GithubServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &githubServiceClient{ + getGithubAppConfig: connect_go.NewClient[v1alpha1.GetGithubAppConfigRequest, v1alpha1.GetGithubAppConfigResponse]( + httpClient, + baseURL+GithubServiceGetGithubAppConfigProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// githubServiceClient implements GithubServiceClient. +type githubServiceClient struct { + getGithubAppConfig *connect_go.Client[v1alpha1.GetGithubAppConfigRequest, v1alpha1.GetGithubAppConfigResponse] +} + +// GetGithubAppConfig calls +// bufman.dubbo.apache.org.registry.v1alpha1.GithubService.GetGithubAppConfig. +func (c *githubServiceClient) GetGithubAppConfig(ctx context.Context, req *connect_go.Request[v1alpha1.GetGithubAppConfigRequest]) (*connect_go.Response[v1alpha1.GetGithubAppConfigResponse], error) { + return c.getGithubAppConfig.CallUnary(ctx, req) +} + +// GithubServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.GithubService service. +type GithubServiceHandler interface { + // GetGithubAppConfig returns a Github Application Configuration. + GetGithubAppConfig(context.Context, *connect_go.Request[v1alpha1.GetGithubAppConfigRequest]) (*connect_go.Response[v1alpha1.GetGithubAppConfigResponse], error) +} + +// NewGithubServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewGithubServiceHandler(svc GithubServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + githubServiceGetGithubAppConfigHandler := connect_go.NewUnaryHandler( + GithubServiceGetGithubAppConfigProcedure, + svc.GetGithubAppConfig, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.GithubService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case GithubServiceGetGithubAppConfigProcedure: + githubServiceGetGithubAppConfigHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedGithubServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedGithubServiceHandler struct{} + +func (UnimplementedGithubServiceHandler) GetGithubAppConfig(context.Context, *connect_go.Request[v1alpha1.GetGithubAppConfigRequest]) (*connect_go.Response[v1alpha1.GetGithubAppConfigResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.GithubService.GetGithubAppConfig is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/image.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/image.connect.go new file mode 100644 index 000000000..979ffecfe --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/image.connect.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/image.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // ImageServiceName is the fully-qualified name of the ImageService service. + ImageServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ImageService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ImageServiceGetImageProcedure is the fully-qualified name of the ImageService's GetImage RPC. + ImageServiceGetImageProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ImageService/GetImage" +) + +// ImageServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.ImageService +// service. +type ImageServiceClient interface { + // GetImage serves a compiled image for the local module. It automatically + // downloads dependencies if necessary. + GetImage(context.Context, *connect_go.Request[v1alpha1.GetImageRequest]) (*connect_go.Response[v1alpha1.GetImageResponse], error) +} + +// NewImageServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ImageService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewImageServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ImageServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &imageServiceClient{ + getImage: connect_go.NewClient[v1alpha1.GetImageRequest, v1alpha1.GetImageResponse]( + httpClient, + baseURL+ImageServiceGetImageProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// imageServiceClient implements ImageServiceClient. +type imageServiceClient struct { + getImage *connect_go.Client[v1alpha1.GetImageRequest, v1alpha1.GetImageResponse] +} + +// GetImage calls bufman.dubbo.apache.org.registry.v1alpha1.ImageService.GetImage. +func (c *imageServiceClient) GetImage(ctx context.Context, req *connect_go.Request[v1alpha1.GetImageRequest]) (*connect_go.Response[v1alpha1.GetImageResponse], error) { + return c.getImage.CallUnary(ctx, req) +} + +// ImageServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ImageService service. +type ImageServiceHandler interface { + // GetImage serves a compiled image for the local module. It automatically + // downloads dependencies if necessary. + GetImage(context.Context, *connect_go.Request[v1alpha1.GetImageRequest]) (*connect_go.Response[v1alpha1.GetImageResponse], error) +} + +// NewImageServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewImageServiceHandler(svc ImageServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + imageServiceGetImageHandler := connect_go.NewUnaryHandler( + ImageServiceGetImageProcedure, + svc.GetImage, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ImageService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ImageServiceGetImageProcedure: + imageServiceGetImageHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedImageServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedImageServiceHandler struct{} + +func (UnimplementedImageServiceHandler) GetImage(context.Context, *connect_go.Request[v1alpha1.GetImageRequest]) (*connect_go.Response[v1alpha1.GetImageResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ImageService.GetImage is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/jsonschema.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/jsonschema.connect.go new file mode 100644 index 000000000..66382f8e0 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/jsonschema.connect.go @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/jsonschema.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // JSONSchemaServiceName is the fully-qualified name of the JSONSchemaService service. + JSONSchemaServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // JSONSchemaServiceGetJSONSchemaProcedure is the fully-qualified name of the JSONSchemaService's + // GetJSONSchema RPC. + JSONSchemaServiceGetJSONSchemaProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService/GetJSONSchema" +) + +// JSONSchemaServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService service. +type JSONSchemaServiceClient interface { + // GetJSONSchema allows users to get an (approximate) json schema for a + // protobuf type. + GetJSONSchema(context.Context, *connect_go.Request[v1alpha1.GetJSONSchemaRequest]) (*connect_go.Response[v1alpha1.GetJSONSchemaResponse], error) +} + +// NewJSONSchemaServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewJSONSchemaServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) JSONSchemaServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &jSONSchemaServiceClient{ + getJSONSchema: connect_go.NewClient[v1alpha1.GetJSONSchemaRequest, v1alpha1.GetJSONSchemaResponse]( + httpClient, + baseURL+JSONSchemaServiceGetJSONSchemaProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// jSONSchemaServiceClient implements JSONSchemaServiceClient. +type jSONSchemaServiceClient struct { + getJSONSchema *connect_go.Client[v1alpha1.GetJSONSchemaRequest, v1alpha1.GetJSONSchemaResponse] +} + +// GetJSONSchema calls bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService.GetJSONSchema. +func (c *jSONSchemaServiceClient) GetJSONSchema(ctx context.Context, req *connect_go.Request[v1alpha1.GetJSONSchemaRequest]) (*connect_go.Response[v1alpha1.GetJSONSchemaResponse], error) { + return c.getJSONSchema.CallUnary(ctx, req) +} + +// JSONSchemaServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService service. +type JSONSchemaServiceHandler interface { + // GetJSONSchema allows users to get an (approximate) json schema for a + // protobuf type. + GetJSONSchema(context.Context, *connect_go.Request[v1alpha1.GetJSONSchemaRequest]) (*connect_go.Response[v1alpha1.GetJSONSchemaResponse], error) +} + +// NewJSONSchemaServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewJSONSchemaServiceHandler(svc JSONSchemaServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + jSONSchemaServiceGetJSONSchemaHandler := connect_go.NewUnaryHandler( + JSONSchemaServiceGetJSONSchemaProcedure, + svc.GetJSONSchema, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case JSONSchemaServiceGetJSONSchemaProcedure: + jSONSchemaServiceGetJSONSchemaHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedJSONSchemaServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedJSONSchemaServiceHandler struct{} + +func (UnimplementedJSONSchemaServiceHandler) GetJSONSchema(context.Context, *connect_go.Request[v1alpha1.GetJSONSchemaRequest]) (*connect_go.Response[v1alpha1.GetJSONSchemaResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService.GetJSONSchema is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/labels.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/labels.connect.go new file mode 100644 index 000000000..bdcb7b872 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/labels.connect.go @@ -0,0 +1,179 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/labels.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // LabelServiceName is the fully-qualified name of the LabelService service. + LabelServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.LabelService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // LabelServiceCreateLabelProcedure is the fully-qualified name of the LabelService's CreateLabel + // RPC. + LabelServiceCreateLabelProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/CreateLabel" + // LabelServiceMoveLabelProcedure is the fully-qualified name of the LabelService's MoveLabel RPC. + LabelServiceMoveLabelProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/MoveLabel" + // LabelServiceGetLabelsProcedure is the fully-qualified name of the LabelService's GetLabels RPC. + LabelServiceGetLabelsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/GetLabels" +) + +// LabelServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.LabelService +// service. +type LabelServiceClient interface { + CreateLabel(context.Context, *connect_go.Request[v1alpha1.CreateLabelRequest]) (*connect_go.Response[v1alpha1.CreateLabelResponse], error) + MoveLabel(context.Context, *connect_go.Request[v1alpha1.MoveLabelRequest]) (*connect_go.Response[v1alpha1.MoveLabelResponse], error) + GetLabels(context.Context, *connect_go.Request[v1alpha1.GetLabelsRequest]) (*connect_go.Response[v1alpha1.GetLabelsResponse], error) +} + +// NewLabelServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.LabelService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewLabelServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) LabelServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &labelServiceClient{ + createLabel: connect_go.NewClient[v1alpha1.CreateLabelRequest, v1alpha1.CreateLabelResponse]( + httpClient, + baseURL+LabelServiceCreateLabelProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + moveLabel: connect_go.NewClient[v1alpha1.MoveLabelRequest, v1alpha1.MoveLabelResponse]( + httpClient, + baseURL+LabelServiceMoveLabelProcedure, + opts..., + ), + getLabels: connect_go.NewClient[v1alpha1.GetLabelsRequest, v1alpha1.GetLabelsResponse]( + httpClient, + baseURL+LabelServiceGetLabelsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// labelServiceClient implements LabelServiceClient. +type labelServiceClient struct { + createLabel *connect_go.Client[v1alpha1.CreateLabelRequest, v1alpha1.CreateLabelResponse] + moveLabel *connect_go.Client[v1alpha1.MoveLabelRequest, v1alpha1.MoveLabelResponse] + getLabels *connect_go.Client[v1alpha1.GetLabelsRequest, v1alpha1.GetLabelsResponse] +} + +// CreateLabel calls bufman.dubbo.apache.org.registry.v1alpha1.LabelService.CreateLabel. +func (c *labelServiceClient) CreateLabel(ctx context.Context, req *connect_go.Request[v1alpha1.CreateLabelRequest]) (*connect_go.Response[v1alpha1.CreateLabelResponse], error) { + return c.createLabel.CallUnary(ctx, req) +} + +// MoveLabel calls bufman.dubbo.apache.org.registry.v1alpha1.LabelService.MoveLabel. +func (c *labelServiceClient) MoveLabel(ctx context.Context, req *connect_go.Request[v1alpha1.MoveLabelRequest]) (*connect_go.Response[v1alpha1.MoveLabelResponse], error) { + return c.moveLabel.CallUnary(ctx, req) +} + +// GetLabels calls bufman.dubbo.apache.org.registry.v1alpha1.LabelService.GetLabels. +func (c *labelServiceClient) GetLabels(ctx context.Context, req *connect_go.Request[v1alpha1.GetLabelsRequest]) (*connect_go.Response[v1alpha1.GetLabelsResponse], error) { + return c.getLabels.CallUnary(ctx, req) +} + +// LabelServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.LabelService service. +type LabelServiceHandler interface { + CreateLabel(context.Context, *connect_go.Request[v1alpha1.CreateLabelRequest]) (*connect_go.Response[v1alpha1.CreateLabelResponse], error) + MoveLabel(context.Context, *connect_go.Request[v1alpha1.MoveLabelRequest]) (*connect_go.Response[v1alpha1.MoveLabelResponse], error) + GetLabels(context.Context, *connect_go.Request[v1alpha1.GetLabelsRequest]) (*connect_go.Response[v1alpha1.GetLabelsResponse], error) +} + +// NewLabelServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewLabelServiceHandler(svc LabelServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + labelServiceCreateLabelHandler := connect_go.NewUnaryHandler( + LabelServiceCreateLabelProcedure, + svc.CreateLabel, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + labelServiceMoveLabelHandler := connect_go.NewUnaryHandler( + LabelServiceMoveLabelProcedure, + svc.MoveLabel, + opts..., + ) + labelServiceGetLabelsHandler := connect_go.NewUnaryHandler( + LabelServiceGetLabelsProcedure, + svc.GetLabels, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case LabelServiceCreateLabelProcedure: + labelServiceCreateLabelHandler.ServeHTTP(w, r) + case LabelServiceMoveLabelProcedure: + labelServiceMoveLabelHandler.ServeHTTP(w, r) + case LabelServiceGetLabelsProcedure: + labelServiceGetLabelsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedLabelServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedLabelServiceHandler struct{} + +func (UnimplementedLabelServiceHandler) CreateLabel(context.Context, *connect_go.Request[v1alpha1.CreateLabelRequest]) (*connect_go.Response[v1alpha1.CreateLabelResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.LabelService.CreateLabel is not implemented")) +} + +func (UnimplementedLabelServiceHandler) MoveLabel(context.Context, *connect_go.Request[v1alpha1.MoveLabelRequest]) (*connect_go.Response[v1alpha1.MoveLabelResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.LabelService.MoveLabel is not implemented")) +} + +func (UnimplementedLabelServiceHandler) GetLabels(context.Context, *connect_go.Request[v1alpha1.GetLabelsRequest]) (*connect_go.Response[v1alpha1.GetLabelsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.LabelService.GetLabels is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/organization.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/organization.connect.go new file mode 100644 index 000000000..d36a22afe --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/organization.connect.go @@ -0,0 +1,600 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/organization.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // OrganizationServiceName is the fully-qualified name of the OrganizationService service. + OrganizationServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // OrganizationServiceGetOrganizationProcedure is the fully-qualified name of the + // OrganizationService's GetOrganization RPC. + OrganizationServiceGetOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganization" + // OrganizationServiceGetOrganizationByNameProcedure is the fully-qualified name of the + // OrganizationService's GetOrganizationByName RPC. + OrganizationServiceGetOrganizationByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganizationByName" + // OrganizationServiceListOrganizationsProcedure is the fully-qualified name of the + // OrganizationService's ListOrganizations RPC. + OrganizationServiceListOrganizationsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/ListOrganizations" + // OrganizationServiceListUserOrganizationsProcedure is the fully-qualified name of the + // OrganizationService's ListUserOrganizations RPC. + OrganizationServiceListUserOrganizationsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/ListUserOrganizations" + // OrganizationServiceGetUserOrganizationProcedure is the fully-qualified name of the + // OrganizationService's GetUserOrganization RPC. + OrganizationServiceGetUserOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetUserOrganization" + // OrganizationServiceCreateOrganizationProcedure is the fully-qualified name of the + // OrganizationService's CreateOrganization RPC. + OrganizationServiceCreateOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/CreateOrganization" + // OrganizationServiceDeleteOrganizationProcedure is the fully-qualified name of the + // OrganizationService's DeleteOrganization RPC. + OrganizationServiceDeleteOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/DeleteOrganization" + // OrganizationServiceDeleteOrganizationByNameProcedure is the fully-qualified name of the + // OrganizationService's DeleteOrganizationByName RPC. + OrganizationServiceDeleteOrganizationByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/DeleteOrganizationByName" + // OrganizationServiceAddOrganizationMemberProcedure is the fully-qualified name of the + // OrganizationService's AddOrganizationMember RPC. + OrganizationServiceAddOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/AddOrganizationMember" + // OrganizationServiceUpdateOrganizationMemberProcedure is the fully-qualified name of the + // OrganizationService's UpdateOrganizationMember RPC. + OrganizationServiceUpdateOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/UpdateOrganizationMember" + // OrganizationServiceRemoveOrganizationMemberProcedure is the fully-qualified name of the + // OrganizationService's RemoveOrganizationMember RPC. + OrganizationServiceRemoveOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/RemoveOrganizationMember" + // OrganizationServiceSetOrganizationMemberProcedure is the fully-qualified name of the + // OrganizationService's SetOrganizationMember RPC. + OrganizationServiceSetOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/SetOrganizationMember" + // OrganizationServiceGetOrganizationSettingsProcedure is the fully-qualified name of the + // OrganizationService's GetOrganizationSettings RPC. + OrganizationServiceGetOrganizationSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganizationSettings" + // OrganizationServiceUpdateOrganizationSettingsProcedure is the fully-qualified name of the + // OrganizationService's UpdateOrganizationSettings RPC. + OrganizationServiceUpdateOrganizationSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/UpdateOrganizationSettings" + // OrganizationServiceAddOrganizationGroupProcedure is the fully-qualified name of the + // OrganizationService's AddOrganizationGroup RPC. + OrganizationServiceAddOrganizationGroupProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/AddOrganizationGroup" + // OrganizationServiceRemoveOrganizationGroupProcedure is the fully-qualified name of the + // OrganizationService's RemoveOrganizationGroup RPC. + OrganizationServiceRemoveOrganizationGroupProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/RemoveOrganizationGroup" +) + +// OrganizationServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService service. +type OrganizationServiceClient interface { + // GetOrganization gets a organization by ID. + GetOrganization(context.Context, *connect_go.Request[v1alpha1.GetOrganizationRequest]) (*connect_go.Response[v1alpha1.GetOrganizationResponse], error) + // GetOrganizationByName gets a organization by name. + GetOrganizationByName(context.Context, *connect_go.Request[v1alpha1.GetOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.GetOrganizationByNameResponse], error) + // ListOrganizations lists all organizations. + ListOrganizations(context.Context, *connect_go.Request[v1alpha1.ListOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationsResponse], error) + // ListUserOrganizations lists all organizations a user is member of. + ListUserOrganizations(context.Context, *connect_go.Request[v1alpha1.ListUserOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListUserOrganizationsResponse], error) + GetUserOrganization(context.Context, *connect_go.Request[v1alpha1.GetUserOrganizationRequest]) (*connect_go.Response[v1alpha1.GetUserOrganizationResponse], error) + // CreateOrganization creates a new organization. + CreateOrganization(context.Context, *connect_go.Request[v1alpha1.CreateOrganizationRequest]) (*connect_go.Response[v1alpha1.CreateOrganizationResponse], error) + // DeleteOrganization deletes a organization. + DeleteOrganization(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationResponse], error) + // DeleteOrganizationByName deletes a organization by name. + DeleteOrganizationByName(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationByNameResponse], error) + // AddOrganizationMember add a role to an user in the organization. + AddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.AddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.AddOrganizationMemberResponse], error) + // UpdateOrganizationMember update the user's membership information in the organization. + UpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationMemberResponse], error) + // RemoveOrganizationMember remove the role of an user in the organization. + RemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationMemberResponse], error) + // SetOrganizationMember sets the role of a user in the organization. + SetOrganizationMember(context.Context, *connect_go.Request[v1alpha1.SetOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.SetOrganizationMemberResponse], error) + // GetOrganizationSettings gets the settings of an organization, including organization base roles. + GetOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.GetOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.GetOrganizationSettingsResponse], error) + // UpdateOrganizationSettings update the organization settings including base roles. + UpdateOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationSettingsResponse], error) + // AddOrganizationGroup adds an IdP Group to the organization. + AddOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.AddOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.AddOrganizationGroupResponse], error) + // RemoveOrganizationGroup removes an IdP Group from the organization. + RemoveOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationGroupResponse], error) +} + +// NewOrganizationServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewOrganizationServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) OrganizationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &organizationServiceClient{ + getOrganization: connect_go.NewClient[v1alpha1.GetOrganizationRequest, v1alpha1.GetOrganizationResponse]( + httpClient, + baseURL+OrganizationServiceGetOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getOrganizationByName: connect_go.NewClient[v1alpha1.GetOrganizationByNameRequest, v1alpha1.GetOrganizationByNameResponse]( + httpClient, + baseURL+OrganizationServiceGetOrganizationByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizations: connect_go.NewClient[v1alpha1.ListOrganizationsRequest, v1alpha1.ListOrganizationsResponse]( + httpClient, + baseURL+OrganizationServiceListOrganizationsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUserOrganizations: connect_go.NewClient[v1alpha1.ListUserOrganizationsRequest, v1alpha1.ListUserOrganizationsResponse]( + httpClient, + baseURL+OrganizationServiceListUserOrganizationsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getUserOrganization: connect_go.NewClient[v1alpha1.GetUserOrganizationRequest, v1alpha1.GetUserOrganizationResponse]( + httpClient, + baseURL+OrganizationServiceGetUserOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + createOrganization: connect_go.NewClient[v1alpha1.CreateOrganizationRequest, v1alpha1.CreateOrganizationResponse]( + httpClient, + baseURL+OrganizationServiceCreateOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteOrganization: connect_go.NewClient[v1alpha1.DeleteOrganizationRequest, v1alpha1.DeleteOrganizationResponse]( + httpClient, + baseURL+OrganizationServiceDeleteOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteOrganizationByName: connect_go.NewClient[v1alpha1.DeleteOrganizationByNameRequest, v1alpha1.DeleteOrganizationByNameResponse]( + httpClient, + baseURL+OrganizationServiceDeleteOrganizationByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + addOrganizationMember: connect_go.NewClient[v1alpha1.AddOrganizationMemberRequest, v1alpha1.AddOrganizationMemberResponse]( + httpClient, + baseURL+OrganizationServiceAddOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + updateOrganizationMember: connect_go.NewClient[v1alpha1.UpdateOrganizationMemberRequest, v1alpha1.UpdateOrganizationMemberResponse]( + httpClient, + baseURL+OrganizationServiceUpdateOrganizationMemberProcedure, + opts..., + ), + removeOrganizationMember: connect_go.NewClient[v1alpha1.RemoveOrganizationMemberRequest, v1alpha1.RemoveOrganizationMemberResponse]( + httpClient, + baseURL+OrganizationServiceRemoveOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + setOrganizationMember: connect_go.NewClient[v1alpha1.SetOrganizationMemberRequest, v1alpha1.SetOrganizationMemberResponse]( + httpClient, + baseURL+OrganizationServiceSetOrganizationMemberProcedure, + opts..., + ), + getOrganizationSettings: connect_go.NewClient[v1alpha1.GetOrganizationSettingsRequest, v1alpha1.GetOrganizationSettingsResponse]( + httpClient, + baseURL+OrganizationServiceGetOrganizationSettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateOrganizationSettings: connect_go.NewClient[v1alpha1.UpdateOrganizationSettingsRequest, v1alpha1.UpdateOrganizationSettingsResponse]( + httpClient, + baseURL+OrganizationServiceUpdateOrganizationSettingsProcedure, + opts..., + ), + addOrganizationGroup: connect_go.NewClient[v1alpha1.AddOrganizationGroupRequest, v1alpha1.AddOrganizationGroupResponse]( + httpClient, + baseURL+OrganizationServiceAddOrganizationGroupProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + removeOrganizationGroup: connect_go.NewClient[v1alpha1.RemoveOrganizationGroupRequest, v1alpha1.RemoveOrganizationGroupResponse]( + httpClient, + baseURL+OrganizationServiceRemoveOrganizationGroupProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// organizationServiceClient implements OrganizationServiceClient. +type organizationServiceClient struct { + getOrganization *connect_go.Client[v1alpha1.GetOrganizationRequest, v1alpha1.GetOrganizationResponse] + getOrganizationByName *connect_go.Client[v1alpha1.GetOrganizationByNameRequest, v1alpha1.GetOrganizationByNameResponse] + listOrganizations *connect_go.Client[v1alpha1.ListOrganizationsRequest, v1alpha1.ListOrganizationsResponse] + listUserOrganizations *connect_go.Client[v1alpha1.ListUserOrganizationsRequest, v1alpha1.ListUserOrganizationsResponse] + getUserOrganization *connect_go.Client[v1alpha1.GetUserOrganizationRequest, v1alpha1.GetUserOrganizationResponse] + createOrganization *connect_go.Client[v1alpha1.CreateOrganizationRequest, v1alpha1.CreateOrganizationResponse] + deleteOrganization *connect_go.Client[v1alpha1.DeleteOrganizationRequest, v1alpha1.DeleteOrganizationResponse] + deleteOrganizationByName *connect_go.Client[v1alpha1.DeleteOrganizationByNameRequest, v1alpha1.DeleteOrganizationByNameResponse] + addOrganizationMember *connect_go.Client[v1alpha1.AddOrganizationMemberRequest, v1alpha1.AddOrganizationMemberResponse] + updateOrganizationMember *connect_go.Client[v1alpha1.UpdateOrganizationMemberRequest, v1alpha1.UpdateOrganizationMemberResponse] + removeOrganizationMember *connect_go.Client[v1alpha1.RemoveOrganizationMemberRequest, v1alpha1.RemoveOrganizationMemberResponse] + setOrganizationMember *connect_go.Client[v1alpha1.SetOrganizationMemberRequest, v1alpha1.SetOrganizationMemberResponse] + getOrganizationSettings *connect_go.Client[v1alpha1.GetOrganizationSettingsRequest, v1alpha1.GetOrganizationSettingsResponse] + updateOrganizationSettings *connect_go.Client[v1alpha1.UpdateOrganizationSettingsRequest, v1alpha1.UpdateOrganizationSettingsResponse] + addOrganizationGroup *connect_go.Client[v1alpha1.AddOrganizationGroupRequest, v1alpha1.AddOrganizationGroupResponse] + removeOrganizationGroup *connect_go.Client[v1alpha1.RemoveOrganizationGroupRequest, v1alpha1.RemoveOrganizationGroupResponse] +} + +// GetOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganization. +func (c *organizationServiceClient) GetOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrganizationRequest]) (*connect_go.Response[v1alpha1.GetOrganizationResponse], error) { + return c.getOrganization.CallUnary(ctx, req) +} + +// GetOrganizationByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationByName. +func (c *organizationServiceClient) GetOrganizationByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.GetOrganizationByNameResponse], error) { + return c.getOrganizationByName.CallUnary(ctx, req) +} + +// ListOrganizations calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListOrganizations. +func (c *organizationServiceClient) ListOrganizations(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationsResponse], error) { + return c.listOrganizations.CallUnary(ctx, req) +} + +// ListUserOrganizations calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListUserOrganizations. +func (c *organizationServiceClient) ListUserOrganizations(ctx context.Context, req *connect_go.Request[v1alpha1.ListUserOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListUserOrganizationsResponse], error) { + return c.listUserOrganizations.CallUnary(ctx, req) +} + +// GetUserOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetUserOrganization. +func (c *organizationServiceClient) GetUserOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.GetUserOrganizationRequest]) (*connect_go.Response[v1alpha1.GetUserOrganizationResponse], error) { + return c.getUserOrganization.CallUnary(ctx, req) +} + +// CreateOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.CreateOrganization. +func (c *organizationServiceClient) CreateOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.CreateOrganizationRequest]) (*connect_go.Response[v1alpha1.CreateOrganizationResponse], error) { + return c.createOrganization.CallUnary(ctx, req) +} + +// DeleteOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganization. +func (c *organizationServiceClient) DeleteOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationResponse], error) { + return c.deleteOrganization.CallUnary(ctx, req) +} + +// DeleteOrganizationByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganizationByName. +func (c *organizationServiceClient) DeleteOrganizationByName(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationByNameResponse], error) { + return c.deleteOrganizationByName.CallUnary(ctx, req) +} + +// AddOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationMember. +func (c *organizationServiceClient) AddOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.AddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.AddOrganizationMemberResponse], error) { + return c.addOrganizationMember.CallUnary(ctx, req) +} + +// UpdateOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationMember. +func (c *organizationServiceClient) UpdateOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationMemberResponse], error) { + return c.updateOrganizationMember.CallUnary(ctx, req) +} + +// RemoveOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationMember. +func (c *organizationServiceClient) RemoveOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.RemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationMemberResponse], error) { + return c.removeOrganizationMember.CallUnary(ctx, req) +} + +// SetOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.SetOrganizationMember. +func (c *organizationServiceClient) SetOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.SetOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.SetOrganizationMemberResponse], error) { + return c.setOrganizationMember.CallUnary(ctx, req) +} + +// GetOrganizationSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationSettings. +func (c *organizationServiceClient) GetOrganizationSettings(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.GetOrganizationSettingsResponse], error) { + return c.getOrganizationSettings.CallUnary(ctx, req) +} + +// UpdateOrganizationSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationSettings. +func (c *organizationServiceClient) UpdateOrganizationSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationSettingsResponse], error) { + return c.updateOrganizationSettings.CallUnary(ctx, req) +} + +// AddOrganizationGroup calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationGroup. +func (c *organizationServiceClient) AddOrganizationGroup(ctx context.Context, req *connect_go.Request[v1alpha1.AddOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.AddOrganizationGroupResponse], error) { + return c.addOrganizationGroup.CallUnary(ctx, req) +} + +// RemoveOrganizationGroup calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationGroup. +func (c *organizationServiceClient) RemoveOrganizationGroup(ctx context.Context, req *connect_go.Request[v1alpha1.RemoveOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationGroupResponse], error) { + return c.removeOrganizationGroup.CallUnary(ctx, req) +} + +// OrganizationServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService service. +type OrganizationServiceHandler interface { + // GetOrganization gets a organization by ID. + GetOrganization(context.Context, *connect_go.Request[v1alpha1.GetOrganizationRequest]) (*connect_go.Response[v1alpha1.GetOrganizationResponse], error) + // GetOrganizationByName gets a organization by name. + GetOrganizationByName(context.Context, *connect_go.Request[v1alpha1.GetOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.GetOrganizationByNameResponse], error) + // ListOrganizations lists all organizations. + ListOrganizations(context.Context, *connect_go.Request[v1alpha1.ListOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationsResponse], error) + // ListUserOrganizations lists all organizations a user is member of. + ListUserOrganizations(context.Context, *connect_go.Request[v1alpha1.ListUserOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListUserOrganizationsResponse], error) + GetUserOrganization(context.Context, *connect_go.Request[v1alpha1.GetUserOrganizationRequest]) (*connect_go.Response[v1alpha1.GetUserOrganizationResponse], error) + // CreateOrganization creates a new organization. + CreateOrganization(context.Context, *connect_go.Request[v1alpha1.CreateOrganizationRequest]) (*connect_go.Response[v1alpha1.CreateOrganizationResponse], error) + // DeleteOrganization deletes a organization. + DeleteOrganization(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationResponse], error) + // DeleteOrganizationByName deletes a organization by name. + DeleteOrganizationByName(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationByNameResponse], error) + // AddOrganizationMember add a role to an user in the organization. + AddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.AddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.AddOrganizationMemberResponse], error) + // UpdateOrganizationMember update the user's membership information in the organization. + UpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationMemberResponse], error) + // RemoveOrganizationMember remove the role of an user in the organization. + RemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationMemberResponse], error) + // SetOrganizationMember sets the role of a user in the organization. + SetOrganizationMember(context.Context, *connect_go.Request[v1alpha1.SetOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.SetOrganizationMemberResponse], error) + // GetOrganizationSettings gets the settings of an organization, including organization base roles. + GetOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.GetOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.GetOrganizationSettingsResponse], error) + // UpdateOrganizationSettings update the organization settings including base roles. + UpdateOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationSettingsResponse], error) + // AddOrganizationGroup adds an IdP Group to the organization. + AddOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.AddOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.AddOrganizationGroupResponse], error) + // RemoveOrganizationGroup removes an IdP Group from the organization. + RemoveOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationGroupResponse], error) +} + +// NewOrganizationServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewOrganizationServiceHandler(svc OrganizationServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + organizationServiceGetOrganizationHandler := connect_go.NewUnaryHandler( + OrganizationServiceGetOrganizationProcedure, + svc.GetOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceGetOrganizationByNameHandler := connect_go.NewUnaryHandler( + OrganizationServiceGetOrganizationByNameProcedure, + svc.GetOrganizationByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceListOrganizationsHandler := connect_go.NewUnaryHandler( + OrganizationServiceListOrganizationsProcedure, + svc.ListOrganizations, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceListUserOrganizationsHandler := connect_go.NewUnaryHandler( + OrganizationServiceListUserOrganizationsProcedure, + svc.ListUserOrganizations, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceGetUserOrganizationHandler := connect_go.NewUnaryHandler( + OrganizationServiceGetUserOrganizationProcedure, + svc.GetUserOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceCreateOrganizationHandler := connect_go.NewUnaryHandler( + OrganizationServiceCreateOrganizationProcedure, + svc.CreateOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceDeleteOrganizationHandler := connect_go.NewUnaryHandler( + OrganizationServiceDeleteOrganizationProcedure, + svc.DeleteOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceDeleteOrganizationByNameHandler := connect_go.NewUnaryHandler( + OrganizationServiceDeleteOrganizationByNameProcedure, + svc.DeleteOrganizationByName, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceAddOrganizationMemberHandler := connect_go.NewUnaryHandler( + OrganizationServiceAddOrganizationMemberProcedure, + svc.AddOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceUpdateOrganizationMemberHandler := connect_go.NewUnaryHandler( + OrganizationServiceUpdateOrganizationMemberProcedure, + svc.UpdateOrganizationMember, + opts..., + ) + organizationServiceRemoveOrganizationMemberHandler := connect_go.NewUnaryHandler( + OrganizationServiceRemoveOrganizationMemberProcedure, + svc.RemoveOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceSetOrganizationMemberHandler := connect_go.NewUnaryHandler( + OrganizationServiceSetOrganizationMemberProcedure, + svc.SetOrganizationMember, + opts..., + ) + organizationServiceGetOrganizationSettingsHandler := connect_go.NewUnaryHandler( + OrganizationServiceGetOrganizationSettingsProcedure, + svc.GetOrganizationSettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceUpdateOrganizationSettingsHandler := connect_go.NewUnaryHandler( + OrganizationServiceUpdateOrganizationSettingsProcedure, + svc.UpdateOrganizationSettings, + opts..., + ) + organizationServiceAddOrganizationGroupHandler := connect_go.NewUnaryHandler( + OrganizationServiceAddOrganizationGroupProcedure, + svc.AddOrganizationGroup, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceRemoveOrganizationGroupHandler := connect_go.NewUnaryHandler( + OrganizationServiceRemoveOrganizationGroupProcedure, + svc.RemoveOrganizationGroup, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case OrganizationServiceGetOrganizationProcedure: + organizationServiceGetOrganizationHandler.ServeHTTP(w, r) + case OrganizationServiceGetOrganizationByNameProcedure: + organizationServiceGetOrganizationByNameHandler.ServeHTTP(w, r) + case OrganizationServiceListOrganizationsProcedure: + organizationServiceListOrganizationsHandler.ServeHTTP(w, r) + case OrganizationServiceListUserOrganizationsProcedure: + organizationServiceListUserOrganizationsHandler.ServeHTTP(w, r) + case OrganizationServiceGetUserOrganizationProcedure: + organizationServiceGetUserOrganizationHandler.ServeHTTP(w, r) + case OrganizationServiceCreateOrganizationProcedure: + organizationServiceCreateOrganizationHandler.ServeHTTP(w, r) + case OrganizationServiceDeleteOrganizationProcedure: + organizationServiceDeleteOrganizationHandler.ServeHTTP(w, r) + case OrganizationServiceDeleteOrganizationByNameProcedure: + organizationServiceDeleteOrganizationByNameHandler.ServeHTTP(w, r) + case OrganizationServiceAddOrganizationMemberProcedure: + organizationServiceAddOrganizationMemberHandler.ServeHTTP(w, r) + case OrganizationServiceUpdateOrganizationMemberProcedure: + organizationServiceUpdateOrganizationMemberHandler.ServeHTTP(w, r) + case OrganizationServiceRemoveOrganizationMemberProcedure: + organizationServiceRemoveOrganizationMemberHandler.ServeHTTP(w, r) + case OrganizationServiceSetOrganizationMemberProcedure: + organizationServiceSetOrganizationMemberHandler.ServeHTTP(w, r) + case OrganizationServiceGetOrganizationSettingsProcedure: + organizationServiceGetOrganizationSettingsHandler.ServeHTTP(w, r) + case OrganizationServiceUpdateOrganizationSettingsProcedure: + organizationServiceUpdateOrganizationSettingsHandler.ServeHTTP(w, r) + case OrganizationServiceAddOrganizationGroupProcedure: + organizationServiceAddOrganizationGroupHandler.ServeHTTP(w, r) + case OrganizationServiceRemoveOrganizationGroupProcedure: + organizationServiceRemoveOrganizationGroupHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedOrganizationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedOrganizationServiceHandler struct{} + +func (UnimplementedOrganizationServiceHandler) GetOrganization(context.Context, *connect_go.Request[v1alpha1.GetOrganizationRequest]) (*connect_go.Response[v1alpha1.GetOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganization is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) GetOrganizationByName(context.Context, *connect_go.Request[v1alpha1.GetOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.GetOrganizationByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationByName is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) ListOrganizations(context.Context, *connect_go.Request[v1alpha1.ListOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListOrganizations is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) ListUserOrganizations(context.Context, *connect_go.Request[v1alpha1.ListUserOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListUserOrganizationsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListUserOrganizations is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) GetUserOrganization(context.Context, *connect_go.Request[v1alpha1.GetUserOrganizationRequest]) (*connect_go.Response[v1alpha1.GetUserOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetUserOrganization is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) CreateOrganization(context.Context, *connect_go.Request[v1alpha1.CreateOrganizationRequest]) (*connect_go.Response[v1alpha1.CreateOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.CreateOrganization is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) DeleteOrganization(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganization is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) DeleteOrganizationByName(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganizationByName is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) AddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.AddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.AddOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationMember is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) UpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationMember is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) RemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationMember is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) SetOrganizationMember(context.Context, *connect_go.Request[v1alpha1.SetOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.SetOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.SetOrganizationMember is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) GetOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.GetOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.GetOrganizationSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationSettings is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) UpdateOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationSettings is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) AddOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.AddOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.AddOrganizationGroupResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationGroup is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) RemoveOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationGroupResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationGroup is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/owner.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/owner.connect.go new file mode 100644 index 000000000..715a067f8 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/owner.connect.go @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/owner.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // OwnerServiceName is the fully-qualified name of the OwnerService service. + OwnerServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.OwnerService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // OwnerServiceGetOwnerByNameProcedure is the fully-qualified name of the OwnerService's + // GetOwnerByName RPC. + OwnerServiceGetOwnerByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OwnerService/GetOwnerByName" +) + +// OwnerServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.OwnerService +// service. +type OwnerServiceClient interface { + // GetOwnerByName takes an owner name and returns the owner as + // either a user or organization. + GetOwnerByName(context.Context, *connect_go.Request[v1alpha1.GetOwnerByNameRequest]) (*connect_go.Response[v1alpha1.GetOwnerByNameResponse], error) +} + +// NewOwnerServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.OwnerService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewOwnerServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) OwnerServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &ownerServiceClient{ + getOwnerByName: connect_go.NewClient[v1alpha1.GetOwnerByNameRequest, v1alpha1.GetOwnerByNameResponse]( + httpClient, + baseURL+OwnerServiceGetOwnerByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// ownerServiceClient implements OwnerServiceClient. +type ownerServiceClient struct { + getOwnerByName *connect_go.Client[v1alpha1.GetOwnerByNameRequest, v1alpha1.GetOwnerByNameResponse] +} + +// GetOwnerByName calls bufman.dubbo.apache.org.registry.v1alpha1.OwnerService.GetOwnerByName. +func (c *ownerServiceClient) GetOwnerByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetOwnerByNameRequest]) (*connect_go.Response[v1alpha1.GetOwnerByNameResponse], error) { + return c.getOwnerByName.CallUnary(ctx, req) +} + +// OwnerServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.OwnerService service. +type OwnerServiceHandler interface { + // GetOwnerByName takes an owner name and returns the owner as + // either a user or organization. + GetOwnerByName(context.Context, *connect_go.Request[v1alpha1.GetOwnerByNameRequest]) (*connect_go.Response[v1alpha1.GetOwnerByNameResponse], error) +} + +// NewOwnerServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewOwnerServiceHandler(svc OwnerServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + ownerServiceGetOwnerByNameHandler := connect_go.NewUnaryHandler( + OwnerServiceGetOwnerByNameProcedure, + svc.GetOwnerByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.OwnerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case OwnerServiceGetOwnerByNameProcedure: + ownerServiceGetOwnerByNameHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedOwnerServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedOwnerServiceHandler struct{} + +func (UnimplementedOwnerServiceHandler) GetOwnerByName(context.Context, *connect_go.Request[v1alpha1.GetOwnerByNameRequest]) (*connect_go.Response[v1alpha1.GetOwnerByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OwnerService.GetOwnerByName is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/plugin.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/plugin.connect.go new file mode 100644 index 000000000..d9aa5e559 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/plugin.connect.go @@ -0,0 +1,581 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// registry/v1alpha1/plugin.proto is a deprecated file. + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // PluginServiceName is the fully-qualified name of the PluginService service. + PluginServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.PluginService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // PluginServiceListPluginsProcedure is the fully-qualified name of the PluginService's ListPlugins + // RPC. + PluginServiceListPluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListPlugins" + // PluginServiceListUserPluginsProcedure is the fully-qualified name of the PluginService's + // ListUserPlugins RPC. + PluginServiceListUserPluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListUserPlugins" + // PluginServiceListOrganizationPluginsProcedure is the fully-qualified name of the PluginService's + // ListOrganizationPlugins RPC. + PluginServiceListOrganizationPluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListOrganizationPlugins" + // PluginServiceGetPluginVersionProcedure is the fully-qualified name of the PluginService's + // GetPluginVersion RPC. + PluginServiceGetPluginVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetPluginVersion" + // PluginServiceListPluginVersionsProcedure is the fully-qualified name of the PluginService's + // ListPluginVersions RPC. + PluginServiceListPluginVersionsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListPluginVersions" + // PluginServiceGetPluginProcedure is the fully-qualified name of the PluginService's GetPlugin RPC. + PluginServiceGetPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetPlugin" + // PluginServiceDeletePluginProcedure is the fully-qualified name of the PluginService's + // DeletePlugin RPC. + PluginServiceDeletePluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/DeletePlugin" + // PluginServiceGetTemplateProcedure is the fully-qualified name of the PluginService's GetTemplate + // RPC. + PluginServiceGetTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetTemplate" + // PluginServiceListTemplatesProcedure is the fully-qualified name of the PluginService's + // ListTemplates RPC. + PluginServiceListTemplatesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplates" + // PluginServiceListTemplatesUserCanAccessProcedure is the fully-qualified name of the + // PluginService's ListTemplatesUserCanAccess RPC. + PluginServiceListTemplatesUserCanAccessProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplatesUserCanAccess" + // PluginServiceListUserTemplatesProcedure is the fully-qualified name of the PluginService's + // ListUserTemplates RPC. + PluginServiceListUserTemplatesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListUserTemplates" + // PluginServiceListOrganizationTemplatesProcedure is the fully-qualified name of the + // PluginService's ListOrganizationTemplates RPC. + PluginServiceListOrganizationTemplatesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListOrganizationTemplates" + // PluginServiceGetTemplateVersionProcedure is the fully-qualified name of the PluginService's + // GetTemplateVersion RPC. + PluginServiceGetTemplateVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetTemplateVersion" + // PluginServiceListTemplateVersionsProcedure is the fully-qualified name of the PluginService's + // ListTemplateVersions RPC. + PluginServiceListTemplateVersionsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplateVersions" + // PluginServiceDeleteTemplateProcedure is the fully-qualified name of the PluginService's + // DeleteTemplate RPC. + PluginServiceDeleteTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/DeleteTemplate" +) + +// PluginServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.PluginService +// service. +type PluginServiceClient interface { + // ListPlugins returns all the plugins available to the user. This includes + // public plugins, those uploaded to organizations the user is part of, + // and any plugins uploaded directly by the user. + ListPlugins(context.Context, *connect_go.Request[v1alpha1.ListPluginsRequest]) (*connect_go.Response[v1alpha1.ListPluginsResponse], error) + // ListUserPlugins lists all plugins belonging to a user. + ListUserPlugins(context.Context, *connect_go.Request[v1alpha1.ListUserPluginsRequest]) (*connect_go.Response[v1alpha1.ListUserPluginsResponse], error) + // ListOrganizationPlugins lists all plugins for an organization. + ListOrganizationPlugins(context.Context, *connect_go.Request[v1alpha1.ListOrganizationPluginsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationPluginsResponse], error) + // GetPluginVersion returns the plugin version, if found. + GetPluginVersion(context.Context, *connect_go.Request[v1alpha1.GetPluginVersionRequest]) (*connect_go.Response[v1alpha1.GetPluginVersionResponse], error) + // ListPluginVersions lists all the versions available for the specified plugin. + ListPluginVersions(context.Context, *connect_go.Request[v1alpha1.ListPluginVersionsRequest]) (*connect_go.Response[v1alpha1.ListPluginVersionsResponse], error) + // GetPlugin returns the plugin, if found. + GetPlugin(context.Context, *connect_go.Request[v1alpha1.GetPluginRequest]) (*connect_go.Response[v1alpha1.GetPluginResponse], error) + // DeletePlugin deletes the plugin, if it exists. Note that deleting + // a plugin may cause breaking changes for templates using that plugin, + // and should be done with extreme care. + DeletePlugin(context.Context, *connect_go.Request[v1alpha1.DeletePluginRequest]) (*connect_go.Response[v1alpha1.DeletePluginResponse], error) + // GetTemplate returns the template, if found. + GetTemplate(context.Context, *connect_go.Request[v1alpha1.GetTemplateRequest]) (*connect_go.Response[v1alpha1.GetTemplateResponse], error) + // ListTemplates returns all the templates available to the user. This includes + // public templates, those owned by organizations the user is part of, + // and any created directly by the user. + ListTemplates(context.Context, *connect_go.Request[v1alpha1.ListTemplatesRequest]) (*connect_go.Response[v1alpha1.ListTemplatesResponse], error) + // ListTemplatesUserCanAccess is like ListTemplates, but does not return + // public templates. + ListTemplatesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListTemplatesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListTemplatesUserCanAccessResponse], error) + // ListUserPlugins lists all templates belonging to a user. + ListUserTemplates(context.Context, *connect_go.Request[v1alpha1.ListUserTemplatesRequest]) (*connect_go.Response[v1alpha1.ListUserTemplatesResponse], error) + // ListOrganizationTemplates lists all templates for an organization. + ListOrganizationTemplates(context.Context, *connect_go.Request[v1alpha1.ListOrganizationTemplatesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationTemplatesResponse], error) + // GetTemplateVersion returns the template version, if found. + GetTemplateVersion(context.Context, *connect_go.Request[v1alpha1.GetTemplateVersionRequest]) (*connect_go.Response[v1alpha1.GetTemplateVersionResponse], error) + // ListTemplateVersions lists all the template versions available for the specified template. + ListTemplateVersions(context.Context, *connect_go.Request[v1alpha1.ListTemplateVersionsRequest]) (*connect_go.Response[v1alpha1.ListTemplateVersionsResponse], error) + // DeleteTemplate deletes the template, if it exists. + DeleteTemplate(context.Context, *connect_go.Request[v1alpha1.DeleteTemplateRequest]) (*connect_go.Response[v1alpha1.DeleteTemplateResponse], error) +} + +// NewPluginServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewPluginServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) PluginServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &pluginServiceClient{ + listPlugins: connect_go.NewClient[v1alpha1.ListPluginsRequest, v1alpha1.ListPluginsResponse]( + httpClient, + baseURL+PluginServiceListPluginsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUserPlugins: connect_go.NewClient[v1alpha1.ListUserPluginsRequest, v1alpha1.ListUserPluginsResponse]( + httpClient, + baseURL+PluginServiceListUserPluginsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizationPlugins: connect_go.NewClient[v1alpha1.ListOrganizationPluginsRequest, v1alpha1.ListOrganizationPluginsResponse]( + httpClient, + baseURL+PluginServiceListOrganizationPluginsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getPluginVersion: connect_go.NewClient[v1alpha1.GetPluginVersionRequest, v1alpha1.GetPluginVersionResponse]( + httpClient, + baseURL+PluginServiceGetPluginVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listPluginVersions: connect_go.NewClient[v1alpha1.ListPluginVersionsRequest, v1alpha1.ListPluginVersionsResponse]( + httpClient, + baseURL+PluginServiceListPluginVersionsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getPlugin: connect_go.NewClient[v1alpha1.GetPluginRequest, v1alpha1.GetPluginResponse]( + httpClient, + baseURL+PluginServiceGetPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deletePlugin: connect_go.NewClient[v1alpha1.DeletePluginRequest, v1alpha1.DeletePluginResponse]( + httpClient, + baseURL+PluginServiceDeletePluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getTemplate: connect_go.NewClient[v1alpha1.GetTemplateRequest, v1alpha1.GetTemplateResponse]( + httpClient, + baseURL+PluginServiceGetTemplateProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listTemplates: connect_go.NewClient[v1alpha1.ListTemplatesRequest, v1alpha1.ListTemplatesResponse]( + httpClient, + baseURL+PluginServiceListTemplatesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listTemplatesUserCanAccess: connect_go.NewClient[v1alpha1.ListTemplatesUserCanAccessRequest, v1alpha1.ListTemplatesUserCanAccessResponse]( + httpClient, + baseURL+PluginServiceListTemplatesUserCanAccessProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUserTemplates: connect_go.NewClient[v1alpha1.ListUserTemplatesRequest, v1alpha1.ListUserTemplatesResponse]( + httpClient, + baseURL+PluginServiceListUserTemplatesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizationTemplates: connect_go.NewClient[v1alpha1.ListOrganizationTemplatesRequest, v1alpha1.ListOrganizationTemplatesResponse]( + httpClient, + baseURL+PluginServiceListOrganizationTemplatesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getTemplateVersion: connect_go.NewClient[v1alpha1.GetTemplateVersionRequest, v1alpha1.GetTemplateVersionResponse]( + httpClient, + baseURL+PluginServiceGetTemplateVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listTemplateVersions: connect_go.NewClient[v1alpha1.ListTemplateVersionsRequest, v1alpha1.ListTemplateVersionsResponse]( + httpClient, + baseURL+PluginServiceListTemplateVersionsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteTemplate: connect_go.NewClient[v1alpha1.DeleteTemplateRequest, v1alpha1.DeleteTemplateResponse]( + httpClient, + baseURL+PluginServiceDeleteTemplateProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// pluginServiceClient implements PluginServiceClient. +type pluginServiceClient struct { + listPlugins *connect_go.Client[v1alpha1.ListPluginsRequest, v1alpha1.ListPluginsResponse] + listUserPlugins *connect_go.Client[v1alpha1.ListUserPluginsRequest, v1alpha1.ListUserPluginsResponse] + listOrganizationPlugins *connect_go.Client[v1alpha1.ListOrganizationPluginsRequest, v1alpha1.ListOrganizationPluginsResponse] + getPluginVersion *connect_go.Client[v1alpha1.GetPluginVersionRequest, v1alpha1.GetPluginVersionResponse] + listPluginVersions *connect_go.Client[v1alpha1.ListPluginVersionsRequest, v1alpha1.ListPluginVersionsResponse] + getPlugin *connect_go.Client[v1alpha1.GetPluginRequest, v1alpha1.GetPluginResponse] + deletePlugin *connect_go.Client[v1alpha1.DeletePluginRequest, v1alpha1.DeletePluginResponse] + getTemplate *connect_go.Client[v1alpha1.GetTemplateRequest, v1alpha1.GetTemplateResponse] + listTemplates *connect_go.Client[v1alpha1.ListTemplatesRequest, v1alpha1.ListTemplatesResponse] + listTemplatesUserCanAccess *connect_go.Client[v1alpha1.ListTemplatesUserCanAccessRequest, v1alpha1.ListTemplatesUserCanAccessResponse] + listUserTemplates *connect_go.Client[v1alpha1.ListUserTemplatesRequest, v1alpha1.ListUserTemplatesResponse] + listOrganizationTemplates *connect_go.Client[v1alpha1.ListOrganizationTemplatesRequest, v1alpha1.ListOrganizationTemplatesResponse] + getTemplateVersion *connect_go.Client[v1alpha1.GetTemplateVersionRequest, v1alpha1.GetTemplateVersionResponse] + listTemplateVersions *connect_go.Client[v1alpha1.ListTemplateVersionsRequest, v1alpha1.ListTemplateVersionsResponse] + deleteTemplate *connect_go.Client[v1alpha1.DeleteTemplateRequest, v1alpha1.DeleteTemplateResponse] +} + +// ListPlugins calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPlugins. +func (c *pluginServiceClient) ListPlugins(ctx context.Context, req *connect_go.Request[v1alpha1.ListPluginsRequest]) (*connect_go.Response[v1alpha1.ListPluginsResponse], error) { + return c.listPlugins.CallUnary(ctx, req) +} + +// ListUserPlugins calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserPlugins. +func (c *pluginServiceClient) ListUserPlugins(ctx context.Context, req *connect_go.Request[v1alpha1.ListUserPluginsRequest]) (*connect_go.Response[v1alpha1.ListUserPluginsResponse], error) { + return c.listUserPlugins.CallUnary(ctx, req) +} + +// ListOrganizationPlugins calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationPlugins. +func (c *pluginServiceClient) ListOrganizationPlugins(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationPluginsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationPluginsResponse], error) { + return c.listOrganizationPlugins.CallUnary(ctx, req) +} + +// GetPluginVersion calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPluginVersion. +func (c *pluginServiceClient) GetPluginVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetPluginVersionRequest]) (*connect_go.Response[v1alpha1.GetPluginVersionResponse], error) { + return c.getPluginVersion.CallUnary(ctx, req) +} + +// ListPluginVersions calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPluginVersions. +func (c *pluginServiceClient) ListPluginVersions(ctx context.Context, req *connect_go.Request[v1alpha1.ListPluginVersionsRequest]) (*connect_go.Response[v1alpha1.ListPluginVersionsResponse], error) { + return c.listPluginVersions.CallUnary(ctx, req) +} + +// GetPlugin calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPlugin. +func (c *pluginServiceClient) GetPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.GetPluginRequest]) (*connect_go.Response[v1alpha1.GetPluginResponse], error) { + return c.getPlugin.CallUnary(ctx, req) +} + +// DeletePlugin calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeletePlugin. +func (c *pluginServiceClient) DeletePlugin(ctx context.Context, req *connect_go.Request[v1alpha1.DeletePluginRequest]) (*connect_go.Response[v1alpha1.DeletePluginResponse], error) { + return c.deletePlugin.CallUnary(ctx, req) +} + +// GetTemplate calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplate. +func (c *pluginServiceClient) GetTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.GetTemplateRequest]) (*connect_go.Response[v1alpha1.GetTemplateResponse], error) { + return c.getTemplate.CallUnary(ctx, req) +} + +// ListTemplates calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplates. +func (c *pluginServiceClient) ListTemplates(ctx context.Context, req *connect_go.Request[v1alpha1.ListTemplatesRequest]) (*connect_go.Response[v1alpha1.ListTemplatesResponse], error) { + return c.listTemplates.CallUnary(ctx, req) +} + +// ListTemplatesUserCanAccess calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplatesUserCanAccess. +func (c *pluginServiceClient) ListTemplatesUserCanAccess(ctx context.Context, req *connect_go.Request[v1alpha1.ListTemplatesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListTemplatesUserCanAccessResponse], error) { + return c.listTemplatesUserCanAccess.CallUnary(ctx, req) +} + +// ListUserTemplates calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserTemplates. +func (c *pluginServiceClient) ListUserTemplates(ctx context.Context, req *connect_go.Request[v1alpha1.ListUserTemplatesRequest]) (*connect_go.Response[v1alpha1.ListUserTemplatesResponse], error) { + return c.listUserTemplates.CallUnary(ctx, req) +} + +// ListOrganizationTemplates calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationTemplates. +func (c *pluginServiceClient) ListOrganizationTemplates(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationTemplatesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationTemplatesResponse], error) { + return c.listOrganizationTemplates.CallUnary(ctx, req) +} + +// GetTemplateVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplateVersion. +func (c *pluginServiceClient) GetTemplateVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetTemplateVersionRequest]) (*connect_go.Response[v1alpha1.GetTemplateVersionResponse], error) { + return c.getTemplateVersion.CallUnary(ctx, req) +} + +// ListTemplateVersions calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplateVersions. +func (c *pluginServiceClient) ListTemplateVersions(ctx context.Context, req *connect_go.Request[v1alpha1.ListTemplateVersionsRequest]) (*connect_go.Response[v1alpha1.ListTemplateVersionsResponse], error) { + return c.listTemplateVersions.CallUnary(ctx, req) +} + +// DeleteTemplate calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeleteTemplate. +func (c *pluginServiceClient) DeleteTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteTemplateRequest]) (*connect_go.Response[v1alpha1.DeleteTemplateResponse], error) { + return c.deleteTemplate.CallUnary(ctx, req) +} + +// PluginServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService service. +type PluginServiceHandler interface { + // ListPlugins returns all the plugins available to the user. This includes + // public plugins, those uploaded to organizations the user is part of, + // and any plugins uploaded directly by the user. + ListPlugins(context.Context, *connect_go.Request[v1alpha1.ListPluginsRequest]) (*connect_go.Response[v1alpha1.ListPluginsResponse], error) + // ListUserPlugins lists all plugins belonging to a user. + ListUserPlugins(context.Context, *connect_go.Request[v1alpha1.ListUserPluginsRequest]) (*connect_go.Response[v1alpha1.ListUserPluginsResponse], error) + // ListOrganizationPlugins lists all plugins for an organization. + ListOrganizationPlugins(context.Context, *connect_go.Request[v1alpha1.ListOrganizationPluginsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationPluginsResponse], error) + // GetPluginVersion returns the plugin version, if found. + GetPluginVersion(context.Context, *connect_go.Request[v1alpha1.GetPluginVersionRequest]) (*connect_go.Response[v1alpha1.GetPluginVersionResponse], error) + // ListPluginVersions lists all the versions available for the specified plugin. + ListPluginVersions(context.Context, *connect_go.Request[v1alpha1.ListPluginVersionsRequest]) (*connect_go.Response[v1alpha1.ListPluginVersionsResponse], error) + // GetPlugin returns the plugin, if found. + GetPlugin(context.Context, *connect_go.Request[v1alpha1.GetPluginRequest]) (*connect_go.Response[v1alpha1.GetPluginResponse], error) + // DeletePlugin deletes the plugin, if it exists. Note that deleting + // a plugin may cause breaking changes for templates using that plugin, + // and should be done with extreme care. + DeletePlugin(context.Context, *connect_go.Request[v1alpha1.DeletePluginRequest]) (*connect_go.Response[v1alpha1.DeletePluginResponse], error) + // GetTemplate returns the template, if found. + GetTemplate(context.Context, *connect_go.Request[v1alpha1.GetTemplateRequest]) (*connect_go.Response[v1alpha1.GetTemplateResponse], error) + // ListTemplates returns all the templates available to the user. This includes + // public templates, those owned by organizations the user is part of, + // and any created directly by the user. + ListTemplates(context.Context, *connect_go.Request[v1alpha1.ListTemplatesRequest]) (*connect_go.Response[v1alpha1.ListTemplatesResponse], error) + // ListTemplatesUserCanAccess is like ListTemplates, but does not return + // public templates. + ListTemplatesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListTemplatesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListTemplatesUserCanAccessResponse], error) + // ListUserPlugins lists all templates belonging to a user. + ListUserTemplates(context.Context, *connect_go.Request[v1alpha1.ListUserTemplatesRequest]) (*connect_go.Response[v1alpha1.ListUserTemplatesResponse], error) + // ListOrganizationTemplates lists all templates for an organization. + ListOrganizationTemplates(context.Context, *connect_go.Request[v1alpha1.ListOrganizationTemplatesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationTemplatesResponse], error) + // GetTemplateVersion returns the template version, if found. + GetTemplateVersion(context.Context, *connect_go.Request[v1alpha1.GetTemplateVersionRequest]) (*connect_go.Response[v1alpha1.GetTemplateVersionResponse], error) + // ListTemplateVersions lists all the template versions available for the specified template. + ListTemplateVersions(context.Context, *connect_go.Request[v1alpha1.ListTemplateVersionsRequest]) (*connect_go.Response[v1alpha1.ListTemplateVersionsResponse], error) + // DeleteTemplate deletes the template, if it exists. + DeleteTemplate(context.Context, *connect_go.Request[v1alpha1.DeleteTemplateRequest]) (*connect_go.Response[v1alpha1.DeleteTemplateResponse], error) +} + +// NewPluginServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewPluginServiceHandler(svc PluginServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + pluginServiceListPluginsHandler := connect_go.NewUnaryHandler( + PluginServiceListPluginsProcedure, + svc.ListPlugins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListUserPluginsHandler := connect_go.NewUnaryHandler( + PluginServiceListUserPluginsProcedure, + svc.ListUserPlugins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListOrganizationPluginsHandler := connect_go.NewUnaryHandler( + PluginServiceListOrganizationPluginsProcedure, + svc.ListOrganizationPlugins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceGetPluginVersionHandler := connect_go.NewUnaryHandler( + PluginServiceGetPluginVersionProcedure, + svc.GetPluginVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListPluginVersionsHandler := connect_go.NewUnaryHandler( + PluginServiceListPluginVersionsProcedure, + svc.ListPluginVersions, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceGetPluginHandler := connect_go.NewUnaryHandler( + PluginServiceGetPluginProcedure, + svc.GetPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceDeletePluginHandler := connect_go.NewUnaryHandler( + PluginServiceDeletePluginProcedure, + svc.DeletePlugin, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceGetTemplateHandler := connect_go.NewUnaryHandler( + PluginServiceGetTemplateProcedure, + svc.GetTemplate, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListTemplatesHandler := connect_go.NewUnaryHandler( + PluginServiceListTemplatesProcedure, + svc.ListTemplates, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListTemplatesUserCanAccessHandler := connect_go.NewUnaryHandler( + PluginServiceListTemplatesUserCanAccessProcedure, + svc.ListTemplatesUserCanAccess, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListUserTemplatesHandler := connect_go.NewUnaryHandler( + PluginServiceListUserTemplatesProcedure, + svc.ListUserTemplates, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListOrganizationTemplatesHandler := connect_go.NewUnaryHandler( + PluginServiceListOrganizationTemplatesProcedure, + svc.ListOrganizationTemplates, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceGetTemplateVersionHandler := connect_go.NewUnaryHandler( + PluginServiceGetTemplateVersionProcedure, + svc.GetTemplateVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListTemplateVersionsHandler := connect_go.NewUnaryHandler( + PluginServiceListTemplateVersionsProcedure, + svc.ListTemplateVersions, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceDeleteTemplateHandler := connect_go.NewUnaryHandler( + PluginServiceDeleteTemplateProcedure, + svc.DeleteTemplate, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case PluginServiceListPluginsProcedure: + pluginServiceListPluginsHandler.ServeHTTP(w, r) + case PluginServiceListUserPluginsProcedure: + pluginServiceListUserPluginsHandler.ServeHTTP(w, r) + case PluginServiceListOrganizationPluginsProcedure: + pluginServiceListOrganizationPluginsHandler.ServeHTTP(w, r) + case PluginServiceGetPluginVersionProcedure: + pluginServiceGetPluginVersionHandler.ServeHTTP(w, r) + case PluginServiceListPluginVersionsProcedure: + pluginServiceListPluginVersionsHandler.ServeHTTP(w, r) + case PluginServiceGetPluginProcedure: + pluginServiceGetPluginHandler.ServeHTTP(w, r) + case PluginServiceDeletePluginProcedure: + pluginServiceDeletePluginHandler.ServeHTTP(w, r) + case PluginServiceGetTemplateProcedure: + pluginServiceGetTemplateHandler.ServeHTTP(w, r) + case PluginServiceListTemplatesProcedure: + pluginServiceListTemplatesHandler.ServeHTTP(w, r) + case PluginServiceListTemplatesUserCanAccessProcedure: + pluginServiceListTemplatesUserCanAccessHandler.ServeHTTP(w, r) + case PluginServiceListUserTemplatesProcedure: + pluginServiceListUserTemplatesHandler.ServeHTTP(w, r) + case PluginServiceListOrganizationTemplatesProcedure: + pluginServiceListOrganizationTemplatesHandler.ServeHTTP(w, r) + case PluginServiceGetTemplateVersionProcedure: + pluginServiceGetTemplateVersionHandler.ServeHTTP(w, r) + case PluginServiceListTemplateVersionsProcedure: + pluginServiceListTemplateVersionsHandler.ServeHTTP(w, r) + case PluginServiceDeleteTemplateProcedure: + pluginServiceDeleteTemplateHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedPluginServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedPluginServiceHandler struct{} + +func (UnimplementedPluginServiceHandler) ListPlugins(context.Context, *connect_go.Request[v1alpha1.ListPluginsRequest]) (*connect_go.Response[v1alpha1.ListPluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPlugins is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListUserPlugins(context.Context, *connect_go.Request[v1alpha1.ListUserPluginsRequest]) (*connect_go.Response[v1alpha1.ListUserPluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserPlugins is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListOrganizationPlugins(context.Context, *connect_go.Request[v1alpha1.ListOrganizationPluginsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationPluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationPlugins is not implemented")) +} + +func (UnimplementedPluginServiceHandler) GetPluginVersion(context.Context, *connect_go.Request[v1alpha1.GetPluginVersionRequest]) (*connect_go.Response[v1alpha1.GetPluginVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPluginVersion is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListPluginVersions(context.Context, *connect_go.Request[v1alpha1.ListPluginVersionsRequest]) (*connect_go.Response[v1alpha1.ListPluginVersionsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPluginVersions is not implemented")) +} + +func (UnimplementedPluginServiceHandler) GetPlugin(context.Context, *connect_go.Request[v1alpha1.GetPluginRequest]) (*connect_go.Response[v1alpha1.GetPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPlugin is not implemented")) +} + +func (UnimplementedPluginServiceHandler) DeletePlugin(context.Context, *connect_go.Request[v1alpha1.DeletePluginRequest]) (*connect_go.Response[v1alpha1.DeletePluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeletePlugin is not implemented")) +} + +func (UnimplementedPluginServiceHandler) GetTemplate(context.Context, *connect_go.Request[v1alpha1.GetTemplateRequest]) (*connect_go.Response[v1alpha1.GetTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplate is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListTemplates(context.Context, *connect_go.Request[v1alpha1.ListTemplatesRequest]) (*connect_go.Response[v1alpha1.ListTemplatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplates is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListTemplatesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListTemplatesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListTemplatesUserCanAccessResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplatesUserCanAccess is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListUserTemplates(context.Context, *connect_go.Request[v1alpha1.ListUserTemplatesRequest]) (*connect_go.Response[v1alpha1.ListUserTemplatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserTemplates is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListOrganizationTemplates(context.Context, *connect_go.Request[v1alpha1.ListOrganizationTemplatesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationTemplatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationTemplates is not implemented")) +} + +func (UnimplementedPluginServiceHandler) GetTemplateVersion(context.Context, *connect_go.Request[v1alpha1.GetTemplateVersionRequest]) (*connect_go.Response[v1alpha1.GetTemplateVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplateVersion is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListTemplateVersions(context.Context, *connect_go.Request[v1alpha1.ListTemplateVersionsRequest]) (*connect_go.Response[v1alpha1.ListTemplateVersionsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplateVersions is not implemented")) +} + +func (UnimplementedPluginServiceHandler) DeleteTemplate(context.Context, *connect_go.Request[v1alpha1.DeleteTemplateRequest]) (*connect_go.Response[v1alpha1.DeleteTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeleteTemplate is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/plugin_curation.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/plugin_curation.connect.go new file mode 100644 index 000000000..a5f11ddae --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/plugin_curation.connect.go @@ -0,0 +1,300 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/plugin_curation.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // PluginCurationServiceName is the fully-qualified name of the PluginCurationService service. + PluginCurationServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService" + // CodeGenerationServiceName is the fully-qualified name of the CodeGenerationService service. + CodeGenerationServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // PluginCurationServiceListCuratedPluginsProcedure is the fully-qualified name of the + // PluginCurationService's ListCuratedPlugins RPC. + PluginCurationServiceListCuratedPluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/ListCuratedPlugins" + // PluginCurationServiceCreateCuratedPluginProcedure is the fully-qualified name of the + // PluginCurationService's CreateCuratedPlugin RPC. + PluginCurationServiceCreateCuratedPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/CreateCuratedPlugin" + // PluginCurationServiceGetLatestCuratedPluginProcedure is the fully-qualified name of the + // PluginCurationService's GetLatestCuratedPlugin RPC. + PluginCurationServiceGetLatestCuratedPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/GetLatestCuratedPlugin" + // PluginCurationServiceDeleteCuratedPluginProcedure is the fully-qualified name of the + // PluginCurationService's DeleteCuratedPlugin RPC. + PluginCurationServiceDeleteCuratedPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/DeleteCuratedPlugin" + // CodeGenerationServiceGenerateCodeProcedure is the fully-qualified name of the + // CodeGenerationService's GenerateCode RPC. + CodeGenerationServiceGenerateCodeProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService/GenerateCode" +) + +// PluginCurationServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService service. +type PluginCurationServiceClient interface { + // ListCuratedPlugins returns all the curated plugins available. + ListCuratedPlugins(context.Context, *connect_go.Request[v1alpha1.ListCuratedPluginsRequest]) (*connect_go.Response[v1alpha1.ListCuratedPluginsResponse], error) + // CreateCuratedPlugin creates a new curated plugin. + CreateCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.CreateCuratedPluginRequest]) (*connect_go.Response[v1alpha1.CreateCuratedPluginResponse], error) + // GetLatestCuratedPlugin returns the latest version of a plugin matching given parameters. + GetLatestCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.GetLatestCuratedPluginRequest]) (*connect_go.Response[v1alpha1.GetLatestCuratedPluginResponse], error) + // DeleteCuratedPlugin deletes a curated plugin based on the given parameters. + DeleteCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.DeleteCuratedPluginRequest]) (*connect_go.Response[v1alpha1.DeleteCuratedPluginResponse], error) +} + +// NewPluginCurationServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewPluginCurationServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) PluginCurationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &pluginCurationServiceClient{ + listCuratedPlugins: connect_go.NewClient[v1alpha1.ListCuratedPluginsRequest, v1alpha1.ListCuratedPluginsResponse]( + httpClient, + baseURL+PluginCurationServiceListCuratedPluginsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + createCuratedPlugin: connect_go.NewClient[v1alpha1.CreateCuratedPluginRequest, v1alpha1.CreateCuratedPluginResponse]( + httpClient, + baseURL+PluginCurationServiceCreateCuratedPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getLatestCuratedPlugin: connect_go.NewClient[v1alpha1.GetLatestCuratedPluginRequest, v1alpha1.GetLatestCuratedPluginResponse]( + httpClient, + baseURL+PluginCurationServiceGetLatestCuratedPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteCuratedPlugin: connect_go.NewClient[v1alpha1.DeleteCuratedPluginRequest, v1alpha1.DeleteCuratedPluginResponse]( + httpClient, + baseURL+PluginCurationServiceDeleteCuratedPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// pluginCurationServiceClient implements PluginCurationServiceClient. +type pluginCurationServiceClient struct { + listCuratedPlugins *connect_go.Client[v1alpha1.ListCuratedPluginsRequest, v1alpha1.ListCuratedPluginsResponse] + createCuratedPlugin *connect_go.Client[v1alpha1.CreateCuratedPluginRequest, v1alpha1.CreateCuratedPluginResponse] + getLatestCuratedPlugin *connect_go.Client[v1alpha1.GetLatestCuratedPluginRequest, v1alpha1.GetLatestCuratedPluginResponse] + deleteCuratedPlugin *connect_go.Client[v1alpha1.DeleteCuratedPluginRequest, v1alpha1.DeleteCuratedPluginResponse] +} + +// ListCuratedPlugins calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.ListCuratedPlugins. +func (c *pluginCurationServiceClient) ListCuratedPlugins(ctx context.Context, req *connect_go.Request[v1alpha1.ListCuratedPluginsRequest]) (*connect_go.Response[v1alpha1.ListCuratedPluginsResponse], error) { + return c.listCuratedPlugins.CallUnary(ctx, req) +} + +// CreateCuratedPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.CreateCuratedPlugin. +func (c *pluginCurationServiceClient) CreateCuratedPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.CreateCuratedPluginRequest]) (*connect_go.Response[v1alpha1.CreateCuratedPluginResponse], error) { + return c.createCuratedPlugin.CallUnary(ctx, req) +} + +// GetLatestCuratedPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.GetLatestCuratedPlugin. +func (c *pluginCurationServiceClient) GetLatestCuratedPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.GetLatestCuratedPluginRequest]) (*connect_go.Response[v1alpha1.GetLatestCuratedPluginResponse], error) { + return c.getLatestCuratedPlugin.CallUnary(ctx, req) +} + +// DeleteCuratedPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.DeleteCuratedPlugin. +func (c *pluginCurationServiceClient) DeleteCuratedPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteCuratedPluginRequest]) (*connect_go.Response[v1alpha1.DeleteCuratedPluginResponse], error) { + return c.deleteCuratedPlugin.CallUnary(ctx, req) +} + +// PluginCurationServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService service. +type PluginCurationServiceHandler interface { + // ListCuratedPlugins returns all the curated plugins available. + ListCuratedPlugins(context.Context, *connect_go.Request[v1alpha1.ListCuratedPluginsRequest]) (*connect_go.Response[v1alpha1.ListCuratedPluginsResponse], error) + // CreateCuratedPlugin creates a new curated plugin. + CreateCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.CreateCuratedPluginRequest]) (*connect_go.Response[v1alpha1.CreateCuratedPluginResponse], error) + // GetLatestCuratedPlugin returns the latest version of a plugin matching given parameters. + GetLatestCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.GetLatestCuratedPluginRequest]) (*connect_go.Response[v1alpha1.GetLatestCuratedPluginResponse], error) + // DeleteCuratedPlugin deletes a curated plugin based on the given parameters. + DeleteCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.DeleteCuratedPluginRequest]) (*connect_go.Response[v1alpha1.DeleteCuratedPluginResponse], error) +} + +// NewPluginCurationServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewPluginCurationServiceHandler(svc PluginCurationServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + pluginCurationServiceListCuratedPluginsHandler := connect_go.NewUnaryHandler( + PluginCurationServiceListCuratedPluginsProcedure, + svc.ListCuratedPlugins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginCurationServiceCreateCuratedPluginHandler := connect_go.NewUnaryHandler( + PluginCurationServiceCreateCuratedPluginProcedure, + svc.CreateCuratedPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + pluginCurationServiceGetLatestCuratedPluginHandler := connect_go.NewUnaryHandler( + PluginCurationServiceGetLatestCuratedPluginProcedure, + svc.GetLatestCuratedPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginCurationServiceDeleteCuratedPluginHandler := connect_go.NewUnaryHandler( + PluginCurationServiceDeleteCuratedPluginProcedure, + svc.DeleteCuratedPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case PluginCurationServiceListCuratedPluginsProcedure: + pluginCurationServiceListCuratedPluginsHandler.ServeHTTP(w, r) + case PluginCurationServiceCreateCuratedPluginProcedure: + pluginCurationServiceCreateCuratedPluginHandler.ServeHTTP(w, r) + case PluginCurationServiceGetLatestCuratedPluginProcedure: + pluginCurationServiceGetLatestCuratedPluginHandler.ServeHTTP(w, r) + case PluginCurationServiceDeleteCuratedPluginProcedure: + pluginCurationServiceDeleteCuratedPluginHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedPluginCurationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedPluginCurationServiceHandler struct{} + +func (UnimplementedPluginCurationServiceHandler) ListCuratedPlugins(context.Context, *connect_go.Request[v1alpha1.ListCuratedPluginsRequest]) (*connect_go.Response[v1alpha1.ListCuratedPluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.ListCuratedPlugins is not implemented")) +} + +func (UnimplementedPluginCurationServiceHandler) CreateCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.CreateCuratedPluginRequest]) (*connect_go.Response[v1alpha1.CreateCuratedPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.CreateCuratedPlugin is not implemented")) +} + +func (UnimplementedPluginCurationServiceHandler) GetLatestCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.GetLatestCuratedPluginRequest]) (*connect_go.Response[v1alpha1.GetLatestCuratedPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.GetLatestCuratedPlugin is not implemented")) +} + +func (UnimplementedPluginCurationServiceHandler) DeleteCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.DeleteCuratedPluginRequest]) (*connect_go.Response[v1alpha1.DeleteCuratedPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.DeleteCuratedPlugin is not implemented")) +} + +// CodeGenerationServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService service. +type CodeGenerationServiceClient interface { + // GenerateCode generates code using the specified remote plugins. + GenerateCode(context.Context, *connect_go.Request[v1alpha1.GenerateCodeRequest]) (*connect_go.Response[v1alpha1.GenerateCodeResponse], error) +} + +// NewCodeGenerationServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewCodeGenerationServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) CodeGenerationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &codeGenerationServiceClient{ + generateCode: connect_go.NewClient[v1alpha1.GenerateCodeRequest, v1alpha1.GenerateCodeResponse]( + httpClient, + baseURL+CodeGenerationServiceGenerateCodeProcedure, + opts..., + ), + } +} + +// codeGenerationServiceClient implements CodeGenerationServiceClient. +type codeGenerationServiceClient struct { + generateCode *connect_go.Client[v1alpha1.GenerateCodeRequest, v1alpha1.GenerateCodeResponse] +} + +// GenerateCode calls bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService.GenerateCode. +func (c *codeGenerationServiceClient) GenerateCode(ctx context.Context, req *connect_go.Request[v1alpha1.GenerateCodeRequest]) (*connect_go.Response[v1alpha1.GenerateCodeResponse], error) { + return c.generateCode.CallUnary(ctx, req) +} + +// CodeGenerationServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService service. +type CodeGenerationServiceHandler interface { + // GenerateCode generates code using the specified remote plugins. + GenerateCode(context.Context, *connect_go.Request[v1alpha1.GenerateCodeRequest]) (*connect_go.Response[v1alpha1.GenerateCodeResponse], error) +} + +// NewCodeGenerationServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewCodeGenerationServiceHandler(svc CodeGenerationServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + codeGenerationServiceGenerateCodeHandler := connect_go.NewUnaryHandler( + CodeGenerationServiceGenerateCodeProcedure, + svc.GenerateCode, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case CodeGenerationServiceGenerateCodeProcedure: + codeGenerationServiceGenerateCodeHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedCodeGenerationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedCodeGenerationServiceHandler struct{} + +func (UnimplementedCodeGenerationServiceHandler) GenerateCode(context.Context, *connect_go.Request[v1alpha1.GenerateCodeRequest]) (*connect_go.Response[v1alpha1.GenerateCodeResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService.GenerateCode is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/push.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/push.connect.go new file mode 100644 index 000000000..fc84b70f6 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/push.connect.go @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/push.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // PushServiceName is the fully-qualified name of the PushService service. + PushServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.PushService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // PushServicePushProcedure is the fully-qualified name of the PushService's Push RPC. + PushServicePushProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PushService/Push" + // PushServicePushManifestAndBlobsProcedure is the fully-qualified name of the PushService's + // PushManifestAndBlobs RPC. + PushServicePushManifestAndBlobsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PushService/PushManifestAndBlobs" +) + +// PushServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.PushService +// service. +type PushServiceClient interface { + // Push pushes. + // NOTE: Newer clients should use PushManifestAndBlobs. + Push(context.Context, *connect_go.Request[v1alpha1.PushRequest]) (*connect_go.Response[v1alpha1.PushResponse], error) + // PushManifestAndBlobs pushes a module by encoding it in a manifest and blobs format. + PushManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.PushManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.PushManifestAndBlobsResponse], error) +} + +// NewPushServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PushService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewPushServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) PushServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &pushServiceClient{ + push: connect_go.NewClient[v1alpha1.PushRequest, v1alpha1.PushResponse]( + httpClient, + baseURL+PushServicePushProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + pushManifestAndBlobs: connect_go.NewClient[v1alpha1.PushManifestAndBlobsRequest, v1alpha1.PushManifestAndBlobsResponse]( + httpClient, + baseURL+PushServicePushManifestAndBlobsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// pushServiceClient implements PushServiceClient. +type pushServiceClient struct { + push *connect_go.Client[v1alpha1.PushRequest, v1alpha1.PushResponse] + pushManifestAndBlobs *connect_go.Client[v1alpha1.PushManifestAndBlobsRequest, v1alpha1.PushManifestAndBlobsResponse] +} + +// Push calls bufman.dubbo.apache.org.registry.v1alpha1.PushService.Push. +func (c *pushServiceClient) Push(ctx context.Context, req *connect_go.Request[v1alpha1.PushRequest]) (*connect_go.Response[v1alpha1.PushResponse], error) { + return c.push.CallUnary(ctx, req) +} + +// PushManifestAndBlobs calls +// bufman.dubbo.apache.org.registry.v1alpha1.PushService.PushManifestAndBlobs. +func (c *pushServiceClient) PushManifestAndBlobs(ctx context.Context, req *connect_go.Request[v1alpha1.PushManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.PushManifestAndBlobsResponse], error) { + return c.pushManifestAndBlobs.CallUnary(ctx, req) +} + +// PushServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.PushService service. +type PushServiceHandler interface { + // Push pushes. + // NOTE: Newer clients should use PushManifestAndBlobs. + Push(context.Context, *connect_go.Request[v1alpha1.PushRequest]) (*connect_go.Response[v1alpha1.PushResponse], error) + // PushManifestAndBlobs pushes a module by encoding it in a manifest and blobs format. + PushManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.PushManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.PushManifestAndBlobsResponse], error) +} + +// NewPushServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewPushServiceHandler(svc PushServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + pushServicePushHandler := connect_go.NewUnaryHandler( + PushServicePushProcedure, + svc.Push, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + pushServicePushManifestAndBlobsHandler := connect_go.NewUnaryHandler( + PushServicePushManifestAndBlobsProcedure, + svc.PushManifestAndBlobs, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.PushService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case PushServicePushProcedure: + pushServicePushHandler.ServeHTTP(w, r) + case PushServicePushManifestAndBlobsProcedure: + pushServicePushManifestAndBlobsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedPushServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedPushServiceHandler struct{} + +func (UnimplementedPushServiceHandler) Push(context.Context, *connect_go.Request[v1alpha1.PushRequest]) (*connect_go.Response[v1alpha1.PushResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PushService.Push is not implemented")) +} + +func (UnimplementedPushServiceHandler) PushManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.PushManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.PushManifestAndBlobsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PushService.PushManifestAndBlobs is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/recommendation.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/recommendation.connect.go new file mode 100644 index 000000000..ab139667f --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/recommendation.connect.go @@ -0,0 +1,230 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/recommendation.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RecommendationServiceName is the fully-qualified name of the RecommendationService service. + RecommendationServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RecommendationServiceRecommendedRepositoriesProcedure is the fully-qualified name of the + // RecommendationService's RecommendedRepositories RPC. + RecommendationServiceRecommendedRepositoriesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/RecommendedRepositories" + // RecommendationServiceRecommendedTemplatesProcedure is the fully-qualified name of the + // RecommendationService's RecommendedTemplates RPC. + RecommendationServiceRecommendedTemplatesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/RecommendedTemplates" + // RecommendationServiceListRecommendedResourcesProcedure is the fully-qualified name of the + // RecommendationService's ListRecommendedResources RPC. + RecommendationServiceListRecommendedResourcesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/ListRecommendedResources" + // RecommendationServiceSetRecommendedResourcesProcedure is the fully-qualified name of the + // RecommendationService's SetRecommendedResources RPC. + RecommendationServiceSetRecommendedResourcesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/SetRecommendedResources" +) + +// RecommendationServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService service. +type RecommendationServiceClient interface { + // RecommendedRepositories returns a list of recommended repositories. + RecommendedRepositories(context.Context, *connect_go.Request[v1alpha1.RecommendedRepositoriesRequest]) (*connect_go.Response[v1alpha1.RecommendedRepositoriesResponse], error) + // RecommendedTemplates returns a list of recommended templates. + // + // Deprecated: do not use. + RecommendedTemplates(context.Context, *connect_go.Request[v1alpha1.RecommendedTemplatesRequest]) (*connect_go.Response[v1alpha1.RecommendedTemplatesResponse], error) + // ListRecommendedResources returns a list of recommended resources. + ListRecommendedResources(context.Context, *connect_go.Request[v1alpha1.ListRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.ListRecommendedResourcesResponse], error) + // SetRecommendedResources set the list of recommended resources in the server. + SetRecommendedResources(context.Context, *connect_go.Request[v1alpha1.SetRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.SetRecommendedResourcesResponse], error) +} + +// NewRecommendationServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRecommendationServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RecommendationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &recommendationServiceClient{ + recommendedRepositories: connect_go.NewClient[v1alpha1.RecommendedRepositoriesRequest, v1alpha1.RecommendedRepositoriesResponse]( + httpClient, + baseURL+RecommendationServiceRecommendedRepositoriesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + recommendedTemplates: connect_go.NewClient[v1alpha1.RecommendedTemplatesRequest, v1alpha1.RecommendedTemplatesResponse]( + httpClient, + baseURL+RecommendationServiceRecommendedTemplatesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRecommendedResources: connect_go.NewClient[v1alpha1.ListRecommendedResourcesRequest, v1alpha1.ListRecommendedResourcesResponse]( + httpClient, + baseURL+RecommendationServiceListRecommendedResourcesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + setRecommendedResources: connect_go.NewClient[v1alpha1.SetRecommendedResourcesRequest, v1alpha1.SetRecommendedResourcesResponse]( + httpClient, + baseURL+RecommendationServiceSetRecommendedResourcesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// recommendationServiceClient implements RecommendationServiceClient. +type recommendationServiceClient struct { + recommendedRepositories *connect_go.Client[v1alpha1.RecommendedRepositoriesRequest, v1alpha1.RecommendedRepositoriesResponse] + recommendedTemplates *connect_go.Client[v1alpha1.RecommendedTemplatesRequest, v1alpha1.RecommendedTemplatesResponse] + listRecommendedResources *connect_go.Client[v1alpha1.ListRecommendedResourcesRequest, v1alpha1.ListRecommendedResourcesResponse] + setRecommendedResources *connect_go.Client[v1alpha1.SetRecommendedResourcesRequest, v1alpha1.SetRecommendedResourcesResponse] +} + +// RecommendedRepositories calls +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedRepositories. +func (c *recommendationServiceClient) RecommendedRepositories(ctx context.Context, req *connect_go.Request[v1alpha1.RecommendedRepositoriesRequest]) (*connect_go.Response[v1alpha1.RecommendedRepositoriesResponse], error) { + return c.recommendedRepositories.CallUnary(ctx, req) +} + +// RecommendedTemplates calls +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedTemplates. +// +// Deprecated: do not use. +func (c *recommendationServiceClient) RecommendedTemplates(ctx context.Context, req *connect_go.Request[v1alpha1.RecommendedTemplatesRequest]) (*connect_go.Response[v1alpha1.RecommendedTemplatesResponse], error) { + return c.recommendedTemplates.CallUnary(ctx, req) +} + +// ListRecommendedResources calls +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.ListRecommendedResources. +func (c *recommendationServiceClient) ListRecommendedResources(ctx context.Context, req *connect_go.Request[v1alpha1.ListRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.ListRecommendedResourcesResponse], error) { + return c.listRecommendedResources.CallUnary(ctx, req) +} + +// SetRecommendedResources calls +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.SetRecommendedResources. +func (c *recommendationServiceClient) SetRecommendedResources(ctx context.Context, req *connect_go.Request[v1alpha1.SetRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.SetRecommendedResourcesResponse], error) { + return c.setRecommendedResources.CallUnary(ctx, req) +} + +// RecommendationServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService service. +type RecommendationServiceHandler interface { + // RecommendedRepositories returns a list of recommended repositories. + RecommendedRepositories(context.Context, *connect_go.Request[v1alpha1.RecommendedRepositoriesRequest]) (*connect_go.Response[v1alpha1.RecommendedRepositoriesResponse], error) + // RecommendedTemplates returns a list of recommended templates. + // + // Deprecated: do not use. + RecommendedTemplates(context.Context, *connect_go.Request[v1alpha1.RecommendedTemplatesRequest]) (*connect_go.Response[v1alpha1.RecommendedTemplatesResponse], error) + // ListRecommendedResources returns a list of recommended resources. + ListRecommendedResources(context.Context, *connect_go.Request[v1alpha1.ListRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.ListRecommendedResourcesResponse], error) + // SetRecommendedResources set the list of recommended resources in the server. + SetRecommendedResources(context.Context, *connect_go.Request[v1alpha1.SetRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.SetRecommendedResourcesResponse], error) +} + +// NewRecommendationServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRecommendationServiceHandler(svc RecommendationServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + recommendationServiceRecommendedRepositoriesHandler := connect_go.NewUnaryHandler( + RecommendationServiceRecommendedRepositoriesProcedure, + svc.RecommendedRepositories, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + recommendationServiceRecommendedTemplatesHandler := connect_go.NewUnaryHandler( + RecommendationServiceRecommendedTemplatesProcedure, + svc.RecommendedTemplates, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + recommendationServiceListRecommendedResourcesHandler := connect_go.NewUnaryHandler( + RecommendationServiceListRecommendedResourcesProcedure, + svc.ListRecommendedResources, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + recommendationServiceSetRecommendedResourcesHandler := connect_go.NewUnaryHandler( + RecommendationServiceSetRecommendedResourcesProcedure, + svc.SetRecommendedResources, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RecommendationServiceRecommendedRepositoriesProcedure: + recommendationServiceRecommendedRepositoriesHandler.ServeHTTP(w, r) + case RecommendationServiceRecommendedTemplatesProcedure: + recommendationServiceRecommendedTemplatesHandler.ServeHTTP(w, r) + case RecommendationServiceListRecommendedResourcesProcedure: + recommendationServiceListRecommendedResourcesHandler.ServeHTTP(w, r) + case RecommendationServiceSetRecommendedResourcesProcedure: + recommendationServiceSetRecommendedResourcesHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRecommendationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRecommendationServiceHandler struct{} + +func (UnimplementedRecommendationServiceHandler) RecommendedRepositories(context.Context, *connect_go.Request[v1alpha1.RecommendedRepositoriesRequest]) (*connect_go.Response[v1alpha1.RecommendedRepositoriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedRepositories is not implemented")) +} + +func (UnimplementedRecommendationServiceHandler) RecommendedTemplates(context.Context, *connect_go.Request[v1alpha1.RecommendedTemplatesRequest]) (*connect_go.Response[v1alpha1.RecommendedTemplatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedTemplates is not implemented")) +} + +func (UnimplementedRecommendationServiceHandler) ListRecommendedResources(context.Context, *connect_go.Request[v1alpha1.ListRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.ListRecommendedResourcesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.ListRecommendedResources is not implemented")) +} + +func (UnimplementedRecommendationServiceHandler) SetRecommendedResources(context.Context, *connect_go.Request[v1alpha1.SetRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.SetRecommendedResourcesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.SetRecommendedResources is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/reference.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/reference.connect.go new file mode 100644 index 000000000..8edf3ab61 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/reference.connect.go @@ -0,0 +1,164 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/reference.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // ReferenceServiceName is the fully-qualified name of the ReferenceService service. + ReferenceServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ReferenceServiceGetReferenceByNameProcedure is the fully-qualified name of the ReferenceService's + // GetReferenceByName RPC. + ReferenceServiceGetReferenceByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService/GetReferenceByName" + // ReferenceServiceListGitCommitMetadataForReferenceProcedure is the fully-qualified name of the + // ReferenceService's ListGitCommitMetadataForReference RPC. + ReferenceServiceListGitCommitMetadataForReferenceProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService/ListGitCommitMetadataForReference" +) + +// ReferenceServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService service. +type ReferenceServiceClient interface { + // GetReferenceByName takes a reference name and returns the + // reference either as 'main', a tag, or commit. + GetReferenceByName(context.Context, *connect_go.Request[v1alpha1.GetReferenceByNameRequest]) (*connect_go.Response[v1alpha1.GetReferenceByNameResponse], error) + // ListGitCommitMetadataForReference takes a string reference and returns all the git commit + // metadata associated with the resolved reference commit. + ListGitCommitMetadataForReference(context.Context, *connect_go.Request[v1alpha1.ListGitCommitMetadataForReferenceRequest]) (*connect_go.Response[v1alpha1.ListGitCommitMetadataForReferenceResponse], error) +} + +// NewReferenceServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewReferenceServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ReferenceServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &referenceServiceClient{ + getReferenceByName: connect_go.NewClient[v1alpha1.GetReferenceByNameRequest, v1alpha1.GetReferenceByNameResponse]( + httpClient, + baseURL+ReferenceServiceGetReferenceByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listGitCommitMetadataForReference: connect_go.NewClient[v1alpha1.ListGitCommitMetadataForReferenceRequest, v1alpha1.ListGitCommitMetadataForReferenceResponse]( + httpClient, + baseURL+ReferenceServiceListGitCommitMetadataForReferenceProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// referenceServiceClient implements ReferenceServiceClient. +type referenceServiceClient struct { + getReferenceByName *connect_go.Client[v1alpha1.GetReferenceByNameRequest, v1alpha1.GetReferenceByNameResponse] + listGitCommitMetadataForReference *connect_go.Client[v1alpha1.ListGitCommitMetadataForReferenceRequest, v1alpha1.ListGitCommitMetadataForReferenceResponse] +} + +// GetReferenceByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.GetReferenceByName. +func (c *referenceServiceClient) GetReferenceByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetReferenceByNameRequest]) (*connect_go.Response[v1alpha1.GetReferenceByNameResponse], error) { + return c.getReferenceByName.CallUnary(ctx, req) +} + +// ListGitCommitMetadataForReference calls +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.ListGitCommitMetadataForReference. +func (c *referenceServiceClient) ListGitCommitMetadataForReference(ctx context.Context, req *connect_go.Request[v1alpha1.ListGitCommitMetadataForReferenceRequest]) (*connect_go.Response[v1alpha1.ListGitCommitMetadataForReferenceResponse], error) { + return c.listGitCommitMetadataForReference.CallUnary(ctx, req) +} + +// ReferenceServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService service. +type ReferenceServiceHandler interface { + // GetReferenceByName takes a reference name and returns the + // reference either as 'main', a tag, or commit. + GetReferenceByName(context.Context, *connect_go.Request[v1alpha1.GetReferenceByNameRequest]) (*connect_go.Response[v1alpha1.GetReferenceByNameResponse], error) + // ListGitCommitMetadataForReference takes a string reference and returns all the git commit + // metadata associated with the resolved reference commit. + ListGitCommitMetadataForReference(context.Context, *connect_go.Request[v1alpha1.ListGitCommitMetadataForReferenceRequest]) (*connect_go.Response[v1alpha1.ListGitCommitMetadataForReferenceResponse], error) +} + +// NewReferenceServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewReferenceServiceHandler(svc ReferenceServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + referenceServiceGetReferenceByNameHandler := connect_go.NewUnaryHandler( + ReferenceServiceGetReferenceByNameProcedure, + svc.GetReferenceByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + referenceServiceListGitCommitMetadataForReferenceHandler := connect_go.NewUnaryHandler( + ReferenceServiceListGitCommitMetadataForReferenceProcedure, + svc.ListGitCommitMetadataForReference, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ReferenceServiceGetReferenceByNameProcedure: + referenceServiceGetReferenceByNameHandler.ServeHTTP(w, r) + case ReferenceServiceListGitCommitMetadataForReferenceProcedure: + referenceServiceListGitCommitMetadataForReferenceHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedReferenceServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedReferenceServiceHandler struct{} + +func (UnimplementedReferenceServiceHandler) GetReferenceByName(context.Context, *connect_go.Request[v1alpha1.GetReferenceByNameRequest]) (*connect_go.Response[v1alpha1.GetReferenceByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.GetReferenceByName is not implemented")) +} + +func (UnimplementedReferenceServiceHandler) ListGitCommitMetadataForReference(context.Context, *connect_go.Request[v1alpha1.ListGitCommitMetadataForReferenceRequest]) (*connect_go.Response[v1alpha1.ListGitCommitMetadataForReferenceResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.ListGitCommitMetadataForReference is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository.connect.go new file mode 100644 index 000000000..6bfe6ac1f --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository.connect.go @@ -0,0 +1,673 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/repository.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RepositoryServiceName is the fully-qualified name of the RepositoryService service. + RepositoryServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RepositoryServiceGetRepositoryProcedure is the fully-qualified name of the RepositoryService's + // GetRepository RPC. + RepositoryServiceGetRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepository" + // RepositoryServiceGetRepositoryByFullNameProcedure is the fully-qualified name of the + // RepositoryService's GetRepositoryByFullName RPC. + RepositoryServiceGetRepositoryByFullNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoryByFullName" + // RepositoryServiceListRepositoriesProcedure is the fully-qualified name of the RepositoryService's + // ListRepositories RPC. + RepositoryServiceListRepositoriesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositories" + // RepositoryServiceListUserRepositoriesProcedure is the fully-qualified name of the + // RepositoryService's ListUserRepositories RPC. + RepositoryServiceListUserRepositoriesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListUserRepositories" + // RepositoryServiceListRepositoriesUserCanAccessProcedure is the fully-qualified name of the + // RepositoryService's ListRepositoriesUserCanAccess RPC. + RepositoryServiceListRepositoriesUserCanAccessProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositoriesUserCanAccess" + // RepositoryServiceListOrganizationRepositoriesProcedure is the fully-qualified name of the + // RepositoryService's ListOrganizationRepositories RPC. + RepositoryServiceListOrganizationRepositoriesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListOrganizationRepositories" + // RepositoryServiceCreateRepositoryByFullNameProcedure is the fully-qualified name of the + // RepositoryService's CreateRepositoryByFullName RPC. + RepositoryServiceCreateRepositoryByFullNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/CreateRepositoryByFullName" + // RepositoryServiceDeleteRepositoryProcedure is the fully-qualified name of the RepositoryService's + // DeleteRepository RPC. + RepositoryServiceDeleteRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeleteRepository" + // RepositoryServiceDeleteRepositoryByFullNameProcedure is the fully-qualified name of the + // RepositoryService's DeleteRepositoryByFullName RPC. + RepositoryServiceDeleteRepositoryByFullNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeleteRepositoryByFullName" + // RepositoryServiceDeprecateRepositoryByNameProcedure is the fully-qualified name of the + // RepositoryService's DeprecateRepositoryByName RPC. + RepositoryServiceDeprecateRepositoryByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeprecateRepositoryByName" + // RepositoryServiceUndeprecateRepositoryByNameProcedure is the fully-qualified name of the + // RepositoryService's UndeprecateRepositoryByName RPC. + RepositoryServiceUndeprecateRepositoryByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/UndeprecateRepositoryByName" + // RepositoryServiceGetRepositoriesByFullNameProcedure is the fully-qualified name of the + // RepositoryService's GetRepositoriesByFullName RPC. + RepositoryServiceGetRepositoriesByFullNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoriesByFullName" + // RepositoryServiceSetRepositoryContributorProcedure is the fully-qualified name of the + // RepositoryService's SetRepositoryContributor RPC. + RepositoryServiceSetRepositoryContributorProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/SetRepositoryContributor" + // RepositoryServiceListRepositoryContributorsProcedure is the fully-qualified name of the + // RepositoryService's ListRepositoryContributors RPC. + RepositoryServiceListRepositoryContributorsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositoryContributors" + // RepositoryServiceGetRepositoryContributorProcedure is the fully-qualified name of the + // RepositoryService's GetRepositoryContributor RPC. + RepositoryServiceGetRepositoryContributorProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoryContributor" + // RepositoryServiceGetRepositorySettingsProcedure is the fully-qualified name of the + // RepositoryService's GetRepositorySettings RPC. + RepositoryServiceGetRepositorySettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositorySettings" + // RepositoryServiceUpdateRepositorySettingsByNameProcedure is the fully-qualified name of the + // RepositoryService's UpdateRepositorySettingsByName RPC. + RepositoryServiceUpdateRepositorySettingsByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/UpdateRepositorySettingsByName" + // RepositoryServiceGetRepositoriesMetadataProcedure is the fully-qualified name of the + // RepositoryService's GetRepositoriesMetadata RPC. + RepositoryServiceGetRepositoriesMetadataProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoriesMetadata" +) + +// RepositoryServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService service. +type RepositoryServiceClient interface { + // GetRepository gets a repository by ID. + GetRepository(context.Context, *connect_go.Request[v1alpha1.GetRepositoryRequest]) (*connect_go.Response[v1alpha1.GetRepositoryResponse], error) + // GetRepositoryByFullName gets a repository by full name. + GetRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoryByFullNameResponse], error) + // ListRepositories lists all repositories. + ListRepositories(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesResponse], error) + // ListUserRepositories lists all repositories belonging to a user. + ListUserRepositories(context.Context, *connect_go.Request[v1alpha1.ListUserRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListUserRepositoriesResponse], error) + // ListRepositoriesUserCanAccess lists all repositories a user can access. + ListRepositoriesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesUserCanAccessResponse], error) + // ListOrganizationRepositories lists all repositories for an organization. + ListOrganizationRepositories(context.Context, *connect_go.Request[v1alpha1.ListOrganizationRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationRepositoriesResponse], error) + // CreateRepositoryByFullName creates a new repository by full name. + CreateRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryByFullNameResponse], error) + // DeleteRepository deletes a repository. + DeleteRepository(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryResponse], error) + // DeleteRepositoryByFullName deletes a repository by full name. + DeleteRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryByFullNameResponse], error) + // DeprecateRepositoryByName deprecates the repository. + DeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.DeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.DeprecateRepositoryByNameResponse], error) + // UndeprecateRepositoryByName makes the repository not deprecated and removes any deprecation_message. + UndeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.UndeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.UndeprecateRepositoryByNameResponse], error) + // GetRepositoriesByFullName gets repositories by full name. Response order is unspecified. + // Errors if any of the repositories don't exist or the caller does not have access to any of the repositories. + GetRepositoriesByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesByFullNameResponse], error) + // SetRepositoryContributor sets the role of a user in the repository. + SetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.SetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.SetRepositoryContributorResponse], error) + // ListRepositoryContributors returns the list of contributors that has an explicit role against the repository. + // This does not include users who have implicit roles against the repository, unless they have also been + // assigned a role explicitly. + ListRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.ListRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryContributorsResponse], error) + // GetRepositoryContributor returns the contributor information of a user in a repository. + GetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.GetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.GetRepositoryContributorResponse], error) + // GetRepositorySettings gets the settings of a repository. + GetRepositorySettings(context.Context, *connect_go.Request[v1alpha1.GetRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.GetRepositorySettingsResponse], error) + // UpdateRepositorySettingsByName updates the settings of a repository. + UpdateRepositorySettingsByName(context.Context, *connect_go.Request[v1alpha1.UpdateRepositorySettingsByNameRequest]) (*connect_go.Response[v1alpha1.UpdateRepositorySettingsByNameResponse], error) + // GetRepositoriesMetadata gets the metadata of the repositories in the request, the length of repositories in the + // request should match the length of the metadata in the response, and the order of repositories in the response + // should match the order of the metadata in the request. + GetRepositoriesMetadata(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesMetadataRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesMetadataResponse], error) +} + +// NewRepositoryServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRepositoryServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RepositoryServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &repositoryServiceClient{ + getRepository: connect_go.NewClient[v1alpha1.GetRepositoryRequest, v1alpha1.GetRepositoryResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositoryByFullName: connect_go.NewClient[v1alpha1.GetRepositoryByFullNameRequest, v1alpha1.GetRepositoryByFullNameResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoryByFullNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositories: connect_go.NewClient[v1alpha1.ListRepositoriesRequest, v1alpha1.ListRepositoriesResponse]( + httpClient, + baseURL+RepositoryServiceListRepositoriesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUserRepositories: connect_go.NewClient[v1alpha1.ListUserRepositoriesRequest, v1alpha1.ListUserRepositoriesResponse]( + httpClient, + baseURL+RepositoryServiceListUserRepositoriesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositoriesUserCanAccess: connect_go.NewClient[v1alpha1.ListRepositoriesUserCanAccessRequest, v1alpha1.ListRepositoriesUserCanAccessResponse]( + httpClient, + baseURL+RepositoryServiceListRepositoriesUserCanAccessProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizationRepositories: connect_go.NewClient[v1alpha1.ListOrganizationRepositoriesRequest, v1alpha1.ListOrganizationRepositoriesResponse]( + httpClient, + baseURL+RepositoryServiceListOrganizationRepositoriesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + createRepositoryByFullName: connect_go.NewClient[v1alpha1.CreateRepositoryByFullNameRequest, v1alpha1.CreateRepositoryByFullNameResponse]( + httpClient, + baseURL+RepositoryServiceCreateRepositoryByFullNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteRepository: connect_go.NewClient[v1alpha1.DeleteRepositoryRequest, v1alpha1.DeleteRepositoryResponse]( + httpClient, + baseURL+RepositoryServiceDeleteRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteRepositoryByFullName: connect_go.NewClient[v1alpha1.DeleteRepositoryByFullNameRequest, v1alpha1.DeleteRepositoryByFullNameResponse]( + httpClient, + baseURL+RepositoryServiceDeleteRepositoryByFullNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deprecateRepositoryByName: connect_go.NewClient[v1alpha1.DeprecateRepositoryByNameRequest, v1alpha1.DeprecateRepositoryByNameResponse]( + httpClient, + baseURL+RepositoryServiceDeprecateRepositoryByNameProcedure, + opts..., + ), + undeprecateRepositoryByName: connect_go.NewClient[v1alpha1.UndeprecateRepositoryByNameRequest, v1alpha1.UndeprecateRepositoryByNameResponse]( + httpClient, + baseURL+RepositoryServiceUndeprecateRepositoryByNameProcedure, + opts..., + ), + getRepositoriesByFullName: connect_go.NewClient[v1alpha1.GetRepositoriesByFullNameRequest, v1alpha1.GetRepositoriesByFullNameResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoriesByFullNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + setRepositoryContributor: connect_go.NewClient[v1alpha1.SetRepositoryContributorRequest, v1alpha1.SetRepositoryContributorResponse]( + httpClient, + baseURL+RepositoryServiceSetRepositoryContributorProcedure, + opts..., + ), + listRepositoryContributors: connect_go.NewClient[v1alpha1.ListRepositoryContributorsRequest, v1alpha1.ListRepositoryContributorsResponse]( + httpClient, + baseURL+RepositoryServiceListRepositoryContributorsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositoryContributor: connect_go.NewClient[v1alpha1.GetRepositoryContributorRequest, v1alpha1.GetRepositoryContributorResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoryContributorProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositorySettings: connect_go.NewClient[v1alpha1.GetRepositorySettingsRequest, v1alpha1.GetRepositorySettingsResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositorySettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateRepositorySettingsByName: connect_go.NewClient[v1alpha1.UpdateRepositorySettingsByNameRequest, v1alpha1.UpdateRepositorySettingsByNameResponse]( + httpClient, + baseURL+RepositoryServiceUpdateRepositorySettingsByNameProcedure, + opts..., + ), + getRepositoriesMetadata: connect_go.NewClient[v1alpha1.GetRepositoriesMetadataRequest, v1alpha1.GetRepositoriesMetadataResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoriesMetadataProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// repositoryServiceClient implements RepositoryServiceClient. +type repositoryServiceClient struct { + getRepository *connect_go.Client[v1alpha1.GetRepositoryRequest, v1alpha1.GetRepositoryResponse] + getRepositoryByFullName *connect_go.Client[v1alpha1.GetRepositoryByFullNameRequest, v1alpha1.GetRepositoryByFullNameResponse] + listRepositories *connect_go.Client[v1alpha1.ListRepositoriesRequest, v1alpha1.ListRepositoriesResponse] + listUserRepositories *connect_go.Client[v1alpha1.ListUserRepositoriesRequest, v1alpha1.ListUserRepositoriesResponse] + listRepositoriesUserCanAccess *connect_go.Client[v1alpha1.ListRepositoriesUserCanAccessRequest, v1alpha1.ListRepositoriesUserCanAccessResponse] + listOrganizationRepositories *connect_go.Client[v1alpha1.ListOrganizationRepositoriesRequest, v1alpha1.ListOrganizationRepositoriesResponse] + createRepositoryByFullName *connect_go.Client[v1alpha1.CreateRepositoryByFullNameRequest, v1alpha1.CreateRepositoryByFullNameResponse] + deleteRepository *connect_go.Client[v1alpha1.DeleteRepositoryRequest, v1alpha1.DeleteRepositoryResponse] + deleteRepositoryByFullName *connect_go.Client[v1alpha1.DeleteRepositoryByFullNameRequest, v1alpha1.DeleteRepositoryByFullNameResponse] + deprecateRepositoryByName *connect_go.Client[v1alpha1.DeprecateRepositoryByNameRequest, v1alpha1.DeprecateRepositoryByNameResponse] + undeprecateRepositoryByName *connect_go.Client[v1alpha1.UndeprecateRepositoryByNameRequest, v1alpha1.UndeprecateRepositoryByNameResponse] + getRepositoriesByFullName *connect_go.Client[v1alpha1.GetRepositoriesByFullNameRequest, v1alpha1.GetRepositoriesByFullNameResponse] + setRepositoryContributor *connect_go.Client[v1alpha1.SetRepositoryContributorRequest, v1alpha1.SetRepositoryContributorResponse] + listRepositoryContributors *connect_go.Client[v1alpha1.ListRepositoryContributorsRequest, v1alpha1.ListRepositoryContributorsResponse] + getRepositoryContributor *connect_go.Client[v1alpha1.GetRepositoryContributorRequest, v1alpha1.GetRepositoryContributorResponse] + getRepositorySettings *connect_go.Client[v1alpha1.GetRepositorySettingsRequest, v1alpha1.GetRepositorySettingsResponse] + updateRepositorySettingsByName *connect_go.Client[v1alpha1.UpdateRepositorySettingsByNameRequest, v1alpha1.UpdateRepositorySettingsByNameResponse] + getRepositoriesMetadata *connect_go.Client[v1alpha1.GetRepositoriesMetadataRequest, v1alpha1.GetRepositoriesMetadataResponse] +} + +// GetRepository calls bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepository. +func (c *repositoryServiceClient) GetRepository(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryRequest]) (*connect_go.Response[v1alpha1.GetRepositoryResponse], error) { + return c.getRepository.CallUnary(ctx, req) +} + +// GetRepositoryByFullName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryByFullName. +func (c *repositoryServiceClient) GetRepositoryByFullName(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoryByFullNameResponse], error) { + return c.getRepositoryByFullName.CallUnary(ctx, req) +} + +// ListRepositories calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositories. +func (c *repositoryServiceClient) ListRepositories(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesResponse], error) { + return c.listRepositories.CallUnary(ctx, req) +} + +// ListUserRepositories calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListUserRepositories. +func (c *repositoryServiceClient) ListUserRepositories(ctx context.Context, req *connect_go.Request[v1alpha1.ListUserRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListUserRepositoriesResponse], error) { + return c.listUserRepositories.CallUnary(ctx, req) +} + +// ListRepositoriesUserCanAccess calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoriesUserCanAccess. +func (c *repositoryServiceClient) ListRepositoriesUserCanAccess(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoriesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesUserCanAccessResponse], error) { + return c.listRepositoriesUserCanAccess.CallUnary(ctx, req) +} + +// ListOrganizationRepositories calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListOrganizationRepositories. +func (c *repositoryServiceClient) ListOrganizationRepositories(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationRepositoriesResponse], error) { + return c.listOrganizationRepositories.CallUnary(ctx, req) +} + +// CreateRepositoryByFullName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.CreateRepositoryByFullName. +func (c *repositoryServiceClient) CreateRepositoryByFullName(ctx context.Context, req *connect_go.Request[v1alpha1.CreateRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryByFullNameResponse], error) { + return c.createRepositoryByFullName.CallUnary(ctx, req) +} + +// DeleteRepository calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepository. +func (c *repositoryServiceClient) DeleteRepository(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryResponse], error) { + return c.deleteRepository.CallUnary(ctx, req) +} + +// DeleteRepositoryByFullName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepositoryByFullName. +func (c *repositoryServiceClient) DeleteRepositoryByFullName(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryByFullNameResponse], error) { + return c.deleteRepositoryByFullName.CallUnary(ctx, req) +} + +// DeprecateRepositoryByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeprecateRepositoryByName. +func (c *repositoryServiceClient) DeprecateRepositoryByName(ctx context.Context, req *connect_go.Request[v1alpha1.DeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.DeprecateRepositoryByNameResponse], error) { + return c.deprecateRepositoryByName.CallUnary(ctx, req) +} + +// UndeprecateRepositoryByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UndeprecateRepositoryByName. +func (c *repositoryServiceClient) UndeprecateRepositoryByName(ctx context.Context, req *connect_go.Request[v1alpha1.UndeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.UndeprecateRepositoryByNameResponse], error) { + return c.undeprecateRepositoryByName.CallUnary(ctx, req) +} + +// GetRepositoriesByFullName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesByFullName. +func (c *repositoryServiceClient) GetRepositoriesByFullName(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoriesByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesByFullNameResponse], error) { + return c.getRepositoriesByFullName.CallUnary(ctx, req) +} + +// SetRepositoryContributor calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.SetRepositoryContributor. +func (c *repositoryServiceClient) SetRepositoryContributor(ctx context.Context, req *connect_go.Request[v1alpha1.SetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.SetRepositoryContributorResponse], error) { + return c.setRepositoryContributor.CallUnary(ctx, req) +} + +// ListRepositoryContributors calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoryContributors. +func (c *repositoryServiceClient) ListRepositoryContributors(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryContributorsResponse], error) { + return c.listRepositoryContributors.CallUnary(ctx, req) +} + +// GetRepositoryContributor calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryContributor. +func (c *repositoryServiceClient) GetRepositoryContributor(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.GetRepositoryContributorResponse], error) { + return c.getRepositoryContributor.CallUnary(ctx, req) +} + +// GetRepositorySettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositorySettings. +func (c *repositoryServiceClient) GetRepositorySettings(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.GetRepositorySettingsResponse], error) { + return c.getRepositorySettings.CallUnary(ctx, req) +} + +// UpdateRepositorySettingsByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UpdateRepositorySettingsByName. +func (c *repositoryServiceClient) UpdateRepositorySettingsByName(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateRepositorySettingsByNameRequest]) (*connect_go.Response[v1alpha1.UpdateRepositorySettingsByNameResponse], error) { + return c.updateRepositorySettingsByName.CallUnary(ctx, req) +} + +// GetRepositoriesMetadata calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesMetadata. +func (c *repositoryServiceClient) GetRepositoriesMetadata(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoriesMetadataRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesMetadataResponse], error) { + return c.getRepositoriesMetadata.CallUnary(ctx, req) +} + +// RepositoryServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService service. +type RepositoryServiceHandler interface { + // GetRepository gets a repository by ID. + GetRepository(context.Context, *connect_go.Request[v1alpha1.GetRepositoryRequest]) (*connect_go.Response[v1alpha1.GetRepositoryResponse], error) + // GetRepositoryByFullName gets a repository by full name. + GetRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoryByFullNameResponse], error) + // ListRepositories lists all repositories. + ListRepositories(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesResponse], error) + // ListUserRepositories lists all repositories belonging to a user. + ListUserRepositories(context.Context, *connect_go.Request[v1alpha1.ListUserRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListUserRepositoriesResponse], error) + // ListRepositoriesUserCanAccess lists all repositories a user can access. + ListRepositoriesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesUserCanAccessResponse], error) + // ListOrganizationRepositories lists all repositories for an organization. + ListOrganizationRepositories(context.Context, *connect_go.Request[v1alpha1.ListOrganizationRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationRepositoriesResponse], error) + // CreateRepositoryByFullName creates a new repository by full name. + CreateRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryByFullNameResponse], error) + // DeleteRepository deletes a repository. + DeleteRepository(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryResponse], error) + // DeleteRepositoryByFullName deletes a repository by full name. + DeleteRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryByFullNameResponse], error) + // DeprecateRepositoryByName deprecates the repository. + DeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.DeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.DeprecateRepositoryByNameResponse], error) + // UndeprecateRepositoryByName makes the repository not deprecated and removes any deprecation_message. + UndeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.UndeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.UndeprecateRepositoryByNameResponse], error) + // GetRepositoriesByFullName gets repositories by full name. Response order is unspecified. + // Errors if any of the repositories don't exist or the caller does not have access to any of the repositories. + GetRepositoriesByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesByFullNameResponse], error) + // SetRepositoryContributor sets the role of a user in the repository. + SetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.SetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.SetRepositoryContributorResponse], error) + // ListRepositoryContributors returns the list of contributors that has an explicit role against the repository. + // This does not include users who have implicit roles against the repository, unless they have also been + // assigned a role explicitly. + ListRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.ListRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryContributorsResponse], error) + // GetRepositoryContributor returns the contributor information of a user in a repository. + GetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.GetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.GetRepositoryContributorResponse], error) + // GetRepositorySettings gets the settings of a repository. + GetRepositorySettings(context.Context, *connect_go.Request[v1alpha1.GetRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.GetRepositorySettingsResponse], error) + // UpdateRepositorySettingsByName updates the settings of a repository. + UpdateRepositorySettingsByName(context.Context, *connect_go.Request[v1alpha1.UpdateRepositorySettingsByNameRequest]) (*connect_go.Response[v1alpha1.UpdateRepositorySettingsByNameResponse], error) + // GetRepositoriesMetadata gets the metadata of the repositories in the request, the length of repositories in the + // request should match the length of the metadata in the response, and the order of repositories in the response + // should match the order of the metadata in the request. + GetRepositoriesMetadata(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesMetadataRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesMetadataResponse], error) +} + +// NewRepositoryServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRepositoryServiceHandler(svc RepositoryServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + repositoryServiceGetRepositoryHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoryProcedure, + svc.GetRepository, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceGetRepositoryByFullNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoryByFullNameProcedure, + svc.GetRepositoryByFullName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceListRepositoriesHandler := connect_go.NewUnaryHandler( + RepositoryServiceListRepositoriesProcedure, + svc.ListRepositories, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceListUserRepositoriesHandler := connect_go.NewUnaryHandler( + RepositoryServiceListUserRepositoriesProcedure, + svc.ListUserRepositories, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceListRepositoriesUserCanAccessHandler := connect_go.NewUnaryHandler( + RepositoryServiceListRepositoriesUserCanAccessProcedure, + svc.ListRepositoriesUserCanAccess, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceListOrganizationRepositoriesHandler := connect_go.NewUnaryHandler( + RepositoryServiceListOrganizationRepositoriesProcedure, + svc.ListOrganizationRepositories, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceCreateRepositoryByFullNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceCreateRepositoryByFullNameProcedure, + svc.CreateRepositoryByFullName, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceDeleteRepositoryHandler := connect_go.NewUnaryHandler( + RepositoryServiceDeleteRepositoryProcedure, + svc.DeleteRepository, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceDeleteRepositoryByFullNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceDeleteRepositoryByFullNameProcedure, + svc.DeleteRepositoryByFullName, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceDeprecateRepositoryByNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceDeprecateRepositoryByNameProcedure, + svc.DeprecateRepositoryByName, + opts..., + ) + repositoryServiceUndeprecateRepositoryByNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceUndeprecateRepositoryByNameProcedure, + svc.UndeprecateRepositoryByName, + opts..., + ) + repositoryServiceGetRepositoriesByFullNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoriesByFullNameProcedure, + svc.GetRepositoriesByFullName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceSetRepositoryContributorHandler := connect_go.NewUnaryHandler( + RepositoryServiceSetRepositoryContributorProcedure, + svc.SetRepositoryContributor, + opts..., + ) + repositoryServiceListRepositoryContributorsHandler := connect_go.NewUnaryHandler( + RepositoryServiceListRepositoryContributorsProcedure, + svc.ListRepositoryContributors, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceGetRepositoryContributorHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoryContributorProcedure, + svc.GetRepositoryContributor, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceGetRepositorySettingsHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositorySettingsProcedure, + svc.GetRepositorySettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceUpdateRepositorySettingsByNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceUpdateRepositorySettingsByNameProcedure, + svc.UpdateRepositorySettingsByName, + opts..., + ) + repositoryServiceGetRepositoriesMetadataHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoriesMetadataProcedure, + svc.GetRepositoriesMetadata, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RepositoryServiceGetRepositoryProcedure: + repositoryServiceGetRepositoryHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositoryByFullNameProcedure: + repositoryServiceGetRepositoryByFullNameHandler.ServeHTTP(w, r) + case RepositoryServiceListRepositoriesProcedure: + repositoryServiceListRepositoriesHandler.ServeHTTP(w, r) + case RepositoryServiceListUserRepositoriesProcedure: + repositoryServiceListUserRepositoriesHandler.ServeHTTP(w, r) + case RepositoryServiceListRepositoriesUserCanAccessProcedure: + repositoryServiceListRepositoriesUserCanAccessHandler.ServeHTTP(w, r) + case RepositoryServiceListOrganizationRepositoriesProcedure: + repositoryServiceListOrganizationRepositoriesHandler.ServeHTTP(w, r) + case RepositoryServiceCreateRepositoryByFullNameProcedure: + repositoryServiceCreateRepositoryByFullNameHandler.ServeHTTP(w, r) + case RepositoryServiceDeleteRepositoryProcedure: + repositoryServiceDeleteRepositoryHandler.ServeHTTP(w, r) + case RepositoryServiceDeleteRepositoryByFullNameProcedure: + repositoryServiceDeleteRepositoryByFullNameHandler.ServeHTTP(w, r) + case RepositoryServiceDeprecateRepositoryByNameProcedure: + repositoryServiceDeprecateRepositoryByNameHandler.ServeHTTP(w, r) + case RepositoryServiceUndeprecateRepositoryByNameProcedure: + repositoryServiceUndeprecateRepositoryByNameHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositoriesByFullNameProcedure: + repositoryServiceGetRepositoriesByFullNameHandler.ServeHTTP(w, r) + case RepositoryServiceSetRepositoryContributorProcedure: + repositoryServiceSetRepositoryContributorHandler.ServeHTTP(w, r) + case RepositoryServiceListRepositoryContributorsProcedure: + repositoryServiceListRepositoryContributorsHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositoryContributorProcedure: + repositoryServiceGetRepositoryContributorHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositorySettingsProcedure: + repositoryServiceGetRepositorySettingsHandler.ServeHTTP(w, r) + case RepositoryServiceUpdateRepositorySettingsByNameProcedure: + repositoryServiceUpdateRepositorySettingsByNameHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositoriesMetadataProcedure: + repositoryServiceGetRepositoriesMetadataHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRepositoryServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRepositoryServiceHandler struct{} + +func (UnimplementedRepositoryServiceHandler) GetRepository(context.Context, *connect_go.Request[v1alpha1.GetRepositoryRequest]) (*connect_go.Response[v1alpha1.GetRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepository is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoryByFullNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryByFullName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListRepositories(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositories is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListUserRepositories(context.Context, *connect_go.Request[v1alpha1.ListUserRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListUserRepositoriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListUserRepositories is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListRepositoriesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesUserCanAccessResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoriesUserCanAccess is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListOrganizationRepositories(context.Context, *connect_go.Request[v1alpha1.ListOrganizationRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationRepositoriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListOrganizationRepositories is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) CreateRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryByFullNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.CreateRepositoryByFullName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) DeleteRepository(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepository is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) DeleteRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryByFullNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepositoryByFullName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) DeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.DeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.DeprecateRepositoryByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeprecateRepositoryByName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) UndeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.UndeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.UndeprecateRepositoryByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UndeprecateRepositoryByName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositoriesByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesByFullNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesByFullName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) SetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.SetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.SetRepositoryContributorResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.SetRepositoryContributor is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.ListRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryContributorsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoryContributors is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.GetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.GetRepositoryContributorResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryContributor is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositorySettings(context.Context, *connect_go.Request[v1alpha1.GetRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.GetRepositorySettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositorySettings is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) UpdateRepositorySettingsByName(context.Context, *connect_go.Request[v1alpha1.UpdateRepositorySettingsByNameRequest]) (*connect_go.Response[v1alpha1.UpdateRepositorySettingsByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UpdateRepositorySettingsByName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositoriesMetadata(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesMetadataRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesMetadataResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesMetadata is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_branch.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_branch.connect.go new file mode 100644 index 000000000..0f1705dad --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_branch.connect.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/repository_branch.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RepositoryBranchServiceName is the fully-qualified name of the RepositoryBranchService service. + RepositoryBranchServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RepositoryBranchServiceListRepositoryBranchesProcedure is the fully-qualified name of the + // RepositoryBranchService's ListRepositoryBranches RPC. + RepositoryBranchServiceListRepositoryBranchesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService/ListRepositoryBranches" +) + +// RepositoryBranchServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService service. +type RepositoryBranchServiceClient interface { + // ListRepositoryBranchs lists the repository branches associated with a Repository. + ListRepositoryBranches(context.Context, *connect_go.Request[v1alpha1.ListRepositoryBranchesRequest]) (*connect_go.Response[v1alpha1.ListRepositoryBranchesResponse], error) +} + +// NewRepositoryBranchServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRepositoryBranchServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RepositoryBranchServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &repositoryBranchServiceClient{ + listRepositoryBranches: connect_go.NewClient[v1alpha1.ListRepositoryBranchesRequest, v1alpha1.ListRepositoryBranchesResponse]( + httpClient, + baseURL+RepositoryBranchServiceListRepositoryBranchesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// repositoryBranchServiceClient implements RepositoryBranchServiceClient. +type repositoryBranchServiceClient struct { + listRepositoryBranches *connect_go.Client[v1alpha1.ListRepositoryBranchesRequest, v1alpha1.ListRepositoryBranchesResponse] +} + +// ListRepositoryBranches calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService.ListRepositoryBranches. +func (c *repositoryBranchServiceClient) ListRepositoryBranches(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryBranchesRequest]) (*connect_go.Response[v1alpha1.ListRepositoryBranchesResponse], error) { + return c.listRepositoryBranches.CallUnary(ctx, req) +} + +// RepositoryBranchServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService service. +type RepositoryBranchServiceHandler interface { + // ListRepositoryBranchs lists the repository branches associated with a Repository. + ListRepositoryBranches(context.Context, *connect_go.Request[v1alpha1.ListRepositoryBranchesRequest]) (*connect_go.Response[v1alpha1.ListRepositoryBranchesResponse], error) +} + +// NewRepositoryBranchServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRepositoryBranchServiceHandler(svc RepositoryBranchServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + repositoryBranchServiceListRepositoryBranchesHandler := connect_go.NewUnaryHandler( + RepositoryBranchServiceListRepositoryBranchesProcedure, + svc.ListRepositoryBranches, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RepositoryBranchServiceListRepositoryBranchesProcedure: + repositoryBranchServiceListRepositoryBranchesHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRepositoryBranchServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRepositoryBranchServiceHandler struct{} + +func (UnimplementedRepositoryBranchServiceHandler) ListRepositoryBranches(context.Context, *connect_go.Request[v1alpha1.ListRepositoryBranchesRequest]) (*connect_go.Response[v1alpha1.ListRepositoryBranchesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService.ListRepositoryBranches is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_commit.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_commit.connect.go new file mode 100644 index 000000000..bd404c34e --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_commit.connect.go @@ -0,0 +1,302 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/repository_commit.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RepositoryCommitServiceName is the fully-qualified name of the RepositoryCommitService service. + RepositoryCommitServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RepositoryCommitServiceListRepositoryCommitsByBranchProcedure is the fully-qualified name of the + // RepositoryCommitService's ListRepositoryCommitsByBranch RPC. + RepositoryCommitServiceListRepositoryCommitsByBranchProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryCommitsByBranch" + // RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure is the fully-qualified name of + // the RepositoryCommitService's ListRepositoryCommitsByReference RPC. + RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryCommitsByReference" + // RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure is the fully-qualified name of the + // RepositoryCommitService's GetRepositoryCommitByReference RPC. + RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/GetRepositoryCommitByReference" + // RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure is the fully-qualified name of + // the RepositoryCommitService's GetRepositoryCommitBySequenceId RPC. + RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/GetRepositoryCommitBySequenceId" + // RepositoryCommitServiceListRepositoryDraftCommitsProcedure is the fully-qualified name of the + // RepositoryCommitService's ListRepositoryDraftCommits RPC. + RepositoryCommitServiceListRepositoryDraftCommitsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryDraftCommits" + // RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure is the fully-qualified name of the + // RepositoryCommitService's DeleteRepositoryDraftCommit RPC. + RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/DeleteRepositoryDraftCommit" +) + +// RepositoryCommitServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService service. +type RepositoryCommitServiceClient interface { + // ListRepositoryCommitsByBranch lists the repository commits associated + // with a repository branch on a repository, ordered by their create time. + // + // Deprecated: do not use. + ListRepositoryCommitsByBranch(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByBranchRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByBranchResponse], error) + // ListRepositoryCommitsByReference returns repository commits up-to and including + // the provided reference. + ListRepositoryCommitsByReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByReferenceResponse], error) + // GetRepositoryCommitByReference returns the repository commit matching + // the provided reference, if it exists. + GetRepositoryCommitByReference(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitByReferenceRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitByReferenceResponse], error) + // GetRepositoryCommitBySequenceId returns the repository commit matching + // the provided sequence ID and branch, if it exists. + GetRepositoryCommitBySequenceId(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitBySequenceIdRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitBySequenceIdResponse], error) + // ListRepositoryDraftCommits lists draft commits in a repository. + ListRepositoryDraftCommits(context.Context, *connect_go.Request[v1alpha1.ListRepositoryDraftCommitsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryDraftCommitsResponse], error) + // DeleteRepositoryDraftCommit deletes a draft. + DeleteRepositoryDraftCommit(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryDraftCommitRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryDraftCommitResponse], error) +} + +// NewRepositoryCommitServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRepositoryCommitServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RepositoryCommitServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &repositoryCommitServiceClient{ + listRepositoryCommitsByBranch: connect_go.NewClient[v1alpha1.ListRepositoryCommitsByBranchRequest, v1alpha1.ListRepositoryCommitsByBranchResponse]( + httpClient, + baseURL+RepositoryCommitServiceListRepositoryCommitsByBranchProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositoryCommitsByReference: connect_go.NewClient[v1alpha1.ListRepositoryCommitsByReferenceRequest, v1alpha1.ListRepositoryCommitsByReferenceResponse]( + httpClient, + baseURL+RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositoryCommitByReference: connect_go.NewClient[v1alpha1.GetRepositoryCommitByReferenceRequest, v1alpha1.GetRepositoryCommitByReferenceResponse]( + httpClient, + baseURL+RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositoryCommitBySequenceId: connect_go.NewClient[v1alpha1.GetRepositoryCommitBySequenceIdRequest, v1alpha1.GetRepositoryCommitBySequenceIdResponse]( + httpClient, + baseURL+RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositoryDraftCommits: connect_go.NewClient[v1alpha1.ListRepositoryDraftCommitsRequest, v1alpha1.ListRepositoryDraftCommitsResponse]( + httpClient, + baseURL+RepositoryCommitServiceListRepositoryDraftCommitsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteRepositoryDraftCommit: connect_go.NewClient[v1alpha1.DeleteRepositoryDraftCommitRequest, v1alpha1.DeleteRepositoryDraftCommitResponse]( + httpClient, + baseURL+RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// repositoryCommitServiceClient implements RepositoryCommitServiceClient. +type repositoryCommitServiceClient struct { + listRepositoryCommitsByBranch *connect_go.Client[v1alpha1.ListRepositoryCommitsByBranchRequest, v1alpha1.ListRepositoryCommitsByBranchResponse] + listRepositoryCommitsByReference *connect_go.Client[v1alpha1.ListRepositoryCommitsByReferenceRequest, v1alpha1.ListRepositoryCommitsByReferenceResponse] + getRepositoryCommitByReference *connect_go.Client[v1alpha1.GetRepositoryCommitByReferenceRequest, v1alpha1.GetRepositoryCommitByReferenceResponse] + getRepositoryCommitBySequenceId *connect_go.Client[v1alpha1.GetRepositoryCommitBySequenceIdRequest, v1alpha1.GetRepositoryCommitBySequenceIdResponse] + listRepositoryDraftCommits *connect_go.Client[v1alpha1.ListRepositoryDraftCommitsRequest, v1alpha1.ListRepositoryDraftCommitsResponse] + deleteRepositoryDraftCommit *connect_go.Client[v1alpha1.DeleteRepositoryDraftCommitRequest, v1alpha1.DeleteRepositoryDraftCommitResponse] +} + +// ListRepositoryCommitsByBranch calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByBranch. +// +// Deprecated: do not use. +func (c *repositoryCommitServiceClient) ListRepositoryCommitsByBranch(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryCommitsByBranchRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByBranchResponse], error) { + return c.listRepositoryCommitsByBranch.CallUnary(ctx, req) +} + +// ListRepositoryCommitsByReference calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByReference. +func (c *repositoryCommitServiceClient) ListRepositoryCommitsByReference(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryCommitsByReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByReferenceResponse], error) { + return c.listRepositoryCommitsByReference.CallUnary(ctx, req) +} + +// GetRepositoryCommitByReference calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitByReference. +func (c *repositoryCommitServiceClient) GetRepositoryCommitByReference(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryCommitByReferenceRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitByReferenceResponse], error) { + return c.getRepositoryCommitByReference.CallUnary(ctx, req) +} + +// GetRepositoryCommitBySequenceId calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitBySequenceId. +func (c *repositoryCommitServiceClient) GetRepositoryCommitBySequenceId(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryCommitBySequenceIdRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitBySequenceIdResponse], error) { + return c.getRepositoryCommitBySequenceId.CallUnary(ctx, req) +} + +// ListRepositoryDraftCommits calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryDraftCommits. +func (c *repositoryCommitServiceClient) ListRepositoryDraftCommits(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryDraftCommitsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryDraftCommitsResponse], error) { + return c.listRepositoryDraftCommits.CallUnary(ctx, req) +} + +// DeleteRepositoryDraftCommit calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.DeleteRepositoryDraftCommit. +func (c *repositoryCommitServiceClient) DeleteRepositoryDraftCommit(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteRepositoryDraftCommitRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryDraftCommitResponse], error) { + return c.deleteRepositoryDraftCommit.CallUnary(ctx, req) +} + +// RepositoryCommitServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService service. +type RepositoryCommitServiceHandler interface { + // ListRepositoryCommitsByBranch lists the repository commits associated + // with a repository branch on a repository, ordered by their create time. + // + // Deprecated: do not use. + ListRepositoryCommitsByBranch(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByBranchRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByBranchResponse], error) + // ListRepositoryCommitsByReference returns repository commits up-to and including + // the provided reference. + ListRepositoryCommitsByReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByReferenceResponse], error) + // GetRepositoryCommitByReference returns the repository commit matching + // the provided reference, if it exists. + GetRepositoryCommitByReference(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitByReferenceRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitByReferenceResponse], error) + // GetRepositoryCommitBySequenceId returns the repository commit matching + // the provided sequence ID and branch, if it exists. + GetRepositoryCommitBySequenceId(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitBySequenceIdRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitBySequenceIdResponse], error) + // ListRepositoryDraftCommits lists draft commits in a repository. + ListRepositoryDraftCommits(context.Context, *connect_go.Request[v1alpha1.ListRepositoryDraftCommitsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryDraftCommitsResponse], error) + // DeleteRepositoryDraftCommit deletes a draft. + DeleteRepositoryDraftCommit(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryDraftCommitRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryDraftCommitResponse], error) +} + +// NewRepositoryCommitServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRepositoryCommitServiceHandler(svc RepositoryCommitServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + repositoryCommitServiceListRepositoryCommitsByBranchHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceListRepositoryCommitsByBranchProcedure, + svc.ListRepositoryCommitsByBranch, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceListRepositoryCommitsByReferenceHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure, + svc.ListRepositoryCommitsByReference, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceGetRepositoryCommitByReferenceHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure, + svc.GetRepositoryCommitByReference, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceGetRepositoryCommitBySequenceIdHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure, + svc.GetRepositoryCommitBySequenceId, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceListRepositoryDraftCommitsHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceListRepositoryDraftCommitsProcedure, + svc.ListRepositoryDraftCommits, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceDeleteRepositoryDraftCommitHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure, + svc.DeleteRepositoryDraftCommit, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RepositoryCommitServiceListRepositoryCommitsByBranchProcedure: + repositoryCommitServiceListRepositoryCommitsByBranchHandler.ServeHTTP(w, r) + case RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure: + repositoryCommitServiceListRepositoryCommitsByReferenceHandler.ServeHTTP(w, r) + case RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure: + repositoryCommitServiceGetRepositoryCommitByReferenceHandler.ServeHTTP(w, r) + case RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure: + repositoryCommitServiceGetRepositoryCommitBySequenceIdHandler.ServeHTTP(w, r) + case RepositoryCommitServiceListRepositoryDraftCommitsProcedure: + repositoryCommitServiceListRepositoryDraftCommitsHandler.ServeHTTP(w, r) + case RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure: + repositoryCommitServiceDeleteRepositoryDraftCommitHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRepositoryCommitServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRepositoryCommitServiceHandler struct{} + +func (UnimplementedRepositoryCommitServiceHandler) ListRepositoryCommitsByBranch(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByBranchRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByBranchResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByBranch is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) ListRepositoryCommitsByReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByReferenceResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByReference is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) GetRepositoryCommitByReference(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitByReferenceRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitByReferenceResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitByReference is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) GetRepositoryCommitBySequenceId(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitBySequenceIdRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitBySequenceIdResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitBySequenceId is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) ListRepositoryDraftCommits(context.Context, *connect_go.Request[v1alpha1.ListRepositoryDraftCommitsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryDraftCommitsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryDraftCommits is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) DeleteRepositoryDraftCommit(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryDraftCommitRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryDraftCommitResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.DeleteRepositoryDraftCommit is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_tag.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_tag.connect.go new file mode 100644 index 000000000..b1630ea49 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/repository_tag.connect.go @@ -0,0 +1,194 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/repository_tag.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RepositoryTagServiceName is the fully-qualified name of the RepositoryTagService service. + RepositoryTagServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RepositoryTagServiceCreateRepositoryTagProcedure is the fully-qualified name of the + // RepositoryTagService's CreateRepositoryTag RPC. + RepositoryTagServiceCreateRepositoryTagProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/CreateRepositoryTag" + // RepositoryTagServiceListRepositoryTagsProcedure is the fully-qualified name of the + // RepositoryTagService's ListRepositoryTags RPC. + RepositoryTagServiceListRepositoryTagsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/ListRepositoryTags" + // RepositoryTagServiceListRepositoryTagsForReferenceProcedure is the fully-qualified name of the + // RepositoryTagService's ListRepositoryTagsForReference RPC. + RepositoryTagServiceListRepositoryTagsForReferenceProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/ListRepositoryTagsForReference" +) + +// RepositoryTagServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService service. +type RepositoryTagServiceClient interface { + // CreateRepositoryTag creates a new repository tag. + CreateRepositoryTag(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryTagRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryTagResponse], error) + // ListRepositoryTags lists the repository tags associated with a Repository. + ListRepositoryTags(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsResponse], error) + // ListRepositoryTagsForReference lists the repository tags associated with a repository + // reference name. + ListRepositoryTagsForReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsForReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsForReferenceResponse], error) +} + +// NewRepositoryTagServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRepositoryTagServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RepositoryTagServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &repositoryTagServiceClient{ + createRepositoryTag: connect_go.NewClient[v1alpha1.CreateRepositoryTagRequest, v1alpha1.CreateRepositoryTagResponse]( + httpClient, + baseURL+RepositoryTagServiceCreateRepositoryTagProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + listRepositoryTags: connect_go.NewClient[v1alpha1.ListRepositoryTagsRequest, v1alpha1.ListRepositoryTagsResponse]( + httpClient, + baseURL+RepositoryTagServiceListRepositoryTagsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositoryTagsForReference: connect_go.NewClient[v1alpha1.ListRepositoryTagsForReferenceRequest, v1alpha1.ListRepositoryTagsForReferenceResponse]( + httpClient, + baseURL+RepositoryTagServiceListRepositoryTagsForReferenceProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// repositoryTagServiceClient implements RepositoryTagServiceClient. +type repositoryTagServiceClient struct { + createRepositoryTag *connect_go.Client[v1alpha1.CreateRepositoryTagRequest, v1alpha1.CreateRepositoryTagResponse] + listRepositoryTags *connect_go.Client[v1alpha1.ListRepositoryTagsRequest, v1alpha1.ListRepositoryTagsResponse] + listRepositoryTagsForReference *connect_go.Client[v1alpha1.ListRepositoryTagsForReferenceRequest, v1alpha1.ListRepositoryTagsForReferenceResponse] +} + +// CreateRepositoryTag calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.CreateRepositoryTag. +func (c *repositoryTagServiceClient) CreateRepositoryTag(ctx context.Context, req *connect_go.Request[v1alpha1.CreateRepositoryTagRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryTagResponse], error) { + return c.createRepositoryTag.CallUnary(ctx, req) +} + +// ListRepositoryTags calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTags. +func (c *repositoryTagServiceClient) ListRepositoryTags(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryTagsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsResponse], error) { + return c.listRepositoryTags.CallUnary(ctx, req) +} + +// ListRepositoryTagsForReference calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTagsForReference. +func (c *repositoryTagServiceClient) ListRepositoryTagsForReference(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryTagsForReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsForReferenceResponse], error) { + return c.listRepositoryTagsForReference.CallUnary(ctx, req) +} + +// RepositoryTagServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService service. +type RepositoryTagServiceHandler interface { + // CreateRepositoryTag creates a new repository tag. + CreateRepositoryTag(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryTagRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryTagResponse], error) + // ListRepositoryTags lists the repository tags associated with a Repository. + ListRepositoryTags(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsResponse], error) + // ListRepositoryTagsForReference lists the repository tags associated with a repository + // reference name. + ListRepositoryTagsForReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsForReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsForReferenceResponse], error) +} + +// NewRepositoryTagServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRepositoryTagServiceHandler(svc RepositoryTagServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + repositoryTagServiceCreateRepositoryTagHandler := connect_go.NewUnaryHandler( + RepositoryTagServiceCreateRepositoryTagProcedure, + svc.CreateRepositoryTag, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + repositoryTagServiceListRepositoryTagsHandler := connect_go.NewUnaryHandler( + RepositoryTagServiceListRepositoryTagsProcedure, + svc.ListRepositoryTags, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryTagServiceListRepositoryTagsForReferenceHandler := connect_go.NewUnaryHandler( + RepositoryTagServiceListRepositoryTagsForReferenceProcedure, + svc.ListRepositoryTagsForReference, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RepositoryTagServiceCreateRepositoryTagProcedure: + repositoryTagServiceCreateRepositoryTagHandler.ServeHTTP(w, r) + case RepositoryTagServiceListRepositoryTagsProcedure: + repositoryTagServiceListRepositoryTagsHandler.ServeHTTP(w, r) + case RepositoryTagServiceListRepositoryTagsForReferenceProcedure: + repositoryTagServiceListRepositoryTagsForReferenceHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRepositoryTagServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRepositoryTagServiceHandler struct{} + +func (UnimplementedRepositoryTagServiceHandler) CreateRepositoryTag(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryTagRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryTagResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.CreateRepositoryTag is not implemented")) +} + +func (UnimplementedRepositoryTagServiceHandler) ListRepositoryTags(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTags is not implemented")) +} + +func (UnimplementedRepositoryTagServiceHandler) ListRepositoryTagsForReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsForReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsForReferenceResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTagsForReference is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/resolve.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/resolve.connect.go new file mode 100644 index 000000000..0d4af6deb --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/resolve.connect.go @@ -0,0 +1,364 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/resolve.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // ResolveServiceName is the fully-qualified name of the ResolveService service. + ResolveServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ResolveService" + // LocalResolveServiceName is the fully-qualified name of the LocalResolveService service. + LocalResolveServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ResolveServiceGetModulePinsProcedure is the fully-qualified name of the ResolveService's + // GetModulePins RPC. + ResolveServiceGetModulePinsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetModulePins" + // ResolveServiceGetGoVersionProcedure is the fully-qualified name of the ResolveService's + // GetGoVersion RPC. + ResolveServiceGetGoVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetGoVersion" + // ResolveServiceGetSwiftVersionProcedure is the fully-qualified name of the ResolveService's + // GetSwiftVersion RPC. + ResolveServiceGetSwiftVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetSwiftVersion" + // ResolveServiceGetMavenVersionProcedure is the fully-qualified name of the ResolveService's + // GetMavenVersion RPC. + ResolveServiceGetMavenVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetMavenVersion" + // ResolveServiceGetNPMVersionProcedure is the fully-qualified name of the ResolveService's + // GetNPMVersion RPC. + ResolveServiceGetNPMVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetNPMVersion" + // LocalResolveServiceGetLocalModulePinsProcedure is the fully-qualified name of the + // LocalResolveService's GetLocalModulePins RPC. + LocalResolveServiceGetLocalModulePinsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService/GetLocalModulePins" +) + +// ResolveServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.ResolveService +// service. +type ResolveServiceClient interface { + // GetModulePins finds all the latest digests and respective dependencies of + // the provided module references and picks a set of distinct modules pins. + // + // Note that module references with commits should still be passed to this function + // to make sure this function can do dependency resolution. + // + // This function also deals with tiebreaking what ModulePin wins for the same repository. + GetModulePins(context.Context, *connect_go.Request[v1alpha1.GetModulePinsRequest]) (*connect_go.Response[v1alpha1.GetModulePinsResponse], error) + // GetGoVersion resolves the given plugin and module references to a version. + GetGoVersion(context.Context, *connect_go.Request[v1alpha1.GetGoVersionRequest]) (*connect_go.Response[v1alpha1.GetGoVersionResponse], error) + // GetSwiftVersion resolves the given plugin and module references to a version. + GetSwiftVersion(context.Context, *connect_go.Request[v1alpha1.GetSwiftVersionRequest]) (*connect_go.Response[v1alpha1.GetSwiftVersionResponse], error) + // GetMavenVersion resolves the given plugin and module references to a version. + GetMavenVersion(context.Context, *connect_go.Request[v1alpha1.GetMavenVersionRequest]) (*connect_go.Response[v1alpha1.GetMavenVersionResponse], error) + // GetNPMVersion resolves the given plugin and module references to a version. + GetNPMVersion(context.Context, *connect_go.Request[v1alpha1.GetNPMVersionRequest]) (*connect_go.Response[v1alpha1.GetNPMVersionResponse], error) +} + +// NewResolveServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewResolveServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ResolveServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &resolveServiceClient{ + getModulePins: connect_go.NewClient[v1alpha1.GetModulePinsRequest, v1alpha1.GetModulePinsResponse]( + httpClient, + baseURL+ResolveServiceGetModulePinsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getGoVersion: connect_go.NewClient[v1alpha1.GetGoVersionRequest, v1alpha1.GetGoVersionResponse]( + httpClient, + baseURL+ResolveServiceGetGoVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getSwiftVersion: connect_go.NewClient[v1alpha1.GetSwiftVersionRequest, v1alpha1.GetSwiftVersionResponse]( + httpClient, + baseURL+ResolveServiceGetSwiftVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getMavenVersion: connect_go.NewClient[v1alpha1.GetMavenVersionRequest, v1alpha1.GetMavenVersionResponse]( + httpClient, + baseURL+ResolveServiceGetMavenVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getNPMVersion: connect_go.NewClient[v1alpha1.GetNPMVersionRequest, v1alpha1.GetNPMVersionResponse]( + httpClient, + baseURL+ResolveServiceGetNPMVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// resolveServiceClient implements ResolveServiceClient. +type resolveServiceClient struct { + getModulePins *connect_go.Client[v1alpha1.GetModulePinsRequest, v1alpha1.GetModulePinsResponse] + getGoVersion *connect_go.Client[v1alpha1.GetGoVersionRequest, v1alpha1.GetGoVersionResponse] + getSwiftVersion *connect_go.Client[v1alpha1.GetSwiftVersionRequest, v1alpha1.GetSwiftVersionResponse] + getMavenVersion *connect_go.Client[v1alpha1.GetMavenVersionRequest, v1alpha1.GetMavenVersionResponse] + getNPMVersion *connect_go.Client[v1alpha1.GetNPMVersionRequest, v1alpha1.GetNPMVersionResponse] +} + +// GetModulePins calls bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetModulePins. +func (c *resolveServiceClient) GetModulePins(ctx context.Context, req *connect_go.Request[v1alpha1.GetModulePinsRequest]) (*connect_go.Response[v1alpha1.GetModulePinsResponse], error) { + return c.getModulePins.CallUnary(ctx, req) +} + +// GetGoVersion calls bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetGoVersion. +func (c *resolveServiceClient) GetGoVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetGoVersionRequest]) (*connect_go.Response[v1alpha1.GetGoVersionResponse], error) { + return c.getGoVersion.CallUnary(ctx, req) +} + +// GetSwiftVersion calls bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetSwiftVersion. +func (c *resolveServiceClient) GetSwiftVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetSwiftVersionRequest]) (*connect_go.Response[v1alpha1.GetSwiftVersionResponse], error) { + return c.getSwiftVersion.CallUnary(ctx, req) +} + +// GetMavenVersion calls bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetMavenVersion. +func (c *resolveServiceClient) GetMavenVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetMavenVersionRequest]) (*connect_go.Response[v1alpha1.GetMavenVersionResponse], error) { + return c.getMavenVersion.CallUnary(ctx, req) +} + +// GetNPMVersion calls bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetNPMVersion. +func (c *resolveServiceClient) GetNPMVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetNPMVersionRequest]) (*connect_go.Response[v1alpha1.GetNPMVersionResponse], error) { + return c.getNPMVersion.CallUnary(ctx, req) +} + +// ResolveServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService service. +type ResolveServiceHandler interface { + // GetModulePins finds all the latest digests and respective dependencies of + // the provided module references and picks a set of distinct modules pins. + // + // Note that module references with commits should still be passed to this function + // to make sure this function can do dependency resolution. + // + // This function also deals with tiebreaking what ModulePin wins for the same repository. + GetModulePins(context.Context, *connect_go.Request[v1alpha1.GetModulePinsRequest]) (*connect_go.Response[v1alpha1.GetModulePinsResponse], error) + // GetGoVersion resolves the given plugin and module references to a version. + GetGoVersion(context.Context, *connect_go.Request[v1alpha1.GetGoVersionRequest]) (*connect_go.Response[v1alpha1.GetGoVersionResponse], error) + // GetSwiftVersion resolves the given plugin and module references to a version. + GetSwiftVersion(context.Context, *connect_go.Request[v1alpha1.GetSwiftVersionRequest]) (*connect_go.Response[v1alpha1.GetSwiftVersionResponse], error) + // GetMavenVersion resolves the given plugin and module references to a version. + GetMavenVersion(context.Context, *connect_go.Request[v1alpha1.GetMavenVersionRequest]) (*connect_go.Response[v1alpha1.GetMavenVersionResponse], error) + // GetNPMVersion resolves the given plugin and module references to a version. + GetNPMVersion(context.Context, *connect_go.Request[v1alpha1.GetNPMVersionRequest]) (*connect_go.Response[v1alpha1.GetNPMVersionResponse], error) +} + +// NewResolveServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewResolveServiceHandler(svc ResolveServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + resolveServiceGetModulePinsHandler := connect_go.NewUnaryHandler( + ResolveServiceGetModulePinsProcedure, + svc.GetModulePins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + resolveServiceGetGoVersionHandler := connect_go.NewUnaryHandler( + ResolveServiceGetGoVersionProcedure, + svc.GetGoVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + resolveServiceGetSwiftVersionHandler := connect_go.NewUnaryHandler( + ResolveServiceGetSwiftVersionProcedure, + svc.GetSwiftVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + resolveServiceGetMavenVersionHandler := connect_go.NewUnaryHandler( + ResolveServiceGetMavenVersionProcedure, + svc.GetMavenVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + resolveServiceGetNPMVersionHandler := connect_go.NewUnaryHandler( + ResolveServiceGetNPMVersionProcedure, + svc.GetNPMVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ResolveServiceGetModulePinsProcedure: + resolveServiceGetModulePinsHandler.ServeHTTP(w, r) + case ResolveServiceGetGoVersionProcedure: + resolveServiceGetGoVersionHandler.ServeHTTP(w, r) + case ResolveServiceGetSwiftVersionProcedure: + resolveServiceGetSwiftVersionHandler.ServeHTTP(w, r) + case ResolveServiceGetMavenVersionProcedure: + resolveServiceGetMavenVersionHandler.ServeHTTP(w, r) + case ResolveServiceGetNPMVersionProcedure: + resolveServiceGetNPMVersionHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedResolveServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedResolveServiceHandler struct{} + +func (UnimplementedResolveServiceHandler) GetModulePins(context.Context, *connect_go.Request[v1alpha1.GetModulePinsRequest]) (*connect_go.Response[v1alpha1.GetModulePinsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetModulePins is not implemented")) +} + +func (UnimplementedResolveServiceHandler) GetGoVersion(context.Context, *connect_go.Request[v1alpha1.GetGoVersionRequest]) (*connect_go.Response[v1alpha1.GetGoVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetGoVersion is not implemented")) +} + +func (UnimplementedResolveServiceHandler) GetSwiftVersion(context.Context, *connect_go.Request[v1alpha1.GetSwiftVersionRequest]) (*connect_go.Response[v1alpha1.GetSwiftVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetSwiftVersion is not implemented")) +} + +func (UnimplementedResolveServiceHandler) GetMavenVersion(context.Context, *connect_go.Request[v1alpha1.GetMavenVersionRequest]) (*connect_go.Response[v1alpha1.GetMavenVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetMavenVersion is not implemented")) +} + +func (UnimplementedResolveServiceHandler) GetNPMVersion(context.Context, *connect_go.Request[v1alpha1.GetNPMVersionRequest]) (*connect_go.Response[v1alpha1.GetNPMVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetNPMVersion is not implemented")) +} + +// LocalResolveServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService service. +type LocalResolveServiceClient interface { + // GetLocalModulePins gets the latest pins for the specified local module references. + // It also includes all of the modules transitive dependencies for the specified references. + // + // We want this for two reasons: + // + // 1. It makes it easy to say "we know we're looking for owner/repo on this specific remote". + // While we could just do this in GetModulePins by being aware of what our remote is + // (something we probably still need to know, DNS problems aside, which are more + // theoretical), this helps. + // 2. Having a separate method makes us able to say "do not make decisions about what + // wins between competing pins for the same repo". This should only be done in + // GetModulePins, not in this function, i.e. only done at the top level. + GetLocalModulePins(context.Context, *connect_go.Request[v1alpha1.GetLocalModulePinsRequest]) (*connect_go.Response[v1alpha1.GetLocalModulePinsResponse], error) +} + +// NewLocalResolveServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewLocalResolveServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) LocalResolveServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &localResolveServiceClient{ + getLocalModulePins: connect_go.NewClient[v1alpha1.GetLocalModulePinsRequest, v1alpha1.GetLocalModulePinsResponse]( + httpClient, + baseURL+LocalResolveServiceGetLocalModulePinsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// localResolveServiceClient implements LocalResolveServiceClient. +type localResolveServiceClient struct { + getLocalModulePins *connect_go.Client[v1alpha1.GetLocalModulePinsRequest, v1alpha1.GetLocalModulePinsResponse] +} + +// GetLocalModulePins calls +// bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService.GetLocalModulePins. +func (c *localResolveServiceClient) GetLocalModulePins(ctx context.Context, req *connect_go.Request[v1alpha1.GetLocalModulePinsRequest]) (*connect_go.Response[v1alpha1.GetLocalModulePinsResponse], error) { + return c.getLocalModulePins.CallUnary(ctx, req) +} + +// LocalResolveServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService service. +type LocalResolveServiceHandler interface { + // GetLocalModulePins gets the latest pins for the specified local module references. + // It also includes all of the modules transitive dependencies for the specified references. + // + // We want this for two reasons: + // + // 1. It makes it easy to say "we know we're looking for owner/repo on this specific remote". + // While we could just do this in GetModulePins by being aware of what our remote is + // (something we probably still need to know, DNS problems aside, which are more + // theoretical), this helps. + // 2. Having a separate method makes us able to say "do not make decisions about what + // wins between competing pins for the same repo". This should only be done in + // GetModulePins, not in this function, i.e. only done at the top level. + GetLocalModulePins(context.Context, *connect_go.Request[v1alpha1.GetLocalModulePinsRequest]) (*connect_go.Response[v1alpha1.GetLocalModulePinsResponse], error) +} + +// NewLocalResolveServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewLocalResolveServiceHandler(svc LocalResolveServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + localResolveServiceGetLocalModulePinsHandler := connect_go.NewUnaryHandler( + LocalResolveServiceGetLocalModulePinsProcedure, + svc.GetLocalModulePins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case LocalResolveServiceGetLocalModulePinsProcedure: + localResolveServiceGetLocalModulePinsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedLocalResolveServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedLocalResolveServiceHandler struct{} + +func (UnimplementedLocalResolveServiceHandler) GetLocalModulePins(context.Context, *connect_go.Request[v1alpha1.GetLocalModulePinsRequest]) (*connect_go.Response[v1alpha1.GetLocalModulePinsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService.GetLocalModulePins is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/resource.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/resource.connect.go new file mode 100644 index 000000000..99215c79c --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/resource.connect.go @@ -0,0 +1,130 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/resource.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // ResourceServiceName is the fully-qualified name of the ResourceService service. + ResourceServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ResourceService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ResourceServiceGetResourceByNameProcedure is the fully-qualified name of the ResourceService's + // GetResourceByName RPC. + ResourceServiceGetResourceByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResourceService/GetResourceByName" +) + +// ResourceServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ResourceService service. +type ResourceServiceClient interface { + // GetResourceByName takes a resource name and returns the + // resource either as a repository or a plugin. + GetResourceByName(context.Context, *connect_go.Request[v1alpha1.GetResourceByNameRequest]) (*connect_go.Response[v1alpha1.GetResourceByNameResponse], error) +} + +// NewResourceServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ResourceService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewResourceServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ResourceServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &resourceServiceClient{ + getResourceByName: connect_go.NewClient[v1alpha1.GetResourceByNameRequest, v1alpha1.GetResourceByNameResponse]( + httpClient, + baseURL+ResourceServiceGetResourceByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// resourceServiceClient implements ResourceServiceClient. +type resourceServiceClient struct { + getResourceByName *connect_go.Client[v1alpha1.GetResourceByNameRequest, v1alpha1.GetResourceByNameResponse] +} + +// GetResourceByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.ResourceService.GetResourceByName. +func (c *resourceServiceClient) GetResourceByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetResourceByNameRequest]) (*connect_go.Response[v1alpha1.GetResourceByNameResponse], error) { + return c.getResourceByName.CallUnary(ctx, req) +} + +// ResourceServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ResourceService service. +type ResourceServiceHandler interface { + // GetResourceByName takes a resource name and returns the + // resource either as a repository or a plugin. + GetResourceByName(context.Context, *connect_go.Request[v1alpha1.GetResourceByNameRequest]) (*connect_go.Response[v1alpha1.GetResourceByNameResponse], error) +} + +// NewResourceServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewResourceServiceHandler(svc ResourceServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + resourceServiceGetResourceByNameHandler := connect_go.NewUnaryHandler( + ResourceServiceGetResourceByNameProcedure, + svc.GetResourceByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ResourceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ResourceServiceGetResourceByNameProcedure: + resourceServiceGetResourceByNameHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedResourceServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedResourceServiceHandler struct{} + +func (UnimplementedResourceServiceHandler) GetResourceByName(context.Context, *connect_go.Request[v1alpha1.GetResourceByNameRequest]) (*connect_go.Response[v1alpha1.GetResourceByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResourceService.GetResourceByName is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/schema.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/schema.connect.go new file mode 100644 index 000000000..cd08b7ec1 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/schema.connect.go @@ -0,0 +1,159 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/schema.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // SchemaServiceName is the fully-qualified name of the SchemaService service. + SchemaServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.SchemaService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SchemaServiceGetSchemaProcedure is the fully-qualified name of the SchemaService's GetSchema RPC. + SchemaServiceGetSchemaProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SchemaService/GetSchema" + // SchemaServiceConvertMessageProcedure is the fully-qualified name of the SchemaService's + // ConvertMessage RPC. + SchemaServiceConvertMessageProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SchemaService/ConvertMessage" +) + +// SchemaServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.SchemaService +// service. +type SchemaServiceClient interface { + // GetSchema allows the caller to download a schema for one or more requested + // types, RPC services, or RPC methods. + GetSchema(context.Context, *connect_go.Request[v1alpha1.GetSchemaRequest]) (*connect_go.Response[v1alpha1.GetSchemaResponse], error) + // ConvertMessage allows the caller to convert a given message data blob from + // one format to another by referring to a type schema for the blob. + ConvertMessage(context.Context, *connect_go.Request[v1alpha1.ConvertMessageRequest]) (*connect_go.Response[v1alpha1.ConvertMessageResponse], error) +} + +// NewSchemaServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SchemaService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewSchemaServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SchemaServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &schemaServiceClient{ + getSchema: connect_go.NewClient[v1alpha1.GetSchemaRequest, v1alpha1.GetSchemaResponse]( + httpClient, + baseURL+SchemaServiceGetSchemaProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + convertMessage: connect_go.NewClient[v1alpha1.ConvertMessageRequest, v1alpha1.ConvertMessageResponse]( + httpClient, + baseURL+SchemaServiceConvertMessageProcedure, + opts..., + ), + } +} + +// schemaServiceClient implements SchemaServiceClient. +type schemaServiceClient struct { + getSchema *connect_go.Client[v1alpha1.GetSchemaRequest, v1alpha1.GetSchemaResponse] + convertMessage *connect_go.Client[v1alpha1.ConvertMessageRequest, v1alpha1.ConvertMessageResponse] +} + +// GetSchema calls bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.GetSchema. +func (c *schemaServiceClient) GetSchema(ctx context.Context, req *connect_go.Request[v1alpha1.GetSchemaRequest]) (*connect_go.Response[v1alpha1.GetSchemaResponse], error) { + return c.getSchema.CallUnary(ctx, req) +} + +// ConvertMessage calls bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.ConvertMessage. +func (c *schemaServiceClient) ConvertMessage(ctx context.Context, req *connect_go.Request[v1alpha1.ConvertMessageRequest]) (*connect_go.Response[v1alpha1.ConvertMessageResponse], error) { + return c.convertMessage.CallUnary(ctx, req) +} + +// SchemaServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.SchemaService service. +type SchemaServiceHandler interface { + // GetSchema allows the caller to download a schema for one or more requested + // types, RPC services, or RPC methods. + GetSchema(context.Context, *connect_go.Request[v1alpha1.GetSchemaRequest]) (*connect_go.Response[v1alpha1.GetSchemaResponse], error) + // ConvertMessage allows the caller to convert a given message data blob from + // one format to another by referring to a type schema for the blob. + ConvertMessage(context.Context, *connect_go.Request[v1alpha1.ConvertMessageRequest]) (*connect_go.Response[v1alpha1.ConvertMessageResponse], error) +} + +// NewSchemaServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewSchemaServiceHandler(svc SchemaServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + schemaServiceGetSchemaHandler := connect_go.NewUnaryHandler( + SchemaServiceGetSchemaProcedure, + svc.GetSchema, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + schemaServiceConvertMessageHandler := connect_go.NewUnaryHandler( + SchemaServiceConvertMessageProcedure, + svc.ConvertMessage, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.SchemaService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SchemaServiceGetSchemaProcedure: + schemaServiceGetSchemaHandler.ServeHTTP(w, r) + case SchemaServiceConvertMessageProcedure: + schemaServiceConvertMessageHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSchemaServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSchemaServiceHandler struct{} + +func (UnimplementedSchemaServiceHandler) GetSchema(context.Context, *connect_go.Request[v1alpha1.GetSchemaRequest]) (*connect_go.Response[v1alpha1.GetSchemaResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.GetSchema is not implemented")) +} + +func (UnimplementedSchemaServiceHandler) ConvertMessage(context.Context, *connect_go.Request[v1alpha1.ConvertMessageRequest]) (*connect_go.Response[v1alpha1.ConvertMessageResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.ConvertMessage is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/scim_token.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/scim_token.connect.go new file mode 100644 index 000000000..592829636 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/scim_token.connect.go @@ -0,0 +1,199 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/scim_token.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // SCIMTokenServiceName is the fully-qualified name of the SCIMTokenService service. + SCIMTokenServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SCIMTokenServiceCreateSCIMTokenProcedure is the fully-qualified name of the SCIMTokenService's + // CreateSCIMToken RPC. + SCIMTokenServiceCreateSCIMTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/CreateSCIMToken" + // SCIMTokenServiceListSCIMTokensProcedure is the fully-qualified name of the SCIMTokenService's + // ListSCIMTokens RPC. + SCIMTokenServiceListSCIMTokensProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/ListSCIMTokens" + // SCIMTokenServiceDeleteSCIMTokenProcedure is the fully-qualified name of the SCIMTokenService's + // DeleteSCIMToken RPC. + SCIMTokenServiceDeleteSCIMTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/DeleteSCIMToken" +) + +// SCIMTokenServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService service. +type SCIMTokenServiceClient interface { + // CreateToken creates a new token suitable for authentication to the SCIM API. + // + // This method requires authentication. + CreateSCIMToken(context.Context, *connect_go.Request[v1alpha1.CreateSCIMTokenRequest]) (*connect_go.Response[v1alpha1.CreateSCIMTokenResponse], error) + // ListTokens lists all active SCIM tokens. + // + // This method requires authentication. + ListSCIMTokens(context.Context, *connect_go.Request[v1alpha1.ListSCIMTokensRequest]) (*connect_go.Response[v1alpha1.ListSCIMTokensResponse], error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteSCIMToken(context.Context, *connect_go.Request[v1alpha1.DeleteSCIMTokenRequest]) (*connect_go.Response[v1alpha1.DeleteSCIMTokenResponse], error) +} + +// NewSCIMTokenServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewSCIMTokenServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SCIMTokenServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &sCIMTokenServiceClient{ + createSCIMToken: connect_go.NewClient[v1alpha1.CreateSCIMTokenRequest, v1alpha1.CreateSCIMTokenResponse]( + httpClient, + baseURL+SCIMTokenServiceCreateSCIMTokenProcedure, + opts..., + ), + listSCIMTokens: connect_go.NewClient[v1alpha1.ListSCIMTokensRequest, v1alpha1.ListSCIMTokensResponse]( + httpClient, + baseURL+SCIMTokenServiceListSCIMTokensProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteSCIMToken: connect_go.NewClient[v1alpha1.DeleteSCIMTokenRequest, v1alpha1.DeleteSCIMTokenResponse]( + httpClient, + baseURL+SCIMTokenServiceDeleteSCIMTokenProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// sCIMTokenServiceClient implements SCIMTokenServiceClient. +type sCIMTokenServiceClient struct { + createSCIMToken *connect_go.Client[v1alpha1.CreateSCIMTokenRequest, v1alpha1.CreateSCIMTokenResponse] + listSCIMTokens *connect_go.Client[v1alpha1.ListSCIMTokensRequest, v1alpha1.ListSCIMTokensResponse] + deleteSCIMToken *connect_go.Client[v1alpha1.DeleteSCIMTokenRequest, v1alpha1.DeleteSCIMTokenResponse] +} + +// CreateSCIMToken calls bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.CreateSCIMToken. +func (c *sCIMTokenServiceClient) CreateSCIMToken(ctx context.Context, req *connect_go.Request[v1alpha1.CreateSCIMTokenRequest]) (*connect_go.Response[v1alpha1.CreateSCIMTokenResponse], error) { + return c.createSCIMToken.CallUnary(ctx, req) +} + +// ListSCIMTokens calls bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.ListSCIMTokens. +func (c *sCIMTokenServiceClient) ListSCIMTokens(ctx context.Context, req *connect_go.Request[v1alpha1.ListSCIMTokensRequest]) (*connect_go.Response[v1alpha1.ListSCIMTokensResponse], error) { + return c.listSCIMTokens.CallUnary(ctx, req) +} + +// DeleteSCIMToken calls bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.DeleteSCIMToken. +func (c *sCIMTokenServiceClient) DeleteSCIMToken(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteSCIMTokenRequest]) (*connect_go.Response[v1alpha1.DeleteSCIMTokenResponse], error) { + return c.deleteSCIMToken.CallUnary(ctx, req) +} + +// SCIMTokenServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService service. +type SCIMTokenServiceHandler interface { + // CreateToken creates a new token suitable for authentication to the SCIM API. + // + // This method requires authentication. + CreateSCIMToken(context.Context, *connect_go.Request[v1alpha1.CreateSCIMTokenRequest]) (*connect_go.Response[v1alpha1.CreateSCIMTokenResponse], error) + // ListTokens lists all active SCIM tokens. + // + // This method requires authentication. + ListSCIMTokens(context.Context, *connect_go.Request[v1alpha1.ListSCIMTokensRequest]) (*connect_go.Response[v1alpha1.ListSCIMTokensResponse], error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteSCIMToken(context.Context, *connect_go.Request[v1alpha1.DeleteSCIMTokenRequest]) (*connect_go.Response[v1alpha1.DeleteSCIMTokenResponse], error) +} + +// NewSCIMTokenServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewSCIMTokenServiceHandler(svc SCIMTokenServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + sCIMTokenServiceCreateSCIMTokenHandler := connect_go.NewUnaryHandler( + SCIMTokenServiceCreateSCIMTokenProcedure, + svc.CreateSCIMToken, + opts..., + ) + sCIMTokenServiceListSCIMTokensHandler := connect_go.NewUnaryHandler( + SCIMTokenServiceListSCIMTokensProcedure, + svc.ListSCIMTokens, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + sCIMTokenServiceDeleteSCIMTokenHandler := connect_go.NewUnaryHandler( + SCIMTokenServiceDeleteSCIMTokenProcedure, + svc.DeleteSCIMToken, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SCIMTokenServiceCreateSCIMTokenProcedure: + sCIMTokenServiceCreateSCIMTokenHandler.ServeHTTP(w, r) + case SCIMTokenServiceListSCIMTokensProcedure: + sCIMTokenServiceListSCIMTokensHandler.ServeHTTP(w, r) + case SCIMTokenServiceDeleteSCIMTokenProcedure: + sCIMTokenServiceDeleteSCIMTokenHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSCIMTokenServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSCIMTokenServiceHandler struct{} + +func (UnimplementedSCIMTokenServiceHandler) CreateSCIMToken(context.Context, *connect_go.Request[v1alpha1.CreateSCIMTokenRequest]) (*connect_go.Response[v1alpha1.CreateSCIMTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.CreateSCIMToken is not implemented")) +} + +func (UnimplementedSCIMTokenServiceHandler) ListSCIMTokens(context.Context, *connect_go.Request[v1alpha1.ListSCIMTokensRequest]) (*connect_go.Response[v1alpha1.ListSCIMTokensResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.ListSCIMTokens is not implemented")) +} + +func (UnimplementedSCIMTokenServiceHandler) DeleteSCIMToken(context.Context, *connect_go.Request[v1alpha1.DeleteSCIMTokenRequest]) (*connect_go.Response[v1alpha1.DeleteSCIMTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.DeleteSCIMToken is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/search.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/search.connect.go new file mode 100644 index 000000000..abb43e6b7 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/search.connect.go @@ -0,0 +1,285 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/search.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // SearchServiceName is the fully-qualified name of the SearchService service. + SearchServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.SearchService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SearchServiceSearchUserProcedure is the fully-qualified name of the SearchService's SearchUser + // RPC. + SearchServiceSearchUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchUser" + // SearchServiceSearchRepositoryProcedure is the fully-qualified name of the SearchService's + // SearchRepository RPC. + SearchServiceSearchRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchRepository" + // SearchServiceSearchLastCommitByContentProcedure is the fully-qualified name of the + // SearchService's SearchLastCommitByContent RPC. + SearchServiceSearchLastCommitByContentProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchLastCommitByContent" + // SearchServiceSearchCurationPluginProcedure is the fully-qualified name of the SearchService's + // SearchCurationPlugin RPC. + SearchServiceSearchCurationPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchCurationPlugin" + // SearchServiceSearchTagProcedure is the fully-qualified name of the SearchService's SearchTag RPC. + SearchServiceSearchTagProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchTag" + // SearchServiceSearchDraftProcedure is the fully-qualified name of the SearchService's SearchDraft + // RPC. + SearchServiceSearchDraftProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchDraft" +) + +// SearchServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.SearchService +// service. +type SearchServiceClient interface { + // SearchUser searches users by username + SearchUser(context.Context, *connect_go.Request[v1alpha1.SearchUserRequest]) (*connect_go.Response[v1alpha1.SearchUserResponse], error) + // SearchRepository searches repositories by name or description + SearchRepository(context.Context, *connect_go.Request[v1alpha1.SearchRepositoryRequest]) (*connect_go.Response[v1alpha1.SearchRepositoryResponse], error) + // SearchCommitByContent searches last commit in same repo by idl content + // that means, for a repo, search results only record last matched commit + SearchLastCommitByContent(context.Context, *connect_go.Request[v1alpha1.SearchLastCommitByContentRequest]) (*connect_go.Response[v1alpha1.SearchLastCommitByContentResponse], error) + // SearchCurationPlugin search plugins by name or description + SearchCurationPlugin(context.Context, *connect_go.Request[v1alpha1.SearchCuratedPluginRequest]) (*connect_go.Response[v1alpha1.SearchCuratedPluginResponse], error) + // SearchTag searches for tags in a repository + SearchTag(context.Context, *connect_go.Request[v1alpha1.SearchTagRequest]) (*connect_go.Response[v1alpha1.SearchTagResponse], error) + // SearchDraft searches for drafts in a repository + SearchDraft(context.Context, *connect_go.Request[v1alpha1.SearchDraftRequest]) (*connect_go.Response[v1alpha1.SearchDraftResponse], error) +} + +// NewSearchServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewSearchServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SearchServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &searchServiceClient{ + searchUser: connect_go.NewClient[v1alpha1.SearchUserRequest, v1alpha1.SearchUserResponse]( + httpClient, + baseURL+SearchServiceSearchUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchRepository: connect_go.NewClient[v1alpha1.SearchRepositoryRequest, v1alpha1.SearchRepositoryResponse]( + httpClient, + baseURL+SearchServiceSearchRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchLastCommitByContent: connect_go.NewClient[v1alpha1.SearchLastCommitByContentRequest, v1alpha1.SearchLastCommitByContentResponse]( + httpClient, + baseURL+SearchServiceSearchLastCommitByContentProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchCurationPlugin: connect_go.NewClient[v1alpha1.SearchCuratedPluginRequest, v1alpha1.SearchCuratedPluginResponse]( + httpClient, + baseURL+SearchServiceSearchCurationPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchTag: connect_go.NewClient[v1alpha1.SearchTagRequest, v1alpha1.SearchTagResponse]( + httpClient, + baseURL+SearchServiceSearchTagProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchDraft: connect_go.NewClient[v1alpha1.SearchDraftRequest, v1alpha1.SearchDraftResponse]( + httpClient, + baseURL+SearchServiceSearchDraftProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// searchServiceClient implements SearchServiceClient. +type searchServiceClient struct { + searchUser *connect_go.Client[v1alpha1.SearchUserRequest, v1alpha1.SearchUserResponse] + searchRepository *connect_go.Client[v1alpha1.SearchRepositoryRequest, v1alpha1.SearchRepositoryResponse] + searchLastCommitByContent *connect_go.Client[v1alpha1.SearchLastCommitByContentRequest, v1alpha1.SearchLastCommitByContentResponse] + searchCurationPlugin *connect_go.Client[v1alpha1.SearchCuratedPluginRequest, v1alpha1.SearchCuratedPluginResponse] + searchTag *connect_go.Client[v1alpha1.SearchTagRequest, v1alpha1.SearchTagResponse] + searchDraft *connect_go.Client[v1alpha1.SearchDraftRequest, v1alpha1.SearchDraftResponse] +} + +// SearchUser calls bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchUser. +func (c *searchServiceClient) SearchUser(ctx context.Context, req *connect_go.Request[v1alpha1.SearchUserRequest]) (*connect_go.Response[v1alpha1.SearchUserResponse], error) { + return c.searchUser.CallUnary(ctx, req) +} + +// SearchRepository calls bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchRepository. +func (c *searchServiceClient) SearchRepository(ctx context.Context, req *connect_go.Request[v1alpha1.SearchRepositoryRequest]) (*connect_go.Response[v1alpha1.SearchRepositoryResponse], error) { + return c.searchRepository.CallUnary(ctx, req) +} + +// SearchLastCommitByContent calls +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchLastCommitByContent. +func (c *searchServiceClient) SearchLastCommitByContent(ctx context.Context, req *connect_go.Request[v1alpha1.SearchLastCommitByContentRequest]) (*connect_go.Response[v1alpha1.SearchLastCommitByContentResponse], error) { + return c.searchLastCommitByContent.CallUnary(ctx, req) +} + +// SearchCurationPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchCurationPlugin. +func (c *searchServiceClient) SearchCurationPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.SearchCuratedPluginRequest]) (*connect_go.Response[v1alpha1.SearchCuratedPluginResponse], error) { + return c.searchCurationPlugin.CallUnary(ctx, req) +} + +// SearchTag calls bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchTag. +func (c *searchServiceClient) SearchTag(ctx context.Context, req *connect_go.Request[v1alpha1.SearchTagRequest]) (*connect_go.Response[v1alpha1.SearchTagResponse], error) { + return c.searchTag.CallUnary(ctx, req) +} + +// SearchDraft calls bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchDraft. +func (c *searchServiceClient) SearchDraft(ctx context.Context, req *connect_go.Request[v1alpha1.SearchDraftRequest]) (*connect_go.Response[v1alpha1.SearchDraftResponse], error) { + return c.searchDraft.CallUnary(ctx, req) +} + +// SearchServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService service. +type SearchServiceHandler interface { + // SearchUser searches users by username + SearchUser(context.Context, *connect_go.Request[v1alpha1.SearchUserRequest]) (*connect_go.Response[v1alpha1.SearchUserResponse], error) + // SearchRepository searches repositories by name or description + SearchRepository(context.Context, *connect_go.Request[v1alpha1.SearchRepositoryRequest]) (*connect_go.Response[v1alpha1.SearchRepositoryResponse], error) + // SearchCommitByContent searches last commit in same repo by idl content + // that means, for a repo, search results only record last matched commit + SearchLastCommitByContent(context.Context, *connect_go.Request[v1alpha1.SearchLastCommitByContentRequest]) (*connect_go.Response[v1alpha1.SearchLastCommitByContentResponse], error) + // SearchCurationPlugin search plugins by name or description + SearchCurationPlugin(context.Context, *connect_go.Request[v1alpha1.SearchCuratedPluginRequest]) (*connect_go.Response[v1alpha1.SearchCuratedPluginResponse], error) + // SearchTag searches for tags in a repository + SearchTag(context.Context, *connect_go.Request[v1alpha1.SearchTagRequest]) (*connect_go.Response[v1alpha1.SearchTagResponse], error) + // SearchDraft searches for drafts in a repository + SearchDraft(context.Context, *connect_go.Request[v1alpha1.SearchDraftRequest]) (*connect_go.Response[v1alpha1.SearchDraftResponse], error) +} + +// NewSearchServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewSearchServiceHandler(svc SearchServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + searchServiceSearchUserHandler := connect_go.NewUnaryHandler( + SearchServiceSearchUserProcedure, + svc.SearchUser, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchRepositoryHandler := connect_go.NewUnaryHandler( + SearchServiceSearchRepositoryProcedure, + svc.SearchRepository, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchLastCommitByContentHandler := connect_go.NewUnaryHandler( + SearchServiceSearchLastCommitByContentProcedure, + svc.SearchLastCommitByContent, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchCurationPluginHandler := connect_go.NewUnaryHandler( + SearchServiceSearchCurationPluginProcedure, + svc.SearchCurationPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchTagHandler := connect_go.NewUnaryHandler( + SearchServiceSearchTagProcedure, + svc.SearchTag, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchDraftHandler := connect_go.NewUnaryHandler( + SearchServiceSearchDraftProcedure, + svc.SearchDraft, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SearchServiceSearchUserProcedure: + searchServiceSearchUserHandler.ServeHTTP(w, r) + case SearchServiceSearchRepositoryProcedure: + searchServiceSearchRepositoryHandler.ServeHTTP(w, r) + case SearchServiceSearchLastCommitByContentProcedure: + searchServiceSearchLastCommitByContentHandler.ServeHTTP(w, r) + case SearchServiceSearchCurationPluginProcedure: + searchServiceSearchCurationPluginHandler.ServeHTTP(w, r) + case SearchServiceSearchTagProcedure: + searchServiceSearchTagHandler.ServeHTTP(w, r) + case SearchServiceSearchDraftProcedure: + searchServiceSearchDraftHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSearchServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSearchServiceHandler struct{} + +func (UnimplementedSearchServiceHandler) SearchUser(context.Context, *connect_go.Request[v1alpha1.SearchUserRequest]) (*connect_go.Response[v1alpha1.SearchUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchUser is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchRepository(context.Context, *connect_go.Request[v1alpha1.SearchRepositoryRequest]) (*connect_go.Response[v1alpha1.SearchRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchRepository is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchLastCommitByContent(context.Context, *connect_go.Request[v1alpha1.SearchLastCommitByContentRequest]) (*connect_go.Response[v1alpha1.SearchLastCommitByContentResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchLastCommitByContent is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchCurationPlugin(context.Context, *connect_go.Request[v1alpha1.SearchCuratedPluginRequest]) (*connect_go.Response[v1alpha1.SearchCuratedPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchCurationPlugin is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchTag(context.Context, *connect_go.Request[v1alpha1.SearchTagRequest]) (*connect_go.Response[v1alpha1.SearchTagResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchTag is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchDraft(context.Context, *connect_go.Request[v1alpha1.SearchDraftRequest]) (*connect_go.Response[v1alpha1.SearchDraftResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchDraft is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/studio.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/studio.connect.go new file mode 100644 index 000000000..de68529e5 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/studio.connect.go @@ -0,0 +1,158 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/studio.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // StudioServiceName is the fully-qualified name of the StudioService service. + StudioServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.StudioService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // StudioServiceListStudioAgentPresetsProcedure is the fully-qualified name of the StudioService's + // ListStudioAgentPresets RPC. + StudioServiceListStudioAgentPresetsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioService/ListStudioAgentPresets" + // StudioServiceSetStudioAgentPresetsProcedure is the fully-qualified name of the StudioService's + // SetStudioAgentPresets RPC. + StudioServiceSetStudioAgentPresetsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioService/SetStudioAgentPresets" +) + +// StudioServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.StudioService +// service. +type StudioServiceClient interface { + // ListStudioAgentPresets returns a list of agent presets in the server. + ListStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.ListStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.ListStudioAgentPresetsResponse], error) + // SetStudioAgentPresets sets the list of agent presets in the server. + SetStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.SetStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.SetStudioAgentPresetsResponse], error) +} + +// NewStudioServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewStudioServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) StudioServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &studioServiceClient{ + listStudioAgentPresets: connect_go.NewClient[v1alpha1.ListStudioAgentPresetsRequest, v1alpha1.ListStudioAgentPresetsResponse]( + httpClient, + baseURL+StudioServiceListStudioAgentPresetsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + setStudioAgentPresets: connect_go.NewClient[v1alpha1.SetStudioAgentPresetsRequest, v1alpha1.SetStudioAgentPresetsResponse]( + httpClient, + baseURL+StudioServiceSetStudioAgentPresetsProcedure, + opts..., + ), + } +} + +// studioServiceClient implements StudioServiceClient. +type studioServiceClient struct { + listStudioAgentPresets *connect_go.Client[v1alpha1.ListStudioAgentPresetsRequest, v1alpha1.ListStudioAgentPresetsResponse] + setStudioAgentPresets *connect_go.Client[v1alpha1.SetStudioAgentPresetsRequest, v1alpha1.SetStudioAgentPresetsResponse] +} + +// ListStudioAgentPresets calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService.ListStudioAgentPresets. +func (c *studioServiceClient) ListStudioAgentPresets(ctx context.Context, req *connect_go.Request[v1alpha1.ListStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.ListStudioAgentPresetsResponse], error) { + return c.listStudioAgentPresets.CallUnary(ctx, req) +} + +// SetStudioAgentPresets calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService.SetStudioAgentPresets. +func (c *studioServiceClient) SetStudioAgentPresets(ctx context.Context, req *connect_go.Request[v1alpha1.SetStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.SetStudioAgentPresetsResponse], error) { + return c.setStudioAgentPresets.CallUnary(ctx, req) +} + +// StudioServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService service. +type StudioServiceHandler interface { + // ListStudioAgentPresets returns a list of agent presets in the server. + ListStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.ListStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.ListStudioAgentPresetsResponse], error) + // SetStudioAgentPresets sets the list of agent presets in the server. + SetStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.SetStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.SetStudioAgentPresetsResponse], error) +} + +// NewStudioServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewStudioServiceHandler(svc StudioServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + studioServiceListStudioAgentPresetsHandler := connect_go.NewUnaryHandler( + StudioServiceListStudioAgentPresetsProcedure, + svc.ListStudioAgentPresets, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + studioServiceSetStudioAgentPresetsHandler := connect_go.NewUnaryHandler( + StudioServiceSetStudioAgentPresetsProcedure, + svc.SetStudioAgentPresets, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.StudioService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case StudioServiceListStudioAgentPresetsProcedure: + studioServiceListStudioAgentPresetsHandler.ServeHTTP(w, r) + case StudioServiceSetStudioAgentPresetsProcedure: + studioServiceSetStudioAgentPresetsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedStudioServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedStudioServiceHandler struct{} + +func (UnimplementedStudioServiceHandler) ListStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.ListStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.ListStudioAgentPresetsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioService.ListStudioAgentPresets is not implemented")) +} + +func (UnimplementedStudioServiceHandler) SetStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.SetStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.SetStudioAgentPresetsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioService.SetStudioAgentPresets is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/studio_request.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/studio_request.connect.go new file mode 100644 index 000000000..f7f6c0066 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/studio_request.connect.go @@ -0,0 +1,224 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/studio_request.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // StudioRequestServiceName is the fully-qualified name of the StudioRequestService service. + StudioRequestServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // StudioRequestServiceCreateStudioRequestProcedure is the fully-qualified name of the + // StudioRequestService's CreateStudioRequest RPC. + StudioRequestServiceCreateStudioRequestProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/CreateStudioRequest" + // StudioRequestServiceRenameStudioRequestProcedure is the fully-qualified name of the + // StudioRequestService's RenameStudioRequest RPC. + StudioRequestServiceRenameStudioRequestProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/RenameStudioRequest" + // StudioRequestServiceDeleteStudioRequestProcedure is the fully-qualified name of the + // StudioRequestService's DeleteStudioRequest RPC. + StudioRequestServiceDeleteStudioRequestProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/DeleteStudioRequest" + // StudioRequestServiceListStudioRequestsProcedure is the fully-qualified name of the + // StudioRequestService's ListStudioRequests RPC. + StudioRequestServiceListStudioRequestsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/ListStudioRequests" +) + +// StudioRequestServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService service. +type StudioRequestServiceClient interface { + // CreateStudioRequest registers a favorite Studio Requests to the caller's + // BSR profile. + CreateStudioRequest(context.Context, *connect_go.Request[v1alpha1.CreateStudioRequestRequest]) (*connect_go.Response[v1alpha1.CreateStudioRequestResponse], error) + // RenameStudioRequest renames an existing Studio Request. + RenameStudioRequest(context.Context, *connect_go.Request[v1alpha1.RenameStudioRequestRequest]) (*connect_go.Response[v1alpha1.RenameStudioRequestResponse], error) + // DeleteStudioRequest removes a favorite Studio Request from the caller's BSR + // profile. + DeleteStudioRequest(context.Context, *connect_go.Request[v1alpha1.DeleteStudioRequestRequest]) (*connect_go.Response[v1alpha1.DeleteStudioRequestResponse], error) + // ListStudioRequests shows the caller's favorited Studio Requests. + ListStudioRequests(context.Context, *connect_go.Request[v1alpha1.ListStudioRequestsRequest]) (*connect_go.Response[v1alpha1.ListStudioRequestsResponse], error) +} + +// NewStudioRequestServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewStudioRequestServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) StudioRequestServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &studioRequestServiceClient{ + createStudioRequest: connect_go.NewClient[v1alpha1.CreateStudioRequestRequest, v1alpha1.CreateStudioRequestResponse]( + httpClient, + baseURL+StudioRequestServiceCreateStudioRequestProcedure, + opts..., + ), + renameStudioRequest: connect_go.NewClient[v1alpha1.RenameStudioRequestRequest, v1alpha1.RenameStudioRequestResponse]( + httpClient, + baseURL+StudioRequestServiceRenameStudioRequestProcedure, + opts..., + ), + deleteStudioRequest: connect_go.NewClient[v1alpha1.DeleteStudioRequestRequest, v1alpha1.DeleteStudioRequestResponse]( + httpClient, + baseURL+StudioRequestServiceDeleteStudioRequestProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + listStudioRequests: connect_go.NewClient[v1alpha1.ListStudioRequestsRequest, v1alpha1.ListStudioRequestsResponse]( + httpClient, + baseURL+StudioRequestServiceListStudioRequestsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// studioRequestServiceClient implements StudioRequestServiceClient. +type studioRequestServiceClient struct { + createStudioRequest *connect_go.Client[v1alpha1.CreateStudioRequestRequest, v1alpha1.CreateStudioRequestResponse] + renameStudioRequest *connect_go.Client[v1alpha1.RenameStudioRequestRequest, v1alpha1.RenameStudioRequestResponse] + deleteStudioRequest *connect_go.Client[v1alpha1.DeleteStudioRequestRequest, v1alpha1.DeleteStudioRequestResponse] + listStudioRequests *connect_go.Client[v1alpha1.ListStudioRequestsRequest, v1alpha1.ListStudioRequestsResponse] +} + +// CreateStudioRequest calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.CreateStudioRequest. +func (c *studioRequestServiceClient) CreateStudioRequest(ctx context.Context, req *connect_go.Request[v1alpha1.CreateStudioRequestRequest]) (*connect_go.Response[v1alpha1.CreateStudioRequestResponse], error) { + return c.createStudioRequest.CallUnary(ctx, req) +} + +// RenameStudioRequest calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.RenameStudioRequest. +func (c *studioRequestServiceClient) RenameStudioRequest(ctx context.Context, req *connect_go.Request[v1alpha1.RenameStudioRequestRequest]) (*connect_go.Response[v1alpha1.RenameStudioRequestResponse], error) { + return c.renameStudioRequest.CallUnary(ctx, req) +} + +// DeleteStudioRequest calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.DeleteStudioRequest. +func (c *studioRequestServiceClient) DeleteStudioRequest(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteStudioRequestRequest]) (*connect_go.Response[v1alpha1.DeleteStudioRequestResponse], error) { + return c.deleteStudioRequest.CallUnary(ctx, req) +} + +// ListStudioRequests calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.ListStudioRequests. +func (c *studioRequestServiceClient) ListStudioRequests(ctx context.Context, req *connect_go.Request[v1alpha1.ListStudioRequestsRequest]) (*connect_go.Response[v1alpha1.ListStudioRequestsResponse], error) { + return c.listStudioRequests.CallUnary(ctx, req) +} + +// StudioRequestServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService service. +type StudioRequestServiceHandler interface { + // CreateStudioRequest registers a favorite Studio Requests to the caller's + // BSR profile. + CreateStudioRequest(context.Context, *connect_go.Request[v1alpha1.CreateStudioRequestRequest]) (*connect_go.Response[v1alpha1.CreateStudioRequestResponse], error) + // RenameStudioRequest renames an existing Studio Request. + RenameStudioRequest(context.Context, *connect_go.Request[v1alpha1.RenameStudioRequestRequest]) (*connect_go.Response[v1alpha1.RenameStudioRequestResponse], error) + // DeleteStudioRequest removes a favorite Studio Request from the caller's BSR + // profile. + DeleteStudioRequest(context.Context, *connect_go.Request[v1alpha1.DeleteStudioRequestRequest]) (*connect_go.Response[v1alpha1.DeleteStudioRequestResponse], error) + // ListStudioRequests shows the caller's favorited Studio Requests. + ListStudioRequests(context.Context, *connect_go.Request[v1alpha1.ListStudioRequestsRequest]) (*connect_go.Response[v1alpha1.ListStudioRequestsResponse], error) +} + +// NewStudioRequestServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewStudioRequestServiceHandler(svc StudioRequestServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + studioRequestServiceCreateStudioRequestHandler := connect_go.NewUnaryHandler( + StudioRequestServiceCreateStudioRequestProcedure, + svc.CreateStudioRequest, + opts..., + ) + studioRequestServiceRenameStudioRequestHandler := connect_go.NewUnaryHandler( + StudioRequestServiceRenameStudioRequestProcedure, + svc.RenameStudioRequest, + opts..., + ) + studioRequestServiceDeleteStudioRequestHandler := connect_go.NewUnaryHandler( + StudioRequestServiceDeleteStudioRequestProcedure, + svc.DeleteStudioRequest, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + studioRequestServiceListStudioRequestsHandler := connect_go.NewUnaryHandler( + StudioRequestServiceListStudioRequestsProcedure, + svc.ListStudioRequests, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case StudioRequestServiceCreateStudioRequestProcedure: + studioRequestServiceCreateStudioRequestHandler.ServeHTTP(w, r) + case StudioRequestServiceRenameStudioRequestProcedure: + studioRequestServiceRenameStudioRequestHandler.ServeHTTP(w, r) + case StudioRequestServiceDeleteStudioRequestProcedure: + studioRequestServiceDeleteStudioRequestHandler.ServeHTTP(w, r) + case StudioRequestServiceListStudioRequestsProcedure: + studioRequestServiceListStudioRequestsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedStudioRequestServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedStudioRequestServiceHandler struct{} + +func (UnimplementedStudioRequestServiceHandler) CreateStudioRequest(context.Context, *connect_go.Request[v1alpha1.CreateStudioRequestRequest]) (*connect_go.Response[v1alpha1.CreateStudioRequestResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.CreateStudioRequest is not implemented")) +} + +func (UnimplementedStudioRequestServiceHandler) RenameStudioRequest(context.Context, *connect_go.Request[v1alpha1.RenameStudioRequestRequest]) (*connect_go.Response[v1alpha1.RenameStudioRequestResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.RenameStudioRequest is not implemented")) +} + +func (UnimplementedStudioRequestServiceHandler) DeleteStudioRequest(context.Context, *connect_go.Request[v1alpha1.DeleteStudioRequestRequest]) (*connect_go.Response[v1alpha1.DeleteStudioRequestResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.DeleteStudioRequest is not implemented")) +} + +func (UnimplementedStudioRequestServiceHandler) ListStudioRequests(context.Context, *connect_go.Request[v1alpha1.ListStudioRequestsRequest]) (*connect_go.Response[v1alpha1.ListStudioRequestsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.ListStudioRequests is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/sync.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/sync.connect.go new file mode 100644 index 000000000..ed777cf45 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/sync.connect.go @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/sync.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // SyncServiceName is the fully-qualified name of the SyncService service. + SyncServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.SyncService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SyncServiceGetGitSyncPointProcedure is the fully-qualified name of the SyncService's + // GetGitSyncPoint RPC. + SyncServiceGetGitSyncPointProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SyncService/GetGitSyncPoint" + // SyncServiceSyncGitCommitProcedure is the fully-qualified name of the SyncService's SyncGitCommit + // RPC. + SyncServiceSyncGitCommitProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SyncService/SyncGitCommit" +) + +// SyncServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.SyncService +// service. +type SyncServiceClient interface { + // GetGitSyncPoint retrieves the Git sync point for the named repository + // on the specified branch. + GetGitSyncPoint(context.Context, *connect_go.Request[v1alpha1.GetGitSyncPointRequest]) (*connect_go.Response[v1alpha1.GetGitSyncPointResponse], error) + // SyncGitCommit syncs a Git commit containing a module to a named repository. + SyncGitCommit(context.Context, *connect_go.Request[v1alpha1.SyncGitCommitRequest]) (*connect_go.Response[v1alpha1.SyncGitCommitResponse], error) +} + +// NewSyncServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SyncService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewSyncServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SyncServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &syncServiceClient{ + getGitSyncPoint: connect_go.NewClient[v1alpha1.GetGitSyncPointRequest, v1alpha1.GetGitSyncPointResponse]( + httpClient, + baseURL+SyncServiceGetGitSyncPointProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + syncGitCommit: connect_go.NewClient[v1alpha1.SyncGitCommitRequest, v1alpha1.SyncGitCommitResponse]( + httpClient, + baseURL+SyncServiceSyncGitCommitProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// syncServiceClient implements SyncServiceClient. +type syncServiceClient struct { + getGitSyncPoint *connect_go.Client[v1alpha1.GetGitSyncPointRequest, v1alpha1.GetGitSyncPointResponse] + syncGitCommit *connect_go.Client[v1alpha1.SyncGitCommitRequest, v1alpha1.SyncGitCommitResponse] +} + +// GetGitSyncPoint calls bufman.dubbo.apache.org.registry.v1alpha1.SyncService.GetGitSyncPoint. +func (c *syncServiceClient) GetGitSyncPoint(ctx context.Context, req *connect_go.Request[v1alpha1.GetGitSyncPointRequest]) (*connect_go.Response[v1alpha1.GetGitSyncPointResponse], error) { + return c.getGitSyncPoint.CallUnary(ctx, req) +} + +// SyncGitCommit calls bufman.dubbo.apache.org.registry.v1alpha1.SyncService.SyncGitCommit. +func (c *syncServiceClient) SyncGitCommit(ctx context.Context, req *connect_go.Request[v1alpha1.SyncGitCommitRequest]) (*connect_go.Response[v1alpha1.SyncGitCommitResponse], error) { + return c.syncGitCommit.CallUnary(ctx, req) +} + +// SyncServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.SyncService service. +type SyncServiceHandler interface { + // GetGitSyncPoint retrieves the Git sync point for the named repository + // on the specified branch. + GetGitSyncPoint(context.Context, *connect_go.Request[v1alpha1.GetGitSyncPointRequest]) (*connect_go.Response[v1alpha1.GetGitSyncPointResponse], error) + // SyncGitCommit syncs a Git commit containing a module to a named repository. + SyncGitCommit(context.Context, *connect_go.Request[v1alpha1.SyncGitCommitRequest]) (*connect_go.Response[v1alpha1.SyncGitCommitResponse], error) +} + +// NewSyncServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewSyncServiceHandler(svc SyncServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + syncServiceGetGitSyncPointHandler := connect_go.NewUnaryHandler( + SyncServiceGetGitSyncPointProcedure, + svc.GetGitSyncPoint, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + syncServiceSyncGitCommitHandler := connect_go.NewUnaryHandler( + SyncServiceSyncGitCommitProcedure, + svc.SyncGitCommit, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.SyncService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SyncServiceGetGitSyncPointProcedure: + syncServiceGetGitSyncPointHandler.ServeHTTP(w, r) + case SyncServiceSyncGitCommitProcedure: + syncServiceSyncGitCommitHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSyncServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSyncServiceHandler struct{} + +func (UnimplementedSyncServiceHandler) GetGitSyncPoint(context.Context, *connect_go.Request[v1alpha1.GetGitSyncPointRequest]) (*connect_go.Response[v1alpha1.GetGitSyncPointResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SyncService.GetGitSyncPoint is not implemented")) +} + +func (UnimplementedSyncServiceHandler) SyncGitCommit(context.Context, *connect_go.Request[v1alpha1.SyncGitCommitRequest]) (*connect_go.Response[v1alpha1.SyncGitCommitResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SyncService.SyncGitCommit is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/token.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/token.connect.go new file mode 100644 index 000000000..3617662a4 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/token.connect.go @@ -0,0 +1,228 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/token.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // TokenServiceName is the fully-qualified name of the TokenService service. + TokenServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.TokenService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // TokenServiceCreateTokenProcedure is the fully-qualified name of the TokenService's CreateToken + // RPC. + TokenServiceCreateTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/CreateToken" + // TokenServiceGetTokenProcedure is the fully-qualified name of the TokenService's GetToken RPC. + TokenServiceGetTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/GetToken" + // TokenServiceListTokensProcedure is the fully-qualified name of the TokenService's ListTokens RPC. + TokenServiceListTokensProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/ListTokens" + // TokenServiceDeleteTokenProcedure is the fully-qualified name of the TokenService's DeleteToken + // RPC. + TokenServiceDeleteTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/DeleteToken" +) + +// TokenServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.TokenService +// service. +type TokenServiceClient interface { + // CreateToken creates a new token suitable for machine-to-machine authentication. + CreateToken(context.Context, *connect_go.Request[v1alpha1.CreateTokenRequest]) (*connect_go.Response[v1alpha1.CreateTokenResponse], error) + // GetToken gets the specific token for the user + // + // This method requires authentication. + GetToken(context.Context, *connect_go.Request[v1alpha1.GetTokenRequest]) (*connect_go.Response[v1alpha1.GetTokenResponse], error) + // ListTokens lists the users active tokens + // + // This method requires authentication. + ListTokens(context.Context, *connect_go.Request[v1alpha1.ListTokensRequest]) (*connect_go.Response[v1alpha1.ListTokensResponse], error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteToken(context.Context, *connect_go.Request[v1alpha1.DeleteTokenRequest]) (*connect_go.Response[v1alpha1.DeleteTokenResponse], error) +} + +// NewTokenServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.TokenService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewTokenServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) TokenServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &tokenServiceClient{ + createToken: connect_go.NewClient[v1alpha1.CreateTokenRequest, v1alpha1.CreateTokenResponse]( + httpClient, + baseURL+TokenServiceCreateTokenProcedure, + opts..., + ), + getToken: connect_go.NewClient[v1alpha1.GetTokenRequest, v1alpha1.GetTokenResponse]( + httpClient, + baseURL+TokenServiceGetTokenProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listTokens: connect_go.NewClient[v1alpha1.ListTokensRequest, v1alpha1.ListTokensResponse]( + httpClient, + baseURL+TokenServiceListTokensProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteToken: connect_go.NewClient[v1alpha1.DeleteTokenRequest, v1alpha1.DeleteTokenResponse]( + httpClient, + baseURL+TokenServiceDeleteTokenProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// tokenServiceClient implements TokenServiceClient. +type tokenServiceClient struct { + createToken *connect_go.Client[v1alpha1.CreateTokenRequest, v1alpha1.CreateTokenResponse] + getToken *connect_go.Client[v1alpha1.GetTokenRequest, v1alpha1.GetTokenResponse] + listTokens *connect_go.Client[v1alpha1.ListTokensRequest, v1alpha1.ListTokensResponse] + deleteToken *connect_go.Client[v1alpha1.DeleteTokenRequest, v1alpha1.DeleteTokenResponse] +} + +// CreateToken calls bufman.dubbo.apache.org.registry.v1alpha1.TokenService.CreateToken. +func (c *tokenServiceClient) CreateToken(ctx context.Context, req *connect_go.Request[v1alpha1.CreateTokenRequest]) (*connect_go.Response[v1alpha1.CreateTokenResponse], error) { + return c.createToken.CallUnary(ctx, req) +} + +// GetToken calls bufman.dubbo.apache.org.registry.v1alpha1.TokenService.GetToken. +func (c *tokenServiceClient) GetToken(ctx context.Context, req *connect_go.Request[v1alpha1.GetTokenRequest]) (*connect_go.Response[v1alpha1.GetTokenResponse], error) { + return c.getToken.CallUnary(ctx, req) +} + +// ListTokens calls bufman.dubbo.apache.org.registry.v1alpha1.TokenService.ListTokens. +func (c *tokenServiceClient) ListTokens(ctx context.Context, req *connect_go.Request[v1alpha1.ListTokensRequest]) (*connect_go.Response[v1alpha1.ListTokensResponse], error) { + return c.listTokens.CallUnary(ctx, req) +} + +// DeleteToken calls bufman.dubbo.apache.org.registry.v1alpha1.TokenService.DeleteToken. +func (c *tokenServiceClient) DeleteToken(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteTokenRequest]) (*connect_go.Response[v1alpha1.DeleteTokenResponse], error) { + return c.deleteToken.CallUnary(ctx, req) +} + +// TokenServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.TokenService service. +type TokenServiceHandler interface { + // CreateToken creates a new token suitable for machine-to-machine authentication. + CreateToken(context.Context, *connect_go.Request[v1alpha1.CreateTokenRequest]) (*connect_go.Response[v1alpha1.CreateTokenResponse], error) + // GetToken gets the specific token for the user + // + // This method requires authentication. + GetToken(context.Context, *connect_go.Request[v1alpha1.GetTokenRequest]) (*connect_go.Response[v1alpha1.GetTokenResponse], error) + // ListTokens lists the users active tokens + // + // This method requires authentication. + ListTokens(context.Context, *connect_go.Request[v1alpha1.ListTokensRequest]) (*connect_go.Response[v1alpha1.ListTokensResponse], error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteToken(context.Context, *connect_go.Request[v1alpha1.DeleteTokenRequest]) (*connect_go.Response[v1alpha1.DeleteTokenResponse], error) +} + +// NewTokenServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewTokenServiceHandler(svc TokenServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + tokenServiceCreateTokenHandler := connect_go.NewUnaryHandler( + TokenServiceCreateTokenProcedure, + svc.CreateToken, + opts..., + ) + tokenServiceGetTokenHandler := connect_go.NewUnaryHandler( + TokenServiceGetTokenProcedure, + svc.GetToken, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + tokenServiceListTokensHandler := connect_go.NewUnaryHandler( + TokenServiceListTokensProcedure, + svc.ListTokens, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + tokenServiceDeleteTokenHandler := connect_go.NewUnaryHandler( + TokenServiceDeleteTokenProcedure, + svc.DeleteToken, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case TokenServiceCreateTokenProcedure: + tokenServiceCreateTokenHandler.ServeHTTP(w, r) + case TokenServiceGetTokenProcedure: + tokenServiceGetTokenHandler.ServeHTTP(w, r) + case TokenServiceListTokensProcedure: + tokenServiceListTokensHandler.ServeHTTP(w, r) + case TokenServiceDeleteTokenProcedure: + tokenServiceDeleteTokenHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedTokenServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedTokenServiceHandler struct{} + +func (UnimplementedTokenServiceHandler) CreateToken(context.Context, *connect_go.Request[v1alpha1.CreateTokenRequest]) (*connect_go.Response[v1alpha1.CreateTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.TokenService.CreateToken is not implemented")) +} + +func (UnimplementedTokenServiceHandler) GetToken(context.Context, *connect_go.Request[v1alpha1.GetTokenRequest]) (*connect_go.Response[v1alpha1.GetTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.TokenService.GetToken is not implemented")) +} + +func (UnimplementedTokenServiceHandler) ListTokens(context.Context, *connect_go.Request[v1alpha1.ListTokensRequest]) (*connect_go.Response[v1alpha1.ListTokensResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.TokenService.ListTokens is not implemented")) +} + +func (UnimplementedTokenServiceHandler) DeleteToken(context.Context, *connect_go.Request[v1alpha1.DeleteTokenRequest]) (*connect_go.Response[v1alpha1.DeleteTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.TokenService.DeleteToken is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/user.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/user.connect.go new file mode 100644 index 000000000..d6a8607e1 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/user.connect.go @@ -0,0 +1,402 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/user.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // UserServiceName is the fully-qualified name of the UserService service. + UserServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.UserService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // UserServiceCreateUserProcedure is the fully-qualified name of the UserService's CreateUser RPC. + UserServiceCreateUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/CreateUser" + // UserServiceGetUserProcedure is the fully-qualified name of the UserService's GetUser RPC. + UserServiceGetUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/GetUser" + // UserServiceGetUserByUsernameProcedure is the fully-qualified name of the UserService's + // GetUserByUsername RPC. + UserServiceGetUserByUsernameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/GetUserByUsername" + // UserServiceListUsersProcedure is the fully-qualified name of the UserService's ListUsers RPC. + UserServiceListUsersProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/ListUsers" + // UserServiceListOrganizationUsersProcedure is the fully-qualified name of the UserService's + // ListOrganizationUsers RPC. + UserServiceListOrganizationUsersProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/ListOrganizationUsers" + // UserServiceDeleteUserProcedure is the fully-qualified name of the UserService's DeleteUser RPC. + UserServiceDeleteUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/DeleteUser" + // UserServiceDeactivateUserProcedure is the fully-qualified name of the UserService's + // DeactivateUser RPC. + UserServiceDeactivateUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/DeactivateUser" + // UserServiceUpdateUserServerRoleProcedure is the fully-qualified name of the UserService's + // UpdateUserServerRole RPC. + UserServiceUpdateUserServerRoleProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/UpdateUserServerRole" + // UserServiceCountUsersProcedure is the fully-qualified name of the UserService's CountUsers RPC. + UserServiceCountUsersProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/CountUsers" + // UserServiceUpdateUserSettingsProcedure is the fully-qualified name of the UserService's + // UpdateUserSettings RPC. + UserServiceUpdateUserSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/UpdateUserSettings" +) + +// UserServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.UserService +// service. +type UserServiceClient interface { + // CreateUser creates a new user with the given username. + CreateUser(context.Context, *connect_go.Request[v1alpha1.CreateUserRequest]) (*connect_go.Response[v1alpha1.CreateUserResponse], error) + // GetUser gets a user by ID. + GetUser(context.Context, *connect_go.Request[v1alpha1.GetUserRequest]) (*connect_go.Response[v1alpha1.GetUserResponse], error) + // GetUserByUsername gets a user by username. + GetUserByUsername(context.Context, *connect_go.Request[v1alpha1.GetUserByUsernameRequest]) (*connect_go.Response[v1alpha1.GetUserByUsernameResponse], error) + // ListUsers lists all users. + ListUsers(context.Context, *connect_go.Request[v1alpha1.ListUsersRequest]) (*connect_go.Response[v1alpha1.ListUsersResponse], error) + // ListOrganizationUsers lists all users for an organization. + // TODO: #663 move this to organization service + ListOrganizationUsers(context.Context, *connect_go.Request[v1alpha1.ListOrganizationUsersRequest]) (*connect_go.Response[v1alpha1.ListOrganizationUsersResponse], error) + // DeleteUser deletes a user. + DeleteUser(context.Context, *connect_go.Request[v1alpha1.DeleteUserRequest]) (*connect_go.Response[v1alpha1.DeleteUserResponse], error) + // Deactivate user deactivates a user. + DeactivateUser(context.Context, *connect_go.Request[v1alpha1.DeactivateUserRequest]) (*connect_go.Response[v1alpha1.DeactivateUserResponse], error) + // UpdateUserServerRole update the role of an user in the server. + UpdateUserServerRole(context.Context, *connect_go.Request[v1alpha1.UpdateUserServerRoleRequest]) (*connect_go.Response[v1alpha1.UpdateUserServerRoleResponse], error) + // CountUsers returns the number of users in the server by the user state provided. + CountUsers(context.Context, *connect_go.Request[v1alpha1.CountUsersRequest]) (*connect_go.Response[v1alpha1.CountUsersResponse], error) + // UpdateUserSettings update the user settings including description. + UpdateUserSettings(context.Context, *connect_go.Request[v1alpha1.UpdateUserSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateUserSettingsResponse], error) +} + +// NewUserServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.UserService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewUserServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) UserServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &userServiceClient{ + createUser: connect_go.NewClient[v1alpha1.CreateUserRequest, v1alpha1.CreateUserResponse]( + httpClient, + baseURL+UserServiceCreateUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getUser: connect_go.NewClient[v1alpha1.GetUserRequest, v1alpha1.GetUserResponse]( + httpClient, + baseURL+UserServiceGetUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getUserByUsername: connect_go.NewClient[v1alpha1.GetUserByUsernameRequest, v1alpha1.GetUserByUsernameResponse]( + httpClient, + baseURL+UserServiceGetUserByUsernameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUsers: connect_go.NewClient[v1alpha1.ListUsersRequest, v1alpha1.ListUsersResponse]( + httpClient, + baseURL+UserServiceListUsersProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizationUsers: connect_go.NewClient[v1alpha1.ListOrganizationUsersRequest, v1alpha1.ListOrganizationUsersResponse]( + httpClient, + baseURL+UserServiceListOrganizationUsersProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteUser: connect_go.NewClient[v1alpha1.DeleteUserRequest, v1alpha1.DeleteUserResponse]( + httpClient, + baseURL+UserServiceDeleteUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deactivateUser: connect_go.NewClient[v1alpha1.DeactivateUserRequest, v1alpha1.DeactivateUserResponse]( + httpClient, + baseURL+UserServiceDeactivateUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + updateUserServerRole: connect_go.NewClient[v1alpha1.UpdateUserServerRoleRequest, v1alpha1.UpdateUserServerRoleResponse]( + httpClient, + baseURL+UserServiceUpdateUserServerRoleProcedure, + opts..., + ), + countUsers: connect_go.NewClient[v1alpha1.CountUsersRequest, v1alpha1.CountUsersResponse]( + httpClient, + baseURL+UserServiceCountUsersProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateUserSettings: connect_go.NewClient[v1alpha1.UpdateUserSettingsRequest, v1alpha1.UpdateUserSettingsResponse]( + httpClient, + baseURL+UserServiceUpdateUserSettingsProcedure, + opts..., + ), + } +} + +// userServiceClient implements UserServiceClient. +type userServiceClient struct { + createUser *connect_go.Client[v1alpha1.CreateUserRequest, v1alpha1.CreateUserResponse] + getUser *connect_go.Client[v1alpha1.GetUserRequest, v1alpha1.GetUserResponse] + getUserByUsername *connect_go.Client[v1alpha1.GetUserByUsernameRequest, v1alpha1.GetUserByUsernameResponse] + listUsers *connect_go.Client[v1alpha1.ListUsersRequest, v1alpha1.ListUsersResponse] + listOrganizationUsers *connect_go.Client[v1alpha1.ListOrganizationUsersRequest, v1alpha1.ListOrganizationUsersResponse] + deleteUser *connect_go.Client[v1alpha1.DeleteUserRequest, v1alpha1.DeleteUserResponse] + deactivateUser *connect_go.Client[v1alpha1.DeactivateUserRequest, v1alpha1.DeactivateUserResponse] + updateUserServerRole *connect_go.Client[v1alpha1.UpdateUserServerRoleRequest, v1alpha1.UpdateUserServerRoleResponse] + countUsers *connect_go.Client[v1alpha1.CountUsersRequest, v1alpha1.CountUsersResponse] + updateUserSettings *connect_go.Client[v1alpha1.UpdateUserSettingsRequest, v1alpha1.UpdateUserSettingsResponse] +} + +// CreateUser calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.CreateUser. +func (c *userServiceClient) CreateUser(ctx context.Context, req *connect_go.Request[v1alpha1.CreateUserRequest]) (*connect_go.Response[v1alpha1.CreateUserResponse], error) { + return c.createUser.CallUnary(ctx, req) +} + +// GetUser calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUser. +func (c *userServiceClient) GetUser(ctx context.Context, req *connect_go.Request[v1alpha1.GetUserRequest]) (*connect_go.Response[v1alpha1.GetUserResponse], error) { + return c.getUser.CallUnary(ctx, req) +} + +// GetUserByUsername calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUserByUsername. +func (c *userServiceClient) GetUserByUsername(ctx context.Context, req *connect_go.Request[v1alpha1.GetUserByUsernameRequest]) (*connect_go.Response[v1alpha1.GetUserByUsernameResponse], error) { + return c.getUserByUsername.CallUnary(ctx, req) +} + +// ListUsers calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListUsers. +func (c *userServiceClient) ListUsers(ctx context.Context, req *connect_go.Request[v1alpha1.ListUsersRequest]) (*connect_go.Response[v1alpha1.ListUsersResponse], error) { + return c.listUsers.CallUnary(ctx, req) +} + +// ListOrganizationUsers calls +// bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListOrganizationUsers. +func (c *userServiceClient) ListOrganizationUsers(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationUsersRequest]) (*connect_go.Response[v1alpha1.ListOrganizationUsersResponse], error) { + return c.listOrganizationUsers.CallUnary(ctx, req) +} + +// DeleteUser calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeleteUser. +func (c *userServiceClient) DeleteUser(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteUserRequest]) (*connect_go.Response[v1alpha1.DeleteUserResponse], error) { + return c.deleteUser.CallUnary(ctx, req) +} + +// DeactivateUser calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeactivateUser. +func (c *userServiceClient) DeactivateUser(ctx context.Context, req *connect_go.Request[v1alpha1.DeactivateUserRequest]) (*connect_go.Response[v1alpha1.DeactivateUserResponse], error) { + return c.deactivateUser.CallUnary(ctx, req) +} + +// UpdateUserServerRole calls +// bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserServerRole. +func (c *userServiceClient) UpdateUserServerRole(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateUserServerRoleRequest]) (*connect_go.Response[v1alpha1.UpdateUserServerRoleResponse], error) { + return c.updateUserServerRole.CallUnary(ctx, req) +} + +// CountUsers calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.CountUsers. +func (c *userServiceClient) CountUsers(ctx context.Context, req *connect_go.Request[v1alpha1.CountUsersRequest]) (*connect_go.Response[v1alpha1.CountUsersResponse], error) { + return c.countUsers.CallUnary(ctx, req) +} + +// UpdateUserSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserSettings. +func (c *userServiceClient) UpdateUserSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateUserSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateUserSettingsResponse], error) { + return c.updateUserSettings.CallUnary(ctx, req) +} + +// UserServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.UserService service. +type UserServiceHandler interface { + // CreateUser creates a new user with the given username. + CreateUser(context.Context, *connect_go.Request[v1alpha1.CreateUserRequest]) (*connect_go.Response[v1alpha1.CreateUserResponse], error) + // GetUser gets a user by ID. + GetUser(context.Context, *connect_go.Request[v1alpha1.GetUserRequest]) (*connect_go.Response[v1alpha1.GetUserResponse], error) + // GetUserByUsername gets a user by username. + GetUserByUsername(context.Context, *connect_go.Request[v1alpha1.GetUserByUsernameRequest]) (*connect_go.Response[v1alpha1.GetUserByUsernameResponse], error) + // ListUsers lists all users. + ListUsers(context.Context, *connect_go.Request[v1alpha1.ListUsersRequest]) (*connect_go.Response[v1alpha1.ListUsersResponse], error) + // ListOrganizationUsers lists all users for an organization. + // TODO: #663 move this to organization service + ListOrganizationUsers(context.Context, *connect_go.Request[v1alpha1.ListOrganizationUsersRequest]) (*connect_go.Response[v1alpha1.ListOrganizationUsersResponse], error) + // DeleteUser deletes a user. + DeleteUser(context.Context, *connect_go.Request[v1alpha1.DeleteUserRequest]) (*connect_go.Response[v1alpha1.DeleteUserResponse], error) + // Deactivate user deactivates a user. + DeactivateUser(context.Context, *connect_go.Request[v1alpha1.DeactivateUserRequest]) (*connect_go.Response[v1alpha1.DeactivateUserResponse], error) + // UpdateUserServerRole update the role of an user in the server. + UpdateUserServerRole(context.Context, *connect_go.Request[v1alpha1.UpdateUserServerRoleRequest]) (*connect_go.Response[v1alpha1.UpdateUserServerRoleResponse], error) + // CountUsers returns the number of users in the server by the user state provided. + CountUsers(context.Context, *connect_go.Request[v1alpha1.CountUsersRequest]) (*connect_go.Response[v1alpha1.CountUsersResponse], error) + // UpdateUserSettings update the user settings including description. + UpdateUserSettings(context.Context, *connect_go.Request[v1alpha1.UpdateUserSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateUserSettingsResponse], error) +} + +// NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewUserServiceHandler(svc UserServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + userServiceCreateUserHandler := connect_go.NewUnaryHandler( + UserServiceCreateUserProcedure, + svc.CreateUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + userServiceGetUserHandler := connect_go.NewUnaryHandler( + UserServiceGetUserProcedure, + svc.GetUser, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceGetUserByUsernameHandler := connect_go.NewUnaryHandler( + UserServiceGetUserByUsernameProcedure, + svc.GetUserByUsername, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceListUsersHandler := connect_go.NewUnaryHandler( + UserServiceListUsersProcedure, + svc.ListUsers, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceListOrganizationUsersHandler := connect_go.NewUnaryHandler( + UserServiceListOrganizationUsersProcedure, + svc.ListOrganizationUsers, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceDeleteUserHandler := connect_go.NewUnaryHandler( + UserServiceDeleteUserProcedure, + svc.DeleteUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + userServiceDeactivateUserHandler := connect_go.NewUnaryHandler( + UserServiceDeactivateUserProcedure, + svc.DeactivateUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + userServiceUpdateUserServerRoleHandler := connect_go.NewUnaryHandler( + UserServiceUpdateUserServerRoleProcedure, + svc.UpdateUserServerRole, + opts..., + ) + userServiceCountUsersHandler := connect_go.NewUnaryHandler( + UserServiceCountUsersProcedure, + svc.CountUsers, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceUpdateUserSettingsHandler := connect_go.NewUnaryHandler( + UserServiceUpdateUserSettingsProcedure, + svc.UpdateUserSettings, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case UserServiceCreateUserProcedure: + userServiceCreateUserHandler.ServeHTTP(w, r) + case UserServiceGetUserProcedure: + userServiceGetUserHandler.ServeHTTP(w, r) + case UserServiceGetUserByUsernameProcedure: + userServiceGetUserByUsernameHandler.ServeHTTP(w, r) + case UserServiceListUsersProcedure: + userServiceListUsersHandler.ServeHTTP(w, r) + case UserServiceListOrganizationUsersProcedure: + userServiceListOrganizationUsersHandler.ServeHTTP(w, r) + case UserServiceDeleteUserProcedure: + userServiceDeleteUserHandler.ServeHTTP(w, r) + case UserServiceDeactivateUserProcedure: + userServiceDeactivateUserHandler.ServeHTTP(w, r) + case UserServiceUpdateUserServerRoleProcedure: + userServiceUpdateUserServerRoleHandler.ServeHTTP(w, r) + case UserServiceCountUsersProcedure: + userServiceCountUsersHandler.ServeHTTP(w, r) + case UserServiceUpdateUserSettingsProcedure: + userServiceUpdateUserSettingsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedUserServiceHandler struct{} + +func (UnimplementedUserServiceHandler) CreateUser(context.Context, *connect_go.Request[v1alpha1.CreateUserRequest]) (*connect_go.Response[v1alpha1.CreateUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.CreateUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) GetUser(context.Context, *connect_go.Request[v1alpha1.GetUserRequest]) (*connect_go.Response[v1alpha1.GetUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) GetUserByUsername(context.Context, *connect_go.Request[v1alpha1.GetUserByUsernameRequest]) (*connect_go.Response[v1alpha1.GetUserByUsernameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUserByUsername is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListUsers(context.Context, *connect_go.Request[v1alpha1.ListUsersRequest]) (*connect_go.Response[v1alpha1.ListUsersResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListUsers is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListOrganizationUsers(context.Context, *connect_go.Request[v1alpha1.ListOrganizationUsersRequest]) (*connect_go.Response[v1alpha1.ListOrganizationUsersResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListOrganizationUsers is not implemented")) +} + +func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect_go.Request[v1alpha1.DeleteUserRequest]) (*connect_go.Response[v1alpha1.DeleteUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeleteUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) DeactivateUser(context.Context, *connect_go.Request[v1alpha1.DeactivateUserRequest]) (*connect_go.Response[v1alpha1.DeactivateUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeactivateUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) UpdateUserServerRole(context.Context, *connect_go.Request[v1alpha1.UpdateUserServerRoleRequest]) (*connect_go.Response[v1alpha1.UpdateUserServerRoleResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserServerRole is not implemented")) +} + +func (UnimplementedUserServiceHandler) CountUsers(context.Context, *connect_go.Request[v1alpha1.CountUsersRequest]) (*connect_go.Response[v1alpha1.CountUsersResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.CountUsers is not implemented")) +} + +func (UnimplementedUserServiceHandler) UpdateUserSettings(context.Context, *connect_go.Request[v1alpha1.UpdateUserSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateUserSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserSettings is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/webhook.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/webhook.connect.go new file mode 100644 index 000000000..55fc0424a --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect/webhook.connect.go @@ -0,0 +1,191 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/webhook.proto + +package registryv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // WebhookServiceName is the fully-qualified name of the WebhookService service. + WebhookServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.WebhookService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // WebhookServiceCreateWebhookProcedure is the fully-qualified name of the WebhookService's + // CreateWebhook RPC. + WebhookServiceCreateWebhookProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/CreateWebhook" + // WebhookServiceDeleteWebhookProcedure is the fully-qualified name of the WebhookService's + // DeleteWebhook RPC. + WebhookServiceDeleteWebhookProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/DeleteWebhook" + // WebhookServiceListWebhooksProcedure is the fully-qualified name of the WebhookService's + // ListWebhooks RPC. + WebhookServiceListWebhooksProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/ListWebhooks" +) + +// WebhookServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.WebhookService +// service. +type WebhookServiceClient interface { + // Create a webhook, subscribes to a given repository event for a callback URL + // invocation. + CreateWebhook(context.Context, *connect_go.Request[v1alpha1.CreateWebhookRequest]) (*connect_go.Response[v1alpha1.CreateWebhookResponse], error) + // Delete a webhook removes the event subscription. + DeleteWebhook(context.Context, *connect_go.Request[v1alpha1.DeleteWebhookRequest]) (*connect_go.Response[v1alpha1.DeleteWebhookResponse], error) + // Lists the webhooks subscriptions for a given repository. + ListWebhooks(context.Context, *connect_go.Request[v1alpha1.ListWebhooksRequest]) (*connect_go.Response[v1alpha1.ListWebhooksResponse], error) +} + +// NewWebhookServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.WebhookService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewWebhookServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) WebhookServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &webhookServiceClient{ + createWebhook: connect_go.NewClient[v1alpha1.CreateWebhookRequest, v1alpha1.CreateWebhookResponse]( + httpClient, + baseURL+WebhookServiceCreateWebhookProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteWebhook: connect_go.NewClient[v1alpha1.DeleteWebhookRequest, v1alpha1.DeleteWebhookResponse]( + httpClient, + baseURL+WebhookServiceDeleteWebhookProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + listWebhooks: connect_go.NewClient[v1alpha1.ListWebhooksRequest, v1alpha1.ListWebhooksResponse]( + httpClient, + baseURL+WebhookServiceListWebhooksProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// webhookServiceClient implements WebhookServiceClient. +type webhookServiceClient struct { + createWebhook *connect_go.Client[v1alpha1.CreateWebhookRequest, v1alpha1.CreateWebhookResponse] + deleteWebhook *connect_go.Client[v1alpha1.DeleteWebhookRequest, v1alpha1.DeleteWebhookResponse] + listWebhooks *connect_go.Client[v1alpha1.ListWebhooksRequest, v1alpha1.ListWebhooksResponse] +} + +// CreateWebhook calls bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.CreateWebhook. +func (c *webhookServiceClient) CreateWebhook(ctx context.Context, req *connect_go.Request[v1alpha1.CreateWebhookRequest]) (*connect_go.Response[v1alpha1.CreateWebhookResponse], error) { + return c.createWebhook.CallUnary(ctx, req) +} + +// DeleteWebhook calls bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.DeleteWebhook. +func (c *webhookServiceClient) DeleteWebhook(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteWebhookRequest]) (*connect_go.Response[v1alpha1.DeleteWebhookResponse], error) { + return c.deleteWebhook.CallUnary(ctx, req) +} + +// ListWebhooks calls bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.ListWebhooks. +func (c *webhookServiceClient) ListWebhooks(ctx context.Context, req *connect_go.Request[v1alpha1.ListWebhooksRequest]) (*connect_go.Response[v1alpha1.ListWebhooksResponse], error) { + return c.listWebhooks.CallUnary(ctx, req) +} + +// WebhookServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.WebhookService service. +type WebhookServiceHandler interface { + // Create a webhook, subscribes to a given repository event for a callback URL + // invocation. + CreateWebhook(context.Context, *connect_go.Request[v1alpha1.CreateWebhookRequest]) (*connect_go.Response[v1alpha1.CreateWebhookResponse], error) + // Delete a webhook removes the event subscription. + DeleteWebhook(context.Context, *connect_go.Request[v1alpha1.DeleteWebhookRequest]) (*connect_go.Response[v1alpha1.DeleteWebhookResponse], error) + // Lists the webhooks subscriptions for a given repository. + ListWebhooks(context.Context, *connect_go.Request[v1alpha1.ListWebhooksRequest]) (*connect_go.Response[v1alpha1.ListWebhooksResponse], error) +} + +// NewWebhookServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewWebhookServiceHandler(svc WebhookServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + webhookServiceCreateWebhookHandler := connect_go.NewUnaryHandler( + WebhookServiceCreateWebhookProcedure, + svc.CreateWebhook, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + webhookServiceDeleteWebhookHandler := connect_go.NewUnaryHandler( + WebhookServiceDeleteWebhookProcedure, + svc.DeleteWebhook, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + webhookServiceListWebhooksHandler := connect_go.NewUnaryHandler( + WebhookServiceListWebhooksProcedure, + svc.ListWebhooks, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case WebhookServiceCreateWebhookProcedure: + webhookServiceCreateWebhookHandler.ServeHTTP(w, r) + case WebhookServiceDeleteWebhookProcedure: + webhookServiceDeleteWebhookHandler.ServeHTTP(w, r) + case WebhookServiceListWebhooksProcedure: + webhookServiceListWebhooksHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedWebhookServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedWebhookServiceHandler struct{} + +func (UnimplementedWebhookServiceHandler) CreateWebhook(context.Context, *connect_go.Request[v1alpha1.CreateWebhookRequest]) (*connect_go.Response[v1alpha1.CreateWebhookResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.CreateWebhook is not implemented")) +} + +func (UnimplementedWebhookServiceHandler) DeleteWebhook(context.Context, *connect_go.Request[v1alpha1.DeleteWebhookRequest]) (*connect_go.Response[v1alpha1.DeleteWebhookResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.DeleteWebhook is not implemented")) +} + +func (UnimplementedWebhookServiceHandler) ListWebhooks(context.Context, *connect_go.Request[v1alpha1.ListWebhooksRequest]) (*connect_go.Response[v1alpha1.ListWebhooksResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.ListWebhooks is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/admin.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/admin.connect.go new file mode 100644 index 000000000..6ca071ea9 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/admin.connect.go @@ -0,0 +1,378 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/admin.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // AdminServiceName is the fully-qualified name of the AdminService service. + AdminServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.AdminService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AdminServiceForceDeleteUserProcedure is the fully-qualified name of the AdminService's + // ForceDeleteUser RPC. + AdminServiceForceDeleteUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/ForceDeleteUser" + // AdminServiceUpdateUserVerificationStatusProcedure is the fully-qualified name of the + // AdminService's UpdateUserVerificationStatus RPC. + AdminServiceUpdateUserVerificationStatusProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateUserVerificationStatus" + // AdminServiceUpdateOrganizationVerificationStatusProcedure is the fully-qualified name of the + // AdminService's UpdateOrganizationVerificationStatus RPC. + AdminServiceUpdateOrganizationVerificationStatusProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateOrganizationVerificationStatus" + // AdminServiceCreateMachineUserProcedure is the fully-qualified name of the AdminService's + // CreateMachineUser RPC. + AdminServiceCreateMachineUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/CreateMachineUser" + // AdminServiceGetBreakingChangePolicyProcedure is the fully-qualified name of the AdminService's + // GetBreakingChangePolicy RPC. + AdminServiceGetBreakingChangePolicyProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/GetBreakingChangePolicy" + // AdminServiceUpdateBreakingChangePolicyProcedure is the fully-qualified name of the AdminService's + // UpdateBreakingChangePolicy RPC. + AdminServiceUpdateBreakingChangePolicyProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateBreakingChangePolicy" + // AdminServiceGetUniquenessPolicyProcedure is the fully-qualified name of the AdminService's + // GetUniquenessPolicy RPC. + AdminServiceGetUniquenessPolicyProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/GetUniquenessPolicy" + // AdminServiceUpdateUniquenessPolicyProcedure is the fully-qualified name of the AdminService's + // UpdateUniquenessPolicy RPC. + AdminServiceUpdateUniquenessPolicyProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateUniquenessPolicy" + // AdminServiceListServerUniquenessCollisionsProcedure is the fully-qualified name of the + // AdminService's ListServerUniquenessCollisions RPC. + AdminServiceListServerUniquenessCollisionsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/ListServerUniquenessCollisions" +) + +// AdminServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService service. +type AdminServiceClient interface { + // ForceDeleteUser forces to delete a user. Resources and organizations that are + // solely owned by the user will also be deleted. + ForceDeleteUser(context.Context, *connect_go.Request[v1alpha1.ForceDeleteUserRequest]) (*connect_go.Response[v1alpha1.ForceDeleteUserResponse], error) + // Update a user's verification status. + UpdateUserVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateUserVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateUserVerificationStatusResponse], error) + // Update a organization's verification. + UpdateOrganizationVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationVerificationStatusResponse], error) + // Create a new machine user on the server. + CreateMachineUser(context.Context, *connect_go.Request[v1alpha1.CreateMachineUserRequest]) (*connect_go.Response[v1alpha1.CreateMachineUserResponse], error) + // Get breaking change policy for the server. + GetBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.GetBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.GetBreakingChangePolicyResponse], error) + // Update breaking change policy for the server. + UpdateBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.UpdateBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.UpdateBreakingChangePolicyResponse], error) + // Get uniqueness policy for the server. + GetUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.GetUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.GetUniquenessPolicyResponse], error) + // Update uniqueness policy enforcement for the server. + UpdateUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.UpdateUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.UpdateUniquenessPolicyResponse], error) + // Get state of uniqueness collisions for the server + ListServerUniquenessCollisions(context.Context, *connect_go.Request[v1alpha1.ListServerUniquenessCollisionsRequest]) (*connect_go.Response[v1alpha1.ListServerUniquenessCollisionsResponse], error) +} + +// NewAdminServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAdminServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AdminServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &adminServiceClient{ + forceDeleteUser: connect_go.NewClient[v1alpha1.ForceDeleteUserRequest, v1alpha1.ForceDeleteUserResponse]( + httpClient, + baseURL+AdminServiceForceDeleteUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + updateUserVerificationStatus: connect_go.NewClient[v1alpha1.UpdateUserVerificationStatusRequest, v1alpha1.UpdateUserVerificationStatusResponse]( + httpClient, + baseURL+AdminServiceUpdateUserVerificationStatusProcedure, + opts..., + ), + updateOrganizationVerificationStatus: connect_go.NewClient[v1alpha1.UpdateOrganizationVerificationStatusRequest, v1alpha1.UpdateOrganizationVerificationStatusResponse]( + httpClient, + baseURL+AdminServiceUpdateOrganizationVerificationStatusProcedure, + opts..., + ), + createMachineUser: connect_go.NewClient[v1alpha1.CreateMachineUserRequest, v1alpha1.CreateMachineUserResponse]( + httpClient, + baseURL+AdminServiceCreateMachineUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getBreakingChangePolicy: connect_go.NewClient[v1alpha1.GetBreakingChangePolicyRequest, v1alpha1.GetBreakingChangePolicyResponse]( + httpClient, + baseURL+AdminServiceGetBreakingChangePolicyProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateBreakingChangePolicy: connect_go.NewClient[v1alpha1.UpdateBreakingChangePolicyRequest, v1alpha1.UpdateBreakingChangePolicyResponse]( + httpClient, + baseURL+AdminServiceUpdateBreakingChangePolicyProcedure, + opts..., + ), + getUniquenessPolicy: connect_go.NewClient[v1alpha1.GetUniquenessPolicyRequest, v1alpha1.GetUniquenessPolicyResponse]( + httpClient, + baseURL+AdminServiceGetUniquenessPolicyProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateUniquenessPolicy: connect_go.NewClient[v1alpha1.UpdateUniquenessPolicyRequest, v1alpha1.UpdateUniquenessPolicyResponse]( + httpClient, + baseURL+AdminServiceUpdateUniquenessPolicyProcedure, + opts..., + ), + listServerUniquenessCollisions: connect_go.NewClient[v1alpha1.ListServerUniquenessCollisionsRequest, v1alpha1.ListServerUniquenessCollisionsResponse]( + httpClient, + baseURL+AdminServiceListServerUniquenessCollisionsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// adminServiceClient implements AdminServiceClient. +type adminServiceClient struct { + forceDeleteUser *connect_go.Client[v1alpha1.ForceDeleteUserRequest, v1alpha1.ForceDeleteUserResponse] + updateUserVerificationStatus *connect_go.Client[v1alpha1.UpdateUserVerificationStatusRequest, v1alpha1.UpdateUserVerificationStatusResponse] + updateOrganizationVerificationStatus *connect_go.Client[v1alpha1.UpdateOrganizationVerificationStatusRequest, v1alpha1.UpdateOrganizationVerificationStatusResponse] + createMachineUser *connect_go.Client[v1alpha1.CreateMachineUserRequest, v1alpha1.CreateMachineUserResponse] + getBreakingChangePolicy *connect_go.Client[v1alpha1.GetBreakingChangePolicyRequest, v1alpha1.GetBreakingChangePolicyResponse] + updateBreakingChangePolicy *connect_go.Client[v1alpha1.UpdateBreakingChangePolicyRequest, v1alpha1.UpdateBreakingChangePolicyResponse] + getUniquenessPolicy *connect_go.Client[v1alpha1.GetUniquenessPolicyRequest, v1alpha1.GetUniquenessPolicyResponse] + updateUniquenessPolicy *connect_go.Client[v1alpha1.UpdateUniquenessPolicyRequest, v1alpha1.UpdateUniquenessPolicyResponse] + listServerUniquenessCollisions *connect_go.Client[v1alpha1.ListServerUniquenessCollisionsRequest, v1alpha1.ListServerUniquenessCollisionsResponse] +} + +// ForceDeleteUser calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ForceDeleteUser. +func (c *adminServiceClient) ForceDeleteUser(ctx context.Context, req *connect_go.Request[v1alpha1.ForceDeleteUserRequest]) (*connect_go.Response[v1alpha1.ForceDeleteUserResponse], error) { + return c.forceDeleteUser.CallUnary(ctx, req) +} + +// UpdateUserVerificationStatus calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUserVerificationStatus. +func (c *adminServiceClient) UpdateUserVerificationStatus(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateUserVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateUserVerificationStatusResponse], error) { + return c.updateUserVerificationStatus.CallUnary(ctx, req) +} + +// UpdateOrganizationVerificationStatus calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateOrganizationVerificationStatus. +func (c *adminServiceClient) UpdateOrganizationVerificationStatus(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateOrganizationVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationVerificationStatusResponse], error) { + return c.updateOrganizationVerificationStatus.CallUnary(ctx, req) +} + +// CreateMachineUser calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.CreateMachineUser. +func (c *adminServiceClient) CreateMachineUser(ctx context.Context, req *connect_go.Request[v1alpha1.CreateMachineUserRequest]) (*connect_go.Response[v1alpha1.CreateMachineUserResponse], error) { + return c.createMachineUser.CallUnary(ctx, req) +} + +// GetBreakingChangePolicy calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetBreakingChangePolicy. +func (c *adminServiceClient) GetBreakingChangePolicy(ctx context.Context, req *connect_go.Request[v1alpha1.GetBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.GetBreakingChangePolicyResponse], error) { + return c.getBreakingChangePolicy.CallUnary(ctx, req) +} + +// UpdateBreakingChangePolicy calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateBreakingChangePolicy. +func (c *adminServiceClient) UpdateBreakingChangePolicy(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.UpdateBreakingChangePolicyResponse], error) { + return c.updateBreakingChangePolicy.CallUnary(ctx, req) +} + +// GetUniquenessPolicy calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetUniquenessPolicy. +func (c *adminServiceClient) GetUniquenessPolicy(ctx context.Context, req *connect_go.Request[v1alpha1.GetUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.GetUniquenessPolicyResponse], error) { + return c.getUniquenessPolicy.CallUnary(ctx, req) +} + +// UpdateUniquenessPolicy calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUniquenessPolicy. +func (c *adminServiceClient) UpdateUniquenessPolicy(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.UpdateUniquenessPolicyResponse], error) { + return c.updateUniquenessPolicy.CallUnary(ctx, req) +} + +// ListServerUniquenessCollisions calls +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ListServerUniquenessCollisions. +func (c *adminServiceClient) ListServerUniquenessCollisions(ctx context.Context, req *connect_go.Request[v1alpha1.ListServerUniquenessCollisionsRequest]) (*connect_go.Response[v1alpha1.ListServerUniquenessCollisionsResponse], error) { + return c.listServerUniquenessCollisions.CallUnary(ctx, req) +} + +// AdminServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.AdminService service. +type AdminServiceHandler interface { + // ForceDeleteUser forces to delete a user. Resources and organizations that are + // solely owned by the user will also be deleted. + ForceDeleteUser(context.Context, *connect_go.Request[v1alpha1.ForceDeleteUserRequest]) (*connect_go.Response[v1alpha1.ForceDeleteUserResponse], error) + // Update a user's verification status. + UpdateUserVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateUserVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateUserVerificationStatusResponse], error) + // Update a organization's verification. + UpdateOrganizationVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationVerificationStatusResponse], error) + // Create a new machine user on the server. + CreateMachineUser(context.Context, *connect_go.Request[v1alpha1.CreateMachineUserRequest]) (*connect_go.Response[v1alpha1.CreateMachineUserResponse], error) + // Get breaking change policy for the server. + GetBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.GetBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.GetBreakingChangePolicyResponse], error) + // Update breaking change policy for the server. + UpdateBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.UpdateBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.UpdateBreakingChangePolicyResponse], error) + // Get uniqueness policy for the server. + GetUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.GetUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.GetUniquenessPolicyResponse], error) + // Update uniqueness policy enforcement for the server. + UpdateUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.UpdateUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.UpdateUniquenessPolicyResponse], error) + // Get state of uniqueness collisions for the server + ListServerUniquenessCollisions(context.Context, *connect_go.Request[v1alpha1.ListServerUniquenessCollisionsRequest]) (*connect_go.Response[v1alpha1.ListServerUniquenessCollisionsResponse], error) +} + +// NewAdminServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAdminServiceHandler(svc AdminServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + adminServiceForceDeleteUserHandler := connect_go.NewUnaryHandler( + AdminServiceForceDeleteUserProcedure, + svc.ForceDeleteUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + adminServiceUpdateUserVerificationStatusHandler := connect_go.NewUnaryHandler( + AdminServiceUpdateUserVerificationStatusProcedure, + svc.UpdateUserVerificationStatus, + opts..., + ) + adminServiceUpdateOrganizationVerificationStatusHandler := connect_go.NewUnaryHandler( + AdminServiceUpdateOrganizationVerificationStatusProcedure, + svc.UpdateOrganizationVerificationStatus, + opts..., + ) + adminServiceCreateMachineUserHandler := connect_go.NewUnaryHandler( + AdminServiceCreateMachineUserProcedure, + svc.CreateMachineUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + adminServiceGetBreakingChangePolicyHandler := connect_go.NewUnaryHandler( + AdminServiceGetBreakingChangePolicyProcedure, + svc.GetBreakingChangePolicy, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + adminServiceUpdateBreakingChangePolicyHandler := connect_go.NewUnaryHandler( + AdminServiceUpdateBreakingChangePolicyProcedure, + svc.UpdateBreakingChangePolicy, + opts..., + ) + adminServiceGetUniquenessPolicyHandler := connect_go.NewUnaryHandler( + AdminServiceGetUniquenessPolicyProcedure, + svc.GetUniquenessPolicy, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + adminServiceUpdateUniquenessPolicyHandler := connect_go.NewUnaryHandler( + AdminServiceUpdateUniquenessPolicyProcedure, + svc.UpdateUniquenessPolicy, + opts..., + ) + adminServiceListServerUniquenessCollisionsHandler := connect_go.NewUnaryHandler( + AdminServiceListServerUniquenessCollisionsProcedure, + svc.ListServerUniquenessCollisions, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AdminServiceForceDeleteUserProcedure: + adminServiceForceDeleteUserHandler.ServeHTTP(w, r) + case AdminServiceUpdateUserVerificationStatusProcedure: + adminServiceUpdateUserVerificationStatusHandler.ServeHTTP(w, r) + case AdminServiceUpdateOrganizationVerificationStatusProcedure: + adminServiceUpdateOrganizationVerificationStatusHandler.ServeHTTP(w, r) + case AdminServiceCreateMachineUserProcedure: + adminServiceCreateMachineUserHandler.ServeHTTP(w, r) + case AdminServiceGetBreakingChangePolicyProcedure: + adminServiceGetBreakingChangePolicyHandler.ServeHTTP(w, r) + case AdminServiceUpdateBreakingChangePolicyProcedure: + adminServiceUpdateBreakingChangePolicyHandler.ServeHTTP(w, r) + case AdminServiceGetUniquenessPolicyProcedure: + adminServiceGetUniquenessPolicyHandler.ServeHTTP(w, r) + case AdminServiceUpdateUniquenessPolicyProcedure: + adminServiceUpdateUniquenessPolicyHandler.ServeHTTP(w, r) + case AdminServiceListServerUniquenessCollisionsProcedure: + adminServiceListServerUniquenessCollisionsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAdminServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAdminServiceHandler struct{} + +func (UnimplementedAdminServiceHandler) ForceDeleteUser(context.Context, *connect_go.Request[v1alpha1.ForceDeleteUserRequest]) (*connect_go.Response[v1alpha1.ForceDeleteUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ForceDeleteUser is not implemented")) +} + +func (UnimplementedAdminServiceHandler) UpdateUserVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateUserVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateUserVerificationStatusResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUserVerificationStatus is not implemented")) +} + +func (UnimplementedAdminServiceHandler) UpdateOrganizationVerificationStatus(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationVerificationStatusRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationVerificationStatusResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateOrganizationVerificationStatus is not implemented")) +} + +func (UnimplementedAdminServiceHandler) CreateMachineUser(context.Context, *connect_go.Request[v1alpha1.CreateMachineUserRequest]) (*connect_go.Response[v1alpha1.CreateMachineUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.CreateMachineUser is not implemented")) +} + +func (UnimplementedAdminServiceHandler) GetBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.GetBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.GetBreakingChangePolicyResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetBreakingChangePolicy is not implemented")) +} + +func (UnimplementedAdminServiceHandler) UpdateBreakingChangePolicy(context.Context, *connect_go.Request[v1alpha1.UpdateBreakingChangePolicyRequest]) (*connect_go.Response[v1alpha1.UpdateBreakingChangePolicyResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateBreakingChangePolicy is not implemented")) +} + +func (UnimplementedAdminServiceHandler) GetUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.GetUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.GetUniquenessPolicyResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetUniquenessPolicy is not implemented")) +} + +func (UnimplementedAdminServiceHandler) UpdateUniquenessPolicy(context.Context, *connect_go.Request[v1alpha1.UpdateUniquenessPolicyRequest]) (*connect_go.Response[v1alpha1.UpdateUniquenessPolicyResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUniquenessPolicy is not implemented")) +} + +func (UnimplementedAdminServiceHandler) ListServerUniquenessCollisions(context.Context, *connect_go.Request[v1alpha1.ListServerUniquenessCollisionsRequest]) (*connect_go.Response[v1alpha1.ListServerUniquenessCollisionsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ListServerUniquenessCollisions is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/authn.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/authn.connect.go new file mode 100644 index 000000000..24b14a715 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/authn.connect.go @@ -0,0 +1,168 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/authn.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // AuthnServiceName is the fully-qualified name of the AuthnService service. + AuthnServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.AuthnService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AuthnServiceGetCurrentUserProcedure is the fully-qualified name of the AuthnService's + // GetCurrentUser RPC. + AuthnServiceGetCurrentUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthnService/GetCurrentUser" + // AuthnServiceGetCurrentUserSubjectProcedure is the fully-qualified name of the AuthnService's + // GetCurrentUserSubject RPC. + AuthnServiceGetCurrentUserSubjectProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthnService/GetCurrentUserSubject" +) + +// AuthnServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthnService service. +type AuthnServiceClient interface { + // GetCurrentUser gets information associated with the current user. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUser(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserResponse], error) + // GetCurrentUserSubject gets the currently logged in users subject. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUserSubject(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserSubjectRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserSubjectResponse], error) +} + +// NewAuthnServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthnService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAuthnServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AuthnServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &authnServiceClient{ + getCurrentUser: connect_go.NewClient[v1alpha1.GetCurrentUserRequest, v1alpha1.GetCurrentUserResponse]( + httpClient, + baseURL+AuthnServiceGetCurrentUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getCurrentUserSubject: connect_go.NewClient[v1alpha1.GetCurrentUserSubjectRequest, v1alpha1.GetCurrentUserSubjectResponse]( + httpClient, + baseURL+AuthnServiceGetCurrentUserSubjectProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// authnServiceClient implements AuthnServiceClient. +type authnServiceClient struct { + getCurrentUser *connect_go.Client[v1alpha1.GetCurrentUserRequest, v1alpha1.GetCurrentUserResponse] + getCurrentUserSubject *connect_go.Client[v1alpha1.GetCurrentUserSubjectRequest, v1alpha1.GetCurrentUserSubjectResponse] +} + +// GetCurrentUser calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUser. +func (c *authnServiceClient) GetCurrentUser(ctx context.Context, req *connect_go.Request[v1alpha1.GetCurrentUserRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserResponse], error) { + return c.getCurrentUser.CallUnary(ctx, req) +} + +// GetCurrentUserSubject calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUserSubject. +func (c *authnServiceClient) GetCurrentUserSubject(ctx context.Context, req *connect_go.Request[v1alpha1.GetCurrentUserSubjectRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserSubjectResponse], error) { + return c.getCurrentUserSubject.CallUnary(ctx, req) +} + +// AuthnServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthnService service. +type AuthnServiceHandler interface { + // GetCurrentUser gets information associated with the current user. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUser(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserResponse], error) + // GetCurrentUserSubject gets the currently logged in users subject. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUserSubject(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserSubjectRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserSubjectResponse], error) +} + +// NewAuthnServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAuthnServiceHandler(svc AuthnServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + authnServiceGetCurrentUserHandler := connect_go.NewUnaryHandler( + AuthnServiceGetCurrentUserProcedure, + svc.GetCurrentUser, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authnServiceGetCurrentUserSubjectHandler := connect_go.NewUnaryHandler( + AuthnServiceGetCurrentUserSubjectProcedure, + svc.GetCurrentUserSubject, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.AuthnService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AuthnServiceGetCurrentUserProcedure: + authnServiceGetCurrentUserHandler.ServeHTTP(w, r) + case AuthnServiceGetCurrentUserSubjectProcedure: + authnServiceGetCurrentUserSubjectHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAuthnServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAuthnServiceHandler struct{} + +func (UnimplementedAuthnServiceHandler) GetCurrentUser(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUser is not implemented")) +} + +func (UnimplementedAuthnServiceHandler) GetCurrentUserSubject(context.Context, *connect_go.Request[v1alpha1.GetCurrentUserSubjectRequest]) (*connect_go.Response[v1alpha1.GetCurrentUserSubjectResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUserSubject is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/authz.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/authz.connect.go new file mode 100644 index 000000000..e31d08866 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/authz.connect.go @@ -0,0 +1,828 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/authz.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // AuthzServiceName is the fully-qualified name of the AuthzService service. + AuthzServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.AuthzService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AuthzServiceUserCanCreateOrganizationRepositoryProcedure is the fully-qualified name of the + // AuthzService's UserCanCreateOrganizationRepository RPC. + AuthzServiceUserCanCreateOrganizationRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationRepository" + // AuthzServiceUserCanSeeRepositorySettingsProcedure is the fully-qualified name of the + // AuthzService's UserCanSeeRepositorySettings RPC. + AuthzServiceUserCanSeeRepositorySettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeRepositorySettings" + // AuthzServiceUserCanSeeOrganizationSettingsProcedure is the fully-qualified name of the + // AuthzService's UserCanSeeOrganizationSettings RPC. + AuthzServiceUserCanSeeOrganizationSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeOrganizationSettings" + // AuthzServiceUserCanReadPluginProcedure is the fully-qualified name of the AuthzService's + // UserCanReadPlugin RPC. + AuthzServiceUserCanReadPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanReadPlugin" + // AuthzServiceUserCanCreatePluginVersionProcedure is the fully-qualified name of the AuthzService's + // UserCanCreatePluginVersion RPC. + AuthzServiceUserCanCreatePluginVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreatePluginVersion" + // AuthzServiceUserCanCreateTemplateVersionProcedure is the fully-qualified name of the + // AuthzService's UserCanCreateTemplateVersion RPC. + AuthzServiceUserCanCreateTemplateVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateTemplateVersion" + // AuthzServiceUserCanCreateOrganizationPluginProcedure is the fully-qualified name of the + // AuthzService's UserCanCreateOrganizationPlugin RPC. + AuthzServiceUserCanCreateOrganizationPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationPlugin" + // AuthzServiceUserCanCreateOrganizationTemplateProcedure is the fully-qualified name of the + // AuthzService's UserCanCreateOrganizationTemplate RPC. + AuthzServiceUserCanCreateOrganizationTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationTemplate" + // AuthzServiceUserCanSeePluginSettingsProcedure is the fully-qualified name of the AuthzService's + // UserCanSeePluginSettings RPC. + AuthzServiceUserCanSeePluginSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeePluginSettings" + // AuthzServiceUserCanSeeTemplateSettingsProcedure is the fully-qualified name of the AuthzService's + // UserCanSeeTemplateSettings RPC. + AuthzServiceUserCanSeeTemplateSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeTemplateSettings" + // AuthzServiceUserCanAddOrganizationMemberProcedure is the fully-qualified name of the + // AuthzService's UserCanAddOrganizationMember RPC. + AuthzServiceUserCanAddOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanAddOrganizationMember" + // AuthzServiceUserCanUpdateOrganizationMemberProcedure is the fully-qualified name of the + // AuthzService's UserCanUpdateOrganizationMember RPC. + AuthzServiceUserCanUpdateOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanUpdateOrganizationMember" + // AuthzServiceUserCanRemoveOrganizationMemberProcedure is the fully-qualified name of the + // AuthzService's UserCanRemoveOrganizationMember RPC. + AuthzServiceUserCanRemoveOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanRemoveOrganizationMember" + // AuthzServiceUserCanDeleteOrganizationProcedure is the fully-qualified name of the AuthzService's + // UserCanDeleteOrganization RPC. + AuthzServiceUserCanDeleteOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteOrganization" + // AuthzServiceUserCanDeleteRepositoryProcedure is the fully-qualified name of the AuthzService's + // UserCanDeleteRepository RPC. + AuthzServiceUserCanDeleteRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteRepository" + // AuthzServiceUserCanDeleteTemplateProcedure is the fully-qualified name of the AuthzService's + // UserCanDeleteTemplate RPC. + AuthzServiceUserCanDeleteTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteTemplate" + // AuthzServiceUserCanDeletePluginProcedure is the fully-qualified name of the AuthzService's + // UserCanDeletePlugin RPC. + AuthzServiceUserCanDeletePluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeletePlugin" + // AuthzServiceUserCanDeleteUserProcedure is the fully-qualified name of the AuthzService's + // UserCanDeleteUser RPC. + AuthzServiceUserCanDeleteUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteUser" + // AuthzServiceUserCanSeeServerAdminPanelProcedure is the fully-qualified name of the AuthzService's + // UserCanSeeServerAdminPanel RPC. + AuthzServiceUserCanSeeServerAdminPanelProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeServerAdminPanel" + // AuthzServiceUserCanManageRepositoryContributorsProcedure is the fully-qualified name of the + // AuthzService's UserCanManageRepositoryContributors RPC. + AuthzServiceUserCanManageRepositoryContributorsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanManageRepositoryContributors" +) + +// AuthzServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService service. +type AuthzServiceClient interface { + // UserCanCreateOrganizationRepository returns whether the user is authorized + // to create repositories in an organization. + UserCanCreateOrganizationRepository(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationRepositoryResponse], error) + // UserCanSeeRepositorySettings returns whether the user is authorized + // to see repository settings. + UserCanSeeRepositorySettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeRepositorySettingsResponse], error) + // UserCanSeeOrganizationSettings returns whether the user is authorized + // to see organization settings. + UserCanSeeOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeOrganizationSettingsResponse], error) + // UserCanReadPlugin returns whether the user has read access to the specified plugin. + // + // Deprecated: do not use. + UserCanReadPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanReadPluginRequest]) (*connect_go.Response[v1alpha1.UserCanReadPluginResponse], error) + // UserCanCreatePluginVersion returns whether the user is authorized + // to create a plugin version under the specified plugin. + // + // Deprecated: do not use. + UserCanCreatePluginVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreatePluginVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreatePluginVersionResponse], error) + // UserCanCreateTemplateVersion returns whether the user is authorized + // to create a template version under the specified template. + // + // Deprecated: do not use. + UserCanCreateTemplateVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreateTemplateVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreateTemplateVersionResponse], error) + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a plugin in an organization. + // + // Deprecated: do not use. + UserCanCreateOrganizationPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationPluginRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationPluginResponse], error) + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a template in an organization. + // + // Deprecated: do not use. + UserCanCreateOrganizationTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationTemplateResponse], error) + // UserCanSeePluginSettings returns whether the user is authorized + // to see plugin settings. + // + // Deprecated: do not use. + UserCanSeePluginSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeePluginSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeePluginSettingsResponse], error) + // UserCanSeeTemplateSettings returns whether the user is authorized + // to see template settings. + // + // Deprecated: do not use. + UserCanSeeTemplateSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeTemplateSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeTemplateSettingsResponse], error) + // UserCanAddOrganizationMember returns whether the user is authorized to add + // any members to the organization and the list of roles they can add. + UserCanAddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanAddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanAddOrganizationMemberResponse], error) + // UserCanUpdateOrganizationMember returns whether the user is authorized to update + // any members' membership information in the organization and the list of roles they can update. + UserCanUpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanUpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanUpdateOrganizationMemberResponse], error) + // UserCanRemoveOrganizationMember returns whether the user is authorized to remove + // any members from the organization and the list of roles they can remove. + UserCanRemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanRemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanRemoveOrganizationMemberResponse], error) + // UserCanDeleteOrganization returns whether the user is authorized + // to delete an organization. + UserCanDeleteOrganization(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteOrganizationResponse], error) + // UserCanDeleteRepository returns whether the user is authorized + // to delete a repository. + UserCanDeleteRepository(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteRepositoryResponse], error) + // UserCanDeleteTemplate returns whether the user is authorized + // to delete a template. + // + // Deprecated: do not use. + UserCanDeleteTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteTemplateResponse], error) + // UserCanDeletePlugin returns whether the user is authorized + // to delete a plugin. + // + // Deprecated: do not use. + UserCanDeletePlugin(context.Context, *connect_go.Request[v1alpha1.UserCanDeletePluginRequest]) (*connect_go.Response[v1alpha1.UserCanDeletePluginResponse], error) + // UserCanDeleteUser returns whether the user is authorized + // to delete a user. + UserCanDeleteUser(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteUserRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteUserResponse], error) + // UserCanSeeServerAdminPanel returns whether the user is authorized + // to see server admin panel. + UserCanSeeServerAdminPanel(context.Context, *connect_go.Request[v1alpha1.UserCanSeeServerAdminPanelRequest]) (*connect_go.Response[v1alpha1.UserCanSeeServerAdminPanelResponse], error) + // UserCanManageRepositoryContributors returns whether the user is authorized to manage + // any contributors to the repository and the list of roles they can manage. + UserCanManageRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.UserCanManageRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.UserCanManageRepositoryContributorsResponse], error) +} + +// NewAuthzServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAuthzServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) AuthzServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &authzServiceClient{ + userCanCreateOrganizationRepository: connect_go.NewClient[v1alpha1.UserCanCreateOrganizationRepositoryRequest, v1alpha1.UserCanCreateOrganizationRepositoryResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreateOrganizationRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeeRepositorySettings: connect_go.NewClient[v1alpha1.UserCanSeeRepositorySettingsRequest, v1alpha1.UserCanSeeRepositorySettingsResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeeRepositorySettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeeOrganizationSettings: connect_go.NewClient[v1alpha1.UserCanSeeOrganizationSettingsRequest, v1alpha1.UserCanSeeOrganizationSettingsResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeeOrganizationSettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanReadPlugin: connect_go.NewClient[v1alpha1.UserCanReadPluginRequest, v1alpha1.UserCanReadPluginResponse]( + httpClient, + baseURL+AuthzServiceUserCanReadPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanCreatePluginVersion: connect_go.NewClient[v1alpha1.UserCanCreatePluginVersionRequest, v1alpha1.UserCanCreatePluginVersionResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreatePluginVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanCreateTemplateVersion: connect_go.NewClient[v1alpha1.UserCanCreateTemplateVersionRequest, v1alpha1.UserCanCreateTemplateVersionResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreateTemplateVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanCreateOrganizationPlugin: connect_go.NewClient[v1alpha1.UserCanCreateOrganizationPluginRequest, v1alpha1.UserCanCreateOrganizationPluginResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreateOrganizationPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanCreateOrganizationTemplate: connect_go.NewClient[v1alpha1.UserCanCreateOrganizationTemplateRequest, v1alpha1.UserCanCreateOrganizationTemplateResponse]( + httpClient, + baseURL+AuthzServiceUserCanCreateOrganizationTemplateProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeePluginSettings: connect_go.NewClient[v1alpha1.UserCanSeePluginSettingsRequest, v1alpha1.UserCanSeePluginSettingsResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeePluginSettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeeTemplateSettings: connect_go.NewClient[v1alpha1.UserCanSeeTemplateSettingsRequest, v1alpha1.UserCanSeeTemplateSettingsResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeeTemplateSettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanAddOrganizationMember: connect_go.NewClient[v1alpha1.UserCanAddOrganizationMemberRequest, v1alpha1.UserCanAddOrganizationMemberResponse]( + httpClient, + baseURL+AuthzServiceUserCanAddOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanUpdateOrganizationMember: connect_go.NewClient[v1alpha1.UserCanUpdateOrganizationMemberRequest, v1alpha1.UserCanUpdateOrganizationMemberResponse]( + httpClient, + baseURL+AuthzServiceUserCanUpdateOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanRemoveOrganizationMember: connect_go.NewClient[v1alpha1.UserCanRemoveOrganizationMemberRequest, v1alpha1.UserCanRemoveOrganizationMemberResponse]( + httpClient, + baseURL+AuthzServiceUserCanRemoveOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeleteOrganization: connect_go.NewClient[v1alpha1.UserCanDeleteOrganizationRequest, v1alpha1.UserCanDeleteOrganizationResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeleteOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeleteRepository: connect_go.NewClient[v1alpha1.UserCanDeleteRepositoryRequest, v1alpha1.UserCanDeleteRepositoryResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeleteRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeleteTemplate: connect_go.NewClient[v1alpha1.UserCanDeleteTemplateRequest, v1alpha1.UserCanDeleteTemplateResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeleteTemplateProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeletePlugin: connect_go.NewClient[v1alpha1.UserCanDeletePluginRequest, v1alpha1.UserCanDeletePluginResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeletePluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanDeleteUser: connect_go.NewClient[v1alpha1.UserCanDeleteUserRequest, v1alpha1.UserCanDeleteUserResponse]( + httpClient, + baseURL+AuthzServiceUserCanDeleteUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanSeeServerAdminPanel: connect_go.NewClient[v1alpha1.UserCanSeeServerAdminPanelRequest, v1alpha1.UserCanSeeServerAdminPanelResponse]( + httpClient, + baseURL+AuthzServiceUserCanSeeServerAdminPanelProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + userCanManageRepositoryContributors: connect_go.NewClient[v1alpha1.UserCanManageRepositoryContributorsRequest, v1alpha1.UserCanManageRepositoryContributorsResponse]( + httpClient, + baseURL+AuthzServiceUserCanManageRepositoryContributorsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// authzServiceClient implements AuthzServiceClient. +type authzServiceClient struct { + userCanCreateOrganizationRepository *connect_go.Client[v1alpha1.UserCanCreateOrganizationRepositoryRequest, v1alpha1.UserCanCreateOrganizationRepositoryResponse] + userCanSeeRepositorySettings *connect_go.Client[v1alpha1.UserCanSeeRepositorySettingsRequest, v1alpha1.UserCanSeeRepositorySettingsResponse] + userCanSeeOrganizationSettings *connect_go.Client[v1alpha1.UserCanSeeOrganizationSettingsRequest, v1alpha1.UserCanSeeOrganizationSettingsResponse] + userCanReadPlugin *connect_go.Client[v1alpha1.UserCanReadPluginRequest, v1alpha1.UserCanReadPluginResponse] + userCanCreatePluginVersion *connect_go.Client[v1alpha1.UserCanCreatePluginVersionRequest, v1alpha1.UserCanCreatePluginVersionResponse] + userCanCreateTemplateVersion *connect_go.Client[v1alpha1.UserCanCreateTemplateVersionRequest, v1alpha1.UserCanCreateTemplateVersionResponse] + userCanCreateOrganizationPlugin *connect_go.Client[v1alpha1.UserCanCreateOrganizationPluginRequest, v1alpha1.UserCanCreateOrganizationPluginResponse] + userCanCreateOrganizationTemplate *connect_go.Client[v1alpha1.UserCanCreateOrganizationTemplateRequest, v1alpha1.UserCanCreateOrganizationTemplateResponse] + userCanSeePluginSettings *connect_go.Client[v1alpha1.UserCanSeePluginSettingsRequest, v1alpha1.UserCanSeePluginSettingsResponse] + userCanSeeTemplateSettings *connect_go.Client[v1alpha1.UserCanSeeTemplateSettingsRequest, v1alpha1.UserCanSeeTemplateSettingsResponse] + userCanAddOrganizationMember *connect_go.Client[v1alpha1.UserCanAddOrganizationMemberRequest, v1alpha1.UserCanAddOrganizationMemberResponse] + userCanUpdateOrganizationMember *connect_go.Client[v1alpha1.UserCanUpdateOrganizationMemberRequest, v1alpha1.UserCanUpdateOrganizationMemberResponse] + userCanRemoveOrganizationMember *connect_go.Client[v1alpha1.UserCanRemoveOrganizationMemberRequest, v1alpha1.UserCanRemoveOrganizationMemberResponse] + userCanDeleteOrganization *connect_go.Client[v1alpha1.UserCanDeleteOrganizationRequest, v1alpha1.UserCanDeleteOrganizationResponse] + userCanDeleteRepository *connect_go.Client[v1alpha1.UserCanDeleteRepositoryRequest, v1alpha1.UserCanDeleteRepositoryResponse] + userCanDeleteTemplate *connect_go.Client[v1alpha1.UserCanDeleteTemplateRequest, v1alpha1.UserCanDeleteTemplateResponse] + userCanDeletePlugin *connect_go.Client[v1alpha1.UserCanDeletePluginRequest, v1alpha1.UserCanDeletePluginResponse] + userCanDeleteUser *connect_go.Client[v1alpha1.UserCanDeleteUserRequest, v1alpha1.UserCanDeleteUserResponse] + userCanSeeServerAdminPanel *connect_go.Client[v1alpha1.UserCanSeeServerAdminPanelRequest, v1alpha1.UserCanSeeServerAdminPanelResponse] + userCanManageRepositoryContributors *connect_go.Client[v1alpha1.UserCanManageRepositoryContributorsRequest, v1alpha1.UserCanManageRepositoryContributorsResponse] +} + +// UserCanCreateOrganizationRepository calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationRepository. +func (c *authzServiceClient) UserCanCreateOrganizationRepository(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreateOrganizationRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationRepositoryResponse], error) { + return c.userCanCreateOrganizationRepository.CallUnary(ctx, req) +} + +// UserCanSeeRepositorySettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeRepositorySettings. +func (c *authzServiceClient) UserCanSeeRepositorySettings(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeeRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeRepositorySettingsResponse], error) { + return c.userCanSeeRepositorySettings.CallUnary(ctx, req) +} + +// UserCanSeeOrganizationSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeOrganizationSettings. +func (c *authzServiceClient) UserCanSeeOrganizationSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeeOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeOrganizationSettingsResponse], error) { + return c.userCanSeeOrganizationSettings.CallUnary(ctx, req) +} + +// UserCanReadPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanReadPlugin. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanReadPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanReadPluginRequest]) (*connect_go.Response[v1alpha1.UserCanReadPluginResponse], error) { + return c.userCanReadPlugin.CallUnary(ctx, req) +} + +// UserCanCreatePluginVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreatePluginVersion. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanCreatePluginVersion(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreatePluginVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreatePluginVersionResponse], error) { + return c.userCanCreatePluginVersion.CallUnary(ctx, req) +} + +// UserCanCreateTemplateVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateTemplateVersion. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanCreateTemplateVersion(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreateTemplateVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreateTemplateVersionResponse], error) { + return c.userCanCreateTemplateVersion.CallUnary(ctx, req) +} + +// UserCanCreateOrganizationPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationPlugin. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanCreateOrganizationPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreateOrganizationPluginRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationPluginResponse], error) { + return c.userCanCreateOrganizationPlugin.CallUnary(ctx, req) +} + +// UserCanCreateOrganizationTemplate calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationTemplate. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanCreateOrganizationTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanCreateOrganizationTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationTemplateResponse], error) { + return c.userCanCreateOrganizationTemplate.CallUnary(ctx, req) +} + +// UserCanSeePluginSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeePluginSettings. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanSeePluginSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeePluginSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeePluginSettingsResponse], error) { + return c.userCanSeePluginSettings.CallUnary(ctx, req) +} + +// UserCanSeeTemplateSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeTemplateSettings. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanSeeTemplateSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeeTemplateSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeTemplateSettingsResponse], error) { + return c.userCanSeeTemplateSettings.CallUnary(ctx, req) +} + +// UserCanAddOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanAddOrganizationMember. +func (c *authzServiceClient) UserCanAddOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanAddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanAddOrganizationMemberResponse], error) { + return c.userCanAddOrganizationMember.CallUnary(ctx, req) +} + +// UserCanUpdateOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanUpdateOrganizationMember. +func (c *authzServiceClient) UserCanUpdateOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanUpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanUpdateOrganizationMemberResponse], error) { + return c.userCanUpdateOrganizationMember.CallUnary(ctx, req) +} + +// UserCanRemoveOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanRemoveOrganizationMember. +func (c *authzServiceClient) UserCanRemoveOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanRemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanRemoveOrganizationMemberResponse], error) { + return c.userCanRemoveOrganizationMember.CallUnary(ctx, req) +} + +// UserCanDeleteOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteOrganization. +func (c *authzServiceClient) UserCanDeleteOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteOrganizationResponse], error) { + return c.userCanDeleteOrganization.CallUnary(ctx, req) +} + +// UserCanDeleteRepository calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteRepository. +func (c *authzServiceClient) UserCanDeleteRepository(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteRepositoryResponse], error) { + return c.userCanDeleteRepository.CallUnary(ctx, req) +} + +// UserCanDeleteTemplate calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteTemplate. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanDeleteTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeleteTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteTemplateResponse], error) { + return c.userCanDeleteTemplate.CallUnary(ctx, req) +} + +// UserCanDeletePlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeletePlugin. +// +// Deprecated: do not use. +func (c *authzServiceClient) UserCanDeletePlugin(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeletePluginRequest]) (*connect_go.Response[v1alpha1.UserCanDeletePluginResponse], error) { + return c.userCanDeletePlugin.CallUnary(ctx, req) +} + +// UserCanDeleteUser calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteUser. +func (c *authzServiceClient) UserCanDeleteUser(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanDeleteUserRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteUserResponse], error) { + return c.userCanDeleteUser.CallUnary(ctx, req) +} + +// UserCanSeeServerAdminPanel calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeServerAdminPanel. +func (c *authzServiceClient) UserCanSeeServerAdminPanel(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanSeeServerAdminPanelRequest]) (*connect_go.Response[v1alpha1.UserCanSeeServerAdminPanelResponse], error) { + return c.userCanSeeServerAdminPanel.CallUnary(ctx, req) +} + +// UserCanManageRepositoryContributors calls +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanManageRepositoryContributors. +func (c *authzServiceClient) UserCanManageRepositoryContributors(ctx context.Context, req *connect_go.Request[v1alpha1.UserCanManageRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.UserCanManageRepositoryContributorsResponse], error) { + return c.userCanManageRepositoryContributors.CallUnary(ctx, req) +} + +// AuthzServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.AuthzService service. +type AuthzServiceHandler interface { + // UserCanCreateOrganizationRepository returns whether the user is authorized + // to create repositories in an organization. + UserCanCreateOrganizationRepository(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationRepositoryResponse], error) + // UserCanSeeRepositorySettings returns whether the user is authorized + // to see repository settings. + UserCanSeeRepositorySettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeRepositorySettingsResponse], error) + // UserCanSeeOrganizationSettings returns whether the user is authorized + // to see organization settings. + UserCanSeeOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeOrganizationSettingsResponse], error) + // UserCanReadPlugin returns whether the user has read access to the specified plugin. + // + // Deprecated: do not use. + UserCanReadPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanReadPluginRequest]) (*connect_go.Response[v1alpha1.UserCanReadPluginResponse], error) + // UserCanCreatePluginVersion returns whether the user is authorized + // to create a plugin version under the specified plugin. + // + // Deprecated: do not use. + UserCanCreatePluginVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreatePluginVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreatePluginVersionResponse], error) + // UserCanCreateTemplateVersion returns whether the user is authorized + // to create a template version under the specified template. + // + // Deprecated: do not use. + UserCanCreateTemplateVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreateTemplateVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreateTemplateVersionResponse], error) + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a plugin in an organization. + // + // Deprecated: do not use. + UserCanCreateOrganizationPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationPluginRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationPluginResponse], error) + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a template in an organization. + // + // Deprecated: do not use. + UserCanCreateOrganizationTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationTemplateResponse], error) + // UserCanSeePluginSettings returns whether the user is authorized + // to see plugin settings. + // + // Deprecated: do not use. + UserCanSeePluginSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeePluginSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeePluginSettingsResponse], error) + // UserCanSeeTemplateSettings returns whether the user is authorized + // to see template settings. + // + // Deprecated: do not use. + UserCanSeeTemplateSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeTemplateSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeTemplateSettingsResponse], error) + // UserCanAddOrganizationMember returns whether the user is authorized to add + // any members to the organization and the list of roles they can add. + UserCanAddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanAddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanAddOrganizationMemberResponse], error) + // UserCanUpdateOrganizationMember returns whether the user is authorized to update + // any members' membership information in the organization and the list of roles they can update. + UserCanUpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanUpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanUpdateOrganizationMemberResponse], error) + // UserCanRemoveOrganizationMember returns whether the user is authorized to remove + // any members from the organization and the list of roles they can remove. + UserCanRemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanRemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanRemoveOrganizationMemberResponse], error) + // UserCanDeleteOrganization returns whether the user is authorized + // to delete an organization. + UserCanDeleteOrganization(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteOrganizationResponse], error) + // UserCanDeleteRepository returns whether the user is authorized + // to delete a repository. + UserCanDeleteRepository(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteRepositoryResponse], error) + // UserCanDeleteTemplate returns whether the user is authorized + // to delete a template. + // + // Deprecated: do not use. + UserCanDeleteTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteTemplateResponse], error) + // UserCanDeletePlugin returns whether the user is authorized + // to delete a plugin. + // + // Deprecated: do not use. + UserCanDeletePlugin(context.Context, *connect_go.Request[v1alpha1.UserCanDeletePluginRequest]) (*connect_go.Response[v1alpha1.UserCanDeletePluginResponse], error) + // UserCanDeleteUser returns whether the user is authorized + // to delete a user. + UserCanDeleteUser(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteUserRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteUserResponse], error) + // UserCanSeeServerAdminPanel returns whether the user is authorized + // to see server admin panel. + UserCanSeeServerAdminPanel(context.Context, *connect_go.Request[v1alpha1.UserCanSeeServerAdminPanelRequest]) (*connect_go.Response[v1alpha1.UserCanSeeServerAdminPanelResponse], error) + // UserCanManageRepositoryContributors returns whether the user is authorized to manage + // any contributors to the repository and the list of roles they can manage. + UserCanManageRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.UserCanManageRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.UserCanManageRepositoryContributorsResponse], error) +} + +// NewAuthzServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAuthzServiceHandler(svc AuthzServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + authzServiceUserCanCreateOrganizationRepositoryHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreateOrganizationRepositoryProcedure, + svc.UserCanCreateOrganizationRepository, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeeRepositorySettingsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeeRepositorySettingsProcedure, + svc.UserCanSeeRepositorySettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeeOrganizationSettingsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeeOrganizationSettingsProcedure, + svc.UserCanSeeOrganizationSettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanReadPluginHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanReadPluginProcedure, + svc.UserCanReadPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanCreatePluginVersionHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreatePluginVersionProcedure, + svc.UserCanCreatePluginVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanCreateTemplateVersionHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreateTemplateVersionProcedure, + svc.UserCanCreateTemplateVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanCreateOrganizationPluginHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreateOrganizationPluginProcedure, + svc.UserCanCreateOrganizationPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanCreateOrganizationTemplateHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanCreateOrganizationTemplateProcedure, + svc.UserCanCreateOrganizationTemplate, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeePluginSettingsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeePluginSettingsProcedure, + svc.UserCanSeePluginSettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeeTemplateSettingsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeeTemplateSettingsProcedure, + svc.UserCanSeeTemplateSettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanAddOrganizationMemberHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanAddOrganizationMemberProcedure, + svc.UserCanAddOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanUpdateOrganizationMemberHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanUpdateOrganizationMemberProcedure, + svc.UserCanUpdateOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanRemoveOrganizationMemberHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanRemoveOrganizationMemberProcedure, + svc.UserCanRemoveOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeleteOrganizationHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeleteOrganizationProcedure, + svc.UserCanDeleteOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeleteRepositoryHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeleteRepositoryProcedure, + svc.UserCanDeleteRepository, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeleteTemplateHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeleteTemplateProcedure, + svc.UserCanDeleteTemplate, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeletePluginHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeletePluginProcedure, + svc.UserCanDeletePlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanDeleteUserHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanDeleteUserProcedure, + svc.UserCanDeleteUser, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanSeeServerAdminPanelHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanSeeServerAdminPanelProcedure, + svc.UserCanSeeServerAdminPanel, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + authzServiceUserCanManageRepositoryContributorsHandler := connect_go.NewUnaryHandler( + AuthzServiceUserCanManageRepositoryContributorsProcedure, + svc.UserCanManageRepositoryContributors, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AuthzServiceUserCanCreateOrganizationRepositoryProcedure: + authzServiceUserCanCreateOrganizationRepositoryHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeeRepositorySettingsProcedure: + authzServiceUserCanSeeRepositorySettingsHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeeOrganizationSettingsProcedure: + authzServiceUserCanSeeOrganizationSettingsHandler.ServeHTTP(w, r) + case AuthzServiceUserCanReadPluginProcedure: + authzServiceUserCanReadPluginHandler.ServeHTTP(w, r) + case AuthzServiceUserCanCreatePluginVersionProcedure: + authzServiceUserCanCreatePluginVersionHandler.ServeHTTP(w, r) + case AuthzServiceUserCanCreateTemplateVersionProcedure: + authzServiceUserCanCreateTemplateVersionHandler.ServeHTTP(w, r) + case AuthzServiceUserCanCreateOrganizationPluginProcedure: + authzServiceUserCanCreateOrganizationPluginHandler.ServeHTTP(w, r) + case AuthzServiceUserCanCreateOrganizationTemplateProcedure: + authzServiceUserCanCreateOrganizationTemplateHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeePluginSettingsProcedure: + authzServiceUserCanSeePluginSettingsHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeeTemplateSettingsProcedure: + authzServiceUserCanSeeTemplateSettingsHandler.ServeHTTP(w, r) + case AuthzServiceUserCanAddOrganizationMemberProcedure: + authzServiceUserCanAddOrganizationMemberHandler.ServeHTTP(w, r) + case AuthzServiceUserCanUpdateOrganizationMemberProcedure: + authzServiceUserCanUpdateOrganizationMemberHandler.ServeHTTP(w, r) + case AuthzServiceUserCanRemoveOrganizationMemberProcedure: + authzServiceUserCanRemoveOrganizationMemberHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeleteOrganizationProcedure: + authzServiceUserCanDeleteOrganizationHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeleteRepositoryProcedure: + authzServiceUserCanDeleteRepositoryHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeleteTemplateProcedure: + authzServiceUserCanDeleteTemplateHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeletePluginProcedure: + authzServiceUserCanDeletePluginHandler.ServeHTTP(w, r) + case AuthzServiceUserCanDeleteUserProcedure: + authzServiceUserCanDeleteUserHandler.ServeHTTP(w, r) + case AuthzServiceUserCanSeeServerAdminPanelProcedure: + authzServiceUserCanSeeServerAdminPanelHandler.ServeHTTP(w, r) + case AuthzServiceUserCanManageRepositoryContributorsProcedure: + authzServiceUserCanManageRepositoryContributorsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAuthzServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAuthzServiceHandler struct{} + +func (UnimplementedAuthzServiceHandler) UserCanCreateOrganizationRepository(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationRepository is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeeRepositorySettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeRepositorySettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeRepositorySettings is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeeOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeOrganizationSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeOrganizationSettings is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanReadPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanReadPluginRequest]) (*connect_go.Response[v1alpha1.UserCanReadPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanReadPlugin is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanCreatePluginVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreatePluginVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreatePluginVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreatePluginVersion is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanCreateTemplateVersion(context.Context, *connect_go.Request[v1alpha1.UserCanCreateTemplateVersionRequest]) (*connect_go.Response[v1alpha1.UserCanCreateTemplateVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateTemplateVersion is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanCreateOrganizationPlugin(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationPluginRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationPlugin is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanCreateOrganizationTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanCreateOrganizationTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanCreateOrganizationTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationTemplate is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeePluginSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeePluginSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeePluginSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeePluginSettings is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeeTemplateSettings(context.Context, *connect_go.Request[v1alpha1.UserCanSeeTemplateSettingsRequest]) (*connect_go.Response[v1alpha1.UserCanSeeTemplateSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeTemplateSettings is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanAddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanAddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanAddOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanAddOrganizationMember is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanUpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanUpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanUpdateOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanUpdateOrganizationMember is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanRemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UserCanRemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UserCanRemoveOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanRemoveOrganizationMember is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeleteOrganization(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteOrganization is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeleteRepository(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteRepository is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeleteTemplate(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteTemplateRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteTemplate is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeletePlugin(context.Context, *connect_go.Request[v1alpha1.UserCanDeletePluginRequest]) (*connect_go.Response[v1alpha1.UserCanDeletePluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeletePlugin is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanDeleteUser(context.Context, *connect_go.Request[v1alpha1.UserCanDeleteUserRequest]) (*connect_go.Response[v1alpha1.UserCanDeleteUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteUser is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanSeeServerAdminPanel(context.Context, *connect_go.Request[v1alpha1.UserCanSeeServerAdminPanelRequest]) (*connect_go.Response[v1alpha1.UserCanSeeServerAdminPanelResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeServerAdminPanel is not implemented")) +} + +func (UnimplementedAuthzServiceHandler) UserCanManageRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.UserCanManageRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.UserCanManageRepositoryContributorsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanManageRepositoryContributors is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/convert.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/convert.connect.go new file mode 100644 index 000000000..ddbb0946f --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/convert.connect.go @@ -0,0 +1,126 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/convert.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // ConvertServiceName is the fully-qualified name of the ConvertService service. + ConvertServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ConvertService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ConvertServiceConvertProcedure is the fully-qualified name of the ConvertService's Convert RPC. + ConvertServiceConvertProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ConvertService/Convert" +) + +// ConvertServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ConvertService service. +type ConvertServiceClient interface { + // Convert converts a serialized message according to + // the provided type name using an image. + Convert(context.Context, *connect_go.Request[v1alpha1.ConvertRequest]) (*connect_go.Response[v1alpha1.ConvertResponse], error) +} + +// NewConvertServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ConvertService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewConvertServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ConvertServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &convertServiceClient{ + convert: connect_go.NewClient[v1alpha1.ConvertRequest, v1alpha1.ConvertResponse]( + httpClient, + baseURL+ConvertServiceConvertProcedure, + opts..., + ), + } +} + +// convertServiceClient implements ConvertServiceClient. +type convertServiceClient struct { + convert *connect_go.Client[v1alpha1.ConvertRequest, v1alpha1.ConvertResponse] +} + +// Convert calls bufman.dubbo.apache.org.registry.v1alpha1.ConvertService.Convert. +func (c *convertServiceClient) Convert(ctx context.Context, req *connect_go.Request[v1alpha1.ConvertRequest]) (*connect_go.Response[v1alpha1.ConvertResponse], error) { + return c.convert.CallUnary(ctx, req) +} + +// ConvertServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ConvertService service. +type ConvertServiceHandler interface { + // Convert converts a serialized message according to + // the provided type name using an image. + Convert(context.Context, *connect_go.Request[v1alpha1.ConvertRequest]) (*connect_go.Response[v1alpha1.ConvertResponse], error) +} + +// NewConvertServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewConvertServiceHandler(svc ConvertServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + convertServiceConvertHandler := connect_go.NewUnaryHandler( + ConvertServiceConvertProcedure, + svc.Convert, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ConvertService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ConvertServiceConvertProcedure: + convertServiceConvertHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedConvertServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedConvertServiceHandler struct{} + +func (UnimplementedConvertServiceHandler) Convert(context.Context, *connect_go.Request[v1alpha1.ConvertRequest]) (*connect_go.Response[v1alpha1.ConvertResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ConvertService.Convert is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/display.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/display.connect.go new file mode 100644 index 000000000..4146ab167 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/display.connect.go @@ -0,0 +1,356 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/display.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // DisplayServiceName is the fully-qualified name of the DisplayService service. + DisplayServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.DisplayService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DisplayServiceDisplayOrganizationElementsProcedure is the fully-qualified name of the + // DisplayService's DisplayOrganizationElements RPC. + DisplayServiceDisplayOrganizationElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayOrganizationElements" + // DisplayServiceDisplayRepositoryElementsProcedure is the fully-qualified name of the + // DisplayService's DisplayRepositoryElements RPC. + DisplayServiceDisplayRepositoryElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayRepositoryElements" + // DisplayServiceDisplayUserElementsProcedure is the fully-qualified name of the DisplayService's + // DisplayUserElements RPC. + DisplayServiceDisplayUserElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayUserElements" + // DisplayServiceDisplayServerElementsProcedure is the fully-qualified name of the DisplayService's + // DisplayServerElements RPC. + DisplayServiceDisplayServerElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayServerElements" + // DisplayServiceDisplayOwnerEntitledElementsProcedure is the fully-qualified name of the + // DisplayService's DisplayOwnerEntitledElements RPC. + DisplayServiceDisplayOwnerEntitledElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayOwnerEntitledElements" + // DisplayServiceDisplayRepositoryEntitledElementsProcedure is the fully-qualified name of the + // DisplayService's DisplayRepositoryEntitledElements RPC. + DisplayServiceDisplayRepositoryEntitledElementsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayRepositoryEntitledElements" + // DisplayServiceListManageableRepositoryRolesProcedure is the fully-qualified name of the + // DisplayService's ListManageableRepositoryRoles RPC. + DisplayServiceListManageableRepositoryRolesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/ListManageableRepositoryRoles" + // DisplayServiceListManageableUserRepositoryRolesProcedure is the fully-qualified name of the + // DisplayService's ListManageableUserRepositoryRoles RPC. + DisplayServiceListManageableUserRepositoryRolesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/ListManageableUserRepositoryRoles" +) + +// DisplayServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService service. +type DisplayServiceClient interface { + // DisplayOrganizationElements returns which organization elements should be displayed to the user. + DisplayOrganizationElements(context.Context, *connect_go.Request[v1alpha1.DisplayOrganizationElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOrganizationElementsResponse], error) + // DisplayRepositoryElements returns which repository elements should be displayed to the user. + DisplayRepositoryElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryElementsResponse], error) + // DisplayUserElements returns which user elements should be displayed to the user. + DisplayUserElements(context.Context, *connect_go.Request[v1alpha1.DisplayUserElementsRequest]) (*connect_go.Response[v1alpha1.DisplayUserElementsResponse], error) + // DisplayServerElements returns which server elements should be displayed to the user. + DisplayServerElements(context.Context, *connect_go.Request[v1alpha1.DisplayServerElementsRequest]) (*connect_go.Response[v1alpha1.DisplayServerElementsResponse], error) + // DisplayOwnerEntitledElements returns which owner elements are entitled to be displayed to the user. + DisplayOwnerEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayOwnerEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOwnerEntitledElementsResponse], error) + // DisplayRepositoryEntitledElements returns which repository elements are entitled to be displayed to the user. + DisplayRepositoryEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryEntitledElementsResponse], error) + // ListManageableRepositoryRoles returns which roles should be displayed + // to the user when they are managing contributors on the repository. + ListManageableRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableRepositoryRolesResponse], error) + // ListManageableUserRepositoryRoles returns which roles should be displayed + // to the user when they are managing a specific contributor on the repository. + ListManageableUserRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableUserRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableUserRepositoryRolesResponse], error) +} + +// NewDisplayServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDisplayServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DisplayServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &displayServiceClient{ + displayOrganizationElements: connect_go.NewClient[v1alpha1.DisplayOrganizationElementsRequest, v1alpha1.DisplayOrganizationElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayOrganizationElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayRepositoryElements: connect_go.NewClient[v1alpha1.DisplayRepositoryElementsRequest, v1alpha1.DisplayRepositoryElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayRepositoryElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayUserElements: connect_go.NewClient[v1alpha1.DisplayUserElementsRequest, v1alpha1.DisplayUserElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayUserElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayServerElements: connect_go.NewClient[v1alpha1.DisplayServerElementsRequest, v1alpha1.DisplayServerElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayServerElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayOwnerEntitledElements: connect_go.NewClient[v1alpha1.DisplayOwnerEntitledElementsRequest, v1alpha1.DisplayOwnerEntitledElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayOwnerEntitledElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + displayRepositoryEntitledElements: connect_go.NewClient[v1alpha1.DisplayRepositoryEntitledElementsRequest, v1alpha1.DisplayRepositoryEntitledElementsResponse]( + httpClient, + baseURL+DisplayServiceDisplayRepositoryEntitledElementsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listManageableRepositoryRoles: connect_go.NewClient[v1alpha1.ListManageableRepositoryRolesRequest, v1alpha1.ListManageableRepositoryRolesResponse]( + httpClient, + baseURL+DisplayServiceListManageableRepositoryRolesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listManageableUserRepositoryRoles: connect_go.NewClient[v1alpha1.ListManageableUserRepositoryRolesRequest, v1alpha1.ListManageableUserRepositoryRolesResponse]( + httpClient, + baseURL+DisplayServiceListManageableUserRepositoryRolesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// displayServiceClient implements DisplayServiceClient. +type displayServiceClient struct { + displayOrganizationElements *connect_go.Client[v1alpha1.DisplayOrganizationElementsRequest, v1alpha1.DisplayOrganizationElementsResponse] + displayRepositoryElements *connect_go.Client[v1alpha1.DisplayRepositoryElementsRequest, v1alpha1.DisplayRepositoryElementsResponse] + displayUserElements *connect_go.Client[v1alpha1.DisplayUserElementsRequest, v1alpha1.DisplayUserElementsResponse] + displayServerElements *connect_go.Client[v1alpha1.DisplayServerElementsRequest, v1alpha1.DisplayServerElementsResponse] + displayOwnerEntitledElements *connect_go.Client[v1alpha1.DisplayOwnerEntitledElementsRequest, v1alpha1.DisplayOwnerEntitledElementsResponse] + displayRepositoryEntitledElements *connect_go.Client[v1alpha1.DisplayRepositoryEntitledElementsRequest, v1alpha1.DisplayRepositoryEntitledElementsResponse] + listManageableRepositoryRoles *connect_go.Client[v1alpha1.ListManageableRepositoryRolesRequest, v1alpha1.ListManageableRepositoryRolesResponse] + listManageableUserRepositoryRoles *connect_go.Client[v1alpha1.ListManageableUserRepositoryRolesRequest, v1alpha1.ListManageableUserRepositoryRolesResponse] +} + +// DisplayOrganizationElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOrganizationElements. +func (c *displayServiceClient) DisplayOrganizationElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayOrganizationElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOrganizationElementsResponse], error) { + return c.displayOrganizationElements.CallUnary(ctx, req) +} + +// DisplayRepositoryElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryElements. +func (c *displayServiceClient) DisplayRepositoryElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayRepositoryElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryElementsResponse], error) { + return c.displayRepositoryElements.CallUnary(ctx, req) +} + +// DisplayUserElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayUserElements. +func (c *displayServiceClient) DisplayUserElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayUserElementsRequest]) (*connect_go.Response[v1alpha1.DisplayUserElementsResponse], error) { + return c.displayUserElements.CallUnary(ctx, req) +} + +// DisplayServerElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayServerElements. +func (c *displayServiceClient) DisplayServerElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayServerElementsRequest]) (*connect_go.Response[v1alpha1.DisplayServerElementsResponse], error) { + return c.displayServerElements.CallUnary(ctx, req) +} + +// DisplayOwnerEntitledElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOwnerEntitledElements. +func (c *displayServiceClient) DisplayOwnerEntitledElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayOwnerEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOwnerEntitledElementsResponse], error) { + return c.displayOwnerEntitledElements.CallUnary(ctx, req) +} + +// DisplayRepositoryEntitledElements calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryEntitledElements. +func (c *displayServiceClient) DisplayRepositoryEntitledElements(ctx context.Context, req *connect_go.Request[v1alpha1.DisplayRepositoryEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryEntitledElementsResponse], error) { + return c.displayRepositoryEntitledElements.CallUnary(ctx, req) +} + +// ListManageableRepositoryRoles calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableRepositoryRoles. +func (c *displayServiceClient) ListManageableRepositoryRoles(ctx context.Context, req *connect_go.Request[v1alpha1.ListManageableRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableRepositoryRolesResponse], error) { + return c.listManageableRepositoryRoles.CallUnary(ctx, req) +} + +// ListManageableUserRepositoryRoles calls +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableUserRepositoryRoles. +func (c *displayServiceClient) ListManageableUserRepositoryRoles(ctx context.Context, req *connect_go.Request[v1alpha1.ListManageableUserRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableUserRepositoryRolesResponse], error) { + return c.listManageableUserRepositoryRoles.CallUnary(ctx, req) +} + +// DisplayServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.DisplayService service. +type DisplayServiceHandler interface { + // DisplayOrganizationElements returns which organization elements should be displayed to the user. + DisplayOrganizationElements(context.Context, *connect_go.Request[v1alpha1.DisplayOrganizationElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOrganizationElementsResponse], error) + // DisplayRepositoryElements returns which repository elements should be displayed to the user. + DisplayRepositoryElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryElementsResponse], error) + // DisplayUserElements returns which user elements should be displayed to the user. + DisplayUserElements(context.Context, *connect_go.Request[v1alpha1.DisplayUserElementsRequest]) (*connect_go.Response[v1alpha1.DisplayUserElementsResponse], error) + // DisplayServerElements returns which server elements should be displayed to the user. + DisplayServerElements(context.Context, *connect_go.Request[v1alpha1.DisplayServerElementsRequest]) (*connect_go.Response[v1alpha1.DisplayServerElementsResponse], error) + // DisplayOwnerEntitledElements returns which owner elements are entitled to be displayed to the user. + DisplayOwnerEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayOwnerEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOwnerEntitledElementsResponse], error) + // DisplayRepositoryEntitledElements returns which repository elements are entitled to be displayed to the user. + DisplayRepositoryEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryEntitledElementsResponse], error) + // ListManageableRepositoryRoles returns which roles should be displayed + // to the user when they are managing contributors on the repository. + ListManageableRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableRepositoryRolesResponse], error) + // ListManageableUserRepositoryRoles returns which roles should be displayed + // to the user when they are managing a specific contributor on the repository. + ListManageableUserRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableUserRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableUserRepositoryRolesResponse], error) +} + +// NewDisplayServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDisplayServiceHandler(svc DisplayServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + displayServiceDisplayOrganizationElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayOrganizationElementsProcedure, + svc.DisplayOrganizationElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayRepositoryElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayRepositoryElementsProcedure, + svc.DisplayRepositoryElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayUserElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayUserElementsProcedure, + svc.DisplayUserElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayServerElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayServerElementsProcedure, + svc.DisplayServerElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayOwnerEntitledElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayOwnerEntitledElementsProcedure, + svc.DisplayOwnerEntitledElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceDisplayRepositoryEntitledElementsHandler := connect_go.NewUnaryHandler( + DisplayServiceDisplayRepositoryEntitledElementsProcedure, + svc.DisplayRepositoryEntitledElements, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceListManageableRepositoryRolesHandler := connect_go.NewUnaryHandler( + DisplayServiceListManageableRepositoryRolesProcedure, + svc.ListManageableRepositoryRoles, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + displayServiceListManageableUserRepositoryRolesHandler := connect_go.NewUnaryHandler( + DisplayServiceListManageableUserRepositoryRolesProcedure, + svc.ListManageableUserRepositoryRoles, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DisplayServiceDisplayOrganizationElementsProcedure: + displayServiceDisplayOrganizationElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayRepositoryElementsProcedure: + displayServiceDisplayRepositoryElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayUserElementsProcedure: + displayServiceDisplayUserElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayServerElementsProcedure: + displayServiceDisplayServerElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayOwnerEntitledElementsProcedure: + displayServiceDisplayOwnerEntitledElementsHandler.ServeHTTP(w, r) + case DisplayServiceDisplayRepositoryEntitledElementsProcedure: + displayServiceDisplayRepositoryEntitledElementsHandler.ServeHTTP(w, r) + case DisplayServiceListManageableRepositoryRolesProcedure: + displayServiceListManageableRepositoryRolesHandler.ServeHTTP(w, r) + case DisplayServiceListManageableUserRepositoryRolesProcedure: + displayServiceListManageableUserRepositoryRolesHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDisplayServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDisplayServiceHandler struct{} + +func (UnimplementedDisplayServiceHandler) DisplayOrganizationElements(context.Context, *connect_go.Request[v1alpha1.DisplayOrganizationElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOrganizationElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOrganizationElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayRepositoryElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayUserElements(context.Context, *connect_go.Request[v1alpha1.DisplayUserElementsRequest]) (*connect_go.Response[v1alpha1.DisplayUserElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayUserElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayServerElements(context.Context, *connect_go.Request[v1alpha1.DisplayServerElementsRequest]) (*connect_go.Response[v1alpha1.DisplayServerElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayServerElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayOwnerEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayOwnerEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayOwnerEntitledElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOwnerEntitledElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) DisplayRepositoryEntitledElements(context.Context, *connect_go.Request[v1alpha1.DisplayRepositoryEntitledElementsRequest]) (*connect_go.Response[v1alpha1.DisplayRepositoryEntitledElementsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryEntitledElements is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) ListManageableRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableRepositoryRolesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableRepositoryRoles is not implemented")) +} + +func (UnimplementedDisplayServiceHandler) ListManageableUserRepositoryRoles(context.Context, *connect_go.Request[v1alpha1.ListManageableUserRepositoryRolesRequest]) (*connect_go.Response[v1alpha1.ListManageableUserRepositoryRolesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableUserRepositoryRoles is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/doc.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/doc.connect.go new file mode 100644 index 000000000..9d8bd4d00 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/doc.connect.go @@ -0,0 +1,271 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/doc.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // DocServiceName is the fully-qualified name of the DocService service. + DocServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.DocService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DocServiceGetSourceDirectoryInfoProcedure is the fully-qualified name of the DocService's + // GetSourceDirectoryInfo RPC. + DocServiceGetSourceDirectoryInfoProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetSourceDirectoryInfo" + // DocServiceGetSourceFileProcedure is the fully-qualified name of the DocService's GetSourceFile + // RPC. + DocServiceGetSourceFileProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetSourceFile" + // DocServiceGetModulePackagesProcedure is the fully-qualified name of the DocService's + // GetModulePackages RPC. + DocServiceGetModulePackagesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetModulePackages" + // DocServiceGetModuleDocumentationProcedure is the fully-qualified name of the DocService's + // GetModuleDocumentation RPC. + DocServiceGetModuleDocumentationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetModuleDocumentation" + // DocServiceGetPackageDocumentationProcedure is the fully-qualified name of the DocService's + // GetPackageDocumentation RPC. + DocServiceGetPackageDocumentationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetPackageDocumentation" +) + +// DocServiceClient is a client for the bufman.dubbo.apache.org.registry.v1alpha1.DocService +// service. +type DocServiceClient interface { + // GetSourceDirectoryInfo retrieves the directory and file structure for the + // given owner, repository and reference. + // + // The purpose of this is to get a representation of the file tree for a given + // module to enable exploring the module by navigating through its contents. + GetSourceDirectoryInfo(context.Context, *connect_go.Request[v1alpha1.GetSourceDirectoryInfoRequest]) (*connect_go.Response[v1alpha1.GetSourceDirectoryInfoResponse], error) + // GetSourceFile retrieves the source contents for the given owner, repository, + // reference, and path. + GetSourceFile(context.Context, *connect_go.Request[v1alpha1.GetSourceFileRequest]) (*connect_go.Response[v1alpha1.GetSourceFileResponse], error) + // GetModulePackages retrieves the list of packages for the module based on the given + // owner, repository, and reference. + GetModulePackages(context.Context, *connect_go.Request[v1alpha1.GetModulePackagesRequest]) (*connect_go.Response[v1alpha1.GetModulePackagesResponse], error) + // GetModuleDocumentation retrieves the documentations including buf.md and LICENSE files + // for module based on the given owner, repository, and reference. + GetModuleDocumentation(context.Context, *connect_go.Request[v1alpha1.GetModuleDocumentationRequest]) (*connect_go.Response[v1alpha1.GetModuleDocumentationResponse], error) + // GetPackageDocumentation retrieves a a slice of documentation structures + // for the given owner, repository, reference, and package name. + GetPackageDocumentation(context.Context, *connect_go.Request[v1alpha1.GetPackageDocumentationRequest]) (*connect_go.Response[v1alpha1.GetPackageDocumentationResponse], error) +} + +// NewDocServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DocService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDocServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DocServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &docServiceClient{ + getSourceDirectoryInfo: connect_go.NewClient[v1alpha1.GetSourceDirectoryInfoRequest, v1alpha1.GetSourceDirectoryInfoResponse]( + httpClient, + baseURL+DocServiceGetSourceDirectoryInfoProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getSourceFile: connect_go.NewClient[v1alpha1.GetSourceFileRequest, v1alpha1.GetSourceFileResponse]( + httpClient, + baseURL+DocServiceGetSourceFileProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getModulePackages: connect_go.NewClient[v1alpha1.GetModulePackagesRequest, v1alpha1.GetModulePackagesResponse]( + httpClient, + baseURL+DocServiceGetModulePackagesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getModuleDocumentation: connect_go.NewClient[v1alpha1.GetModuleDocumentationRequest, v1alpha1.GetModuleDocumentationResponse]( + httpClient, + baseURL+DocServiceGetModuleDocumentationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getPackageDocumentation: connect_go.NewClient[v1alpha1.GetPackageDocumentationRequest, v1alpha1.GetPackageDocumentationResponse]( + httpClient, + baseURL+DocServiceGetPackageDocumentationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// docServiceClient implements DocServiceClient. +type docServiceClient struct { + getSourceDirectoryInfo *connect_go.Client[v1alpha1.GetSourceDirectoryInfoRequest, v1alpha1.GetSourceDirectoryInfoResponse] + getSourceFile *connect_go.Client[v1alpha1.GetSourceFileRequest, v1alpha1.GetSourceFileResponse] + getModulePackages *connect_go.Client[v1alpha1.GetModulePackagesRequest, v1alpha1.GetModulePackagesResponse] + getModuleDocumentation *connect_go.Client[v1alpha1.GetModuleDocumentationRequest, v1alpha1.GetModuleDocumentationResponse] + getPackageDocumentation *connect_go.Client[v1alpha1.GetPackageDocumentationRequest, v1alpha1.GetPackageDocumentationResponse] +} + +// GetSourceDirectoryInfo calls +// bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceDirectoryInfo. +func (c *docServiceClient) GetSourceDirectoryInfo(ctx context.Context, req *connect_go.Request[v1alpha1.GetSourceDirectoryInfoRequest]) (*connect_go.Response[v1alpha1.GetSourceDirectoryInfoResponse], error) { + return c.getSourceDirectoryInfo.CallUnary(ctx, req) +} + +// GetSourceFile calls bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceFile. +func (c *docServiceClient) GetSourceFile(ctx context.Context, req *connect_go.Request[v1alpha1.GetSourceFileRequest]) (*connect_go.Response[v1alpha1.GetSourceFileResponse], error) { + return c.getSourceFile.CallUnary(ctx, req) +} + +// GetModulePackages calls +// bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModulePackages. +func (c *docServiceClient) GetModulePackages(ctx context.Context, req *connect_go.Request[v1alpha1.GetModulePackagesRequest]) (*connect_go.Response[v1alpha1.GetModulePackagesResponse], error) { + return c.getModulePackages.CallUnary(ctx, req) +} + +// GetModuleDocumentation calls +// bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModuleDocumentation. +func (c *docServiceClient) GetModuleDocumentation(ctx context.Context, req *connect_go.Request[v1alpha1.GetModuleDocumentationRequest]) (*connect_go.Response[v1alpha1.GetModuleDocumentationResponse], error) { + return c.getModuleDocumentation.CallUnary(ctx, req) +} + +// GetPackageDocumentation calls +// bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetPackageDocumentation. +func (c *docServiceClient) GetPackageDocumentation(ctx context.Context, req *connect_go.Request[v1alpha1.GetPackageDocumentationRequest]) (*connect_go.Response[v1alpha1.GetPackageDocumentationResponse], error) { + return c.getPackageDocumentation.CallUnary(ctx, req) +} + +// DocServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.DocService service. +type DocServiceHandler interface { + // GetSourceDirectoryInfo retrieves the directory and file structure for the + // given owner, repository and reference. + // + // The purpose of this is to get a representation of the file tree for a given + // module to enable exploring the module by navigating through its contents. + GetSourceDirectoryInfo(context.Context, *connect_go.Request[v1alpha1.GetSourceDirectoryInfoRequest]) (*connect_go.Response[v1alpha1.GetSourceDirectoryInfoResponse], error) + // GetSourceFile retrieves the source contents for the given owner, repository, + // reference, and path. + GetSourceFile(context.Context, *connect_go.Request[v1alpha1.GetSourceFileRequest]) (*connect_go.Response[v1alpha1.GetSourceFileResponse], error) + // GetModulePackages retrieves the list of packages for the module based on the given + // owner, repository, and reference. + GetModulePackages(context.Context, *connect_go.Request[v1alpha1.GetModulePackagesRequest]) (*connect_go.Response[v1alpha1.GetModulePackagesResponse], error) + // GetModuleDocumentation retrieves the documentations including buf.md and LICENSE files + // for module based on the given owner, repository, and reference. + GetModuleDocumentation(context.Context, *connect_go.Request[v1alpha1.GetModuleDocumentationRequest]) (*connect_go.Response[v1alpha1.GetModuleDocumentationResponse], error) + // GetPackageDocumentation retrieves a a slice of documentation structures + // for the given owner, repository, reference, and package name. + GetPackageDocumentation(context.Context, *connect_go.Request[v1alpha1.GetPackageDocumentationRequest]) (*connect_go.Response[v1alpha1.GetPackageDocumentationResponse], error) +} + +// NewDocServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDocServiceHandler(svc DocServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + docServiceGetSourceDirectoryInfoHandler := connect_go.NewUnaryHandler( + DocServiceGetSourceDirectoryInfoProcedure, + svc.GetSourceDirectoryInfo, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + docServiceGetSourceFileHandler := connect_go.NewUnaryHandler( + DocServiceGetSourceFileProcedure, + svc.GetSourceFile, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + docServiceGetModulePackagesHandler := connect_go.NewUnaryHandler( + DocServiceGetModulePackagesProcedure, + svc.GetModulePackages, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + docServiceGetModuleDocumentationHandler := connect_go.NewUnaryHandler( + DocServiceGetModuleDocumentationProcedure, + svc.GetModuleDocumentation, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + docServiceGetPackageDocumentationHandler := connect_go.NewUnaryHandler( + DocServiceGetPackageDocumentationProcedure, + svc.GetPackageDocumentation, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DocServiceGetSourceDirectoryInfoProcedure: + docServiceGetSourceDirectoryInfoHandler.ServeHTTP(w, r) + case DocServiceGetSourceFileProcedure: + docServiceGetSourceFileHandler.ServeHTTP(w, r) + case DocServiceGetModulePackagesProcedure: + docServiceGetModulePackagesHandler.ServeHTTP(w, r) + case DocServiceGetModuleDocumentationProcedure: + docServiceGetModuleDocumentationHandler.ServeHTTP(w, r) + case DocServiceGetPackageDocumentationProcedure: + docServiceGetPackageDocumentationHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDocServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDocServiceHandler struct{} + +func (UnimplementedDocServiceHandler) GetSourceDirectoryInfo(context.Context, *connect_go.Request[v1alpha1.GetSourceDirectoryInfoRequest]) (*connect_go.Response[v1alpha1.GetSourceDirectoryInfoResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceDirectoryInfo is not implemented")) +} + +func (UnimplementedDocServiceHandler) GetSourceFile(context.Context, *connect_go.Request[v1alpha1.GetSourceFileRequest]) (*connect_go.Response[v1alpha1.GetSourceFileResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceFile is not implemented")) +} + +func (UnimplementedDocServiceHandler) GetModulePackages(context.Context, *connect_go.Request[v1alpha1.GetModulePackagesRequest]) (*connect_go.Response[v1alpha1.GetModulePackagesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModulePackages is not implemented")) +} + +func (UnimplementedDocServiceHandler) GetModuleDocumentation(context.Context, *connect_go.Request[v1alpha1.GetModuleDocumentationRequest]) (*connect_go.Response[v1alpha1.GetModuleDocumentationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModuleDocumentation is not implemented")) +} + +func (UnimplementedDocServiceHandler) GetPackageDocumentation(context.Context, *connect_go.Request[v1alpha1.GetPackageDocumentationRequest]) (*connect_go.Response[v1alpha1.GetPackageDocumentationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetPackageDocumentation is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/docker.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/docker.connect.go new file mode 100644 index 000000000..fc05e5ca6 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/docker.connect.go @@ -0,0 +1,312 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/docker.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // DockerRepoServiceName is the fully-qualified name of the DockerRepoService service. + DockerRepoServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DockerRepoServiceCreateDockerRepoProcedure is the fully-qualified name of the DockerRepoService's + // CreateDockerRepo RPC. + DockerRepoServiceCreateDockerRepoProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/CreateDockerRepo" + // DockerRepoServiceGetDockerRepoProcedure is the fully-qualified name of the DockerRepoService's + // GetDockerRepo RPC. + DockerRepoServiceGetDockerRepoProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/GetDockerRepo" + // DockerRepoServiceGetDockerRepoByNameProcedure is the fully-qualified name of the + // DockerRepoService's GetDockerRepoByName RPC. + DockerRepoServiceGetDockerRepoByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/GetDockerRepoByName" + // DockerRepoServiceListDockerReposProcedure is the fully-qualified name of the DockerRepoService's + // ListDockerRepos RPC. + DockerRepoServiceListDockerReposProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/ListDockerRepos" + // DockerRepoServiceUpdateDockerRepoByNameProcedure is the fully-qualified name of the + // DockerRepoService's UpdateDockerRepoByName RPC. + DockerRepoServiceUpdateDockerRepoByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/UpdateDockerRepoByName" + // DockerRepoServiceUpdateDockerRepoByIDProcedure is the fully-qualified name of the + // DockerRepoService's UpdateDockerRepoByID RPC. + DockerRepoServiceUpdateDockerRepoByIDProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/UpdateDockerRepoByID" +) + +// DockerRepoServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService service. +type DockerRepoServiceClient interface { + // CreateDockerRepo create a docker repo for user + // + // This method requires authentication. + CreateDockerRepo(context.Context, *connect_go.Request[v1alpha1.CreateDockerRepoRequest]) (*connect_go.Response[v1alpha1.CreateDockerRepoResponse], error) + // GetDockerRepo get a user's docker repo by id + // + // This method requires authentication. + GetDockerRepo(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoResponse], error) + // GetDockerRepoByName get a user's docker repo by name + // + // This method requires authentication. + GetDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoByNameResponse], error) + // ListDockerRepos lists the user's all docker repo entries + // + // This method requires authentication. + ListDockerRepos(context.Context, *connect_go.Request[v1alpha1.ListDockerReposRequest]) (*connect_go.Response[v1alpha1.ListDockerReposResponse], error) + // UpdateDockerRepoByName given a name, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByNameResponse], error) + // UpdateDockerRepoByName given a id, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByID(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByIDRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByIDResponse], error) +} + +// NewDockerRepoServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDockerRepoServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DockerRepoServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &dockerRepoServiceClient{ + createDockerRepo: connect_go.NewClient[v1alpha1.CreateDockerRepoRequest, v1alpha1.CreateDockerRepoResponse]( + httpClient, + baseURL+DockerRepoServiceCreateDockerRepoProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getDockerRepo: connect_go.NewClient[v1alpha1.GetDockerRepoRequest, v1alpha1.GetDockerRepoResponse]( + httpClient, + baseURL+DockerRepoServiceGetDockerRepoProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getDockerRepoByName: connect_go.NewClient[v1alpha1.GetDockerRepoByNameRequest, v1alpha1.GetDockerRepoByNameResponse]( + httpClient, + baseURL+DockerRepoServiceGetDockerRepoByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listDockerRepos: connect_go.NewClient[v1alpha1.ListDockerReposRequest, v1alpha1.ListDockerReposResponse]( + httpClient, + baseURL+DockerRepoServiceListDockerReposProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateDockerRepoByName: connect_go.NewClient[v1alpha1.UpdateDockerRepoByNameRequest, v1alpha1.UpdateDockerRepoByNameResponse]( + httpClient, + baseURL+DockerRepoServiceUpdateDockerRepoByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + updateDockerRepoByID: connect_go.NewClient[v1alpha1.UpdateDockerRepoByIDRequest, v1alpha1.UpdateDockerRepoByIDResponse]( + httpClient, + baseURL+DockerRepoServiceUpdateDockerRepoByIDProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// dockerRepoServiceClient implements DockerRepoServiceClient. +type dockerRepoServiceClient struct { + createDockerRepo *connect_go.Client[v1alpha1.CreateDockerRepoRequest, v1alpha1.CreateDockerRepoResponse] + getDockerRepo *connect_go.Client[v1alpha1.GetDockerRepoRequest, v1alpha1.GetDockerRepoResponse] + getDockerRepoByName *connect_go.Client[v1alpha1.GetDockerRepoByNameRequest, v1alpha1.GetDockerRepoByNameResponse] + listDockerRepos *connect_go.Client[v1alpha1.ListDockerReposRequest, v1alpha1.ListDockerReposResponse] + updateDockerRepoByName *connect_go.Client[v1alpha1.UpdateDockerRepoByNameRequest, v1alpha1.UpdateDockerRepoByNameResponse] + updateDockerRepoByID *connect_go.Client[v1alpha1.UpdateDockerRepoByIDRequest, v1alpha1.UpdateDockerRepoByIDResponse] +} + +// CreateDockerRepo calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.CreateDockerRepo. +func (c *dockerRepoServiceClient) CreateDockerRepo(ctx context.Context, req *connect_go.Request[v1alpha1.CreateDockerRepoRequest]) (*connect_go.Response[v1alpha1.CreateDockerRepoResponse], error) { + return c.createDockerRepo.CallUnary(ctx, req) +} + +// GetDockerRepo calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepo. +func (c *dockerRepoServiceClient) GetDockerRepo(ctx context.Context, req *connect_go.Request[v1alpha1.GetDockerRepoRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoResponse], error) { + return c.getDockerRepo.CallUnary(ctx, req) +} + +// GetDockerRepoByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepoByName. +func (c *dockerRepoServiceClient) GetDockerRepoByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoByNameResponse], error) { + return c.getDockerRepoByName.CallUnary(ctx, req) +} + +// ListDockerRepos calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.ListDockerRepos. +func (c *dockerRepoServiceClient) ListDockerRepos(ctx context.Context, req *connect_go.Request[v1alpha1.ListDockerReposRequest]) (*connect_go.Response[v1alpha1.ListDockerReposResponse], error) { + return c.listDockerRepos.CallUnary(ctx, req) +} + +// UpdateDockerRepoByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByName. +func (c *dockerRepoServiceClient) UpdateDockerRepoByName(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByNameResponse], error) { + return c.updateDockerRepoByName.CallUnary(ctx, req) +} + +// UpdateDockerRepoByID calls +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByID. +func (c *dockerRepoServiceClient) UpdateDockerRepoByID(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateDockerRepoByIDRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByIDResponse], error) { + return c.updateDockerRepoByID.CallUnary(ctx, req) +} + +// DockerRepoServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService service. +type DockerRepoServiceHandler interface { + // CreateDockerRepo create a docker repo for user + // + // This method requires authentication. + CreateDockerRepo(context.Context, *connect_go.Request[v1alpha1.CreateDockerRepoRequest]) (*connect_go.Response[v1alpha1.CreateDockerRepoResponse], error) + // GetDockerRepo get a user's docker repo by id + // + // This method requires authentication. + GetDockerRepo(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoResponse], error) + // GetDockerRepoByName get a user's docker repo by name + // + // This method requires authentication. + GetDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoByNameResponse], error) + // ListDockerRepos lists the user's all docker repo entries + // + // This method requires authentication. + ListDockerRepos(context.Context, *connect_go.Request[v1alpha1.ListDockerReposRequest]) (*connect_go.Response[v1alpha1.ListDockerReposResponse], error) + // UpdateDockerRepoByName given a name, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByNameResponse], error) + // UpdateDockerRepoByName given a id, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByID(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByIDRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByIDResponse], error) +} + +// NewDockerRepoServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDockerRepoServiceHandler(svc DockerRepoServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + dockerRepoServiceCreateDockerRepoHandler := connect_go.NewUnaryHandler( + DockerRepoServiceCreateDockerRepoProcedure, + svc.CreateDockerRepo, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceGetDockerRepoHandler := connect_go.NewUnaryHandler( + DockerRepoServiceGetDockerRepoProcedure, + svc.GetDockerRepo, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceGetDockerRepoByNameHandler := connect_go.NewUnaryHandler( + DockerRepoServiceGetDockerRepoByNameProcedure, + svc.GetDockerRepoByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceListDockerReposHandler := connect_go.NewUnaryHandler( + DockerRepoServiceListDockerReposProcedure, + svc.ListDockerRepos, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceUpdateDockerRepoByNameHandler := connect_go.NewUnaryHandler( + DockerRepoServiceUpdateDockerRepoByNameProcedure, + svc.UpdateDockerRepoByName, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + dockerRepoServiceUpdateDockerRepoByIDHandler := connect_go.NewUnaryHandler( + DockerRepoServiceUpdateDockerRepoByIDProcedure, + svc.UpdateDockerRepoByID, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DockerRepoServiceCreateDockerRepoProcedure: + dockerRepoServiceCreateDockerRepoHandler.ServeHTTP(w, r) + case DockerRepoServiceGetDockerRepoProcedure: + dockerRepoServiceGetDockerRepoHandler.ServeHTTP(w, r) + case DockerRepoServiceGetDockerRepoByNameProcedure: + dockerRepoServiceGetDockerRepoByNameHandler.ServeHTTP(w, r) + case DockerRepoServiceListDockerReposProcedure: + dockerRepoServiceListDockerReposHandler.ServeHTTP(w, r) + case DockerRepoServiceUpdateDockerRepoByNameProcedure: + dockerRepoServiceUpdateDockerRepoByNameHandler.ServeHTTP(w, r) + case DockerRepoServiceUpdateDockerRepoByIDProcedure: + dockerRepoServiceUpdateDockerRepoByIDHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDockerRepoServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDockerRepoServiceHandler struct{} + +func (UnimplementedDockerRepoServiceHandler) CreateDockerRepo(context.Context, *connect_go.Request[v1alpha1.CreateDockerRepoRequest]) (*connect_go.Response[v1alpha1.CreateDockerRepoResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.CreateDockerRepo is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) GetDockerRepo(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepo is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) GetDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.GetDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.GetDockerRepoByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepoByName is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) ListDockerRepos(context.Context, *connect_go.Request[v1alpha1.ListDockerReposRequest]) (*connect_go.Response[v1alpha1.ListDockerReposResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.ListDockerRepos is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) UpdateDockerRepoByName(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByNameRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByName is not implemented")) +} + +func (UnimplementedDockerRepoServiceHandler) UpdateDockerRepoByID(context.Context, *connect_go.Request[v1alpha1.UpdateDockerRepoByIDRequest]) (*connect_go.Response[v1alpha1.UpdateDockerRepoByIDResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByID is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/download.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/download.connect.go new file mode 100644 index 000000000..83cd84f77 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/download.connect.go @@ -0,0 +1,161 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/download.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // DownloadServiceName is the fully-qualified name of the DownloadService service. + DownloadServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.DownloadService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DownloadServiceDownloadProcedure is the fully-qualified name of the DownloadService's Download + // RPC. + DownloadServiceDownloadProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DownloadService/Download" + // DownloadServiceDownloadManifestAndBlobsProcedure is the fully-qualified name of the + // DownloadService's DownloadManifestAndBlobs RPC. + DownloadServiceDownloadManifestAndBlobsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.DownloadService/DownloadManifestAndBlobs" +) + +// DownloadServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DownloadService service. +type DownloadServiceClient interface { + // Download downloads a BSR module. + // NOTE: Newer clients should use DownloadManifestAndBlobs instead. + Download(context.Context, *connect_go.Request[v1alpha1.DownloadRequest]) (*connect_go.Response[v1alpha1.DownloadResponse], error) + // DownloadManifestAndBlobs downloads a module in the manifest+blobs encoding format. + DownloadManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.DownloadManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.DownloadManifestAndBlobsResponse], error) +} + +// NewDownloadServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.DownloadService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewDownloadServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) DownloadServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &downloadServiceClient{ + download: connect_go.NewClient[v1alpha1.DownloadRequest, v1alpha1.DownloadResponse]( + httpClient, + baseURL+DownloadServiceDownloadProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + downloadManifestAndBlobs: connect_go.NewClient[v1alpha1.DownloadManifestAndBlobsRequest, v1alpha1.DownloadManifestAndBlobsResponse]( + httpClient, + baseURL+DownloadServiceDownloadManifestAndBlobsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// downloadServiceClient implements DownloadServiceClient. +type downloadServiceClient struct { + download *connect_go.Client[v1alpha1.DownloadRequest, v1alpha1.DownloadResponse] + downloadManifestAndBlobs *connect_go.Client[v1alpha1.DownloadManifestAndBlobsRequest, v1alpha1.DownloadManifestAndBlobsResponse] +} + +// Download calls bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.Download. +func (c *downloadServiceClient) Download(ctx context.Context, req *connect_go.Request[v1alpha1.DownloadRequest]) (*connect_go.Response[v1alpha1.DownloadResponse], error) { + return c.download.CallUnary(ctx, req) +} + +// DownloadManifestAndBlobs calls +// bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.DownloadManifestAndBlobs. +func (c *downloadServiceClient) DownloadManifestAndBlobs(ctx context.Context, req *connect_go.Request[v1alpha1.DownloadManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.DownloadManifestAndBlobsResponse], error) { + return c.downloadManifestAndBlobs.CallUnary(ctx, req) +} + +// DownloadServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.DownloadService service. +type DownloadServiceHandler interface { + // Download downloads a BSR module. + // NOTE: Newer clients should use DownloadManifestAndBlobs instead. + Download(context.Context, *connect_go.Request[v1alpha1.DownloadRequest]) (*connect_go.Response[v1alpha1.DownloadResponse], error) + // DownloadManifestAndBlobs downloads a module in the manifest+blobs encoding format. + DownloadManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.DownloadManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.DownloadManifestAndBlobsResponse], error) +} + +// NewDownloadServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewDownloadServiceHandler(svc DownloadServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + downloadServiceDownloadHandler := connect_go.NewUnaryHandler( + DownloadServiceDownloadProcedure, + svc.Download, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + downloadServiceDownloadManifestAndBlobsHandler := connect_go.NewUnaryHandler( + DownloadServiceDownloadManifestAndBlobsProcedure, + svc.DownloadManifestAndBlobs, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.DownloadService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case DownloadServiceDownloadProcedure: + downloadServiceDownloadHandler.ServeHTTP(w, r) + case DownloadServiceDownloadManifestAndBlobsProcedure: + downloadServiceDownloadManifestAndBlobsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedDownloadServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDownloadServiceHandler struct{} + +func (UnimplementedDownloadServiceHandler) Download(context.Context, *connect_go.Request[v1alpha1.DownloadRequest]) (*connect_go.Response[v1alpha1.DownloadResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.Download is not implemented")) +} + +func (UnimplementedDownloadServiceHandler) DownloadManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.DownloadManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.DownloadManifestAndBlobsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.DownloadManifestAndBlobs is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/generate.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/generate.connect.go new file mode 100644 index 000000000..353342542 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/generate.connect.go @@ -0,0 +1,162 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// registry/v1alpha1/generate.proto is a deprecated file. + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // GenerateServiceName is the fully-qualified name of the GenerateService service. + GenerateServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.GenerateService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // GenerateServiceGeneratePluginsProcedure is the fully-qualified name of the GenerateService's + // GeneratePlugins RPC. + GenerateServiceGeneratePluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.GenerateService/GeneratePlugins" + // GenerateServiceGenerateTemplateProcedure is the fully-qualified name of the GenerateService's + // GenerateTemplate RPC. + GenerateServiceGenerateTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.GenerateService/GenerateTemplate" +) + +// GenerateServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService service. +type GenerateServiceClient interface { + // GeneratePlugins generates an array of files given the provided + // module reference and plugin version and option tuples. No attempt + // is made at merging insertion points. + GeneratePlugins(context.Context, *connect_go.Request[v1alpha1.GeneratePluginsRequest]) (*connect_go.Response[v1alpha1.GeneratePluginsResponse], error) + // GenerateTemplate generates an array of files given the provided + // module reference and template version. + GenerateTemplate(context.Context, *connect_go.Request[v1alpha1.GenerateTemplateRequest]) (*connect_go.Response[v1alpha1.GenerateTemplateResponse], error) +} + +// NewGenerateServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewGenerateServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GenerateServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &generateServiceClient{ + generatePlugins: connect_go.NewClient[v1alpha1.GeneratePluginsRequest, v1alpha1.GeneratePluginsResponse]( + httpClient, + baseURL+GenerateServiceGeneratePluginsProcedure, + opts..., + ), + generateTemplate: connect_go.NewClient[v1alpha1.GenerateTemplateRequest, v1alpha1.GenerateTemplateResponse]( + httpClient, + baseURL+GenerateServiceGenerateTemplateProcedure, + opts..., + ), + } +} + +// generateServiceClient implements GenerateServiceClient. +type generateServiceClient struct { + generatePlugins *connect_go.Client[v1alpha1.GeneratePluginsRequest, v1alpha1.GeneratePluginsResponse] + generateTemplate *connect_go.Client[v1alpha1.GenerateTemplateRequest, v1alpha1.GenerateTemplateResponse] +} + +// GeneratePlugins calls +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GeneratePlugins. +func (c *generateServiceClient) GeneratePlugins(ctx context.Context, req *connect_go.Request[v1alpha1.GeneratePluginsRequest]) (*connect_go.Response[v1alpha1.GeneratePluginsResponse], error) { + return c.generatePlugins.CallUnary(ctx, req) +} + +// GenerateTemplate calls +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GenerateTemplate. +func (c *generateServiceClient) GenerateTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.GenerateTemplateRequest]) (*connect_go.Response[v1alpha1.GenerateTemplateResponse], error) { + return c.generateTemplate.CallUnary(ctx, req) +} + +// GenerateServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.GenerateService service. +type GenerateServiceHandler interface { + // GeneratePlugins generates an array of files given the provided + // module reference and plugin version and option tuples. No attempt + // is made at merging insertion points. + GeneratePlugins(context.Context, *connect_go.Request[v1alpha1.GeneratePluginsRequest]) (*connect_go.Response[v1alpha1.GeneratePluginsResponse], error) + // GenerateTemplate generates an array of files given the provided + // module reference and template version. + GenerateTemplate(context.Context, *connect_go.Request[v1alpha1.GenerateTemplateRequest]) (*connect_go.Response[v1alpha1.GenerateTemplateResponse], error) +} + +// NewGenerateServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewGenerateServiceHandler(svc GenerateServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + generateServiceGeneratePluginsHandler := connect_go.NewUnaryHandler( + GenerateServiceGeneratePluginsProcedure, + svc.GeneratePlugins, + opts..., + ) + generateServiceGenerateTemplateHandler := connect_go.NewUnaryHandler( + GenerateServiceGenerateTemplateProcedure, + svc.GenerateTemplate, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.GenerateService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case GenerateServiceGeneratePluginsProcedure: + generateServiceGeneratePluginsHandler.ServeHTTP(w, r) + case GenerateServiceGenerateTemplateProcedure: + generateServiceGenerateTemplateHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedGenerateServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedGenerateServiceHandler struct{} + +func (UnimplementedGenerateServiceHandler) GeneratePlugins(context.Context, *connect_go.Request[v1alpha1.GeneratePluginsRequest]) (*connect_go.Response[v1alpha1.GeneratePluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GeneratePlugins is not implemented")) +} + +func (UnimplementedGenerateServiceHandler) GenerateTemplate(context.Context, *connect_go.Request[v1alpha1.GenerateTemplateRequest]) (*connect_go.Response[v1alpha1.GenerateTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GenerateTemplate is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/github.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/github.connect.go new file mode 100644 index 000000000..e46d59574 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/github.connect.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/github.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // GithubServiceName is the fully-qualified name of the GithubService service. + GithubServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.GithubService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // GithubServiceGetGithubAppConfigProcedure is the fully-qualified name of the GithubService's + // GetGithubAppConfig RPC. + GithubServiceGetGithubAppConfigProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.GithubService/GetGithubAppConfig" +) + +// GithubServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.GithubService service. +type GithubServiceClient interface { + // GetGithubAppConfig returns a Github Application Configuration. + GetGithubAppConfig(context.Context, *connect_go.Request[v1alpha1.GetGithubAppConfigRequest]) (*connect_go.Response[v1alpha1.GetGithubAppConfigResponse], error) +} + +// NewGithubServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.GithubService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewGithubServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GithubServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &githubServiceClient{ + getGithubAppConfig: connect_go.NewClient[v1alpha1.GetGithubAppConfigRequest, v1alpha1.GetGithubAppConfigResponse]( + httpClient, + baseURL+GithubServiceGetGithubAppConfigProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// githubServiceClient implements GithubServiceClient. +type githubServiceClient struct { + getGithubAppConfig *connect_go.Client[v1alpha1.GetGithubAppConfigRequest, v1alpha1.GetGithubAppConfigResponse] +} + +// GetGithubAppConfig calls +// bufman.dubbo.apache.org.registry.v1alpha1.GithubService.GetGithubAppConfig. +func (c *githubServiceClient) GetGithubAppConfig(ctx context.Context, req *connect_go.Request[v1alpha1.GetGithubAppConfigRequest]) (*connect_go.Response[v1alpha1.GetGithubAppConfigResponse], error) { + return c.getGithubAppConfig.CallUnary(ctx, req) +} + +// GithubServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.GithubService service. +type GithubServiceHandler interface { + // GetGithubAppConfig returns a Github Application Configuration. + GetGithubAppConfig(context.Context, *connect_go.Request[v1alpha1.GetGithubAppConfigRequest]) (*connect_go.Response[v1alpha1.GetGithubAppConfigResponse], error) +} + +// NewGithubServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewGithubServiceHandler(svc GithubServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + githubServiceGetGithubAppConfigHandler := connect_go.NewUnaryHandler( + GithubServiceGetGithubAppConfigProcedure, + svc.GetGithubAppConfig, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.GithubService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case GithubServiceGetGithubAppConfigProcedure: + githubServiceGetGithubAppConfigHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedGithubServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedGithubServiceHandler struct{} + +func (UnimplementedGithubServiceHandler) GetGithubAppConfig(context.Context, *connect_go.Request[v1alpha1.GetGithubAppConfigRequest]) (*connect_go.Response[v1alpha1.GetGithubAppConfigResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.GithubService.GetGithubAppConfig is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/image.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/image.connect.go new file mode 100644 index 000000000..dd142cd7d --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/image.connect.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/image.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // ImageServiceName is the fully-qualified name of the ImageService service. + ImageServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ImageService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ImageServiceGetImageProcedure is the fully-qualified name of the ImageService's GetImage RPC. + ImageServiceGetImageProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ImageService/GetImage" +) + +// ImageServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ImageService service. +type ImageServiceClient interface { + // GetImage serves a compiled image for the local module. It automatically + // downloads dependencies if necessary. + GetImage(context.Context, *connect_go.Request[v1alpha1.GetImageRequest]) (*connect_go.Response[v1alpha1.GetImageResponse], error) +} + +// NewImageServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ImageService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewImageServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ImageServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &imageServiceClient{ + getImage: connect_go.NewClient[v1alpha1.GetImageRequest, v1alpha1.GetImageResponse]( + httpClient, + baseURL+ImageServiceGetImageProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// imageServiceClient implements ImageServiceClient. +type imageServiceClient struct { + getImage *connect_go.Client[v1alpha1.GetImageRequest, v1alpha1.GetImageResponse] +} + +// GetImage calls bufman.dubbo.apache.org.registry.v1alpha1.ImageService.GetImage. +func (c *imageServiceClient) GetImage(ctx context.Context, req *connect_go.Request[v1alpha1.GetImageRequest]) (*connect_go.Response[v1alpha1.GetImageResponse], error) { + return c.getImage.CallUnary(ctx, req) +} + +// ImageServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ImageService service. +type ImageServiceHandler interface { + // GetImage serves a compiled image for the local module. It automatically + // downloads dependencies if necessary. + GetImage(context.Context, *connect_go.Request[v1alpha1.GetImageRequest]) (*connect_go.Response[v1alpha1.GetImageResponse], error) +} + +// NewImageServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewImageServiceHandler(svc ImageServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + imageServiceGetImageHandler := connect_go.NewUnaryHandler( + ImageServiceGetImageProcedure, + svc.GetImage, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ImageService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ImageServiceGetImageProcedure: + imageServiceGetImageHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedImageServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedImageServiceHandler struct{} + +func (UnimplementedImageServiceHandler) GetImage(context.Context, *connect_go.Request[v1alpha1.GetImageRequest]) (*connect_go.Response[v1alpha1.GetImageResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ImageService.GetImage is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/jsonschema.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/jsonschema.connect.go new file mode 100644 index 000000000..1fedca667 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/jsonschema.connect.go @@ -0,0 +1,130 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/jsonschema.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // JSONSchemaServiceName is the fully-qualified name of the JSONSchemaService service. + JSONSchemaServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // JSONSchemaServiceGetJSONSchemaProcedure is the fully-qualified name of the JSONSchemaService's + // GetJSONSchema RPC. + JSONSchemaServiceGetJSONSchemaProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService/GetJSONSchema" +) + +// JSONSchemaServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService service. +type JSONSchemaServiceClient interface { + // GetJSONSchema allows users to get an (approximate) json schema for a + // protobuf type. + GetJSONSchema(context.Context, *connect_go.Request[v1alpha1.GetJSONSchemaRequest]) (*connect_go.Response[v1alpha1.GetJSONSchemaResponse], error) +} + +// NewJSONSchemaServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewJSONSchemaServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) JSONSchemaServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &jSONSchemaServiceClient{ + getJSONSchema: connect_go.NewClient[v1alpha1.GetJSONSchemaRequest, v1alpha1.GetJSONSchemaResponse]( + httpClient, + baseURL+JSONSchemaServiceGetJSONSchemaProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// jSONSchemaServiceClient implements JSONSchemaServiceClient. +type jSONSchemaServiceClient struct { + getJSONSchema *connect_go.Client[v1alpha1.GetJSONSchemaRequest, v1alpha1.GetJSONSchemaResponse] +} + +// GetJSONSchema calls +// bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService.GetJSONSchema. +func (c *jSONSchemaServiceClient) GetJSONSchema(ctx context.Context, req *connect_go.Request[v1alpha1.GetJSONSchemaRequest]) (*connect_go.Response[v1alpha1.GetJSONSchemaResponse], error) { + return c.getJSONSchema.CallUnary(ctx, req) +} + +// JSONSchemaServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService service. +type JSONSchemaServiceHandler interface { + // GetJSONSchema allows users to get an (approximate) json schema for a + // protobuf type. + GetJSONSchema(context.Context, *connect_go.Request[v1alpha1.GetJSONSchemaRequest]) (*connect_go.Response[v1alpha1.GetJSONSchemaResponse], error) +} + +// NewJSONSchemaServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewJSONSchemaServiceHandler(svc JSONSchemaServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + jSONSchemaServiceGetJSONSchemaHandler := connect_go.NewUnaryHandler( + JSONSchemaServiceGetJSONSchemaProcedure, + svc.GetJSONSchema, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case JSONSchemaServiceGetJSONSchemaProcedure: + jSONSchemaServiceGetJSONSchemaHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedJSONSchemaServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedJSONSchemaServiceHandler struct{} + +func (UnimplementedJSONSchemaServiceHandler) GetJSONSchema(context.Context, *connect_go.Request[v1alpha1.GetJSONSchemaRequest]) (*connect_go.Response[v1alpha1.GetJSONSchemaResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService.GetJSONSchema is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/labels.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/labels.connect.go new file mode 100644 index 000000000..3de9160c9 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/labels.connect.go @@ -0,0 +1,179 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/labels.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // LabelServiceName is the fully-qualified name of the LabelService service. + LabelServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.LabelService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // LabelServiceCreateLabelProcedure is the fully-qualified name of the LabelService's CreateLabel + // RPC. + LabelServiceCreateLabelProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/CreateLabel" + // LabelServiceMoveLabelProcedure is the fully-qualified name of the LabelService's MoveLabel RPC. + LabelServiceMoveLabelProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/MoveLabel" + // LabelServiceGetLabelsProcedure is the fully-qualified name of the LabelService's GetLabels RPC. + LabelServiceGetLabelsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/GetLabels" +) + +// LabelServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.LabelService service. +type LabelServiceClient interface { + CreateLabel(context.Context, *connect_go.Request[v1alpha1.CreateLabelRequest]) (*connect_go.Response[v1alpha1.CreateLabelResponse], error) + MoveLabel(context.Context, *connect_go.Request[v1alpha1.MoveLabelRequest]) (*connect_go.Response[v1alpha1.MoveLabelResponse], error) + GetLabels(context.Context, *connect_go.Request[v1alpha1.GetLabelsRequest]) (*connect_go.Response[v1alpha1.GetLabelsResponse], error) +} + +// NewLabelServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.LabelService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewLabelServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) LabelServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &labelServiceClient{ + createLabel: connect_go.NewClient[v1alpha1.CreateLabelRequest, v1alpha1.CreateLabelResponse]( + httpClient, + baseURL+LabelServiceCreateLabelProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + moveLabel: connect_go.NewClient[v1alpha1.MoveLabelRequest, v1alpha1.MoveLabelResponse]( + httpClient, + baseURL+LabelServiceMoveLabelProcedure, + opts..., + ), + getLabels: connect_go.NewClient[v1alpha1.GetLabelsRequest, v1alpha1.GetLabelsResponse]( + httpClient, + baseURL+LabelServiceGetLabelsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// labelServiceClient implements LabelServiceClient. +type labelServiceClient struct { + createLabel *connect_go.Client[v1alpha1.CreateLabelRequest, v1alpha1.CreateLabelResponse] + moveLabel *connect_go.Client[v1alpha1.MoveLabelRequest, v1alpha1.MoveLabelResponse] + getLabels *connect_go.Client[v1alpha1.GetLabelsRequest, v1alpha1.GetLabelsResponse] +} + +// CreateLabel calls bufman.dubbo.apache.org.registry.v1alpha1.LabelService.CreateLabel. +func (c *labelServiceClient) CreateLabel(ctx context.Context, req *connect_go.Request[v1alpha1.CreateLabelRequest]) (*connect_go.Response[v1alpha1.CreateLabelResponse], error) { + return c.createLabel.CallUnary(ctx, req) +} + +// MoveLabel calls bufman.dubbo.apache.org.registry.v1alpha1.LabelService.MoveLabel. +func (c *labelServiceClient) MoveLabel(ctx context.Context, req *connect_go.Request[v1alpha1.MoveLabelRequest]) (*connect_go.Response[v1alpha1.MoveLabelResponse], error) { + return c.moveLabel.CallUnary(ctx, req) +} + +// GetLabels calls bufman.dubbo.apache.org.registry.v1alpha1.LabelService.GetLabels. +func (c *labelServiceClient) GetLabels(ctx context.Context, req *connect_go.Request[v1alpha1.GetLabelsRequest]) (*connect_go.Response[v1alpha1.GetLabelsResponse], error) { + return c.getLabels.CallUnary(ctx, req) +} + +// LabelServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.LabelService service. +type LabelServiceHandler interface { + CreateLabel(context.Context, *connect_go.Request[v1alpha1.CreateLabelRequest]) (*connect_go.Response[v1alpha1.CreateLabelResponse], error) + MoveLabel(context.Context, *connect_go.Request[v1alpha1.MoveLabelRequest]) (*connect_go.Response[v1alpha1.MoveLabelResponse], error) + GetLabels(context.Context, *connect_go.Request[v1alpha1.GetLabelsRequest]) (*connect_go.Response[v1alpha1.GetLabelsResponse], error) +} + +// NewLabelServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewLabelServiceHandler(svc LabelServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + labelServiceCreateLabelHandler := connect_go.NewUnaryHandler( + LabelServiceCreateLabelProcedure, + svc.CreateLabel, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + labelServiceMoveLabelHandler := connect_go.NewUnaryHandler( + LabelServiceMoveLabelProcedure, + svc.MoveLabel, + opts..., + ) + labelServiceGetLabelsHandler := connect_go.NewUnaryHandler( + LabelServiceGetLabelsProcedure, + svc.GetLabels, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case LabelServiceCreateLabelProcedure: + labelServiceCreateLabelHandler.ServeHTTP(w, r) + case LabelServiceMoveLabelProcedure: + labelServiceMoveLabelHandler.ServeHTTP(w, r) + case LabelServiceGetLabelsProcedure: + labelServiceGetLabelsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedLabelServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedLabelServiceHandler struct{} + +func (UnimplementedLabelServiceHandler) CreateLabel(context.Context, *connect_go.Request[v1alpha1.CreateLabelRequest]) (*connect_go.Response[v1alpha1.CreateLabelResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.LabelService.CreateLabel is not implemented")) +} + +func (UnimplementedLabelServiceHandler) MoveLabel(context.Context, *connect_go.Request[v1alpha1.MoveLabelRequest]) (*connect_go.Response[v1alpha1.MoveLabelResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.LabelService.MoveLabel is not implemented")) +} + +func (UnimplementedLabelServiceHandler) GetLabels(context.Context, *connect_go.Request[v1alpha1.GetLabelsRequest]) (*connect_go.Response[v1alpha1.GetLabelsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.LabelService.GetLabels is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/organization.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/organization.connect.go new file mode 100644 index 000000000..40298f46b --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/organization.connect.go @@ -0,0 +1,600 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/organization.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // OrganizationServiceName is the fully-qualified name of the OrganizationService service. + OrganizationServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // OrganizationServiceGetOrganizationProcedure is the fully-qualified name of the + // OrganizationService's GetOrganization RPC. + OrganizationServiceGetOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganization" + // OrganizationServiceGetOrganizationByNameProcedure is the fully-qualified name of the + // OrganizationService's GetOrganizationByName RPC. + OrganizationServiceGetOrganizationByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganizationByName" + // OrganizationServiceListOrganizationsProcedure is the fully-qualified name of the + // OrganizationService's ListOrganizations RPC. + OrganizationServiceListOrganizationsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/ListOrganizations" + // OrganizationServiceListUserOrganizationsProcedure is the fully-qualified name of the + // OrganizationService's ListUserOrganizations RPC. + OrganizationServiceListUserOrganizationsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/ListUserOrganizations" + // OrganizationServiceGetUserOrganizationProcedure is the fully-qualified name of the + // OrganizationService's GetUserOrganization RPC. + OrganizationServiceGetUserOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetUserOrganization" + // OrganizationServiceCreateOrganizationProcedure is the fully-qualified name of the + // OrganizationService's CreateOrganization RPC. + OrganizationServiceCreateOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/CreateOrganization" + // OrganizationServiceDeleteOrganizationProcedure is the fully-qualified name of the + // OrganizationService's DeleteOrganization RPC. + OrganizationServiceDeleteOrganizationProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/DeleteOrganization" + // OrganizationServiceDeleteOrganizationByNameProcedure is the fully-qualified name of the + // OrganizationService's DeleteOrganizationByName RPC. + OrganizationServiceDeleteOrganizationByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/DeleteOrganizationByName" + // OrganizationServiceAddOrganizationMemberProcedure is the fully-qualified name of the + // OrganizationService's AddOrganizationMember RPC. + OrganizationServiceAddOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/AddOrganizationMember" + // OrganizationServiceUpdateOrganizationMemberProcedure is the fully-qualified name of the + // OrganizationService's UpdateOrganizationMember RPC. + OrganizationServiceUpdateOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/UpdateOrganizationMember" + // OrganizationServiceRemoveOrganizationMemberProcedure is the fully-qualified name of the + // OrganizationService's RemoveOrganizationMember RPC. + OrganizationServiceRemoveOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/RemoveOrganizationMember" + // OrganizationServiceSetOrganizationMemberProcedure is the fully-qualified name of the + // OrganizationService's SetOrganizationMember RPC. + OrganizationServiceSetOrganizationMemberProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/SetOrganizationMember" + // OrganizationServiceGetOrganizationSettingsProcedure is the fully-qualified name of the + // OrganizationService's GetOrganizationSettings RPC. + OrganizationServiceGetOrganizationSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganizationSettings" + // OrganizationServiceUpdateOrganizationSettingsProcedure is the fully-qualified name of the + // OrganizationService's UpdateOrganizationSettings RPC. + OrganizationServiceUpdateOrganizationSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/UpdateOrganizationSettings" + // OrganizationServiceAddOrganizationGroupProcedure is the fully-qualified name of the + // OrganizationService's AddOrganizationGroup RPC. + OrganizationServiceAddOrganizationGroupProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/AddOrganizationGroup" + // OrganizationServiceRemoveOrganizationGroupProcedure is the fully-qualified name of the + // OrganizationService's RemoveOrganizationGroup RPC. + OrganizationServiceRemoveOrganizationGroupProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/RemoveOrganizationGroup" +) + +// OrganizationServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService service. +type OrganizationServiceClient interface { + // GetOrganization gets a organization by ID. + GetOrganization(context.Context, *connect_go.Request[v1alpha1.GetOrganizationRequest]) (*connect_go.Response[v1alpha1.GetOrganizationResponse], error) + // GetOrganizationByName gets a organization by name. + GetOrganizationByName(context.Context, *connect_go.Request[v1alpha1.GetOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.GetOrganizationByNameResponse], error) + // ListOrganizations lists all organizations. + ListOrganizations(context.Context, *connect_go.Request[v1alpha1.ListOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationsResponse], error) + // ListUserOrganizations lists all organizations a user is member of. + ListUserOrganizations(context.Context, *connect_go.Request[v1alpha1.ListUserOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListUserOrganizationsResponse], error) + GetUserOrganization(context.Context, *connect_go.Request[v1alpha1.GetUserOrganizationRequest]) (*connect_go.Response[v1alpha1.GetUserOrganizationResponse], error) + // CreateOrganization creates a new organization. + CreateOrganization(context.Context, *connect_go.Request[v1alpha1.CreateOrganizationRequest]) (*connect_go.Response[v1alpha1.CreateOrganizationResponse], error) + // DeleteOrganization deletes a organization. + DeleteOrganization(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationResponse], error) + // DeleteOrganizationByName deletes a organization by name. + DeleteOrganizationByName(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationByNameResponse], error) + // AddOrganizationMember add a role to an user in the organization. + AddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.AddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.AddOrganizationMemberResponse], error) + // UpdateOrganizationMember update the user's membership information in the organization. + UpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationMemberResponse], error) + // RemoveOrganizationMember remove the role of an user in the organization. + RemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationMemberResponse], error) + // SetOrganizationMember sets the role of a user in the organization. + SetOrganizationMember(context.Context, *connect_go.Request[v1alpha1.SetOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.SetOrganizationMemberResponse], error) + // GetOrganizationSettings gets the settings of an organization, including organization base roles. + GetOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.GetOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.GetOrganizationSettingsResponse], error) + // UpdateOrganizationSettings update the organization settings including base roles. + UpdateOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationSettingsResponse], error) + // AddOrganizationGroup adds an IdP Group to the organization. + AddOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.AddOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.AddOrganizationGroupResponse], error) + // RemoveOrganizationGroup removes an IdP Group from the organization. + RemoveOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationGroupResponse], error) +} + +// NewOrganizationServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewOrganizationServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) OrganizationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &organizationServiceClient{ + getOrganization: connect_go.NewClient[v1alpha1.GetOrganizationRequest, v1alpha1.GetOrganizationResponse]( + httpClient, + baseURL+OrganizationServiceGetOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getOrganizationByName: connect_go.NewClient[v1alpha1.GetOrganizationByNameRequest, v1alpha1.GetOrganizationByNameResponse]( + httpClient, + baseURL+OrganizationServiceGetOrganizationByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizations: connect_go.NewClient[v1alpha1.ListOrganizationsRequest, v1alpha1.ListOrganizationsResponse]( + httpClient, + baseURL+OrganizationServiceListOrganizationsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUserOrganizations: connect_go.NewClient[v1alpha1.ListUserOrganizationsRequest, v1alpha1.ListUserOrganizationsResponse]( + httpClient, + baseURL+OrganizationServiceListUserOrganizationsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getUserOrganization: connect_go.NewClient[v1alpha1.GetUserOrganizationRequest, v1alpha1.GetUserOrganizationResponse]( + httpClient, + baseURL+OrganizationServiceGetUserOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + createOrganization: connect_go.NewClient[v1alpha1.CreateOrganizationRequest, v1alpha1.CreateOrganizationResponse]( + httpClient, + baseURL+OrganizationServiceCreateOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteOrganization: connect_go.NewClient[v1alpha1.DeleteOrganizationRequest, v1alpha1.DeleteOrganizationResponse]( + httpClient, + baseURL+OrganizationServiceDeleteOrganizationProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteOrganizationByName: connect_go.NewClient[v1alpha1.DeleteOrganizationByNameRequest, v1alpha1.DeleteOrganizationByNameResponse]( + httpClient, + baseURL+OrganizationServiceDeleteOrganizationByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + addOrganizationMember: connect_go.NewClient[v1alpha1.AddOrganizationMemberRequest, v1alpha1.AddOrganizationMemberResponse]( + httpClient, + baseURL+OrganizationServiceAddOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + updateOrganizationMember: connect_go.NewClient[v1alpha1.UpdateOrganizationMemberRequest, v1alpha1.UpdateOrganizationMemberResponse]( + httpClient, + baseURL+OrganizationServiceUpdateOrganizationMemberProcedure, + opts..., + ), + removeOrganizationMember: connect_go.NewClient[v1alpha1.RemoveOrganizationMemberRequest, v1alpha1.RemoveOrganizationMemberResponse]( + httpClient, + baseURL+OrganizationServiceRemoveOrganizationMemberProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + setOrganizationMember: connect_go.NewClient[v1alpha1.SetOrganizationMemberRequest, v1alpha1.SetOrganizationMemberResponse]( + httpClient, + baseURL+OrganizationServiceSetOrganizationMemberProcedure, + opts..., + ), + getOrganizationSettings: connect_go.NewClient[v1alpha1.GetOrganizationSettingsRequest, v1alpha1.GetOrganizationSettingsResponse]( + httpClient, + baseURL+OrganizationServiceGetOrganizationSettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateOrganizationSettings: connect_go.NewClient[v1alpha1.UpdateOrganizationSettingsRequest, v1alpha1.UpdateOrganizationSettingsResponse]( + httpClient, + baseURL+OrganizationServiceUpdateOrganizationSettingsProcedure, + opts..., + ), + addOrganizationGroup: connect_go.NewClient[v1alpha1.AddOrganizationGroupRequest, v1alpha1.AddOrganizationGroupResponse]( + httpClient, + baseURL+OrganizationServiceAddOrganizationGroupProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + removeOrganizationGroup: connect_go.NewClient[v1alpha1.RemoveOrganizationGroupRequest, v1alpha1.RemoveOrganizationGroupResponse]( + httpClient, + baseURL+OrganizationServiceRemoveOrganizationGroupProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// organizationServiceClient implements OrganizationServiceClient. +type organizationServiceClient struct { + getOrganization *connect_go.Client[v1alpha1.GetOrganizationRequest, v1alpha1.GetOrganizationResponse] + getOrganizationByName *connect_go.Client[v1alpha1.GetOrganizationByNameRequest, v1alpha1.GetOrganizationByNameResponse] + listOrganizations *connect_go.Client[v1alpha1.ListOrganizationsRequest, v1alpha1.ListOrganizationsResponse] + listUserOrganizations *connect_go.Client[v1alpha1.ListUserOrganizationsRequest, v1alpha1.ListUserOrganizationsResponse] + getUserOrganization *connect_go.Client[v1alpha1.GetUserOrganizationRequest, v1alpha1.GetUserOrganizationResponse] + createOrganization *connect_go.Client[v1alpha1.CreateOrganizationRequest, v1alpha1.CreateOrganizationResponse] + deleteOrganization *connect_go.Client[v1alpha1.DeleteOrganizationRequest, v1alpha1.DeleteOrganizationResponse] + deleteOrganizationByName *connect_go.Client[v1alpha1.DeleteOrganizationByNameRequest, v1alpha1.DeleteOrganizationByNameResponse] + addOrganizationMember *connect_go.Client[v1alpha1.AddOrganizationMemberRequest, v1alpha1.AddOrganizationMemberResponse] + updateOrganizationMember *connect_go.Client[v1alpha1.UpdateOrganizationMemberRequest, v1alpha1.UpdateOrganizationMemberResponse] + removeOrganizationMember *connect_go.Client[v1alpha1.RemoveOrganizationMemberRequest, v1alpha1.RemoveOrganizationMemberResponse] + setOrganizationMember *connect_go.Client[v1alpha1.SetOrganizationMemberRequest, v1alpha1.SetOrganizationMemberResponse] + getOrganizationSettings *connect_go.Client[v1alpha1.GetOrganizationSettingsRequest, v1alpha1.GetOrganizationSettingsResponse] + updateOrganizationSettings *connect_go.Client[v1alpha1.UpdateOrganizationSettingsRequest, v1alpha1.UpdateOrganizationSettingsResponse] + addOrganizationGroup *connect_go.Client[v1alpha1.AddOrganizationGroupRequest, v1alpha1.AddOrganizationGroupResponse] + removeOrganizationGroup *connect_go.Client[v1alpha1.RemoveOrganizationGroupRequest, v1alpha1.RemoveOrganizationGroupResponse] +} + +// GetOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganization. +func (c *organizationServiceClient) GetOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrganizationRequest]) (*connect_go.Response[v1alpha1.GetOrganizationResponse], error) { + return c.getOrganization.CallUnary(ctx, req) +} + +// GetOrganizationByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationByName. +func (c *organizationServiceClient) GetOrganizationByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.GetOrganizationByNameResponse], error) { + return c.getOrganizationByName.CallUnary(ctx, req) +} + +// ListOrganizations calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListOrganizations. +func (c *organizationServiceClient) ListOrganizations(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationsResponse], error) { + return c.listOrganizations.CallUnary(ctx, req) +} + +// ListUserOrganizations calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListUserOrganizations. +func (c *organizationServiceClient) ListUserOrganizations(ctx context.Context, req *connect_go.Request[v1alpha1.ListUserOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListUserOrganizationsResponse], error) { + return c.listUserOrganizations.CallUnary(ctx, req) +} + +// GetUserOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetUserOrganization. +func (c *organizationServiceClient) GetUserOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.GetUserOrganizationRequest]) (*connect_go.Response[v1alpha1.GetUserOrganizationResponse], error) { + return c.getUserOrganization.CallUnary(ctx, req) +} + +// CreateOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.CreateOrganization. +func (c *organizationServiceClient) CreateOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.CreateOrganizationRequest]) (*connect_go.Response[v1alpha1.CreateOrganizationResponse], error) { + return c.createOrganization.CallUnary(ctx, req) +} + +// DeleteOrganization calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganization. +func (c *organizationServiceClient) DeleteOrganization(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationResponse], error) { + return c.deleteOrganization.CallUnary(ctx, req) +} + +// DeleteOrganizationByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganizationByName. +func (c *organizationServiceClient) DeleteOrganizationByName(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationByNameResponse], error) { + return c.deleteOrganizationByName.CallUnary(ctx, req) +} + +// AddOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationMember. +func (c *organizationServiceClient) AddOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.AddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.AddOrganizationMemberResponse], error) { + return c.addOrganizationMember.CallUnary(ctx, req) +} + +// UpdateOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationMember. +func (c *organizationServiceClient) UpdateOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationMemberResponse], error) { + return c.updateOrganizationMember.CallUnary(ctx, req) +} + +// RemoveOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationMember. +func (c *organizationServiceClient) RemoveOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.RemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationMemberResponse], error) { + return c.removeOrganizationMember.CallUnary(ctx, req) +} + +// SetOrganizationMember calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.SetOrganizationMember. +func (c *organizationServiceClient) SetOrganizationMember(ctx context.Context, req *connect_go.Request[v1alpha1.SetOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.SetOrganizationMemberResponse], error) { + return c.setOrganizationMember.CallUnary(ctx, req) +} + +// GetOrganizationSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationSettings. +func (c *organizationServiceClient) GetOrganizationSettings(ctx context.Context, req *connect_go.Request[v1alpha1.GetOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.GetOrganizationSettingsResponse], error) { + return c.getOrganizationSettings.CallUnary(ctx, req) +} + +// UpdateOrganizationSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationSettings. +func (c *organizationServiceClient) UpdateOrganizationSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationSettingsResponse], error) { + return c.updateOrganizationSettings.CallUnary(ctx, req) +} + +// AddOrganizationGroup calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationGroup. +func (c *organizationServiceClient) AddOrganizationGroup(ctx context.Context, req *connect_go.Request[v1alpha1.AddOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.AddOrganizationGroupResponse], error) { + return c.addOrganizationGroup.CallUnary(ctx, req) +} + +// RemoveOrganizationGroup calls +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationGroup. +func (c *organizationServiceClient) RemoveOrganizationGroup(ctx context.Context, req *connect_go.Request[v1alpha1.RemoveOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationGroupResponse], error) { + return c.removeOrganizationGroup.CallUnary(ctx, req) +} + +// OrganizationServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService service. +type OrganizationServiceHandler interface { + // GetOrganization gets a organization by ID. + GetOrganization(context.Context, *connect_go.Request[v1alpha1.GetOrganizationRequest]) (*connect_go.Response[v1alpha1.GetOrganizationResponse], error) + // GetOrganizationByName gets a organization by name. + GetOrganizationByName(context.Context, *connect_go.Request[v1alpha1.GetOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.GetOrganizationByNameResponse], error) + // ListOrganizations lists all organizations. + ListOrganizations(context.Context, *connect_go.Request[v1alpha1.ListOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationsResponse], error) + // ListUserOrganizations lists all organizations a user is member of. + ListUserOrganizations(context.Context, *connect_go.Request[v1alpha1.ListUserOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListUserOrganizationsResponse], error) + GetUserOrganization(context.Context, *connect_go.Request[v1alpha1.GetUserOrganizationRequest]) (*connect_go.Response[v1alpha1.GetUserOrganizationResponse], error) + // CreateOrganization creates a new organization. + CreateOrganization(context.Context, *connect_go.Request[v1alpha1.CreateOrganizationRequest]) (*connect_go.Response[v1alpha1.CreateOrganizationResponse], error) + // DeleteOrganization deletes a organization. + DeleteOrganization(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationResponse], error) + // DeleteOrganizationByName deletes a organization by name. + DeleteOrganizationByName(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationByNameResponse], error) + // AddOrganizationMember add a role to an user in the organization. + AddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.AddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.AddOrganizationMemberResponse], error) + // UpdateOrganizationMember update the user's membership information in the organization. + UpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationMemberResponse], error) + // RemoveOrganizationMember remove the role of an user in the organization. + RemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationMemberResponse], error) + // SetOrganizationMember sets the role of a user in the organization. + SetOrganizationMember(context.Context, *connect_go.Request[v1alpha1.SetOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.SetOrganizationMemberResponse], error) + // GetOrganizationSettings gets the settings of an organization, including organization base roles. + GetOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.GetOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.GetOrganizationSettingsResponse], error) + // UpdateOrganizationSettings update the organization settings including base roles. + UpdateOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationSettingsResponse], error) + // AddOrganizationGroup adds an IdP Group to the organization. + AddOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.AddOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.AddOrganizationGroupResponse], error) + // RemoveOrganizationGroup removes an IdP Group from the organization. + RemoveOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationGroupResponse], error) +} + +// NewOrganizationServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewOrganizationServiceHandler(svc OrganizationServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + organizationServiceGetOrganizationHandler := connect_go.NewUnaryHandler( + OrganizationServiceGetOrganizationProcedure, + svc.GetOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceGetOrganizationByNameHandler := connect_go.NewUnaryHandler( + OrganizationServiceGetOrganizationByNameProcedure, + svc.GetOrganizationByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceListOrganizationsHandler := connect_go.NewUnaryHandler( + OrganizationServiceListOrganizationsProcedure, + svc.ListOrganizations, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceListUserOrganizationsHandler := connect_go.NewUnaryHandler( + OrganizationServiceListUserOrganizationsProcedure, + svc.ListUserOrganizations, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceGetUserOrganizationHandler := connect_go.NewUnaryHandler( + OrganizationServiceGetUserOrganizationProcedure, + svc.GetUserOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceCreateOrganizationHandler := connect_go.NewUnaryHandler( + OrganizationServiceCreateOrganizationProcedure, + svc.CreateOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceDeleteOrganizationHandler := connect_go.NewUnaryHandler( + OrganizationServiceDeleteOrganizationProcedure, + svc.DeleteOrganization, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceDeleteOrganizationByNameHandler := connect_go.NewUnaryHandler( + OrganizationServiceDeleteOrganizationByNameProcedure, + svc.DeleteOrganizationByName, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceAddOrganizationMemberHandler := connect_go.NewUnaryHandler( + OrganizationServiceAddOrganizationMemberProcedure, + svc.AddOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceUpdateOrganizationMemberHandler := connect_go.NewUnaryHandler( + OrganizationServiceUpdateOrganizationMemberProcedure, + svc.UpdateOrganizationMember, + opts..., + ) + organizationServiceRemoveOrganizationMemberHandler := connect_go.NewUnaryHandler( + OrganizationServiceRemoveOrganizationMemberProcedure, + svc.RemoveOrganizationMember, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceSetOrganizationMemberHandler := connect_go.NewUnaryHandler( + OrganizationServiceSetOrganizationMemberProcedure, + svc.SetOrganizationMember, + opts..., + ) + organizationServiceGetOrganizationSettingsHandler := connect_go.NewUnaryHandler( + OrganizationServiceGetOrganizationSettingsProcedure, + svc.GetOrganizationSettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceUpdateOrganizationSettingsHandler := connect_go.NewUnaryHandler( + OrganizationServiceUpdateOrganizationSettingsProcedure, + svc.UpdateOrganizationSettings, + opts..., + ) + organizationServiceAddOrganizationGroupHandler := connect_go.NewUnaryHandler( + OrganizationServiceAddOrganizationGroupProcedure, + svc.AddOrganizationGroup, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + organizationServiceRemoveOrganizationGroupHandler := connect_go.NewUnaryHandler( + OrganizationServiceRemoveOrganizationGroupProcedure, + svc.RemoveOrganizationGroup, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case OrganizationServiceGetOrganizationProcedure: + organizationServiceGetOrganizationHandler.ServeHTTP(w, r) + case OrganizationServiceGetOrganizationByNameProcedure: + organizationServiceGetOrganizationByNameHandler.ServeHTTP(w, r) + case OrganizationServiceListOrganizationsProcedure: + organizationServiceListOrganizationsHandler.ServeHTTP(w, r) + case OrganizationServiceListUserOrganizationsProcedure: + organizationServiceListUserOrganizationsHandler.ServeHTTP(w, r) + case OrganizationServiceGetUserOrganizationProcedure: + organizationServiceGetUserOrganizationHandler.ServeHTTP(w, r) + case OrganizationServiceCreateOrganizationProcedure: + organizationServiceCreateOrganizationHandler.ServeHTTP(w, r) + case OrganizationServiceDeleteOrganizationProcedure: + organizationServiceDeleteOrganizationHandler.ServeHTTP(w, r) + case OrganizationServiceDeleteOrganizationByNameProcedure: + organizationServiceDeleteOrganizationByNameHandler.ServeHTTP(w, r) + case OrganizationServiceAddOrganizationMemberProcedure: + organizationServiceAddOrganizationMemberHandler.ServeHTTP(w, r) + case OrganizationServiceUpdateOrganizationMemberProcedure: + organizationServiceUpdateOrganizationMemberHandler.ServeHTTP(w, r) + case OrganizationServiceRemoveOrganizationMemberProcedure: + organizationServiceRemoveOrganizationMemberHandler.ServeHTTP(w, r) + case OrganizationServiceSetOrganizationMemberProcedure: + organizationServiceSetOrganizationMemberHandler.ServeHTTP(w, r) + case OrganizationServiceGetOrganizationSettingsProcedure: + organizationServiceGetOrganizationSettingsHandler.ServeHTTP(w, r) + case OrganizationServiceUpdateOrganizationSettingsProcedure: + organizationServiceUpdateOrganizationSettingsHandler.ServeHTTP(w, r) + case OrganizationServiceAddOrganizationGroupProcedure: + organizationServiceAddOrganizationGroupHandler.ServeHTTP(w, r) + case OrganizationServiceRemoveOrganizationGroupProcedure: + organizationServiceRemoveOrganizationGroupHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedOrganizationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedOrganizationServiceHandler struct{} + +func (UnimplementedOrganizationServiceHandler) GetOrganization(context.Context, *connect_go.Request[v1alpha1.GetOrganizationRequest]) (*connect_go.Response[v1alpha1.GetOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganization is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) GetOrganizationByName(context.Context, *connect_go.Request[v1alpha1.GetOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.GetOrganizationByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationByName is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) ListOrganizations(context.Context, *connect_go.Request[v1alpha1.ListOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListOrganizations is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) ListUserOrganizations(context.Context, *connect_go.Request[v1alpha1.ListUserOrganizationsRequest]) (*connect_go.Response[v1alpha1.ListUserOrganizationsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListUserOrganizations is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) GetUserOrganization(context.Context, *connect_go.Request[v1alpha1.GetUserOrganizationRequest]) (*connect_go.Response[v1alpha1.GetUserOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetUserOrganization is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) CreateOrganization(context.Context, *connect_go.Request[v1alpha1.CreateOrganizationRequest]) (*connect_go.Response[v1alpha1.CreateOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.CreateOrganization is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) DeleteOrganization(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganization is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) DeleteOrganizationByName(context.Context, *connect_go.Request[v1alpha1.DeleteOrganizationByNameRequest]) (*connect_go.Response[v1alpha1.DeleteOrganizationByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganizationByName is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) AddOrganizationMember(context.Context, *connect_go.Request[v1alpha1.AddOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.AddOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationMember is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) UpdateOrganizationMember(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationMember is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) RemoveOrganizationMember(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationMember is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) SetOrganizationMember(context.Context, *connect_go.Request[v1alpha1.SetOrganizationMemberRequest]) (*connect_go.Response[v1alpha1.SetOrganizationMemberResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.SetOrganizationMember is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) GetOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.GetOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.GetOrganizationSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationSettings is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) UpdateOrganizationSettings(context.Context, *connect_go.Request[v1alpha1.UpdateOrganizationSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateOrganizationSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationSettings is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) AddOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.AddOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.AddOrganizationGroupResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationGroup is not implemented")) +} + +func (UnimplementedOrganizationServiceHandler) RemoveOrganizationGroup(context.Context, *connect_go.Request[v1alpha1.RemoveOrganizationGroupRequest]) (*connect_go.Response[v1alpha1.RemoveOrganizationGroupResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationGroup is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/owner.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/owner.connect.go new file mode 100644 index 000000000..7ecfd1328 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/owner.connect.go @@ -0,0 +1,130 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/owner.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // OwnerServiceName is the fully-qualified name of the OwnerService service. + OwnerServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.OwnerService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // OwnerServiceGetOwnerByNameProcedure is the fully-qualified name of the OwnerService's + // GetOwnerByName RPC. + OwnerServiceGetOwnerByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.OwnerService/GetOwnerByName" +) + +// OwnerServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.OwnerService service. +type OwnerServiceClient interface { + // GetOwnerByName takes an owner name and returns the owner as + // either a user or organization. + GetOwnerByName(context.Context, *connect_go.Request[v1alpha1.GetOwnerByNameRequest]) (*connect_go.Response[v1alpha1.GetOwnerByNameResponse], error) +} + +// NewOwnerServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.OwnerService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewOwnerServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) OwnerServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &ownerServiceClient{ + getOwnerByName: connect_go.NewClient[v1alpha1.GetOwnerByNameRequest, v1alpha1.GetOwnerByNameResponse]( + httpClient, + baseURL+OwnerServiceGetOwnerByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// ownerServiceClient implements OwnerServiceClient. +type ownerServiceClient struct { + getOwnerByName *connect_go.Client[v1alpha1.GetOwnerByNameRequest, v1alpha1.GetOwnerByNameResponse] +} + +// GetOwnerByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.OwnerService.GetOwnerByName. +func (c *ownerServiceClient) GetOwnerByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetOwnerByNameRequest]) (*connect_go.Response[v1alpha1.GetOwnerByNameResponse], error) { + return c.getOwnerByName.CallUnary(ctx, req) +} + +// OwnerServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.OwnerService service. +type OwnerServiceHandler interface { + // GetOwnerByName takes an owner name and returns the owner as + // either a user or organization. + GetOwnerByName(context.Context, *connect_go.Request[v1alpha1.GetOwnerByNameRequest]) (*connect_go.Response[v1alpha1.GetOwnerByNameResponse], error) +} + +// NewOwnerServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewOwnerServiceHandler(svc OwnerServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + ownerServiceGetOwnerByNameHandler := connect_go.NewUnaryHandler( + OwnerServiceGetOwnerByNameProcedure, + svc.GetOwnerByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.OwnerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case OwnerServiceGetOwnerByNameProcedure: + ownerServiceGetOwnerByNameHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedOwnerServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedOwnerServiceHandler struct{} + +func (UnimplementedOwnerServiceHandler) GetOwnerByName(context.Context, *connect_go.Request[v1alpha1.GetOwnerByNameRequest]) (*connect_go.Response[v1alpha1.GetOwnerByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.OwnerService.GetOwnerByName is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/plugin.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/plugin.connect.go new file mode 100644 index 000000000..6b03bdd04 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/plugin.connect.go @@ -0,0 +1,585 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// registry/v1alpha1/plugin.proto is a deprecated file. + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // PluginServiceName is the fully-qualified name of the PluginService service. + PluginServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.PluginService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // PluginServiceListPluginsProcedure is the fully-qualified name of the PluginService's ListPlugins + // RPC. + PluginServiceListPluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListPlugins" + // PluginServiceListUserPluginsProcedure is the fully-qualified name of the PluginService's + // ListUserPlugins RPC. + PluginServiceListUserPluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListUserPlugins" + // PluginServiceListOrganizationPluginsProcedure is the fully-qualified name of the PluginService's + // ListOrganizationPlugins RPC. + PluginServiceListOrganizationPluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListOrganizationPlugins" + // PluginServiceGetPluginVersionProcedure is the fully-qualified name of the PluginService's + // GetPluginVersion RPC. + PluginServiceGetPluginVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetPluginVersion" + // PluginServiceListPluginVersionsProcedure is the fully-qualified name of the PluginService's + // ListPluginVersions RPC. + PluginServiceListPluginVersionsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListPluginVersions" + // PluginServiceGetPluginProcedure is the fully-qualified name of the PluginService's GetPlugin RPC. + PluginServiceGetPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetPlugin" + // PluginServiceDeletePluginProcedure is the fully-qualified name of the PluginService's + // DeletePlugin RPC. + PluginServiceDeletePluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/DeletePlugin" + // PluginServiceGetTemplateProcedure is the fully-qualified name of the PluginService's GetTemplate + // RPC. + PluginServiceGetTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetTemplate" + // PluginServiceListTemplatesProcedure is the fully-qualified name of the PluginService's + // ListTemplates RPC. + PluginServiceListTemplatesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplates" + // PluginServiceListTemplatesUserCanAccessProcedure is the fully-qualified name of the + // PluginService's ListTemplatesUserCanAccess RPC. + PluginServiceListTemplatesUserCanAccessProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplatesUserCanAccess" + // PluginServiceListUserTemplatesProcedure is the fully-qualified name of the PluginService's + // ListUserTemplates RPC. + PluginServiceListUserTemplatesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListUserTemplates" + // PluginServiceListOrganizationTemplatesProcedure is the fully-qualified name of the + // PluginService's ListOrganizationTemplates RPC. + PluginServiceListOrganizationTemplatesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListOrganizationTemplates" + // PluginServiceGetTemplateVersionProcedure is the fully-qualified name of the PluginService's + // GetTemplateVersion RPC. + PluginServiceGetTemplateVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetTemplateVersion" + // PluginServiceListTemplateVersionsProcedure is the fully-qualified name of the PluginService's + // ListTemplateVersions RPC. + PluginServiceListTemplateVersionsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplateVersions" + // PluginServiceDeleteTemplateProcedure is the fully-qualified name of the PluginService's + // DeleteTemplate RPC. + PluginServiceDeleteTemplateProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/DeleteTemplate" +) + +// PluginServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService service. +type PluginServiceClient interface { + // ListPlugins returns all the plugins available to the user. This includes + // public plugins, those uploaded to organizations the user is part of, + // and any plugins uploaded directly by the user. + ListPlugins(context.Context, *connect_go.Request[v1alpha1.ListPluginsRequest]) (*connect_go.Response[v1alpha1.ListPluginsResponse], error) + // ListUserPlugins lists all plugins belonging to a user. + ListUserPlugins(context.Context, *connect_go.Request[v1alpha1.ListUserPluginsRequest]) (*connect_go.Response[v1alpha1.ListUserPluginsResponse], error) + // ListOrganizationPlugins lists all plugins for an organization. + ListOrganizationPlugins(context.Context, *connect_go.Request[v1alpha1.ListOrganizationPluginsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationPluginsResponse], error) + // GetPluginVersion returns the plugin version, if found. + GetPluginVersion(context.Context, *connect_go.Request[v1alpha1.GetPluginVersionRequest]) (*connect_go.Response[v1alpha1.GetPluginVersionResponse], error) + // ListPluginVersions lists all the versions available for the specified plugin. + ListPluginVersions(context.Context, *connect_go.Request[v1alpha1.ListPluginVersionsRequest]) (*connect_go.Response[v1alpha1.ListPluginVersionsResponse], error) + // GetPlugin returns the plugin, if found. + GetPlugin(context.Context, *connect_go.Request[v1alpha1.GetPluginRequest]) (*connect_go.Response[v1alpha1.GetPluginResponse], error) + // DeletePlugin deletes the plugin, if it exists. Note that deleting + // a plugin may cause breaking changes for templates using that plugin, + // and should be done with extreme care. + DeletePlugin(context.Context, *connect_go.Request[v1alpha1.DeletePluginRequest]) (*connect_go.Response[v1alpha1.DeletePluginResponse], error) + // GetTemplate returns the template, if found. + GetTemplate(context.Context, *connect_go.Request[v1alpha1.GetTemplateRequest]) (*connect_go.Response[v1alpha1.GetTemplateResponse], error) + // ListTemplates returns all the templates available to the user. This includes + // public templates, those owned by organizations the user is part of, + // and any created directly by the user. + ListTemplates(context.Context, *connect_go.Request[v1alpha1.ListTemplatesRequest]) (*connect_go.Response[v1alpha1.ListTemplatesResponse], error) + // ListTemplatesUserCanAccess is like ListTemplates, but does not return + // public templates. + ListTemplatesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListTemplatesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListTemplatesUserCanAccessResponse], error) + // ListUserPlugins lists all templates belonging to a user. + ListUserTemplates(context.Context, *connect_go.Request[v1alpha1.ListUserTemplatesRequest]) (*connect_go.Response[v1alpha1.ListUserTemplatesResponse], error) + // ListOrganizationTemplates lists all templates for an organization. + ListOrganizationTemplates(context.Context, *connect_go.Request[v1alpha1.ListOrganizationTemplatesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationTemplatesResponse], error) + // GetTemplateVersion returns the template version, if found. + GetTemplateVersion(context.Context, *connect_go.Request[v1alpha1.GetTemplateVersionRequest]) (*connect_go.Response[v1alpha1.GetTemplateVersionResponse], error) + // ListTemplateVersions lists all the template versions available for the specified template. + ListTemplateVersions(context.Context, *connect_go.Request[v1alpha1.ListTemplateVersionsRequest]) (*connect_go.Response[v1alpha1.ListTemplateVersionsResponse], error) + // DeleteTemplate deletes the template, if it exists. + DeleteTemplate(context.Context, *connect_go.Request[v1alpha1.DeleteTemplateRequest]) (*connect_go.Response[v1alpha1.DeleteTemplateResponse], error) +} + +// NewPluginServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewPluginServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) PluginServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &pluginServiceClient{ + listPlugins: connect_go.NewClient[v1alpha1.ListPluginsRequest, v1alpha1.ListPluginsResponse]( + httpClient, + baseURL+PluginServiceListPluginsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUserPlugins: connect_go.NewClient[v1alpha1.ListUserPluginsRequest, v1alpha1.ListUserPluginsResponse]( + httpClient, + baseURL+PluginServiceListUserPluginsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizationPlugins: connect_go.NewClient[v1alpha1.ListOrganizationPluginsRequest, v1alpha1.ListOrganizationPluginsResponse]( + httpClient, + baseURL+PluginServiceListOrganizationPluginsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getPluginVersion: connect_go.NewClient[v1alpha1.GetPluginVersionRequest, v1alpha1.GetPluginVersionResponse]( + httpClient, + baseURL+PluginServiceGetPluginVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listPluginVersions: connect_go.NewClient[v1alpha1.ListPluginVersionsRequest, v1alpha1.ListPluginVersionsResponse]( + httpClient, + baseURL+PluginServiceListPluginVersionsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getPlugin: connect_go.NewClient[v1alpha1.GetPluginRequest, v1alpha1.GetPluginResponse]( + httpClient, + baseURL+PluginServiceGetPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deletePlugin: connect_go.NewClient[v1alpha1.DeletePluginRequest, v1alpha1.DeletePluginResponse]( + httpClient, + baseURL+PluginServiceDeletePluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getTemplate: connect_go.NewClient[v1alpha1.GetTemplateRequest, v1alpha1.GetTemplateResponse]( + httpClient, + baseURL+PluginServiceGetTemplateProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listTemplates: connect_go.NewClient[v1alpha1.ListTemplatesRequest, v1alpha1.ListTemplatesResponse]( + httpClient, + baseURL+PluginServiceListTemplatesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listTemplatesUserCanAccess: connect_go.NewClient[v1alpha1.ListTemplatesUserCanAccessRequest, v1alpha1.ListTemplatesUserCanAccessResponse]( + httpClient, + baseURL+PluginServiceListTemplatesUserCanAccessProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUserTemplates: connect_go.NewClient[v1alpha1.ListUserTemplatesRequest, v1alpha1.ListUserTemplatesResponse]( + httpClient, + baseURL+PluginServiceListUserTemplatesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizationTemplates: connect_go.NewClient[v1alpha1.ListOrganizationTemplatesRequest, v1alpha1.ListOrganizationTemplatesResponse]( + httpClient, + baseURL+PluginServiceListOrganizationTemplatesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getTemplateVersion: connect_go.NewClient[v1alpha1.GetTemplateVersionRequest, v1alpha1.GetTemplateVersionResponse]( + httpClient, + baseURL+PluginServiceGetTemplateVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listTemplateVersions: connect_go.NewClient[v1alpha1.ListTemplateVersionsRequest, v1alpha1.ListTemplateVersionsResponse]( + httpClient, + baseURL+PluginServiceListTemplateVersionsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteTemplate: connect_go.NewClient[v1alpha1.DeleteTemplateRequest, v1alpha1.DeleteTemplateResponse]( + httpClient, + baseURL+PluginServiceDeleteTemplateProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// pluginServiceClient implements PluginServiceClient. +type pluginServiceClient struct { + listPlugins *connect_go.Client[v1alpha1.ListPluginsRequest, v1alpha1.ListPluginsResponse] + listUserPlugins *connect_go.Client[v1alpha1.ListUserPluginsRequest, v1alpha1.ListUserPluginsResponse] + listOrganizationPlugins *connect_go.Client[v1alpha1.ListOrganizationPluginsRequest, v1alpha1.ListOrganizationPluginsResponse] + getPluginVersion *connect_go.Client[v1alpha1.GetPluginVersionRequest, v1alpha1.GetPluginVersionResponse] + listPluginVersions *connect_go.Client[v1alpha1.ListPluginVersionsRequest, v1alpha1.ListPluginVersionsResponse] + getPlugin *connect_go.Client[v1alpha1.GetPluginRequest, v1alpha1.GetPluginResponse] + deletePlugin *connect_go.Client[v1alpha1.DeletePluginRequest, v1alpha1.DeletePluginResponse] + getTemplate *connect_go.Client[v1alpha1.GetTemplateRequest, v1alpha1.GetTemplateResponse] + listTemplates *connect_go.Client[v1alpha1.ListTemplatesRequest, v1alpha1.ListTemplatesResponse] + listTemplatesUserCanAccess *connect_go.Client[v1alpha1.ListTemplatesUserCanAccessRequest, v1alpha1.ListTemplatesUserCanAccessResponse] + listUserTemplates *connect_go.Client[v1alpha1.ListUserTemplatesRequest, v1alpha1.ListUserTemplatesResponse] + listOrganizationTemplates *connect_go.Client[v1alpha1.ListOrganizationTemplatesRequest, v1alpha1.ListOrganizationTemplatesResponse] + getTemplateVersion *connect_go.Client[v1alpha1.GetTemplateVersionRequest, v1alpha1.GetTemplateVersionResponse] + listTemplateVersions *connect_go.Client[v1alpha1.ListTemplateVersionsRequest, v1alpha1.ListTemplateVersionsResponse] + deleteTemplate *connect_go.Client[v1alpha1.DeleteTemplateRequest, v1alpha1.DeleteTemplateResponse] +} + +// ListPlugins calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPlugins. +func (c *pluginServiceClient) ListPlugins(ctx context.Context, req *connect_go.Request[v1alpha1.ListPluginsRequest]) (*connect_go.Response[v1alpha1.ListPluginsResponse], error) { + return c.listPlugins.CallUnary(ctx, req) +} + +// ListUserPlugins calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserPlugins. +func (c *pluginServiceClient) ListUserPlugins(ctx context.Context, req *connect_go.Request[v1alpha1.ListUserPluginsRequest]) (*connect_go.Response[v1alpha1.ListUserPluginsResponse], error) { + return c.listUserPlugins.CallUnary(ctx, req) +} + +// ListOrganizationPlugins calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationPlugins. +func (c *pluginServiceClient) ListOrganizationPlugins(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationPluginsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationPluginsResponse], error) { + return c.listOrganizationPlugins.CallUnary(ctx, req) +} + +// GetPluginVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPluginVersion. +func (c *pluginServiceClient) GetPluginVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetPluginVersionRequest]) (*connect_go.Response[v1alpha1.GetPluginVersionResponse], error) { + return c.getPluginVersion.CallUnary(ctx, req) +} + +// ListPluginVersions calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPluginVersions. +func (c *pluginServiceClient) ListPluginVersions(ctx context.Context, req *connect_go.Request[v1alpha1.ListPluginVersionsRequest]) (*connect_go.Response[v1alpha1.ListPluginVersionsResponse], error) { + return c.listPluginVersions.CallUnary(ctx, req) +} + +// GetPlugin calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPlugin. +func (c *pluginServiceClient) GetPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.GetPluginRequest]) (*connect_go.Response[v1alpha1.GetPluginResponse], error) { + return c.getPlugin.CallUnary(ctx, req) +} + +// DeletePlugin calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeletePlugin. +func (c *pluginServiceClient) DeletePlugin(ctx context.Context, req *connect_go.Request[v1alpha1.DeletePluginRequest]) (*connect_go.Response[v1alpha1.DeletePluginResponse], error) { + return c.deletePlugin.CallUnary(ctx, req) +} + +// GetTemplate calls bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplate. +func (c *pluginServiceClient) GetTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.GetTemplateRequest]) (*connect_go.Response[v1alpha1.GetTemplateResponse], error) { + return c.getTemplate.CallUnary(ctx, req) +} + +// ListTemplates calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplates. +func (c *pluginServiceClient) ListTemplates(ctx context.Context, req *connect_go.Request[v1alpha1.ListTemplatesRequest]) (*connect_go.Response[v1alpha1.ListTemplatesResponse], error) { + return c.listTemplates.CallUnary(ctx, req) +} + +// ListTemplatesUserCanAccess calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplatesUserCanAccess. +func (c *pluginServiceClient) ListTemplatesUserCanAccess(ctx context.Context, req *connect_go.Request[v1alpha1.ListTemplatesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListTemplatesUserCanAccessResponse], error) { + return c.listTemplatesUserCanAccess.CallUnary(ctx, req) +} + +// ListUserTemplates calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserTemplates. +func (c *pluginServiceClient) ListUserTemplates(ctx context.Context, req *connect_go.Request[v1alpha1.ListUserTemplatesRequest]) (*connect_go.Response[v1alpha1.ListUserTemplatesResponse], error) { + return c.listUserTemplates.CallUnary(ctx, req) +} + +// ListOrganizationTemplates calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationTemplates. +func (c *pluginServiceClient) ListOrganizationTemplates(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationTemplatesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationTemplatesResponse], error) { + return c.listOrganizationTemplates.CallUnary(ctx, req) +} + +// GetTemplateVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplateVersion. +func (c *pluginServiceClient) GetTemplateVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetTemplateVersionRequest]) (*connect_go.Response[v1alpha1.GetTemplateVersionResponse], error) { + return c.getTemplateVersion.CallUnary(ctx, req) +} + +// ListTemplateVersions calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplateVersions. +func (c *pluginServiceClient) ListTemplateVersions(ctx context.Context, req *connect_go.Request[v1alpha1.ListTemplateVersionsRequest]) (*connect_go.Response[v1alpha1.ListTemplateVersionsResponse], error) { + return c.listTemplateVersions.CallUnary(ctx, req) +} + +// DeleteTemplate calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeleteTemplate. +func (c *pluginServiceClient) DeleteTemplate(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteTemplateRequest]) (*connect_go.Response[v1alpha1.DeleteTemplateResponse], error) { + return c.deleteTemplate.CallUnary(ctx, req) +} + +// PluginServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginService service. +type PluginServiceHandler interface { + // ListPlugins returns all the plugins available to the user. This includes + // public plugins, those uploaded to organizations the user is part of, + // and any plugins uploaded directly by the user. + ListPlugins(context.Context, *connect_go.Request[v1alpha1.ListPluginsRequest]) (*connect_go.Response[v1alpha1.ListPluginsResponse], error) + // ListUserPlugins lists all plugins belonging to a user. + ListUserPlugins(context.Context, *connect_go.Request[v1alpha1.ListUserPluginsRequest]) (*connect_go.Response[v1alpha1.ListUserPluginsResponse], error) + // ListOrganizationPlugins lists all plugins for an organization. + ListOrganizationPlugins(context.Context, *connect_go.Request[v1alpha1.ListOrganizationPluginsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationPluginsResponse], error) + // GetPluginVersion returns the plugin version, if found. + GetPluginVersion(context.Context, *connect_go.Request[v1alpha1.GetPluginVersionRequest]) (*connect_go.Response[v1alpha1.GetPluginVersionResponse], error) + // ListPluginVersions lists all the versions available for the specified plugin. + ListPluginVersions(context.Context, *connect_go.Request[v1alpha1.ListPluginVersionsRequest]) (*connect_go.Response[v1alpha1.ListPluginVersionsResponse], error) + // GetPlugin returns the plugin, if found. + GetPlugin(context.Context, *connect_go.Request[v1alpha1.GetPluginRequest]) (*connect_go.Response[v1alpha1.GetPluginResponse], error) + // DeletePlugin deletes the plugin, if it exists. Note that deleting + // a plugin may cause breaking changes for templates using that plugin, + // and should be done with extreme care. + DeletePlugin(context.Context, *connect_go.Request[v1alpha1.DeletePluginRequest]) (*connect_go.Response[v1alpha1.DeletePluginResponse], error) + // GetTemplate returns the template, if found. + GetTemplate(context.Context, *connect_go.Request[v1alpha1.GetTemplateRequest]) (*connect_go.Response[v1alpha1.GetTemplateResponse], error) + // ListTemplates returns all the templates available to the user. This includes + // public templates, those owned by organizations the user is part of, + // and any created directly by the user. + ListTemplates(context.Context, *connect_go.Request[v1alpha1.ListTemplatesRequest]) (*connect_go.Response[v1alpha1.ListTemplatesResponse], error) + // ListTemplatesUserCanAccess is like ListTemplates, but does not return + // public templates. + ListTemplatesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListTemplatesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListTemplatesUserCanAccessResponse], error) + // ListUserPlugins lists all templates belonging to a user. + ListUserTemplates(context.Context, *connect_go.Request[v1alpha1.ListUserTemplatesRequest]) (*connect_go.Response[v1alpha1.ListUserTemplatesResponse], error) + // ListOrganizationTemplates lists all templates for an organization. + ListOrganizationTemplates(context.Context, *connect_go.Request[v1alpha1.ListOrganizationTemplatesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationTemplatesResponse], error) + // GetTemplateVersion returns the template version, if found. + GetTemplateVersion(context.Context, *connect_go.Request[v1alpha1.GetTemplateVersionRequest]) (*connect_go.Response[v1alpha1.GetTemplateVersionResponse], error) + // ListTemplateVersions lists all the template versions available for the specified template. + ListTemplateVersions(context.Context, *connect_go.Request[v1alpha1.ListTemplateVersionsRequest]) (*connect_go.Response[v1alpha1.ListTemplateVersionsResponse], error) + // DeleteTemplate deletes the template, if it exists. + DeleteTemplate(context.Context, *connect_go.Request[v1alpha1.DeleteTemplateRequest]) (*connect_go.Response[v1alpha1.DeleteTemplateResponse], error) +} + +// NewPluginServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewPluginServiceHandler(svc PluginServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + pluginServiceListPluginsHandler := connect_go.NewUnaryHandler( + PluginServiceListPluginsProcedure, + svc.ListPlugins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListUserPluginsHandler := connect_go.NewUnaryHandler( + PluginServiceListUserPluginsProcedure, + svc.ListUserPlugins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListOrganizationPluginsHandler := connect_go.NewUnaryHandler( + PluginServiceListOrganizationPluginsProcedure, + svc.ListOrganizationPlugins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceGetPluginVersionHandler := connect_go.NewUnaryHandler( + PluginServiceGetPluginVersionProcedure, + svc.GetPluginVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListPluginVersionsHandler := connect_go.NewUnaryHandler( + PluginServiceListPluginVersionsProcedure, + svc.ListPluginVersions, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceGetPluginHandler := connect_go.NewUnaryHandler( + PluginServiceGetPluginProcedure, + svc.GetPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceDeletePluginHandler := connect_go.NewUnaryHandler( + PluginServiceDeletePluginProcedure, + svc.DeletePlugin, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceGetTemplateHandler := connect_go.NewUnaryHandler( + PluginServiceGetTemplateProcedure, + svc.GetTemplate, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListTemplatesHandler := connect_go.NewUnaryHandler( + PluginServiceListTemplatesProcedure, + svc.ListTemplates, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListTemplatesUserCanAccessHandler := connect_go.NewUnaryHandler( + PluginServiceListTemplatesUserCanAccessProcedure, + svc.ListTemplatesUserCanAccess, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListUserTemplatesHandler := connect_go.NewUnaryHandler( + PluginServiceListUserTemplatesProcedure, + svc.ListUserTemplates, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListOrganizationTemplatesHandler := connect_go.NewUnaryHandler( + PluginServiceListOrganizationTemplatesProcedure, + svc.ListOrganizationTemplates, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceGetTemplateVersionHandler := connect_go.NewUnaryHandler( + PluginServiceGetTemplateVersionProcedure, + svc.GetTemplateVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceListTemplateVersionsHandler := connect_go.NewUnaryHandler( + PluginServiceListTemplateVersionsProcedure, + svc.ListTemplateVersions, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginServiceDeleteTemplateHandler := connect_go.NewUnaryHandler( + PluginServiceDeleteTemplateProcedure, + svc.DeleteTemplate, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case PluginServiceListPluginsProcedure: + pluginServiceListPluginsHandler.ServeHTTP(w, r) + case PluginServiceListUserPluginsProcedure: + pluginServiceListUserPluginsHandler.ServeHTTP(w, r) + case PluginServiceListOrganizationPluginsProcedure: + pluginServiceListOrganizationPluginsHandler.ServeHTTP(w, r) + case PluginServiceGetPluginVersionProcedure: + pluginServiceGetPluginVersionHandler.ServeHTTP(w, r) + case PluginServiceListPluginVersionsProcedure: + pluginServiceListPluginVersionsHandler.ServeHTTP(w, r) + case PluginServiceGetPluginProcedure: + pluginServiceGetPluginHandler.ServeHTTP(w, r) + case PluginServiceDeletePluginProcedure: + pluginServiceDeletePluginHandler.ServeHTTP(w, r) + case PluginServiceGetTemplateProcedure: + pluginServiceGetTemplateHandler.ServeHTTP(w, r) + case PluginServiceListTemplatesProcedure: + pluginServiceListTemplatesHandler.ServeHTTP(w, r) + case PluginServiceListTemplatesUserCanAccessProcedure: + pluginServiceListTemplatesUserCanAccessHandler.ServeHTTP(w, r) + case PluginServiceListUserTemplatesProcedure: + pluginServiceListUserTemplatesHandler.ServeHTTP(w, r) + case PluginServiceListOrganizationTemplatesProcedure: + pluginServiceListOrganizationTemplatesHandler.ServeHTTP(w, r) + case PluginServiceGetTemplateVersionProcedure: + pluginServiceGetTemplateVersionHandler.ServeHTTP(w, r) + case PluginServiceListTemplateVersionsProcedure: + pluginServiceListTemplateVersionsHandler.ServeHTTP(w, r) + case PluginServiceDeleteTemplateProcedure: + pluginServiceDeleteTemplateHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedPluginServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedPluginServiceHandler struct{} + +func (UnimplementedPluginServiceHandler) ListPlugins(context.Context, *connect_go.Request[v1alpha1.ListPluginsRequest]) (*connect_go.Response[v1alpha1.ListPluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPlugins is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListUserPlugins(context.Context, *connect_go.Request[v1alpha1.ListUserPluginsRequest]) (*connect_go.Response[v1alpha1.ListUserPluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserPlugins is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListOrganizationPlugins(context.Context, *connect_go.Request[v1alpha1.ListOrganizationPluginsRequest]) (*connect_go.Response[v1alpha1.ListOrganizationPluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationPlugins is not implemented")) +} + +func (UnimplementedPluginServiceHandler) GetPluginVersion(context.Context, *connect_go.Request[v1alpha1.GetPluginVersionRequest]) (*connect_go.Response[v1alpha1.GetPluginVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPluginVersion is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListPluginVersions(context.Context, *connect_go.Request[v1alpha1.ListPluginVersionsRequest]) (*connect_go.Response[v1alpha1.ListPluginVersionsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPluginVersions is not implemented")) +} + +func (UnimplementedPluginServiceHandler) GetPlugin(context.Context, *connect_go.Request[v1alpha1.GetPluginRequest]) (*connect_go.Response[v1alpha1.GetPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPlugin is not implemented")) +} + +func (UnimplementedPluginServiceHandler) DeletePlugin(context.Context, *connect_go.Request[v1alpha1.DeletePluginRequest]) (*connect_go.Response[v1alpha1.DeletePluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeletePlugin is not implemented")) +} + +func (UnimplementedPluginServiceHandler) GetTemplate(context.Context, *connect_go.Request[v1alpha1.GetTemplateRequest]) (*connect_go.Response[v1alpha1.GetTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplate is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListTemplates(context.Context, *connect_go.Request[v1alpha1.ListTemplatesRequest]) (*connect_go.Response[v1alpha1.ListTemplatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplates is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListTemplatesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListTemplatesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListTemplatesUserCanAccessResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplatesUserCanAccess is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListUserTemplates(context.Context, *connect_go.Request[v1alpha1.ListUserTemplatesRequest]) (*connect_go.Response[v1alpha1.ListUserTemplatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserTemplates is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListOrganizationTemplates(context.Context, *connect_go.Request[v1alpha1.ListOrganizationTemplatesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationTemplatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationTemplates is not implemented")) +} + +func (UnimplementedPluginServiceHandler) GetTemplateVersion(context.Context, *connect_go.Request[v1alpha1.GetTemplateVersionRequest]) (*connect_go.Response[v1alpha1.GetTemplateVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplateVersion is not implemented")) +} + +func (UnimplementedPluginServiceHandler) ListTemplateVersions(context.Context, *connect_go.Request[v1alpha1.ListTemplateVersionsRequest]) (*connect_go.Response[v1alpha1.ListTemplateVersionsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplateVersions is not implemented")) +} + +func (UnimplementedPluginServiceHandler) DeleteTemplate(context.Context, *connect_go.Request[v1alpha1.DeleteTemplateRequest]) (*connect_go.Response[v1alpha1.DeleteTemplateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeleteTemplate is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/plugin_curation.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/plugin_curation.connect.go new file mode 100644 index 000000000..8fd6ec527 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/plugin_curation.connect.go @@ -0,0 +1,301 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/plugin_curation.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // PluginCurationServiceName is the fully-qualified name of the PluginCurationService service. + PluginCurationServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService" + // CodeGenerationServiceName is the fully-qualified name of the CodeGenerationService service. + CodeGenerationServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // PluginCurationServiceListCuratedPluginsProcedure is the fully-qualified name of the + // PluginCurationService's ListCuratedPlugins RPC. + PluginCurationServiceListCuratedPluginsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/ListCuratedPlugins" + // PluginCurationServiceCreateCuratedPluginProcedure is the fully-qualified name of the + // PluginCurationService's CreateCuratedPlugin RPC. + PluginCurationServiceCreateCuratedPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/CreateCuratedPlugin" + // PluginCurationServiceGetLatestCuratedPluginProcedure is the fully-qualified name of the + // PluginCurationService's GetLatestCuratedPlugin RPC. + PluginCurationServiceGetLatestCuratedPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/GetLatestCuratedPlugin" + // PluginCurationServiceDeleteCuratedPluginProcedure is the fully-qualified name of the + // PluginCurationService's DeleteCuratedPlugin RPC. + PluginCurationServiceDeleteCuratedPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/DeleteCuratedPlugin" + // CodeGenerationServiceGenerateCodeProcedure is the fully-qualified name of the + // CodeGenerationService's GenerateCode RPC. + CodeGenerationServiceGenerateCodeProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService/GenerateCode" +) + +// PluginCurationServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService service. +type PluginCurationServiceClient interface { + // ListCuratedPlugins returns all the curated plugins available. + ListCuratedPlugins(context.Context, *connect_go.Request[v1alpha1.ListCuratedPluginsRequest]) (*connect_go.Response[v1alpha1.ListCuratedPluginsResponse], error) + // CreateCuratedPlugin creates a new curated plugin. + CreateCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.CreateCuratedPluginRequest]) (*connect_go.Response[v1alpha1.CreateCuratedPluginResponse], error) + // GetLatestCuratedPlugin returns the latest version of a plugin matching given parameters. + GetLatestCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.GetLatestCuratedPluginRequest]) (*connect_go.Response[v1alpha1.GetLatestCuratedPluginResponse], error) + // DeleteCuratedPlugin deletes a curated plugin based on the given parameters. + DeleteCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.DeleteCuratedPluginRequest]) (*connect_go.Response[v1alpha1.DeleteCuratedPluginResponse], error) +} + +// NewPluginCurationServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewPluginCurationServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) PluginCurationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &pluginCurationServiceClient{ + listCuratedPlugins: connect_go.NewClient[v1alpha1.ListCuratedPluginsRequest, v1alpha1.ListCuratedPluginsResponse]( + httpClient, + baseURL+PluginCurationServiceListCuratedPluginsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + createCuratedPlugin: connect_go.NewClient[v1alpha1.CreateCuratedPluginRequest, v1alpha1.CreateCuratedPluginResponse]( + httpClient, + baseURL+PluginCurationServiceCreateCuratedPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getLatestCuratedPlugin: connect_go.NewClient[v1alpha1.GetLatestCuratedPluginRequest, v1alpha1.GetLatestCuratedPluginResponse]( + httpClient, + baseURL+PluginCurationServiceGetLatestCuratedPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteCuratedPlugin: connect_go.NewClient[v1alpha1.DeleteCuratedPluginRequest, v1alpha1.DeleteCuratedPluginResponse]( + httpClient, + baseURL+PluginCurationServiceDeleteCuratedPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// pluginCurationServiceClient implements PluginCurationServiceClient. +type pluginCurationServiceClient struct { + listCuratedPlugins *connect_go.Client[v1alpha1.ListCuratedPluginsRequest, v1alpha1.ListCuratedPluginsResponse] + createCuratedPlugin *connect_go.Client[v1alpha1.CreateCuratedPluginRequest, v1alpha1.CreateCuratedPluginResponse] + getLatestCuratedPlugin *connect_go.Client[v1alpha1.GetLatestCuratedPluginRequest, v1alpha1.GetLatestCuratedPluginResponse] + deleteCuratedPlugin *connect_go.Client[v1alpha1.DeleteCuratedPluginRequest, v1alpha1.DeleteCuratedPluginResponse] +} + +// ListCuratedPlugins calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.ListCuratedPlugins. +func (c *pluginCurationServiceClient) ListCuratedPlugins(ctx context.Context, req *connect_go.Request[v1alpha1.ListCuratedPluginsRequest]) (*connect_go.Response[v1alpha1.ListCuratedPluginsResponse], error) { + return c.listCuratedPlugins.CallUnary(ctx, req) +} + +// CreateCuratedPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.CreateCuratedPlugin. +func (c *pluginCurationServiceClient) CreateCuratedPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.CreateCuratedPluginRequest]) (*connect_go.Response[v1alpha1.CreateCuratedPluginResponse], error) { + return c.createCuratedPlugin.CallUnary(ctx, req) +} + +// GetLatestCuratedPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.GetLatestCuratedPlugin. +func (c *pluginCurationServiceClient) GetLatestCuratedPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.GetLatestCuratedPluginRequest]) (*connect_go.Response[v1alpha1.GetLatestCuratedPluginResponse], error) { + return c.getLatestCuratedPlugin.CallUnary(ctx, req) +} + +// DeleteCuratedPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.DeleteCuratedPlugin. +func (c *pluginCurationServiceClient) DeleteCuratedPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteCuratedPluginRequest]) (*connect_go.Response[v1alpha1.DeleteCuratedPluginResponse], error) { + return c.deleteCuratedPlugin.CallUnary(ctx, req) +} + +// PluginCurationServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService service. +type PluginCurationServiceHandler interface { + // ListCuratedPlugins returns all the curated plugins available. + ListCuratedPlugins(context.Context, *connect_go.Request[v1alpha1.ListCuratedPluginsRequest]) (*connect_go.Response[v1alpha1.ListCuratedPluginsResponse], error) + // CreateCuratedPlugin creates a new curated plugin. + CreateCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.CreateCuratedPluginRequest]) (*connect_go.Response[v1alpha1.CreateCuratedPluginResponse], error) + // GetLatestCuratedPlugin returns the latest version of a plugin matching given parameters. + GetLatestCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.GetLatestCuratedPluginRequest]) (*connect_go.Response[v1alpha1.GetLatestCuratedPluginResponse], error) + // DeleteCuratedPlugin deletes a curated plugin based on the given parameters. + DeleteCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.DeleteCuratedPluginRequest]) (*connect_go.Response[v1alpha1.DeleteCuratedPluginResponse], error) +} + +// NewPluginCurationServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewPluginCurationServiceHandler(svc PluginCurationServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + pluginCurationServiceListCuratedPluginsHandler := connect_go.NewUnaryHandler( + PluginCurationServiceListCuratedPluginsProcedure, + svc.ListCuratedPlugins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginCurationServiceCreateCuratedPluginHandler := connect_go.NewUnaryHandler( + PluginCurationServiceCreateCuratedPluginProcedure, + svc.CreateCuratedPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + pluginCurationServiceGetLatestCuratedPluginHandler := connect_go.NewUnaryHandler( + PluginCurationServiceGetLatestCuratedPluginProcedure, + svc.GetLatestCuratedPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + pluginCurationServiceDeleteCuratedPluginHandler := connect_go.NewUnaryHandler( + PluginCurationServiceDeleteCuratedPluginProcedure, + svc.DeleteCuratedPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case PluginCurationServiceListCuratedPluginsProcedure: + pluginCurationServiceListCuratedPluginsHandler.ServeHTTP(w, r) + case PluginCurationServiceCreateCuratedPluginProcedure: + pluginCurationServiceCreateCuratedPluginHandler.ServeHTTP(w, r) + case PluginCurationServiceGetLatestCuratedPluginProcedure: + pluginCurationServiceGetLatestCuratedPluginHandler.ServeHTTP(w, r) + case PluginCurationServiceDeleteCuratedPluginProcedure: + pluginCurationServiceDeleteCuratedPluginHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedPluginCurationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedPluginCurationServiceHandler struct{} + +func (UnimplementedPluginCurationServiceHandler) ListCuratedPlugins(context.Context, *connect_go.Request[v1alpha1.ListCuratedPluginsRequest]) (*connect_go.Response[v1alpha1.ListCuratedPluginsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.ListCuratedPlugins is not implemented")) +} + +func (UnimplementedPluginCurationServiceHandler) CreateCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.CreateCuratedPluginRequest]) (*connect_go.Response[v1alpha1.CreateCuratedPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.CreateCuratedPlugin is not implemented")) +} + +func (UnimplementedPluginCurationServiceHandler) GetLatestCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.GetLatestCuratedPluginRequest]) (*connect_go.Response[v1alpha1.GetLatestCuratedPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.GetLatestCuratedPlugin is not implemented")) +} + +func (UnimplementedPluginCurationServiceHandler) DeleteCuratedPlugin(context.Context, *connect_go.Request[v1alpha1.DeleteCuratedPluginRequest]) (*connect_go.Response[v1alpha1.DeleteCuratedPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.DeleteCuratedPlugin is not implemented")) +} + +// CodeGenerationServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService service. +type CodeGenerationServiceClient interface { + // GenerateCode generates code using the specified remote plugins. + GenerateCode(context.Context, *connect_go.Request[v1alpha1.GenerateCodeRequest]) (*connect_go.Response[v1alpha1.GenerateCodeResponse], error) +} + +// NewCodeGenerationServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewCodeGenerationServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) CodeGenerationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &codeGenerationServiceClient{ + generateCode: connect_go.NewClient[v1alpha1.GenerateCodeRequest, v1alpha1.GenerateCodeResponse]( + httpClient, + baseURL+CodeGenerationServiceGenerateCodeProcedure, + opts..., + ), + } +} + +// codeGenerationServiceClient implements CodeGenerationServiceClient. +type codeGenerationServiceClient struct { + generateCode *connect_go.Client[v1alpha1.GenerateCodeRequest, v1alpha1.GenerateCodeResponse] +} + +// GenerateCode calls +// bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService.GenerateCode. +func (c *codeGenerationServiceClient) GenerateCode(ctx context.Context, req *connect_go.Request[v1alpha1.GenerateCodeRequest]) (*connect_go.Response[v1alpha1.GenerateCodeResponse], error) { + return c.generateCode.CallUnary(ctx, req) +} + +// CodeGenerationServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService service. +type CodeGenerationServiceHandler interface { + // GenerateCode generates code using the specified remote plugins. + GenerateCode(context.Context, *connect_go.Request[v1alpha1.GenerateCodeRequest]) (*connect_go.Response[v1alpha1.GenerateCodeResponse], error) +} + +// NewCodeGenerationServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewCodeGenerationServiceHandler(svc CodeGenerationServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + codeGenerationServiceGenerateCodeHandler := connect_go.NewUnaryHandler( + CodeGenerationServiceGenerateCodeProcedure, + svc.GenerateCode, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case CodeGenerationServiceGenerateCodeProcedure: + codeGenerationServiceGenerateCodeHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedCodeGenerationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedCodeGenerationServiceHandler struct{} + +func (UnimplementedCodeGenerationServiceHandler) GenerateCode(context.Context, *connect_go.Request[v1alpha1.GenerateCodeRequest]) (*connect_go.Response[v1alpha1.GenerateCodeResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService.GenerateCode is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/push.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/push.connect.go new file mode 100644 index 000000000..865bc5814 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/push.connect.go @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/push.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // PushServiceName is the fully-qualified name of the PushService service. + PushServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.PushService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // PushServicePushProcedure is the fully-qualified name of the PushService's Push RPC. + PushServicePushProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PushService/Push" + // PushServicePushManifestAndBlobsProcedure is the fully-qualified name of the PushService's + // PushManifestAndBlobs RPC. + PushServicePushManifestAndBlobsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.PushService/PushManifestAndBlobs" +) + +// PushServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PushService service. +type PushServiceClient interface { + // Push pushes. + // NOTE: Newer clients should use PushManifestAndBlobs. + Push(context.Context, *connect_go.Request[v1alpha1.PushRequest]) (*connect_go.Response[v1alpha1.PushResponse], error) + // PushManifestAndBlobs pushes a module by encoding it in a manifest and blobs format. + PushManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.PushManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.PushManifestAndBlobsResponse], error) +} + +// NewPushServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.PushService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewPushServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) PushServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &pushServiceClient{ + push: connect_go.NewClient[v1alpha1.PushRequest, v1alpha1.PushResponse]( + httpClient, + baseURL+PushServicePushProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + pushManifestAndBlobs: connect_go.NewClient[v1alpha1.PushManifestAndBlobsRequest, v1alpha1.PushManifestAndBlobsResponse]( + httpClient, + baseURL+PushServicePushManifestAndBlobsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// pushServiceClient implements PushServiceClient. +type pushServiceClient struct { + push *connect_go.Client[v1alpha1.PushRequest, v1alpha1.PushResponse] + pushManifestAndBlobs *connect_go.Client[v1alpha1.PushManifestAndBlobsRequest, v1alpha1.PushManifestAndBlobsResponse] +} + +// Push calls bufman.dubbo.apache.org.registry.v1alpha1.PushService.Push. +func (c *pushServiceClient) Push(ctx context.Context, req *connect_go.Request[v1alpha1.PushRequest]) (*connect_go.Response[v1alpha1.PushResponse], error) { + return c.push.CallUnary(ctx, req) +} + +// PushManifestAndBlobs calls +// bufman.dubbo.apache.org.registry.v1alpha1.PushService.PushManifestAndBlobs. +func (c *pushServiceClient) PushManifestAndBlobs(ctx context.Context, req *connect_go.Request[v1alpha1.PushManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.PushManifestAndBlobsResponse], error) { + return c.pushManifestAndBlobs.CallUnary(ctx, req) +} + +// PushServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.PushService service. +type PushServiceHandler interface { + // Push pushes. + // NOTE: Newer clients should use PushManifestAndBlobs. + Push(context.Context, *connect_go.Request[v1alpha1.PushRequest]) (*connect_go.Response[v1alpha1.PushResponse], error) + // PushManifestAndBlobs pushes a module by encoding it in a manifest and blobs format. + PushManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.PushManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.PushManifestAndBlobsResponse], error) +} + +// NewPushServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewPushServiceHandler(svc PushServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + pushServicePushHandler := connect_go.NewUnaryHandler( + PushServicePushProcedure, + svc.Push, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + pushServicePushManifestAndBlobsHandler := connect_go.NewUnaryHandler( + PushServicePushManifestAndBlobsProcedure, + svc.PushManifestAndBlobs, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.PushService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case PushServicePushProcedure: + pushServicePushHandler.ServeHTTP(w, r) + case PushServicePushManifestAndBlobsProcedure: + pushServicePushManifestAndBlobsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedPushServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedPushServiceHandler struct{} + +func (UnimplementedPushServiceHandler) Push(context.Context, *connect_go.Request[v1alpha1.PushRequest]) (*connect_go.Response[v1alpha1.PushResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PushService.Push is not implemented")) +} + +func (UnimplementedPushServiceHandler) PushManifestAndBlobs(context.Context, *connect_go.Request[v1alpha1.PushManifestAndBlobsRequest]) (*connect_go.Response[v1alpha1.PushManifestAndBlobsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.PushService.PushManifestAndBlobs is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/recommendation.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/recommendation.connect.go new file mode 100644 index 000000000..861323c2c --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/recommendation.connect.go @@ -0,0 +1,230 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/recommendation.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RecommendationServiceName is the fully-qualified name of the RecommendationService service. + RecommendationServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RecommendationServiceRecommendedRepositoriesProcedure is the fully-qualified name of the + // RecommendationService's RecommendedRepositories RPC. + RecommendationServiceRecommendedRepositoriesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/RecommendedRepositories" + // RecommendationServiceRecommendedTemplatesProcedure is the fully-qualified name of the + // RecommendationService's RecommendedTemplates RPC. + RecommendationServiceRecommendedTemplatesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/RecommendedTemplates" + // RecommendationServiceListRecommendedResourcesProcedure is the fully-qualified name of the + // RecommendationService's ListRecommendedResources RPC. + RecommendationServiceListRecommendedResourcesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/ListRecommendedResources" + // RecommendationServiceSetRecommendedResourcesProcedure is the fully-qualified name of the + // RecommendationService's SetRecommendedResources RPC. + RecommendationServiceSetRecommendedResourcesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/SetRecommendedResources" +) + +// RecommendationServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService service. +type RecommendationServiceClient interface { + // RecommendedRepositories returns a list of recommended repositories. + RecommendedRepositories(context.Context, *connect_go.Request[v1alpha1.RecommendedRepositoriesRequest]) (*connect_go.Response[v1alpha1.RecommendedRepositoriesResponse], error) + // RecommendedTemplates returns a list of recommended templates. + // + // Deprecated: do not use. + RecommendedTemplates(context.Context, *connect_go.Request[v1alpha1.RecommendedTemplatesRequest]) (*connect_go.Response[v1alpha1.RecommendedTemplatesResponse], error) + // ListRecommendedResources returns a list of recommended resources. + ListRecommendedResources(context.Context, *connect_go.Request[v1alpha1.ListRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.ListRecommendedResourcesResponse], error) + // SetRecommendedResources set the list of recommended resources in the server. + SetRecommendedResources(context.Context, *connect_go.Request[v1alpha1.SetRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.SetRecommendedResourcesResponse], error) +} + +// NewRecommendationServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRecommendationServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RecommendationServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &recommendationServiceClient{ + recommendedRepositories: connect_go.NewClient[v1alpha1.RecommendedRepositoriesRequest, v1alpha1.RecommendedRepositoriesResponse]( + httpClient, + baseURL+RecommendationServiceRecommendedRepositoriesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + recommendedTemplates: connect_go.NewClient[v1alpha1.RecommendedTemplatesRequest, v1alpha1.RecommendedTemplatesResponse]( + httpClient, + baseURL+RecommendationServiceRecommendedTemplatesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRecommendedResources: connect_go.NewClient[v1alpha1.ListRecommendedResourcesRequest, v1alpha1.ListRecommendedResourcesResponse]( + httpClient, + baseURL+RecommendationServiceListRecommendedResourcesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + setRecommendedResources: connect_go.NewClient[v1alpha1.SetRecommendedResourcesRequest, v1alpha1.SetRecommendedResourcesResponse]( + httpClient, + baseURL+RecommendationServiceSetRecommendedResourcesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// recommendationServiceClient implements RecommendationServiceClient. +type recommendationServiceClient struct { + recommendedRepositories *connect_go.Client[v1alpha1.RecommendedRepositoriesRequest, v1alpha1.RecommendedRepositoriesResponse] + recommendedTemplates *connect_go.Client[v1alpha1.RecommendedTemplatesRequest, v1alpha1.RecommendedTemplatesResponse] + listRecommendedResources *connect_go.Client[v1alpha1.ListRecommendedResourcesRequest, v1alpha1.ListRecommendedResourcesResponse] + setRecommendedResources *connect_go.Client[v1alpha1.SetRecommendedResourcesRequest, v1alpha1.SetRecommendedResourcesResponse] +} + +// RecommendedRepositories calls +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedRepositories. +func (c *recommendationServiceClient) RecommendedRepositories(ctx context.Context, req *connect_go.Request[v1alpha1.RecommendedRepositoriesRequest]) (*connect_go.Response[v1alpha1.RecommendedRepositoriesResponse], error) { + return c.recommendedRepositories.CallUnary(ctx, req) +} + +// RecommendedTemplates calls +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedTemplates. +// +// Deprecated: do not use. +func (c *recommendationServiceClient) RecommendedTemplates(ctx context.Context, req *connect_go.Request[v1alpha1.RecommendedTemplatesRequest]) (*connect_go.Response[v1alpha1.RecommendedTemplatesResponse], error) { + return c.recommendedTemplates.CallUnary(ctx, req) +} + +// ListRecommendedResources calls +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.ListRecommendedResources. +func (c *recommendationServiceClient) ListRecommendedResources(ctx context.Context, req *connect_go.Request[v1alpha1.ListRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.ListRecommendedResourcesResponse], error) { + return c.listRecommendedResources.CallUnary(ctx, req) +} + +// SetRecommendedResources calls +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.SetRecommendedResources. +func (c *recommendationServiceClient) SetRecommendedResources(ctx context.Context, req *connect_go.Request[v1alpha1.SetRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.SetRecommendedResourcesResponse], error) { + return c.setRecommendedResources.CallUnary(ctx, req) +} + +// RecommendationServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService service. +type RecommendationServiceHandler interface { + // RecommendedRepositories returns a list of recommended repositories. + RecommendedRepositories(context.Context, *connect_go.Request[v1alpha1.RecommendedRepositoriesRequest]) (*connect_go.Response[v1alpha1.RecommendedRepositoriesResponse], error) + // RecommendedTemplates returns a list of recommended templates. + // + // Deprecated: do not use. + RecommendedTemplates(context.Context, *connect_go.Request[v1alpha1.RecommendedTemplatesRequest]) (*connect_go.Response[v1alpha1.RecommendedTemplatesResponse], error) + // ListRecommendedResources returns a list of recommended resources. + ListRecommendedResources(context.Context, *connect_go.Request[v1alpha1.ListRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.ListRecommendedResourcesResponse], error) + // SetRecommendedResources set the list of recommended resources in the server. + SetRecommendedResources(context.Context, *connect_go.Request[v1alpha1.SetRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.SetRecommendedResourcesResponse], error) +} + +// NewRecommendationServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRecommendationServiceHandler(svc RecommendationServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + recommendationServiceRecommendedRepositoriesHandler := connect_go.NewUnaryHandler( + RecommendationServiceRecommendedRepositoriesProcedure, + svc.RecommendedRepositories, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + recommendationServiceRecommendedTemplatesHandler := connect_go.NewUnaryHandler( + RecommendationServiceRecommendedTemplatesProcedure, + svc.RecommendedTemplates, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + recommendationServiceListRecommendedResourcesHandler := connect_go.NewUnaryHandler( + RecommendationServiceListRecommendedResourcesProcedure, + svc.ListRecommendedResources, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + recommendationServiceSetRecommendedResourcesHandler := connect_go.NewUnaryHandler( + RecommendationServiceSetRecommendedResourcesProcedure, + svc.SetRecommendedResources, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RecommendationServiceRecommendedRepositoriesProcedure: + recommendationServiceRecommendedRepositoriesHandler.ServeHTTP(w, r) + case RecommendationServiceRecommendedTemplatesProcedure: + recommendationServiceRecommendedTemplatesHandler.ServeHTTP(w, r) + case RecommendationServiceListRecommendedResourcesProcedure: + recommendationServiceListRecommendedResourcesHandler.ServeHTTP(w, r) + case RecommendationServiceSetRecommendedResourcesProcedure: + recommendationServiceSetRecommendedResourcesHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRecommendationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRecommendationServiceHandler struct{} + +func (UnimplementedRecommendationServiceHandler) RecommendedRepositories(context.Context, *connect_go.Request[v1alpha1.RecommendedRepositoriesRequest]) (*connect_go.Response[v1alpha1.RecommendedRepositoriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedRepositories is not implemented")) +} + +func (UnimplementedRecommendationServiceHandler) RecommendedTemplates(context.Context, *connect_go.Request[v1alpha1.RecommendedTemplatesRequest]) (*connect_go.Response[v1alpha1.RecommendedTemplatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedTemplates is not implemented")) +} + +func (UnimplementedRecommendationServiceHandler) ListRecommendedResources(context.Context, *connect_go.Request[v1alpha1.ListRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.ListRecommendedResourcesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.ListRecommendedResources is not implemented")) +} + +func (UnimplementedRecommendationServiceHandler) SetRecommendedResources(context.Context, *connect_go.Request[v1alpha1.SetRecommendedResourcesRequest]) (*connect_go.Response[v1alpha1.SetRecommendedResourcesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.SetRecommendedResources is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/reference.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/reference.connect.go new file mode 100644 index 000000000..4209f4fe8 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/reference.connect.go @@ -0,0 +1,164 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/reference.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // ReferenceServiceName is the fully-qualified name of the ReferenceService service. + ReferenceServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ReferenceServiceGetReferenceByNameProcedure is the fully-qualified name of the ReferenceService's + // GetReferenceByName RPC. + ReferenceServiceGetReferenceByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService/GetReferenceByName" + // ReferenceServiceListGitCommitMetadataForReferenceProcedure is the fully-qualified name of the + // ReferenceService's ListGitCommitMetadataForReference RPC. + ReferenceServiceListGitCommitMetadataForReferenceProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService/ListGitCommitMetadataForReference" +) + +// ReferenceServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService service. +type ReferenceServiceClient interface { + // GetReferenceByName takes a reference name and returns the + // reference either as 'main', a tag, or commit. + GetReferenceByName(context.Context, *connect_go.Request[v1alpha1.GetReferenceByNameRequest]) (*connect_go.Response[v1alpha1.GetReferenceByNameResponse], error) + // ListGitCommitMetadataForReference takes a string reference and returns all the git commit + // metadata associated with the resolved reference commit. + ListGitCommitMetadataForReference(context.Context, *connect_go.Request[v1alpha1.ListGitCommitMetadataForReferenceRequest]) (*connect_go.Response[v1alpha1.ListGitCommitMetadataForReferenceResponse], error) +} + +// NewReferenceServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewReferenceServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ReferenceServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &referenceServiceClient{ + getReferenceByName: connect_go.NewClient[v1alpha1.GetReferenceByNameRequest, v1alpha1.GetReferenceByNameResponse]( + httpClient, + baseURL+ReferenceServiceGetReferenceByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listGitCommitMetadataForReference: connect_go.NewClient[v1alpha1.ListGitCommitMetadataForReferenceRequest, v1alpha1.ListGitCommitMetadataForReferenceResponse]( + httpClient, + baseURL+ReferenceServiceListGitCommitMetadataForReferenceProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// referenceServiceClient implements ReferenceServiceClient. +type referenceServiceClient struct { + getReferenceByName *connect_go.Client[v1alpha1.GetReferenceByNameRequest, v1alpha1.GetReferenceByNameResponse] + listGitCommitMetadataForReference *connect_go.Client[v1alpha1.ListGitCommitMetadataForReferenceRequest, v1alpha1.ListGitCommitMetadataForReferenceResponse] +} + +// GetReferenceByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.GetReferenceByName. +func (c *referenceServiceClient) GetReferenceByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetReferenceByNameRequest]) (*connect_go.Response[v1alpha1.GetReferenceByNameResponse], error) { + return c.getReferenceByName.CallUnary(ctx, req) +} + +// ListGitCommitMetadataForReference calls +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.ListGitCommitMetadataForReference. +func (c *referenceServiceClient) ListGitCommitMetadataForReference(ctx context.Context, req *connect_go.Request[v1alpha1.ListGitCommitMetadataForReferenceRequest]) (*connect_go.Response[v1alpha1.ListGitCommitMetadataForReferenceResponse], error) { + return c.listGitCommitMetadataForReference.CallUnary(ctx, req) +} + +// ReferenceServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService service. +type ReferenceServiceHandler interface { + // GetReferenceByName takes a reference name and returns the + // reference either as 'main', a tag, or commit. + GetReferenceByName(context.Context, *connect_go.Request[v1alpha1.GetReferenceByNameRequest]) (*connect_go.Response[v1alpha1.GetReferenceByNameResponse], error) + // ListGitCommitMetadataForReference takes a string reference and returns all the git commit + // metadata associated with the resolved reference commit. + ListGitCommitMetadataForReference(context.Context, *connect_go.Request[v1alpha1.ListGitCommitMetadataForReferenceRequest]) (*connect_go.Response[v1alpha1.ListGitCommitMetadataForReferenceResponse], error) +} + +// NewReferenceServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewReferenceServiceHandler(svc ReferenceServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + referenceServiceGetReferenceByNameHandler := connect_go.NewUnaryHandler( + ReferenceServiceGetReferenceByNameProcedure, + svc.GetReferenceByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + referenceServiceListGitCommitMetadataForReferenceHandler := connect_go.NewUnaryHandler( + ReferenceServiceListGitCommitMetadataForReferenceProcedure, + svc.ListGitCommitMetadataForReference, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ReferenceServiceGetReferenceByNameProcedure: + referenceServiceGetReferenceByNameHandler.ServeHTTP(w, r) + case ReferenceServiceListGitCommitMetadataForReferenceProcedure: + referenceServiceListGitCommitMetadataForReferenceHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedReferenceServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedReferenceServiceHandler struct{} + +func (UnimplementedReferenceServiceHandler) GetReferenceByName(context.Context, *connect_go.Request[v1alpha1.GetReferenceByNameRequest]) (*connect_go.Response[v1alpha1.GetReferenceByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.GetReferenceByName is not implemented")) +} + +func (UnimplementedReferenceServiceHandler) ListGitCommitMetadataForReference(context.Context, *connect_go.Request[v1alpha1.ListGitCommitMetadataForReferenceRequest]) (*connect_go.Response[v1alpha1.ListGitCommitMetadataForReferenceResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.ListGitCommitMetadataForReference is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository.connect.go new file mode 100644 index 000000000..ba2b7ac04 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository.connect.go @@ -0,0 +1,674 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/repository.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RepositoryServiceName is the fully-qualified name of the RepositoryService service. + RepositoryServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RepositoryServiceGetRepositoryProcedure is the fully-qualified name of the RepositoryService's + // GetRepository RPC. + RepositoryServiceGetRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepository" + // RepositoryServiceGetRepositoryByFullNameProcedure is the fully-qualified name of the + // RepositoryService's GetRepositoryByFullName RPC. + RepositoryServiceGetRepositoryByFullNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoryByFullName" + // RepositoryServiceListRepositoriesProcedure is the fully-qualified name of the RepositoryService's + // ListRepositories RPC. + RepositoryServiceListRepositoriesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositories" + // RepositoryServiceListUserRepositoriesProcedure is the fully-qualified name of the + // RepositoryService's ListUserRepositories RPC. + RepositoryServiceListUserRepositoriesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListUserRepositories" + // RepositoryServiceListRepositoriesUserCanAccessProcedure is the fully-qualified name of the + // RepositoryService's ListRepositoriesUserCanAccess RPC. + RepositoryServiceListRepositoriesUserCanAccessProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositoriesUserCanAccess" + // RepositoryServiceListOrganizationRepositoriesProcedure is the fully-qualified name of the + // RepositoryService's ListOrganizationRepositories RPC. + RepositoryServiceListOrganizationRepositoriesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListOrganizationRepositories" + // RepositoryServiceCreateRepositoryByFullNameProcedure is the fully-qualified name of the + // RepositoryService's CreateRepositoryByFullName RPC. + RepositoryServiceCreateRepositoryByFullNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/CreateRepositoryByFullName" + // RepositoryServiceDeleteRepositoryProcedure is the fully-qualified name of the RepositoryService's + // DeleteRepository RPC. + RepositoryServiceDeleteRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeleteRepository" + // RepositoryServiceDeleteRepositoryByFullNameProcedure is the fully-qualified name of the + // RepositoryService's DeleteRepositoryByFullName RPC. + RepositoryServiceDeleteRepositoryByFullNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeleteRepositoryByFullName" + // RepositoryServiceDeprecateRepositoryByNameProcedure is the fully-qualified name of the + // RepositoryService's DeprecateRepositoryByName RPC. + RepositoryServiceDeprecateRepositoryByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeprecateRepositoryByName" + // RepositoryServiceUndeprecateRepositoryByNameProcedure is the fully-qualified name of the + // RepositoryService's UndeprecateRepositoryByName RPC. + RepositoryServiceUndeprecateRepositoryByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/UndeprecateRepositoryByName" + // RepositoryServiceGetRepositoriesByFullNameProcedure is the fully-qualified name of the + // RepositoryService's GetRepositoriesByFullName RPC. + RepositoryServiceGetRepositoriesByFullNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoriesByFullName" + // RepositoryServiceSetRepositoryContributorProcedure is the fully-qualified name of the + // RepositoryService's SetRepositoryContributor RPC. + RepositoryServiceSetRepositoryContributorProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/SetRepositoryContributor" + // RepositoryServiceListRepositoryContributorsProcedure is the fully-qualified name of the + // RepositoryService's ListRepositoryContributors RPC. + RepositoryServiceListRepositoryContributorsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositoryContributors" + // RepositoryServiceGetRepositoryContributorProcedure is the fully-qualified name of the + // RepositoryService's GetRepositoryContributor RPC. + RepositoryServiceGetRepositoryContributorProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoryContributor" + // RepositoryServiceGetRepositorySettingsProcedure is the fully-qualified name of the + // RepositoryService's GetRepositorySettings RPC. + RepositoryServiceGetRepositorySettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositorySettings" + // RepositoryServiceUpdateRepositorySettingsByNameProcedure is the fully-qualified name of the + // RepositoryService's UpdateRepositorySettingsByName RPC. + RepositoryServiceUpdateRepositorySettingsByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/UpdateRepositorySettingsByName" + // RepositoryServiceGetRepositoriesMetadataProcedure is the fully-qualified name of the + // RepositoryService's GetRepositoriesMetadata RPC. + RepositoryServiceGetRepositoriesMetadataProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoriesMetadata" +) + +// RepositoryServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService service. +type RepositoryServiceClient interface { + // GetRepository gets a repository by ID. + GetRepository(context.Context, *connect_go.Request[v1alpha1.GetRepositoryRequest]) (*connect_go.Response[v1alpha1.GetRepositoryResponse], error) + // GetRepositoryByFullName gets a repository by full name. + GetRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoryByFullNameResponse], error) + // ListRepositories lists all repositories. + ListRepositories(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesResponse], error) + // ListUserRepositories lists all repositories belonging to a user. + ListUserRepositories(context.Context, *connect_go.Request[v1alpha1.ListUserRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListUserRepositoriesResponse], error) + // ListRepositoriesUserCanAccess lists all repositories a user can access. + ListRepositoriesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesUserCanAccessResponse], error) + // ListOrganizationRepositories lists all repositories for an organization. + ListOrganizationRepositories(context.Context, *connect_go.Request[v1alpha1.ListOrganizationRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationRepositoriesResponse], error) + // CreateRepositoryByFullName creates a new repository by full name. + CreateRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryByFullNameResponse], error) + // DeleteRepository deletes a repository. + DeleteRepository(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryResponse], error) + // DeleteRepositoryByFullName deletes a repository by full name. + DeleteRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryByFullNameResponse], error) + // DeprecateRepositoryByName deprecates the repository. + DeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.DeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.DeprecateRepositoryByNameResponse], error) + // UndeprecateRepositoryByName makes the repository not deprecated and removes any deprecation_message. + UndeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.UndeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.UndeprecateRepositoryByNameResponse], error) + // GetRepositoriesByFullName gets repositories by full name. Response order is unspecified. + // Errors if any of the repositories don't exist or the caller does not have access to any of the repositories. + GetRepositoriesByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesByFullNameResponse], error) + // SetRepositoryContributor sets the role of a user in the repository. + SetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.SetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.SetRepositoryContributorResponse], error) + // ListRepositoryContributors returns the list of contributors that has an explicit role against the repository. + // This does not include users who have implicit roles against the repository, unless they have also been + // assigned a role explicitly. + ListRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.ListRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryContributorsResponse], error) + // GetRepositoryContributor returns the contributor information of a user in a repository. + GetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.GetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.GetRepositoryContributorResponse], error) + // GetRepositorySettings gets the settings of a repository. + GetRepositorySettings(context.Context, *connect_go.Request[v1alpha1.GetRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.GetRepositorySettingsResponse], error) + // UpdateRepositorySettingsByName updates the settings of a repository. + UpdateRepositorySettingsByName(context.Context, *connect_go.Request[v1alpha1.UpdateRepositorySettingsByNameRequest]) (*connect_go.Response[v1alpha1.UpdateRepositorySettingsByNameResponse], error) + // GetRepositoriesMetadata gets the metadata of the repositories in the request, the length of repositories in the + // request should match the length of the metadata in the response, and the order of repositories in the response + // should match the order of the metadata in the request. + GetRepositoriesMetadata(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesMetadataRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesMetadataResponse], error) +} + +// NewRepositoryServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRepositoryServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RepositoryServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &repositoryServiceClient{ + getRepository: connect_go.NewClient[v1alpha1.GetRepositoryRequest, v1alpha1.GetRepositoryResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositoryByFullName: connect_go.NewClient[v1alpha1.GetRepositoryByFullNameRequest, v1alpha1.GetRepositoryByFullNameResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoryByFullNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositories: connect_go.NewClient[v1alpha1.ListRepositoriesRequest, v1alpha1.ListRepositoriesResponse]( + httpClient, + baseURL+RepositoryServiceListRepositoriesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUserRepositories: connect_go.NewClient[v1alpha1.ListUserRepositoriesRequest, v1alpha1.ListUserRepositoriesResponse]( + httpClient, + baseURL+RepositoryServiceListUserRepositoriesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositoriesUserCanAccess: connect_go.NewClient[v1alpha1.ListRepositoriesUserCanAccessRequest, v1alpha1.ListRepositoriesUserCanAccessResponse]( + httpClient, + baseURL+RepositoryServiceListRepositoriesUserCanAccessProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizationRepositories: connect_go.NewClient[v1alpha1.ListOrganizationRepositoriesRequest, v1alpha1.ListOrganizationRepositoriesResponse]( + httpClient, + baseURL+RepositoryServiceListOrganizationRepositoriesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + createRepositoryByFullName: connect_go.NewClient[v1alpha1.CreateRepositoryByFullNameRequest, v1alpha1.CreateRepositoryByFullNameResponse]( + httpClient, + baseURL+RepositoryServiceCreateRepositoryByFullNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteRepository: connect_go.NewClient[v1alpha1.DeleteRepositoryRequest, v1alpha1.DeleteRepositoryResponse]( + httpClient, + baseURL+RepositoryServiceDeleteRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteRepositoryByFullName: connect_go.NewClient[v1alpha1.DeleteRepositoryByFullNameRequest, v1alpha1.DeleteRepositoryByFullNameResponse]( + httpClient, + baseURL+RepositoryServiceDeleteRepositoryByFullNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deprecateRepositoryByName: connect_go.NewClient[v1alpha1.DeprecateRepositoryByNameRequest, v1alpha1.DeprecateRepositoryByNameResponse]( + httpClient, + baseURL+RepositoryServiceDeprecateRepositoryByNameProcedure, + opts..., + ), + undeprecateRepositoryByName: connect_go.NewClient[v1alpha1.UndeprecateRepositoryByNameRequest, v1alpha1.UndeprecateRepositoryByNameResponse]( + httpClient, + baseURL+RepositoryServiceUndeprecateRepositoryByNameProcedure, + opts..., + ), + getRepositoriesByFullName: connect_go.NewClient[v1alpha1.GetRepositoriesByFullNameRequest, v1alpha1.GetRepositoriesByFullNameResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoriesByFullNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + setRepositoryContributor: connect_go.NewClient[v1alpha1.SetRepositoryContributorRequest, v1alpha1.SetRepositoryContributorResponse]( + httpClient, + baseURL+RepositoryServiceSetRepositoryContributorProcedure, + opts..., + ), + listRepositoryContributors: connect_go.NewClient[v1alpha1.ListRepositoryContributorsRequest, v1alpha1.ListRepositoryContributorsResponse]( + httpClient, + baseURL+RepositoryServiceListRepositoryContributorsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositoryContributor: connect_go.NewClient[v1alpha1.GetRepositoryContributorRequest, v1alpha1.GetRepositoryContributorResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoryContributorProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositorySettings: connect_go.NewClient[v1alpha1.GetRepositorySettingsRequest, v1alpha1.GetRepositorySettingsResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositorySettingsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateRepositorySettingsByName: connect_go.NewClient[v1alpha1.UpdateRepositorySettingsByNameRequest, v1alpha1.UpdateRepositorySettingsByNameResponse]( + httpClient, + baseURL+RepositoryServiceUpdateRepositorySettingsByNameProcedure, + opts..., + ), + getRepositoriesMetadata: connect_go.NewClient[v1alpha1.GetRepositoriesMetadataRequest, v1alpha1.GetRepositoriesMetadataResponse]( + httpClient, + baseURL+RepositoryServiceGetRepositoriesMetadataProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// repositoryServiceClient implements RepositoryServiceClient. +type repositoryServiceClient struct { + getRepository *connect_go.Client[v1alpha1.GetRepositoryRequest, v1alpha1.GetRepositoryResponse] + getRepositoryByFullName *connect_go.Client[v1alpha1.GetRepositoryByFullNameRequest, v1alpha1.GetRepositoryByFullNameResponse] + listRepositories *connect_go.Client[v1alpha1.ListRepositoriesRequest, v1alpha1.ListRepositoriesResponse] + listUserRepositories *connect_go.Client[v1alpha1.ListUserRepositoriesRequest, v1alpha1.ListUserRepositoriesResponse] + listRepositoriesUserCanAccess *connect_go.Client[v1alpha1.ListRepositoriesUserCanAccessRequest, v1alpha1.ListRepositoriesUserCanAccessResponse] + listOrganizationRepositories *connect_go.Client[v1alpha1.ListOrganizationRepositoriesRequest, v1alpha1.ListOrganizationRepositoriesResponse] + createRepositoryByFullName *connect_go.Client[v1alpha1.CreateRepositoryByFullNameRequest, v1alpha1.CreateRepositoryByFullNameResponse] + deleteRepository *connect_go.Client[v1alpha1.DeleteRepositoryRequest, v1alpha1.DeleteRepositoryResponse] + deleteRepositoryByFullName *connect_go.Client[v1alpha1.DeleteRepositoryByFullNameRequest, v1alpha1.DeleteRepositoryByFullNameResponse] + deprecateRepositoryByName *connect_go.Client[v1alpha1.DeprecateRepositoryByNameRequest, v1alpha1.DeprecateRepositoryByNameResponse] + undeprecateRepositoryByName *connect_go.Client[v1alpha1.UndeprecateRepositoryByNameRequest, v1alpha1.UndeprecateRepositoryByNameResponse] + getRepositoriesByFullName *connect_go.Client[v1alpha1.GetRepositoriesByFullNameRequest, v1alpha1.GetRepositoriesByFullNameResponse] + setRepositoryContributor *connect_go.Client[v1alpha1.SetRepositoryContributorRequest, v1alpha1.SetRepositoryContributorResponse] + listRepositoryContributors *connect_go.Client[v1alpha1.ListRepositoryContributorsRequest, v1alpha1.ListRepositoryContributorsResponse] + getRepositoryContributor *connect_go.Client[v1alpha1.GetRepositoryContributorRequest, v1alpha1.GetRepositoryContributorResponse] + getRepositorySettings *connect_go.Client[v1alpha1.GetRepositorySettingsRequest, v1alpha1.GetRepositorySettingsResponse] + updateRepositorySettingsByName *connect_go.Client[v1alpha1.UpdateRepositorySettingsByNameRequest, v1alpha1.UpdateRepositorySettingsByNameResponse] + getRepositoriesMetadata *connect_go.Client[v1alpha1.GetRepositoriesMetadataRequest, v1alpha1.GetRepositoriesMetadataResponse] +} + +// GetRepository calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepository. +func (c *repositoryServiceClient) GetRepository(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryRequest]) (*connect_go.Response[v1alpha1.GetRepositoryResponse], error) { + return c.getRepository.CallUnary(ctx, req) +} + +// GetRepositoryByFullName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryByFullName. +func (c *repositoryServiceClient) GetRepositoryByFullName(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoryByFullNameResponse], error) { + return c.getRepositoryByFullName.CallUnary(ctx, req) +} + +// ListRepositories calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositories. +func (c *repositoryServiceClient) ListRepositories(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesResponse], error) { + return c.listRepositories.CallUnary(ctx, req) +} + +// ListUserRepositories calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListUserRepositories. +func (c *repositoryServiceClient) ListUserRepositories(ctx context.Context, req *connect_go.Request[v1alpha1.ListUserRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListUserRepositoriesResponse], error) { + return c.listUserRepositories.CallUnary(ctx, req) +} + +// ListRepositoriesUserCanAccess calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoriesUserCanAccess. +func (c *repositoryServiceClient) ListRepositoriesUserCanAccess(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoriesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesUserCanAccessResponse], error) { + return c.listRepositoriesUserCanAccess.CallUnary(ctx, req) +} + +// ListOrganizationRepositories calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListOrganizationRepositories. +func (c *repositoryServiceClient) ListOrganizationRepositories(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationRepositoriesResponse], error) { + return c.listOrganizationRepositories.CallUnary(ctx, req) +} + +// CreateRepositoryByFullName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.CreateRepositoryByFullName. +func (c *repositoryServiceClient) CreateRepositoryByFullName(ctx context.Context, req *connect_go.Request[v1alpha1.CreateRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryByFullNameResponse], error) { + return c.createRepositoryByFullName.CallUnary(ctx, req) +} + +// DeleteRepository calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepository. +func (c *repositoryServiceClient) DeleteRepository(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryResponse], error) { + return c.deleteRepository.CallUnary(ctx, req) +} + +// DeleteRepositoryByFullName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepositoryByFullName. +func (c *repositoryServiceClient) DeleteRepositoryByFullName(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryByFullNameResponse], error) { + return c.deleteRepositoryByFullName.CallUnary(ctx, req) +} + +// DeprecateRepositoryByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeprecateRepositoryByName. +func (c *repositoryServiceClient) DeprecateRepositoryByName(ctx context.Context, req *connect_go.Request[v1alpha1.DeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.DeprecateRepositoryByNameResponse], error) { + return c.deprecateRepositoryByName.CallUnary(ctx, req) +} + +// UndeprecateRepositoryByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UndeprecateRepositoryByName. +func (c *repositoryServiceClient) UndeprecateRepositoryByName(ctx context.Context, req *connect_go.Request[v1alpha1.UndeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.UndeprecateRepositoryByNameResponse], error) { + return c.undeprecateRepositoryByName.CallUnary(ctx, req) +} + +// GetRepositoriesByFullName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesByFullName. +func (c *repositoryServiceClient) GetRepositoriesByFullName(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoriesByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesByFullNameResponse], error) { + return c.getRepositoriesByFullName.CallUnary(ctx, req) +} + +// SetRepositoryContributor calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.SetRepositoryContributor. +func (c *repositoryServiceClient) SetRepositoryContributor(ctx context.Context, req *connect_go.Request[v1alpha1.SetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.SetRepositoryContributorResponse], error) { + return c.setRepositoryContributor.CallUnary(ctx, req) +} + +// ListRepositoryContributors calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoryContributors. +func (c *repositoryServiceClient) ListRepositoryContributors(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryContributorsResponse], error) { + return c.listRepositoryContributors.CallUnary(ctx, req) +} + +// GetRepositoryContributor calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryContributor. +func (c *repositoryServiceClient) GetRepositoryContributor(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.GetRepositoryContributorResponse], error) { + return c.getRepositoryContributor.CallUnary(ctx, req) +} + +// GetRepositorySettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositorySettings. +func (c *repositoryServiceClient) GetRepositorySettings(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.GetRepositorySettingsResponse], error) { + return c.getRepositorySettings.CallUnary(ctx, req) +} + +// UpdateRepositorySettingsByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UpdateRepositorySettingsByName. +func (c *repositoryServiceClient) UpdateRepositorySettingsByName(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateRepositorySettingsByNameRequest]) (*connect_go.Response[v1alpha1.UpdateRepositorySettingsByNameResponse], error) { + return c.updateRepositorySettingsByName.CallUnary(ctx, req) +} + +// GetRepositoriesMetadata calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesMetadata. +func (c *repositoryServiceClient) GetRepositoriesMetadata(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoriesMetadataRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesMetadataResponse], error) { + return c.getRepositoriesMetadata.CallUnary(ctx, req) +} + +// RepositoryServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService service. +type RepositoryServiceHandler interface { + // GetRepository gets a repository by ID. + GetRepository(context.Context, *connect_go.Request[v1alpha1.GetRepositoryRequest]) (*connect_go.Response[v1alpha1.GetRepositoryResponse], error) + // GetRepositoryByFullName gets a repository by full name. + GetRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoryByFullNameResponse], error) + // ListRepositories lists all repositories. + ListRepositories(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesResponse], error) + // ListUserRepositories lists all repositories belonging to a user. + ListUserRepositories(context.Context, *connect_go.Request[v1alpha1.ListUserRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListUserRepositoriesResponse], error) + // ListRepositoriesUserCanAccess lists all repositories a user can access. + ListRepositoriesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesUserCanAccessResponse], error) + // ListOrganizationRepositories lists all repositories for an organization. + ListOrganizationRepositories(context.Context, *connect_go.Request[v1alpha1.ListOrganizationRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationRepositoriesResponse], error) + // CreateRepositoryByFullName creates a new repository by full name. + CreateRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryByFullNameResponse], error) + // DeleteRepository deletes a repository. + DeleteRepository(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryResponse], error) + // DeleteRepositoryByFullName deletes a repository by full name. + DeleteRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryByFullNameResponse], error) + // DeprecateRepositoryByName deprecates the repository. + DeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.DeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.DeprecateRepositoryByNameResponse], error) + // UndeprecateRepositoryByName makes the repository not deprecated and removes any deprecation_message. + UndeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.UndeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.UndeprecateRepositoryByNameResponse], error) + // GetRepositoriesByFullName gets repositories by full name. Response order is unspecified. + // Errors if any of the repositories don't exist or the caller does not have access to any of the repositories. + GetRepositoriesByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesByFullNameResponse], error) + // SetRepositoryContributor sets the role of a user in the repository. + SetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.SetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.SetRepositoryContributorResponse], error) + // ListRepositoryContributors returns the list of contributors that has an explicit role against the repository. + // This does not include users who have implicit roles against the repository, unless they have also been + // assigned a role explicitly. + ListRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.ListRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryContributorsResponse], error) + // GetRepositoryContributor returns the contributor information of a user in a repository. + GetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.GetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.GetRepositoryContributorResponse], error) + // GetRepositorySettings gets the settings of a repository. + GetRepositorySettings(context.Context, *connect_go.Request[v1alpha1.GetRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.GetRepositorySettingsResponse], error) + // UpdateRepositorySettingsByName updates the settings of a repository. + UpdateRepositorySettingsByName(context.Context, *connect_go.Request[v1alpha1.UpdateRepositorySettingsByNameRequest]) (*connect_go.Response[v1alpha1.UpdateRepositorySettingsByNameResponse], error) + // GetRepositoriesMetadata gets the metadata of the repositories in the request, the length of repositories in the + // request should match the length of the metadata in the response, and the order of repositories in the response + // should match the order of the metadata in the request. + GetRepositoriesMetadata(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesMetadataRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesMetadataResponse], error) +} + +// NewRepositoryServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRepositoryServiceHandler(svc RepositoryServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + repositoryServiceGetRepositoryHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoryProcedure, + svc.GetRepository, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceGetRepositoryByFullNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoryByFullNameProcedure, + svc.GetRepositoryByFullName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceListRepositoriesHandler := connect_go.NewUnaryHandler( + RepositoryServiceListRepositoriesProcedure, + svc.ListRepositories, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceListUserRepositoriesHandler := connect_go.NewUnaryHandler( + RepositoryServiceListUserRepositoriesProcedure, + svc.ListUserRepositories, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceListRepositoriesUserCanAccessHandler := connect_go.NewUnaryHandler( + RepositoryServiceListRepositoriesUserCanAccessProcedure, + svc.ListRepositoriesUserCanAccess, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceListOrganizationRepositoriesHandler := connect_go.NewUnaryHandler( + RepositoryServiceListOrganizationRepositoriesProcedure, + svc.ListOrganizationRepositories, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceCreateRepositoryByFullNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceCreateRepositoryByFullNameProcedure, + svc.CreateRepositoryByFullName, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceDeleteRepositoryHandler := connect_go.NewUnaryHandler( + RepositoryServiceDeleteRepositoryProcedure, + svc.DeleteRepository, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceDeleteRepositoryByFullNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceDeleteRepositoryByFullNameProcedure, + svc.DeleteRepositoryByFullName, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceDeprecateRepositoryByNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceDeprecateRepositoryByNameProcedure, + svc.DeprecateRepositoryByName, + opts..., + ) + repositoryServiceUndeprecateRepositoryByNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceUndeprecateRepositoryByNameProcedure, + svc.UndeprecateRepositoryByName, + opts..., + ) + repositoryServiceGetRepositoriesByFullNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoriesByFullNameProcedure, + svc.GetRepositoriesByFullName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceSetRepositoryContributorHandler := connect_go.NewUnaryHandler( + RepositoryServiceSetRepositoryContributorProcedure, + svc.SetRepositoryContributor, + opts..., + ) + repositoryServiceListRepositoryContributorsHandler := connect_go.NewUnaryHandler( + RepositoryServiceListRepositoryContributorsProcedure, + svc.ListRepositoryContributors, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceGetRepositoryContributorHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoryContributorProcedure, + svc.GetRepositoryContributor, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceGetRepositorySettingsHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositorySettingsProcedure, + svc.GetRepositorySettings, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryServiceUpdateRepositorySettingsByNameHandler := connect_go.NewUnaryHandler( + RepositoryServiceUpdateRepositorySettingsByNameProcedure, + svc.UpdateRepositorySettingsByName, + opts..., + ) + repositoryServiceGetRepositoriesMetadataHandler := connect_go.NewUnaryHandler( + RepositoryServiceGetRepositoriesMetadataProcedure, + svc.GetRepositoriesMetadata, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RepositoryServiceGetRepositoryProcedure: + repositoryServiceGetRepositoryHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositoryByFullNameProcedure: + repositoryServiceGetRepositoryByFullNameHandler.ServeHTTP(w, r) + case RepositoryServiceListRepositoriesProcedure: + repositoryServiceListRepositoriesHandler.ServeHTTP(w, r) + case RepositoryServiceListUserRepositoriesProcedure: + repositoryServiceListUserRepositoriesHandler.ServeHTTP(w, r) + case RepositoryServiceListRepositoriesUserCanAccessProcedure: + repositoryServiceListRepositoriesUserCanAccessHandler.ServeHTTP(w, r) + case RepositoryServiceListOrganizationRepositoriesProcedure: + repositoryServiceListOrganizationRepositoriesHandler.ServeHTTP(w, r) + case RepositoryServiceCreateRepositoryByFullNameProcedure: + repositoryServiceCreateRepositoryByFullNameHandler.ServeHTTP(w, r) + case RepositoryServiceDeleteRepositoryProcedure: + repositoryServiceDeleteRepositoryHandler.ServeHTTP(w, r) + case RepositoryServiceDeleteRepositoryByFullNameProcedure: + repositoryServiceDeleteRepositoryByFullNameHandler.ServeHTTP(w, r) + case RepositoryServiceDeprecateRepositoryByNameProcedure: + repositoryServiceDeprecateRepositoryByNameHandler.ServeHTTP(w, r) + case RepositoryServiceUndeprecateRepositoryByNameProcedure: + repositoryServiceUndeprecateRepositoryByNameHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositoriesByFullNameProcedure: + repositoryServiceGetRepositoriesByFullNameHandler.ServeHTTP(w, r) + case RepositoryServiceSetRepositoryContributorProcedure: + repositoryServiceSetRepositoryContributorHandler.ServeHTTP(w, r) + case RepositoryServiceListRepositoryContributorsProcedure: + repositoryServiceListRepositoryContributorsHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositoryContributorProcedure: + repositoryServiceGetRepositoryContributorHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositorySettingsProcedure: + repositoryServiceGetRepositorySettingsHandler.ServeHTTP(w, r) + case RepositoryServiceUpdateRepositorySettingsByNameProcedure: + repositoryServiceUpdateRepositorySettingsByNameHandler.ServeHTTP(w, r) + case RepositoryServiceGetRepositoriesMetadataProcedure: + repositoryServiceGetRepositoriesMetadataHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRepositoryServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRepositoryServiceHandler struct{} + +func (UnimplementedRepositoryServiceHandler) GetRepository(context.Context, *connect_go.Request[v1alpha1.GetRepositoryRequest]) (*connect_go.Response[v1alpha1.GetRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepository is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoryByFullNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryByFullName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListRepositories(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositories is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListUserRepositories(context.Context, *connect_go.Request[v1alpha1.ListUserRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListUserRepositoriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListUserRepositories is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListRepositoriesUserCanAccess(context.Context, *connect_go.Request[v1alpha1.ListRepositoriesUserCanAccessRequest]) (*connect_go.Response[v1alpha1.ListRepositoriesUserCanAccessResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoriesUserCanAccess is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListOrganizationRepositories(context.Context, *connect_go.Request[v1alpha1.ListOrganizationRepositoriesRequest]) (*connect_go.Response[v1alpha1.ListOrganizationRepositoriesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListOrganizationRepositories is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) CreateRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryByFullNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.CreateRepositoryByFullName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) DeleteRepository(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepository is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) DeleteRepositoryByFullName(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryByFullNameRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryByFullNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepositoryByFullName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) DeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.DeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.DeprecateRepositoryByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeprecateRepositoryByName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) UndeprecateRepositoryByName(context.Context, *connect_go.Request[v1alpha1.UndeprecateRepositoryByNameRequest]) (*connect_go.Response[v1alpha1.UndeprecateRepositoryByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UndeprecateRepositoryByName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositoriesByFullName(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesByFullNameRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesByFullNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesByFullName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) SetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.SetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.SetRepositoryContributorResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.SetRepositoryContributor is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) ListRepositoryContributors(context.Context, *connect_go.Request[v1alpha1.ListRepositoryContributorsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryContributorsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoryContributors is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositoryContributor(context.Context, *connect_go.Request[v1alpha1.GetRepositoryContributorRequest]) (*connect_go.Response[v1alpha1.GetRepositoryContributorResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryContributor is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositorySettings(context.Context, *connect_go.Request[v1alpha1.GetRepositorySettingsRequest]) (*connect_go.Response[v1alpha1.GetRepositorySettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositorySettings is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) UpdateRepositorySettingsByName(context.Context, *connect_go.Request[v1alpha1.UpdateRepositorySettingsByNameRequest]) (*connect_go.Response[v1alpha1.UpdateRepositorySettingsByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UpdateRepositorySettingsByName is not implemented")) +} + +func (UnimplementedRepositoryServiceHandler) GetRepositoriesMetadata(context.Context, *connect_go.Request[v1alpha1.GetRepositoriesMetadataRequest]) (*connect_go.Response[v1alpha1.GetRepositoriesMetadataResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesMetadata is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_branch.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_branch.connect.go new file mode 100644 index 000000000..d51a4c52d --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_branch.connect.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/repository_branch.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RepositoryBranchServiceName is the fully-qualified name of the RepositoryBranchService service. + RepositoryBranchServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RepositoryBranchServiceListRepositoryBranchesProcedure is the fully-qualified name of the + // RepositoryBranchService's ListRepositoryBranches RPC. + RepositoryBranchServiceListRepositoryBranchesProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService/ListRepositoryBranches" +) + +// RepositoryBranchServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService service. +type RepositoryBranchServiceClient interface { + // ListRepositoryBranchs lists the repository branches associated with a Repository. + ListRepositoryBranches(context.Context, *connect_go.Request[v1alpha1.ListRepositoryBranchesRequest]) (*connect_go.Response[v1alpha1.ListRepositoryBranchesResponse], error) +} + +// NewRepositoryBranchServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRepositoryBranchServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RepositoryBranchServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &repositoryBranchServiceClient{ + listRepositoryBranches: connect_go.NewClient[v1alpha1.ListRepositoryBranchesRequest, v1alpha1.ListRepositoryBranchesResponse]( + httpClient, + baseURL+RepositoryBranchServiceListRepositoryBranchesProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// repositoryBranchServiceClient implements RepositoryBranchServiceClient. +type repositoryBranchServiceClient struct { + listRepositoryBranches *connect_go.Client[v1alpha1.ListRepositoryBranchesRequest, v1alpha1.ListRepositoryBranchesResponse] +} + +// ListRepositoryBranches calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService.ListRepositoryBranches. +func (c *repositoryBranchServiceClient) ListRepositoryBranches(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryBranchesRequest]) (*connect_go.Response[v1alpha1.ListRepositoryBranchesResponse], error) { + return c.listRepositoryBranches.CallUnary(ctx, req) +} + +// RepositoryBranchServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService service. +type RepositoryBranchServiceHandler interface { + // ListRepositoryBranchs lists the repository branches associated with a Repository. + ListRepositoryBranches(context.Context, *connect_go.Request[v1alpha1.ListRepositoryBranchesRequest]) (*connect_go.Response[v1alpha1.ListRepositoryBranchesResponse], error) +} + +// NewRepositoryBranchServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRepositoryBranchServiceHandler(svc RepositoryBranchServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + repositoryBranchServiceListRepositoryBranchesHandler := connect_go.NewUnaryHandler( + RepositoryBranchServiceListRepositoryBranchesProcedure, + svc.ListRepositoryBranches, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RepositoryBranchServiceListRepositoryBranchesProcedure: + repositoryBranchServiceListRepositoryBranchesHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRepositoryBranchServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRepositoryBranchServiceHandler struct{} + +func (UnimplementedRepositoryBranchServiceHandler) ListRepositoryBranches(context.Context, *connect_go.Request[v1alpha1.ListRepositoryBranchesRequest]) (*connect_go.Response[v1alpha1.ListRepositoryBranchesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService.ListRepositoryBranches is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_commit.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_commit.connect.go new file mode 100644 index 000000000..b1beade59 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_commit.connect.go @@ -0,0 +1,302 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/repository_commit.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RepositoryCommitServiceName is the fully-qualified name of the RepositoryCommitService service. + RepositoryCommitServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RepositoryCommitServiceListRepositoryCommitsByBranchProcedure is the fully-qualified name of the + // RepositoryCommitService's ListRepositoryCommitsByBranch RPC. + RepositoryCommitServiceListRepositoryCommitsByBranchProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryCommitsByBranch" + // RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure is the fully-qualified name of + // the RepositoryCommitService's ListRepositoryCommitsByReference RPC. + RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryCommitsByReference" + // RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure is the fully-qualified name of the + // RepositoryCommitService's GetRepositoryCommitByReference RPC. + RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/GetRepositoryCommitByReference" + // RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure is the fully-qualified name of + // the RepositoryCommitService's GetRepositoryCommitBySequenceId RPC. + RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/GetRepositoryCommitBySequenceId" + // RepositoryCommitServiceListRepositoryDraftCommitsProcedure is the fully-qualified name of the + // RepositoryCommitService's ListRepositoryDraftCommits RPC. + RepositoryCommitServiceListRepositoryDraftCommitsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryDraftCommits" + // RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure is the fully-qualified name of the + // RepositoryCommitService's DeleteRepositoryDraftCommit RPC. + RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/DeleteRepositoryDraftCommit" +) + +// RepositoryCommitServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService service. +type RepositoryCommitServiceClient interface { + // ListRepositoryCommitsByBranch lists the repository commits associated + // with a repository branch on a repository, ordered by their create time. + // + // Deprecated: do not use. + ListRepositoryCommitsByBranch(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByBranchRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByBranchResponse], error) + // ListRepositoryCommitsByReference returns repository commits up-to and including + // the provided reference. + ListRepositoryCommitsByReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByReferenceResponse], error) + // GetRepositoryCommitByReference returns the repository commit matching + // the provided reference, if it exists. + GetRepositoryCommitByReference(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitByReferenceRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitByReferenceResponse], error) + // GetRepositoryCommitBySequenceId returns the repository commit matching + // the provided sequence ID and branch, if it exists. + GetRepositoryCommitBySequenceId(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitBySequenceIdRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitBySequenceIdResponse], error) + // ListRepositoryDraftCommits lists draft commits in a repository. + ListRepositoryDraftCommits(context.Context, *connect_go.Request[v1alpha1.ListRepositoryDraftCommitsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryDraftCommitsResponse], error) + // DeleteRepositoryDraftCommit deletes a draft. + DeleteRepositoryDraftCommit(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryDraftCommitRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryDraftCommitResponse], error) +} + +// NewRepositoryCommitServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRepositoryCommitServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RepositoryCommitServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &repositoryCommitServiceClient{ + listRepositoryCommitsByBranch: connect_go.NewClient[v1alpha1.ListRepositoryCommitsByBranchRequest, v1alpha1.ListRepositoryCommitsByBranchResponse]( + httpClient, + baseURL+RepositoryCommitServiceListRepositoryCommitsByBranchProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositoryCommitsByReference: connect_go.NewClient[v1alpha1.ListRepositoryCommitsByReferenceRequest, v1alpha1.ListRepositoryCommitsByReferenceResponse]( + httpClient, + baseURL+RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositoryCommitByReference: connect_go.NewClient[v1alpha1.GetRepositoryCommitByReferenceRequest, v1alpha1.GetRepositoryCommitByReferenceResponse]( + httpClient, + baseURL+RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getRepositoryCommitBySequenceId: connect_go.NewClient[v1alpha1.GetRepositoryCommitBySequenceIdRequest, v1alpha1.GetRepositoryCommitBySequenceIdResponse]( + httpClient, + baseURL+RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositoryDraftCommits: connect_go.NewClient[v1alpha1.ListRepositoryDraftCommitsRequest, v1alpha1.ListRepositoryDraftCommitsResponse]( + httpClient, + baseURL+RepositoryCommitServiceListRepositoryDraftCommitsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteRepositoryDraftCommit: connect_go.NewClient[v1alpha1.DeleteRepositoryDraftCommitRequest, v1alpha1.DeleteRepositoryDraftCommitResponse]( + httpClient, + baseURL+RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// repositoryCommitServiceClient implements RepositoryCommitServiceClient. +type repositoryCommitServiceClient struct { + listRepositoryCommitsByBranch *connect_go.Client[v1alpha1.ListRepositoryCommitsByBranchRequest, v1alpha1.ListRepositoryCommitsByBranchResponse] + listRepositoryCommitsByReference *connect_go.Client[v1alpha1.ListRepositoryCommitsByReferenceRequest, v1alpha1.ListRepositoryCommitsByReferenceResponse] + getRepositoryCommitByReference *connect_go.Client[v1alpha1.GetRepositoryCommitByReferenceRequest, v1alpha1.GetRepositoryCommitByReferenceResponse] + getRepositoryCommitBySequenceId *connect_go.Client[v1alpha1.GetRepositoryCommitBySequenceIdRequest, v1alpha1.GetRepositoryCommitBySequenceIdResponse] + listRepositoryDraftCommits *connect_go.Client[v1alpha1.ListRepositoryDraftCommitsRequest, v1alpha1.ListRepositoryDraftCommitsResponse] + deleteRepositoryDraftCommit *connect_go.Client[v1alpha1.DeleteRepositoryDraftCommitRequest, v1alpha1.DeleteRepositoryDraftCommitResponse] +} + +// ListRepositoryCommitsByBranch calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByBranch. +// +// Deprecated: do not use. +func (c *repositoryCommitServiceClient) ListRepositoryCommitsByBranch(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryCommitsByBranchRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByBranchResponse], error) { + return c.listRepositoryCommitsByBranch.CallUnary(ctx, req) +} + +// ListRepositoryCommitsByReference calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByReference. +func (c *repositoryCommitServiceClient) ListRepositoryCommitsByReference(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryCommitsByReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByReferenceResponse], error) { + return c.listRepositoryCommitsByReference.CallUnary(ctx, req) +} + +// GetRepositoryCommitByReference calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitByReference. +func (c *repositoryCommitServiceClient) GetRepositoryCommitByReference(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryCommitByReferenceRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitByReferenceResponse], error) { + return c.getRepositoryCommitByReference.CallUnary(ctx, req) +} + +// GetRepositoryCommitBySequenceId calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitBySequenceId. +func (c *repositoryCommitServiceClient) GetRepositoryCommitBySequenceId(ctx context.Context, req *connect_go.Request[v1alpha1.GetRepositoryCommitBySequenceIdRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitBySequenceIdResponse], error) { + return c.getRepositoryCommitBySequenceId.CallUnary(ctx, req) +} + +// ListRepositoryDraftCommits calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryDraftCommits. +func (c *repositoryCommitServiceClient) ListRepositoryDraftCommits(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryDraftCommitsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryDraftCommitsResponse], error) { + return c.listRepositoryDraftCommits.CallUnary(ctx, req) +} + +// DeleteRepositoryDraftCommit calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.DeleteRepositoryDraftCommit. +func (c *repositoryCommitServiceClient) DeleteRepositoryDraftCommit(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteRepositoryDraftCommitRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryDraftCommitResponse], error) { + return c.deleteRepositoryDraftCommit.CallUnary(ctx, req) +} + +// RepositoryCommitServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService service. +type RepositoryCommitServiceHandler interface { + // ListRepositoryCommitsByBranch lists the repository commits associated + // with a repository branch on a repository, ordered by their create time. + // + // Deprecated: do not use. + ListRepositoryCommitsByBranch(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByBranchRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByBranchResponse], error) + // ListRepositoryCommitsByReference returns repository commits up-to and including + // the provided reference. + ListRepositoryCommitsByReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByReferenceResponse], error) + // GetRepositoryCommitByReference returns the repository commit matching + // the provided reference, if it exists. + GetRepositoryCommitByReference(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitByReferenceRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitByReferenceResponse], error) + // GetRepositoryCommitBySequenceId returns the repository commit matching + // the provided sequence ID and branch, if it exists. + GetRepositoryCommitBySequenceId(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitBySequenceIdRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitBySequenceIdResponse], error) + // ListRepositoryDraftCommits lists draft commits in a repository. + ListRepositoryDraftCommits(context.Context, *connect_go.Request[v1alpha1.ListRepositoryDraftCommitsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryDraftCommitsResponse], error) + // DeleteRepositoryDraftCommit deletes a draft. + DeleteRepositoryDraftCommit(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryDraftCommitRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryDraftCommitResponse], error) +} + +// NewRepositoryCommitServiceHandler builds an HTTP handler from the service implementation. It +// returns the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRepositoryCommitServiceHandler(svc RepositoryCommitServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + repositoryCommitServiceListRepositoryCommitsByBranchHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceListRepositoryCommitsByBranchProcedure, + svc.ListRepositoryCommitsByBranch, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceListRepositoryCommitsByReferenceHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure, + svc.ListRepositoryCommitsByReference, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceGetRepositoryCommitByReferenceHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure, + svc.GetRepositoryCommitByReference, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceGetRepositoryCommitBySequenceIdHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure, + svc.GetRepositoryCommitBySequenceId, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceListRepositoryDraftCommitsHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceListRepositoryDraftCommitsProcedure, + svc.ListRepositoryDraftCommits, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryCommitServiceDeleteRepositoryDraftCommitHandler := connect_go.NewUnaryHandler( + RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure, + svc.DeleteRepositoryDraftCommit, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RepositoryCommitServiceListRepositoryCommitsByBranchProcedure: + repositoryCommitServiceListRepositoryCommitsByBranchHandler.ServeHTTP(w, r) + case RepositoryCommitServiceListRepositoryCommitsByReferenceProcedure: + repositoryCommitServiceListRepositoryCommitsByReferenceHandler.ServeHTTP(w, r) + case RepositoryCommitServiceGetRepositoryCommitByReferenceProcedure: + repositoryCommitServiceGetRepositoryCommitByReferenceHandler.ServeHTTP(w, r) + case RepositoryCommitServiceGetRepositoryCommitBySequenceIdProcedure: + repositoryCommitServiceGetRepositoryCommitBySequenceIdHandler.ServeHTTP(w, r) + case RepositoryCommitServiceListRepositoryDraftCommitsProcedure: + repositoryCommitServiceListRepositoryDraftCommitsHandler.ServeHTTP(w, r) + case RepositoryCommitServiceDeleteRepositoryDraftCommitProcedure: + repositoryCommitServiceDeleteRepositoryDraftCommitHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRepositoryCommitServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRepositoryCommitServiceHandler struct{} + +func (UnimplementedRepositoryCommitServiceHandler) ListRepositoryCommitsByBranch(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByBranchRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByBranchResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByBranch is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) ListRepositoryCommitsByReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryCommitsByReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryCommitsByReferenceResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByReference is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) GetRepositoryCommitByReference(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitByReferenceRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitByReferenceResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitByReference is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) GetRepositoryCommitBySequenceId(context.Context, *connect_go.Request[v1alpha1.GetRepositoryCommitBySequenceIdRequest]) (*connect_go.Response[v1alpha1.GetRepositoryCommitBySequenceIdResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitBySequenceId is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) ListRepositoryDraftCommits(context.Context, *connect_go.Request[v1alpha1.ListRepositoryDraftCommitsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryDraftCommitsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryDraftCommits is not implemented")) +} + +func (UnimplementedRepositoryCommitServiceHandler) DeleteRepositoryDraftCommit(context.Context, *connect_go.Request[v1alpha1.DeleteRepositoryDraftCommitRequest]) (*connect_go.Response[v1alpha1.DeleteRepositoryDraftCommitResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.DeleteRepositoryDraftCommit is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_tag.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_tag.connect.go new file mode 100644 index 000000000..4bff4f51a --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/repository_tag.connect.go @@ -0,0 +1,194 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/repository_tag.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // RepositoryTagServiceName is the fully-qualified name of the RepositoryTagService service. + RepositoryTagServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RepositoryTagServiceCreateRepositoryTagProcedure is the fully-qualified name of the + // RepositoryTagService's CreateRepositoryTag RPC. + RepositoryTagServiceCreateRepositoryTagProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/CreateRepositoryTag" + // RepositoryTagServiceListRepositoryTagsProcedure is the fully-qualified name of the + // RepositoryTagService's ListRepositoryTags RPC. + RepositoryTagServiceListRepositoryTagsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/ListRepositoryTags" + // RepositoryTagServiceListRepositoryTagsForReferenceProcedure is the fully-qualified name of the + // RepositoryTagService's ListRepositoryTagsForReference RPC. + RepositoryTagServiceListRepositoryTagsForReferenceProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/ListRepositoryTagsForReference" +) + +// RepositoryTagServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService service. +type RepositoryTagServiceClient interface { + // CreateRepositoryTag creates a new repository tag. + CreateRepositoryTag(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryTagRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryTagResponse], error) + // ListRepositoryTags lists the repository tags associated with a Repository. + ListRepositoryTags(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsResponse], error) + // ListRepositoryTagsForReference lists the repository tags associated with a repository + // reference name. + ListRepositoryTagsForReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsForReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsForReferenceResponse], error) +} + +// NewRepositoryTagServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRepositoryTagServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) RepositoryTagServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &repositoryTagServiceClient{ + createRepositoryTag: connect_go.NewClient[v1alpha1.CreateRepositoryTagRequest, v1alpha1.CreateRepositoryTagResponse]( + httpClient, + baseURL+RepositoryTagServiceCreateRepositoryTagProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + listRepositoryTags: connect_go.NewClient[v1alpha1.ListRepositoryTagsRequest, v1alpha1.ListRepositoryTagsResponse]( + httpClient, + baseURL+RepositoryTagServiceListRepositoryTagsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listRepositoryTagsForReference: connect_go.NewClient[v1alpha1.ListRepositoryTagsForReferenceRequest, v1alpha1.ListRepositoryTagsForReferenceResponse]( + httpClient, + baseURL+RepositoryTagServiceListRepositoryTagsForReferenceProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// repositoryTagServiceClient implements RepositoryTagServiceClient. +type repositoryTagServiceClient struct { + createRepositoryTag *connect_go.Client[v1alpha1.CreateRepositoryTagRequest, v1alpha1.CreateRepositoryTagResponse] + listRepositoryTags *connect_go.Client[v1alpha1.ListRepositoryTagsRequest, v1alpha1.ListRepositoryTagsResponse] + listRepositoryTagsForReference *connect_go.Client[v1alpha1.ListRepositoryTagsForReferenceRequest, v1alpha1.ListRepositoryTagsForReferenceResponse] +} + +// CreateRepositoryTag calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.CreateRepositoryTag. +func (c *repositoryTagServiceClient) CreateRepositoryTag(ctx context.Context, req *connect_go.Request[v1alpha1.CreateRepositoryTagRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryTagResponse], error) { + return c.createRepositoryTag.CallUnary(ctx, req) +} + +// ListRepositoryTags calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTags. +func (c *repositoryTagServiceClient) ListRepositoryTags(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryTagsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsResponse], error) { + return c.listRepositoryTags.CallUnary(ctx, req) +} + +// ListRepositoryTagsForReference calls +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTagsForReference. +func (c *repositoryTagServiceClient) ListRepositoryTagsForReference(ctx context.Context, req *connect_go.Request[v1alpha1.ListRepositoryTagsForReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsForReferenceResponse], error) { + return c.listRepositoryTagsForReference.CallUnary(ctx, req) +} + +// RepositoryTagServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService service. +type RepositoryTagServiceHandler interface { + // CreateRepositoryTag creates a new repository tag. + CreateRepositoryTag(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryTagRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryTagResponse], error) + // ListRepositoryTags lists the repository tags associated with a Repository. + ListRepositoryTags(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsResponse], error) + // ListRepositoryTagsForReference lists the repository tags associated with a repository + // reference name. + ListRepositoryTagsForReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsForReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsForReferenceResponse], error) +} + +// NewRepositoryTagServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRepositoryTagServiceHandler(svc RepositoryTagServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + repositoryTagServiceCreateRepositoryTagHandler := connect_go.NewUnaryHandler( + RepositoryTagServiceCreateRepositoryTagProcedure, + svc.CreateRepositoryTag, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + repositoryTagServiceListRepositoryTagsHandler := connect_go.NewUnaryHandler( + RepositoryTagServiceListRepositoryTagsProcedure, + svc.ListRepositoryTags, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + repositoryTagServiceListRepositoryTagsForReferenceHandler := connect_go.NewUnaryHandler( + RepositoryTagServiceListRepositoryTagsForReferenceProcedure, + svc.ListRepositoryTagsForReference, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RepositoryTagServiceCreateRepositoryTagProcedure: + repositoryTagServiceCreateRepositoryTagHandler.ServeHTTP(w, r) + case RepositoryTagServiceListRepositoryTagsProcedure: + repositoryTagServiceListRepositoryTagsHandler.ServeHTTP(w, r) + case RepositoryTagServiceListRepositoryTagsForReferenceProcedure: + repositoryTagServiceListRepositoryTagsForReferenceHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRepositoryTagServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRepositoryTagServiceHandler struct{} + +func (UnimplementedRepositoryTagServiceHandler) CreateRepositoryTag(context.Context, *connect_go.Request[v1alpha1.CreateRepositoryTagRequest]) (*connect_go.Response[v1alpha1.CreateRepositoryTagResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.CreateRepositoryTag is not implemented")) +} + +func (UnimplementedRepositoryTagServiceHandler) ListRepositoryTags(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTags is not implemented")) +} + +func (UnimplementedRepositoryTagServiceHandler) ListRepositoryTagsForReference(context.Context, *connect_go.Request[v1alpha1.ListRepositoryTagsForReferenceRequest]) (*connect_go.Response[v1alpha1.ListRepositoryTagsForReferenceResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTagsForReference is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/resolve.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/resolve.connect.go new file mode 100644 index 000000000..6e232ac3c --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/resolve.connect.go @@ -0,0 +1,368 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/resolve.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // ResolveServiceName is the fully-qualified name of the ResolveService service. + ResolveServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ResolveService" + // LocalResolveServiceName is the fully-qualified name of the LocalResolveService service. + LocalResolveServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ResolveServiceGetModulePinsProcedure is the fully-qualified name of the ResolveService's + // GetModulePins RPC. + ResolveServiceGetModulePinsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetModulePins" + // ResolveServiceGetGoVersionProcedure is the fully-qualified name of the ResolveService's + // GetGoVersion RPC. + ResolveServiceGetGoVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetGoVersion" + // ResolveServiceGetSwiftVersionProcedure is the fully-qualified name of the ResolveService's + // GetSwiftVersion RPC. + ResolveServiceGetSwiftVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetSwiftVersion" + // ResolveServiceGetMavenVersionProcedure is the fully-qualified name of the ResolveService's + // GetMavenVersion RPC. + ResolveServiceGetMavenVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetMavenVersion" + // ResolveServiceGetNPMVersionProcedure is the fully-qualified name of the ResolveService's + // GetNPMVersion RPC. + ResolveServiceGetNPMVersionProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetNPMVersion" + // LocalResolveServiceGetLocalModulePinsProcedure is the fully-qualified name of the + // LocalResolveService's GetLocalModulePins RPC. + LocalResolveServiceGetLocalModulePinsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService/GetLocalModulePins" +) + +// ResolveServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService service. +type ResolveServiceClient interface { + // GetModulePins finds all the latest digests and respective dependencies of + // the provided module references and picks a set of distinct modules pins. + // + // Note that module references with commits should still be passed to this function + // to make sure this function can do dependency resolution. + // + // This function also deals with tiebreaking what ModulePin wins for the same repository. + GetModulePins(context.Context, *connect_go.Request[v1alpha1.GetModulePinsRequest]) (*connect_go.Response[v1alpha1.GetModulePinsResponse], error) + // GetGoVersion resolves the given plugin and module references to a version. + GetGoVersion(context.Context, *connect_go.Request[v1alpha1.GetGoVersionRequest]) (*connect_go.Response[v1alpha1.GetGoVersionResponse], error) + // GetSwiftVersion resolves the given plugin and module references to a version. + GetSwiftVersion(context.Context, *connect_go.Request[v1alpha1.GetSwiftVersionRequest]) (*connect_go.Response[v1alpha1.GetSwiftVersionResponse], error) + // GetMavenVersion resolves the given plugin and module references to a version. + GetMavenVersion(context.Context, *connect_go.Request[v1alpha1.GetMavenVersionRequest]) (*connect_go.Response[v1alpha1.GetMavenVersionResponse], error) + // GetNPMVersion resolves the given plugin and module references to a version. + GetNPMVersion(context.Context, *connect_go.Request[v1alpha1.GetNPMVersionRequest]) (*connect_go.Response[v1alpha1.GetNPMVersionResponse], error) +} + +// NewResolveServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewResolveServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ResolveServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &resolveServiceClient{ + getModulePins: connect_go.NewClient[v1alpha1.GetModulePinsRequest, v1alpha1.GetModulePinsResponse]( + httpClient, + baseURL+ResolveServiceGetModulePinsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getGoVersion: connect_go.NewClient[v1alpha1.GetGoVersionRequest, v1alpha1.GetGoVersionResponse]( + httpClient, + baseURL+ResolveServiceGetGoVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getSwiftVersion: connect_go.NewClient[v1alpha1.GetSwiftVersionRequest, v1alpha1.GetSwiftVersionResponse]( + httpClient, + baseURL+ResolveServiceGetSwiftVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getMavenVersion: connect_go.NewClient[v1alpha1.GetMavenVersionRequest, v1alpha1.GetMavenVersionResponse]( + httpClient, + baseURL+ResolveServiceGetMavenVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getNPMVersion: connect_go.NewClient[v1alpha1.GetNPMVersionRequest, v1alpha1.GetNPMVersionResponse]( + httpClient, + baseURL+ResolveServiceGetNPMVersionProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// resolveServiceClient implements ResolveServiceClient. +type resolveServiceClient struct { + getModulePins *connect_go.Client[v1alpha1.GetModulePinsRequest, v1alpha1.GetModulePinsResponse] + getGoVersion *connect_go.Client[v1alpha1.GetGoVersionRequest, v1alpha1.GetGoVersionResponse] + getSwiftVersion *connect_go.Client[v1alpha1.GetSwiftVersionRequest, v1alpha1.GetSwiftVersionResponse] + getMavenVersion *connect_go.Client[v1alpha1.GetMavenVersionRequest, v1alpha1.GetMavenVersionResponse] + getNPMVersion *connect_go.Client[v1alpha1.GetNPMVersionRequest, v1alpha1.GetNPMVersionResponse] +} + +// GetModulePins calls +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetModulePins. +func (c *resolveServiceClient) GetModulePins(ctx context.Context, req *connect_go.Request[v1alpha1.GetModulePinsRequest]) (*connect_go.Response[v1alpha1.GetModulePinsResponse], error) { + return c.getModulePins.CallUnary(ctx, req) +} + +// GetGoVersion calls bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetGoVersion. +func (c *resolveServiceClient) GetGoVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetGoVersionRequest]) (*connect_go.Response[v1alpha1.GetGoVersionResponse], error) { + return c.getGoVersion.CallUnary(ctx, req) +} + +// GetSwiftVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetSwiftVersion. +func (c *resolveServiceClient) GetSwiftVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetSwiftVersionRequest]) (*connect_go.Response[v1alpha1.GetSwiftVersionResponse], error) { + return c.getSwiftVersion.CallUnary(ctx, req) +} + +// GetMavenVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetMavenVersion. +func (c *resolveServiceClient) GetMavenVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetMavenVersionRequest]) (*connect_go.Response[v1alpha1.GetMavenVersionResponse], error) { + return c.getMavenVersion.CallUnary(ctx, req) +} + +// GetNPMVersion calls +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetNPMVersion. +func (c *resolveServiceClient) GetNPMVersion(ctx context.Context, req *connect_go.Request[v1alpha1.GetNPMVersionRequest]) (*connect_go.Response[v1alpha1.GetNPMVersionResponse], error) { + return c.getNPMVersion.CallUnary(ctx, req) +} + +// ResolveServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ResolveService service. +type ResolveServiceHandler interface { + // GetModulePins finds all the latest digests and respective dependencies of + // the provided module references and picks a set of distinct modules pins. + // + // Note that module references with commits should still be passed to this function + // to make sure this function can do dependency resolution. + // + // This function also deals with tiebreaking what ModulePin wins for the same repository. + GetModulePins(context.Context, *connect_go.Request[v1alpha1.GetModulePinsRequest]) (*connect_go.Response[v1alpha1.GetModulePinsResponse], error) + // GetGoVersion resolves the given plugin and module references to a version. + GetGoVersion(context.Context, *connect_go.Request[v1alpha1.GetGoVersionRequest]) (*connect_go.Response[v1alpha1.GetGoVersionResponse], error) + // GetSwiftVersion resolves the given plugin and module references to a version. + GetSwiftVersion(context.Context, *connect_go.Request[v1alpha1.GetSwiftVersionRequest]) (*connect_go.Response[v1alpha1.GetSwiftVersionResponse], error) + // GetMavenVersion resolves the given plugin and module references to a version. + GetMavenVersion(context.Context, *connect_go.Request[v1alpha1.GetMavenVersionRequest]) (*connect_go.Response[v1alpha1.GetMavenVersionResponse], error) + // GetNPMVersion resolves the given plugin and module references to a version. + GetNPMVersion(context.Context, *connect_go.Request[v1alpha1.GetNPMVersionRequest]) (*connect_go.Response[v1alpha1.GetNPMVersionResponse], error) +} + +// NewResolveServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewResolveServiceHandler(svc ResolveServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + resolveServiceGetModulePinsHandler := connect_go.NewUnaryHandler( + ResolveServiceGetModulePinsProcedure, + svc.GetModulePins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + resolveServiceGetGoVersionHandler := connect_go.NewUnaryHandler( + ResolveServiceGetGoVersionProcedure, + svc.GetGoVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + resolveServiceGetSwiftVersionHandler := connect_go.NewUnaryHandler( + ResolveServiceGetSwiftVersionProcedure, + svc.GetSwiftVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + resolveServiceGetMavenVersionHandler := connect_go.NewUnaryHandler( + ResolveServiceGetMavenVersionProcedure, + svc.GetMavenVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + resolveServiceGetNPMVersionHandler := connect_go.NewUnaryHandler( + ResolveServiceGetNPMVersionProcedure, + svc.GetNPMVersion, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ResolveServiceGetModulePinsProcedure: + resolveServiceGetModulePinsHandler.ServeHTTP(w, r) + case ResolveServiceGetGoVersionProcedure: + resolveServiceGetGoVersionHandler.ServeHTTP(w, r) + case ResolveServiceGetSwiftVersionProcedure: + resolveServiceGetSwiftVersionHandler.ServeHTTP(w, r) + case ResolveServiceGetMavenVersionProcedure: + resolveServiceGetMavenVersionHandler.ServeHTTP(w, r) + case ResolveServiceGetNPMVersionProcedure: + resolveServiceGetNPMVersionHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedResolveServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedResolveServiceHandler struct{} + +func (UnimplementedResolveServiceHandler) GetModulePins(context.Context, *connect_go.Request[v1alpha1.GetModulePinsRequest]) (*connect_go.Response[v1alpha1.GetModulePinsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetModulePins is not implemented")) +} + +func (UnimplementedResolveServiceHandler) GetGoVersion(context.Context, *connect_go.Request[v1alpha1.GetGoVersionRequest]) (*connect_go.Response[v1alpha1.GetGoVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetGoVersion is not implemented")) +} + +func (UnimplementedResolveServiceHandler) GetSwiftVersion(context.Context, *connect_go.Request[v1alpha1.GetSwiftVersionRequest]) (*connect_go.Response[v1alpha1.GetSwiftVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetSwiftVersion is not implemented")) +} + +func (UnimplementedResolveServiceHandler) GetMavenVersion(context.Context, *connect_go.Request[v1alpha1.GetMavenVersionRequest]) (*connect_go.Response[v1alpha1.GetMavenVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetMavenVersion is not implemented")) +} + +func (UnimplementedResolveServiceHandler) GetNPMVersion(context.Context, *connect_go.Request[v1alpha1.GetNPMVersionRequest]) (*connect_go.Response[v1alpha1.GetNPMVersionResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetNPMVersion is not implemented")) +} + +// LocalResolveServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService service. +type LocalResolveServiceClient interface { + // GetLocalModulePins gets the latest pins for the specified local module references. + // It also includes all of the modules transitive dependencies for the specified references. + // + // We want this for two reasons: + // + // 1. It makes it easy to say "we know we're looking for owner/repo on this specific remote". + // While we could just do this in GetModulePins by being aware of what our remote is + // (something we probably still need to know, DNS problems aside, which are more + // theoretical), this helps. + // 2. Having a separate method makes us able to say "do not make decisions about what + // wins between competing pins for the same repo". This should only be done in + // GetModulePins, not in this function, i.e. only done at the top level. + GetLocalModulePins(context.Context, *connect_go.Request[v1alpha1.GetLocalModulePinsRequest]) (*connect_go.Response[v1alpha1.GetLocalModulePinsResponse], error) +} + +// NewLocalResolveServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewLocalResolveServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) LocalResolveServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &localResolveServiceClient{ + getLocalModulePins: connect_go.NewClient[v1alpha1.GetLocalModulePinsRequest, v1alpha1.GetLocalModulePinsResponse]( + httpClient, + baseURL+LocalResolveServiceGetLocalModulePinsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// localResolveServiceClient implements LocalResolveServiceClient. +type localResolveServiceClient struct { + getLocalModulePins *connect_go.Client[v1alpha1.GetLocalModulePinsRequest, v1alpha1.GetLocalModulePinsResponse] +} + +// GetLocalModulePins calls +// bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService.GetLocalModulePins. +func (c *localResolveServiceClient) GetLocalModulePins(ctx context.Context, req *connect_go.Request[v1alpha1.GetLocalModulePinsRequest]) (*connect_go.Response[v1alpha1.GetLocalModulePinsResponse], error) { + return c.getLocalModulePins.CallUnary(ctx, req) +} + +// LocalResolveServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService service. +type LocalResolveServiceHandler interface { + // GetLocalModulePins gets the latest pins for the specified local module references. + // It also includes all of the modules transitive dependencies for the specified references. + // + // We want this for two reasons: + // + // 1. It makes it easy to say "we know we're looking for owner/repo on this specific remote". + // While we could just do this in GetModulePins by being aware of what our remote is + // (something we probably still need to know, DNS problems aside, which are more + // theoretical), this helps. + // 2. Having a separate method makes us able to say "do not make decisions about what + // wins between competing pins for the same repo". This should only be done in + // GetModulePins, not in this function, i.e. only done at the top level. + GetLocalModulePins(context.Context, *connect_go.Request[v1alpha1.GetLocalModulePinsRequest]) (*connect_go.Response[v1alpha1.GetLocalModulePinsResponse], error) +} + +// NewLocalResolveServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewLocalResolveServiceHandler(svc LocalResolveServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + localResolveServiceGetLocalModulePinsHandler := connect_go.NewUnaryHandler( + LocalResolveServiceGetLocalModulePinsProcedure, + svc.GetLocalModulePins, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case LocalResolveServiceGetLocalModulePinsProcedure: + localResolveServiceGetLocalModulePinsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedLocalResolveServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedLocalResolveServiceHandler struct{} + +func (UnimplementedLocalResolveServiceHandler) GetLocalModulePins(context.Context, *connect_go.Request[v1alpha1.GetLocalModulePinsRequest]) (*connect_go.Response[v1alpha1.GetLocalModulePinsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService.GetLocalModulePins is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/resource.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/resource.connect.go new file mode 100644 index 000000000..a65411d16 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/resource.connect.go @@ -0,0 +1,130 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/resource.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // ResourceServiceName is the fully-qualified name of the ResourceService service. + ResourceServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.ResourceService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ResourceServiceGetResourceByNameProcedure is the fully-qualified name of the ResourceService's + // GetResourceByName RPC. + ResourceServiceGetResourceByNameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.ResourceService/GetResourceByName" +) + +// ResourceServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ResourceService service. +type ResourceServiceClient interface { + // GetResourceByName takes a resource name and returns the + // resource either as a repository or a plugin. + GetResourceByName(context.Context, *connect_go.Request[v1alpha1.GetResourceByNameRequest]) (*connect_go.Response[v1alpha1.GetResourceByNameResponse], error) +} + +// NewResourceServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.ResourceService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewResourceServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ResourceServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &resourceServiceClient{ + getResourceByName: connect_go.NewClient[v1alpha1.GetResourceByNameRequest, v1alpha1.GetResourceByNameResponse]( + httpClient, + baseURL+ResourceServiceGetResourceByNameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// resourceServiceClient implements ResourceServiceClient. +type resourceServiceClient struct { + getResourceByName *connect_go.Client[v1alpha1.GetResourceByNameRequest, v1alpha1.GetResourceByNameResponse] +} + +// GetResourceByName calls +// bufman.dubbo.apache.org.registry.v1alpha1.ResourceService.GetResourceByName. +func (c *resourceServiceClient) GetResourceByName(ctx context.Context, req *connect_go.Request[v1alpha1.GetResourceByNameRequest]) (*connect_go.Response[v1alpha1.GetResourceByNameResponse], error) { + return c.getResourceByName.CallUnary(ctx, req) +} + +// ResourceServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.ResourceService service. +type ResourceServiceHandler interface { + // GetResourceByName takes a resource name and returns the + // resource either as a repository or a plugin. + GetResourceByName(context.Context, *connect_go.Request[v1alpha1.GetResourceByNameRequest]) (*connect_go.Response[v1alpha1.GetResourceByNameResponse], error) +} + +// NewResourceServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewResourceServiceHandler(svc ResourceServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + resourceServiceGetResourceByNameHandler := connect_go.NewUnaryHandler( + ResourceServiceGetResourceByNameProcedure, + svc.GetResourceByName, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.ResourceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ResourceServiceGetResourceByNameProcedure: + resourceServiceGetResourceByNameHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedResourceServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedResourceServiceHandler struct{} + +func (UnimplementedResourceServiceHandler) GetResourceByName(context.Context, *connect_go.Request[v1alpha1.GetResourceByNameRequest]) (*connect_go.Response[v1alpha1.GetResourceByNameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.ResourceService.GetResourceByName is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/schema.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/schema.connect.go new file mode 100644 index 000000000..83cb0b9eb --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/schema.connect.go @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/schema.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // SchemaServiceName is the fully-qualified name of the SchemaService service. + SchemaServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.SchemaService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SchemaServiceGetSchemaProcedure is the fully-qualified name of the SchemaService's GetSchema RPC. + SchemaServiceGetSchemaProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SchemaService/GetSchema" + // SchemaServiceConvertMessageProcedure is the fully-qualified name of the SchemaService's + // ConvertMessage RPC. + SchemaServiceConvertMessageProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SchemaService/ConvertMessage" +) + +// SchemaServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SchemaService service. +type SchemaServiceClient interface { + // GetSchema allows the caller to download a schema for one or more requested + // types, RPC services, or RPC methods. + GetSchema(context.Context, *connect_go.Request[v1alpha1.GetSchemaRequest]) (*connect_go.Response[v1alpha1.GetSchemaResponse], error) + // ConvertMessage allows the caller to convert a given message data blob from + // one format to another by referring to a type schema for the blob. + ConvertMessage(context.Context, *connect_go.Request[v1alpha1.ConvertMessageRequest]) (*connect_go.Response[v1alpha1.ConvertMessageResponse], error) +} + +// NewSchemaServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SchemaService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewSchemaServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SchemaServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &schemaServiceClient{ + getSchema: connect_go.NewClient[v1alpha1.GetSchemaRequest, v1alpha1.GetSchemaResponse]( + httpClient, + baseURL+SchemaServiceGetSchemaProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + convertMessage: connect_go.NewClient[v1alpha1.ConvertMessageRequest, v1alpha1.ConvertMessageResponse]( + httpClient, + baseURL+SchemaServiceConvertMessageProcedure, + opts..., + ), + } +} + +// schemaServiceClient implements SchemaServiceClient. +type schemaServiceClient struct { + getSchema *connect_go.Client[v1alpha1.GetSchemaRequest, v1alpha1.GetSchemaResponse] + convertMessage *connect_go.Client[v1alpha1.ConvertMessageRequest, v1alpha1.ConvertMessageResponse] +} + +// GetSchema calls bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.GetSchema. +func (c *schemaServiceClient) GetSchema(ctx context.Context, req *connect_go.Request[v1alpha1.GetSchemaRequest]) (*connect_go.Response[v1alpha1.GetSchemaResponse], error) { + return c.getSchema.CallUnary(ctx, req) +} + +// ConvertMessage calls +// bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.ConvertMessage. +func (c *schemaServiceClient) ConvertMessage(ctx context.Context, req *connect_go.Request[v1alpha1.ConvertMessageRequest]) (*connect_go.Response[v1alpha1.ConvertMessageResponse], error) { + return c.convertMessage.CallUnary(ctx, req) +} + +// SchemaServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.SchemaService service. +type SchemaServiceHandler interface { + // GetSchema allows the caller to download a schema for one or more requested + // types, RPC services, or RPC methods. + GetSchema(context.Context, *connect_go.Request[v1alpha1.GetSchemaRequest]) (*connect_go.Response[v1alpha1.GetSchemaResponse], error) + // ConvertMessage allows the caller to convert a given message data blob from + // one format to another by referring to a type schema for the blob. + ConvertMessage(context.Context, *connect_go.Request[v1alpha1.ConvertMessageRequest]) (*connect_go.Response[v1alpha1.ConvertMessageResponse], error) +} + +// NewSchemaServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewSchemaServiceHandler(svc SchemaServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + schemaServiceGetSchemaHandler := connect_go.NewUnaryHandler( + SchemaServiceGetSchemaProcedure, + svc.GetSchema, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + schemaServiceConvertMessageHandler := connect_go.NewUnaryHandler( + SchemaServiceConvertMessageProcedure, + svc.ConvertMessage, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.SchemaService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SchemaServiceGetSchemaProcedure: + schemaServiceGetSchemaHandler.ServeHTTP(w, r) + case SchemaServiceConvertMessageProcedure: + schemaServiceConvertMessageHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSchemaServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSchemaServiceHandler struct{} + +func (UnimplementedSchemaServiceHandler) GetSchema(context.Context, *connect_go.Request[v1alpha1.GetSchemaRequest]) (*connect_go.Response[v1alpha1.GetSchemaResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.GetSchema is not implemented")) +} + +func (UnimplementedSchemaServiceHandler) ConvertMessage(context.Context, *connect_go.Request[v1alpha1.ConvertMessageRequest]) (*connect_go.Response[v1alpha1.ConvertMessageResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.ConvertMessage is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/scim_token.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/scim_token.connect.go new file mode 100644 index 000000000..c9ce0f779 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/scim_token.connect.go @@ -0,0 +1,202 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/scim_token.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // SCIMTokenServiceName is the fully-qualified name of the SCIMTokenService service. + SCIMTokenServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SCIMTokenServiceCreateSCIMTokenProcedure is the fully-qualified name of the SCIMTokenService's + // CreateSCIMToken RPC. + SCIMTokenServiceCreateSCIMTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/CreateSCIMToken" + // SCIMTokenServiceListSCIMTokensProcedure is the fully-qualified name of the SCIMTokenService's + // ListSCIMTokens RPC. + SCIMTokenServiceListSCIMTokensProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/ListSCIMTokens" + // SCIMTokenServiceDeleteSCIMTokenProcedure is the fully-qualified name of the SCIMTokenService's + // DeleteSCIMToken RPC. + SCIMTokenServiceDeleteSCIMTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/DeleteSCIMToken" +) + +// SCIMTokenServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService service. +type SCIMTokenServiceClient interface { + // CreateToken creates a new token suitable for authentication to the SCIM API. + // + // This method requires authentication. + CreateSCIMToken(context.Context, *connect_go.Request[v1alpha1.CreateSCIMTokenRequest]) (*connect_go.Response[v1alpha1.CreateSCIMTokenResponse], error) + // ListTokens lists all active SCIM tokens. + // + // This method requires authentication. + ListSCIMTokens(context.Context, *connect_go.Request[v1alpha1.ListSCIMTokensRequest]) (*connect_go.Response[v1alpha1.ListSCIMTokensResponse], error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteSCIMToken(context.Context, *connect_go.Request[v1alpha1.DeleteSCIMTokenRequest]) (*connect_go.Response[v1alpha1.DeleteSCIMTokenResponse], error) +} + +// NewSCIMTokenServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService service. By default, it uses +// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewSCIMTokenServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SCIMTokenServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &sCIMTokenServiceClient{ + createSCIMToken: connect_go.NewClient[v1alpha1.CreateSCIMTokenRequest, v1alpha1.CreateSCIMTokenResponse]( + httpClient, + baseURL+SCIMTokenServiceCreateSCIMTokenProcedure, + opts..., + ), + listSCIMTokens: connect_go.NewClient[v1alpha1.ListSCIMTokensRequest, v1alpha1.ListSCIMTokensResponse]( + httpClient, + baseURL+SCIMTokenServiceListSCIMTokensProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteSCIMToken: connect_go.NewClient[v1alpha1.DeleteSCIMTokenRequest, v1alpha1.DeleteSCIMTokenResponse]( + httpClient, + baseURL+SCIMTokenServiceDeleteSCIMTokenProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// sCIMTokenServiceClient implements SCIMTokenServiceClient. +type sCIMTokenServiceClient struct { + createSCIMToken *connect_go.Client[v1alpha1.CreateSCIMTokenRequest, v1alpha1.CreateSCIMTokenResponse] + listSCIMTokens *connect_go.Client[v1alpha1.ListSCIMTokensRequest, v1alpha1.ListSCIMTokensResponse] + deleteSCIMToken *connect_go.Client[v1alpha1.DeleteSCIMTokenRequest, v1alpha1.DeleteSCIMTokenResponse] +} + +// CreateSCIMToken calls +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.CreateSCIMToken. +func (c *sCIMTokenServiceClient) CreateSCIMToken(ctx context.Context, req *connect_go.Request[v1alpha1.CreateSCIMTokenRequest]) (*connect_go.Response[v1alpha1.CreateSCIMTokenResponse], error) { + return c.createSCIMToken.CallUnary(ctx, req) +} + +// ListSCIMTokens calls +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.ListSCIMTokens. +func (c *sCIMTokenServiceClient) ListSCIMTokens(ctx context.Context, req *connect_go.Request[v1alpha1.ListSCIMTokensRequest]) (*connect_go.Response[v1alpha1.ListSCIMTokensResponse], error) { + return c.listSCIMTokens.CallUnary(ctx, req) +} + +// DeleteSCIMToken calls +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.DeleteSCIMToken. +func (c *sCIMTokenServiceClient) DeleteSCIMToken(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteSCIMTokenRequest]) (*connect_go.Response[v1alpha1.DeleteSCIMTokenResponse], error) { + return c.deleteSCIMToken.CallUnary(ctx, req) +} + +// SCIMTokenServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService service. +type SCIMTokenServiceHandler interface { + // CreateToken creates a new token suitable for authentication to the SCIM API. + // + // This method requires authentication. + CreateSCIMToken(context.Context, *connect_go.Request[v1alpha1.CreateSCIMTokenRequest]) (*connect_go.Response[v1alpha1.CreateSCIMTokenResponse], error) + // ListTokens lists all active SCIM tokens. + // + // This method requires authentication. + ListSCIMTokens(context.Context, *connect_go.Request[v1alpha1.ListSCIMTokensRequest]) (*connect_go.Response[v1alpha1.ListSCIMTokensResponse], error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteSCIMToken(context.Context, *connect_go.Request[v1alpha1.DeleteSCIMTokenRequest]) (*connect_go.Response[v1alpha1.DeleteSCIMTokenResponse], error) +} + +// NewSCIMTokenServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewSCIMTokenServiceHandler(svc SCIMTokenServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + sCIMTokenServiceCreateSCIMTokenHandler := connect_go.NewUnaryHandler( + SCIMTokenServiceCreateSCIMTokenProcedure, + svc.CreateSCIMToken, + opts..., + ) + sCIMTokenServiceListSCIMTokensHandler := connect_go.NewUnaryHandler( + SCIMTokenServiceListSCIMTokensProcedure, + svc.ListSCIMTokens, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + sCIMTokenServiceDeleteSCIMTokenHandler := connect_go.NewUnaryHandler( + SCIMTokenServiceDeleteSCIMTokenProcedure, + svc.DeleteSCIMToken, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SCIMTokenServiceCreateSCIMTokenProcedure: + sCIMTokenServiceCreateSCIMTokenHandler.ServeHTTP(w, r) + case SCIMTokenServiceListSCIMTokensProcedure: + sCIMTokenServiceListSCIMTokensHandler.ServeHTTP(w, r) + case SCIMTokenServiceDeleteSCIMTokenProcedure: + sCIMTokenServiceDeleteSCIMTokenHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSCIMTokenServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSCIMTokenServiceHandler struct{} + +func (UnimplementedSCIMTokenServiceHandler) CreateSCIMToken(context.Context, *connect_go.Request[v1alpha1.CreateSCIMTokenRequest]) (*connect_go.Response[v1alpha1.CreateSCIMTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.CreateSCIMToken is not implemented")) +} + +func (UnimplementedSCIMTokenServiceHandler) ListSCIMTokens(context.Context, *connect_go.Request[v1alpha1.ListSCIMTokensRequest]) (*connect_go.Response[v1alpha1.ListSCIMTokensResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.ListSCIMTokens is not implemented")) +} + +func (UnimplementedSCIMTokenServiceHandler) DeleteSCIMToken(context.Context, *connect_go.Request[v1alpha1.DeleteSCIMTokenRequest]) (*connect_go.Response[v1alpha1.DeleteSCIMTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.DeleteSCIMToken is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/search.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/search.connect.go new file mode 100644 index 000000000..53bf6f395 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/search.connect.go @@ -0,0 +1,286 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/search.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // SearchServiceName is the fully-qualified name of the SearchService service. + SearchServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.SearchService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SearchServiceSearchUserProcedure is the fully-qualified name of the SearchService's SearchUser + // RPC. + SearchServiceSearchUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchUser" + // SearchServiceSearchRepositoryProcedure is the fully-qualified name of the SearchService's + // SearchRepository RPC. + SearchServiceSearchRepositoryProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchRepository" + // SearchServiceSearchLastCommitByContentProcedure is the fully-qualified name of the + // SearchService's SearchLastCommitByContent RPC. + SearchServiceSearchLastCommitByContentProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchLastCommitByContent" + // SearchServiceSearchCurationPluginProcedure is the fully-qualified name of the SearchService's + // SearchCurationPlugin RPC. + SearchServiceSearchCurationPluginProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchCurationPlugin" + // SearchServiceSearchTagProcedure is the fully-qualified name of the SearchService's SearchTag RPC. + SearchServiceSearchTagProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchTag" + // SearchServiceSearchDraftProcedure is the fully-qualified name of the SearchService's SearchDraft + // RPC. + SearchServiceSearchDraftProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchDraft" +) + +// SearchServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService service. +type SearchServiceClient interface { + // SearchUser searches users by username + SearchUser(context.Context, *connect_go.Request[v1alpha1.SearchUserRequest]) (*connect_go.Response[v1alpha1.SearchUserResponse], error) + // SearchRepository searches repositories by name or description + SearchRepository(context.Context, *connect_go.Request[v1alpha1.SearchRepositoryRequest]) (*connect_go.Response[v1alpha1.SearchRepositoryResponse], error) + // SearchCommitByContent searches last commit in same repo by idl content + // that means, for a repo, search results only record last matched commit + SearchLastCommitByContent(context.Context, *connect_go.Request[v1alpha1.SearchLastCommitByContentRequest]) (*connect_go.Response[v1alpha1.SearchLastCommitByContentResponse], error) + // SearchCurationPlugin search plugins by name or description + SearchCurationPlugin(context.Context, *connect_go.Request[v1alpha1.SearchCuratedPluginRequest]) (*connect_go.Response[v1alpha1.SearchCuratedPluginResponse], error) + // SearchTag searches for tags in a repository + SearchTag(context.Context, *connect_go.Request[v1alpha1.SearchTagRequest]) (*connect_go.Response[v1alpha1.SearchTagResponse], error) + // SearchDraft searches for drafts in a repository + SearchDraft(context.Context, *connect_go.Request[v1alpha1.SearchDraftRequest]) (*connect_go.Response[v1alpha1.SearchDraftResponse], error) +} + +// NewSearchServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewSearchServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SearchServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &searchServiceClient{ + searchUser: connect_go.NewClient[v1alpha1.SearchUserRequest, v1alpha1.SearchUserResponse]( + httpClient, + baseURL+SearchServiceSearchUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchRepository: connect_go.NewClient[v1alpha1.SearchRepositoryRequest, v1alpha1.SearchRepositoryResponse]( + httpClient, + baseURL+SearchServiceSearchRepositoryProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchLastCommitByContent: connect_go.NewClient[v1alpha1.SearchLastCommitByContentRequest, v1alpha1.SearchLastCommitByContentResponse]( + httpClient, + baseURL+SearchServiceSearchLastCommitByContentProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchCurationPlugin: connect_go.NewClient[v1alpha1.SearchCuratedPluginRequest, v1alpha1.SearchCuratedPluginResponse]( + httpClient, + baseURL+SearchServiceSearchCurationPluginProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchTag: connect_go.NewClient[v1alpha1.SearchTagRequest, v1alpha1.SearchTagResponse]( + httpClient, + baseURL+SearchServiceSearchTagProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + searchDraft: connect_go.NewClient[v1alpha1.SearchDraftRequest, v1alpha1.SearchDraftResponse]( + httpClient, + baseURL+SearchServiceSearchDraftProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// searchServiceClient implements SearchServiceClient. +type searchServiceClient struct { + searchUser *connect_go.Client[v1alpha1.SearchUserRequest, v1alpha1.SearchUserResponse] + searchRepository *connect_go.Client[v1alpha1.SearchRepositoryRequest, v1alpha1.SearchRepositoryResponse] + searchLastCommitByContent *connect_go.Client[v1alpha1.SearchLastCommitByContentRequest, v1alpha1.SearchLastCommitByContentResponse] + searchCurationPlugin *connect_go.Client[v1alpha1.SearchCuratedPluginRequest, v1alpha1.SearchCuratedPluginResponse] + searchTag *connect_go.Client[v1alpha1.SearchTagRequest, v1alpha1.SearchTagResponse] + searchDraft *connect_go.Client[v1alpha1.SearchDraftRequest, v1alpha1.SearchDraftResponse] +} + +// SearchUser calls bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchUser. +func (c *searchServiceClient) SearchUser(ctx context.Context, req *connect_go.Request[v1alpha1.SearchUserRequest]) (*connect_go.Response[v1alpha1.SearchUserResponse], error) { + return c.searchUser.CallUnary(ctx, req) +} + +// SearchRepository calls +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchRepository. +func (c *searchServiceClient) SearchRepository(ctx context.Context, req *connect_go.Request[v1alpha1.SearchRepositoryRequest]) (*connect_go.Response[v1alpha1.SearchRepositoryResponse], error) { + return c.searchRepository.CallUnary(ctx, req) +} + +// SearchLastCommitByContent calls +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchLastCommitByContent. +func (c *searchServiceClient) SearchLastCommitByContent(ctx context.Context, req *connect_go.Request[v1alpha1.SearchLastCommitByContentRequest]) (*connect_go.Response[v1alpha1.SearchLastCommitByContentResponse], error) { + return c.searchLastCommitByContent.CallUnary(ctx, req) +} + +// SearchCurationPlugin calls +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchCurationPlugin. +func (c *searchServiceClient) SearchCurationPlugin(ctx context.Context, req *connect_go.Request[v1alpha1.SearchCuratedPluginRequest]) (*connect_go.Response[v1alpha1.SearchCuratedPluginResponse], error) { + return c.searchCurationPlugin.CallUnary(ctx, req) +} + +// SearchTag calls bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchTag. +func (c *searchServiceClient) SearchTag(ctx context.Context, req *connect_go.Request[v1alpha1.SearchTagRequest]) (*connect_go.Response[v1alpha1.SearchTagResponse], error) { + return c.searchTag.CallUnary(ctx, req) +} + +// SearchDraft calls bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchDraft. +func (c *searchServiceClient) SearchDraft(ctx context.Context, req *connect_go.Request[v1alpha1.SearchDraftRequest]) (*connect_go.Response[v1alpha1.SearchDraftResponse], error) { + return c.searchDraft.CallUnary(ctx, req) +} + +// SearchServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.SearchService service. +type SearchServiceHandler interface { + // SearchUser searches users by username + SearchUser(context.Context, *connect_go.Request[v1alpha1.SearchUserRequest]) (*connect_go.Response[v1alpha1.SearchUserResponse], error) + // SearchRepository searches repositories by name or description + SearchRepository(context.Context, *connect_go.Request[v1alpha1.SearchRepositoryRequest]) (*connect_go.Response[v1alpha1.SearchRepositoryResponse], error) + // SearchCommitByContent searches last commit in same repo by idl content + // that means, for a repo, search results only record last matched commit + SearchLastCommitByContent(context.Context, *connect_go.Request[v1alpha1.SearchLastCommitByContentRequest]) (*connect_go.Response[v1alpha1.SearchLastCommitByContentResponse], error) + // SearchCurationPlugin search plugins by name or description + SearchCurationPlugin(context.Context, *connect_go.Request[v1alpha1.SearchCuratedPluginRequest]) (*connect_go.Response[v1alpha1.SearchCuratedPluginResponse], error) + // SearchTag searches for tags in a repository + SearchTag(context.Context, *connect_go.Request[v1alpha1.SearchTagRequest]) (*connect_go.Response[v1alpha1.SearchTagResponse], error) + // SearchDraft searches for drafts in a repository + SearchDraft(context.Context, *connect_go.Request[v1alpha1.SearchDraftRequest]) (*connect_go.Response[v1alpha1.SearchDraftResponse], error) +} + +// NewSearchServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewSearchServiceHandler(svc SearchServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + searchServiceSearchUserHandler := connect_go.NewUnaryHandler( + SearchServiceSearchUserProcedure, + svc.SearchUser, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchRepositoryHandler := connect_go.NewUnaryHandler( + SearchServiceSearchRepositoryProcedure, + svc.SearchRepository, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchLastCommitByContentHandler := connect_go.NewUnaryHandler( + SearchServiceSearchLastCommitByContentProcedure, + svc.SearchLastCommitByContent, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchCurationPluginHandler := connect_go.NewUnaryHandler( + SearchServiceSearchCurationPluginProcedure, + svc.SearchCurationPlugin, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchTagHandler := connect_go.NewUnaryHandler( + SearchServiceSearchTagProcedure, + svc.SearchTag, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + searchServiceSearchDraftHandler := connect_go.NewUnaryHandler( + SearchServiceSearchDraftProcedure, + svc.SearchDraft, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SearchServiceSearchUserProcedure: + searchServiceSearchUserHandler.ServeHTTP(w, r) + case SearchServiceSearchRepositoryProcedure: + searchServiceSearchRepositoryHandler.ServeHTTP(w, r) + case SearchServiceSearchLastCommitByContentProcedure: + searchServiceSearchLastCommitByContentHandler.ServeHTTP(w, r) + case SearchServiceSearchCurationPluginProcedure: + searchServiceSearchCurationPluginHandler.ServeHTTP(w, r) + case SearchServiceSearchTagProcedure: + searchServiceSearchTagHandler.ServeHTTP(w, r) + case SearchServiceSearchDraftProcedure: + searchServiceSearchDraftHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSearchServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSearchServiceHandler struct{} + +func (UnimplementedSearchServiceHandler) SearchUser(context.Context, *connect_go.Request[v1alpha1.SearchUserRequest]) (*connect_go.Response[v1alpha1.SearchUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchUser is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchRepository(context.Context, *connect_go.Request[v1alpha1.SearchRepositoryRequest]) (*connect_go.Response[v1alpha1.SearchRepositoryResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchRepository is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchLastCommitByContent(context.Context, *connect_go.Request[v1alpha1.SearchLastCommitByContentRequest]) (*connect_go.Response[v1alpha1.SearchLastCommitByContentResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchLastCommitByContent is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchCurationPlugin(context.Context, *connect_go.Request[v1alpha1.SearchCuratedPluginRequest]) (*connect_go.Response[v1alpha1.SearchCuratedPluginResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchCurationPlugin is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchTag(context.Context, *connect_go.Request[v1alpha1.SearchTagRequest]) (*connect_go.Response[v1alpha1.SearchTagResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchTag is not implemented")) +} + +func (UnimplementedSearchServiceHandler) SearchDraft(context.Context, *connect_go.Request[v1alpha1.SearchDraftRequest]) (*connect_go.Response[v1alpha1.SearchDraftResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchDraft is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/studio.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/studio.connect.go new file mode 100644 index 000000000..aed38a1bb --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/studio.connect.go @@ -0,0 +1,158 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/studio.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // StudioServiceName is the fully-qualified name of the StudioService service. + StudioServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.StudioService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // StudioServiceListStudioAgentPresetsProcedure is the fully-qualified name of the StudioService's + // ListStudioAgentPresets RPC. + StudioServiceListStudioAgentPresetsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioService/ListStudioAgentPresets" + // StudioServiceSetStudioAgentPresetsProcedure is the fully-qualified name of the StudioService's + // SetStudioAgentPresets RPC. + StudioServiceSetStudioAgentPresetsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioService/SetStudioAgentPresets" +) + +// StudioServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService service. +type StudioServiceClient interface { + // ListStudioAgentPresets returns a list of agent presets in the server. + ListStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.ListStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.ListStudioAgentPresetsResponse], error) + // SetStudioAgentPresets sets the list of agent presets in the server. + SetStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.SetStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.SetStudioAgentPresetsResponse], error) +} + +// NewStudioServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewStudioServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) StudioServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &studioServiceClient{ + listStudioAgentPresets: connect_go.NewClient[v1alpha1.ListStudioAgentPresetsRequest, v1alpha1.ListStudioAgentPresetsResponse]( + httpClient, + baseURL+StudioServiceListStudioAgentPresetsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + setStudioAgentPresets: connect_go.NewClient[v1alpha1.SetStudioAgentPresetsRequest, v1alpha1.SetStudioAgentPresetsResponse]( + httpClient, + baseURL+StudioServiceSetStudioAgentPresetsProcedure, + opts..., + ), + } +} + +// studioServiceClient implements StudioServiceClient. +type studioServiceClient struct { + listStudioAgentPresets *connect_go.Client[v1alpha1.ListStudioAgentPresetsRequest, v1alpha1.ListStudioAgentPresetsResponse] + setStudioAgentPresets *connect_go.Client[v1alpha1.SetStudioAgentPresetsRequest, v1alpha1.SetStudioAgentPresetsResponse] +} + +// ListStudioAgentPresets calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService.ListStudioAgentPresets. +func (c *studioServiceClient) ListStudioAgentPresets(ctx context.Context, req *connect_go.Request[v1alpha1.ListStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.ListStudioAgentPresetsResponse], error) { + return c.listStudioAgentPresets.CallUnary(ctx, req) +} + +// SetStudioAgentPresets calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService.SetStudioAgentPresets. +func (c *studioServiceClient) SetStudioAgentPresets(ctx context.Context, req *connect_go.Request[v1alpha1.SetStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.SetStudioAgentPresetsResponse], error) { + return c.setStudioAgentPresets.CallUnary(ctx, req) +} + +// StudioServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioService service. +type StudioServiceHandler interface { + // ListStudioAgentPresets returns a list of agent presets in the server. + ListStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.ListStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.ListStudioAgentPresetsResponse], error) + // SetStudioAgentPresets sets the list of agent presets in the server. + SetStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.SetStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.SetStudioAgentPresetsResponse], error) +} + +// NewStudioServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewStudioServiceHandler(svc StudioServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + studioServiceListStudioAgentPresetsHandler := connect_go.NewUnaryHandler( + StudioServiceListStudioAgentPresetsProcedure, + svc.ListStudioAgentPresets, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + studioServiceSetStudioAgentPresetsHandler := connect_go.NewUnaryHandler( + StudioServiceSetStudioAgentPresetsProcedure, + svc.SetStudioAgentPresets, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.StudioService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case StudioServiceListStudioAgentPresetsProcedure: + studioServiceListStudioAgentPresetsHandler.ServeHTTP(w, r) + case StudioServiceSetStudioAgentPresetsProcedure: + studioServiceSetStudioAgentPresetsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedStudioServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedStudioServiceHandler struct{} + +func (UnimplementedStudioServiceHandler) ListStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.ListStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.ListStudioAgentPresetsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioService.ListStudioAgentPresets is not implemented")) +} + +func (UnimplementedStudioServiceHandler) SetStudioAgentPresets(context.Context, *connect_go.Request[v1alpha1.SetStudioAgentPresetsRequest]) (*connect_go.Response[v1alpha1.SetStudioAgentPresetsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioService.SetStudioAgentPresets is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/studio_request.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/studio_request.connect.go new file mode 100644 index 000000000..6ef3d2db8 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/studio_request.connect.go @@ -0,0 +1,224 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/studio_request.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // StudioRequestServiceName is the fully-qualified name of the StudioRequestService service. + StudioRequestServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // StudioRequestServiceCreateStudioRequestProcedure is the fully-qualified name of the + // StudioRequestService's CreateStudioRequest RPC. + StudioRequestServiceCreateStudioRequestProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/CreateStudioRequest" + // StudioRequestServiceRenameStudioRequestProcedure is the fully-qualified name of the + // StudioRequestService's RenameStudioRequest RPC. + StudioRequestServiceRenameStudioRequestProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/RenameStudioRequest" + // StudioRequestServiceDeleteStudioRequestProcedure is the fully-qualified name of the + // StudioRequestService's DeleteStudioRequest RPC. + StudioRequestServiceDeleteStudioRequestProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/DeleteStudioRequest" + // StudioRequestServiceListStudioRequestsProcedure is the fully-qualified name of the + // StudioRequestService's ListStudioRequests RPC. + StudioRequestServiceListStudioRequestsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/ListStudioRequests" +) + +// StudioRequestServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService service. +type StudioRequestServiceClient interface { + // CreateStudioRequest registers a favorite Studio Requests to the caller's + // BSR profile. + CreateStudioRequest(context.Context, *connect_go.Request[v1alpha1.CreateStudioRequestRequest]) (*connect_go.Response[v1alpha1.CreateStudioRequestResponse], error) + // RenameStudioRequest renames an existing Studio Request. + RenameStudioRequest(context.Context, *connect_go.Request[v1alpha1.RenameStudioRequestRequest]) (*connect_go.Response[v1alpha1.RenameStudioRequestResponse], error) + // DeleteStudioRequest removes a favorite Studio Request from the caller's BSR + // profile. + DeleteStudioRequest(context.Context, *connect_go.Request[v1alpha1.DeleteStudioRequestRequest]) (*connect_go.Response[v1alpha1.DeleteStudioRequestResponse], error) + // ListStudioRequests shows the caller's favorited Studio Requests. + ListStudioRequests(context.Context, *connect_go.Request[v1alpha1.ListStudioRequestsRequest]) (*connect_go.Response[v1alpha1.ListStudioRequestsResponse], error) +} + +// NewStudioRequestServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewStudioRequestServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) StudioRequestServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &studioRequestServiceClient{ + createStudioRequest: connect_go.NewClient[v1alpha1.CreateStudioRequestRequest, v1alpha1.CreateStudioRequestResponse]( + httpClient, + baseURL+StudioRequestServiceCreateStudioRequestProcedure, + opts..., + ), + renameStudioRequest: connect_go.NewClient[v1alpha1.RenameStudioRequestRequest, v1alpha1.RenameStudioRequestResponse]( + httpClient, + baseURL+StudioRequestServiceRenameStudioRequestProcedure, + opts..., + ), + deleteStudioRequest: connect_go.NewClient[v1alpha1.DeleteStudioRequestRequest, v1alpha1.DeleteStudioRequestResponse]( + httpClient, + baseURL+StudioRequestServiceDeleteStudioRequestProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + listStudioRequests: connect_go.NewClient[v1alpha1.ListStudioRequestsRequest, v1alpha1.ListStudioRequestsResponse]( + httpClient, + baseURL+StudioRequestServiceListStudioRequestsProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// studioRequestServiceClient implements StudioRequestServiceClient. +type studioRequestServiceClient struct { + createStudioRequest *connect_go.Client[v1alpha1.CreateStudioRequestRequest, v1alpha1.CreateStudioRequestResponse] + renameStudioRequest *connect_go.Client[v1alpha1.RenameStudioRequestRequest, v1alpha1.RenameStudioRequestResponse] + deleteStudioRequest *connect_go.Client[v1alpha1.DeleteStudioRequestRequest, v1alpha1.DeleteStudioRequestResponse] + listStudioRequests *connect_go.Client[v1alpha1.ListStudioRequestsRequest, v1alpha1.ListStudioRequestsResponse] +} + +// CreateStudioRequest calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.CreateStudioRequest. +func (c *studioRequestServiceClient) CreateStudioRequest(ctx context.Context, req *connect_go.Request[v1alpha1.CreateStudioRequestRequest]) (*connect_go.Response[v1alpha1.CreateStudioRequestResponse], error) { + return c.createStudioRequest.CallUnary(ctx, req) +} + +// RenameStudioRequest calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.RenameStudioRequest. +func (c *studioRequestServiceClient) RenameStudioRequest(ctx context.Context, req *connect_go.Request[v1alpha1.RenameStudioRequestRequest]) (*connect_go.Response[v1alpha1.RenameStudioRequestResponse], error) { + return c.renameStudioRequest.CallUnary(ctx, req) +} + +// DeleteStudioRequest calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.DeleteStudioRequest. +func (c *studioRequestServiceClient) DeleteStudioRequest(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteStudioRequestRequest]) (*connect_go.Response[v1alpha1.DeleteStudioRequestResponse], error) { + return c.deleteStudioRequest.CallUnary(ctx, req) +} + +// ListStudioRequests calls +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.ListStudioRequests. +func (c *studioRequestServiceClient) ListStudioRequests(ctx context.Context, req *connect_go.Request[v1alpha1.ListStudioRequestsRequest]) (*connect_go.Response[v1alpha1.ListStudioRequestsResponse], error) { + return c.listStudioRequests.CallUnary(ctx, req) +} + +// StudioRequestServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService service. +type StudioRequestServiceHandler interface { + // CreateStudioRequest registers a favorite Studio Requests to the caller's + // BSR profile. + CreateStudioRequest(context.Context, *connect_go.Request[v1alpha1.CreateStudioRequestRequest]) (*connect_go.Response[v1alpha1.CreateStudioRequestResponse], error) + // RenameStudioRequest renames an existing Studio Request. + RenameStudioRequest(context.Context, *connect_go.Request[v1alpha1.RenameStudioRequestRequest]) (*connect_go.Response[v1alpha1.RenameStudioRequestResponse], error) + // DeleteStudioRequest removes a favorite Studio Request from the caller's BSR + // profile. + DeleteStudioRequest(context.Context, *connect_go.Request[v1alpha1.DeleteStudioRequestRequest]) (*connect_go.Response[v1alpha1.DeleteStudioRequestResponse], error) + // ListStudioRequests shows the caller's favorited Studio Requests. + ListStudioRequests(context.Context, *connect_go.Request[v1alpha1.ListStudioRequestsRequest]) (*connect_go.Response[v1alpha1.ListStudioRequestsResponse], error) +} + +// NewStudioRequestServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewStudioRequestServiceHandler(svc StudioRequestServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + studioRequestServiceCreateStudioRequestHandler := connect_go.NewUnaryHandler( + StudioRequestServiceCreateStudioRequestProcedure, + svc.CreateStudioRequest, + opts..., + ) + studioRequestServiceRenameStudioRequestHandler := connect_go.NewUnaryHandler( + StudioRequestServiceRenameStudioRequestProcedure, + svc.RenameStudioRequest, + opts..., + ) + studioRequestServiceDeleteStudioRequestHandler := connect_go.NewUnaryHandler( + StudioRequestServiceDeleteStudioRequestProcedure, + svc.DeleteStudioRequest, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + studioRequestServiceListStudioRequestsHandler := connect_go.NewUnaryHandler( + StudioRequestServiceListStudioRequestsProcedure, + svc.ListStudioRequests, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case StudioRequestServiceCreateStudioRequestProcedure: + studioRequestServiceCreateStudioRequestHandler.ServeHTTP(w, r) + case StudioRequestServiceRenameStudioRequestProcedure: + studioRequestServiceRenameStudioRequestHandler.ServeHTTP(w, r) + case StudioRequestServiceDeleteStudioRequestProcedure: + studioRequestServiceDeleteStudioRequestHandler.ServeHTTP(w, r) + case StudioRequestServiceListStudioRequestsProcedure: + studioRequestServiceListStudioRequestsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedStudioRequestServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedStudioRequestServiceHandler struct{} + +func (UnimplementedStudioRequestServiceHandler) CreateStudioRequest(context.Context, *connect_go.Request[v1alpha1.CreateStudioRequestRequest]) (*connect_go.Response[v1alpha1.CreateStudioRequestResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.CreateStudioRequest is not implemented")) +} + +func (UnimplementedStudioRequestServiceHandler) RenameStudioRequest(context.Context, *connect_go.Request[v1alpha1.RenameStudioRequestRequest]) (*connect_go.Response[v1alpha1.RenameStudioRequestResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.RenameStudioRequest is not implemented")) +} + +func (UnimplementedStudioRequestServiceHandler) DeleteStudioRequest(context.Context, *connect_go.Request[v1alpha1.DeleteStudioRequestRequest]) (*connect_go.Response[v1alpha1.DeleteStudioRequestResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.DeleteStudioRequest is not implemented")) +} + +func (UnimplementedStudioRequestServiceHandler) ListStudioRequests(context.Context, *connect_go.Request[v1alpha1.ListStudioRequestsRequest]) (*connect_go.Response[v1alpha1.ListStudioRequestsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.ListStudioRequests is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/sync.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/sync.connect.go new file mode 100644 index 000000000..23a7a212a --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/sync.connect.go @@ -0,0 +1,161 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/sync.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // SyncServiceName is the fully-qualified name of the SyncService service. + SyncServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.SyncService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SyncServiceGetGitSyncPointProcedure is the fully-qualified name of the SyncService's + // GetGitSyncPoint RPC. + SyncServiceGetGitSyncPointProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SyncService/GetGitSyncPoint" + // SyncServiceSyncGitCommitProcedure is the fully-qualified name of the SyncService's SyncGitCommit + // RPC. + SyncServiceSyncGitCommitProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.SyncService/SyncGitCommit" +) + +// SyncServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SyncService service. +type SyncServiceClient interface { + // GetGitSyncPoint retrieves the Git sync point for the named repository + // on the specified branch. + GetGitSyncPoint(context.Context, *connect_go.Request[v1alpha1.GetGitSyncPointRequest]) (*connect_go.Response[v1alpha1.GetGitSyncPointResponse], error) + // SyncGitCommit syncs a Git commit containing a module to a named repository. + SyncGitCommit(context.Context, *connect_go.Request[v1alpha1.SyncGitCommitRequest]) (*connect_go.Response[v1alpha1.SyncGitCommitResponse], error) +} + +// NewSyncServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.SyncService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewSyncServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SyncServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &syncServiceClient{ + getGitSyncPoint: connect_go.NewClient[v1alpha1.GetGitSyncPointRequest, v1alpha1.GetGitSyncPointResponse]( + httpClient, + baseURL+SyncServiceGetGitSyncPointProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + syncGitCommit: connect_go.NewClient[v1alpha1.SyncGitCommitRequest, v1alpha1.SyncGitCommitResponse]( + httpClient, + baseURL+SyncServiceSyncGitCommitProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// syncServiceClient implements SyncServiceClient. +type syncServiceClient struct { + getGitSyncPoint *connect_go.Client[v1alpha1.GetGitSyncPointRequest, v1alpha1.GetGitSyncPointResponse] + syncGitCommit *connect_go.Client[v1alpha1.SyncGitCommitRequest, v1alpha1.SyncGitCommitResponse] +} + +// GetGitSyncPoint calls +// bufman.dubbo.apache.org.registry.v1alpha1.SyncService.GetGitSyncPoint. +func (c *syncServiceClient) GetGitSyncPoint(ctx context.Context, req *connect_go.Request[v1alpha1.GetGitSyncPointRequest]) (*connect_go.Response[v1alpha1.GetGitSyncPointResponse], error) { + return c.getGitSyncPoint.CallUnary(ctx, req) +} + +// SyncGitCommit calls bufman.dubbo.apache.org.registry.v1alpha1.SyncService.SyncGitCommit. +func (c *syncServiceClient) SyncGitCommit(ctx context.Context, req *connect_go.Request[v1alpha1.SyncGitCommitRequest]) (*connect_go.Response[v1alpha1.SyncGitCommitResponse], error) { + return c.syncGitCommit.CallUnary(ctx, req) +} + +// SyncServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.SyncService service. +type SyncServiceHandler interface { + // GetGitSyncPoint retrieves the Git sync point for the named repository + // on the specified branch. + GetGitSyncPoint(context.Context, *connect_go.Request[v1alpha1.GetGitSyncPointRequest]) (*connect_go.Response[v1alpha1.GetGitSyncPointResponse], error) + // SyncGitCommit syncs a Git commit containing a module to a named repository. + SyncGitCommit(context.Context, *connect_go.Request[v1alpha1.SyncGitCommitRequest]) (*connect_go.Response[v1alpha1.SyncGitCommitResponse], error) +} + +// NewSyncServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewSyncServiceHandler(svc SyncServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + syncServiceGetGitSyncPointHandler := connect_go.NewUnaryHandler( + SyncServiceGetGitSyncPointProcedure, + svc.GetGitSyncPoint, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + syncServiceSyncGitCommitHandler := connect_go.NewUnaryHandler( + SyncServiceSyncGitCommitProcedure, + svc.SyncGitCommit, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.SyncService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SyncServiceGetGitSyncPointProcedure: + syncServiceGetGitSyncPointHandler.ServeHTTP(w, r) + case SyncServiceSyncGitCommitProcedure: + syncServiceSyncGitCommitHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSyncServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSyncServiceHandler struct{} + +func (UnimplementedSyncServiceHandler) GetGitSyncPoint(context.Context, *connect_go.Request[v1alpha1.GetGitSyncPointRequest]) (*connect_go.Response[v1alpha1.GetGitSyncPointResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SyncService.GetGitSyncPoint is not implemented")) +} + +func (UnimplementedSyncServiceHandler) SyncGitCommit(context.Context, *connect_go.Request[v1alpha1.SyncGitCommitRequest]) (*connect_go.Response[v1alpha1.SyncGitCommitResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.SyncService.SyncGitCommit is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/token.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/token.connect.go new file mode 100644 index 000000000..f3b4d3c5a --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/token.connect.go @@ -0,0 +1,228 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/token.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // TokenServiceName is the fully-qualified name of the TokenService service. + TokenServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.TokenService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // TokenServiceCreateTokenProcedure is the fully-qualified name of the TokenService's CreateToken + // RPC. + TokenServiceCreateTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/CreateToken" + // TokenServiceGetTokenProcedure is the fully-qualified name of the TokenService's GetToken RPC. + TokenServiceGetTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/GetToken" + // TokenServiceListTokensProcedure is the fully-qualified name of the TokenService's ListTokens RPC. + TokenServiceListTokensProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/ListTokens" + // TokenServiceDeleteTokenProcedure is the fully-qualified name of the TokenService's DeleteToken + // RPC. + TokenServiceDeleteTokenProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/DeleteToken" +) + +// TokenServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.TokenService service. +type TokenServiceClient interface { + // CreateToken creates a new token suitable for machine-to-machine authentication. + CreateToken(context.Context, *connect_go.Request[v1alpha1.CreateTokenRequest]) (*connect_go.Response[v1alpha1.CreateTokenResponse], error) + // GetToken gets the specific token for the user + // + // This method requires authentication. + GetToken(context.Context, *connect_go.Request[v1alpha1.GetTokenRequest]) (*connect_go.Response[v1alpha1.GetTokenResponse], error) + // ListTokens lists the users active tokens + // + // This method requires authentication. + ListTokens(context.Context, *connect_go.Request[v1alpha1.ListTokensRequest]) (*connect_go.Response[v1alpha1.ListTokensResponse], error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteToken(context.Context, *connect_go.Request[v1alpha1.DeleteTokenRequest]) (*connect_go.Response[v1alpha1.DeleteTokenResponse], error) +} + +// NewTokenServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.TokenService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewTokenServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) TokenServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &tokenServiceClient{ + createToken: connect_go.NewClient[v1alpha1.CreateTokenRequest, v1alpha1.CreateTokenResponse]( + httpClient, + baseURL+TokenServiceCreateTokenProcedure, + opts..., + ), + getToken: connect_go.NewClient[v1alpha1.GetTokenRequest, v1alpha1.GetTokenResponse]( + httpClient, + baseURL+TokenServiceGetTokenProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listTokens: connect_go.NewClient[v1alpha1.ListTokensRequest, v1alpha1.ListTokensResponse]( + httpClient, + baseURL+TokenServiceListTokensProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteToken: connect_go.NewClient[v1alpha1.DeleteTokenRequest, v1alpha1.DeleteTokenResponse]( + httpClient, + baseURL+TokenServiceDeleteTokenProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + } +} + +// tokenServiceClient implements TokenServiceClient. +type tokenServiceClient struct { + createToken *connect_go.Client[v1alpha1.CreateTokenRequest, v1alpha1.CreateTokenResponse] + getToken *connect_go.Client[v1alpha1.GetTokenRequest, v1alpha1.GetTokenResponse] + listTokens *connect_go.Client[v1alpha1.ListTokensRequest, v1alpha1.ListTokensResponse] + deleteToken *connect_go.Client[v1alpha1.DeleteTokenRequest, v1alpha1.DeleteTokenResponse] +} + +// CreateToken calls bufman.dubbo.apache.org.registry.v1alpha1.TokenService.CreateToken. +func (c *tokenServiceClient) CreateToken(ctx context.Context, req *connect_go.Request[v1alpha1.CreateTokenRequest]) (*connect_go.Response[v1alpha1.CreateTokenResponse], error) { + return c.createToken.CallUnary(ctx, req) +} + +// GetToken calls bufman.dubbo.apache.org.registry.v1alpha1.TokenService.GetToken. +func (c *tokenServiceClient) GetToken(ctx context.Context, req *connect_go.Request[v1alpha1.GetTokenRequest]) (*connect_go.Response[v1alpha1.GetTokenResponse], error) { + return c.getToken.CallUnary(ctx, req) +} + +// ListTokens calls bufman.dubbo.apache.org.registry.v1alpha1.TokenService.ListTokens. +func (c *tokenServiceClient) ListTokens(ctx context.Context, req *connect_go.Request[v1alpha1.ListTokensRequest]) (*connect_go.Response[v1alpha1.ListTokensResponse], error) { + return c.listTokens.CallUnary(ctx, req) +} + +// DeleteToken calls bufman.dubbo.apache.org.registry.v1alpha1.TokenService.DeleteToken. +func (c *tokenServiceClient) DeleteToken(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteTokenRequest]) (*connect_go.Response[v1alpha1.DeleteTokenResponse], error) { + return c.deleteToken.CallUnary(ctx, req) +} + +// TokenServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.TokenService service. +type TokenServiceHandler interface { + // CreateToken creates a new token suitable for machine-to-machine authentication. + CreateToken(context.Context, *connect_go.Request[v1alpha1.CreateTokenRequest]) (*connect_go.Response[v1alpha1.CreateTokenResponse], error) + // GetToken gets the specific token for the user + // + // This method requires authentication. + GetToken(context.Context, *connect_go.Request[v1alpha1.GetTokenRequest]) (*connect_go.Response[v1alpha1.GetTokenResponse], error) + // ListTokens lists the users active tokens + // + // This method requires authentication. + ListTokens(context.Context, *connect_go.Request[v1alpha1.ListTokensRequest]) (*connect_go.Response[v1alpha1.ListTokensResponse], error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteToken(context.Context, *connect_go.Request[v1alpha1.DeleteTokenRequest]) (*connect_go.Response[v1alpha1.DeleteTokenResponse], error) +} + +// NewTokenServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewTokenServiceHandler(svc TokenServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + tokenServiceCreateTokenHandler := connect_go.NewUnaryHandler( + TokenServiceCreateTokenProcedure, + svc.CreateToken, + opts..., + ) + tokenServiceGetTokenHandler := connect_go.NewUnaryHandler( + TokenServiceGetTokenProcedure, + svc.GetToken, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + tokenServiceListTokensHandler := connect_go.NewUnaryHandler( + TokenServiceListTokensProcedure, + svc.ListTokens, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + tokenServiceDeleteTokenHandler := connect_go.NewUnaryHandler( + TokenServiceDeleteTokenProcedure, + svc.DeleteToken, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case TokenServiceCreateTokenProcedure: + tokenServiceCreateTokenHandler.ServeHTTP(w, r) + case TokenServiceGetTokenProcedure: + tokenServiceGetTokenHandler.ServeHTTP(w, r) + case TokenServiceListTokensProcedure: + tokenServiceListTokensHandler.ServeHTTP(w, r) + case TokenServiceDeleteTokenProcedure: + tokenServiceDeleteTokenHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedTokenServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedTokenServiceHandler struct{} + +func (UnimplementedTokenServiceHandler) CreateToken(context.Context, *connect_go.Request[v1alpha1.CreateTokenRequest]) (*connect_go.Response[v1alpha1.CreateTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.TokenService.CreateToken is not implemented")) +} + +func (UnimplementedTokenServiceHandler) GetToken(context.Context, *connect_go.Request[v1alpha1.GetTokenRequest]) (*connect_go.Response[v1alpha1.GetTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.TokenService.GetToken is not implemented")) +} + +func (UnimplementedTokenServiceHandler) ListTokens(context.Context, *connect_go.Request[v1alpha1.ListTokensRequest]) (*connect_go.Response[v1alpha1.ListTokensResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.TokenService.ListTokens is not implemented")) +} + +func (UnimplementedTokenServiceHandler) DeleteToken(context.Context, *connect_go.Request[v1alpha1.DeleteTokenRequest]) (*connect_go.Response[v1alpha1.DeleteTokenResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.TokenService.DeleteToken is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/user.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/user.connect.go new file mode 100644 index 000000000..19903b2eb --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/user.connect.go @@ -0,0 +1,404 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/user.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // UserServiceName is the fully-qualified name of the UserService service. + UserServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.UserService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // UserServiceCreateUserProcedure is the fully-qualified name of the UserService's CreateUser RPC. + UserServiceCreateUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/CreateUser" + // UserServiceGetUserProcedure is the fully-qualified name of the UserService's GetUser RPC. + UserServiceGetUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/GetUser" + // UserServiceGetUserByUsernameProcedure is the fully-qualified name of the UserService's + // GetUserByUsername RPC. + UserServiceGetUserByUsernameProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/GetUserByUsername" + // UserServiceListUsersProcedure is the fully-qualified name of the UserService's ListUsers RPC. + UserServiceListUsersProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/ListUsers" + // UserServiceListOrganizationUsersProcedure is the fully-qualified name of the UserService's + // ListOrganizationUsers RPC. + UserServiceListOrganizationUsersProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/ListOrganizationUsers" + // UserServiceDeleteUserProcedure is the fully-qualified name of the UserService's DeleteUser RPC. + UserServiceDeleteUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/DeleteUser" + // UserServiceDeactivateUserProcedure is the fully-qualified name of the UserService's + // DeactivateUser RPC. + UserServiceDeactivateUserProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/DeactivateUser" + // UserServiceUpdateUserServerRoleProcedure is the fully-qualified name of the UserService's + // UpdateUserServerRole RPC. + UserServiceUpdateUserServerRoleProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/UpdateUserServerRole" + // UserServiceCountUsersProcedure is the fully-qualified name of the UserService's CountUsers RPC. + UserServiceCountUsersProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/CountUsers" + // UserServiceUpdateUserSettingsProcedure is the fully-qualified name of the UserService's + // UpdateUserSettings RPC. + UserServiceUpdateUserSettingsProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/UpdateUserSettings" +) + +// UserServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.UserService service. +type UserServiceClient interface { + // CreateUser creates a new user with the given username. + CreateUser(context.Context, *connect_go.Request[v1alpha1.CreateUserRequest]) (*connect_go.Response[v1alpha1.CreateUserResponse], error) + // GetUser gets a user by ID. + GetUser(context.Context, *connect_go.Request[v1alpha1.GetUserRequest]) (*connect_go.Response[v1alpha1.GetUserResponse], error) + // GetUserByUsername gets a user by username. + GetUserByUsername(context.Context, *connect_go.Request[v1alpha1.GetUserByUsernameRequest]) (*connect_go.Response[v1alpha1.GetUserByUsernameResponse], error) + // ListUsers lists all users. + ListUsers(context.Context, *connect_go.Request[v1alpha1.ListUsersRequest]) (*connect_go.Response[v1alpha1.ListUsersResponse], error) + // ListOrganizationUsers lists all users for an organization. + // TODO: #663 move this to organization service + ListOrganizationUsers(context.Context, *connect_go.Request[v1alpha1.ListOrganizationUsersRequest]) (*connect_go.Response[v1alpha1.ListOrganizationUsersResponse], error) + // DeleteUser deletes a user. + DeleteUser(context.Context, *connect_go.Request[v1alpha1.DeleteUserRequest]) (*connect_go.Response[v1alpha1.DeleteUserResponse], error) + // Deactivate user deactivates a user. + DeactivateUser(context.Context, *connect_go.Request[v1alpha1.DeactivateUserRequest]) (*connect_go.Response[v1alpha1.DeactivateUserResponse], error) + // UpdateUserServerRole update the role of an user in the server. + UpdateUserServerRole(context.Context, *connect_go.Request[v1alpha1.UpdateUserServerRoleRequest]) (*connect_go.Response[v1alpha1.UpdateUserServerRoleResponse], error) + // CountUsers returns the number of users in the server by the user state provided. + CountUsers(context.Context, *connect_go.Request[v1alpha1.CountUsersRequest]) (*connect_go.Response[v1alpha1.CountUsersResponse], error) + // UpdateUserSettings update the user settings including description. + UpdateUserSettings(context.Context, *connect_go.Request[v1alpha1.UpdateUserSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateUserSettingsResponse], error) +} + +// NewUserServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.UserService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewUserServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) UserServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &userServiceClient{ + createUser: connect_go.NewClient[v1alpha1.CreateUserRequest, v1alpha1.CreateUserResponse]( + httpClient, + baseURL+UserServiceCreateUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + getUser: connect_go.NewClient[v1alpha1.GetUserRequest, v1alpha1.GetUserResponse]( + httpClient, + baseURL+UserServiceGetUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + getUserByUsername: connect_go.NewClient[v1alpha1.GetUserByUsernameRequest, v1alpha1.GetUserByUsernameResponse]( + httpClient, + baseURL+UserServiceGetUserByUsernameProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listUsers: connect_go.NewClient[v1alpha1.ListUsersRequest, v1alpha1.ListUsersResponse]( + httpClient, + baseURL+UserServiceListUsersProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + listOrganizationUsers: connect_go.NewClient[v1alpha1.ListOrganizationUsersRequest, v1alpha1.ListOrganizationUsersResponse]( + httpClient, + baseURL+UserServiceListOrganizationUsersProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + deleteUser: connect_go.NewClient[v1alpha1.DeleteUserRequest, v1alpha1.DeleteUserResponse]( + httpClient, + baseURL+UserServiceDeleteUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deactivateUser: connect_go.NewClient[v1alpha1.DeactivateUserRequest, v1alpha1.DeactivateUserResponse]( + httpClient, + baseURL+UserServiceDeactivateUserProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + updateUserServerRole: connect_go.NewClient[v1alpha1.UpdateUserServerRoleRequest, v1alpha1.UpdateUserServerRoleResponse]( + httpClient, + baseURL+UserServiceUpdateUserServerRoleProcedure, + opts..., + ), + countUsers: connect_go.NewClient[v1alpha1.CountUsersRequest, v1alpha1.CountUsersResponse]( + httpClient, + baseURL+UserServiceCountUsersProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + updateUserSettings: connect_go.NewClient[v1alpha1.UpdateUserSettingsRequest, v1alpha1.UpdateUserSettingsResponse]( + httpClient, + baseURL+UserServiceUpdateUserSettingsProcedure, + opts..., + ), + } +} + +// userServiceClient implements UserServiceClient. +type userServiceClient struct { + createUser *connect_go.Client[v1alpha1.CreateUserRequest, v1alpha1.CreateUserResponse] + getUser *connect_go.Client[v1alpha1.GetUserRequest, v1alpha1.GetUserResponse] + getUserByUsername *connect_go.Client[v1alpha1.GetUserByUsernameRequest, v1alpha1.GetUserByUsernameResponse] + listUsers *connect_go.Client[v1alpha1.ListUsersRequest, v1alpha1.ListUsersResponse] + listOrganizationUsers *connect_go.Client[v1alpha1.ListOrganizationUsersRequest, v1alpha1.ListOrganizationUsersResponse] + deleteUser *connect_go.Client[v1alpha1.DeleteUserRequest, v1alpha1.DeleteUserResponse] + deactivateUser *connect_go.Client[v1alpha1.DeactivateUserRequest, v1alpha1.DeactivateUserResponse] + updateUserServerRole *connect_go.Client[v1alpha1.UpdateUserServerRoleRequest, v1alpha1.UpdateUserServerRoleResponse] + countUsers *connect_go.Client[v1alpha1.CountUsersRequest, v1alpha1.CountUsersResponse] + updateUserSettings *connect_go.Client[v1alpha1.UpdateUserSettingsRequest, v1alpha1.UpdateUserSettingsResponse] +} + +// CreateUser calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.CreateUser. +func (c *userServiceClient) CreateUser(ctx context.Context, req *connect_go.Request[v1alpha1.CreateUserRequest]) (*connect_go.Response[v1alpha1.CreateUserResponse], error) { + return c.createUser.CallUnary(ctx, req) +} + +// GetUser calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUser. +func (c *userServiceClient) GetUser(ctx context.Context, req *connect_go.Request[v1alpha1.GetUserRequest]) (*connect_go.Response[v1alpha1.GetUserResponse], error) { + return c.getUser.CallUnary(ctx, req) +} + +// GetUserByUsername calls +// bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUserByUsername. +func (c *userServiceClient) GetUserByUsername(ctx context.Context, req *connect_go.Request[v1alpha1.GetUserByUsernameRequest]) (*connect_go.Response[v1alpha1.GetUserByUsernameResponse], error) { + return c.getUserByUsername.CallUnary(ctx, req) +} + +// ListUsers calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListUsers. +func (c *userServiceClient) ListUsers(ctx context.Context, req *connect_go.Request[v1alpha1.ListUsersRequest]) (*connect_go.Response[v1alpha1.ListUsersResponse], error) { + return c.listUsers.CallUnary(ctx, req) +} + +// ListOrganizationUsers calls +// bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListOrganizationUsers. +func (c *userServiceClient) ListOrganizationUsers(ctx context.Context, req *connect_go.Request[v1alpha1.ListOrganizationUsersRequest]) (*connect_go.Response[v1alpha1.ListOrganizationUsersResponse], error) { + return c.listOrganizationUsers.CallUnary(ctx, req) +} + +// DeleteUser calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeleteUser. +func (c *userServiceClient) DeleteUser(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteUserRequest]) (*connect_go.Response[v1alpha1.DeleteUserResponse], error) { + return c.deleteUser.CallUnary(ctx, req) +} + +// DeactivateUser calls +// bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeactivateUser. +func (c *userServiceClient) DeactivateUser(ctx context.Context, req *connect_go.Request[v1alpha1.DeactivateUserRequest]) (*connect_go.Response[v1alpha1.DeactivateUserResponse], error) { + return c.deactivateUser.CallUnary(ctx, req) +} + +// UpdateUserServerRole calls +// bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserServerRole. +func (c *userServiceClient) UpdateUserServerRole(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateUserServerRoleRequest]) (*connect_go.Response[v1alpha1.UpdateUserServerRoleResponse], error) { + return c.updateUserServerRole.CallUnary(ctx, req) +} + +// CountUsers calls bufman.dubbo.apache.org.registry.v1alpha1.UserService.CountUsers. +func (c *userServiceClient) CountUsers(ctx context.Context, req *connect_go.Request[v1alpha1.CountUsersRequest]) (*connect_go.Response[v1alpha1.CountUsersResponse], error) { + return c.countUsers.CallUnary(ctx, req) +} + +// UpdateUserSettings calls +// bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserSettings. +func (c *userServiceClient) UpdateUserSettings(ctx context.Context, req *connect_go.Request[v1alpha1.UpdateUserSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateUserSettingsResponse], error) { + return c.updateUserSettings.CallUnary(ctx, req) +} + +// UserServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.UserService service. +type UserServiceHandler interface { + // CreateUser creates a new user with the given username. + CreateUser(context.Context, *connect_go.Request[v1alpha1.CreateUserRequest]) (*connect_go.Response[v1alpha1.CreateUserResponse], error) + // GetUser gets a user by ID. + GetUser(context.Context, *connect_go.Request[v1alpha1.GetUserRequest]) (*connect_go.Response[v1alpha1.GetUserResponse], error) + // GetUserByUsername gets a user by username. + GetUserByUsername(context.Context, *connect_go.Request[v1alpha1.GetUserByUsernameRequest]) (*connect_go.Response[v1alpha1.GetUserByUsernameResponse], error) + // ListUsers lists all users. + ListUsers(context.Context, *connect_go.Request[v1alpha1.ListUsersRequest]) (*connect_go.Response[v1alpha1.ListUsersResponse], error) + // ListOrganizationUsers lists all users for an organization. + // TODO: #663 move this to organization service + ListOrganizationUsers(context.Context, *connect_go.Request[v1alpha1.ListOrganizationUsersRequest]) (*connect_go.Response[v1alpha1.ListOrganizationUsersResponse], error) + // DeleteUser deletes a user. + DeleteUser(context.Context, *connect_go.Request[v1alpha1.DeleteUserRequest]) (*connect_go.Response[v1alpha1.DeleteUserResponse], error) + // Deactivate user deactivates a user. + DeactivateUser(context.Context, *connect_go.Request[v1alpha1.DeactivateUserRequest]) (*connect_go.Response[v1alpha1.DeactivateUserResponse], error) + // UpdateUserServerRole update the role of an user in the server. + UpdateUserServerRole(context.Context, *connect_go.Request[v1alpha1.UpdateUserServerRoleRequest]) (*connect_go.Response[v1alpha1.UpdateUserServerRoleResponse], error) + // CountUsers returns the number of users in the server by the user state provided. + CountUsers(context.Context, *connect_go.Request[v1alpha1.CountUsersRequest]) (*connect_go.Response[v1alpha1.CountUsersResponse], error) + // UpdateUserSettings update the user settings including description. + UpdateUserSettings(context.Context, *connect_go.Request[v1alpha1.UpdateUserSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateUserSettingsResponse], error) +} + +// NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewUserServiceHandler(svc UserServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + userServiceCreateUserHandler := connect_go.NewUnaryHandler( + UserServiceCreateUserProcedure, + svc.CreateUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + userServiceGetUserHandler := connect_go.NewUnaryHandler( + UserServiceGetUserProcedure, + svc.GetUser, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceGetUserByUsernameHandler := connect_go.NewUnaryHandler( + UserServiceGetUserByUsernameProcedure, + svc.GetUserByUsername, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceListUsersHandler := connect_go.NewUnaryHandler( + UserServiceListUsersProcedure, + svc.ListUsers, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceListOrganizationUsersHandler := connect_go.NewUnaryHandler( + UserServiceListOrganizationUsersProcedure, + svc.ListOrganizationUsers, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceDeleteUserHandler := connect_go.NewUnaryHandler( + UserServiceDeleteUserProcedure, + svc.DeleteUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + userServiceDeactivateUserHandler := connect_go.NewUnaryHandler( + UserServiceDeactivateUserProcedure, + svc.DeactivateUser, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + userServiceUpdateUserServerRoleHandler := connect_go.NewUnaryHandler( + UserServiceUpdateUserServerRoleProcedure, + svc.UpdateUserServerRole, + opts..., + ) + userServiceCountUsersHandler := connect_go.NewUnaryHandler( + UserServiceCountUsersProcedure, + svc.CountUsers, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + userServiceUpdateUserSettingsHandler := connect_go.NewUnaryHandler( + UserServiceUpdateUserSettingsProcedure, + svc.UpdateUserSettings, + opts..., + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case UserServiceCreateUserProcedure: + userServiceCreateUserHandler.ServeHTTP(w, r) + case UserServiceGetUserProcedure: + userServiceGetUserHandler.ServeHTTP(w, r) + case UserServiceGetUserByUsernameProcedure: + userServiceGetUserByUsernameHandler.ServeHTTP(w, r) + case UserServiceListUsersProcedure: + userServiceListUsersHandler.ServeHTTP(w, r) + case UserServiceListOrganizationUsersProcedure: + userServiceListOrganizationUsersHandler.ServeHTTP(w, r) + case UserServiceDeleteUserProcedure: + userServiceDeleteUserHandler.ServeHTTP(w, r) + case UserServiceDeactivateUserProcedure: + userServiceDeactivateUserHandler.ServeHTTP(w, r) + case UserServiceUpdateUserServerRoleProcedure: + userServiceUpdateUserServerRoleHandler.ServeHTTP(w, r) + case UserServiceCountUsersProcedure: + userServiceCountUsersHandler.ServeHTTP(w, r) + case UserServiceUpdateUserSettingsProcedure: + userServiceUpdateUserSettingsHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedUserServiceHandler struct{} + +func (UnimplementedUserServiceHandler) CreateUser(context.Context, *connect_go.Request[v1alpha1.CreateUserRequest]) (*connect_go.Response[v1alpha1.CreateUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.CreateUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) GetUser(context.Context, *connect_go.Request[v1alpha1.GetUserRequest]) (*connect_go.Response[v1alpha1.GetUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) GetUserByUsername(context.Context, *connect_go.Request[v1alpha1.GetUserByUsernameRequest]) (*connect_go.Response[v1alpha1.GetUserByUsernameResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUserByUsername is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListUsers(context.Context, *connect_go.Request[v1alpha1.ListUsersRequest]) (*connect_go.Response[v1alpha1.ListUsersResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListUsers is not implemented")) +} + +func (UnimplementedUserServiceHandler) ListOrganizationUsers(context.Context, *connect_go.Request[v1alpha1.ListOrganizationUsersRequest]) (*connect_go.Response[v1alpha1.ListOrganizationUsersResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListOrganizationUsers is not implemented")) +} + +func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect_go.Request[v1alpha1.DeleteUserRequest]) (*connect_go.Response[v1alpha1.DeleteUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeleteUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) DeactivateUser(context.Context, *connect_go.Request[v1alpha1.DeactivateUserRequest]) (*connect_go.Response[v1alpha1.DeactivateUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeactivateUser is not implemented")) +} + +func (UnimplementedUserServiceHandler) UpdateUserServerRole(context.Context, *connect_go.Request[v1alpha1.UpdateUserServerRoleRequest]) (*connect_go.Response[v1alpha1.UpdateUserServerRoleResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserServerRole is not implemented")) +} + +func (UnimplementedUserServiceHandler) CountUsers(context.Context, *connect_go.Request[v1alpha1.CountUsersRequest]) (*connect_go.Response[v1alpha1.CountUsersResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.CountUsers is not implemented")) +} + +func (UnimplementedUserServiceHandler) UpdateUserSettings(context.Context, *connect_go.Request[v1alpha1.UpdateUserSettingsRequest]) (*connect_go.Response[v1alpha1.UpdateUserSettingsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserSettings is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/webhook.connect.go b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/webhook.connect.go new file mode 100644 index 000000000..9e4e79344 --- /dev/null +++ b/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1v1alpha1connect/webhook.connect.go @@ -0,0 +1,193 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: registry/v1alpha1/webhook.proto + +package registryv1alpha1v1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion1_7_0 + +const ( + // WebhookServiceName is the fully-qualified name of the WebhookService service. + WebhookServiceName = "bufman.dubbo.apache.org.registry.v1alpha1.WebhookService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // WebhookServiceCreateWebhookProcedure is the fully-qualified name of the WebhookService's + // CreateWebhook RPC. + WebhookServiceCreateWebhookProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/CreateWebhook" + // WebhookServiceDeleteWebhookProcedure is the fully-qualified name of the WebhookService's + // DeleteWebhook RPC. + WebhookServiceDeleteWebhookProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/DeleteWebhook" + // WebhookServiceListWebhooksProcedure is the fully-qualified name of the WebhookService's + // ListWebhooks RPC. + WebhookServiceListWebhooksProcedure = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/ListWebhooks" +) + +// WebhookServiceClient is a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.WebhookService service. +type WebhookServiceClient interface { + // Create a webhook, subscribes to a given repository event for a callback URL + // invocation. + CreateWebhook(context.Context, *connect_go.Request[v1alpha1.CreateWebhookRequest]) (*connect_go.Response[v1alpha1.CreateWebhookResponse], error) + // Delete a webhook removes the event subscription. + DeleteWebhook(context.Context, *connect_go.Request[v1alpha1.DeleteWebhookRequest]) (*connect_go.Response[v1alpha1.DeleteWebhookResponse], error) + // Lists the webhooks subscriptions for a given repository. + ListWebhooks(context.Context, *connect_go.Request[v1alpha1.ListWebhooksRequest]) (*connect_go.Response[v1alpha1.ListWebhooksResponse], error) +} + +// NewWebhookServiceClient constructs a client for the +// bufman.dubbo.apache.org.registry.v1alpha1.WebhookService service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewWebhookServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) WebhookServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &webhookServiceClient{ + createWebhook: connect_go.NewClient[v1alpha1.CreateWebhookRequest, v1alpha1.CreateWebhookResponse]( + httpClient, + baseURL+WebhookServiceCreateWebhookProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + deleteWebhook: connect_go.NewClient[v1alpha1.DeleteWebhookRequest, v1alpha1.DeleteWebhookResponse]( + httpClient, + baseURL+WebhookServiceDeleteWebhookProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithClientOptions(opts...), + ), + listWebhooks: connect_go.NewClient[v1alpha1.ListWebhooksRequest, v1alpha1.ListWebhooksResponse]( + httpClient, + baseURL+WebhookServiceListWebhooksProcedure, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithClientOptions(opts...), + ), + } +} + +// webhookServiceClient implements WebhookServiceClient. +type webhookServiceClient struct { + createWebhook *connect_go.Client[v1alpha1.CreateWebhookRequest, v1alpha1.CreateWebhookResponse] + deleteWebhook *connect_go.Client[v1alpha1.DeleteWebhookRequest, v1alpha1.DeleteWebhookResponse] + listWebhooks *connect_go.Client[v1alpha1.ListWebhooksRequest, v1alpha1.ListWebhooksResponse] +} + +// CreateWebhook calls +// bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.CreateWebhook. +func (c *webhookServiceClient) CreateWebhook(ctx context.Context, req *connect_go.Request[v1alpha1.CreateWebhookRequest]) (*connect_go.Response[v1alpha1.CreateWebhookResponse], error) { + return c.createWebhook.CallUnary(ctx, req) +} + +// DeleteWebhook calls +// bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.DeleteWebhook. +func (c *webhookServiceClient) DeleteWebhook(ctx context.Context, req *connect_go.Request[v1alpha1.DeleteWebhookRequest]) (*connect_go.Response[v1alpha1.DeleteWebhookResponse], error) { + return c.deleteWebhook.CallUnary(ctx, req) +} + +// ListWebhooks calls bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.ListWebhooks. +func (c *webhookServiceClient) ListWebhooks(ctx context.Context, req *connect_go.Request[v1alpha1.ListWebhooksRequest]) (*connect_go.Response[v1alpha1.ListWebhooksResponse], error) { + return c.listWebhooks.CallUnary(ctx, req) +} + +// WebhookServiceHandler is an implementation of the +// bufman.dubbo.apache.org.registry.v1alpha1.WebhookService service. +type WebhookServiceHandler interface { + // Create a webhook, subscribes to a given repository event for a callback URL + // invocation. + CreateWebhook(context.Context, *connect_go.Request[v1alpha1.CreateWebhookRequest]) (*connect_go.Response[v1alpha1.CreateWebhookResponse], error) + // Delete a webhook removes the event subscription. + DeleteWebhook(context.Context, *connect_go.Request[v1alpha1.DeleteWebhookRequest]) (*connect_go.Response[v1alpha1.DeleteWebhookResponse], error) + // Lists the webhooks subscriptions for a given repository. + ListWebhooks(context.Context, *connect_go.Request[v1alpha1.ListWebhooksRequest]) (*connect_go.Response[v1alpha1.ListWebhooksResponse], error) +} + +// NewWebhookServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewWebhookServiceHandler(svc WebhookServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + webhookServiceCreateWebhookHandler := connect_go.NewUnaryHandler( + WebhookServiceCreateWebhookProcedure, + svc.CreateWebhook, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + webhookServiceDeleteWebhookHandler := connect_go.NewUnaryHandler( + WebhookServiceDeleteWebhookProcedure, + svc.DeleteWebhook, + connect_go.WithIdempotency(connect_go.IdempotencyIdempotent), + connect_go.WithHandlerOptions(opts...), + ) + webhookServiceListWebhooksHandler := connect_go.NewUnaryHandler( + WebhookServiceListWebhooksProcedure, + svc.ListWebhooks, + connect_go.WithIdempotency(connect_go.IdempotencyNoSideEffects), + connect_go.WithHandlerOptions(opts...), + ) + return "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case WebhookServiceCreateWebhookProcedure: + webhookServiceCreateWebhookHandler.ServeHTTP(w, r) + case WebhookServiceDeleteWebhookProcedure: + webhookServiceDeleteWebhookHandler.ServeHTTP(w, r) + case WebhookServiceListWebhooksProcedure: + webhookServiceListWebhooksHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedWebhookServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedWebhookServiceHandler struct{} + +func (UnimplementedWebhookServiceHandler) CreateWebhook(context.Context, *connect_go.Request[v1alpha1.CreateWebhookRequest]) (*connect_go.Response[v1alpha1.CreateWebhookResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.CreateWebhook is not implemented")) +} + +func (UnimplementedWebhookServiceHandler) DeleteWebhook(context.Context, *connect_go.Request[v1alpha1.DeleteWebhookRequest]) (*connect_go.Response[v1alpha1.DeleteWebhookResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.DeleteWebhook is not implemented")) +} + +func (UnimplementedWebhookServiceHandler) ListWebhooks(context.Context, *connect_go.Request[v1alpha1.ListWebhooksRequest]) (*connect_go.Response[v1alpha1.ListWebhooksResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.ListWebhooks is not implemented")) +} diff --git a/pkg/bufman/gen/proto/connect/webhook/v1alpha1/webhookv1alpha1connect/event.connect.go b/pkg/bufman/gen/proto/connect/webhook/v1alpha1/webhookv1alpha1connect/event.connect.go new file mode 100644 index 000000000..7d2290b5f --- /dev/null +++ b/pkg/bufman/gen/proto/connect/webhook/v1alpha1/webhookv1alpha1connect/event.connect.go @@ -0,0 +1,124 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: webhook/v1alpha1/event.proto + +package webhookv1alpha1connect + +import ( + context "context" + errors "errors" + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/webhook/v1alpha1" + connect_go "github.com/bufbuild/connect-go" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect_go.IsAtLeastVersion0_1_0 + +const ( + // EventServiceName is the fully-qualified name of the EventService service. + EventServiceName = "bufman.dubbo.apache.org.webhook.v1alpha1.EventService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // EventServiceEventProcedure is the fully-qualified name of the EventService's Event RPC. + EventServiceEventProcedure = "/bufman.dubbo.apache.org.webhook.v1alpha1.EventService/Event" +) + +// EventServiceClient is a client for the bufman.dubbo.apache.org.webhook.v1alpha1.EventService +// service. +type EventServiceClient interface { + // Event is the rpc which receives webhook events. + Event(context.Context, *connect_go.Request[v1alpha1.EventRequest]) (*connect_go.Response[v1alpha1.EventResponse], error) +} + +// NewEventServiceClient constructs a client for the +// bufman.dubbo.apache.org.webhook.v1alpha1.EventService service. By default, it uses the Connect +// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed +// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewEventServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) EventServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &eventServiceClient{ + event: connect_go.NewClient[v1alpha1.EventRequest, v1alpha1.EventResponse]( + httpClient, + baseURL+EventServiceEventProcedure, + opts..., + ), + } +} + +// eventServiceClient implements EventServiceClient. +type eventServiceClient struct { + event *connect_go.Client[v1alpha1.EventRequest, v1alpha1.EventResponse] +} + +// Event calls bufman.dubbo.apache.org.webhook.v1alpha1.EventService.Event. +func (c *eventServiceClient) Event(ctx context.Context, req *connect_go.Request[v1alpha1.EventRequest]) (*connect_go.Response[v1alpha1.EventResponse], error) { + return c.event.CallUnary(ctx, req) +} + +// EventServiceHandler is an implementation of the +// bufman.dubbo.apache.org.webhook.v1alpha1.EventService service. +type EventServiceHandler interface { + // Event is the rpc which receives webhook events. + Event(context.Context, *connect_go.Request[v1alpha1.EventRequest]) (*connect_go.Response[v1alpha1.EventResponse], error) +} + +// NewEventServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewEventServiceHandler(svc EventServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + eventServiceEventHandler := connect_go.NewUnaryHandler( + EventServiceEventProcedure, + svc.Event, + opts..., + ) + return "/bufman.dubbo.apache.org.webhook.v1alpha1.EventService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case EventServiceEventProcedure: + eventServiceEventHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedEventServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedEventServiceHandler struct{} + +func (UnimplementedEventServiceHandler) Event(context.Context, *connect_go.Request[v1alpha1.EventRequest]) (*connect_go.Response[v1alpha1.EventResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("bufman.dubbo.apache.org.webhook.v1alpha1.EventService.Event is not implemented")) +} diff --git a/pkg/bufman/gen/proto/go/audit/v1alpha1/event.pb.go b/pkg/bufman/gen/proto/go/audit/v1alpha1/event.pb.go new file mode 100644 index 000000000..a18c8937a --- /dev/null +++ b/pkg/bufman/gen/proto/go/audit/v1alpha1/event.pb.go @@ -0,0 +1,4562 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: audit/v1alpha1/event.proto + +package auditv1alpha1 + +import ( + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// ActorType is the type of actor that caused the audited event. +type ActorType int32 + +const ( + ActorType_ACTOR_TYPE_UNSPECIFIED ActorType = 0 + ActorType_ACTOR_TYPE_USER ActorType = 1 + ActorType_ACTOR_TYPE_SYSTEM ActorType = 2 +) + +// Enum value maps for ActorType. +var ( + ActorType_name = map[int32]string{ + 0: "ACTOR_TYPE_UNSPECIFIED", + 1: "ACTOR_TYPE_USER", + 2: "ACTOR_TYPE_SYSTEM", + } + ActorType_value = map[string]int32{ + "ACTOR_TYPE_UNSPECIFIED": 0, + "ACTOR_TYPE_USER": 1, + "ACTOR_TYPE_SYSTEM": 2, + } +) + +func (x ActorType) Enum() *ActorType { + p := new(ActorType) + *p = x + return p +} + +func (x ActorType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ActorType) Descriptor() protoreflect.EnumDescriptor { + return file_audit_v1alpha1_event_proto_enumTypes[0].Descriptor() +} + +func (ActorType) Type() protoreflect.EnumType { + return &file_audit_v1alpha1_event_proto_enumTypes[0] +} + +func (x ActorType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ActorType.Descriptor instead. +func (ActorType) EnumDescriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{0} +} + +// ResourceType is the type of the resource that was affected by the audited +// event. +type ResourceType int32 + +const ( + ResourceType_RESOURCE_TYPE_UNSPECIFIED ResourceType = 0 + ResourceType_RESOURCE_TYPE_USER ResourceType = 1 + ResourceType_RESOURCE_TYPE_ORGANIZATION ResourceType = 2 + ResourceType_RESOURCE_TYPE_ORGANIZATION_MEMBER ResourceType = 3 + ResourceType_RESOURCE_TYPE_ORGANIZATION_IDP_GROUP ResourceType = 9 + ResourceType_RESOURCE_TYPE_REPOSITORY ResourceType = 4 + ResourceType_RESOURCE_TYPE_REPOSITORY_CONTRIBUTOR ResourceType = 5 + ResourceType_RESOURCE_TYPE_REPOSITORY_COMMIT ResourceType = 6 + // Deprecated: Do not use. + ResourceType_RESOURCE_TYPE_PLUGIN ResourceType = 7 + ResourceType_RESOURCE_TYPE_CURATED_PLUGIN ResourceType = 8 + ResourceType_RESOURCE_TYPE_TOKEN ResourceType = 10 + ResourceType_RESOURCE_TYPE_SCIM_TOKEN ResourceType = 11 + ResourceType_RESOURCE_TYPE_REPOSITORY_LABEL ResourceType = 12 + ResourceType_RESOURCE_TYPE_SERVER ResourceType = 13 +) + +// Enum value maps for ResourceType. +var ( + ResourceType_name = map[int32]string{ + 0: "RESOURCE_TYPE_UNSPECIFIED", + 1: "RESOURCE_TYPE_USER", + 2: "RESOURCE_TYPE_ORGANIZATION", + 3: "RESOURCE_TYPE_ORGANIZATION_MEMBER", + 9: "RESOURCE_TYPE_ORGANIZATION_IDP_GROUP", + 4: "RESOURCE_TYPE_REPOSITORY", + 5: "RESOURCE_TYPE_REPOSITORY_CONTRIBUTOR", + 6: "RESOURCE_TYPE_REPOSITORY_COMMIT", + 7: "RESOURCE_TYPE_PLUGIN", + 8: "RESOURCE_TYPE_CURATED_PLUGIN", + 10: "RESOURCE_TYPE_TOKEN", + 11: "RESOURCE_TYPE_SCIM_TOKEN", + 12: "RESOURCE_TYPE_REPOSITORY_LABEL", + 13: "RESOURCE_TYPE_SERVER", + } + ResourceType_value = map[string]int32{ + "RESOURCE_TYPE_UNSPECIFIED": 0, + "RESOURCE_TYPE_USER": 1, + "RESOURCE_TYPE_ORGANIZATION": 2, + "RESOURCE_TYPE_ORGANIZATION_MEMBER": 3, + "RESOURCE_TYPE_ORGANIZATION_IDP_GROUP": 9, + "RESOURCE_TYPE_REPOSITORY": 4, + "RESOURCE_TYPE_REPOSITORY_CONTRIBUTOR": 5, + "RESOURCE_TYPE_REPOSITORY_COMMIT": 6, + "RESOURCE_TYPE_PLUGIN": 7, + "RESOURCE_TYPE_CURATED_PLUGIN": 8, + "RESOURCE_TYPE_TOKEN": 10, + "RESOURCE_TYPE_SCIM_TOKEN": 11, + "RESOURCE_TYPE_REPOSITORY_LABEL": 12, + "RESOURCE_TYPE_SERVER": 13, + } +) + +func (x ResourceType) Enum() *ResourceType { + p := new(ResourceType) + *p = x + return p +} + +func (x ResourceType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ResourceType) Descriptor() protoreflect.EnumDescriptor { + return file_audit_v1alpha1_event_proto_enumTypes[1].Descriptor() +} + +func (ResourceType) Type() protoreflect.EnumType { + return &file_audit_v1alpha1_event_proto_enumTypes[1] +} + +func (x ResourceType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ResourceType.Descriptor instead. +func (ResourceType) EnumDescriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{1} +} + +// EventType is the type of audited event. +type EventType int32 + +const ( + EventType_EVENT_TYPE_UNSPECIFIED EventType = 0 + EventType_EVENT_TYPE_ORGANIZATION_CREATED EventType = 1 + EventType_EVENT_TYPE_ORGANIZATION_DELETED EventType = 2 + EventType_EVENT_TYPE_ORGANIZATION_MEMBER_ADDED EventType = 3 + EventType_EVENT_TYPE_ORGANIZATION_MEMBER_ROLE_CHANGED EventType = 4 + EventType_EVENT_TYPE_ORGANIZATION_MEMBER_REMOVED EventType = 5 + EventType_EVENT_TYPE_ORGANIZATION_IDP_GROUP_ADDED EventType = 21 + EventType_EVENT_TYPE_ORGANIZATION_IDP_GROUP_REMOVED EventType = 22 + EventType_EVENT_TYPE_REPOSITORY_CREATED EventType = 6 + EventType_EVENT_TYPE_REPOSITORY_DELETED EventType = 7 + EventType_EVENT_TYPE_REPOSITORY_COMMIT_PUSHED EventType = 8 + EventType_EVENT_TYPE_REPOSITORY_CONTRIBUTOR_ADDED EventType = 9 + EventType_EVENT_TYPE_REPOSITORY_CONTRIBUTOR_ROLE_CHANGED EventType = 10 + EventType_EVENT_TYPE_REPOSITORY_CONTRIBUTOR_REMOVED EventType = 11 + EventType_EVENT_TYPE_REPOSITORY_VISIBILITY_CHANGED EventType = 12 + // Deprecated: Do not use. + EventType_EVENT_TYPE_PLUGIN_CREATED EventType = 13 + // Deprecated: Do not use. + EventType_EVENT_TYPE_PLUGIN_DELETED EventType = 14 + EventType_EVENT_TYPE_CURATED_PLUGIN_CREATED EventType = 20 + EventType_EVENT_TYPE_CURATED_PLUGIN_DELETED EventType = 31 + EventType_EVENT_TYPE_USER_CREATED EventType = 15 + EventType_EVENT_TYPE_USER_DELETED EventType = 16 + EventType_EVENT_TYPE_USER_DEACTIVATED EventType = 17 + EventType_EVENT_TYPE_USER_LOGGED_IN EventType = 18 + EventType_EVENT_TYPE_USER_LOGGED_OUT EventType = 19 + EventType_EVENT_TYPE_TOKEN_CREATED EventType = 23 + EventType_EVENT_TYPE_TOKEN_DELETED EventType = 24 + EventType_EVENT_TYPE_USER_REACTIVATED EventType = 25 + EventType_EVENT_TYPE_SCIM_TOKEN_CREATED EventType = 26 + EventType_EVENT_TYPE_SCIM_TOKEN_DELETED EventType = 27 + EventType_EVENT_TYPE_REPOSITORY_COMMIT_DELETED EventType = 28 + EventType_EVENT_TYPE_REPOSITORY_LABEL_CREATED EventType = 29 + EventType_EVENT_TYPE_REPOSITORY_LABEL_MOVED EventType = 30 + EventType_EVENT_TYPE_SERVER_BREAKING_CHANGE_POLICY_ENABLED EventType = 32 + EventType_EVENT_TYPE_SERVER_BREAKING_CHANGE_POLICY_DISABLED EventType = 33 +) + +// Enum value maps for EventType. +var ( + EventType_name = map[int32]string{ + 0: "EVENT_TYPE_UNSPECIFIED", + 1: "EVENT_TYPE_ORGANIZATION_CREATED", + 2: "EVENT_TYPE_ORGANIZATION_DELETED", + 3: "EVENT_TYPE_ORGANIZATION_MEMBER_ADDED", + 4: "EVENT_TYPE_ORGANIZATION_MEMBER_ROLE_CHANGED", + 5: "EVENT_TYPE_ORGANIZATION_MEMBER_REMOVED", + 21: "EVENT_TYPE_ORGANIZATION_IDP_GROUP_ADDED", + 22: "EVENT_TYPE_ORGANIZATION_IDP_GROUP_REMOVED", + 6: "EVENT_TYPE_REPOSITORY_CREATED", + 7: "EVENT_TYPE_REPOSITORY_DELETED", + 8: "EVENT_TYPE_REPOSITORY_COMMIT_PUSHED", + 9: "EVENT_TYPE_REPOSITORY_CONTRIBUTOR_ADDED", + 10: "EVENT_TYPE_REPOSITORY_CONTRIBUTOR_ROLE_CHANGED", + 11: "EVENT_TYPE_REPOSITORY_CONTRIBUTOR_REMOVED", + 12: "EVENT_TYPE_REPOSITORY_VISIBILITY_CHANGED", + 13: "EVENT_TYPE_PLUGIN_CREATED", + 14: "EVENT_TYPE_PLUGIN_DELETED", + 20: "EVENT_TYPE_CURATED_PLUGIN_CREATED", + 31: "EVENT_TYPE_CURATED_PLUGIN_DELETED", + 15: "EVENT_TYPE_USER_CREATED", + 16: "EVENT_TYPE_USER_DELETED", + 17: "EVENT_TYPE_USER_DEACTIVATED", + 18: "EVENT_TYPE_USER_LOGGED_IN", + 19: "EVENT_TYPE_USER_LOGGED_OUT", + 23: "EVENT_TYPE_TOKEN_CREATED", + 24: "EVENT_TYPE_TOKEN_DELETED", + 25: "EVENT_TYPE_USER_REACTIVATED", + 26: "EVENT_TYPE_SCIM_TOKEN_CREATED", + 27: "EVENT_TYPE_SCIM_TOKEN_DELETED", + 28: "EVENT_TYPE_REPOSITORY_COMMIT_DELETED", + 29: "EVENT_TYPE_REPOSITORY_LABEL_CREATED", + 30: "EVENT_TYPE_REPOSITORY_LABEL_MOVED", + 32: "EVENT_TYPE_SERVER_BREAKING_CHANGE_POLICY_ENABLED", + 33: "EVENT_TYPE_SERVER_BREAKING_CHANGE_POLICY_DISABLED", + } + EventType_value = map[string]int32{ + "EVENT_TYPE_UNSPECIFIED": 0, + "EVENT_TYPE_ORGANIZATION_CREATED": 1, + "EVENT_TYPE_ORGANIZATION_DELETED": 2, + "EVENT_TYPE_ORGANIZATION_MEMBER_ADDED": 3, + "EVENT_TYPE_ORGANIZATION_MEMBER_ROLE_CHANGED": 4, + "EVENT_TYPE_ORGANIZATION_MEMBER_REMOVED": 5, + "EVENT_TYPE_ORGANIZATION_IDP_GROUP_ADDED": 21, + "EVENT_TYPE_ORGANIZATION_IDP_GROUP_REMOVED": 22, + "EVENT_TYPE_REPOSITORY_CREATED": 6, + "EVENT_TYPE_REPOSITORY_DELETED": 7, + "EVENT_TYPE_REPOSITORY_COMMIT_PUSHED": 8, + "EVENT_TYPE_REPOSITORY_CONTRIBUTOR_ADDED": 9, + "EVENT_TYPE_REPOSITORY_CONTRIBUTOR_ROLE_CHANGED": 10, + "EVENT_TYPE_REPOSITORY_CONTRIBUTOR_REMOVED": 11, + "EVENT_TYPE_REPOSITORY_VISIBILITY_CHANGED": 12, + "EVENT_TYPE_PLUGIN_CREATED": 13, + "EVENT_TYPE_PLUGIN_DELETED": 14, + "EVENT_TYPE_CURATED_PLUGIN_CREATED": 20, + "EVENT_TYPE_CURATED_PLUGIN_DELETED": 31, + "EVENT_TYPE_USER_CREATED": 15, + "EVENT_TYPE_USER_DELETED": 16, + "EVENT_TYPE_USER_DEACTIVATED": 17, + "EVENT_TYPE_USER_LOGGED_IN": 18, + "EVENT_TYPE_USER_LOGGED_OUT": 19, + "EVENT_TYPE_TOKEN_CREATED": 23, + "EVENT_TYPE_TOKEN_DELETED": 24, + "EVENT_TYPE_USER_REACTIVATED": 25, + "EVENT_TYPE_SCIM_TOKEN_CREATED": 26, + "EVENT_TYPE_SCIM_TOKEN_DELETED": 27, + "EVENT_TYPE_REPOSITORY_COMMIT_DELETED": 28, + "EVENT_TYPE_REPOSITORY_LABEL_CREATED": 29, + "EVENT_TYPE_REPOSITORY_LABEL_MOVED": 30, + "EVENT_TYPE_SERVER_BREAKING_CHANGE_POLICY_ENABLED": 32, + "EVENT_TYPE_SERVER_BREAKING_CHANGE_POLICY_DISABLED": 33, + } +) + +func (x EventType) Enum() *EventType { + p := new(EventType) + *p = x + return p +} + +func (x EventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (EventType) Descriptor() protoreflect.EnumDescriptor { + return file_audit_v1alpha1_event_proto_enumTypes[2].Descriptor() +} + +func (EventType) Type() protoreflect.EnumType { + return &file_audit_v1alpha1_event_proto_enumTypes[2] +} + +func (x EventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use EventType.Descriptor instead. +func (EventType) EnumDescriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{2} +} + +// Actor is the actor who caused the audited event. +type Actor struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Type of actor who caused the audited event. + Type ActorType `protobuf:"varint,1,opt,name=type,proto3,enum=bufman.dubbo.apache.org.audit.v1alpha1.ActorType" json:"type,omitempty"` + // Id of the actor who caused the audited event. + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + // Name of the actor who caused the audited event. + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Actor) Reset() { + *x = Actor{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Actor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Actor) ProtoMessage() {} + +func (x *Actor) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Actor.ProtoReflect.Descriptor instead. +func (*Actor) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{0} +} + +func (x *Actor) GetType() ActorType { + if x != nil { + return x.Type + } + return ActorType_ACTOR_TYPE_UNSPECIFIED +} + +func (x *Actor) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Actor) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Resource is the affected resource by the audited event. +type Resource struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Type of resource that was affected by the audited event. + Type ResourceType `protobuf:"varint,1,opt,name=type,proto3,enum=bufman.dubbo.apache.org.audit.v1alpha1.ResourceType" json:"type,omitempty"` + // Id of the affected resource by the audited event. + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + // Name of the affected resource by the audited event. + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Resource) Reset() { + *x = Resource{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Resource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Resource) ProtoMessage() {} + +func (x *Resource) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Resource.ProtoReflect.Descriptor instead. +func (*Resource) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{1} +} + +func (x *Resource) GetType() ResourceType { + if x != nil { + return x.Type + } + return ResourceType_RESOURCE_TYPE_UNSPECIFIED +} + +func (x *Resource) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Resource) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// EventMetadata provides additional details about the audited event. +type EventMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // UserAgent is the User-Agent header associated with the request that triggered the audited event, if any. + UserAgent string `protobuf:"bytes,1,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` + // IP is the IP address associated with the request that triggered the audited event, if any. + Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` + // TraceID is the ID of the trace associated with the audited event, if any. + TraceId string `protobuf:"bytes,3,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` +} + +func (x *EventMetadata) Reset() { + *x = EventMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventMetadata) ProtoMessage() {} + +func (x *EventMetadata) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EventMetadata.ProtoReflect.Descriptor instead. +func (*EventMetadata) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{2} +} + +func (x *EventMetadata) GetUserAgent() string { + if x != nil { + return x.UserAgent + } + return "" +} + +func (x *EventMetadata) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *EventMetadata) GetTraceId() string { + if x != nil { + return x.TraceId + } + return "" +} + +// Event is an audited action that happened in the BSR, with the information of +// what happened, when it happened, who did it, which resource was affected, and +// more contextual information on the event. +type Event struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Unique id of the audited event. + EventId string `protobuf:"bytes,1,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"` + // Type of the audited event. It specifies "what" happened. + Type EventType `protobuf:"varint,2,opt,name=type,proto3,enum=bufman.dubbo.apache.org.audit.v1alpha1.EventType" json:"type,omitempty"` + // Actor of the audited event. It specifies "who" did it. + Actor *Actor `protobuf:"bytes,3,opt,name=actor,proto3" json:"actor,omitempty"` + // Resource of the audited event. It specifies "which resource" was affected. + Resource *Resource `protobuf:"bytes,4,opt,name=resource,proto3" json:"resource,omitempty"` + // Time of the audited event. It specifies "when" it happened. + EventTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=event_time,json=eventTime,proto3" json:"event_time,omitempty"` + // Metadata about the audited event. It specifies any additional details about the audited event. + Metadata *EventMetadata `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"` + // Payload of the audited event. It specifies additional context on the event. + // + // Types that are assignable to Payload: + // + // *Event_OrganizationCreated + // *Event_OrganizationDeleted + // *Event_OrganizationMemberAdded + // *Event_OrganizationMemberRoleChanged + // *Event_OrganizationMemberRemoved + // *Event_RepositoryCreated + // *Event_RepositoryDeleted + // *Event_RepositoryCommitPushed + // *Event_RepositoryContributorAdded + // *Event_RepositoryContributorRoleChanged + // *Event_RepositoryContributorRemoved + // *Event_RepositoryVisibilityChanged + // *Event_PluginCreated + // *Event_PluginDeleted + // *Event_UserCreated + // *Event_UserDeactivated + // *Event_UserDeleted + // *Event_UserLoggedIn + // *Event_UserLoggedOut + // *Event_CuratedPluginCreated + // *Event_IdpGroupAdded + // *Event_IdpGroupRemoved + // *Event_TokenCreated + // *Event_TokenDeleted + // *Event_UserReactivated + // *Event_ScimTokenCreated + // *Event_ScimTokenDeleted + // *Event_RepositoryCommitDeleted + // *Event_RepositoryLabelCreated + // *Event_RepositoryLabelMoved + // *Event_CuratedPluginDeleted + // *Event_PayloadServerBreakingChangePolicyEnabled + // *Event_PayloadServerBreakingChangePolicyDisabled + Payload isEvent_Payload `protobuf_oneof:"payload"` +} + +func (x *Event) Reset() { + *x = Event{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event) ProtoMessage() {} + +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Event.ProtoReflect.Descriptor instead. +func (*Event) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{3} +} + +func (x *Event) GetEventId() string { + if x != nil { + return x.EventId + } + return "" +} + +func (x *Event) GetType() EventType { + if x != nil { + return x.Type + } + return EventType_EVENT_TYPE_UNSPECIFIED +} + +func (x *Event) GetActor() *Actor { + if x != nil { + return x.Actor + } + return nil +} + +func (x *Event) GetResource() *Resource { + if x != nil { + return x.Resource + } + return nil +} + +func (x *Event) GetEventTime() *timestamppb.Timestamp { + if x != nil { + return x.EventTime + } + return nil +} + +func (x *Event) GetMetadata() *EventMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (m *Event) GetPayload() isEvent_Payload { + if m != nil { + return m.Payload + } + return nil +} + +func (x *Event) GetOrganizationCreated() *PayloadOrganizationCreated { + if x, ok := x.GetPayload().(*Event_OrganizationCreated); ok { + return x.OrganizationCreated + } + return nil +} + +func (x *Event) GetOrganizationDeleted() *PayloadOrganizationDeleted { + if x, ok := x.GetPayload().(*Event_OrganizationDeleted); ok { + return x.OrganizationDeleted + } + return nil +} + +func (x *Event) GetOrganizationMemberAdded() *PayloadOrganizationMemberAdded { + if x, ok := x.GetPayload().(*Event_OrganizationMemberAdded); ok { + return x.OrganizationMemberAdded + } + return nil +} + +func (x *Event) GetOrganizationMemberRoleChanged() *PayloadOrganizationMemberRoleChanged { + if x, ok := x.GetPayload().(*Event_OrganizationMemberRoleChanged); ok { + return x.OrganizationMemberRoleChanged + } + return nil +} + +func (x *Event) GetOrganizationMemberRemoved() *PayloadOrganizationMemberRemoved { + if x, ok := x.GetPayload().(*Event_OrganizationMemberRemoved); ok { + return x.OrganizationMemberRemoved + } + return nil +} + +func (x *Event) GetRepositoryCreated() *PayloadRepositoryCreated { + if x, ok := x.GetPayload().(*Event_RepositoryCreated); ok { + return x.RepositoryCreated + } + return nil +} + +func (x *Event) GetRepositoryDeleted() *PayloadRepositoryDeleted { + if x, ok := x.GetPayload().(*Event_RepositoryDeleted); ok { + return x.RepositoryDeleted + } + return nil +} + +func (x *Event) GetRepositoryCommitPushed() *PayloadRepositoryCommitPushed { + if x, ok := x.GetPayload().(*Event_RepositoryCommitPushed); ok { + return x.RepositoryCommitPushed + } + return nil +} + +func (x *Event) GetRepositoryContributorAdded() *PayloadRepositoryContributorAdded { + if x, ok := x.GetPayload().(*Event_RepositoryContributorAdded); ok { + return x.RepositoryContributorAdded + } + return nil +} + +func (x *Event) GetRepositoryContributorRoleChanged() *PayloadRepositoryContributorRoleChanged { + if x, ok := x.GetPayload().(*Event_RepositoryContributorRoleChanged); ok { + return x.RepositoryContributorRoleChanged + } + return nil +} + +func (x *Event) GetRepositoryContributorRemoved() *PayloadRepositoryContributorRemoved { + if x, ok := x.GetPayload().(*Event_RepositoryContributorRemoved); ok { + return x.RepositoryContributorRemoved + } + return nil +} + +func (x *Event) GetRepositoryVisibilityChanged() *PayloadRepositoryVisibilityChanged { + if x, ok := x.GetPayload().(*Event_RepositoryVisibilityChanged); ok { + return x.RepositoryVisibilityChanged + } + return nil +} + +// Deprecated: Do not use. +func (x *Event) GetPluginCreated() *PayloadPluginCreated { + if x, ok := x.GetPayload().(*Event_PluginCreated); ok { + return x.PluginCreated + } + return nil +} + +// Deprecated: Do not use. +func (x *Event) GetPluginDeleted() *PayloadPluginDeleted { + if x, ok := x.GetPayload().(*Event_PluginDeleted); ok { + return x.PluginDeleted + } + return nil +} + +func (x *Event) GetUserCreated() *PayloadUserCreated { + if x, ok := x.GetPayload().(*Event_UserCreated); ok { + return x.UserCreated + } + return nil +} + +func (x *Event) GetUserDeactivated() *PayloadUserDeactivated { + if x, ok := x.GetPayload().(*Event_UserDeactivated); ok { + return x.UserDeactivated + } + return nil +} + +func (x *Event) GetUserDeleted() *PayloadUserDeleted { + if x, ok := x.GetPayload().(*Event_UserDeleted); ok { + return x.UserDeleted + } + return nil +} + +func (x *Event) GetUserLoggedIn() *PayloadUserLoggedIn { + if x, ok := x.GetPayload().(*Event_UserLoggedIn); ok { + return x.UserLoggedIn + } + return nil +} + +func (x *Event) GetUserLoggedOut() *PayloadUserLoggedOut { + if x, ok := x.GetPayload().(*Event_UserLoggedOut); ok { + return x.UserLoggedOut + } + return nil +} + +func (x *Event) GetCuratedPluginCreated() *PayloadCuratedPluginCreated { + if x, ok := x.GetPayload().(*Event_CuratedPluginCreated); ok { + return x.CuratedPluginCreated + } + return nil +} + +func (x *Event) GetIdpGroupAdded() *PayloadOrganizationIDPGroupAdded { + if x, ok := x.GetPayload().(*Event_IdpGroupAdded); ok { + return x.IdpGroupAdded + } + return nil +} + +func (x *Event) GetIdpGroupRemoved() *PayloadOrganizationIDPGroupRemoved { + if x, ok := x.GetPayload().(*Event_IdpGroupRemoved); ok { + return x.IdpGroupRemoved + } + return nil +} + +func (x *Event) GetTokenCreated() *PayloadTokenCreated { + if x, ok := x.GetPayload().(*Event_TokenCreated); ok { + return x.TokenCreated + } + return nil +} + +func (x *Event) GetTokenDeleted() *PayloadTokenDeleted { + if x, ok := x.GetPayload().(*Event_TokenDeleted); ok { + return x.TokenDeleted + } + return nil +} + +func (x *Event) GetUserReactivated() *PayloadUserReactivated { + if x, ok := x.GetPayload().(*Event_UserReactivated); ok { + return x.UserReactivated + } + return nil +} + +func (x *Event) GetScimTokenCreated() *PayloadSCIMTokenCreated { + if x, ok := x.GetPayload().(*Event_ScimTokenCreated); ok { + return x.ScimTokenCreated + } + return nil +} + +func (x *Event) GetScimTokenDeleted() *PayloadSCIMTokenDeleted { + if x, ok := x.GetPayload().(*Event_ScimTokenDeleted); ok { + return x.ScimTokenDeleted + } + return nil +} + +func (x *Event) GetRepositoryCommitDeleted() *PayloadRepositoryCommitDeleted { + if x, ok := x.GetPayload().(*Event_RepositoryCommitDeleted); ok { + return x.RepositoryCommitDeleted + } + return nil +} + +func (x *Event) GetRepositoryLabelCreated() *PayloadRepositoryLabelCreated { + if x, ok := x.GetPayload().(*Event_RepositoryLabelCreated); ok { + return x.RepositoryLabelCreated + } + return nil +} + +func (x *Event) GetRepositoryLabelMoved() *PayloadRepositoryLabelMoved { + if x, ok := x.GetPayload().(*Event_RepositoryLabelMoved); ok { + return x.RepositoryLabelMoved + } + return nil +} + +func (x *Event) GetCuratedPluginDeleted() *PayloadCuratedPluginDeleted { + if x, ok := x.GetPayload().(*Event_CuratedPluginDeleted); ok { + return x.CuratedPluginDeleted + } + return nil +} + +func (x *Event) GetPayloadServerBreakingChangePolicyEnabled() *PayloadServerBreakingChangePolicyEnabled { + if x, ok := x.GetPayload().(*Event_PayloadServerBreakingChangePolicyEnabled); ok { + return x.PayloadServerBreakingChangePolicyEnabled + } + return nil +} + +func (x *Event) GetPayloadServerBreakingChangePolicyDisabled() *PayloadServerBreakingChangePolicyDisabled { + if x, ok := x.GetPayload().(*Event_PayloadServerBreakingChangePolicyDisabled); ok { + return x.PayloadServerBreakingChangePolicyDisabled + } + return nil +} + +type isEvent_Payload interface { + isEvent_Payload() +} + +type Event_OrganizationCreated struct { + OrganizationCreated *PayloadOrganizationCreated `protobuf:"bytes,7,opt,name=organization_created,json=organizationCreated,proto3,oneof"` +} + +type Event_OrganizationDeleted struct { + OrganizationDeleted *PayloadOrganizationDeleted `protobuf:"bytes,8,opt,name=organization_deleted,json=organizationDeleted,proto3,oneof"` +} + +type Event_OrganizationMemberAdded struct { + OrganizationMemberAdded *PayloadOrganizationMemberAdded `protobuf:"bytes,9,opt,name=organization_member_added,json=organizationMemberAdded,proto3,oneof"` +} + +type Event_OrganizationMemberRoleChanged struct { + OrganizationMemberRoleChanged *PayloadOrganizationMemberRoleChanged `protobuf:"bytes,10,opt,name=organization_member_role_changed,json=organizationMemberRoleChanged,proto3,oneof"` +} + +type Event_OrganizationMemberRemoved struct { + OrganizationMemberRemoved *PayloadOrganizationMemberRemoved `protobuf:"bytes,11,opt,name=organization_member_removed,json=organizationMemberRemoved,proto3,oneof"` +} + +type Event_RepositoryCreated struct { + RepositoryCreated *PayloadRepositoryCreated `protobuf:"bytes,12,opt,name=repository_created,json=repositoryCreated,proto3,oneof"` +} + +type Event_RepositoryDeleted struct { + RepositoryDeleted *PayloadRepositoryDeleted `protobuf:"bytes,13,opt,name=repository_deleted,json=repositoryDeleted,proto3,oneof"` +} + +type Event_RepositoryCommitPushed struct { + RepositoryCommitPushed *PayloadRepositoryCommitPushed `protobuf:"bytes,14,opt,name=repository_commit_pushed,json=repositoryCommitPushed,proto3,oneof"` +} + +type Event_RepositoryContributorAdded struct { + RepositoryContributorAdded *PayloadRepositoryContributorAdded `protobuf:"bytes,15,opt,name=repository_contributor_added,json=repositoryContributorAdded,proto3,oneof"` +} + +type Event_RepositoryContributorRoleChanged struct { + RepositoryContributorRoleChanged *PayloadRepositoryContributorRoleChanged `protobuf:"bytes,16,opt,name=repository_contributor_role_changed,json=repositoryContributorRoleChanged,proto3,oneof"` +} + +type Event_RepositoryContributorRemoved struct { + RepositoryContributorRemoved *PayloadRepositoryContributorRemoved `protobuf:"bytes,17,opt,name=repository_contributor_removed,json=repositoryContributorRemoved,proto3,oneof"` +} + +type Event_RepositoryVisibilityChanged struct { + RepositoryVisibilityChanged *PayloadRepositoryVisibilityChanged `protobuf:"bytes,18,opt,name=repository_visibility_changed,json=repositoryVisibilityChanged,proto3,oneof"` +} + +type Event_PluginCreated struct { + // Deprecated: Do not use. + PluginCreated *PayloadPluginCreated `protobuf:"bytes,19,opt,name=plugin_created,json=pluginCreated,proto3,oneof"` +} + +type Event_PluginDeleted struct { + // Deprecated: Do not use. + PluginDeleted *PayloadPluginDeleted `protobuf:"bytes,20,opt,name=plugin_deleted,json=pluginDeleted,proto3,oneof"` +} + +type Event_UserCreated struct { + UserCreated *PayloadUserCreated `protobuf:"bytes,21,opt,name=user_created,json=userCreated,proto3,oneof"` +} + +type Event_UserDeactivated struct { + UserDeactivated *PayloadUserDeactivated `protobuf:"bytes,22,opt,name=user_deactivated,json=userDeactivated,proto3,oneof"` +} + +type Event_UserDeleted struct { + UserDeleted *PayloadUserDeleted `protobuf:"bytes,23,opt,name=user_deleted,json=userDeleted,proto3,oneof"` +} + +type Event_UserLoggedIn struct { + UserLoggedIn *PayloadUserLoggedIn `protobuf:"bytes,24,opt,name=user_logged_in,json=userLoggedIn,proto3,oneof"` +} + +type Event_UserLoggedOut struct { + UserLoggedOut *PayloadUserLoggedOut `protobuf:"bytes,25,opt,name=user_logged_out,json=userLoggedOut,proto3,oneof"` +} + +type Event_CuratedPluginCreated struct { + CuratedPluginCreated *PayloadCuratedPluginCreated `protobuf:"bytes,26,opt,name=curated_plugin_created,json=curatedPluginCreated,proto3,oneof"` +} + +type Event_IdpGroupAdded struct { + IdpGroupAdded *PayloadOrganizationIDPGroupAdded `protobuf:"bytes,27,opt,name=idp_group_added,json=idpGroupAdded,proto3,oneof"` +} + +type Event_IdpGroupRemoved struct { + IdpGroupRemoved *PayloadOrganizationIDPGroupRemoved `protobuf:"bytes,28,opt,name=idp_group_removed,json=idpGroupRemoved,proto3,oneof"` +} + +type Event_TokenCreated struct { + TokenCreated *PayloadTokenCreated `protobuf:"bytes,29,opt,name=token_created,json=tokenCreated,proto3,oneof"` +} + +type Event_TokenDeleted struct { + TokenDeleted *PayloadTokenDeleted `protobuf:"bytes,30,opt,name=token_deleted,json=tokenDeleted,proto3,oneof"` +} + +type Event_UserReactivated struct { + UserReactivated *PayloadUserReactivated `protobuf:"bytes,31,opt,name=user_reactivated,json=userReactivated,proto3,oneof"` +} + +type Event_ScimTokenCreated struct { + ScimTokenCreated *PayloadSCIMTokenCreated `protobuf:"bytes,32,opt,name=scim_token_created,json=scimTokenCreated,proto3,oneof"` +} + +type Event_ScimTokenDeleted struct { + ScimTokenDeleted *PayloadSCIMTokenDeleted `protobuf:"bytes,33,opt,name=scim_token_deleted,json=scimTokenDeleted,proto3,oneof"` +} + +type Event_RepositoryCommitDeleted struct { + RepositoryCommitDeleted *PayloadRepositoryCommitDeleted `protobuf:"bytes,34,opt,name=repository_commit_deleted,json=repositoryCommitDeleted,proto3,oneof"` +} + +type Event_RepositoryLabelCreated struct { + RepositoryLabelCreated *PayloadRepositoryLabelCreated `protobuf:"bytes,35,opt,name=repository_label_created,json=repositoryLabelCreated,proto3,oneof"` +} + +type Event_RepositoryLabelMoved struct { + RepositoryLabelMoved *PayloadRepositoryLabelMoved `protobuf:"bytes,36,opt,name=repository_label_moved,json=repositoryLabelMoved,proto3,oneof"` +} + +type Event_CuratedPluginDeleted struct { + CuratedPluginDeleted *PayloadCuratedPluginDeleted `protobuf:"bytes,37,opt,name=curated_plugin_deleted,json=curatedPluginDeleted,proto3,oneof"` +} + +type Event_PayloadServerBreakingChangePolicyEnabled struct { + PayloadServerBreakingChangePolicyEnabled *PayloadServerBreakingChangePolicyEnabled `protobuf:"bytes,38,opt,name=payload_server_breaking_change_policy_enabled,json=payloadServerBreakingChangePolicyEnabled,proto3,oneof"` +} + +type Event_PayloadServerBreakingChangePolicyDisabled struct { + PayloadServerBreakingChangePolicyDisabled *PayloadServerBreakingChangePolicyDisabled `protobuf:"bytes,39,opt,name=payload_server_breaking_change_policy_disabled,json=payloadServerBreakingChangePolicyDisabled,proto3,oneof"` +} + +func (*Event_OrganizationCreated) isEvent_Payload() {} + +func (*Event_OrganizationDeleted) isEvent_Payload() {} + +func (*Event_OrganizationMemberAdded) isEvent_Payload() {} + +func (*Event_OrganizationMemberRoleChanged) isEvent_Payload() {} + +func (*Event_OrganizationMemberRemoved) isEvent_Payload() {} + +func (*Event_RepositoryCreated) isEvent_Payload() {} + +func (*Event_RepositoryDeleted) isEvent_Payload() {} + +func (*Event_RepositoryCommitPushed) isEvent_Payload() {} + +func (*Event_RepositoryContributorAdded) isEvent_Payload() {} + +func (*Event_RepositoryContributorRoleChanged) isEvent_Payload() {} + +func (*Event_RepositoryContributorRemoved) isEvent_Payload() {} + +func (*Event_RepositoryVisibilityChanged) isEvent_Payload() {} + +func (*Event_PluginCreated) isEvent_Payload() {} + +func (*Event_PluginDeleted) isEvent_Payload() {} + +func (*Event_UserCreated) isEvent_Payload() {} + +func (*Event_UserDeactivated) isEvent_Payload() {} + +func (*Event_UserDeleted) isEvent_Payload() {} + +func (*Event_UserLoggedIn) isEvent_Payload() {} + +func (*Event_UserLoggedOut) isEvent_Payload() {} + +func (*Event_CuratedPluginCreated) isEvent_Payload() {} + +func (*Event_IdpGroupAdded) isEvent_Payload() {} + +func (*Event_IdpGroupRemoved) isEvent_Payload() {} + +func (*Event_TokenCreated) isEvent_Payload() {} + +func (*Event_TokenDeleted) isEvent_Payload() {} + +func (*Event_UserReactivated) isEvent_Payload() {} + +func (*Event_ScimTokenCreated) isEvent_Payload() {} + +func (*Event_ScimTokenDeleted) isEvent_Payload() {} + +func (*Event_RepositoryCommitDeleted) isEvent_Payload() {} + +func (*Event_RepositoryLabelCreated) isEvent_Payload() {} + +func (*Event_RepositoryLabelMoved) isEvent_Payload() {} + +func (*Event_CuratedPluginDeleted) isEvent_Payload() {} + +func (*Event_PayloadServerBreakingChangePolicyEnabled) isEvent_Payload() {} + +func (*Event_PayloadServerBreakingChangePolicyDisabled) isEvent_Payload() {} + +type PayloadOrganizationCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadOrganizationCreated) Reset() { + *x = PayloadOrganizationCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadOrganizationCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadOrganizationCreated) ProtoMessage() {} + +func (x *PayloadOrganizationCreated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadOrganizationCreated.ProtoReflect.Descriptor instead. +func (*PayloadOrganizationCreated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{4} +} + +type PayloadOrganizationDeleted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadOrganizationDeleted) Reset() { + *x = PayloadOrganizationDeleted{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadOrganizationDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadOrganizationDeleted) ProtoMessage() {} + +func (x *PayloadOrganizationDeleted) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadOrganizationDeleted.ProtoReflect.Descriptor instead. +func (*PayloadOrganizationDeleted) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{5} +} + +type PayloadOrganizationMemberAdded struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // organization_id is the id of the organization with the new member. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // organization_name is the name of the organization with the new member. + OrganizationName string `protobuf:"bytes,2,opt,name=organization_name,json=organizationName,proto3" json:"organization_name,omitempty"` + // member_role is the role granted to the member added to the organization. + MemberRole v1alpha1.OrganizationRole `protobuf:"varint,3,opt,name=member_role,json=memberRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"member_role,omitempty"` + // member_role_source is the source of the role granted to the member. + MemberRoleSource v1alpha1.OrganizationRoleSource `protobuf:"varint,4,opt,name=member_role_source,json=memberRoleSource,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource" json:"member_role_source,omitempty"` +} + +func (x *PayloadOrganizationMemberAdded) Reset() { + *x = PayloadOrganizationMemberAdded{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadOrganizationMemberAdded) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadOrganizationMemberAdded) ProtoMessage() {} + +func (x *PayloadOrganizationMemberAdded) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadOrganizationMemberAdded.ProtoReflect.Descriptor instead. +func (*PayloadOrganizationMemberAdded) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{6} +} + +func (x *PayloadOrganizationMemberAdded) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *PayloadOrganizationMemberAdded) GetOrganizationName() string { + if x != nil { + return x.OrganizationName + } + return "" +} + +func (x *PayloadOrganizationMemberAdded) GetMemberRole() v1alpha1.OrganizationRole { + if x != nil { + return x.MemberRole + } + return v1alpha1.OrganizationRole(0) +} + +func (x *PayloadOrganizationMemberAdded) GetMemberRoleSource() v1alpha1.OrganizationRoleSource { + if x != nil { + return x.MemberRoleSource + } + return v1alpha1.OrganizationRoleSource(0) +} + +type PayloadOrganizationMemberRoleChanged struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // organization_id is the id of the organization within which the role was changed. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // organization_name is the name of the organization within which the role was changed. + OrganizationName string `protobuf:"bytes,2,opt,name=organization_name,json=organizationName,proto3" json:"organization_name,omitempty"` + // old_role is the old role of the member whose role was changed. + OldRole v1alpha1.OrganizationRole `protobuf:"varint,3,opt,name=old_role,json=oldRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"old_role,omitempty"` + // new_role is the new role of the member whose role was changed. + NewRole v1alpha1.OrganizationRole `protobuf:"varint,4,opt,name=new_role,json=newRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"new_role,omitempty"` + // old_member_role_source is the old source of the role granted to the member. + OldMemberRoleSource v1alpha1.OrganizationRoleSource `protobuf:"varint,5,opt,name=old_member_role_source,json=oldMemberRoleSource,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource" json:"old_member_role_source,omitempty"` + // new_member_role_source is the new source of the role granted to the member. + NewMemberRoleSource v1alpha1.OrganizationRoleSource `protobuf:"varint,6,opt,name=new_member_role_source,json=newMemberRoleSource,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource" json:"new_member_role_source,omitempty"` +} + +func (x *PayloadOrganizationMemberRoleChanged) Reset() { + *x = PayloadOrganizationMemberRoleChanged{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadOrganizationMemberRoleChanged) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadOrganizationMemberRoleChanged) ProtoMessage() {} + +func (x *PayloadOrganizationMemberRoleChanged) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadOrganizationMemberRoleChanged.ProtoReflect.Descriptor instead. +func (*PayloadOrganizationMemberRoleChanged) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{7} +} + +func (x *PayloadOrganizationMemberRoleChanged) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *PayloadOrganizationMemberRoleChanged) GetOrganizationName() string { + if x != nil { + return x.OrganizationName + } + return "" +} + +func (x *PayloadOrganizationMemberRoleChanged) GetOldRole() v1alpha1.OrganizationRole { + if x != nil { + return x.OldRole + } + return v1alpha1.OrganizationRole(0) +} + +func (x *PayloadOrganizationMemberRoleChanged) GetNewRole() v1alpha1.OrganizationRole { + if x != nil { + return x.NewRole + } + return v1alpha1.OrganizationRole(0) +} + +func (x *PayloadOrganizationMemberRoleChanged) GetOldMemberRoleSource() v1alpha1.OrganizationRoleSource { + if x != nil { + return x.OldMemberRoleSource + } + return v1alpha1.OrganizationRoleSource(0) +} + +func (x *PayloadOrganizationMemberRoleChanged) GetNewMemberRoleSource() v1alpha1.OrganizationRoleSource { + if x != nil { + return x.NewMemberRoleSource + } + return v1alpha1.OrganizationRoleSource(0) +} + +type PayloadOrganizationMemberRemoved struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // organization_id is the id of the organization that the member was removed from. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // organization_name is the name of the organization that the member was removed from. + OrganizationName string `protobuf:"bytes,2,opt,name=organization_name,json=organizationName,proto3" json:"organization_name,omitempty"` + // member_role is the role that the member had when removed from the organization. + MemberRole v1alpha1.OrganizationRole `protobuf:"varint,3,opt,name=member_role,json=memberRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"member_role,omitempty"` + // member_role_source is the source of the role granted to the member. + MemberRoleSource v1alpha1.OrganizationRoleSource `protobuf:"varint,4,opt,name=member_role_source,json=memberRoleSource,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource" json:"member_role_source,omitempty"` +} + +func (x *PayloadOrganizationMemberRemoved) Reset() { + *x = PayloadOrganizationMemberRemoved{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadOrganizationMemberRemoved) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadOrganizationMemberRemoved) ProtoMessage() {} + +func (x *PayloadOrganizationMemberRemoved) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadOrganizationMemberRemoved.ProtoReflect.Descriptor instead. +func (*PayloadOrganizationMemberRemoved) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{8} +} + +func (x *PayloadOrganizationMemberRemoved) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *PayloadOrganizationMemberRemoved) GetOrganizationName() string { + if x != nil { + return x.OrganizationName + } + return "" +} + +func (x *PayloadOrganizationMemberRemoved) GetMemberRole() v1alpha1.OrganizationRole { + if x != nil { + return x.MemberRole + } + return v1alpha1.OrganizationRole(0) +} + +func (x *PayloadOrganizationMemberRemoved) GetMemberRoleSource() v1alpha1.OrganizationRoleSource { + if x != nil { + return x.MemberRoleSource + } + return v1alpha1.OrganizationRoleSource(0) +} + +type PayloadOrganizationIDPGroupAdded struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // organization_id is the id of the organization with the new IDP group. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // organization_name is the name of the organization with the new IDP group. + OrganizationName string `protobuf:"bytes,2,opt,name=organization_name,json=organizationName,proto3" json:"organization_name,omitempty"` +} + +func (x *PayloadOrganizationIDPGroupAdded) Reset() { + *x = PayloadOrganizationIDPGroupAdded{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadOrganizationIDPGroupAdded) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadOrganizationIDPGroupAdded) ProtoMessage() {} + +func (x *PayloadOrganizationIDPGroupAdded) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadOrganizationIDPGroupAdded.ProtoReflect.Descriptor instead. +func (*PayloadOrganizationIDPGroupAdded) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{9} +} + +func (x *PayloadOrganizationIDPGroupAdded) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *PayloadOrganizationIDPGroupAdded) GetOrganizationName() string { + if x != nil { + return x.OrganizationName + } + return "" +} + +type PayloadOrganizationIDPGroupRemoved struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // organization_id is the id of the organization with the removed IDP group. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // organization_name is the name of the organization with the removed IDP group. + OrganizationName string `protobuf:"bytes,2,opt,name=organization_name,json=organizationName,proto3" json:"organization_name,omitempty"` +} + +func (x *PayloadOrganizationIDPGroupRemoved) Reset() { + *x = PayloadOrganizationIDPGroupRemoved{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadOrganizationIDPGroupRemoved) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadOrganizationIDPGroupRemoved) ProtoMessage() {} + +func (x *PayloadOrganizationIDPGroupRemoved) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadOrganizationIDPGroupRemoved.ProtoReflect.Descriptor instead. +func (*PayloadOrganizationIDPGroupRemoved) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{10} +} + +func (x *PayloadOrganizationIDPGroupRemoved) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *PayloadOrganizationIDPGroupRemoved) GetOrganizationName() string { + if x != nil { + return x.OrganizationName + } + return "" +} + +type PayloadRepositoryCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // visibility is the visibility of the repository. + Visibility v1alpha1.Visibility `protobuf:"varint,3,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Visibility" json:"visibility,omitempty"` +} + +func (x *PayloadRepositoryCreated) Reset() { + *x = PayloadRepositoryCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryCreated) ProtoMessage() {} + +func (x *PayloadRepositoryCreated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryCreated.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryCreated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{11} +} + +func (x *PayloadRepositoryCreated) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryCreated) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryCreated) GetVisibility() v1alpha1.Visibility { + if x != nil { + return x.Visibility + } + return v1alpha1.Visibility(0) +} + +type PayloadRepositoryDeleted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // visibility is the visibility of the repository. + Visibility v1alpha1.Visibility `protobuf:"varint,3,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Visibility" json:"visibility,omitempty"` +} + +func (x *PayloadRepositoryDeleted) Reset() { + *x = PayloadRepositoryDeleted{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryDeleted) ProtoMessage() {} + +func (x *PayloadRepositoryDeleted) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryDeleted.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryDeleted) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{12} +} + +func (x *PayloadRepositoryDeleted) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryDeleted) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryDeleted) GetVisibility() v1alpha1.Visibility { + if x != nil { + return x.Visibility + } + return v1alpha1.Visibility(0) +} + +type PayloadRepositoryCommitPushed struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // repository_id is the id of the repository within which the commit was created. + RepositoryId string `protobuf:"bytes,3,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // repository_name is the name of the repository within which the commit was created. + RepositoryName string `protobuf:"bytes,4,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // tags are the tags included in the push. Optional. + Tags []string `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"` + // draft_name is the name of the draft. Optional. + DraftName string `protobuf:"bytes,6,opt,name=draft_name,json=draftName,proto3" json:"draft_name,omitempty"` + // manifest_digest is the module's manifest digest. + ManifestDigest string `protobuf:"bytes,7,opt,name=manifest_digest,json=manifestDigest,proto3" json:"manifest_digest,omitempty"` +} + +func (x *PayloadRepositoryCommitPushed) Reset() { + *x = PayloadRepositoryCommitPushed{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryCommitPushed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryCommitPushed) ProtoMessage() {} + +func (x *PayloadRepositoryCommitPushed) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryCommitPushed.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryCommitPushed) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{13} +} + +func (x *PayloadRepositoryCommitPushed) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryCommitPushed) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryCommitPushed) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *PayloadRepositoryCommitPushed) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *PayloadRepositoryCommitPushed) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *PayloadRepositoryCommitPushed) GetDraftName() string { + if x != nil { + return x.DraftName + } + return "" +} + +func (x *PayloadRepositoryCommitPushed) GetManifestDigest() string { + if x != nil { + return x.ManifestDigest + } + return "" +} + +type PayloadRepositoryContributorAdded struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // repository_id is the id of the repository with the new contributor. + RepositoryId string `protobuf:"bytes,3,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // repository_name is the name of the repository with the new contributor. + RepositoryName string `protobuf:"bytes,4,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // contributor_role is the role granted to the contributor added to the repository. + ContributorRole v1alpha1.RepositoryRole `protobuf:"varint,5,opt,name=contributor_role,json=contributorRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"contributor_role,omitempty"` +} + +func (x *PayloadRepositoryContributorAdded) Reset() { + *x = PayloadRepositoryContributorAdded{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryContributorAdded) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryContributorAdded) ProtoMessage() {} + +func (x *PayloadRepositoryContributorAdded) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryContributorAdded.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryContributorAdded) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{14} +} + +func (x *PayloadRepositoryContributorAdded) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryContributorAdded) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryContributorAdded) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *PayloadRepositoryContributorAdded) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *PayloadRepositoryContributorAdded) GetContributorRole() v1alpha1.RepositoryRole { + if x != nil { + return x.ContributorRole + } + return v1alpha1.RepositoryRole(0) +} + +type PayloadRepositoryContributorRoleChanged struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // repository_id is the id of the repository within which the role was changed. + RepositoryId string `protobuf:"bytes,3,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // repository_name is the name of the repository within which the role was changed. + RepositoryName string `protobuf:"bytes,4,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // old_role is the old role of the contributor whose role was changed. + OldRole v1alpha1.RepositoryRole `protobuf:"varint,5,opt,name=old_role,json=oldRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"old_role,omitempty"` + // new_role is the new role of the contributor whose role was changed. + NewRole v1alpha1.RepositoryRole `protobuf:"varint,6,opt,name=new_role,json=newRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"new_role,omitempty"` +} + +func (x *PayloadRepositoryContributorRoleChanged) Reset() { + *x = PayloadRepositoryContributorRoleChanged{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryContributorRoleChanged) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryContributorRoleChanged) ProtoMessage() {} + +func (x *PayloadRepositoryContributorRoleChanged) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryContributorRoleChanged.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryContributorRoleChanged) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{15} +} + +func (x *PayloadRepositoryContributorRoleChanged) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryContributorRoleChanged) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryContributorRoleChanged) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *PayloadRepositoryContributorRoleChanged) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *PayloadRepositoryContributorRoleChanged) GetOldRole() v1alpha1.RepositoryRole { + if x != nil { + return x.OldRole + } + return v1alpha1.RepositoryRole(0) +} + +func (x *PayloadRepositoryContributorRoleChanged) GetNewRole() v1alpha1.RepositoryRole { + if x != nil { + return x.NewRole + } + return v1alpha1.RepositoryRole(0) +} + +type PayloadRepositoryContributorRemoved struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // repository_id is the id of the repository that the contributor was removed from. + RepositoryId string `protobuf:"bytes,3,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // repository_name is the name of the repository that the contributor was removed from. + RepositoryName string `protobuf:"bytes,4,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // contributor_role is the role that the contributor had when removed from the repository. + ContributorRole v1alpha1.RepositoryRole `protobuf:"varint,5,opt,name=contributor_role,json=contributorRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"contributor_role,omitempty"` +} + +func (x *PayloadRepositoryContributorRemoved) Reset() { + *x = PayloadRepositoryContributorRemoved{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryContributorRemoved) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryContributorRemoved) ProtoMessage() {} + +func (x *PayloadRepositoryContributorRemoved) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryContributorRemoved.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryContributorRemoved) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{16} +} + +func (x *PayloadRepositoryContributorRemoved) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryContributorRemoved) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryContributorRemoved) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *PayloadRepositoryContributorRemoved) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *PayloadRepositoryContributorRemoved) GetContributorRole() v1alpha1.RepositoryRole { + if x != nil { + return x.ContributorRole + } + return v1alpha1.RepositoryRole(0) +} + +type PayloadRepositoryVisibilityChanged struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // old_visibility is the old visibility of the repository. + OldVisibility v1alpha1.Visibility `protobuf:"varint,3,opt,name=old_visibility,json=oldVisibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Visibility" json:"old_visibility,omitempty"` + // new_visibility is the new visibility of the repository. + NewVisibility v1alpha1.Visibility `protobuf:"varint,4,opt,name=new_visibility,json=newVisibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Visibility" json:"new_visibility,omitempty"` +} + +func (x *PayloadRepositoryVisibilityChanged) Reset() { + *x = PayloadRepositoryVisibilityChanged{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryVisibilityChanged) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryVisibilityChanged) ProtoMessage() {} + +func (x *PayloadRepositoryVisibilityChanged) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryVisibilityChanged.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryVisibilityChanged) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{17} +} + +func (x *PayloadRepositoryVisibilityChanged) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryVisibilityChanged) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryVisibilityChanged) GetOldVisibility() v1alpha1.Visibility { + if x != nil { + return x.OldVisibility + } + return v1alpha1.Visibility(0) +} + +func (x *PayloadRepositoryVisibilityChanged) GetNewVisibility() v1alpha1.Visibility { + if x != nil { + return x.NewVisibility + } + return v1alpha1.Visibility(0) +} + +// Deprecated: Do not use. +type PayloadPluginCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the plugin. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the plugin. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // visibility is the visibility of the plugin. + Visibility v1alpha1.PluginVisibility `protobuf:"varint,3,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility" json:"visibility,omitempty"` +} + +func (x *PayloadPluginCreated) Reset() { + *x = PayloadPluginCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadPluginCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadPluginCreated) ProtoMessage() {} + +func (x *PayloadPluginCreated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadPluginCreated.ProtoReflect.Descriptor instead. +func (*PayloadPluginCreated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{18} +} + +func (x *PayloadPluginCreated) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadPluginCreated) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadPluginCreated) GetVisibility() v1alpha1.PluginVisibility { + if x != nil { + return x.Visibility + } + return v1alpha1.PluginVisibility(0) +} + +// Deprecated: Do not use. +type PayloadPluginDeleted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the plugin. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the plugin. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // visibility is the visibility of the plugin. + Visibility v1alpha1.PluginVisibility `protobuf:"varint,3,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility" json:"visibility,omitempty"` +} + +func (x *PayloadPluginDeleted) Reset() { + *x = PayloadPluginDeleted{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadPluginDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadPluginDeleted) ProtoMessage() {} + +func (x *PayloadPluginDeleted) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadPluginDeleted.ProtoReflect.Descriptor instead. +func (*PayloadPluginDeleted) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{19} +} + +func (x *PayloadPluginDeleted) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadPluginDeleted) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadPluginDeleted) GetVisibility() v1alpha1.PluginVisibility { + if x != nil { + return x.Visibility + } + return v1alpha1.PluginVisibility(0) +} + +type PayloadUserCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadUserCreated) Reset() { + *x = PayloadUserCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadUserCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadUserCreated) ProtoMessage() {} + +func (x *PayloadUserCreated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadUserCreated.ProtoReflect.Descriptor instead. +func (*PayloadUserCreated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{20} +} + +type PayloadUserReactivated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadUserReactivated) Reset() { + *x = PayloadUserReactivated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadUserReactivated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadUserReactivated) ProtoMessage() {} + +func (x *PayloadUserReactivated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadUserReactivated.ProtoReflect.Descriptor instead. +func (*PayloadUserReactivated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{21} +} + +type PayloadUserDeactivated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadUserDeactivated) Reset() { + *x = PayloadUserDeactivated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadUserDeactivated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadUserDeactivated) ProtoMessage() {} + +func (x *PayloadUserDeactivated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadUserDeactivated.ProtoReflect.Descriptor instead. +func (*PayloadUserDeactivated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{22} +} + +type PayloadUserDeleted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadUserDeleted) Reset() { + *x = PayloadUserDeleted{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadUserDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadUserDeleted) ProtoMessage() {} + +func (x *PayloadUserDeleted) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadUserDeleted.ProtoReflect.Descriptor instead. +func (*PayloadUserDeleted) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{23} +} + +type PayloadUserLoggedIn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadUserLoggedIn) Reset() { + *x = PayloadUserLoggedIn{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadUserLoggedIn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadUserLoggedIn) ProtoMessage() {} + +func (x *PayloadUserLoggedIn) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadUserLoggedIn.ProtoReflect.Descriptor instead. +func (*PayloadUserLoggedIn) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{24} +} + +type PayloadUserLoggedOut struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadUserLoggedOut) Reset() { + *x = PayloadUserLoggedOut{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadUserLoggedOut) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadUserLoggedOut) ProtoMessage() {} + +func (x *PayloadUserLoggedOut) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadUserLoggedOut.ProtoReflect.Descriptor instead. +func (*PayloadUserLoggedOut) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{25} +} + +type PayloadCuratedPluginCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the plugin. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the plugin. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` +} + +func (x *PayloadCuratedPluginCreated) Reset() { + *x = PayloadCuratedPluginCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadCuratedPluginCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadCuratedPluginCreated) ProtoMessage() {} + +func (x *PayloadCuratedPluginCreated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadCuratedPluginCreated.ProtoReflect.Descriptor instead. +func (*PayloadCuratedPluginCreated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{26} +} + +func (x *PayloadCuratedPluginCreated) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadCuratedPluginCreated) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +type PayloadCuratedPluginDeleted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the plugin. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the plugin. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` +} + +func (x *PayloadCuratedPluginDeleted) Reset() { + *x = PayloadCuratedPluginDeleted{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadCuratedPluginDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadCuratedPluginDeleted) ProtoMessage() {} + +func (x *PayloadCuratedPluginDeleted) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadCuratedPluginDeleted.ProtoReflect.Descriptor instead. +func (*PayloadCuratedPluginDeleted) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{27} +} + +func (x *PayloadCuratedPluginDeleted) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadCuratedPluginDeleted) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +type PayloadTokenCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the token. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // token_expiry_time is the expiry time of the token. + TokenExpiryTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=token_expiry_time,json=tokenExpiryTime,proto3" json:"token_expiry_time,omitempty"` +} + +func (x *PayloadTokenCreated) Reset() { + *x = PayloadTokenCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadTokenCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadTokenCreated) ProtoMessage() {} + +func (x *PayloadTokenCreated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadTokenCreated.ProtoReflect.Descriptor instead. +func (*PayloadTokenCreated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{28} +} + +func (x *PayloadTokenCreated) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadTokenCreated) GetTokenExpiryTime() *timestamppb.Timestamp { + if x != nil { + return x.TokenExpiryTime + } + return nil +} + +type PayloadTokenDeleted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the token. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` +} + +func (x *PayloadTokenDeleted) Reset() { + *x = PayloadTokenDeleted{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadTokenDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadTokenDeleted) ProtoMessage() {} + +func (x *PayloadTokenDeleted) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadTokenDeleted.ProtoReflect.Descriptor instead. +func (*PayloadTokenDeleted) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{29} +} + +func (x *PayloadTokenDeleted) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +type PayloadSCIMTokenCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // token_expiry_time is the expiry time of the token. + TokenExpiryTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=token_expiry_time,json=tokenExpiryTime,proto3" json:"token_expiry_time,omitempty"` +} + +func (x *PayloadSCIMTokenCreated) Reset() { + *x = PayloadSCIMTokenCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadSCIMTokenCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadSCIMTokenCreated) ProtoMessage() {} + +func (x *PayloadSCIMTokenCreated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadSCIMTokenCreated.ProtoReflect.Descriptor instead. +func (*PayloadSCIMTokenCreated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{30} +} + +func (x *PayloadSCIMTokenCreated) GetTokenExpiryTime() *timestamppb.Timestamp { + if x != nil { + return x.TokenExpiryTime + } + return nil +} + +type PayloadSCIMTokenDeleted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadSCIMTokenDeleted) Reset() { + *x = PayloadSCIMTokenDeleted{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadSCIMTokenDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadSCIMTokenDeleted) ProtoMessage() {} + +func (x *PayloadSCIMTokenDeleted) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadSCIMTokenDeleted.ProtoReflect.Descriptor instead. +func (*PayloadSCIMTokenDeleted) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{31} +} + +type PayloadRepositoryCommitDeleted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository from which the commit will be deleted. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository from which the commit will be deleted. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // repository_id is the id of the repository from which the commit will be deleted. + RepositoryId string `protobuf:"bytes,3,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // repository_name is the name of the repository from which the commit will be deleted. + RepositoryName string `protobuf:"bytes,4,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // draft_name is the name of the draft. Optional. + DraftName string `protobuf:"bytes,5,opt,name=draft_name,json=draftName,proto3" json:"draft_name,omitempty"` +} + +func (x *PayloadRepositoryCommitDeleted) Reset() { + *x = PayloadRepositoryCommitDeleted{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryCommitDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryCommitDeleted) ProtoMessage() {} + +func (x *PayloadRepositoryCommitDeleted) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryCommitDeleted.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryCommitDeleted) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{32} +} + +func (x *PayloadRepositoryCommitDeleted) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryCommitDeleted) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryCommitDeleted) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *PayloadRepositoryCommitDeleted) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *PayloadRepositoryCommitDeleted) GetDraftName() string { + if x != nil { + return x.DraftName + } + return "" +} + +type PayloadRepositoryLabelCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository on which the label will be created. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository on which the label will be created. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // repository_id is the id of the repository on which the label will be created. + RepositoryId string `protobuf:"bytes,3,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // repository_name is the name of the repository from which the label will be created. + RepositoryName string `protobuf:"bytes,4,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // label_namespace is the namespace of the label that was created. + LabelNamespace string `protobuf:"bytes,5,opt,name=label_namespace,json=labelNamespace,proto3" json:"label_namespace,omitempty"` + // commit_id is the id of the commit on which the label was created. + CommitId string `protobuf:"bytes,6,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` +} + +func (x *PayloadRepositoryLabelCreated) Reset() { + *x = PayloadRepositoryLabelCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryLabelCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryLabelCreated) ProtoMessage() {} + +func (x *PayloadRepositoryLabelCreated) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryLabelCreated.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryLabelCreated) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{33} +} + +func (x *PayloadRepositoryLabelCreated) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryLabelCreated) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryLabelCreated) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *PayloadRepositoryLabelCreated) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *PayloadRepositoryLabelCreated) GetLabelNamespace() string { + if x != nil { + return x.LabelNamespace + } + return "" +} + +func (x *PayloadRepositoryLabelCreated) GetCommitId() string { + if x != nil { + return x.CommitId + } + return "" +} + +type PayloadRepositoryLabelMoved struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // owner_id is the id of the owner of the repository on which the label will be moved. + OwnerId string `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + // owner_name is the name of the owner of the repository on which the label will be moved. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // repository_id is the id of the repository on which the label will be moved. + RepositoryId string `protobuf:"bytes,3,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // repository_name is the name of the repository from which the label will be moved. + RepositoryName string `protobuf:"bytes,4,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // label_namespace is the namespace of the label that was moved. + LabelNamespace string `protobuf:"bytes,5,opt,name=label_namespace,json=labelNamespace,proto3" json:"label_namespace,omitempty"` + // to_commit_id is the id of the commit on which the label was moved to. + ToCommitId string `protobuf:"bytes,6,opt,name=to_commit_id,json=toCommitId,proto3" json:"to_commit_id,omitempty"` + // from_commit_id is the id of the commit on which the label was moved from. + FromCommitId string `protobuf:"bytes,7,opt,name=from_commit_id,json=fromCommitId,proto3" json:"from_commit_id,omitempty"` +} + +func (x *PayloadRepositoryLabelMoved) Reset() { + *x = PayloadRepositoryLabelMoved{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadRepositoryLabelMoved) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadRepositoryLabelMoved) ProtoMessage() {} + +func (x *PayloadRepositoryLabelMoved) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadRepositoryLabelMoved.ProtoReflect.Descriptor instead. +func (*PayloadRepositoryLabelMoved) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{34} +} + +func (x *PayloadRepositoryLabelMoved) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *PayloadRepositoryLabelMoved) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *PayloadRepositoryLabelMoved) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *PayloadRepositoryLabelMoved) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *PayloadRepositoryLabelMoved) GetLabelNamespace() string { + if x != nil { + return x.LabelNamespace + } + return "" +} + +func (x *PayloadRepositoryLabelMoved) GetToCommitId() string { + if x != nil { + return x.ToCommitId + } + return "" +} + +func (x *PayloadRepositoryLabelMoved) GetFromCommitId() string { + if x != nil { + return x.FromCommitId + } + return "" +} + +type PayloadServerBreakingChangePolicyEnabled struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // category is the category of breaking changes. + Category v1alpha1.BreakingChangeCategory `protobuf:"varint,1,opt,name=category,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangeCategory" json:"category,omitempty"` + // ignore_unstable_packages tracks breaking change enforcement for unstable packages. + IgnoreUnstablePackages *bool `protobuf:"varint,2,opt,name=ignore_unstable_packages,json=ignoreUnstablePackages,proto3,oneof" json:"ignore_unstable_packages,omitempty"` +} + +func (x *PayloadServerBreakingChangePolicyEnabled) Reset() { + *x = PayloadServerBreakingChangePolicyEnabled{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadServerBreakingChangePolicyEnabled) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadServerBreakingChangePolicyEnabled) ProtoMessage() {} + +func (x *PayloadServerBreakingChangePolicyEnabled) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadServerBreakingChangePolicyEnabled.ProtoReflect.Descriptor instead. +func (*PayloadServerBreakingChangePolicyEnabled) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{35} +} + +func (x *PayloadServerBreakingChangePolicyEnabled) GetCategory() v1alpha1.BreakingChangeCategory { + if x != nil { + return x.Category + } + return v1alpha1.BreakingChangeCategory(0) +} + +func (x *PayloadServerBreakingChangePolicyEnabled) GetIgnoreUnstablePackages() bool { + if x != nil && x.IgnoreUnstablePackages != nil { + return *x.IgnoreUnstablePackages + } + return false +} + +type PayloadServerBreakingChangePolicyDisabled struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PayloadServerBreakingChangePolicyDisabled) Reset() { + *x = PayloadServerBreakingChangePolicyDisabled{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_event_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadServerBreakingChangePolicyDisabled) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadServerBreakingChangePolicyDisabled) ProtoMessage() {} + +func (x *PayloadServerBreakingChangePolicyDisabled) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_event_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadServerBreakingChangePolicyDisabled.ProtoReflect.Descriptor instead. +func (*PayloadServerBreakingChangePolicyDisabled) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_event_proto_rawDescGZIP(), []int{36} +} + +var File_audit_v1alpha1_event_proto protoreflect.FileDescriptor + +var file_audit_v1alpha1_event_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x26, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x72, 0x0a, 0x05, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x12, + 0x45, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x78, 0x0a, 0x08, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, + 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x59, 0x0a, 0x0d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, + 0xc3, 0x23, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x61, + 0x63, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x05, 0x61, 0x63, 0x74, 0x6f, 0x72, + 0x12, 0x4c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x39, + 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x51, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x77, 0x0a, 0x14, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, + 0x52, 0x13, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x77, 0x0a, 0x14, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x13, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x84, + 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x41, 0x64, 0x64, 0x65, 0x64, 0x48, 0x00, 0x52, 0x17, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x97, 0x01, 0x0a, 0x20, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, 0x6f, + 0x6c, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x48, 0x00, + 0x52, 0x1d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, + 0x8a, 0x01, 0x0a, 0x1b, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x48, + 0x00, 0x52, 0x19, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x12, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x11, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, + 0x71, 0x0a, 0x12, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x64, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, + 0x11, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x12, 0x81, 0x01, 0x0a, 0x18, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x75, 0x73, 0x68, 0x65, 0x64, 0x18, + 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x50, 0x75, 0x73, 0x68, 0x65, 0x64, 0x48, 0x00, 0x52, 0x16, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x50, 0x75, 0x73, 0x68, 0x65, 0x64, 0x12, 0x8d, 0x01, 0x0a, 0x1c, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, + 0x72, 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x49, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x65, 0x64, 0x48, 0x00, 0x52, 0x1a, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, + 0x72, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0xa0, 0x01, 0x0a, 0x23, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, + 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x18, 0x10, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, + 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x64, 0x48, 0x00, 0x52, 0x20, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x6f, + 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x93, 0x01, 0x0a, 0x1e, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x4b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x48, + 0x00, 0x52, 0x1c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, + 0x90, 0x01, 0x0a, 0x1d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x76, + 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x64, 0x48, 0x00, 0x52, 0x1b, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x64, 0x12, 0x69, 0x0a, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, 0x0d, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x69, 0x0a, + 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x64, 0x42, 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, 0x0d, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x5f, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x73, + 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x6b, 0x0a, 0x10, 0x75, 0x73, 0x65, + 0x72, 0x5f, 0x64, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x18, 0x16, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x44, 0x65, 0x61, 0x63, 0x74, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x12, 0x5f, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x65, + 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x63, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, 0x48, 0x00, 0x52, 0x0c, + 0x75, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, 0x12, 0x66, 0x0a, 0x0f, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x18, + 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, + 0x4f, 0x75, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x67, 0x65, + 0x64, 0x4f, 0x75, 0x74, 0x12, 0x7b, 0x0a, 0x16, 0x63, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x1a, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, + 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x14, 0x63, 0x75, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x72, 0x0a, 0x0f, 0x69, 0x64, 0x70, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x61, + 0x64, 0x64, 0x65, 0x64, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x50, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, + 0x64, 0x64, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0d, 0x69, 0x64, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x78, 0x0a, 0x11, 0x69, 0x64, 0x70, 0x5f, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x50, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, + 0x69, 0x64, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, + 0x62, 0x0a, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x12, 0x62, 0x0a, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x64, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x64, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x6b, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x18, 0x1f, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x64, 0x12, 0x6f, 0x0a, 0x12, 0x73, 0x63, 0x69, 0x6d, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x48, 0x00, 0x52, 0x10, 0x73, 0x63, 0x69, 0x6d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x6f, 0x0a, 0x12, 0x73, 0x63, 0x69, 0x6d, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x48, 0x00, 0x52, 0x10, 0x73, 0x63, 0x69, 0x6d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x84, 0x01, 0x0a, 0x19, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x64, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x64, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x48, 0x00, 0x52, 0x17, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x81, 0x01, + 0x0a, 0x18, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x16, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x7b, 0x0a, 0x16, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, + 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x24, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4c, 0x61, 0x62, 0x65, + 0x6c, 0x4d, 0x6f, 0x76, 0x65, 0x64, 0x48, 0x00, 0x52, 0x14, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x7b, + 0x0a, 0x16, 0x63, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x25, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, + 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x14, 0x63, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0xb3, 0x01, 0x0a, 0x2d, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x62, + 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x26, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x50, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, + 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x00, 0x52, 0x28, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x12, 0xb6, 0x01, 0x0a, 0x2e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x5f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x64, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x18, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x51, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x00, 0x52, + 0x29, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x72, + 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x64, 0x22, 0xc5, 0x02, 0x0a, 0x1e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x41, + 0x64, 0x64, 0x65, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2b, 0x0a, + 0x11, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x5c, 0x0a, 0x0b, 0x6d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x0a, 0x6d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x6f, 0x0a, 0x12, 0x6d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, + 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x10, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, + 0x6f, 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x9c, 0x04, 0x0a, 0x24, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x6f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x56, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x5f, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x07, 0x6f, 0x6c, 0x64, 0x52, 0x6f, 0x6c, 0x65, + 0x12, 0x56, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, + 0x07, 0x6e, 0x65, 0x77, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x76, 0x0a, 0x16, 0x6f, 0x6c, 0x64, 0x5f, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x13, 0x6f, 0x6c, 0x64, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x12, 0x76, 0x0a, 0x16, 0x6e, 0x65, 0x77, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, + 0x6f, 0x6c, 0x65, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x13, 0x6e, 0x65, 0x77, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x6f, + 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0xc7, 0x02, 0x0a, 0x20, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x27, 0x0a, + 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x5c, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, 0x6f, + 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x6f, 0x6c, + 0x65, 0x12, 0x6f, 0x0a, 0x12, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, + 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x41, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x10, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x22, 0x78, 0x0a, 0x20, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x50, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, + 0x2b, 0x0a, 0x11, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x7a, 0x0a, 0x22, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x50, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x6f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x18, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x55, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0xab, 0x01, 0x0a, 0x18, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, + 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x55, 0x0a, + 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x69, + 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x22, 0x83, 0x02, 0x0a, 0x1d, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x50, 0x75, 0x73, 0x68, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, + 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x72, 0x61, 0x66, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x72, 0x61, 0x66, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x69, + 0x67, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x61, 0x6e, 0x69, + 0x66, 0x65, 0x73, 0x74, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x91, 0x02, 0x0a, 0x21, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x65, 0x64, + 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, + 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x64, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x0f, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0xdd, + 0x02, 0x0a, 0x27, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, + 0x6f, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x54, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x52, + 0x07, 0x6f, 0x6c, 0x64, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x54, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x93, + 0x02, 0x0a, 0x23, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x64, + 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x5f, 0x72, 0x6f, + 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x6f, 0x6c, 0x65, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, + 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x9a, 0x02, 0x0a, 0x22, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x5c, 0x0a, 0x0e, 0x6f, 0x6c, 0x64, 0x5f, 0x76, 0x69, 0x73, + 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0d, 0x6f, 0x6c, 0x64, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x12, 0x5c, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x52, 0x0d, 0x6e, 0x65, 0x77, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x22, 0xb1, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x5b, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x69, 0x73, 0x69, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xb1, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x19, + 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x5b, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, + 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x14, 0x0a, 0x12, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, + 0x18, 0x0a, 0x16, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, + 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, + 0x22, 0x16, 0x0a, 0x14, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x4c, + 0x6f, 0x67, 0x67, 0x65, 0x64, 0x4f, 0x75, 0x74, 0x22, 0x57, 0x0a, 0x1b, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, + 0x65, 0x22, 0x57, 0x0a, 0x1b, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x75, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x78, 0x0a, 0x13, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x46, 0x0a, 0x11, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x0f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, + 0x54, 0x69, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x13, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0x61, 0x0a, 0x17, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x46, 0x0a, 0x11, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, + 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x45, + 0x78, 0x70, 0x69, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x64, 0x22, 0xc7, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x1d, 0x0a, 0x0a, 0x64, 0x72, 0x61, 0x66, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x72, 0x61, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xed, + 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, + 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6c, 0x61, 0x62, 0x65, + 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x22, 0x96, + 0x02, 0x0a, 0x1b, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x19, + 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x27, 0x0a, + 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, + 0x20, 0x0a, 0x0c, 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, + 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x43, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x22, 0xe5, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, + 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x12, 0x5d, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, + 0x6f, 0x72, 0x79, 0x12, 0x3d, 0x0a, 0x18, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x75, 0x6e, + 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x16, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x55, + 0x6e, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x88, + 0x01, 0x01, 0x42, 0x1b, 0x0a, 0x19, 0x5f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x75, 0x6e, + 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, + 0x2b, 0x0a, 0x29, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2a, 0x53, 0x0a, 0x09, + 0x41, 0x63, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x43, 0x54, + 0x4f, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x43, + 0x54, 0x4f, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, + 0x02, 0x2a, 0xd8, 0x03, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x52, 0x45, 0x53, + 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, + 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x25, 0x0a, 0x21, 0x52, 0x45, 0x53, + 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, + 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x03, + 0x12, 0x28, 0x0a, 0x24, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, + 0x44, 0x50, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x09, 0x12, 0x1c, 0x0a, 0x18, 0x52, 0x45, + 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, + 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x10, 0x04, 0x12, 0x28, 0x0a, 0x24, 0x52, 0x45, 0x53, 0x4f, + 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, + 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, + 0x10, 0x05, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x43, + 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x10, 0x06, 0x12, 0x1c, 0x0a, 0x14, 0x52, 0x45, 0x53, 0x4f, 0x55, + 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x10, + 0x07, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, + 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x55, 0x52, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x50, + 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x10, 0x08, 0x12, 0x17, 0x0a, 0x13, 0x52, 0x45, 0x53, 0x4f, 0x55, + 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0x0a, + 0x12, 0x1c, 0x0a, 0x18, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x53, 0x43, 0x49, 0x4d, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0x0b, 0x12, 0x22, + 0x0a, 0x1e, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x4c, 0x41, 0x42, 0x45, 0x4c, + 0x10, 0x0c, 0x12, 0x18, 0x0a, 0x14, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x10, 0x0d, 0x2a, 0xb9, 0x0a, 0x0a, + 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x45, 0x56, + 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x45, + 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, + 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x02, + 0x12, 0x28, 0x0a, 0x24, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, + 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, + 0x45, 0x52, 0x5f, 0x41, 0x44, 0x44, 0x45, 0x44, 0x10, 0x03, 0x12, 0x2f, 0x0a, 0x2b, 0x45, 0x56, + 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, + 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4c, + 0x45, 0x5f, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x04, 0x12, 0x2a, 0x0a, 0x26, 0x45, + 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, + 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x5f, 0x52, 0x45, + 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x05, 0x12, 0x2b, 0x0a, 0x27, 0x45, 0x56, 0x45, 0x4e, 0x54, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x50, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x41, 0x44, 0x44, + 0x45, 0x44, 0x10, 0x15, 0x12, 0x2d, 0x0a, 0x29, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x49, 0x44, 0x50, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, + 0x44, 0x10, 0x16, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x43, 0x52, 0x45, + 0x41, 0x54, 0x45, 0x44, 0x10, 0x06, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, + 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x07, 0x12, 0x27, 0x0a, 0x23, 0x45, 0x56, 0x45, + 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, + 0x52, 0x59, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x5f, 0x50, 0x55, 0x53, 0x48, 0x45, 0x44, + 0x10, 0x08, 0x12, 0x2b, 0x0a, 0x27, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x43, 0x4f, 0x4e, 0x54, + 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x5f, 0x41, 0x44, 0x44, 0x45, 0x44, 0x10, 0x09, 0x12, + 0x32, 0x0a, 0x2e, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, + 0x55, 0x54, 0x4f, 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, + 0x44, 0x10, 0x0a, 0x12, 0x2d, 0x0a, 0x29, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x43, 0x4f, 0x4e, + 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44, + 0x10, 0x0b, 0x12, 0x2c, 0x0a, 0x28, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x56, 0x49, 0x53, 0x49, + 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x0c, + 0x12, 0x21, 0x0a, 0x19, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, + 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x0d, 0x1a, + 0x02, 0x08, 0x01, 0x12, 0x21, 0x0a, 0x19, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, + 0x10, 0x0e, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x25, 0x0a, 0x21, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x55, 0x52, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x4c, 0x55, + 0x47, 0x49, 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x14, 0x12, 0x25, 0x0a, + 0x21, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x55, 0x52, 0x41, + 0x54, 0x45, 0x44, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, + 0x45, 0x44, 0x10, 0x1f, 0x12, 0x1b, 0x0a, 0x17, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, + 0x0f, 0x12, 0x1b, 0x0a, 0x17, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x53, 0x45, 0x52, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x10, 0x12, 0x1f, + 0x0a, 0x1b, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x53, 0x45, + 0x52, 0x5f, 0x44, 0x45, 0x41, 0x43, 0x54, 0x49, 0x56, 0x41, 0x54, 0x45, 0x44, 0x10, 0x11, 0x12, + 0x1d, 0x0a, 0x19, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x53, + 0x45, 0x52, 0x5f, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x44, 0x5f, 0x49, 0x4e, 0x10, 0x12, 0x12, 0x1e, + 0x0a, 0x1a, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x53, 0x45, + 0x52, 0x5f, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x44, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x13, 0x12, 0x1c, + 0x0a, 0x18, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x4f, 0x4b, + 0x45, 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x17, 0x12, 0x1c, 0x0a, 0x18, + 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, + 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x18, 0x12, 0x1f, 0x0a, 0x1b, 0x45, 0x56, + 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x52, 0x45, + 0x41, 0x43, 0x54, 0x49, 0x56, 0x41, 0x54, 0x45, 0x44, 0x10, 0x19, 0x12, 0x21, 0x0a, 0x1d, 0x45, + 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x43, 0x49, 0x4d, 0x5f, 0x54, + 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x1a, 0x12, 0x21, + 0x0a, 0x1d, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x43, 0x49, + 0x4d, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, + 0x1b, 0x12, 0x28, 0x0a, 0x24, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x49, + 0x54, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x1c, 0x12, 0x27, 0x0a, 0x23, 0x45, + 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, + 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, + 0x45, 0x44, 0x10, 0x1d, 0x12, 0x25, 0x0a, 0x21, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x4c, 0x41, + 0x42, 0x45, 0x4c, 0x5f, 0x4d, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x1e, 0x12, 0x34, 0x0a, 0x30, 0x45, + 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, + 0x5f, 0x42, 0x52, 0x45, 0x41, 0x4b, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, + 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x45, 0x4e, 0x41, 0x42, 0x4c, 0x45, 0x44, 0x10, + 0x20, 0x12, 0x35, 0x0a, 0x31, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x42, 0x52, 0x45, 0x41, 0x4b, 0x49, 0x4e, 0x47, 0x5f, + 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x44, 0x49, + 0x53, 0x41, 0x42, 0x4c, 0x45, 0x44, 0x10, 0x21, 0x42, 0xd0, 0x02, 0x0a, 0x2a, 0x63, 0x6f, 0x6d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x57, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, + 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, + 0x05, 0x42, 0x44, 0x41, 0x4f, 0x41, 0xaa, 0x02, 0x26, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, + 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, + 0x02, 0x26, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x32, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, + 0x72, 0x67, 0x5c, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2b, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x41, 0x75, 0x64, 0x69, + 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_audit_v1alpha1_event_proto_rawDescOnce sync.Once + file_audit_v1alpha1_event_proto_rawDescData = file_audit_v1alpha1_event_proto_rawDesc +) + +func file_audit_v1alpha1_event_proto_rawDescGZIP() []byte { + file_audit_v1alpha1_event_proto_rawDescOnce.Do(func() { + file_audit_v1alpha1_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_audit_v1alpha1_event_proto_rawDescData) + }) + return file_audit_v1alpha1_event_proto_rawDescData +} + +var file_audit_v1alpha1_event_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_audit_v1alpha1_event_proto_msgTypes = make([]protoimpl.MessageInfo, 37) +var file_audit_v1alpha1_event_proto_goTypes = []interface{}{ + (ActorType)(0), // 0: bufman.dubbo.apache.org.audit.v1alpha1.ActorType + (ResourceType)(0), // 1: bufman.dubbo.apache.org.audit.v1alpha1.ResourceType + (EventType)(0), // 2: bufman.dubbo.apache.org.audit.v1alpha1.EventType + (*Actor)(nil), // 3: bufman.dubbo.apache.org.audit.v1alpha1.Actor + (*Resource)(nil), // 4: bufman.dubbo.apache.org.audit.v1alpha1.Resource + (*EventMetadata)(nil), // 5: bufman.dubbo.apache.org.audit.v1alpha1.EventMetadata + (*Event)(nil), // 6: bufman.dubbo.apache.org.audit.v1alpha1.Event + (*PayloadOrganizationCreated)(nil), // 7: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationCreated + (*PayloadOrganizationDeleted)(nil), // 8: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationDeleted + (*PayloadOrganizationMemberAdded)(nil), // 9: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberAdded + (*PayloadOrganizationMemberRoleChanged)(nil), // 10: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRoleChanged + (*PayloadOrganizationMemberRemoved)(nil), // 11: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRemoved + (*PayloadOrganizationIDPGroupAdded)(nil), // 12: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationIDPGroupAdded + (*PayloadOrganizationIDPGroupRemoved)(nil), // 13: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationIDPGroupRemoved + (*PayloadRepositoryCreated)(nil), // 14: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryCreated + (*PayloadRepositoryDeleted)(nil), // 15: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryDeleted + (*PayloadRepositoryCommitPushed)(nil), // 16: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryCommitPushed + (*PayloadRepositoryContributorAdded)(nil), // 17: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorAdded + (*PayloadRepositoryContributorRoleChanged)(nil), // 18: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorRoleChanged + (*PayloadRepositoryContributorRemoved)(nil), // 19: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorRemoved + (*PayloadRepositoryVisibilityChanged)(nil), // 20: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryVisibilityChanged + (*PayloadPluginCreated)(nil), // 21: bufman.dubbo.apache.org.audit.v1alpha1.PayloadPluginCreated + (*PayloadPluginDeleted)(nil), // 22: bufman.dubbo.apache.org.audit.v1alpha1.PayloadPluginDeleted + (*PayloadUserCreated)(nil), // 23: bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserCreated + (*PayloadUserReactivated)(nil), // 24: bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserReactivated + (*PayloadUserDeactivated)(nil), // 25: bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserDeactivated + (*PayloadUserDeleted)(nil), // 26: bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserDeleted + (*PayloadUserLoggedIn)(nil), // 27: bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserLoggedIn + (*PayloadUserLoggedOut)(nil), // 28: bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserLoggedOut + (*PayloadCuratedPluginCreated)(nil), // 29: bufman.dubbo.apache.org.audit.v1alpha1.PayloadCuratedPluginCreated + (*PayloadCuratedPluginDeleted)(nil), // 30: bufman.dubbo.apache.org.audit.v1alpha1.PayloadCuratedPluginDeleted + (*PayloadTokenCreated)(nil), // 31: bufman.dubbo.apache.org.audit.v1alpha1.PayloadTokenCreated + (*PayloadTokenDeleted)(nil), // 32: bufman.dubbo.apache.org.audit.v1alpha1.PayloadTokenDeleted + (*PayloadSCIMTokenCreated)(nil), // 33: bufman.dubbo.apache.org.audit.v1alpha1.PayloadSCIMTokenCreated + (*PayloadSCIMTokenDeleted)(nil), // 34: bufman.dubbo.apache.org.audit.v1alpha1.PayloadSCIMTokenDeleted + (*PayloadRepositoryCommitDeleted)(nil), // 35: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryCommitDeleted + (*PayloadRepositoryLabelCreated)(nil), // 36: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryLabelCreated + (*PayloadRepositoryLabelMoved)(nil), // 37: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryLabelMoved + (*PayloadServerBreakingChangePolicyEnabled)(nil), // 38: bufman.dubbo.apache.org.audit.v1alpha1.PayloadServerBreakingChangePolicyEnabled + (*PayloadServerBreakingChangePolicyDisabled)(nil), // 39: bufman.dubbo.apache.org.audit.v1alpha1.PayloadServerBreakingChangePolicyDisabled + (*timestamppb.Timestamp)(nil), // 40: google.protobuf.Timestamp + (v1alpha1.OrganizationRole)(0), // 41: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + (v1alpha1.OrganizationRoleSource)(0), // 42: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource + (v1alpha1.Visibility)(0), // 43: bufman.dubbo.apache.org.registry.v1alpha1.Visibility + (v1alpha1.RepositoryRole)(0), // 44: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + (v1alpha1.PluginVisibility)(0), // 45: bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility + (v1alpha1.BreakingChangeCategory)(0), // 46: bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangeCategory +} +var file_audit_v1alpha1_event_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.audit.v1alpha1.Actor.type:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.ActorType + 1, // 1: bufman.dubbo.apache.org.audit.v1alpha1.Resource.type:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.ResourceType + 2, // 2: bufman.dubbo.apache.org.audit.v1alpha1.Event.type:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.EventType + 3, // 3: bufman.dubbo.apache.org.audit.v1alpha1.Event.actor:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.Actor + 4, // 4: bufman.dubbo.apache.org.audit.v1alpha1.Event.resource:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.Resource + 40, // 5: bufman.dubbo.apache.org.audit.v1alpha1.Event.event_time:type_name -> google.protobuf.Timestamp + 5, // 6: bufman.dubbo.apache.org.audit.v1alpha1.Event.metadata:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.EventMetadata + 7, // 7: bufman.dubbo.apache.org.audit.v1alpha1.Event.organization_created:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationCreated + 8, // 8: bufman.dubbo.apache.org.audit.v1alpha1.Event.organization_deleted:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationDeleted + 9, // 9: bufman.dubbo.apache.org.audit.v1alpha1.Event.organization_member_added:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberAdded + 10, // 10: bufman.dubbo.apache.org.audit.v1alpha1.Event.organization_member_role_changed:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRoleChanged + 11, // 11: bufman.dubbo.apache.org.audit.v1alpha1.Event.organization_member_removed:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRemoved + 14, // 12: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_created:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryCreated + 15, // 13: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_deleted:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryDeleted + 16, // 14: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_commit_pushed:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryCommitPushed + 17, // 15: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_contributor_added:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorAdded + 18, // 16: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_contributor_role_changed:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorRoleChanged + 19, // 17: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_contributor_removed:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorRemoved + 20, // 18: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_visibility_changed:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryVisibilityChanged + 21, // 19: bufman.dubbo.apache.org.audit.v1alpha1.Event.plugin_created:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadPluginCreated + 22, // 20: bufman.dubbo.apache.org.audit.v1alpha1.Event.plugin_deleted:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadPluginDeleted + 23, // 21: bufman.dubbo.apache.org.audit.v1alpha1.Event.user_created:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserCreated + 25, // 22: bufman.dubbo.apache.org.audit.v1alpha1.Event.user_deactivated:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserDeactivated + 26, // 23: bufman.dubbo.apache.org.audit.v1alpha1.Event.user_deleted:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserDeleted + 27, // 24: bufman.dubbo.apache.org.audit.v1alpha1.Event.user_logged_in:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserLoggedIn + 28, // 25: bufman.dubbo.apache.org.audit.v1alpha1.Event.user_logged_out:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserLoggedOut + 29, // 26: bufman.dubbo.apache.org.audit.v1alpha1.Event.curated_plugin_created:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadCuratedPluginCreated + 12, // 27: bufman.dubbo.apache.org.audit.v1alpha1.Event.idp_group_added:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationIDPGroupAdded + 13, // 28: bufman.dubbo.apache.org.audit.v1alpha1.Event.idp_group_removed:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationIDPGroupRemoved + 31, // 29: bufman.dubbo.apache.org.audit.v1alpha1.Event.token_created:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadTokenCreated + 32, // 30: bufman.dubbo.apache.org.audit.v1alpha1.Event.token_deleted:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadTokenDeleted + 24, // 31: bufman.dubbo.apache.org.audit.v1alpha1.Event.user_reactivated:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadUserReactivated + 33, // 32: bufman.dubbo.apache.org.audit.v1alpha1.Event.scim_token_created:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadSCIMTokenCreated + 34, // 33: bufman.dubbo.apache.org.audit.v1alpha1.Event.scim_token_deleted:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadSCIMTokenDeleted + 35, // 34: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_commit_deleted:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryCommitDeleted + 36, // 35: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_label_created:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryLabelCreated + 37, // 36: bufman.dubbo.apache.org.audit.v1alpha1.Event.repository_label_moved:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryLabelMoved + 30, // 37: bufman.dubbo.apache.org.audit.v1alpha1.Event.curated_plugin_deleted:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadCuratedPluginDeleted + 38, // 38: bufman.dubbo.apache.org.audit.v1alpha1.Event.payload_server_breaking_change_policy_enabled:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadServerBreakingChangePolicyEnabled + 39, // 39: bufman.dubbo.apache.org.audit.v1alpha1.Event.payload_server_breaking_change_policy_disabled:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.PayloadServerBreakingChangePolicyDisabled + 41, // 40: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberAdded.member_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 42, // 41: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberAdded.member_role_source:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource + 41, // 42: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRoleChanged.old_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 41, // 43: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRoleChanged.new_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 42, // 44: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRoleChanged.old_member_role_source:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource + 42, // 45: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRoleChanged.new_member_role_source:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource + 41, // 46: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRemoved.member_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 42, // 47: bufman.dubbo.apache.org.audit.v1alpha1.PayloadOrganizationMemberRemoved.member_role_source:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource + 43, // 48: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryCreated.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Visibility + 43, // 49: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryDeleted.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Visibility + 44, // 50: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorAdded.contributor_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 44, // 51: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorRoleChanged.old_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 44, // 52: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorRoleChanged.new_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 44, // 53: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryContributorRemoved.contributor_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 43, // 54: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryVisibilityChanged.old_visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Visibility + 43, // 55: bufman.dubbo.apache.org.audit.v1alpha1.PayloadRepositoryVisibilityChanged.new_visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Visibility + 45, // 56: bufman.dubbo.apache.org.audit.v1alpha1.PayloadPluginCreated.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility + 45, // 57: bufman.dubbo.apache.org.audit.v1alpha1.PayloadPluginDeleted.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility + 40, // 58: bufman.dubbo.apache.org.audit.v1alpha1.PayloadTokenCreated.token_expiry_time:type_name -> google.protobuf.Timestamp + 40, // 59: bufman.dubbo.apache.org.audit.v1alpha1.PayloadSCIMTokenCreated.token_expiry_time:type_name -> google.protobuf.Timestamp + 46, // 60: bufman.dubbo.apache.org.audit.v1alpha1.PayloadServerBreakingChangePolicyEnabled.category:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangeCategory + 61, // [61:61] is the sub-list for method output_type + 61, // [61:61] is the sub-list for method input_type + 61, // [61:61] is the sub-list for extension type_name + 61, // [61:61] is the sub-list for extension extendee + 0, // [0:61] is the sub-list for field type_name +} + +func init() { file_audit_v1alpha1_event_proto_init() } +func file_audit_v1alpha1_event_proto_init() { + if File_audit_v1alpha1_event_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_audit_v1alpha1_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Actor); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Resource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadOrganizationCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadOrganizationDeleted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadOrganizationMemberAdded); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadOrganizationMemberRoleChanged); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadOrganizationMemberRemoved); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadOrganizationIDPGroupAdded); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadOrganizationIDPGroupRemoved); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryDeleted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryCommitPushed); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryContributorAdded); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryContributorRoleChanged); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryContributorRemoved); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryVisibilityChanged); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadPluginCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadPluginDeleted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadUserCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadUserReactivated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadUserDeactivated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadUserDeleted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadUserLoggedIn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadUserLoggedOut); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadCuratedPluginCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadCuratedPluginDeleted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadTokenCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadTokenDeleted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadSCIMTokenCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadSCIMTokenDeleted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryCommitDeleted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryLabelCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadRepositoryLabelMoved); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadServerBreakingChangePolicyEnabled); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_event_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadServerBreakingChangePolicyDisabled); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_audit_v1alpha1_event_proto_msgTypes[3].OneofWrappers = []interface{}{ + (*Event_OrganizationCreated)(nil), + (*Event_OrganizationDeleted)(nil), + (*Event_OrganizationMemberAdded)(nil), + (*Event_OrganizationMemberRoleChanged)(nil), + (*Event_OrganizationMemberRemoved)(nil), + (*Event_RepositoryCreated)(nil), + (*Event_RepositoryDeleted)(nil), + (*Event_RepositoryCommitPushed)(nil), + (*Event_RepositoryContributorAdded)(nil), + (*Event_RepositoryContributorRoleChanged)(nil), + (*Event_RepositoryContributorRemoved)(nil), + (*Event_RepositoryVisibilityChanged)(nil), + (*Event_PluginCreated)(nil), + (*Event_PluginDeleted)(nil), + (*Event_UserCreated)(nil), + (*Event_UserDeactivated)(nil), + (*Event_UserDeleted)(nil), + (*Event_UserLoggedIn)(nil), + (*Event_UserLoggedOut)(nil), + (*Event_CuratedPluginCreated)(nil), + (*Event_IdpGroupAdded)(nil), + (*Event_IdpGroupRemoved)(nil), + (*Event_TokenCreated)(nil), + (*Event_TokenDeleted)(nil), + (*Event_UserReactivated)(nil), + (*Event_ScimTokenCreated)(nil), + (*Event_ScimTokenDeleted)(nil), + (*Event_RepositoryCommitDeleted)(nil), + (*Event_RepositoryLabelCreated)(nil), + (*Event_RepositoryLabelMoved)(nil), + (*Event_CuratedPluginDeleted)(nil), + (*Event_PayloadServerBreakingChangePolicyEnabled)(nil), + (*Event_PayloadServerBreakingChangePolicyDisabled)(nil), + } + file_audit_v1alpha1_event_proto_msgTypes[35].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_audit_v1alpha1_event_proto_rawDesc, + NumEnums: 3, + NumMessages: 37, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_audit_v1alpha1_event_proto_goTypes, + DependencyIndexes: file_audit_v1alpha1_event_proto_depIdxs, + EnumInfos: file_audit_v1alpha1_event_proto_enumTypes, + MessageInfos: file_audit_v1alpha1_event_proto_msgTypes, + }.Build() + File_audit_v1alpha1_event_proto = out.File + file_audit_v1alpha1_event_proto_rawDesc = nil + file_audit_v1alpha1_event_proto_goTypes = nil + file_audit_v1alpha1_event_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/audit/v1alpha1/service.pb.go b/pkg/bufman/gen/proto/go/audit/v1alpha1/service.pb.go new file mode 100644 index 000000000..9b088312c --- /dev/null +++ b/pkg/bufman/gen/proto/go/audit/v1alpha1/service.pb.go @@ -0,0 +1,306 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: audit/v1alpha1/service.proto + +package auditv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ListAuditedEventsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The page size for listing audited events, values between 1-250. + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The page token for paginating. The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The start timestamp to filter events from. + Start *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=start,proto3" json:"start,omitempty"` + // The end timestamp to filter events to. + End *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=end,proto3" json:"end,omitempty"` +} + +func (x *ListAuditedEventsRequest) Reset() { + *x = ListAuditedEventsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListAuditedEventsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAuditedEventsRequest) ProtoMessage() {} + +func (x *ListAuditedEventsRequest) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAuditedEventsRequest.ProtoReflect.Descriptor instead. +func (*ListAuditedEventsRequest) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_service_proto_rawDescGZIP(), []int{0} +} + +func (x *ListAuditedEventsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListAuditedEventsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListAuditedEventsRequest) GetStart() *timestamppb.Timestamp { + if x != nil { + return x.Start + } + return nil +} + +func (x *ListAuditedEventsRequest) GetEnd() *timestamppb.Timestamp { + if x != nil { + return x.End + } + return nil +} + +type ListAuditedEventsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of audited events in the current page. + Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` + // The token for the next page of audited events. There are no more pages if + // this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListAuditedEventsResponse) Reset() { + *x = ListAuditedEventsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_audit_v1alpha1_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListAuditedEventsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAuditedEventsResponse) ProtoMessage() {} + +func (x *ListAuditedEventsResponse) ProtoReflect() protoreflect.Message { + mi := &file_audit_v1alpha1_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAuditedEventsResponse.ProtoReflect.Descriptor instead. +func (*ListAuditedEventsResponse) Descriptor() ([]byte, []int) { + return file_audit_v1alpha1_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ListAuditedEventsResponse) GetEvents() []*Event { + if x != nil { + return x.Events + } + return nil +} + +func (x *ListAuditedEventsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +var File_audit_v1alpha1_service_proto protoreflect.FileDescriptor + +var file_audit_v1alpha1_service_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x26, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xb6, 0x01, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x64, 0x69, + 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, + 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x30, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2c, + 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x8a, 0x01, 0x0a, + 0x19, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x64, 0x69, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, + 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xae, 0x01, 0x0a, 0x0c, 0x41, 0x75, + 0x64, 0x69, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9d, 0x01, 0x0a, 0x11, 0x4c, + 0x69, 0x73, 0x74, 0x41, 0x75, 0x64, 0x69, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, + 0x12, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, + 0x64, 0x69, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x41, 0x75, 0x64, 0x69, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xd2, 0x02, 0x0a, 0x2a, 0x63, + 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x57, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x41, 0xaa, 0x02, 0x26, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xca, 0x02, 0x26, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x41, 0x75, + 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x32, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x2b, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, + 0x41, 0x75, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_audit_v1alpha1_service_proto_rawDescOnce sync.Once + file_audit_v1alpha1_service_proto_rawDescData = file_audit_v1alpha1_service_proto_rawDesc +) + +func file_audit_v1alpha1_service_proto_rawDescGZIP() []byte { + file_audit_v1alpha1_service_proto_rawDescOnce.Do(func() { + file_audit_v1alpha1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_audit_v1alpha1_service_proto_rawDescData) + }) + return file_audit_v1alpha1_service_proto_rawDescData +} + +var file_audit_v1alpha1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_audit_v1alpha1_service_proto_goTypes = []interface{}{ + (*ListAuditedEventsRequest)(nil), // 0: bufman.dubbo.apache.org.audit.v1alpha1.ListAuditedEventsRequest + (*ListAuditedEventsResponse)(nil), // 1: bufman.dubbo.apache.org.audit.v1alpha1.ListAuditedEventsResponse + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp + (*Event)(nil), // 3: bufman.dubbo.apache.org.audit.v1alpha1.Event +} +var file_audit_v1alpha1_service_proto_depIdxs = []int32{ + 2, // 0: bufman.dubbo.apache.org.audit.v1alpha1.ListAuditedEventsRequest.start:type_name -> google.protobuf.Timestamp + 2, // 1: bufman.dubbo.apache.org.audit.v1alpha1.ListAuditedEventsRequest.end:type_name -> google.protobuf.Timestamp + 3, // 2: bufman.dubbo.apache.org.audit.v1alpha1.ListAuditedEventsResponse.events:type_name -> bufman.dubbo.apache.org.audit.v1alpha1.Event + 0, // 3: bufman.dubbo.apache.org.audit.v1alpha1.AuditService.ListAuditedEvents:input_type -> bufman.dubbo.apache.org.audit.v1alpha1.ListAuditedEventsRequest + 1, // 4: bufman.dubbo.apache.org.audit.v1alpha1.AuditService.ListAuditedEvents:output_type -> bufman.dubbo.apache.org.audit.v1alpha1.ListAuditedEventsResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_audit_v1alpha1_service_proto_init() } +func file_audit_v1alpha1_service_proto_init() { + if File_audit_v1alpha1_service_proto != nil { + return + } + file_audit_v1alpha1_event_proto_init() + if !protoimpl.UnsafeEnabled { + file_audit_v1alpha1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListAuditedEventsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_audit_v1alpha1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListAuditedEventsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_audit_v1alpha1_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_audit_v1alpha1_service_proto_goTypes, + DependencyIndexes: file_audit_v1alpha1_service_proto_depIdxs, + MessageInfos: file_audit_v1alpha1_service_proto_msgTypes, + }.Build() + File_audit_v1alpha1_service_proto = out.File + file_audit_v1alpha1_service_proto_rawDesc = nil + file_audit_v1alpha1_service_proto_goTypes = nil + file_audit_v1alpha1_service_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/audit/v1alpha1/service_grpc.pb.go b/pkg/bufman/gen/proto/go/audit/v1alpha1/service_grpc.pb.go new file mode 100644 index 000000000..059514dba --- /dev/null +++ b/pkg/bufman/gen/proto/go/audit/v1alpha1/service_grpc.pb.go @@ -0,0 +1,111 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: audit/v1alpha1/service.proto + +package auditv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + AuditService_ListAuditedEvents_FullMethodName = "/bufman.dubbo.apache.org.audit.v1alpha1.AuditService/ListAuditedEvents" +) + +// AuditServiceClient is the client API for AuditService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AuditServiceClient interface { + // ListAuditedEvents lists audited events recorded in the BSR instance. + ListAuditedEvents(ctx context.Context, in *ListAuditedEventsRequest, opts ...grpc.CallOption) (*ListAuditedEventsResponse, error) +} + +type auditServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAuditServiceClient(cc grpc.ClientConnInterface) AuditServiceClient { + return &auditServiceClient{cc} +} + +func (c *auditServiceClient) ListAuditedEvents(ctx context.Context, in *ListAuditedEventsRequest, opts ...grpc.CallOption) (*ListAuditedEventsResponse, error) { + out := new(ListAuditedEventsResponse) + err := c.cc.Invoke(ctx, AuditService_ListAuditedEvents_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuditServiceServer is the server API for AuditService service. +// All implementations must embed UnimplementedAuditServiceServer +// for forward compatibility +type AuditServiceServer interface { + // ListAuditedEvents lists audited events recorded in the BSR instance. + ListAuditedEvents(context.Context, *ListAuditedEventsRequest) (*ListAuditedEventsResponse, error) + mustEmbedUnimplementedAuditServiceServer() +} + +// UnimplementedAuditServiceServer must be embedded to have forward compatible implementations. +type UnimplementedAuditServiceServer struct { +} + +func (UnimplementedAuditServiceServer) ListAuditedEvents(context.Context, *ListAuditedEventsRequest) (*ListAuditedEventsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListAuditedEvents not implemented") +} +func (UnimplementedAuditServiceServer) mustEmbedUnimplementedAuditServiceServer() {} + +// UnsafeAuditServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuditServiceServer will +// result in compilation errors. +type UnsafeAuditServiceServer interface { + mustEmbedUnimplementedAuditServiceServer() +} + +func RegisterAuditServiceServer(s grpc.ServiceRegistrar, srv AuditServiceServer) { + s.RegisterService(&AuditService_ServiceDesc, srv) +} + +func _AuditService_ListAuditedEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListAuditedEventsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuditServiceServer).ListAuditedEvents(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuditService_ListAuditedEvents_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuditServiceServer).ListAuditedEvents(ctx, req.(*ListAuditedEventsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AuditService_ServiceDesc is the grpc.ServiceDesc for AuditService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AuditService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.audit.v1alpha1.AuditService", + HandlerType: (*AuditServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListAuditedEvents", + Handler: _AuditService_ListAuditedEvents_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "audit/v1alpha1/service.proto", +} diff --git a/pkg/bufman/gen/proto/go/breaking/v1/config.pb.go b/pkg/bufman/gen/proto/go/breaking/v1/config.pb.go new file mode 100644 index 000000000..a06e60951 --- /dev/null +++ b/pkg/bufman/gen/proto/go/breaking/v1/config.pb.go @@ -0,0 +1,310 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: breaking/v1/config.proto + +package breakingv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Config represents the breaking change configuration for a module. The rule and category IDs are defined +// by the version and apply across the config. The version is independent of the version of +// the package. The package version refers to the config shape, the version encoded in the Config message +// indicates which rule and category IDs should be used. +// +// The rule and category IDs are not encoded as enums in this package because we may want to support custom rule +// and category IDs in the future. Callers will need to resolve the rule and category ID strings. +type Config struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // version represents the version of the breaking change rule and category IDs that should be used with this config. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // use_ids lists the rule and/or category IDs that are included in the breaking change check. + UseIds []string `protobuf:"bytes,2,rep,name=use_ids,json=useIds,proto3" json:"use_ids,omitempty"` + // except_ids lists the rule and/or category IDs that are excluded from the breaking change check. + ExceptIds []string `protobuf:"bytes,3,rep,name=except_ids,json=exceptIds,proto3" json:"except_ids,omitempty"` + // ignore_paths lists the paths of directories and/or files that should be ignored by the breaking change check. + // All paths are relative to the root of the module. + IgnorePaths []string `protobuf:"bytes,4,rep,name=ignore_paths,json=ignorePaths,proto3" json:"ignore_paths,omitempty"` + // ignore_id_paths is a map of rule and/or category IDs to directory and/or file paths to exclude from the + // breaking change check. This corresponds with the ignore_only configuration key. + IgnoreIdPaths []*IDPaths `protobuf:"bytes,5,rep,name=ignore_id_paths,json=ignoreIdPaths,proto3" json:"ignore_id_paths,omitempty"` + // ignore_unstable_packages ignores packages with a last component that is one of the unstable forms recognised + // by the PACKAGE_VERSION_SUFFIX: + // v\d+test.* + // v\d+(alpha|beta)\d+ + // v\d+p\d+(alpha|beta)\d+ + IgnoreUnstablePackages bool `protobuf:"varint,6,opt,name=ignore_unstable_packages,json=ignoreUnstablePackages,proto3" json:"ignore_unstable_packages,omitempty"` +} + +func (x *Config) Reset() { + *x = Config{} + if protoimpl.UnsafeEnabled { + mi := &file_breaking_v1_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Config) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) ProtoReflect() protoreflect.Message { + mi := &file_breaking_v1_config_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Config.ProtoReflect.Descriptor instead. +func (*Config) Descriptor() ([]byte, []int) { + return file_breaking_v1_config_proto_rawDescGZIP(), []int{0} +} + +func (x *Config) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Config) GetUseIds() []string { + if x != nil { + return x.UseIds + } + return nil +} + +func (x *Config) GetExceptIds() []string { + if x != nil { + return x.ExceptIds + } + return nil +} + +func (x *Config) GetIgnorePaths() []string { + if x != nil { + return x.IgnorePaths + } + return nil +} + +func (x *Config) GetIgnoreIdPaths() []*IDPaths { + if x != nil { + return x.IgnoreIdPaths + } + return nil +} + +func (x *Config) GetIgnoreUnstablePackages() bool { + if x != nil { + return x.IgnoreUnstablePackages + } + return false +} + +// IDPaths represents a rule or category ID and the file and/or directory paths that are ignored for the rule. +type IDPaths struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Paths []string `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty"` +} + +func (x *IDPaths) Reset() { + *x = IDPaths{} + if protoimpl.UnsafeEnabled { + mi := &file_breaking_v1_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IDPaths) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IDPaths) ProtoMessage() {} + +func (x *IDPaths) ProtoReflect() protoreflect.Message { + mi := &file_breaking_v1_config_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IDPaths.ProtoReflect.Descriptor instead. +func (*IDPaths) Descriptor() ([]byte, []int) { + return file_breaking_v1_config_proto_rawDescGZIP(), []int{1} +} + +func (x *IDPaths) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *IDPaths) GetPaths() []string { + if x != nil { + return x.Paths + } + return nil +} + +var File_breaking_v1_config_proto protoreflect.FileDescriptor + +var file_breaking_v1_config_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x23, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x22, + 0x8d, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x49, 0x64, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x09, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x49, 0x64, 0x73, 0x12, 0x21, 0x0a, 0x0c, + 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, + 0x54, 0x0a, 0x0f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x70, 0x61, 0x74, + 0x68, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x49, + 0x44, 0x50, 0x61, 0x74, 0x68, 0x73, 0x52, 0x0d, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x49, 0x64, + 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, + 0x75, 0x6e, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x55, + 0x6e, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, + 0x2f, 0x0a, 0x07, 0x49, 0x44, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, + 0x74, 0x68, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, + 0x42, 0xbc, 0x02, 0x0a, 0x27, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x51, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x76, 0x31, 0xa2, 0x02, + 0x05, 0x42, 0x44, 0x41, 0x4f, 0x42, 0xaa, 0x02, 0x23, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, + 0x2e, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x23, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x2f, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x42, 0x72, 0x65, + 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x28, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, + 0x67, 0x3a, 0x3a, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_breaking_v1_config_proto_rawDescOnce sync.Once + file_breaking_v1_config_proto_rawDescData = file_breaking_v1_config_proto_rawDesc +) + +func file_breaking_v1_config_proto_rawDescGZIP() []byte { + file_breaking_v1_config_proto_rawDescOnce.Do(func() { + file_breaking_v1_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_breaking_v1_config_proto_rawDescData) + }) + return file_breaking_v1_config_proto_rawDescData +} + +var file_breaking_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_breaking_v1_config_proto_goTypes = []interface{}{ + (*Config)(nil), // 0: bufman.dubbo.apache.org.breaking.v1.Config + (*IDPaths)(nil), // 1: bufman.dubbo.apache.org.breaking.v1.IDPaths +} +var file_breaking_v1_config_proto_depIdxs = []int32{ + 1, // 0: bufman.dubbo.apache.org.breaking.v1.Config.ignore_id_paths:type_name -> bufman.dubbo.apache.org.breaking.v1.IDPaths + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_breaking_v1_config_proto_init() } +func file_breaking_v1_config_proto_init() { + if File_breaking_v1_config_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_breaking_v1_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_breaking_v1_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IDPaths); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_breaking_v1_config_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_breaking_v1_config_proto_goTypes, + DependencyIndexes: file_breaking_v1_config_proto_depIdxs, + MessageInfos: file_breaking_v1_config_proto_msgTypes, + }.Build() + File_breaking_v1_config_proto = out.File + file_breaking_v1_config_proto_rawDesc = nil + file_breaking_v1_config_proto_goTypes = nil + file_breaking_v1_config_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/image/v1/image.pb.go b/pkg/bufman/gen/proto/go/image/v1/image.pb.go new file mode 100644 index 000000000..6adda8a30 --- /dev/null +++ b/pkg/bufman/gen/proto/go/image/v1/image.pb.go @@ -0,0 +1,711 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: image/v1/image.proto + +package imagev1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Image is an extended FileDescriptorSet. +// +// See https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto +type Image struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + File []*ImageFile `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` +} + +func (x *Image) Reset() { + *x = Image{} + if protoimpl.UnsafeEnabled { + mi := &file_image_v1_image_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Image) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Image) ProtoMessage() {} + +func (x *Image) ProtoReflect() protoreflect.Message { + mi := &file_image_v1_image_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Image.ProtoReflect.Descriptor instead. +func (*Image) Descriptor() ([]byte, []int) { + return file_image_v1_image_proto_rawDescGZIP(), []int{0} +} + +func (x *Image) GetFile() []*ImageFile { + if x != nil { + return x.File + } + return nil +} + +// ImageFile is an extended FileDescriptorProto. +// +// Since FileDescriptorProto does not have extensions, we copy the fields from +// FileDescriptorProto, and then add our own extensions via the buf_extension +// field. This is compatible with a FileDescriptorProto. +// +// See https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto +type ImageFile struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` + Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` + PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` + WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` + MessageType []*descriptorpb.DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` + EnumType []*descriptorpb.EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + Service []*descriptorpb.ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` + Extension []*descriptorpb.FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` + Options *descriptorpb.FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + SourceCodeInfo *descriptorpb.SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` + Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` + Edition *string `protobuf:"bytes,13,opt,name=edition" json:"edition,omitempty"` + // buf_extension contains buf-specific extensions to FileDescriptorProtos. + // + // The prefixed name and high tag value is used to all but guarantee there + // will never be any conflict with Google's FileDescriptorProto definition. + // The definition of a FileDescriptorProto has not changed in years, so + // we're not too worried about a conflict here. + BufExtension *ImageFileExtension `protobuf:"bytes,8042,opt,name=buf_extension,json=bufExtension" json:"buf_extension,omitempty"` +} + +func (x *ImageFile) Reset() { + *x = ImageFile{} + if protoimpl.UnsafeEnabled { + mi := &file_image_v1_image_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageFile) ProtoMessage() {} + +func (x *ImageFile) ProtoReflect() protoreflect.Message { + mi := &file_image_v1_image_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImageFile.ProtoReflect.Descriptor instead. +func (*ImageFile) Descriptor() ([]byte, []int) { + return file_image_v1_image_proto_rawDescGZIP(), []int{1} +} + +func (x *ImageFile) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *ImageFile) GetPackage() string { + if x != nil && x.Package != nil { + return *x.Package + } + return "" +} + +func (x *ImageFile) GetDependency() []string { + if x != nil { + return x.Dependency + } + return nil +} + +func (x *ImageFile) GetPublicDependency() []int32 { + if x != nil { + return x.PublicDependency + } + return nil +} + +func (x *ImageFile) GetWeakDependency() []int32 { + if x != nil { + return x.WeakDependency + } + return nil +} + +func (x *ImageFile) GetMessageType() []*descriptorpb.DescriptorProto { + if x != nil { + return x.MessageType + } + return nil +} + +func (x *ImageFile) GetEnumType() []*descriptorpb.EnumDescriptorProto { + if x != nil { + return x.EnumType + } + return nil +} + +func (x *ImageFile) GetService() []*descriptorpb.ServiceDescriptorProto { + if x != nil { + return x.Service + } + return nil +} + +func (x *ImageFile) GetExtension() []*descriptorpb.FieldDescriptorProto { + if x != nil { + return x.Extension + } + return nil +} + +func (x *ImageFile) GetOptions() *descriptorpb.FileOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *ImageFile) GetSourceCodeInfo() *descriptorpb.SourceCodeInfo { + if x != nil { + return x.SourceCodeInfo + } + return nil +} + +func (x *ImageFile) GetSyntax() string { + if x != nil && x.Syntax != nil { + return *x.Syntax + } + return "" +} + +func (x *ImageFile) GetEdition() string { + if x != nil && x.Edition != nil { + return *x.Edition + } + return "" +} + +func (x *ImageFile) GetBufExtension() *ImageFileExtension { + if x != nil { + return x.BufExtension + } + return nil +} + +// ImageFileExtension contains extensions to ImageFiles. +// +// The fields are not included directly on the ImageFile so that we can both +// detect if extensions exist, which signifies this was created by buf and not +// by protoc, and so that we can add fields in a freeform manner without +// worrying about conflicts with FileDescriptorProto. +type ImageFileExtension struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // is_import denotes whether this file is considered an "import". + // + // An import is a file which was not derived from the local source files. + // There are two cases where this could be true: + // + // 1. A Well-Known Type included from the compiler. + // 2. A file that was included from a Buf module dependency. + // + // We use "import" as this matches with the protoc concept of + // --include_imports, however import is a bit of an overloaded term. + // + // This will always be set. + IsImport *bool `protobuf:"varint,1,opt,name=is_import,json=isImport" json:"is_import,omitempty"` + // ModuleInfo contains information about the Buf module this file belongs to. + // + // This field is optional and will not be set if the module is not known. + ModuleInfo *ModuleInfo `protobuf:"bytes,2,opt,name=module_info,json=moduleInfo" json:"module_info,omitempty"` + // is_syntax_unspecified denotes whether the file did not have a syntax + // explicitly specified. + // + // Per the FileDescriptorProto spec, it would be fine in this case to just + // leave the syntax field unset to denote this and to set the syntax field + // to "proto2" if it is specified. However, protoc does not set the syntax + // field if it was "proto2", and plugins may (incorrectly) depend on this. + // We also want to maintain consistency with protoc as much as possible. + // So instead, we have this field which will denote whether syntax was not + // specified. + // + // This will always be set. + IsSyntaxUnspecified *bool `protobuf:"varint,3,opt,name=is_syntax_unspecified,json=isSyntaxUnspecified" json:"is_syntax_unspecified,omitempty"` + // unused_dependency are the indexes within the dependency field on + // FileDescriptorProto for those dependencies that are not used. + // + // This matches the shape of the public_dependency and weak_dependency + // fields. + UnusedDependency []int32 `protobuf:"varint,4,rep,name=unused_dependency,json=unusedDependency" json:"unused_dependency,omitempty"` +} + +func (x *ImageFileExtension) Reset() { + *x = ImageFileExtension{} + if protoimpl.UnsafeEnabled { + mi := &file_image_v1_image_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageFileExtension) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageFileExtension) ProtoMessage() {} + +func (x *ImageFileExtension) ProtoReflect() protoreflect.Message { + mi := &file_image_v1_image_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImageFileExtension.ProtoReflect.Descriptor instead. +func (*ImageFileExtension) Descriptor() ([]byte, []int) { + return file_image_v1_image_proto_rawDescGZIP(), []int{2} +} + +func (x *ImageFileExtension) GetIsImport() bool { + if x != nil && x.IsImport != nil { + return *x.IsImport + } + return false +} + +func (x *ImageFileExtension) GetModuleInfo() *ModuleInfo { + if x != nil { + return x.ModuleInfo + } + return nil +} + +func (x *ImageFileExtension) GetIsSyntaxUnspecified() bool { + if x != nil && x.IsSyntaxUnspecified != nil { + return *x.IsSyntaxUnspecified + } + return false +} + +func (x *ImageFileExtension) GetUnusedDependency() []int32 { + if x != nil { + return x.UnusedDependency + } + return nil +} + +// ModuleInfo contains information about a Buf module that an ImageFile +// belongs to. +type ModuleInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // name is the name of the Buf module. + // + // This will always be set. + Name *ModuleName `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // commit is the repository commit. + // + // This field is optional and will not be set if the commit is not known. + Commit *string `protobuf:"bytes,2,opt,name=commit" json:"commit,omitempty"` +} + +func (x *ModuleInfo) Reset() { + *x = ModuleInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_image_v1_image_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModuleInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModuleInfo) ProtoMessage() {} + +func (x *ModuleInfo) ProtoReflect() protoreflect.Message { + mi := &file_image_v1_image_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModuleInfo.ProtoReflect.Descriptor instead. +func (*ModuleInfo) Descriptor() ([]byte, []int) { + return file_image_v1_image_proto_rawDescGZIP(), []int{3} +} + +func (x *ModuleInfo) GetName() *ModuleName { + if x != nil { + return x.Name + } + return nil +} + +func (x *ModuleInfo) GetCommit() string { + if x != nil && x.Commit != nil { + return *x.Commit + } + return "" +} + +// ModuleName is a module name. +// +// All fields will always be set. +type ModuleName struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Remote *string `protobuf:"bytes,1,opt,name=remote" json:"remote,omitempty"` + Owner *string `protobuf:"bytes,2,opt,name=owner" json:"owner,omitempty"` + Repository *string `protobuf:"bytes,3,opt,name=repository" json:"repository,omitempty"` +} + +func (x *ModuleName) Reset() { + *x = ModuleName{} + if protoimpl.UnsafeEnabled { + mi := &file_image_v1_image_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModuleName) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModuleName) ProtoMessage() {} + +func (x *ModuleName) ProtoReflect() protoreflect.Message { + mi := &file_image_v1_image_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModuleName.ProtoReflect.Descriptor instead. +func (*ModuleName) Descriptor() ([]byte, []int) { + return file_image_v1_image_proto_rawDescGZIP(), []int{4} +} + +func (x *ModuleName) GetRemote() string { + if x != nil && x.Remote != nil { + return *x.Remote + } + return "" +} + +func (x *ModuleName) GetOwner() string { + if x != nil && x.Owner != nil { + return *x.Owner + } + return "" +} + +func (x *ModuleName) GetRepository() string { + if x != nil && x.Repository != nil { + return *x.Repository + } + return "" +} + +var File_image_v1_image_proto protoreflect.FileDescriptor + +var file_image_v1_image_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x48, 0x0a, 0x05, 0x49, 0x6d, + 0x61, 0x67, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x2b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, + 0x66, 0x69, 0x6c, 0x65, 0x22, 0xd0, 0x05, 0x0a, 0x09, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, + 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, + 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, + 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, 0x77, 0x65, 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, + 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, + 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, + 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, + 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, + 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, + 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, + 0x78, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5a, 0x0a, 0x0d, 0x62, + 0x75, 0x66, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0xea, 0x3e, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x46, 0x69, 0x6c, 0x65, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x62, 0x75, 0x66, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe1, 0x01, 0x0a, 0x12, 0x49, 0x6d, 0x61, 0x67, + 0x65, 0x46, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, + 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x69, 0x73, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x32, 0x0a, 0x15, 0x69, 0x73, + 0x5f, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x5f, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x69, 0x73, 0x53, 0x79, 0x6e, + 0x74, 0x61, 0x78, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x2b, + 0x0a, 0x11, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, + 0x6e, 0x63, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x10, 0x75, 0x6e, 0x75, 0x73, 0x65, + 0x64, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x22, 0x66, 0x0a, 0x0a, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x40, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x22, 0x5a, 0x0a, 0x0a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, + 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, + 0xab, 0x02, 0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x48, 0x01, 0x50, 0x01, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x76, 0x31, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x49, + 0xaa, 0x02, 0x20, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, + 0x2e, 0x56, 0x31, 0xca, 0x02, 0x20, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x49, 0x6d, + 0x61, 0x67, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x2c, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, + 0x5c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x25, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, + 0x72, 0x67, 0x3a, 0x3a, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x3a, 0x3a, 0x56, 0x31, +} + +var ( + file_image_v1_image_proto_rawDescOnce sync.Once + file_image_v1_image_proto_rawDescData = file_image_v1_image_proto_rawDesc +) + +func file_image_v1_image_proto_rawDescGZIP() []byte { + file_image_v1_image_proto_rawDescOnce.Do(func() { + file_image_v1_image_proto_rawDescData = protoimpl.X.CompressGZIP(file_image_v1_image_proto_rawDescData) + }) + return file_image_v1_image_proto_rawDescData +} + +var file_image_v1_image_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_image_v1_image_proto_goTypes = []interface{}{ + (*Image)(nil), // 0: bufman.dubbo.apache.org.image.v1.Image + (*ImageFile)(nil), // 1: bufman.dubbo.apache.org.image.v1.ImageFile + (*ImageFileExtension)(nil), // 2: bufman.dubbo.apache.org.image.v1.ImageFileExtension + (*ModuleInfo)(nil), // 3: bufman.dubbo.apache.org.image.v1.ModuleInfo + (*ModuleName)(nil), // 4: bufman.dubbo.apache.org.image.v1.ModuleName + (*descriptorpb.DescriptorProto)(nil), // 5: google.protobuf.DescriptorProto + (*descriptorpb.EnumDescriptorProto)(nil), // 6: google.protobuf.EnumDescriptorProto + (*descriptorpb.ServiceDescriptorProto)(nil), // 7: google.protobuf.ServiceDescriptorProto + (*descriptorpb.FieldDescriptorProto)(nil), // 8: google.protobuf.FieldDescriptorProto + (*descriptorpb.FileOptions)(nil), // 9: google.protobuf.FileOptions + (*descriptorpb.SourceCodeInfo)(nil), // 10: google.protobuf.SourceCodeInfo +} +var file_image_v1_image_proto_depIdxs = []int32{ + 1, // 0: bufman.dubbo.apache.org.image.v1.Image.file:type_name -> bufman.dubbo.apache.org.image.v1.ImageFile + 5, // 1: bufman.dubbo.apache.org.image.v1.ImageFile.message_type:type_name -> google.protobuf.DescriptorProto + 6, // 2: bufman.dubbo.apache.org.image.v1.ImageFile.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 7, // 3: bufman.dubbo.apache.org.image.v1.ImageFile.service:type_name -> google.protobuf.ServiceDescriptorProto + 8, // 4: bufman.dubbo.apache.org.image.v1.ImageFile.extension:type_name -> google.protobuf.FieldDescriptorProto + 9, // 5: bufman.dubbo.apache.org.image.v1.ImageFile.options:type_name -> google.protobuf.FileOptions + 10, // 6: bufman.dubbo.apache.org.image.v1.ImageFile.source_code_info:type_name -> google.protobuf.SourceCodeInfo + 2, // 7: bufman.dubbo.apache.org.image.v1.ImageFile.buf_extension:type_name -> bufman.dubbo.apache.org.image.v1.ImageFileExtension + 3, // 8: bufman.dubbo.apache.org.image.v1.ImageFileExtension.module_info:type_name -> bufman.dubbo.apache.org.image.v1.ModuleInfo + 4, // 9: bufman.dubbo.apache.org.image.v1.ModuleInfo.name:type_name -> bufman.dubbo.apache.org.image.v1.ModuleName + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_image_v1_image_proto_init() } +func file_image_v1_image_proto_init() { + if File_image_v1_image_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_image_v1_image_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Image); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_image_v1_image_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageFile); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_image_v1_image_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageFileExtension); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_image_v1_image_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModuleInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_image_v1_image_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModuleName); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_image_v1_image_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_image_v1_image_proto_goTypes, + DependencyIndexes: file_image_v1_image_proto_depIdxs, + MessageInfos: file_image_v1_image_proto_msgTypes, + }.Build() + File_image_v1_image_proto = out.File + file_image_v1_image_proto_rawDesc = nil + file_image_v1_image_proto_goTypes = nil + file_image_v1_image_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/lint/v1/config.pb.go b/pkg/bufman/gen/proto/go/lint/v1/config.pb.go new file mode 100644 index 000000000..f7b404f65 --- /dev/null +++ b/pkg/bufman/gen/proto/go/lint/v1/config.pb.go @@ -0,0 +1,372 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: lint/v1/config.proto + +package lintv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Config represents the lint configuration for a module. The rule and category IDs are defined +// by the version and apply across the config. The version is independent of the version of +// the package. The package version refers to the config shape, the version encoded in the Config message +// indicates which rule and category IDs should be used. +// +// The rule and category IDs are not encoded as enums in this package because we may want to support custom rule +// and category IDs in the future. Callers will need to resolve the rule and category ID strings. +type Config struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // version represents the version of the lint rule and category IDs that should be used with this config. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // use_ids lists the rule and/or category IDs that are included in the lint check. + UseIds []string `protobuf:"bytes,2,rep,name=use_ids,json=useIds,proto3" json:"use_ids,omitempty"` + // except_ids lists the rule and/or category IDs that are excluded from the lint check. + ExceptIds []string `protobuf:"bytes,3,rep,name=except_ids,json=exceptIds,proto3" json:"except_ids,omitempty"` + // ignore_paths lists the paths of directories and/or files that should be ignored by the lint check. + // All paths are relative to the root of the module. + IgnorePaths []string `protobuf:"bytes,4,rep,name=ignore_paths,json=ignorePaths,proto3" json:"ignore_paths,omitempty"` + // ignore_id_paths is a map of rule and/or category IDs to directory and/or file paths to exclude from the + // lint check. This corresponds with the ignore_only configuration key. + IgnoreIdPaths []*IDPaths `protobuf:"bytes,5,rep,name=ignore_id_paths,json=ignoreIdPaths,proto3" json:"ignore_id_paths,omitempty"` + // enum_zero_value_suffix controls the behavior of the ENUM_ZERO_VALUE lint rule ID. By default, this rule + // verifies that the zero value of all enums ends in _UNSPECIFIED. This config allows the user to override + // this value with the given string. + EnumZeroValueSuffix string `protobuf:"bytes,6,opt,name=enum_zero_value_suffix,json=enumZeroValueSuffix,proto3" json:"enum_zero_value_suffix,omitempty"` + // rpc_allow_same_request_response allows the same message type for both the request and response of an RPC. + RpcAllowSameRequestResponse bool `protobuf:"varint,7,opt,name=rpc_allow_same_request_response,json=rpcAllowSameRequestResponse,proto3" json:"rpc_allow_same_request_response,omitempty"` + // rpc_allow_google_protobuf_empty_requests allows the RPC requests to use the google.protobuf.Empty message. + RpcAllowGoogleProtobufEmptyRequests bool `protobuf:"varint,8,opt,name=rpc_allow_google_protobuf_empty_requests,json=rpcAllowGoogleProtobufEmptyRequests,proto3" json:"rpc_allow_google_protobuf_empty_requests,omitempty"` + // rpc_allow_google_protobuf_empty_responses allows the RPC responses to use the google.protobuf.Empty message. + RpcAllowGoogleProtobufEmptyResponses bool `protobuf:"varint,9,opt,name=rpc_allow_google_protobuf_empty_responses,json=rpcAllowGoogleProtobufEmptyResponses,proto3" json:"rpc_allow_google_protobuf_empty_responses,omitempty"` + // service_suffix applies to the SERVICE_SUFFIX rule ID. By default, the rule verifies that all service names + // end with the suffix Service. This allows users to override the value with the given string. + ServiceSuffix string `protobuf:"bytes,10,opt,name=service_suffix,json=serviceSuffix,proto3" json:"service_suffix,omitempty"` + // allow_comment_ignores turns on comment-driven ignores. + AllowCommentIgnores bool `protobuf:"varint,11,opt,name=allow_comment_ignores,json=allowCommentIgnores,proto3" json:"allow_comment_ignores,omitempty"` +} + +func (x *Config) Reset() { + *x = Config{} + if protoimpl.UnsafeEnabled { + mi := &file_lint_v1_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Config) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) ProtoReflect() protoreflect.Message { + mi := &file_lint_v1_config_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Config.ProtoReflect.Descriptor instead. +func (*Config) Descriptor() ([]byte, []int) { + return file_lint_v1_config_proto_rawDescGZIP(), []int{0} +} + +func (x *Config) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Config) GetUseIds() []string { + if x != nil { + return x.UseIds + } + return nil +} + +func (x *Config) GetExceptIds() []string { + if x != nil { + return x.ExceptIds + } + return nil +} + +func (x *Config) GetIgnorePaths() []string { + if x != nil { + return x.IgnorePaths + } + return nil +} + +func (x *Config) GetIgnoreIdPaths() []*IDPaths { + if x != nil { + return x.IgnoreIdPaths + } + return nil +} + +func (x *Config) GetEnumZeroValueSuffix() string { + if x != nil { + return x.EnumZeroValueSuffix + } + return "" +} + +func (x *Config) GetRpcAllowSameRequestResponse() bool { + if x != nil { + return x.RpcAllowSameRequestResponse + } + return false +} + +func (x *Config) GetRpcAllowGoogleProtobufEmptyRequests() bool { + if x != nil { + return x.RpcAllowGoogleProtobufEmptyRequests + } + return false +} + +func (x *Config) GetRpcAllowGoogleProtobufEmptyResponses() bool { + if x != nil { + return x.RpcAllowGoogleProtobufEmptyResponses + } + return false +} + +func (x *Config) GetServiceSuffix() string { + if x != nil { + return x.ServiceSuffix + } + return "" +} + +func (x *Config) GetAllowCommentIgnores() bool { + if x != nil { + return x.AllowCommentIgnores + } + return false +} + +// IDPaths represents a rule or category ID and the file and/or directory paths that are ignored for the rule. +type IDPaths struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Paths []string `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty"` +} + +func (x *IDPaths) Reset() { + *x = IDPaths{} + if protoimpl.UnsafeEnabled { + mi := &file_lint_v1_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IDPaths) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IDPaths) ProtoMessage() {} + +func (x *IDPaths) ProtoReflect() protoreflect.Message { + mi := &file_lint_v1_config_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IDPaths.ProtoReflect.Descriptor instead. +func (*IDPaths) Descriptor() ([]byte, []int) { + return file_lint_v1_config_proto_rawDescGZIP(), []int{1} +} + +func (x *IDPaths) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *IDPaths) GetPaths() []string { + if x != nil { + return x.Paths + } + return nil +} + +var File_lint_v1_config_proto protoreflect.FileDescriptor + +var file_lint_v1_config_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x6c, 0x69, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x6c, 0x69, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x22, 0xd5, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, + 0x75, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x75, + 0x73, 0x65, 0x49, 0x64, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x5f, + 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x65, 0x78, 0x63, 0x65, 0x70, + 0x74, 0x49, 0x64, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x70, + 0x61, 0x74, 0x68, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, + 0x72, 0x65, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x50, 0x0a, 0x0f, 0x69, 0x67, 0x6e, 0x6f, 0x72, + 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6c, 0x69, 0x6e, 0x74, 0x2e, + 0x76, 0x31, 0x2e, 0x49, 0x44, 0x50, 0x61, 0x74, 0x68, 0x73, 0x52, 0x0d, 0x69, 0x67, 0x6e, 0x6f, + 0x72, 0x65, 0x49, 0x64, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x33, 0x0a, 0x16, 0x65, 0x6e, 0x75, + 0x6d, 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x75, 0x66, + 0x66, 0x69, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x65, 0x6e, 0x75, 0x6d, 0x5a, + 0x65, 0x72, 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x44, + 0x0a, 0x1f, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x61, 0x6d, 0x65, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1b, 0x72, 0x70, 0x63, 0x41, 0x6c, 0x6c, 0x6f, + 0x77, 0x53, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x28, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x5f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x23, 0x72, 0x70, 0x63, 0x41, 0x6c, 0x6c, 0x6f, 0x77, + 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x57, 0x0a, 0x29, 0x72, + 0x70, 0x63, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x24, + 0x72, 0x70, 0x63, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, + 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x32, 0x0a, 0x15, 0x61, + 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x67, 0x6e, + 0x6f, 0x72, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x73, 0x22, + 0x2f, 0x0a, 0x07, 0x49, 0x44, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, + 0x74, 0x68, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, + 0x42, 0xa0, 0x02, 0x0a, 0x23, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x6c, 0x69, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x2f, 0x6c, 0x69, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x6c, 0x69, 0x6e, 0x74, + 0x76, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x4c, 0xaa, 0x02, 0x1f, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x4c, 0x69, 0x6e, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1f, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x4c, 0x69, 0x6e, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x2b, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x4c, 0x69, 0x6e, 0x74, 0x5c, 0x56, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x24, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x4c, 0x69, 0x6e, 0x74, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_lint_v1_config_proto_rawDescOnce sync.Once + file_lint_v1_config_proto_rawDescData = file_lint_v1_config_proto_rawDesc +) + +func file_lint_v1_config_proto_rawDescGZIP() []byte { + file_lint_v1_config_proto_rawDescOnce.Do(func() { + file_lint_v1_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_lint_v1_config_proto_rawDescData) + }) + return file_lint_v1_config_proto_rawDescData +} + +var file_lint_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_lint_v1_config_proto_goTypes = []interface{}{ + (*Config)(nil), // 0: bufman.dubbo.apache.org.lint.v1.Config + (*IDPaths)(nil), // 1: bufman.dubbo.apache.org.lint.v1.IDPaths +} +var file_lint_v1_config_proto_depIdxs = []int32{ + 1, // 0: bufman.dubbo.apache.org.lint.v1.Config.ignore_id_paths:type_name -> bufman.dubbo.apache.org.lint.v1.IDPaths + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_lint_v1_config_proto_init() } +func file_lint_v1_config_proto_init() { + if File_lint_v1_config_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_lint_v1_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_lint_v1_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IDPaths); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_lint_v1_config_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_lint_v1_config_proto_goTypes, + DependencyIndexes: file_lint_v1_config_proto_depIdxs, + MessageInfos: file_lint_v1_config_proto_msgTypes, + }.Build() + File_lint_v1_config_proto = out.File + file_lint_v1_config_proto_rawDesc = nil + file_lint_v1_config_proto_goTypes = nil + file_lint_v1_config_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/module/v1alpha1/module.pb.go b/pkg/bufman/gen/proto/go/module/v1alpha1/module.pb.go new file mode 100644 index 000000000..85ea6613c --- /dev/null +++ b/pkg/bufman/gen/proto/go/module/v1alpha1/module.pb.go @@ -0,0 +1,783 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: module/v1alpha1/module.proto + +package modulev1alpha1 + +import ( + v1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/breaking/v1" + v11 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/lint/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DigestType int32 + +const ( + DigestType_DIGEST_TYPE_UNSPECIFIED DigestType = 0 + DigestType_DIGEST_TYPE_SHAKE256 DigestType = 1 +) + +// Enum value maps for DigestType. +var ( + DigestType_name = map[int32]string{ + 0: "DIGEST_TYPE_UNSPECIFIED", + 1: "DIGEST_TYPE_SHAKE256", + } + DigestType_value = map[string]int32{ + "DIGEST_TYPE_UNSPECIFIED": 0, + "DIGEST_TYPE_SHAKE256": 1, + } +) + +func (x DigestType) Enum() *DigestType { + p := new(DigestType) + *p = x + return p +} + +func (x DigestType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DigestType) Descriptor() protoreflect.EnumDescriptor { + return file_module_v1alpha1_module_proto_enumTypes[0].Descriptor() +} + +func (DigestType) Type() protoreflect.EnumType { + return &file_module_v1alpha1_module_proto_enumTypes[0] +} + +func (x DigestType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DigestType.Descriptor instead. +func (DigestType) EnumDescriptor() ([]byte, []int) { + return file_module_v1alpha1_module_proto_rawDescGZIP(), []int{0} +} + +// Digest represents a hash function's value. +type Digest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // digest_type describes the hash algorithm. e.g. "SHAKE256" + DigestType DigestType `protobuf:"varint,1,opt,name=digest_type,json=digestType,proto3,enum=bufman.dubbo.apache.org.module.v1alpha1.DigestType" json:"digest_type,omitempty"` + // digest is the hash's output without encoding. + Digest []byte `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"` +} + +func (x *Digest) Reset() { + *x = Digest{} + if protoimpl.UnsafeEnabled { + mi := &file_module_v1alpha1_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Digest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Digest) ProtoMessage() {} + +func (x *Digest) ProtoReflect() protoreflect.Message { + mi := &file_module_v1alpha1_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Digest.ProtoReflect.Descriptor instead. +func (*Digest) Descriptor() ([]byte, []int) { + return file_module_v1alpha1_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Digest) GetDigestType() DigestType { + if x != nil { + return x.DigestType + } + return DigestType_DIGEST_TYPE_UNSPECIFIED +} + +func (x *Digest) GetDigest() []byte { + if x != nil { + return x.Digest + } + return nil +} + +// Blob represents some module content with an associated hash. +type Blob struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Digest of the content. + Digest *Digest `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` + // Content of the blob. Optional when Blob is used as a content pointer. + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *Blob) Reset() { + *x = Blob{} + if protoimpl.UnsafeEnabled { + mi := &file_module_v1alpha1_module_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Blob) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Blob) ProtoMessage() {} + +func (x *Blob) ProtoReflect() protoreflect.Message { + mi := &file_module_v1alpha1_module_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Blob.ProtoReflect.Descriptor instead. +func (*Blob) Descriptor() ([]byte, []int) { + return file_module_v1alpha1_module_proto_rawDescGZIP(), []int{1} +} + +func (x *Blob) GetDigest() *Digest { + if x != nil { + return x.Digest + } + return nil +} + +func (x *Blob) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +// Module is a module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // files are the files that make up the set. + // + // Sorted by path. + // Path must be unique. + // Only the target files. No imports. + // + // Maximum total size of all content: 32MB. + Files []*ModuleFile `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + // dependencies are the dependencies. + Dependencies []*ModulePin `protobuf:"bytes,2,rep,name=dependencies,proto3" json:"dependencies,omitempty"` + // documentation is the string representation of the contents of the file at documentation_path. + // + // string is used to enforce UTF-8 encoding or 7-bit ASCII text. + Documentation string `protobuf:"bytes,3,opt,name=documentation,proto3" json:"documentation,omitempty"` + // breaking_config is the breaking change detection configuration set for the module. + BreakingConfig *v1.Config `protobuf:"bytes,4,opt,name=breaking_config,json=breakingConfig,proto3" json:"breaking_config,omitempty"` + // lint_config is the lint configuration set for the module. + LintConfig *v11.Config `protobuf:"bytes,5,opt,name=lint_config,json=lintConfig,proto3" json:"lint_config,omitempty"` + // license is the string representation of the contents of the `LICENSE` file. + // + // string is used to enforce UTF-8 encoding or 7-bit ASCII text. + License string `protobuf:"bytes,6,opt,name=license,proto3" json:"license,omitempty"` + // documentation_path is the path of the file which contains the module documentation. + // + // either `buf.md`, `README.md` or `README.markdown`. + // if empty, assumes buf.md. + DocumentationPath string `protobuf:"bytes,7,opt,name=documentation_path,json=documentationPath,proto3" json:"documentation_path,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_module_v1alpha1_module_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +func (x *Module) ProtoReflect() protoreflect.Message { + mi := &file_module_v1alpha1_module_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_module_v1alpha1_module_proto_rawDescGZIP(), []int{2} +} + +func (x *Module) GetFiles() []*ModuleFile { + if x != nil { + return x.Files + } + return nil +} + +func (x *Module) GetDependencies() []*ModulePin { + if x != nil { + return x.Dependencies + } + return nil +} + +func (x *Module) GetDocumentation() string { + if x != nil { + return x.Documentation + } + return "" +} + +func (x *Module) GetBreakingConfig() *v1.Config { + if x != nil { + return x.BreakingConfig + } + return nil +} + +func (x *Module) GetLintConfig() *v11.Config { + if x != nil { + return x.LintConfig + } + return nil +} + +func (x *Module) GetLicense() string { + if x != nil { + return x.License + } + return "" +} + +func (x *Module) GetDocumentationPath() string { + if x != nil { + return x.DocumentationPath + } + return "" +} + +// ModuleFile is a file within a FileSet. +type ModuleFile struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // path is the relative path of the file. + // Path can only use '/' as the separator character, and includes no ".." components. + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + // content is the content of the file. + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *ModuleFile) Reset() { + *x = ModuleFile{} + if protoimpl.UnsafeEnabled { + mi := &file_module_v1alpha1_module_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModuleFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModuleFile) ProtoMessage() {} + +func (x *ModuleFile) ProtoReflect() protoreflect.Message { + mi := &file_module_v1alpha1_module_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModuleFile.ProtoReflect.Descriptor instead. +func (*ModuleFile) Descriptor() ([]byte, []int) { + return file_module_v1alpha1_module_proto_rawDescGZIP(), []int{3} +} + +func (x *ModuleFile) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ModuleFile) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +// ModuleReference is a module reference. +type ModuleReference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Remote string `protobuf:"bytes,1,opt,name=remote,proto3" json:"remote,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,3,opt,name=repository,proto3" json:"repository,omitempty"` + // either tag, or commit + Reference string `protobuf:"bytes,4,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *ModuleReference) Reset() { + *x = ModuleReference{} + if protoimpl.UnsafeEnabled { + mi := &file_module_v1alpha1_module_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModuleReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModuleReference) ProtoMessage() {} + +func (x *ModuleReference) ProtoReflect() protoreflect.Message { + mi := &file_module_v1alpha1_module_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModuleReference.ProtoReflect.Descriptor instead. +func (*ModuleReference) Descriptor() ([]byte, []int) { + return file_module_v1alpha1_module_proto_rawDescGZIP(), []int{4} +} + +func (x *ModuleReference) GetRemote() string { + if x != nil { + return x.Remote + } + return "" +} + +func (x *ModuleReference) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ModuleReference) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *ModuleReference) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +// ModulePin is a module pin. +type ModulePin struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Remote string `protobuf:"bytes,1,opt,name=remote,proto3" json:"remote,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,3,opt,name=repository,proto3" json:"repository,omitempty"` + Branch string `protobuf:"bytes,4,opt,name=branch,proto3" json:"branch,omitempty"` + Commit string `protobuf:"bytes,5,opt,name=commit,proto3" json:"commit,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // Module's manifest digest. Replacement for previous b1/b3 digests. + ManifestDigest string `protobuf:"bytes,8,opt,name=manifest_digest,json=manifestDigest,proto3" json:"manifest_digest,omitempty"` +} + +func (x *ModulePin) Reset() { + *x = ModulePin{} + if protoimpl.UnsafeEnabled { + mi := &file_module_v1alpha1_module_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModulePin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModulePin) ProtoMessage() {} + +func (x *ModulePin) ProtoReflect() protoreflect.Message { + mi := &file_module_v1alpha1_module_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModulePin.ProtoReflect.Descriptor instead. +func (*ModulePin) Descriptor() ([]byte, []int) { + return file_module_v1alpha1_module_proto_rawDescGZIP(), []int{5} +} + +func (x *ModulePin) GetRemote() string { + if x != nil { + return x.Remote + } + return "" +} + +func (x *ModulePin) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ModulePin) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *ModulePin) GetBranch() string { + if x != nil { + return x.Branch + } + return "" +} + +func (x *ModulePin) GetCommit() string { + if x != nil { + return x.Commit + } + return "" +} + +func (x *ModulePin) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *ModulePin) GetManifestDigest() string { + if x != nil { + return x.ManifestDigest + } + return "" +} + +var File_module_v1alpha1_module_proto protoreflect.FileDescriptor + +var file_module_v1alpha1_module_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x18, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, + 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x14, 0x6c, 0x69, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x76, 0x0a, 0x06, 0x44, 0x69, 0x67, 0x65, + 0x73, 0x74, 0x12, 0x54, 0x0a, 0x0b, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x69, + 0x67, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, + 0x22, 0x69, 0x0a, 0x04, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x47, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, + 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xba, 0x03, 0x0a, 0x06, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x49, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, + 0x73, 0x12, 0x56, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x52, 0x0c, 0x64, 0x65, 0x70, + 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x6f, 0x63, + 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x54, 0x0a, 0x0f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x48, 0x0a, 0x0b, 0x6c, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6c, 0x69, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x0a, 0x6c, 0x69, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x64, 0x6f, 0x63, + 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x74, 0x68, 0x22, 0x3a, 0x0a, 0x0a, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x22, 0x7d, 0x0a, 0x0f, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x22, 0xfd, 0x01, 0x0a, 0x09, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, + 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, + 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, + 0x16, 0x0a, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, + 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, + 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x44, + 0x69, 0x67, 0x65, 0x73, 0x74, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x52, 0x06, 0x64, 0x69, 0x67, + 0x65, 0x73, 0x74, 0x2a, 0x43, 0x0a, 0x0a, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x44, 0x49, 0x47, 0x45, 0x53, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, + 0x0a, 0x14, 0x44, 0x49, 0x47, 0x45, 0x53, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x48, + 0x41, 0x4b, 0x45, 0x32, 0x35, 0x36, 0x10, 0x01, 0x42, 0xd8, 0x02, 0x0a, 0x2b, 0x63, 0x6f, 0x6d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x59, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x4d, 0xaa, 0x02, 0x27, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x27, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, + 0x33, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2c, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, + 0x67, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_module_v1alpha1_module_proto_rawDescOnce sync.Once + file_module_v1alpha1_module_proto_rawDescData = file_module_v1alpha1_module_proto_rawDesc +) + +func file_module_v1alpha1_module_proto_rawDescGZIP() []byte { + file_module_v1alpha1_module_proto_rawDescOnce.Do(func() { + file_module_v1alpha1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_module_v1alpha1_module_proto_rawDescData) + }) + return file_module_v1alpha1_module_proto_rawDescData +} + +var file_module_v1alpha1_module_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_module_v1alpha1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_module_v1alpha1_module_proto_goTypes = []interface{}{ + (DigestType)(0), // 0: bufman.dubbo.apache.org.module.v1alpha1.DigestType + (*Digest)(nil), // 1: bufman.dubbo.apache.org.module.v1alpha1.Digest + (*Blob)(nil), // 2: bufman.dubbo.apache.org.module.v1alpha1.Blob + (*Module)(nil), // 3: bufman.dubbo.apache.org.module.v1alpha1.Module + (*ModuleFile)(nil), // 4: bufman.dubbo.apache.org.module.v1alpha1.ModuleFile + (*ModuleReference)(nil), // 5: bufman.dubbo.apache.org.module.v1alpha1.ModuleReference + (*ModulePin)(nil), // 6: bufman.dubbo.apache.org.module.v1alpha1.ModulePin + (*v1.Config)(nil), // 7: bufman.dubbo.apache.org.breaking.v1.Config + (*v11.Config)(nil), // 8: bufman.dubbo.apache.org.lint.v1.Config + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp +} +var file_module_v1alpha1_module_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.module.v1alpha1.Digest.digest_type:type_name -> bufman.dubbo.apache.org.module.v1alpha1.DigestType + 1, // 1: bufman.dubbo.apache.org.module.v1alpha1.Blob.digest:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Digest + 4, // 2: bufman.dubbo.apache.org.module.v1alpha1.Module.files:type_name -> bufman.dubbo.apache.org.module.v1alpha1.ModuleFile + 6, // 3: bufman.dubbo.apache.org.module.v1alpha1.Module.dependencies:type_name -> bufman.dubbo.apache.org.module.v1alpha1.ModulePin + 7, // 4: bufman.dubbo.apache.org.module.v1alpha1.Module.breaking_config:type_name -> bufman.dubbo.apache.org.breaking.v1.Config + 8, // 5: bufman.dubbo.apache.org.module.v1alpha1.Module.lint_config:type_name -> bufman.dubbo.apache.org.lint.v1.Config + 9, // 6: bufman.dubbo.apache.org.module.v1alpha1.ModulePin.create_time:type_name -> google.protobuf.Timestamp + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_module_v1alpha1_module_proto_init() } +func file_module_v1alpha1_module_proto_init() { + if File_module_v1alpha1_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_module_v1alpha1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Digest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_module_v1alpha1_module_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Blob); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_module_v1alpha1_module_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_module_v1alpha1_module_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModuleFile); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_module_v1alpha1_module_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModuleReference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_module_v1alpha1_module_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModulePin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_module_v1alpha1_module_proto_rawDesc, + NumEnums: 1, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_module_v1alpha1_module_proto_goTypes, + DependencyIndexes: file_module_v1alpha1_module_proto_depIdxs, + EnumInfos: file_module_v1alpha1_module_proto_enumTypes, + MessageInfos: file_module_v1alpha1_module_proto_msgTypes, + }.Build() + File_module_v1alpha1_module_proto = out.File + file_module_v1alpha1_module_proto_rawDesc = nil + file_module_v1alpha1_module_proto_goTypes = nil + file_module_v1alpha1_module_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/admin.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/admin.pb.go new file mode 100644 index 000000000..488f9e352 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/admin.pb.go @@ -0,0 +1,1997 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/admin.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// BreakingChangeCategory is the allowed list of categories for breaking rule settings. +type BreakingChangeCategory int32 + +const ( + BreakingChangeCategory_BREAKING_CHANGE_CATEGORY_UNSPECIFIED BreakingChangeCategory = 0 + BreakingChangeCategory_BREAKING_CHANGE_CATEGORY_FILE BreakingChangeCategory = 1 + BreakingChangeCategory_BREAKING_CHANGE_CATEGORY_WIRE_JSON BreakingChangeCategory = 2 +) + +// Enum value maps for BreakingChangeCategory. +var ( + BreakingChangeCategory_name = map[int32]string{ + 0: "BREAKING_CHANGE_CATEGORY_UNSPECIFIED", + 1: "BREAKING_CHANGE_CATEGORY_FILE", + 2: "BREAKING_CHANGE_CATEGORY_WIRE_JSON", + } + BreakingChangeCategory_value = map[string]int32{ + "BREAKING_CHANGE_CATEGORY_UNSPECIFIED": 0, + "BREAKING_CHANGE_CATEGORY_FILE": 1, + "BREAKING_CHANGE_CATEGORY_WIRE_JSON": 2, + } +) + +func (x BreakingChangeCategory) Enum() *BreakingChangeCategory { + p := new(BreakingChangeCategory) + *p = x + return p +} + +func (x BreakingChangeCategory) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BreakingChangeCategory) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_admin_proto_enumTypes[0].Descriptor() +} + +func (BreakingChangeCategory) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_admin_proto_enumTypes[0] +} + +func (x BreakingChangeCategory) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BreakingChangeCategory.Descriptor instead. +func (BreakingChangeCategory) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{0} +} + +// CollisionType is the type of collisions that can occur. +type CollisionType int32 + +const ( + // Unspecified collision type. + CollisionType_COLLISION_TYPE_UNSPECIFIED CollisionType = 0 + // A fully qualified proto name + CollisionType_COLLISION_TYPE_FULLY_QUALIFIED_NAME CollisionType = 1 + // A proto file path + CollisionType_COLLISION_TYPE_PATH CollisionType = 2 +) + +// Enum value maps for CollisionType. +var ( + CollisionType_name = map[int32]string{ + 0: "COLLISION_TYPE_UNSPECIFIED", + 1: "COLLISION_TYPE_FULLY_QUALIFIED_NAME", + 2: "COLLISION_TYPE_PATH", + } + CollisionType_value = map[string]int32{ + "COLLISION_TYPE_UNSPECIFIED": 0, + "COLLISION_TYPE_FULLY_QUALIFIED_NAME": 1, + "COLLISION_TYPE_PATH": 2, + } +) + +func (x CollisionType) Enum() *CollisionType { + p := new(CollisionType) + *p = x + return p +} + +func (x CollisionType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CollisionType) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_admin_proto_enumTypes[1].Descriptor() +} + +func (CollisionType) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_admin_proto_enumTypes[1] +} + +func (x CollisionType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CollisionType.Descriptor instead. +func (CollisionType) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{1} +} + +type BreakingChangePolicy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Enabled *bool `protobuf:"varint,1,opt,name=enabled,proto3,oneof" json:"enabled,omitempty"` + IgnoreUnstablePackages *bool `protobuf:"varint,2,opt,name=ignore_unstable_packages,json=ignoreUnstablePackages,proto3,oneof" json:"ignore_unstable_packages,omitempty"` + Category BreakingChangeCategory `protobuf:"varint,3,opt,name=category,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangeCategory" json:"category,omitempty"` +} + +func (x *BreakingChangePolicy) Reset() { + *x = BreakingChangePolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BreakingChangePolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BreakingChangePolicy) ProtoMessage() {} + +func (x *BreakingChangePolicy) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BreakingChangePolicy.ProtoReflect.Descriptor instead. +func (*BreakingChangePolicy) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{0} +} + +func (x *BreakingChangePolicy) GetEnabled() bool { + if x != nil && x.Enabled != nil { + return *x.Enabled + } + return false +} + +func (x *BreakingChangePolicy) GetIgnoreUnstablePackages() bool { + if x != nil && x.IgnoreUnstablePackages != nil { + return *x.IgnoreUnstablePackages + } + return false +} + +func (x *BreakingChangePolicy) GetCategory() BreakingChangeCategory { + if x != nil { + return x.Category + } + return BreakingChangeCategory_BREAKING_CHANGE_CATEGORY_UNSPECIFIED +} + +// UniquenessPolicy is the policy for uniqueness on the server. +type UniquenessPolicy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Whether uniqueness policy is enforced. + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` +} + +func (x *UniquenessPolicy) Reset() { + *x = UniquenessPolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UniquenessPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UniquenessPolicy) ProtoMessage() {} + +func (x *UniquenessPolicy) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UniquenessPolicy.ProtoReflect.Descriptor instead. +func (*UniquenessPolicy) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{1} +} + +func (x *UniquenessPolicy) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +// Collision is a collision that has occurred. +type Collision struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The reference that has collisions. + Reference string `protobuf:"bytes,1,opt,name=reference,proto3" json:"reference,omitempty"` + // The type of collision. + Type CollisionType `protobuf:"varint,2,opt,name=type,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.CollisionType" json:"type,omitempty"` + // The sources of the collision that the user is authorized to see. + Sources []*CollisionSource `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` + // Whether there are other collision sources that the user is not authorized to see. + // The user should contact a server admin for more information about these collisions. + HasOtherCollisionSources bool `protobuf:"varint,4,opt,name=has_other_collision_sources,json=hasOtherCollisionSources,proto3" json:"has_other_collision_sources,omitempty"` +} + +func (x *Collision) Reset() { + *x = Collision{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Collision) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Collision) ProtoMessage() {} + +func (x *Collision) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Collision.ProtoReflect.Descriptor instead. +func (*Collision) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{2} +} + +func (x *Collision) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +func (x *Collision) GetType() CollisionType { + if x != nil { + return x.Type + } + return CollisionType_COLLISION_TYPE_UNSPECIFIED +} + +func (x *Collision) GetSources() []*CollisionSource { + if x != nil { + return x.Sources + } + return nil +} + +func (x *Collision) GetHasOtherCollisionSources() bool { + if x != nil { + return x.HasOtherCollisionSources + } + return false +} + +// CollisionSource is the source of a collision +type CollisionSource struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the owner of the source. + OwnerName string `protobuf:"bytes,1,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // The name of the repository of the source. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The path of the file that is the source of the collision. + Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *CollisionSource) Reset() { + *x = CollisionSource{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CollisionSource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollisionSource) ProtoMessage() {} + +func (x *CollisionSource) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollisionSource.ProtoReflect.Descriptor instead. +func (*CollisionSource) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{3} +} + +func (x *CollisionSource) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *CollisionSource) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *CollisionSource) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +type ForceDeleteUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *ForceDeleteUserRequest) Reset() { + *x = ForceDeleteUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ForceDeleteUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ForceDeleteUserRequest) ProtoMessage() {} + +func (x *ForceDeleteUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ForceDeleteUserRequest.ProtoReflect.Descriptor instead. +func (*ForceDeleteUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{4} +} + +func (x *ForceDeleteUserRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type ForceDeleteUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The deleted user. + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + // The deleted organizations. + Organizations []*Organization `protobuf:"bytes,2,rep,name=organizations,proto3" json:"organizations,omitempty"` + // The deleted repositories. + Repositories []*Repository `protobuf:"bytes,3,rep,name=repositories,proto3" json:"repositories,omitempty"` + // The deleted plugins. + // + // Deprecated: Do not use. + Plugins []*Plugin `protobuf:"bytes,4,rep,name=plugins,proto3" json:"plugins,omitempty"` + // The deleted templates. + // + // Deprecated: Do not use. + Templates []*Template `protobuf:"bytes,5,rep,name=templates,proto3" json:"templates,omitempty"` +} + +func (x *ForceDeleteUserResponse) Reset() { + *x = ForceDeleteUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ForceDeleteUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ForceDeleteUserResponse) ProtoMessage() {} + +func (x *ForceDeleteUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ForceDeleteUserResponse.ProtoReflect.Descriptor instead. +func (*ForceDeleteUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{5} +} + +func (x *ForceDeleteUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +func (x *ForceDeleteUserResponse) GetOrganizations() []*Organization { + if x != nil { + return x.Organizations + } + return nil +} + +func (x *ForceDeleteUserResponse) GetRepositories() []*Repository { + if x != nil { + return x.Repositories + } + return nil +} + +// Deprecated: Do not use. +func (x *ForceDeleteUserResponse) GetPlugins() []*Plugin { + if x != nil { + return x.Plugins + } + return nil +} + +// Deprecated: Do not use. +func (x *ForceDeleteUserResponse) GetTemplates() []*Template { + if x != nil { + return x.Templates + } + return nil +} + +type UpdateUserVerificationStatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + VerificationStatus VerificationStatus `protobuf:"varint,2,opt,name=verification_status,json=verificationStatus,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus" json:"verification_status,omitempty"` +} + +func (x *UpdateUserVerificationStatusRequest) Reset() { + *x = UpdateUserVerificationStatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserVerificationStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserVerificationStatusRequest) ProtoMessage() {} + +func (x *UpdateUserVerificationStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserVerificationStatusRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserVerificationStatusRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateUserVerificationStatusRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateUserVerificationStatusRequest) GetVerificationStatus() VerificationStatus { + if x != nil { + return x.VerificationStatus + } + return VerificationStatus_VERIFICATION_STATUS_UNSPECIFIED +} + +type UpdateUserVerificationStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateUserVerificationStatusResponse) Reset() { + *x = UpdateUserVerificationStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserVerificationStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserVerificationStatusResponse) ProtoMessage() {} + +func (x *UpdateUserVerificationStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserVerificationStatusResponse.ProtoReflect.Descriptor instead. +func (*UpdateUserVerificationStatusResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{7} +} + +type UpdateOrganizationVerificationStatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + VerificationStatus VerificationStatus `protobuf:"varint,2,opt,name=verification_status,json=verificationStatus,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus" json:"verification_status,omitempty"` +} + +func (x *UpdateOrganizationVerificationStatusRequest) Reset() { + *x = UpdateOrganizationVerificationStatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateOrganizationVerificationStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateOrganizationVerificationStatusRequest) ProtoMessage() {} + +func (x *UpdateOrganizationVerificationStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateOrganizationVerificationStatusRequest.ProtoReflect.Descriptor instead. +func (*UpdateOrganizationVerificationStatusRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateOrganizationVerificationStatusRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *UpdateOrganizationVerificationStatusRequest) GetVerificationStatus() VerificationStatus { + if x != nil { + return x.VerificationStatus + } + return VerificationStatus_VERIFICATION_STATUS_UNSPECIFIED +} + +type UpdateOrganizationVerificationStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateOrganizationVerificationStatusResponse) Reset() { + *x = UpdateOrganizationVerificationStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateOrganizationVerificationStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateOrganizationVerificationStatusResponse) ProtoMessage() {} + +func (x *UpdateOrganizationVerificationStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateOrganizationVerificationStatusResponse.ProtoReflect.Descriptor instead. +func (*UpdateOrganizationVerificationStatusResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{9} +} + +type CreateMachineUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` +} + +func (x *CreateMachineUserRequest) Reset() { + *x = CreateMachineUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateMachineUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMachineUserRequest) ProtoMessage() {} + +func (x *CreateMachineUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMachineUserRequest.ProtoReflect.Descriptor instead. +func (*CreateMachineUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{10} +} + +func (x *CreateMachineUserRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +type CreateMachineUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *CreateMachineUserResponse) Reset() { + *x = CreateMachineUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateMachineUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMachineUserResponse) ProtoMessage() {} + +func (x *CreateMachineUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMachineUserResponse.ProtoReflect.Descriptor instead. +func (*CreateMachineUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{11} +} + +func (x *CreateMachineUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type GetBreakingChangePolicyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetBreakingChangePolicyRequest) Reset() { + *x = GetBreakingChangePolicyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBreakingChangePolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBreakingChangePolicyRequest) ProtoMessage() {} + +func (x *GetBreakingChangePolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBreakingChangePolicyRequest.ProtoReflect.Descriptor instead. +func (*GetBreakingChangePolicyRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{12} +} + +type GetBreakingChangePolicyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Policy *BreakingChangePolicy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` +} + +func (x *GetBreakingChangePolicyResponse) Reset() { + *x = GetBreakingChangePolicyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBreakingChangePolicyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBreakingChangePolicyResponse) ProtoMessage() {} + +func (x *GetBreakingChangePolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBreakingChangePolicyResponse.ProtoReflect.Descriptor instead. +func (*GetBreakingChangePolicyResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{13} +} + +func (x *GetBreakingChangePolicyResponse) GetPolicy() *BreakingChangePolicy { + if x != nil { + return x.Policy + } + return nil +} + +type UpdateBreakingChangePolicyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Policy *BreakingChangePolicy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` +} + +func (x *UpdateBreakingChangePolicyRequest) Reset() { + *x = UpdateBreakingChangePolicyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateBreakingChangePolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateBreakingChangePolicyRequest) ProtoMessage() {} + +func (x *UpdateBreakingChangePolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateBreakingChangePolicyRequest.ProtoReflect.Descriptor instead. +func (*UpdateBreakingChangePolicyRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{14} +} + +func (x *UpdateBreakingChangePolicyRequest) GetPolicy() *BreakingChangePolicy { + if x != nil { + return x.Policy + } + return nil +} + +type UpdateBreakingChangePolicyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateBreakingChangePolicyResponse) Reset() { + *x = UpdateBreakingChangePolicyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateBreakingChangePolicyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateBreakingChangePolicyResponse) ProtoMessage() {} + +func (x *UpdateBreakingChangePolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateBreakingChangePolicyResponse.ProtoReflect.Descriptor instead. +func (*UpdateBreakingChangePolicyResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{15} +} + +type GetUniquenessPolicyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetUniquenessPolicyRequest) Reset() { + *x = GetUniquenessPolicyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUniquenessPolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUniquenessPolicyRequest) ProtoMessage() {} + +func (x *GetUniquenessPolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUniquenessPolicyRequest.ProtoReflect.Descriptor instead. +func (*GetUniquenessPolicyRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{16} +} + +type GetUniquenessPolicyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Policy *UniquenessPolicy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` +} + +func (x *GetUniquenessPolicyResponse) Reset() { + *x = GetUniquenessPolicyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUniquenessPolicyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUniquenessPolicyResponse) ProtoMessage() {} + +func (x *GetUniquenessPolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUniquenessPolicyResponse.ProtoReflect.Descriptor instead. +func (*GetUniquenessPolicyResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{17} +} + +func (x *GetUniquenessPolicyResponse) GetPolicy() *UniquenessPolicy { + if x != nil { + return x.Policy + } + return nil +} + +type UpdateUniquenessPolicyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Policy *UniquenessPolicy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` +} + +func (x *UpdateUniquenessPolicyRequest) Reset() { + *x = UpdateUniquenessPolicyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUniquenessPolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUniquenessPolicyRequest) ProtoMessage() {} + +func (x *UpdateUniquenessPolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUniquenessPolicyRequest.ProtoReflect.Descriptor instead. +func (*UpdateUniquenessPolicyRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{18} +} + +func (x *UpdateUniquenessPolicyRequest) GetPolicy() *UniquenessPolicy { + if x != nil { + return x.Policy + } + return nil +} + +type UpdateUniquenessPolicyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateUniquenessPolicyResponse) Reset() { + *x = UpdateUniquenessPolicyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUniquenessPolicyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUniquenessPolicyResponse) ProtoMessage() {} + +func (x *UpdateUniquenessPolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUniquenessPolicyResponse.ProtoReflect.Descriptor instead. +func (*UpdateUniquenessPolicyResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{19} +} + +type ListServerUniquenessCollisionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Token of the page to retrieve. If not specified, the first page of + // results will be returned. Use the value obtained from `next_page_token` + // in the previous response in order to request the next page of results. + PageToken string `protobuf:"bytes,1,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // Number of elements to retrieve in a single page. + // When too large a page is requested, the server may decide to further + // limit the number of returned resources. + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The desired collision type to filter by. + // This must be specified. Only collisions of the specified type will be returned, + // continue to page through results until no more collisions of the specified + // type are returned. + CollisionType CollisionType `protobuf:"varint,3,opt,name=collision_type,json=collisionType,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.CollisionType" json:"collision_type,omitempty"` +} + +func (x *ListServerUniquenessCollisionsRequest) Reset() { + *x = ListServerUniquenessCollisionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListServerUniquenessCollisionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListServerUniquenessCollisionsRequest) ProtoMessage() {} + +func (x *ListServerUniquenessCollisionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListServerUniquenessCollisionsRequest.ProtoReflect.Descriptor instead. +func (*ListServerUniquenessCollisionsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{20} +} + +func (x *ListServerUniquenessCollisionsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListServerUniquenessCollisionsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListServerUniquenessCollisionsRequest) GetCollisionType() CollisionType { + if x != nil { + return x.CollisionType + } + return CollisionType_COLLISION_TYPE_UNSPECIFIED +} + +type ListServerUniquenessCollisionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The collisions. + Collisions []*Collision `protobuf:"bytes,1,rep,name=collisions,proto3" json:"collisions,omitempty"` + // Pagination token used to retrieve the next page of results. + // Pass the content of this string as the `page_token` attribute of + // the next request. `next_page_token` is not returned for the last + // page. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListServerUniquenessCollisionsResponse) Reset() { + *x = ListServerUniquenessCollisionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListServerUniquenessCollisionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListServerUniquenessCollisionsResponse) ProtoMessage() {} + +func (x *ListServerUniquenessCollisionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_admin_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListServerUniquenessCollisionsResponse.ProtoReflect.Descriptor instead. +func (*ListServerUniquenessCollisionsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_admin_proto_rawDescGZIP(), []int{21} +} + +func (x *ListServerUniquenessCollisionsResponse) GetCollisions() []*Collision { + if x != nil { + return x.Collisions + } + return nil +} + +func (x *ListServerUniquenessCollisionsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +var File_registry_v1alpha1_admin_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_admin_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x24, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x22, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x2b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xfc, 0x01, 0x0a, 0x14, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1d, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x65, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x3d, 0x0a, 0x18, 0x69, 0x67, 0x6e, 0x6f, 0x72, + 0x65, 0x5f, 0x75, 0x6e, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x16, 0x69, 0x67, 0x6e, + 0x6f, 0x72, 0x65, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x5d, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, + 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x08, 0x63, 0x61, 0x74, + 0x65, 0x67, 0x6f, 0x72, 0x79, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x42, 0x1b, 0x0a, 0x19, 0x5f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x75, 0x6e, 0x73, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, 0x2c, + 0x0a, 0x10, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x8c, 0x02, 0x0a, + 0x09, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x54, 0x0a, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x1b, + 0x68, 0x61, 0x73, 0x5f, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x18, 0x68, 0x61, 0x73, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x6d, 0x0a, 0x0f, 0x43, + 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, + 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x31, 0x0a, 0x16, 0x46, 0x6f, + 0x72, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xc0, 0x03, + 0x0a, 0x17, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x5d, + 0x0a, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x59, 0x0a, + 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x4f, 0x0a, 0x07, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x02, 0x18, 0x01, + 0x52, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x09, 0x74, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x42, 0x02, 0x18, 0x01, 0x52, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, + 0x22, 0xae, 0x01, 0x0a, 0x23, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x6e, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x12, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x22, 0x26, 0x0a, 0x24, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc6, 0x01, 0x0a, 0x2b, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x12, 0x6e, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x12, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x22, 0x2e, 0x0a, 0x2c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x36, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, + 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x60, 0x0a, 0x19, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x20, 0x0a, 0x1e, + 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x7a, + 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x57, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x72, + 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x7c, 0x0a, 0x21, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x57, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x72, 0x65, 0x61, + 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x24, 0x0a, 0x22, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, + 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x72, 0x0a, 0x1b, + 0x47, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x06, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, + 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x22, 0x74, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x53, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x6e, + 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x06, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x20, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc4, 0x01, 0x0a, 0x25, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, + 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x5f, + 0x0a, 0x0e, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, + 0xa6, 0x01, 0x0a, 0x26, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x6e, + 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0a, 0x63, 0x6f, + 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, + 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0x8d, 0x01, 0x0a, 0x16, 0x42, 0x72, 0x65, + 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, + 0x6f, 0x72, 0x79, 0x12, 0x28, 0x0a, 0x24, 0x42, 0x52, 0x45, 0x41, 0x4b, 0x49, 0x4e, 0x47, 0x5f, + 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x21, 0x0a, + 0x1d, 0x42, 0x52, 0x45, 0x41, 0x4b, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, + 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x01, + 0x12, 0x26, 0x0a, 0x22, 0x42, 0x52, 0x45, 0x41, 0x4b, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x48, 0x41, + 0x4e, 0x47, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x57, 0x49, 0x52, + 0x45, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x02, 0x2a, 0x71, 0x0a, 0x0d, 0x43, 0x6f, 0x6c, 0x6c, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x43, 0x4f, 0x4c, + 0x4c, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x27, 0x0a, 0x23, 0x43, 0x4f, 0x4c, + 0x4c, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x55, 0x4c, 0x4c, + 0x59, 0x5f, 0x51, 0x55, 0x41, 0x4c, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5f, 0x4e, 0x41, 0x4d, 0x45, + 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4c, 0x4c, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x41, 0x54, 0x48, 0x10, 0x02, 0x32, 0x8d, 0x0d, 0x0a, 0x0c, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9d, 0x01, 0x0a, + 0x0f, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x6f, 0x72, + 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x46, 0x6f, 0x72, 0x63, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0xbf, 0x01, 0x0a, + 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4e, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4f, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xd7, + 0x01, 0x0a, 0x24, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x56, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x57, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xa3, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x43, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0xb5, + 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x49, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, + 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb9, 0x01, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0xa9, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xad, + 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, + 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x71, + 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xca, + 0x01, 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x6e, 0x69, + 0x71, 0x75, 0x65, 0x6e, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x50, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x6e, 0x65, + 0x73, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x51, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x6e, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe5, 0x02, 0x0a, 0x2d, + 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0a, 0x41, + 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, + 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, + 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, + 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_admin_proto_rawDescOnce sync.Once + file_registry_v1alpha1_admin_proto_rawDescData = file_registry_v1alpha1_admin_proto_rawDesc +) + +func file_registry_v1alpha1_admin_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_admin_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_admin_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_admin_proto_rawDescData) + }) + return file_registry_v1alpha1_admin_proto_rawDescData +} + +var file_registry_v1alpha1_admin_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_registry_v1alpha1_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_registry_v1alpha1_admin_proto_goTypes = []interface{}{ + (BreakingChangeCategory)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangeCategory + (CollisionType)(0), // 1: bufman.dubbo.apache.org.registry.v1alpha1.CollisionType + (*BreakingChangePolicy)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangePolicy + (*UniquenessPolicy)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.UniquenessPolicy + (*Collision)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.Collision + (*CollisionSource)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.CollisionSource + (*ForceDeleteUserRequest)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserRequest + (*ForceDeleteUserResponse)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserResponse + (*UpdateUserVerificationStatusRequest)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserVerificationStatusRequest + (*UpdateUserVerificationStatusResponse)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserVerificationStatusResponse + (*UpdateOrganizationVerificationStatusRequest)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationVerificationStatusRequest + (*UpdateOrganizationVerificationStatusResponse)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationVerificationStatusResponse + (*CreateMachineUserRequest)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.CreateMachineUserRequest + (*CreateMachineUserResponse)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.CreateMachineUserResponse + (*GetBreakingChangePolicyRequest)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.GetBreakingChangePolicyRequest + (*GetBreakingChangePolicyResponse)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.GetBreakingChangePolicyResponse + (*UpdateBreakingChangePolicyRequest)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.UpdateBreakingChangePolicyRequest + (*UpdateBreakingChangePolicyResponse)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.UpdateBreakingChangePolicyResponse + (*GetUniquenessPolicyRequest)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.GetUniquenessPolicyRequest + (*GetUniquenessPolicyResponse)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.GetUniquenessPolicyResponse + (*UpdateUniquenessPolicyRequest)(nil), // 20: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUniquenessPolicyRequest + (*UpdateUniquenessPolicyResponse)(nil), // 21: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUniquenessPolicyResponse + (*ListServerUniquenessCollisionsRequest)(nil), // 22: bufman.dubbo.apache.org.registry.v1alpha1.ListServerUniquenessCollisionsRequest + (*ListServerUniquenessCollisionsResponse)(nil), // 23: bufman.dubbo.apache.org.registry.v1alpha1.ListServerUniquenessCollisionsResponse + (*User)(nil), // 24: bufman.dubbo.apache.org.registry.v1alpha1.User + (*Organization)(nil), // 25: bufman.dubbo.apache.org.registry.v1alpha1.Organization + (*Repository)(nil), // 26: bufman.dubbo.apache.org.registry.v1alpha1.Repository + (*Plugin)(nil), // 27: bufman.dubbo.apache.org.registry.v1alpha1.Plugin + (*Template)(nil), // 28: bufman.dubbo.apache.org.registry.v1alpha1.Template + (VerificationStatus)(0), // 29: bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus +} +var file_registry_v1alpha1_admin_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangePolicy.category:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangeCategory + 1, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Collision.type:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CollisionType + 5, // 2: bufman.dubbo.apache.org.registry.v1alpha1.Collision.sources:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CollisionSource + 24, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserResponse.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 25, // 4: bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserResponse.organizations:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Organization + 26, // 5: bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserResponse.repositories:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 27, // 6: bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserResponse.plugins:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Plugin + 28, // 7: bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserResponse.templates:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Template + 29, // 8: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserVerificationStatusRequest.verification_status:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus + 29, // 9: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationVerificationStatusRequest.verification_status:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus + 24, // 10: bufman.dubbo.apache.org.registry.v1alpha1.CreateMachineUserResponse.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 2, // 11: bufman.dubbo.apache.org.registry.v1alpha1.GetBreakingChangePolicyResponse.policy:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangePolicy + 2, // 12: bufman.dubbo.apache.org.registry.v1alpha1.UpdateBreakingChangePolicyRequest.policy:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.BreakingChangePolicy + 3, // 13: bufman.dubbo.apache.org.registry.v1alpha1.GetUniquenessPolicyResponse.policy:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.UniquenessPolicy + 3, // 14: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUniquenessPolicyRequest.policy:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.UniquenessPolicy + 1, // 15: bufman.dubbo.apache.org.registry.v1alpha1.ListServerUniquenessCollisionsRequest.collision_type:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CollisionType + 4, // 16: bufman.dubbo.apache.org.registry.v1alpha1.ListServerUniquenessCollisionsResponse.collisions:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Collision + 6, // 17: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ForceDeleteUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserRequest + 8, // 18: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUserVerificationStatus:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserVerificationStatusRequest + 10, // 19: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateOrganizationVerificationStatus:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationVerificationStatusRequest + 12, // 20: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.CreateMachineUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateMachineUserRequest + 14, // 21: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetBreakingChangePolicy:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetBreakingChangePolicyRequest + 16, // 22: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateBreakingChangePolicy:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateBreakingChangePolicyRequest + 18, // 23: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetUniquenessPolicy:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetUniquenessPolicyRequest + 20, // 24: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUniquenessPolicy:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateUniquenessPolicyRequest + 22, // 25: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ListServerUniquenessCollisions:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListServerUniquenessCollisionsRequest + 7, // 26: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ForceDeleteUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ForceDeleteUserResponse + 9, // 27: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUserVerificationStatus:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserVerificationStatusResponse + 11, // 28: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateOrganizationVerificationStatus:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationVerificationStatusResponse + 13, // 29: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.CreateMachineUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateMachineUserResponse + 15, // 30: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetBreakingChangePolicy:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetBreakingChangePolicyResponse + 17, // 31: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateBreakingChangePolicy:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateBreakingChangePolicyResponse + 19, // 32: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.GetUniquenessPolicy:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetUniquenessPolicyResponse + 21, // 33: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.UpdateUniquenessPolicy:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateUniquenessPolicyResponse + 23, // 34: bufman.dubbo.apache.org.registry.v1alpha1.AdminService.ListServerUniquenessCollisions:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListServerUniquenessCollisionsResponse + 26, // [26:35] is the sub-list for method output_type + 17, // [17:26] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_admin_proto_init() } +func file_registry_v1alpha1_admin_proto_init() { + if File_registry_v1alpha1_admin_proto != nil { + return + } + file_registry_v1alpha1_organization_proto_init() + file_registry_v1alpha1_plugin_proto_init() + file_registry_v1alpha1_repository_proto_init() + file_registry_v1alpha1_user_proto_init() + file_registry_v1alpha1_verification_status_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_admin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BreakingChangePolicy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UniquenessPolicy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Collision); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CollisionSource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ForceDeleteUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ForceDeleteUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserVerificationStatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserVerificationStatusResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateOrganizationVerificationStatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateOrganizationVerificationStatusResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateMachineUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateMachineUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBreakingChangePolicyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBreakingChangePolicyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateBreakingChangePolicyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateBreakingChangePolicyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUniquenessPolicyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUniquenessPolicyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUniquenessPolicyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUniquenessPolicyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListServerUniquenessCollisionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_admin_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListServerUniquenessCollisionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_admin_proto_msgTypes[0].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_admin_proto_rawDesc, + NumEnums: 2, + NumMessages: 22, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_admin_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_admin_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_admin_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_admin_proto_msgTypes, + }.Build() + File_registry_v1alpha1_admin_proto = out.File + file_registry_v1alpha1_admin_proto_rawDesc = nil + file_registry_v1alpha1_admin_proto_goTypes = nil + file_registry_v1alpha1_admin_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/admin_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/admin_grpc.pb.go new file mode 100644 index 000000000..40deae002 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/admin_grpc.pb.go @@ -0,0 +1,425 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/admin.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + AdminService_ForceDeleteUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/ForceDeleteUser" + AdminService_UpdateUserVerificationStatus_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateUserVerificationStatus" + AdminService_UpdateOrganizationVerificationStatus_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateOrganizationVerificationStatus" + AdminService_CreateMachineUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/CreateMachineUser" + AdminService_GetBreakingChangePolicy_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/GetBreakingChangePolicy" + AdminService_UpdateBreakingChangePolicy_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateBreakingChangePolicy" + AdminService_GetUniquenessPolicy_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/GetUniquenessPolicy" + AdminService_UpdateUniquenessPolicy_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/UpdateUniquenessPolicy" + AdminService_ListServerUniquenessCollisions_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AdminService/ListServerUniquenessCollisions" +) + +// AdminServiceClient is the client API for AdminService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AdminServiceClient interface { + // ForceDeleteUser forces to delete a user. Resources and organizations that are + // solely owned by the user will also be deleted. + ForceDeleteUser(ctx context.Context, in *ForceDeleteUserRequest, opts ...grpc.CallOption) (*ForceDeleteUserResponse, error) + // Update a user's verification status. + UpdateUserVerificationStatus(ctx context.Context, in *UpdateUserVerificationStatusRequest, opts ...grpc.CallOption) (*UpdateUserVerificationStatusResponse, error) + // Update a organization's verification. + UpdateOrganizationVerificationStatus(ctx context.Context, in *UpdateOrganizationVerificationStatusRequest, opts ...grpc.CallOption) (*UpdateOrganizationVerificationStatusResponse, error) + // Create a new machine user on the server. + CreateMachineUser(ctx context.Context, in *CreateMachineUserRequest, opts ...grpc.CallOption) (*CreateMachineUserResponse, error) + // Get breaking change policy for the server. + GetBreakingChangePolicy(ctx context.Context, in *GetBreakingChangePolicyRequest, opts ...grpc.CallOption) (*GetBreakingChangePolicyResponse, error) + // Update breaking change policy for the server. + UpdateBreakingChangePolicy(ctx context.Context, in *UpdateBreakingChangePolicyRequest, opts ...grpc.CallOption) (*UpdateBreakingChangePolicyResponse, error) + // Get uniqueness policy for the server. + GetUniquenessPolicy(ctx context.Context, in *GetUniquenessPolicyRequest, opts ...grpc.CallOption) (*GetUniquenessPolicyResponse, error) + // Update uniqueness policy enforcement for the server. + UpdateUniquenessPolicy(ctx context.Context, in *UpdateUniquenessPolicyRequest, opts ...grpc.CallOption) (*UpdateUniquenessPolicyResponse, error) + // Get state of uniqueness collisions for the server + ListServerUniquenessCollisions(ctx context.Context, in *ListServerUniquenessCollisionsRequest, opts ...grpc.CallOption) (*ListServerUniquenessCollisionsResponse, error) +} + +type adminServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient { + return &adminServiceClient{cc} +} + +func (c *adminServiceClient) ForceDeleteUser(ctx context.Context, in *ForceDeleteUserRequest, opts ...grpc.CallOption) (*ForceDeleteUserResponse, error) { + out := new(ForceDeleteUserResponse) + err := c.cc.Invoke(ctx, AdminService_ForceDeleteUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) UpdateUserVerificationStatus(ctx context.Context, in *UpdateUserVerificationStatusRequest, opts ...grpc.CallOption) (*UpdateUserVerificationStatusResponse, error) { + out := new(UpdateUserVerificationStatusResponse) + err := c.cc.Invoke(ctx, AdminService_UpdateUserVerificationStatus_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) UpdateOrganizationVerificationStatus(ctx context.Context, in *UpdateOrganizationVerificationStatusRequest, opts ...grpc.CallOption) (*UpdateOrganizationVerificationStatusResponse, error) { + out := new(UpdateOrganizationVerificationStatusResponse) + err := c.cc.Invoke(ctx, AdminService_UpdateOrganizationVerificationStatus_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) CreateMachineUser(ctx context.Context, in *CreateMachineUserRequest, opts ...grpc.CallOption) (*CreateMachineUserResponse, error) { + out := new(CreateMachineUserResponse) + err := c.cc.Invoke(ctx, AdminService_CreateMachineUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) GetBreakingChangePolicy(ctx context.Context, in *GetBreakingChangePolicyRequest, opts ...grpc.CallOption) (*GetBreakingChangePolicyResponse, error) { + out := new(GetBreakingChangePolicyResponse) + err := c.cc.Invoke(ctx, AdminService_GetBreakingChangePolicy_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) UpdateBreakingChangePolicy(ctx context.Context, in *UpdateBreakingChangePolicyRequest, opts ...grpc.CallOption) (*UpdateBreakingChangePolicyResponse, error) { + out := new(UpdateBreakingChangePolicyResponse) + err := c.cc.Invoke(ctx, AdminService_UpdateBreakingChangePolicy_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) GetUniquenessPolicy(ctx context.Context, in *GetUniquenessPolicyRequest, opts ...grpc.CallOption) (*GetUniquenessPolicyResponse, error) { + out := new(GetUniquenessPolicyResponse) + err := c.cc.Invoke(ctx, AdminService_GetUniquenessPolicy_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) UpdateUniquenessPolicy(ctx context.Context, in *UpdateUniquenessPolicyRequest, opts ...grpc.CallOption) (*UpdateUniquenessPolicyResponse, error) { + out := new(UpdateUniquenessPolicyResponse) + err := c.cc.Invoke(ctx, AdminService_UpdateUniquenessPolicy_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) ListServerUniquenessCollisions(ctx context.Context, in *ListServerUniquenessCollisionsRequest, opts ...grpc.CallOption) (*ListServerUniquenessCollisionsResponse, error) { + out := new(ListServerUniquenessCollisionsResponse) + err := c.cc.Invoke(ctx, AdminService_ListServerUniquenessCollisions_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AdminServiceServer is the server API for AdminService service. +// All implementations must embed UnimplementedAdminServiceServer +// for forward compatibility +type AdminServiceServer interface { + // ForceDeleteUser forces to delete a user. Resources and organizations that are + // solely owned by the user will also be deleted. + ForceDeleteUser(context.Context, *ForceDeleteUserRequest) (*ForceDeleteUserResponse, error) + // Update a user's verification status. + UpdateUserVerificationStatus(context.Context, *UpdateUserVerificationStatusRequest) (*UpdateUserVerificationStatusResponse, error) + // Update a organization's verification. + UpdateOrganizationVerificationStatus(context.Context, *UpdateOrganizationVerificationStatusRequest) (*UpdateOrganizationVerificationStatusResponse, error) + // Create a new machine user on the server. + CreateMachineUser(context.Context, *CreateMachineUserRequest) (*CreateMachineUserResponse, error) + // Get breaking change policy for the server. + GetBreakingChangePolicy(context.Context, *GetBreakingChangePolicyRequest) (*GetBreakingChangePolicyResponse, error) + // Update breaking change policy for the server. + UpdateBreakingChangePolicy(context.Context, *UpdateBreakingChangePolicyRequest) (*UpdateBreakingChangePolicyResponse, error) + // Get uniqueness policy for the server. + GetUniquenessPolicy(context.Context, *GetUniquenessPolicyRequest) (*GetUniquenessPolicyResponse, error) + // Update uniqueness policy enforcement for the server. + UpdateUniquenessPolicy(context.Context, *UpdateUniquenessPolicyRequest) (*UpdateUniquenessPolicyResponse, error) + // Get state of uniqueness collisions for the server + ListServerUniquenessCollisions(context.Context, *ListServerUniquenessCollisionsRequest) (*ListServerUniquenessCollisionsResponse, error) + mustEmbedUnimplementedAdminServiceServer() +} + +// UnimplementedAdminServiceServer must be embedded to have forward compatible implementations. +type UnimplementedAdminServiceServer struct { +} + +func (UnimplementedAdminServiceServer) ForceDeleteUser(context.Context, *ForceDeleteUserRequest) (*ForceDeleteUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ForceDeleteUser not implemented") +} +func (UnimplementedAdminServiceServer) UpdateUserVerificationStatus(context.Context, *UpdateUserVerificationStatusRequest) (*UpdateUserVerificationStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUserVerificationStatus not implemented") +} +func (UnimplementedAdminServiceServer) UpdateOrganizationVerificationStatus(context.Context, *UpdateOrganizationVerificationStatusRequest) (*UpdateOrganizationVerificationStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateOrganizationVerificationStatus not implemented") +} +func (UnimplementedAdminServiceServer) CreateMachineUser(context.Context, *CreateMachineUserRequest) (*CreateMachineUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateMachineUser not implemented") +} +func (UnimplementedAdminServiceServer) GetBreakingChangePolicy(context.Context, *GetBreakingChangePolicyRequest) (*GetBreakingChangePolicyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBreakingChangePolicy not implemented") +} +func (UnimplementedAdminServiceServer) UpdateBreakingChangePolicy(context.Context, *UpdateBreakingChangePolicyRequest) (*UpdateBreakingChangePolicyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateBreakingChangePolicy not implemented") +} +func (UnimplementedAdminServiceServer) GetUniquenessPolicy(context.Context, *GetUniquenessPolicyRequest) (*GetUniquenessPolicyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUniquenessPolicy not implemented") +} +func (UnimplementedAdminServiceServer) UpdateUniquenessPolicy(context.Context, *UpdateUniquenessPolicyRequest) (*UpdateUniquenessPolicyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUniquenessPolicy not implemented") +} +func (UnimplementedAdminServiceServer) ListServerUniquenessCollisions(context.Context, *ListServerUniquenessCollisionsRequest) (*ListServerUniquenessCollisionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListServerUniquenessCollisions not implemented") +} +func (UnimplementedAdminServiceServer) mustEmbedUnimplementedAdminServiceServer() {} + +// UnsafeAdminServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AdminServiceServer will +// result in compilation errors. +type UnsafeAdminServiceServer interface { + mustEmbedUnimplementedAdminServiceServer() +} + +func RegisterAdminServiceServer(s grpc.ServiceRegistrar, srv AdminServiceServer) { + s.RegisterService(&AdminService_ServiceDesc, srv) +} + +func _AdminService_ForceDeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ForceDeleteUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).ForceDeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_ForceDeleteUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).ForceDeleteUser(ctx, req.(*ForceDeleteUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_UpdateUserVerificationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserVerificationStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).UpdateUserVerificationStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_UpdateUserVerificationStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).UpdateUserVerificationStatus(ctx, req.(*UpdateUserVerificationStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_UpdateOrganizationVerificationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateOrganizationVerificationStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).UpdateOrganizationVerificationStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_UpdateOrganizationVerificationStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).UpdateOrganizationVerificationStatus(ctx, req.(*UpdateOrganizationVerificationStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_CreateMachineUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateMachineUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).CreateMachineUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_CreateMachineUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).CreateMachineUser(ctx, req.(*CreateMachineUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_GetBreakingChangePolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBreakingChangePolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).GetBreakingChangePolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_GetBreakingChangePolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).GetBreakingChangePolicy(ctx, req.(*GetBreakingChangePolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_UpdateBreakingChangePolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateBreakingChangePolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).UpdateBreakingChangePolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_UpdateBreakingChangePolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).UpdateBreakingChangePolicy(ctx, req.(*UpdateBreakingChangePolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_GetUniquenessPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUniquenessPolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).GetUniquenessPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_GetUniquenessPolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).GetUniquenessPolicy(ctx, req.(*GetUniquenessPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_UpdateUniquenessPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUniquenessPolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).UpdateUniquenessPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_UpdateUniquenessPolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).UpdateUniquenessPolicy(ctx, req.(*UpdateUniquenessPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_ListServerUniquenessCollisions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListServerUniquenessCollisionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).ListServerUniquenessCollisions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AdminService_ListServerUniquenessCollisions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).ListServerUniquenessCollisions(ctx, req.(*ListServerUniquenessCollisionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AdminService_ServiceDesc is the grpc.ServiceDesc for AdminService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AdminService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.AdminService", + HandlerType: (*AdminServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ForceDeleteUser", + Handler: _AdminService_ForceDeleteUser_Handler, + }, + { + MethodName: "UpdateUserVerificationStatus", + Handler: _AdminService_UpdateUserVerificationStatus_Handler, + }, + { + MethodName: "UpdateOrganizationVerificationStatus", + Handler: _AdminService_UpdateOrganizationVerificationStatus_Handler, + }, + { + MethodName: "CreateMachineUser", + Handler: _AdminService_CreateMachineUser_Handler, + }, + { + MethodName: "GetBreakingChangePolicy", + Handler: _AdminService_GetBreakingChangePolicy_Handler, + }, + { + MethodName: "UpdateBreakingChangePolicy", + Handler: _AdminService_UpdateBreakingChangePolicy_Handler, + }, + { + MethodName: "GetUniquenessPolicy", + Handler: _AdminService_GetUniquenessPolicy_Handler, + }, + { + MethodName: "UpdateUniquenessPolicy", + Handler: _AdminService_UpdateUniquenessPolicy_Handler, + }, + { + MethodName: "ListServerUniquenessCollisions", + Handler: _AdminService_ListServerUniquenessCollisions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/admin.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/authn.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/authn.pb.go new file mode 100644 index 000000000..a403024b0 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/authn.pb.go @@ -0,0 +1,374 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/authn.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetCurrentUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetCurrentUserRequest) Reset() { + *x = GetCurrentUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authn_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCurrentUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCurrentUserRequest) ProtoMessage() {} + +func (x *GetCurrentUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authn_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCurrentUserRequest.ProtoReflect.Descriptor instead. +func (*GetCurrentUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authn_proto_rawDescGZIP(), []int{0} +} + +type GetCurrentUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *GetCurrentUserResponse) Reset() { + *x = GetCurrentUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authn_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCurrentUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCurrentUserResponse) ProtoMessage() {} + +func (x *GetCurrentUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authn_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCurrentUserResponse.ProtoReflect.Descriptor instead. +func (*GetCurrentUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authn_proto_rawDescGZIP(), []int{1} +} + +func (x *GetCurrentUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type GetCurrentUserSubjectRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetCurrentUserSubjectRequest) Reset() { + *x = GetCurrentUserSubjectRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authn_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCurrentUserSubjectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCurrentUserSubjectRequest) ProtoMessage() {} + +func (x *GetCurrentUserSubjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authn_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCurrentUserSubjectRequest.ProtoReflect.Descriptor instead. +func (*GetCurrentUserSubjectRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authn_proto_rawDescGZIP(), []int{2} +} + +type GetCurrentUserSubjectResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The user's subject for mapping to user in identity provider. + // Note: we do not want to make it part of the User response as + // it contains potentially sensitive information and the User + // response is shared with other users. + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` +} + +func (x *GetCurrentUserSubjectResponse) Reset() { + *x = GetCurrentUserSubjectResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authn_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCurrentUserSubjectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCurrentUserSubjectResponse) ProtoMessage() {} + +func (x *GetCurrentUserSubjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authn_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCurrentUserSubjectResponse.ProtoReflect.Descriptor instead. +func (*GetCurrentUserSubjectResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authn_proto_rawDescGZIP(), []int{3} +} + +func (x *GetCurrentUserSubjectResponse) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +var File_registry_v1alpha1_authn_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_authn_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1c, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x75, 0x73, + 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x5d, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x75, + 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, + 0x22, 0x1e, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x39, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x32, 0xdd, 0x02, 0x0a, 0x0c, + 0x41, 0x75, 0x74, 0x68, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9a, 0x01, 0x0a, + 0x0e, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, + 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xaf, 0x01, 0x0a, 0x15, 0x47, 0x65, + 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x12, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x48, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe5, 0x02, 0x0a, 0x2d, + 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0a, 0x41, + 0x75, 0x74, 0x68, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, + 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, + 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, + 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_authn_proto_rawDescOnce sync.Once + file_registry_v1alpha1_authn_proto_rawDescData = file_registry_v1alpha1_authn_proto_rawDesc +) + +func file_registry_v1alpha1_authn_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_authn_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_authn_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_authn_proto_rawDescData) + }) + return file_registry_v1alpha1_authn_proto_rawDescData +} + +var file_registry_v1alpha1_authn_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_registry_v1alpha1_authn_proto_goTypes = []interface{}{ + (*GetCurrentUserRequest)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserRequest + (*GetCurrentUserResponse)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserResponse + (*GetCurrentUserSubjectRequest)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserSubjectRequest + (*GetCurrentUserSubjectResponse)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserSubjectResponse + (*User)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.User +} +var file_registry_v1alpha1_authn_proto_depIdxs = []int32{ + 4, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserResponse.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserRequest + 2, // 2: bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUserSubject:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserSubjectRequest + 1, // 3: bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserResponse + 3, // 4: bufman.dubbo.apache.org.registry.v1alpha1.AuthnService.GetCurrentUserSubject:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetCurrentUserSubjectResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_authn_proto_init() } +func file_registry_v1alpha1_authn_proto_init() { + if File_registry_v1alpha1_authn_proto != nil { + return + } + file_registry_v1alpha1_user_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_authn_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCurrentUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authn_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCurrentUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authn_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCurrentUserSubjectRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authn_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCurrentUserSubjectResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_authn_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_authn_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_authn_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_authn_proto_msgTypes, + }.Build() + File_registry_v1alpha1_authn_proto = out.File + file_registry_v1alpha1_authn_proto_rawDesc = nil + file_registry_v1alpha1_authn_proto_goTypes = nil + file_registry_v1alpha1_authn_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/authn_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/authn_grpc.pb.go new file mode 100644 index 000000000..fc0048a72 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/authn_grpc.pb.go @@ -0,0 +1,158 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/authn.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + AuthnService_GetCurrentUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthnService/GetCurrentUser" + AuthnService_GetCurrentUserSubject_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthnService/GetCurrentUserSubject" +) + +// AuthnServiceClient is the client API for AuthnService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AuthnServiceClient interface { + // GetCurrentUser gets information associated with the current user. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUser(ctx context.Context, in *GetCurrentUserRequest, opts ...grpc.CallOption) (*GetCurrentUserResponse, error) + // GetCurrentUserSubject gets the currently logged in users subject. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUserSubject(ctx context.Context, in *GetCurrentUserSubjectRequest, opts ...grpc.CallOption) (*GetCurrentUserSubjectResponse, error) +} + +type authnServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAuthnServiceClient(cc grpc.ClientConnInterface) AuthnServiceClient { + return &authnServiceClient{cc} +} + +func (c *authnServiceClient) GetCurrentUser(ctx context.Context, in *GetCurrentUserRequest, opts ...grpc.CallOption) (*GetCurrentUserResponse, error) { + out := new(GetCurrentUserResponse) + err := c.cc.Invoke(ctx, AuthnService_GetCurrentUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authnServiceClient) GetCurrentUserSubject(ctx context.Context, in *GetCurrentUserSubjectRequest, opts ...grpc.CallOption) (*GetCurrentUserSubjectResponse, error) { + out := new(GetCurrentUserSubjectResponse) + err := c.cc.Invoke(ctx, AuthnService_GetCurrentUserSubject_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuthnServiceServer is the server API for AuthnService service. +// All implementations must embed UnimplementedAuthnServiceServer +// for forward compatibility +type AuthnServiceServer interface { + // GetCurrentUser gets information associated with the current user. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUser(context.Context, *GetCurrentUserRequest) (*GetCurrentUserResponse, error) + // GetCurrentUserSubject gets the currently logged in users subject. + // + // The user's ID is retrieved from the request's authentication header. + GetCurrentUserSubject(context.Context, *GetCurrentUserSubjectRequest) (*GetCurrentUserSubjectResponse, error) + mustEmbedUnimplementedAuthnServiceServer() +} + +// UnimplementedAuthnServiceServer must be embedded to have forward compatible implementations. +type UnimplementedAuthnServiceServer struct { +} + +func (UnimplementedAuthnServiceServer) GetCurrentUser(context.Context, *GetCurrentUserRequest) (*GetCurrentUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCurrentUser not implemented") +} +func (UnimplementedAuthnServiceServer) GetCurrentUserSubject(context.Context, *GetCurrentUserSubjectRequest) (*GetCurrentUserSubjectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCurrentUserSubject not implemented") +} +func (UnimplementedAuthnServiceServer) mustEmbedUnimplementedAuthnServiceServer() {} + +// UnsafeAuthnServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuthnServiceServer will +// result in compilation errors. +type UnsafeAuthnServiceServer interface { + mustEmbedUnimplementedAuthnServiceServer() +} + +func RegisterAuthnServiceServer(s grpc.ServiceRegistrar, srv AuthnServiceServer) { + s.RegisterService(&AuthnService_ServiceDesc, srv) +} + +func _AuthnService_GetCurrentUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCurrentUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthnServiceServer).GetCurrentUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthnService_GetCurrentUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthnServiceServer).GetCurrentUser(ctx, req.(*GetCurrentUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthnService_GetCurrentUserSubject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCurrentUserSubjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthnServiceServer).GetCurrentUserSubject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthnService_GetCurrentUserSubject_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthnServiceServer).GetCurrentUserSubject(ctx, req.(*GetCurrentUserSubjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AuthnService_ServiceDesc is the grpc.ServiceDesc for AuthnService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AuthnService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.AuthnService", + HandlerType: (*AuthnServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetCurrentUser", + Handler: _AuthnService_GetCurrentUser_Handler, + }, + { + MethodName: "GetCurrentUserSubject", + Handler: _AuthnService_GetCurrentUserSubject_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/authn.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/authz.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/authz.pb.go new file mode 100644 index 000000000..ac7477122 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/authz.pb.go @@ -0,0 +1,3086 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/authz.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type UserCanCreateOrganizationRepositoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // whether the user is authorized. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *UserCanCreateOrganizationRepositoryRequest) Reset() { + *x = UserCanCreateOrganizationRepositoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreateOrganizationRepositoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreateOrganizationRepositoryRequest) ProtoMessage() {} + +func (x *UserCanCreateOrganizationRepositoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreateOrganizationRepositoryRequest.ProtoReflect.Descriptor instead. +func (*UserCanCreateOrganizationRepositoryRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{0} +} + +func (x *UserCanCreateOrganizationRepositoryRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type UserCanCreateOrganizationRepositoryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanCreateOrganizationRepositoryResponse) Reset() { + *x = UserCanCreateOrganizationRepositoryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreateOrganizationRepositoryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreateOrganizationRepositoryResponse) ProtoMessage() {} + +func (x *UserCanCreateOrganizationRepositoryResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreateOrganizationRepositoryResponse.ProtoReflect.Descriptor instead. +func (*UserCanCreateOrganizationRepositoryResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{1} +} + +func (x *UserCanCreateOrganizationRepositoryResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +type UserCanSeeRepositorySettingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to check + // whether the user is authorized. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` +} + +func (x *UserCanSeeRepositorySettingsRequest) Reset() { + *x = UserCanSeeRepositorySettingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeeRepositorySettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeeRepositorySettingsRequest) ProtoMessage() {} + +func (x *UserCanSeeRepositorySettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeeRepositorySettingsRequest.ProtoReflect.Descriptor instead. +func (*UserCanSeeRepositorySettingsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{2} +} + +func (x *UserCanSeeRepositorySettingsRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +type UserCanSeeRepositorySettingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanSeeRepositorySettingsResponse) Reset() { + *x = UserCanSeeRepositorySettingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeeRepositorySettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeeRepositorySettingsResponse) ProtoMessage() {} + +func (x *UserCanSeeRepositorySettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeeRepositorySettingsResponse.ProtoReflect.Descriptor instead. +func (*UserCanSeeRepositorySettingsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{3} +} + +func (x *UserCanSeeRepositorySettingsResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +type UserCanSeeOrganizationSettingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // whether the user is authorized. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *UserCanSeeOrganizationSettingsRequest) Reset() { + *x = UserCanSeeOrganizationSettingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeeOrganizationSettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeeOrganizationSettingsRequest) ProtoMessage() {} + +func (x *UserCanSeeOrganizationSettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeeOrganizationSettingsRequest.ProtoReflect.Descriptor instead. +func (*UserCanSeeOrganizationSettingsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{4} +} + +func (x *UserCanSeeOrganizationSettingsRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type UserCanSeeOrganizationSettingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanSeeOrganizationSettingsResponse) Reset() { + *x = UserCanSeeOrganizationSettingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeeOrganizationSettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeeOrganizationSettingsResponse) ProtoMessage() {} + +func (x *UserCanSeeOrganizationSettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeeOrganizationSettingsResponse.ProtoReflect.Descriptor instead. +func (*UserCanSeeOrganizationSettingsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{5} +} + +func (x *UserCanSeeOrganizationSettingsResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanReadPluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *UserCanReadPluginRequest) Reset() { + *x = UserCanReadPluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanReadPluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanReadPluginRequest) ProtoMessage() {} + +func (x *UserCanReadPluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanReadPluginRequest.ProtoReflect.Descriptor instead. +func (*UserCanReadPluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{6} +} + +func (x *UserCanReadPluginRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *UserCanReadPluginRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Deprecated: Do not use. +type UserCanReadPluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanReadPluginResponse) Reset() { + *x = UserCanReadPluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanReadPluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanReadPluginResponse) ProtoMessage() {} + +func (x *UserCanReadPluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanReadPluginResponse.ProtoReflect.Descriptor instead. +func (*UserCanReadPluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{7} +} + +func (x *UserCanReadPluginResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanCreatePluginVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *UserCanCreatePluginVersionRequest) Reset() { + *x = UserCanCreatePluginVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreatePluginVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreatePluginVersionRequest) ProtoMessage() {} + +func (x *UserCanCreatePluginVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreatePluginVersionRequest.ProtoReflect.Descriptor instead. +func (*UserCanCreatePluginVersionRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{8} +} + +func (x *UserCanCreatePluginVersionRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *UserCanCreatePluginVersionRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Deprecated: Do not use. +type UserCanCreatePluginVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanCreatePluginVersionResponse) Reset() { + *x = UserCanCreatePluginVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreatePluginVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreatePluginVersionResponse) ProtoMessage() {} + +func (x *UserCanCreatePluginVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreatePluginVersionResponse.ProtoReflect.Descriptor instead. +func (*UserCanCreatePluginVersionResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{9} +} + +func (x *UserCanCreatePluginVersionResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanCreateTemplateVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the template. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the template. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *UserCanCreateTemplateVersionRequest) Reset() { + *x = UserCanCreateTemplateVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreateTemplateVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreateTemplateVersionRequest) ProtoMessage() {} + +func (x *UserCanCreateTemplateVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreateTemplateVersionRequest.ProtoReflect.Descriptor instead. +func (*UserCanCreateTemplateVersionRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{10} +} + +func (x *UserCanCreateTemplateVersionRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *UserCanCreateTemplateVersionRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Deprecated: Do not use. +type UserCanCreateTemplateVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanCreateTemplateVersionResponse) Reset() { + *x = UserCanCreateTemplateVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreateTemplateVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreateTemplateVersionResponse) ProtoMessage() {} + +func (x *UserCanCreateTemplateVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreateTemplateVersionResponse.ProtoReflect.Descriptor instead. +func (*UserCanCreateTemplateVersionResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{11} +} + +func (x *UserCanCreateTemplateVersionResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanCreateOrganizationPluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // whether the user is authorized. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *UserCanCreateOrganizationPluginRequest) Reset() { + *x = UserCanCreateOrganizationPluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreateOrganizationPluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreateOrganizationPluginRequest) ProtoMessage() {} + +func (x *UserCanCreateOrganizationPluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreateOrganizationPluginRequest.ProtoReflect.Descriptor instead. +func (*UserCanCreateOrganizationPluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{12} +} + +func (x *UserCanCreateOrganizationPluginRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +// Deprecated: Do not use. +type UserCanCreateOrganizationPluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanCreateOrganizationPluginResponse) Reset() { + *x = UserCanCreateOrganizationPluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreateOrganizationPluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreateOrganizationPluginResponse) ProtoMessage() {} + +func (x *UserCanCreateOrganizationPluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreateOrganizationPluginResponse.ProtoReflect.Descriptor instead. +func (*UserCanCreateOrganizationPluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{13} +} + +func (x *UserCanCreateOrganizationPluginResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanCreateOrganizationTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // whether the user is authorized. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *UserCanCreateOrganizationTemplateRequest) Reset() { + *x = UserCanCreateOrganizationTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreateOrganizationTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreateOrganizationTemplateRequest) ProtoMessage() {} + +func (x *UserCanCreateOrganizationTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreateOrganizationTemplateRequest.ProtoReflect.Descriptor instead. +func (*UserCanCreateOrganizationTemplateRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{14} +} + +func (x *UserCanCreateOrganizationTemplateRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +// Deprecated: Do not use. +type UserCanCreateOrganizationTemplateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanCreateOrganizationTemplateResponse) Reset() { + *x = UserCanCreateOrganizationTemplateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanCreateOrganizationTemplateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanCreateOrganizationTemplateResponse) ProtoMessage() {} + +func (x *UserCanCreateOrganizationTemplateResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanCreateOrganizationTemplateResponse.ProtoReflect.Descriptor instead. +func (*UserCanCreateOrganizationTemplateResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{15} +} + +func (x *UserCanCreateOrganizationTemplateResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanSeePluginSettingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *UserCanSeePluginSettingsRequest) Reset() { + *x = UserCanSeePluginSettingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeePluginSettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeePluginSettingsRequest) ProtoMessage() {} + +func (x *UserCanSeePluginSettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeePluginSettingsRequest.ProtoReflect.Descriptor instead. +func (*UserCanSeePluginSettingsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{16} +} + +func (x *UserCanSeePluginSettingsRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *UserCanSeePluginSettingsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Deprecated: Do not use. +type UserCanSeePluginSettingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanSeePluginSettingsResponse) Reset() { + *x = UserCanSeePluginSettingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeePluginSettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeePluginSettingsResponse) ProtoMessage() {} + +func (x *UserCanSeePluginSettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeePluginSettingsResponse.ProtoReflect.Descriptor instead. +func (*UserCanSeePluginSettingsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{17} +} + +func (x *UserCanSeePluginSettingsResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanSeeTemplateSettingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the template. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the template. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *UserCanSeeTemplateSettingsRequest) Reset() { + *x = UserCanSeeTemplateSettingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeeTemplateSettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeeTemplateSettingsRequest) ProtoMessage() {} + +func (x *UserCanSeeTemplateSettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeeTemplateSettingsRequest.ProtoReflect.Descriptor instead. +func (*UserCanSeeTemplateSettingsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{18} +} + +func (x *UserCanSeeTemplateSettingsRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *UserCanSeeTemplateSettingsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Deprecated: Do not use. +type UserCanSeeTemplateSettingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanSeeTemplateSettingsResponse) Reset() { + *x = UserCanSeeTemplateSettingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeeTemplateSettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeeTemplateSettingsResponse) ProtoMessage() {} + +func (x *UserCanSeeTemplateSettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeeTemplateSettingsResponse.ProtoReflect.Descriptor instead. +func (*UserCanSeeTemplateSettingsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{19} +} + +func (x *UserCanSeeTemplateSettingsResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +type UserCanAddOrganizationMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // whether the user is authorized. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *UserCanAddOrganizationMemberRequest) Reset() { + *x = UserCanAddOrganizationMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanAddOrganizationMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanAddOrganizationMemberRequest) ProtoMessage() {} + +func (x *UserCanAddOrganizationMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanAddOrganizationMemberRequest.ProtoReflect.Descriptor instead. +func (*UserCanAddOrganizationMemberRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{20} +} + +func (x *UserCanAddOrganizationMemberRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type UserCanAddOrganizationMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of roles that the user is authorized to add, empty list means the user is + // not authorized to add any members. + AuthorizedRoles []OrganizationRole `protobuf:"varint,1,rep,packed,name=authorized_roles,json=authorizedRoles,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"authorized_roles,omitempty"` +} + +func (x *UserCanAddOrganizationMemberResponse) Reset() { + *x = UserCanAddOrganizationMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanAddOrganizationMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanAddOrganizationMemberResponse) ProtoMessage() {} + +func (x *UserCanAddOrganizationMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanAddOrganizationMemberResponse.ProtoReflect.Descriptor instead. +func (*UserCanAddOrganizationMemberResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{21} +} + +func (x *UserCanAddOrganizationMemberResponse) GetAuthorizedRoles() []OrganizationRole { + if x != nil { + return x.AuthorizedRoles + } + return nil +} + +type UserCanUpdateOrganizationMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // whether the user is authorized. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *UserCanUpdateOrganizationMemberRequest) Reset() { + *x = UserCanUpdateOrganizationMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanUpdateOrganizationMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanUpdateOrganizationMemberRequest) ProtoMessage() {} + +func (x *UserCanUpdateOrganizationMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanUpdateOrganizationMemberRequest.ProtoReflect.Descriptor instead. +func (*UserCanUpdateOrganizationMemberRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{22} +} + +func (x *UserCanUpdateOrganizationMemberRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type UserCanUpdateOrganizationMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of roles that the user is authorized to update (from and to), empty list means the user is + // not authorized to update any members' role. + AuthorizedRoles []OrganizationRole `protobuf:"varint,1,rep,packed,name=authorized_roles,json=authorizedRoles,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"authorized_roles,omitempty"` +} + +func (x *UserCanUpdateOrganizationMemberResponse) Reset() { + *x = UserCanUpdateOrganizationMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanUpdateOrganizationMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanUpdateOrganizationMemberResponse) ProtoMessage() {} + +func (x *UserCanUpdateOrganizationMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanUpdateOrganizationMemberResponse.ProtoReflect.Descriptor instead. +func (*UserCanUpdateOrganizationMemberResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{23} +} + +func (x *UserCanUpdateOrganizationMemberResponse) GetAuthorizedRoles() []OrganizationRole { + if x != nil { + return x.AuthorizedRoles + } + return nil +} + +type UserCanRemoveOrganizationMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // whether the user is authorized. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *UserCanRemoveOrganizationMemberRequest) Reset() { + *x = UserCanRemoveOrganizationMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanRemoveOrganizationMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanRemoveOrganizationMemberRequest) ProtoMessage() {} + +func (x *UserCanRemoveOrganizationMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanRemoveOrganizationMemberRequest.ProtoReflect.Descriptor instead. +func (*UserCanRemoveOrganizationMemberRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{24} +} + +func (x *UserCanRemoveOrganizationMemberRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type UserCanRemoveOrganizationMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of roles that the user is authorized to remove, empty list means the user is + // not authorized to remove any members. + AuthorizedRoles []OrganizationRole `protobuf:"varint,1,rep,packed,name=authorized_roles,json=authorizedRoles,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"authorized_roles,omitempty"` +} + +func (x *UserCanRemoveOrganizationMemberResponse) Reset() { + *x = UserCanRemoveOrganizationMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanRemoveOrganizationMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanRemoveOrganizationMemberResponse) ProtoMessage() {} + +func (x *UserCanRemoveOrganizationMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanRemoveOrganizationMemberResponse.ProtoReflect.Descriptor instead. +func (*UserCanRemoveOrganizationMemberResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{25} +} + +func (x *UserCanRemoveOrganizationMemberResponse) GetAuthorizedRoles() []OrganizationRole { + if x != nil { + return x.AuthorizedRoles + } + return nil +} + +type UserCanDeleteOrganizationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // whether the user is authorized. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *UserCanDeleteOrganizationRequest) Reset() { + *x = UserCanDeleteOrganizationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeleteOrganizationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeleteOrganizationRequest) ProtoMessage() {} + +func (x *UserCanDeleteOrganizationRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeleteOrganizationRequest.ProtoReflect.Descriptor instead. +func (*UserCanDeleteOrganizationRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{26} +} + +func (x *UserCanDeleteOrganizationRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type UserCanDeleteOrganizationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanDeleteOrganizationResponse) Reset() { + *x = UserCanDeleteOrganizationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeleteOrganizationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeleteOrganizationResponse) ProtoMessage() {} + +func (x *UserCanDeleteOrganizationResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeleteOrganizationResponse.ProtoReflect.Descriptor instead. +func (*UserCanDeleteOrganizationResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{27} +} + +func (x *UserCanDeleteOrganizationResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +type UserCanDeleteRepositoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to check + // whether the user is authorized. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` +} + +func (x *UserCanDeleteRepositoryRequest) Reset() { + *x = UserCanDeleteRepositoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeleteRepositoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeleteRepositoryRequest) ProtoMessage() {} + +func (x *UserCanDeleteRepositoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeleteRepositoryRequest.ProtoReflect.Descriptor instead. +func (*UserCanDeleteRepositoryRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{28} +} + +func (x *UserCanDeleteRepositoryRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +type UserCanDeleteRepositoryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanDeleteRepositoryResponse) Reset() { + *x = UserCanDeleteRepositoryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeleteRepositoryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeleteRepositoryResponse) ProtoMessage() {} + +func (x *UserCanDeleteRepositoryResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeleteRepositoryResponse.ProtoReflect.Descriptor instead. +func (*UserCanDeleteRepositoryResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{29} +} + +func (x *UserCanDeleteRepositoryResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanDeleteTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the template for which to check + // whether the user is authorized. + TemplateId string `protobuf:"bytes,1,opt,name=template_id,json=templateId,proto3" json:"template_id,omitempty"` +} + +func (x *UserCanDeleteTemplateRequest) Reset() { + *x = UserCanDeleteTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeleteTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeleteTemplateRequest) ProtoMessage() {} + +func (x *UserCanDeleteTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeleteTemplateRequest.ProtoReflect.Descriptor instead. +func (*UserCanDeleteTemplateRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{30} +} + +func (x *UserCanDeleteTemplateRequest) GetTemplateId() string { + if x != nil { + return x.TemplateId + } + return "" +} + +// Deprecated: Do not use. +type UserCanDeleteTemplateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanDeleteTemplateResponse) Reset() { + *x = UserCanDeleteTemplateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeleteTemplateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeleteTemplateResponse) ProtoMessage() {} + +func (x *UserCanDeleteTemplateResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeleteTemplateResponse.ProtoReflect.Descriptor instead. +func (*UserCanDeleteTemplateResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{31} +} + +func (x *UserCanDeleteTemplateResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +// Deprecated: Do not use. +type UserCanDeletePluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the plugin for which to check + // whether the user is authorized. + PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` +} + +func (x *UserCanDeletePluginRequest) Reset() { + *x = UserCanDeletePluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeletePluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeletePluginRequest) ProtoMessage() {} + +func (x *UserCanDeletePluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeletePluginRequest.ProtoReflect.Descriptor instead. +func (*UserCanDeletePluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{32} +} + +func (x *UserCanDeletePluginRequest) GetPluginId() string { + if x != nil { + return x.PluginId + } + return "" +} + +// Deprecated: Do not use. +type UserCanDeletePluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanDeletePluginResponse) Reset() { + *x = UserCanDeletePluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeletePluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeletePluginResponse) ProtoMessage() {} + +func (x *UserCanDeletePluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeletePluginResponse.ProtoReflect.Descriptor instead. +func (*UserCanDeletePluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{33} +} + +func (x *UserCanDeletePluginResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +type UserCanDeleteUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UserCanDeleteUserRequest) Reset() { + *x = UserCanDeleteUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeleteUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeleteUserRequest) ProtoMessage() {} + +func (x *UserCanDeleteUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeleteUserRequest.ProtoReflect.Descriptor instead. +func (*UserCanDeleteUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{34} +} + +type UserCanDeleteUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanDeleteUserResponse) Reset() { + *x = UserCanDeleteUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanDeleteUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanDeleteUserResponse) ProtoMessage() {} + +func (x *UserCanDeleteUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanDeleteUserResponse.ProtoReflect.Descriptor instead. +func (*UserCanDeleteUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{35} +} + +func (x *UserCanDeleteUserResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +type UserCanSeeServerAdminPanelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UserCanSeeServerAdminPanelRequest) Reset() { + *x = UserCanSeeServerAdminPanelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeeServerAdminPanelRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeeServerAdminPanelRequest) ProtoMessage() {} + +func (x *UserCanSeeServerAdminPanelRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeeServerAdminPanelRequest.ProtoReflect.Descriptor instead. +func (*UserCanSeeServerAdminPanelRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{36} +} + +type UserCanSeeServerAdminPanelResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` +} + +func (x *UserCanSeeServerAdminPanelResponse) Reset() { + *x = UserCanSeeServerAdminPanelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanSeeServerAdminPanelResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanSeeServerAdminPanelResponse) ProtoMessage() {} + +func (x *UserCanSeeServerAdminPanelResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[37] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanSeeServerAdminPanelResponse.ProtoReflect.Descriptor instead. +func (*UserCanSeeServerAdminPanelResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{37} +} + +func (x *UserCanSeeServerAdminPanelResponse) GetAuthorized() bool { + if x != nil { + return x.Authorized + } + return false +} + +type UserCanManageRepositoryContributorsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to check + // whether the user is authorized. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` +} + +func (x *UserCanManageRepositoryContributorsRequest) Reset() { + *x = UserCanManageRepositoryContributorsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanManageRepositoryContributorsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanManageRepositoryContributorsRequest) ProtoMessage() {} + +func (x *UserCanManageRepositoryContributorsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanManageRepositoryContributorsRequest.ProtoReflect.Descriptor instead. +func (*UserCanManageRepositoryContributorsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{38} +} + +func (x *UserCanManageRepositoryContributorsRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +type UserCanManageRepositoryContributorsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of roles that the user is authorized to manage, empty list means the user is + // not authorized to manage any contributors. + AuthorizedRoles []RepositoryRole `protobuf:"varint,1,rep,packed,name=authorized_roles,json=authorizedRoles,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"authorized_roles,omitempty"` +} + +func (x *UserCanManageRepositoryContributorsResponse) Reset() { + *x = UserCanManageRepositoryContributorsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCanManageRepositoryContributorsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCanManageRepositoryContributorsResponse) ProtoMessage() {} + +func (x *UserCanManageRepositoryContributorsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_authz_proto_msgTypes[39] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCanManageRepositoryContributorsResponse.ProtoReflect.Descriptor instead. +func (*UserCanManageRepositoryContributorsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_authz_proto_rawDescGZIP(), []int{39} +} + +func (x *UserCanManageRepositoryContributorsResponse) GetAuthorizedRoles() []RepositoryRole { + if x != nil { + return x.AuthorizedRoles + } + return nil +} + +var File_registry_v1alpha1_authz_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_authz_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1c, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x6f, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x55, 0x0a, 0x2a, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, + 0x4d, 0x0a, 0x2b, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x4a, + 0x0a, 0x23, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x22, 0x46, 0x0a, 0x24, 0x55, 0x73, + 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x64, 0x22, 0x50, 0x0a, 0x25, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x48, 0x0a, 0x26, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, + 0x65, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x48, + 0x0a, 0x18, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x61, 0x64, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x3f, 0x0a, 0x19, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x52, 0x65, 0x61, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x51, 0x0a, 0x21, 0x55, 0x73, 0x65, + 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x48, 0x0a, 0x22, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x53, 0x0a, 0x23, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, + 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x4a, 0x0a, 0x24, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x55, 0x0a, 0x26, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x4d, + 0x0a, 0x27, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x57, 0x0a, + 0x28, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x4f, 0x0a, 0x29, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, + 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x4f, 0x0a, 0x1f, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x61, 0x6e, 0x53, 0x65, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x46, 0x0a, 0x20, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, + 0x22, 0x51, 0x0a, 0x21, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, + 0x02, 0x18, 0x01, 0x22, 0x48, 0x0a, 0x22, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, + 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x4e, 0x0a, + 0x23, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x8e, 0x01, + 0x0a, 0x24, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, + 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x0f, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x51, + 0x0a, 0x26, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x22, 0x91, 0x01, 0x0a, 0x27, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, + 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x6c, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, + 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x51, 0x0a, 0x26, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x91, 0x01, 0x0a, 0x27, 0x55, 0x73, 0x65, + 0x72, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x3b, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x0f, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x4b, 0x0a, 0x20, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x21, 0x55, 0x73, 0x65, + 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x45, + 0x0a, 0x1e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x49, 0x64, 0x22, 0x41, 0x0a, 0x1f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x43, 0x0a, 0x1c, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x49, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x43, 0x0a, + 0x1d, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x3a, 0x02, + 0x18, 0x01, 0x22, 0x3d, 0x0a, 0x1a, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x3a, 0x02, 0x18, + 0x01, 0x22, 0x41, 0x0a, 0x1b, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, + 0x3a, 0x02, 0x18, 0x01, 0x22, 0x1a, 0x0a, 0x18, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x3b, 0x0a, 0x19, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, + 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x23, 0x0a, + 0x21, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x44, 0x0a, 0x22, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x61, 0x6e, 0x65, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x51, 0x0a, 0x2a, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x22, 0x93, 0x01, 0x0a, 0x2b, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x10, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, + 0x52, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x52, 0x6f, 0x6c, 0x65, + 0x73, 0x32, 0xe7, 0x1e, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0xd9, 0x01, 0x0a, 0x23, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x55, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x56, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xc4, + 0x01, 0x0a, 0x1c, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, + 0x4e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x4f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xca, 0x01, 0x0a, 0x1e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, + 0x6e, 0x53, 0x65, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x50, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x51, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, + 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0xa6, 0x01, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x52, 0x65, + 0x61, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x61, 0x64, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x44, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, + 0x6e, 0x52, 0x65, 0x61, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x06, 0x88, 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, 0xc1, 0x01, 0x0a, 0x1a, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0x88, 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, + 0xc7, 0x01, 0x0a, 0x1c, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x4e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x4f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x06, 0x88, 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, 0xd0, 0x01, 0x0a, 0x1f, 0x55, 0x73, + 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x51, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, + 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x52, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0x88, 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, 0xd6, 0x01, 0x0a, + 0x21, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x12, 0x53, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x54, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0x88, + 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, 0xbb, 0x01, 0x0a, 0x18, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, + 0x6e, 0x53, 0x65, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x73, 0x12, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4b, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x61, 0x6e, 0x53, 0x65, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0x88, 0x02, 0x01, + 0x90, 0x02, 0x01, 0x12, 0xc1, 0x01, 0x0a, 0x1a, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, + 0x65, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x73, 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x06, 0x88, 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, 0xc4, 0x01, 0x0a, 0x1c, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x4e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x64, 0x64, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x64, 0x64, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xcd, + 0x01, 0x0a, 0x1f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x51, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x52, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xcd, + 0x01, 0x0a, 0x1f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x51, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x52, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xbb, + 0x01, 0x0a, 0x19, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4b, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb5, 0x01, 0x0a, + 0x17, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x03, 0x90, 0x02, 0x01, 0x12, 0xb2, 0x01, 0x0a, 0x15, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x47, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x06, 0x88, 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, 0xac, 0x01, 0x0a, 0x13, 0x55, 0x73, + 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x06, 0x88, 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, 0xa3, 0x01, 0x0a, 0x11, 0x55, 0x73, 0x65, + 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x43, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xbe, + 0x01, 0x0a, 0x1a, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, 0x65, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x12, 0x4c, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, + 0x6e, 0x53, 0x65, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x50, + 0x61, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x53, + 0x65, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x61, 0x6e, + 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, + 0xd9, 0x01, 0x0a, 0x23, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x55, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x56, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x61, 0x6e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe5, 0x02, 0x0a, 0x2d, + 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0a, 0x41, + 0x75, 0x74, 0x68, 0x7a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, + 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, + 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, + 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_authz_proto_rawDescOnce sync.Once + file_registry_v1alpha1_authz_proto_rawDescData = file_registry_v1alpha1_authz_proto_rawDesc +) + +func file_registry_v1alpha1_authz_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_authz_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_authz_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_authz_proto_rawDescData) + }) + return file_registry_v1alpha1_authz_proto_rawDescData +} + +var file_registry_v1alpha1_authz_proto_msgTypes = make([]protoimpl.MessageInfo, 40) +var file_registry_v1alpha1_authz_proto_goTypes = []interface{}{ + (*UserCanCreateOrganizationRepositoryRequest)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationRepositoryRequest + (*UserCanCreateOrganizationRepositoryResponse)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationRepositoryResponse + (*UserCanSeeRepositorySettingsRequest)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeRepositorySettingsRequest + (*UserCanSeeRepositorySettingsResponse)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeRepositorySettingsResponse + (*UserCanSeeOrganizationSettingsRequest)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeOrganizationSettingsRequest + (*UserCanSeeOrganizationSettingsResponse)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeOrganizationSettingsResponse + (*UserCanReadPluginRequest)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.UserCanReadPluginRequest + (*UserCanReadPluginResponse)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.UserCanReadPluginResponse + (*UserCanCreatePluginVersionRequest)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreatePluginVersionRequest + (*UserCanCreatePluginVersionResponse)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreatePluginVersionResponse + (*UserCanCreateTemplateVersionRequest)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateTemplateVersionRequest + (*UserCanCreateTemplateVersionResponse)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateTemplateVersionResponse + (*UserCanCreateOrganizationPluginRequest)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationPluginRequest + (*UserCanCreateOrganizationPluginResponse)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationPluginResponse + (*UserCanCreateOrganizationTemplateRequest)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationTemplateRequest + (*UserCanCreateOrganizationTemplateResponse)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationTemplateResponse + (*UserCanSeePluginSettingsRequest)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeePluginSettingsRequest + (*UserCanSeePluginSettingsResponse)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeePluginSettingsResponse + (*UserCanSeeTemplateSettingsRequest)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeTemplateSettingsRequest + (*UserCanSeeTemplateSettingsResponse)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeTemplateSettingsResponse + (*UserCanAddOrganizationMemberRequest)(nil), // 20: bufman.dubbo.apache.org.registry.v1alpha1.UserCanAddOrganizationMemberRequest + (*UserCanAddOrganizationMemberResponse)(nil), // 21: bufman.dubbo.apache.org.registry.v1alpha1.UserCanAddOrganizationMemberResponse + (*UserCanUpdateOrganizationMemberRequest)(nil), // 22: bufman.dubbo.apache.org.registry.v1alpha1.UserCanUpdateOrganizationMemberRequest + (*UserCanUpdateOrganizationMemberResponse)(nil), // 23: bufman.dubbo.apache.org.registry.v1alpha1.UserCanUpdateOrganizationMemberResponse + (*UserCanRemoveOrganizationMemberRequest)(nil), // 24: bufman.dubbo.apache.org.registry.v1alpha1.UserCanRemoveOrganizationMemberRequest + (*UserCanRemoveOrganizationMemberResponse)(nil), // 25: bufman.dubbo.apache.org.registry.v1alpha1.UserCanRemoveOrganizationMemberResponse + (*UserCanDeleteOrganizationRequest)(nil), // 26: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteOrganizationRequest + (*UserCanDeleteOrganizationResponse)(nil), // 27: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteOrganizationResponse + (*UserCanDeleteRepositoryRequest)(nil), // 28: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteRepositoryRequest + (*UserCanDeleteRepositoryResponse)(nil), // 29: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteRepositoryResponse + (*UserCanDeleteTemplateRequest)(nil), // 30: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteTemplateRequest + (*UserCanDeleteTemplateResponse)(nil), // 31: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteTemplateResponse + (*UserCanDeletePluginRequest)(nil), // 32: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeletePluginRequest + (*UserCanDeletePluginResponse)(nil), // 33: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeletePluginResponse + (*UserCanDeleteUserRequest)(nil), // 34: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteUserRequest + (*UserCanDeleteUserResponse)(nil), // 35: bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteUserResponse + (*UserCanSeeServerAdminPanelRequest)(nil), // 36: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeServerAdminPanelRequest + (*UserCanSeeServerAdminPanelResponse)(nil), // 37: bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeServerAdminPanelResponse + (*UserCanManageRepositoryContributorsRequest)(nil), // 38: bufman.dubbo.apache.org.registry.v1alpha1.UserCanManageRepositoryContributorsRequest + (*UserCanManageRepositoryContributorsResponse)(nil), // 39: bufman.dubbo.apache.org.registry.v1alpha1.UserCanManageRepositoryContributorsResponse + (OrganizationRole)(0), // 40: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + (RepositoryRole)(0), // 41: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole +} +var file_registry_v1alpha1_authz_proto_depIdxs = []int32{ + 40, // 0: bufman.dubbo.apache.org.registry.v1alpha1.UserCanAddOrganizationMemberResponse.authorized_roles:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 40, // 1: bufman.dubbo.apache.org.registry.v1alpha1.UserCanUpdateOrganizationMemberResponse.authorized_roles:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 40, // 2: bufman.dubbo.apache.org.registry.v1alpha1.UserCanRemoveOrganizationMemberResponse.authorized_roles:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 41, // 3: bufman.dubbo.apache.org.registry.v1alpha1.UserCanManageRepositoryContributorsResponse.authorized_roles:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 0, // 4: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationRepository:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationRepositoryRequest + 2, // 5: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeRepositorySettings:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeRepositorySettingsRequest + 4, // 6: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeOrganizationSettings:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeOrganizationSettingsRequest + 6, // 7: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanReadPlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanReadPluginRequest + 8, // 8: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreatePluginVersion:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreatePluginVersionRequest + 10, // 9: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateTemplateVersion:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateTemplateVersionRequest + 12, // 10: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationPlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationPluginRequest + 14, // 11: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationTemplate:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationTemplateRequest + 16, // 12: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeePluginSettings:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeePluginSettingsRequest + 18, // 13: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeTemplateSettings:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeTemplateSettingsRequest + 20, // 14: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanAddOrganizationMember:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanAddOrganizationMemberRequest + 22, // 15: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanUpdateOrganizationMember:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanUpdateOrganizationMemberRequest + 24, // 16: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanRemoveOrganizationMember:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanRemoveOrganizationMemberRequest + 26, // 17: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteOrganization:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteOrganizationRequest + 28, // 18: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteRepository:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteRepositoryRequest + 30, // 19: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteTemplate:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteTemplateRequest + 32, // 20: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeletePlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeletePluginRequest + 34, // 21: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteUserRequest + 36, // 22: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeServerAdminPanel:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeServerAdminPanelRequest + 38, // 23: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanManageRepositoryContributors:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanManageRepositoryContributorsRequest + 1, // 24: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationRepository:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationRepositoryResponse + 3, // 25: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeRepositorySettings:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeRepositorySettingsResponse + 5, // 26: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeOrganizationSettings:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeOrganizationSettingsResponse + 7, // 27: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanReadPlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanReadPluginResponse + 9, // 28: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreatePluginVersion:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreatePluginVersionResponse + 11, // 29: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateTemplateVersion:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateTemplateVersionResponse + 13, // 30: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationPlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationPluginResponse + 15, // 31: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanCreateOrganizationTemplate:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanCreateOrganizationTemplateResponse + 17, // 32: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeePluginSettings:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeePluginSettingsResponse + 19, // 33: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeTemplateSettings:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeTemplateSettingsResponse + 21, // 34: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanAddOrganizationMember:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanAddOrganizationMemberResponse + 23, // 35: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanUpdateOrganizationMember:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanUpdateOrganizationMemberResponse + 25, // 36: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanRemoveOrganizationMember:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanRemoveOrganizationMemberResponse + 27, // 37: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteOrganization:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteOrganizationResponse + 29, // 38: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteRepository:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteRepositoryResponse + 31, // 39: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteTemplate:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteTemplateResponse + 33, // 40: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeletePlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeletePluginResponse + 35, // 41: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanDeleteUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanDeleteUserResponse + 37, // 42: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanSeeServerAdminPanel:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanSeeServerAdminPanelResponse + 39, // 43: bufman.dubbo.apache.org.registry.v1alpha1.AuthzService.UserCanManageRepositoryContributors:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UserCanManageRepositoryContributorsResponse + 24, // [24:44] is the sub-list for method output_type + 4, // [4:24] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_authz_proto_init() } +func file_registry_v1alpha1_authz_proto_init() { + if File_registry_v1alpha1_authz_proto != nil { + return + } + file_registry_v1alpha1_role_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_authz_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreateOrganizationRepositoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreateOrganizationRepositoryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeeRepositorySettingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeeRepositorySettingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeeOrganizationSettingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeeOrganizationSettingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanReadPluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanReadPluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreatePluginVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreatePluginVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreateTemplateVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreateTemplateVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreateOrganizationPluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreateOrganizationPluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreateOrganizationTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanCreateOrganizationTemplateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeePluginSettingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeePluginSettingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeeTemplateSettingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeeTemplateSettingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanAddOrganizationMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanAddOrganizationMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanUpdateOrganizationMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanUpdateOrganizationMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanRemoveOrganizationMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanRemoveOrganizationMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeleteOrganizationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeleteOrganizationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeleteRepositoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeleteRepositoryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeleteTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeleteTemplateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeletePluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeletePluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeleteUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanDeleteUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeeServerAdminPanelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanSeeServerAdminPanelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanManageRepositoryContributorsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_authz_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserCanManageRepositoryContributorsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_authz_proto_rawDesc, + NumEnums: 0, + NumMessages: 40, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_authz_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_authz_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_authz_proto_msgTypes, + }.Build() + File_registry_v1alpha1_authz_proto = out.File + file_registry_v1alpha1_authz_proto_rawDesc = nil + file_registry_v1alpha1_authz_proto_goTypes = nil + file_registry_v1alpha1_authz_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/authz_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/authz_grpc.pb.go new file mode 100644 index 000000000..d7b1b46c1 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/authz_grpc.pb.go @@ -0,0 +1,917 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/authz.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + AuthzService_UserCanCreateOrganizationRepository_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationRepository" + AuthzService_UserCanSeeRepositorySettings_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeRepositorySettings" + AuthzService_UserCanSeeOrganizationSettings_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeOrganizationSettings" + AuthzService_UserCanReadPlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanReadPlugin" + AuthzService_UserCanCreatePluginVersion_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreatePluginVersion" + AuthzService_UserCanCreateTemplateVersion_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateTemplateVersion" + AuthzService_UserCanCreateOrganizationPlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationPlugin" + AuthzService_UserCanCreateOrganizationTemplate_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanCreateOrganizationTemplate" + AuthzService_UserCanSeePluginSettings_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeePluginSettings" + AuthzService_UserCanSeeTemplateSettings_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeTemplateSettings" + AuthzService_UserCanAddOrganizationMember_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanAddOrganizationMember" + AuthzService_UserCanUpdateOrganizationMember_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanUpdateOrganizationMember" + AuthzService_UserCanRemoveOrganizationMember_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanRemoveOrganizationMember" + AuthzService_UserCanDeleteOrganization_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteOrganization" + AuthzService_UserCanDeleteRepository_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteRepository" + AuthzService_UserCanDeleteTemplate_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteTemplate" + AuthzService_UserCanDeletePlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeletePlugin" + AuthzService_UserCanDeleteUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanDeleteUser" + AuthzService_UserCanSeeServerAdminPanel_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanSeeServerAdminPanel" + AuthzService_UserCanManageRepositoryContributors_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.AuthzService/UserCanManageRepositoryContributors" +) + +// AuthzServiceClient is the client API for AuthzService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AuthzServiceClient interface { + // UserCanCreateOrganizationRepository returns whether the user is authorized + // to create repositories in an organization. + UserCanCreateOrganizationRepository(ctx context.Context, in *UserCanCreateOrganizationRepositoryRequest, opts ...grpc.CallOption) (*UserCanCreateOrganizationRepositoryResponse, error) + // UserCanSeeRepositorySettings returns whether the user is authorized + // to see repository settings. + UserCanSeeRepositorySettings(ctx context.Context, in *UserCanSeeRepositorySettingsRequest, opts ...grpc.CallOption) (*UserCanSeeRepositorySettingsResponse, error) + // UserCanSeeOrganizationSettings returns whether the user is authorized + // to see organization settings. + UserCanSeeOrganizationSettings(ctx context.Context, in *UserCanSeeOrganizationSettingsRequest, opts ...grpc.CallOption) (*UserCanSeeOrganizationSettingsResponse, error) + // Deprecated: Do not use. + // UserCanReadPlugin returns whether the user has read access to the specified plugin. + UserCanReadPlugin(ctx context.Context, in *UserCanReadPluginRequest, opts ...grpc.CallOption) (*UserCanReadPluginResponse, error) + // Deprecated: Do not use. + // UserCanCreatePluginVersion returns whether the user is authorized + // to create a plugin version under the specified plugin. + UserCanCreatePluginVersion(ctx context.Context, in *UserCanCreatePluginVersionRequest, opts ...grpc.CallOption) (*UserCanCreatePluginVersionResponse, error) + // Deprecated: Do not use. + // UserCanCreateTemplateVersion returns whether the user is authorized + // to create a template version under the specified template. + UserCanCreateTemplateVersion(ctx context.Context, in *UserCanCreateTemplateVersionRequest, opts ...grpc.CallOption) (*UserCanCreateTemplateVersionResponse, error) + // Deprecated: Do not use. + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a plugin in an organization. + UserCanCreateOrganizationPlugin(ctx context.Context, in *UserCanCreateOrganizationPluginRequest, opts ...grpc.CallOption) (*UserCanCreateOrganizationPluginResponse, error) + // Deprecated: Do not use. + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a template in an organization. + UserCanCreateOrganizationTemplate(ctx context.Context, in *UserCanCreateOrganizationTemplateRequest, opts ...grpc.CallOption) (*UserCanCreateOrganizationTemplateResponse, error) + // Deprecated: Do not use. + // UserCanSeePluginSettings returns whether the user is authorized + // to see plugin settings. + UserCanSeePluginSettings(ctx context.Context, in *UserCanSeePluginSettingsRequest, opts ...grpc.CallOption) (*UserCanSeePluginSettingsResponse, error) + // Deprecated: Do not use. + // UserCanSeeTemplateSettings returns whether the user is authorized + // to see template settings. + UserCanSeeTemplateSettings(ctx context.Context, in *UserCanSeeTemplateSettingsRequest, opts ...grpc.CallOption) (*UserCanSeeTemplateSettingsResponse, error) + // UserCanAddOrganizationMember returns whether the user is authorized to add + // any members to the organization and the list of roles they can add. + UserCanAddOrganizationMember(ctx context.Context, in *UserCanAddOrganizationMemberRequest, opts ...grpc.CallOption) (*UserCanAddOrganizationMemberResponse, error) + // UserCanUpdateOrganizationMember returns whether the user is authorized to update + // any members' membership information in the organization and the list of roles they can update. + UserCanUpdateOrganizationMember(ctx context.Context, in *UserCanUpdateOrganizationMemberRequest, opts ...grpc.CallOption) (*UserCanUpdateOrganizationMemberResponse, error) + // UserCanRemoveOrganizationMember returns whether the user is authorized to remove + // any members from the organization and the list of roles they can remove. + UserCanRemoveOrganizationMember(ctx context.Context, in *UserCanRemoveOrganizationMemberRequest, opts ...grpc.CallOption) (*UserCanRemoveOrganizationMemberResponse, error) + // UserCanDeleteOrganization returns whether the user is authorized + // to delete an organization. + UserCanDeleteOrganization(ctx context.Context, in *UserCanDeleteOrganizationRequest, opts ...grpc.CallOption) (*UserCanDeleteOrganizationResponse, error) + // UserCanDeleteRepository returns whether the user is authorized + // to delete a repository. + UserCanDeleteRepository(ctx context.Context, in *UserCanDeleteRepositoryRequest, opts ...grpc.CallOption) (*UserCanDeleteRepositoryResponse, error) + // Deprecated: Do not use. + // UserCanDeleteTemplate returns whether the user is authorized + // to delete a template. + UserCanDeleteTemplate(ctx context.Context, in *UserCanDeleteTemplateRequest, opts ...grpc.CallOption) (*UserCanDeleteTemplateResponse, error) + // Deprecated: Do not use. + // UserCanDeletePlugin returns whether the user is authorized + // to delete a plugin. + UserCanDeletePlugin(ctx context.Context, in *UserCanDeletePluginRequest, opts ...grpc.CallOption) (*UserCanDeletePluginResponse, error) + // UserCanDeleteUser returns whether the user is authorized + // to delete a user. + UserCanDeleteUser(ctx context.Context, in *UserCanDeleteUserRequest, opts ...grpc.CallOption) (*UserCanDeleteUserResponse, error) + // UserCanSeeServerAdminPanel returns whether the user is authorized + // to see server admin panel. + UserCanSeeServerAdminPanel(ctx context.Context, in *UserCanSeeServerAdminPanelRequest, opts ...grpc.CallOption) (*UserCanSeeServerAdminPanelResponse, error) + // UserCanManageRepositoryContributors returns whether the user is authorized to manage + // any contributors to the repository and the list of roles they can manage. + UserCanManageRepositoryContributors(ctx context.Context, in *UserCanManageRepositoryContributorsRequest, opts ...grpc.CallOption) (*UserCanManageRepositoryContributorsResponse, error) +} + +type authzServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAuthzServiceClient(cc grpc.ClientConnInterface) AuthzServiceClient { + return &authzServiceClient{cc} +} + +func (c *authzServiceClient) UserCanCreateOrganizationRepository(ctx context.Context, in *UserCanCreateOrganizationRepositoryRequest, opts ...grpc.CallOption) (*UserCanCreateOrganizationRepositoryResponse, error) { + out := new(UserCanCreateOrganizationRepositoryResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanCreateOrganizationRepository_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanSeeRepositorySettings(ctx context.Context, in *UserCanSeeRepositorySettingsRequest, opts ...grpc.CallOption) (*UserCanSeeRepositorySettingsResponse, error) { + out := new(UserCanSeeRepositorySettingsResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanSeeRepositorySettings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanSeeOrganizationSettings(ctx context.Context, in *UserCanSeeOrganizationSettingsRequest, opts ...grpc.CallOption) (*UserCanSeeOrganizationSettingsResponse, error) { + out := new(UserCanSeeOrganizationSettingsResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanSeeOrganizationSettings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanReadPlugin(ctx context.Context, in *UserCanReadPluginRequest, opts ...grpc.CallOption) (*UserCanReadPluginResponse, error) { + out := new(UserCanReadPluginResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanReadPlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanCreatePluginVersion(ctx context.Context, in *UserCanCreatePluginVersionRequest, opts ...grpc.CallOption) (*UserCanCreatePluginVersionResponse, error) { + out := new(UserCanCreatePluginVersionResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanCreatePluginVersion_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanCreateTemplateVersion(ctx context.Context, in *UserCanCreateTemplateVersionRequest, opts ...grpc.CallOption) (*UserCanCreateTemplateVersionResponse, error) { + out := new(UserCanCreateTemplateVersionResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanCreateTemplateVersion_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanCreateOrganizationPlugin(ctx context.Context, in *UserCanCreateOrganizationPluginRequest, opts ...grpc.CallOption) (*UserCanCreateOrganizationPluginResponse, error) { + out := new(UserCanCreateOrganizationPluginResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanCreateOrganizationPlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanCreateOrganizationTemplate(ctx context.Context, in *UserCanCreateOrganizationTemplateRequest, opts ...grpc.CallOption) (*UserCanCreateOrganizationTemplateResponse, error) { + out := new(UserCanCreateOrganizationTemplateResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanCreateOrganizationTemplate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanSeePluginSettings(ctx context.Context, in *UserCanSeePluginSettingsRequest, opts ...grpc.CallOption) (*UserCanSeePluginSettingsResponse, error) { + out := new(UserCanSeePluginSettingsResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanSeePluginSettings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanSeeTemplateSettings(ctx context.Context, in *UserCanSeeTemplateSettingsRequest, opts ...grpc.CallOption) (*UserCanSeeTemplateSettingsResponse, error) { + out := new(UserCanSeeTemplateSettingsResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanSeeTemplateSettings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanAddOrganizationMember(ctx context.Context, in *UserCanAddOrganizationMemberRequest, opts ...grpc.CallOption) (*UserCanAddOrganizationMemberResponse, error) { + out := new(UserCanAddOrganizationMemberResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanAddOrganizationMember_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanUpdateOrganizationMember(ctx context.Context, in *UserCanUpdateOrganizationMemberRequest, opts ...grpc.CallOption) (*UserCanUpdateOrganizationMemberResponse, error) { + out := new(UserCanUpdateOrganizationMemberResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanUpdateOrganizationMember_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanRemoveOrganizationMember(ctx context.Context, in *UserCanRemoveOrganizationMemberRequest, opts ...grpc.CallOption) (*UserCanRemoveOrganizationMemberResponse, error) { + out := new(UserCanRemoveOrganizationMemberResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanRemoveOrganizationMember_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanDeleteOrganization(ctx context.Context, in *UserCanDeleteOrganizationRequest, opts ...grpc.CallOption) (*UserCanDeleteOrganizationResponse, error) { + out := new(UserCanDeleteOrganizationResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanDeleteOrganization_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanDeleteRepository(ctx context.Context, in *UserCanDeleteRepositoryRequest, opts ...grpc.CallOption) (*UserCanDeleteRepositoryResponse, error) { + out := new(UserCanDeleteRepositoryResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanDeleteRepository_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanDeleteTemplate(ctx context.Context, in *UserCanDeleteTemplateRequest, opts ...grpc.CallOption) (*UserCanDeleteTemplateResponse, error) { + out := new(UserCanDeleteTemplateResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanDeleteTemplate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *authzServiceClient) UserCanDeletePlugin(ctx context.Context, in *UserCanDeletePluginRequest, opts ...grpc.CallOption) (*UserCanDeletePluginResponse, error) { + out := new(UserCanDeletePluginResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanDeletePlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanDeleteUser(ctx context.Context, in *UserCanDeleteUserRequest, opts ...grpc.CallOption) (*UserCanDeleteUserResponse, error) { + out := new(UserCanDeleteUserResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanDeleteUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanSeeServerAdminPanel(ctx context.Context, in *UserCanSeeServerAdminPanelRequest, opts ...grpc.CallOption) (*UserCanSeeServerAdminPanelResponse, error) { + out := new(UserCanSeeServerAdminPanelResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanSeeServerAdminPanel_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authzServiceClient) UserCanManageRepositoryContributors(ctx context.Context, in *UserCanManageRepositoryContributorsRequest, opts ...grpc.CallOption) (*UserCanManageRepositoryContributorsResponse, error) { + out := new(UserCanManageRepositoryContributorsResponse) + err := c.cc.Invoke(ctx, AuthzService_UserCanManageRepositoryContributors_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuthzServiceServer is the server API for AuthzService service. +// All implementations must embed UnimplementedAuthzServiceServer +// for forward compatibility +type AuthzServiceServer interface { + // UserCanCreateOrganizationRepository returns whether the user is authorized + // to create repositories in an organization. + UserCanCreateOrganizationRepository(context.Context, *UserCanCreateOrganizationRepositoryRequest) (*UserCanCreateOrganizationRepositoryResponse, error) + // UserCanSeeRepositorySettings returns whether the user is authorized + // to see repository settings. + UserCanSeeRepositorySettings(context.Context, *UserCanSeeRepositorySettingsRequest) (*UserCanSeeRepositorySettingsResponse, error) + // UserCanSeeOrganizationSettings returns whether the user is authorized + // to see organization settings. + UserCanSeeOrganizationSettings(context.Context, *UserCanSeeOrganizationSettingsRequest) (*UserCanSeeOrganizationSettingsResponse, error) + // Deprecated: Do not use. + // UserCanReadPlugin returns whether the user has read access to the specified plugin. + UserCanReadPlugin(context.Context, *UserCanReadPluginRequest) (*UserCanReadPluginResponse, error) + // Deprecated: Do not use. + // UserCanCreatePluginVersion returns whether the user is authorized + // to create a plugin version under the specified plugin. + UserCanCreatePluginVersion(context.Context, *UserCanCreatePluginVersionRequest) (*UserCanCreatePluginVersionResponse, error) + // Deprecated: Do not use. + // UserCanCreateTemplateVersion returns whether the user is authorized + // to create a template version under the specified template. + UserCanCreateTemplateVersion(context.Context, *UserCanCreateTemplateVersionRequest) (*UserCanCreateTemplateVersionResponse, error) + // Deprecated: Do not use. + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a plugin in an organization. + UserCanCreateOrganizationPlugin(context.Context, *UserCanCreateOrganizationPluginRequest) (*UserCanCreateOrganizationPluginResponse, error) + // Deprecated: Do not use. + // UserCanCreateOrganizationPlugin returns whether the user is authorized to create + // a template in an organization. + UserCanCreateOrganizationTemplate(context.Context, *UserCanCreateOrganizationTemplateRequest) (*UserCanCreateOrganizationTemplateResponse, error) + // Deprecated: Do not use. + // UserCanSeePluginSettings returns whether the user is authorized + // to see plugin settings. + UserCanSeePluginSettings(context.Context, *UserCanSeePluginSettingsRequest) (*UserCanSeePluginSettingsResponse, error) + // Deprecated: Do not use. + // UserCanSeeTemplateSettings returns whether the user is authorized + // to see template settings. + UserCanSeeTemplateSettings(context.Context, *UserCanSeeTemplateSettingsRequest) (*UserCanSeeTemplateSettingsResponse, error) + // UserCanAddOrganizationMember returns whether the user is authorized to add + // any members to the organization and the list of roles they can add. + UserCanAddOrganizationMember(context.Context, *UserCanAddOrganizationMemberRequest) (*UserCanAddOrganizationMemberResponse, error) + // UserCanUpdateOrganizationMember returns whether the user is authorized to update + // any members' membership information in the organization and the list of roles they can update. + UserCanUpdateOrganizationMember(context.Context, *UserCanUpdateOrganizationMemberRequest) (*UserCanUpdateOrganizationMemberResponse, error) + // UserCanRemoveOrganizationMember returns whether the user is authorized to remove + // any members from the organization and the list of roles they can remove. + UserCanRemoveOrganizationMember(context.Context, *UserCanRemoveOrganizationMemberRequest) (*UserCanRemoveOrganizationMemberResponse, error) + // UserCanDeleteOrganization returns whether the user is authorized + // to delete an organization. + UserCanDeleteOrganization(context.Context, *UserCanDeleteOrganizationRequest) (*UserCanDeleteOrganizationResponse, error) + // UserCanDeleteRepository returns whether the user is authorized + // to delete a repository. + UserCanDeleteRepository(context.Context, *UserCanDeleteRepositoryRequest) (*UserCanDeleteRepositoryResponse, error) + // Deprecated: Do not use. + // UserCanDeleteTemplate returns whether the user is authorized + // to delete a template. + UserCanDeleteTemplate(context.Context, *UserCanDeleteTemplateRequest) (*UserCanDeleteTemplateResponse, error) + // Deprecated: Do not use. + // UserCanDeletePlugin returns whether the user is authorized + // to delete a plugin. + UserCanDeletePlugin(context.Context, *UserCanDeletePluginRequest) (*UserCanDeletePluginResponse, error) + // UserCanDeleteUser returns whether the user is authorized + // to delete a user. + UserCanDeleteUser(context.Context, *UserCanDeleteUserRequest) (*UserCanDeleteUserResponse, error) + // UserCanSeeServerAdminPanel returns whether the user is authorized + // to see server admin panel. + UserCanSeeServerAdminPanel(context.Context, *UserCanSeeServerAdminPanelRequest) (*UserCanSeeServerAdminPanelResponse, error) + // UserCanManageRepositoryContributors returns whether the user is authorized to manage + // any contributors to the repository and the list of roles they can manage. + UserCanManageRepositoryContributors(context.Context, *UserCanManageRepositoryContributorsRequest) (*UserCanManageRepositoryContributorsResponse, error) + mustEmbedUnimplementedAuthzServiceServer() +} + +// UnimplementedAuthzServiceServer must be embedded to have forward compatible implementations. +type UnimplementedAuthzServiceServer struct { +} + +func (UnimplementedAuthzServiceServer) UserCanCreateOrganizationRepository(context.Context, *UserCanCreateOrganizationRepositoryRequest) (*UserCanCreateOrganizationRepositoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanCreateOrganizationRepository not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanSeeRepositorySettings(context.Context, *UserCanSeeRepositorySettingsRequest) (*UserCanSeeRepositorySettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanSeeRepositorySettings not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanSeeOrganizationSettings(context.Context, *UserCanSeeOrganizationSettingsRequest) (*UserCanSeeOrganizationSettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanSeeOrganizationSettings not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanReadPlugin(context.Context, *UserCanReadPluginRequest) (*UserCanReadPluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanReadPlugin not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanCreatePluginVersion(context.Context, *UserCanCreatePluginVersionRequest) (*UserCanCreatePluginVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanCreatePluginVersion not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanCreateTemplateVersion(context.Context, *UserCanCreateTemplateVersionRequest) (*UserCanCreateTemplateVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanCreateTemplateVersion not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanCreateOrganizationPlugin(context.Context, *UserCanCreateOrganizationPluginRequest) (*UserCanCreateOrganizationPluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanCreateOrganizationPlugin not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanCreateOrganizationTemplate(context.Context, *UserCanCreateOrganizationTemplateRequest) (*UserCanCreateOrganizationTemplateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanCreateOrganizationTemplate not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanSeePluginSettings(context.Context, *UserCanSeePluginSettingsRequest) (*UserCanSeePluginSettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanSeePluginSettings not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanSeeTemplateSettings(context.Context, *UserCanSeeTemplateSettingsRequest) (*UserCanSeeTemplateSettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanSeeTemplateSettings not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanAddOrganizationMember(context.Context, *UserCanAddOrganizationMemberRequest) (*UserCanAddOrganizationMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanAddOrganizationMember not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanUpdateOrganizationMember(context.Context, *UserCanUpdateOrganizationMemberRequest) (*UserCanUpdateOrganizationMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanUpdateOrganizationMember not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanRemoveOrganizationMember(context.Context, *UserCanRemoveOrganizationMemberRequest) (*UserCanRemoveOrganizationMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanRemoveOrganizationMember not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanDeleteOrganization(context.Context, *UserCanDeleteOrganizationRequest) (*UserCanDeleteOrganizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanDeleteOrganization not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanDeleteRepository(context.Context, *UserCanDeleteRepositoryRequest) (*UserCanDeleteRepositoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanDeleteRepository not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanDeleteTemplate(context.Context, *UserCanDeleteTemplateRequest) (*UserCanDeleteTemplateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanDeleteTemplate not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanDeletePlugin(context.Context, *UserCanDeletePluginRequest) (*UserCanDeletePluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanDeletePlugin not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanDeleteUser(context.Context, *UserCanDeleteUserRequest) (*UserCanDeleteUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanDeleteUser not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanSeeServerAdminPanel(context.Context, *UserCanSeeServerAdminPanelRequest) (*UserCanSeeServerAdminPanelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanSeeServerAdminPanel not implemented") +} +func (UnimplementedAuthzServiceServer) UserCanManageRepositoryContributors(context.Context, *UserCanManageRepositoryContributorsRequest) (*UserCanManageRepositoryContributorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserCanManageRepositoryContributors not implemented") +} +func (UnimplementedAuthzServiceServer) mustEmbedUnimplementedAuthzServiceServer() {} + +// UnsafeAuthzServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuthzServiceServer will +// result in compilation errors. +type UnsafeAuthzServiceServer interface { + mustEmbedUnimplementedAuthzServiceServer() +} + +func RegisterAuthzServiceServer(s grpc.ServiceRegistrar, srv AuthzServiceServer) { + s.RegisterService(&AuthzService_ServiceDesc, srv) +} + +func _AuthzService_UserCanCreateOrganizationRepository_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanCreateOrganizationRepositoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanCreateOrganizationRepository(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanCreateOrganizationRepository_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanCreateOrganizationRepository(ctx, req.(*UserCanCreateOrganizationRepositoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanSeeRepositorySettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanSeeRepositorySettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanSeeRepositorySettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanSeeRepositorySettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanSeeRepositorySettings(ctx, req.(*UserCanSeeRepositorySettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanSeeOrganizationSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanSeeOrganizationSettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanSeeOrganizationSettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanSeeOrganizationSettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanSeeOrganizationSettings(ctx, req.(*UserCanSeeOrganizationSettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanReadPlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanReadPluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanReadPlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanReadPlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanReadPlugin(ctx, req.(*UserCanReadPluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanCreatePluginVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanCreatePluginVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanCreatePluginVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanCreatePluginVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanCreatePluginVersion(ctx, req.(*UserCanCreatePluginVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanCreateTemplateVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanCreateTemplateVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanCreateTemplateVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanCreateTemplateVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanCreateTemplateVersion(ctx, req.(*UserCanCreateTemplateVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanCreateOrganizationPlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanCreateOrganizationPluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanCreateOrganizationPlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanCreateOrganizationPlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanCreateOrganizationPlugin(ctx, req.(*UserCanCreateOrganizationPluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanCreateOrganizationTemplate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanCreateOrganizationTemplateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanCreateOrganizationTemplate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanCreateOrganizationTemplate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanCreateOrganizationTemplate(ctx, req.(*UserCanCreateOrganizationTemplateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanSeePluginSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanSeePluginSettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanSeePluginSettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanSeePluginSettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanSeePluginSettings(ctx, req.(*UserCanSeePluginSettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanSeeTemplateSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanSeeTemplateSettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanSeeTemplateSettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanSeeTemplateSettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanSeeTemplateSettings(ctx, req.(*UserCanSeeTemplateSettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanAddOrganizationMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanAddOrganizationMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanAddOrganizationMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanAddOrganizationMember_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanAddOrganizationMember(ctx, req.(*UserCanAddOrganizationMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanUpdateOrganizationMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanUpdateOrganizationMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanUpdateOrganizationMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanUpdateOrganizationMember_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanUpdateOrganizationMember(ctx, req.(*UserCanUpdateOrganizationMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanRemoveOrganizationMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanRemoveOrganizationMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanRemoveOrganizationMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanRemoveOrganizationMember_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanRemoveOrganizationMember(ctx, req.(*UserCanRemoveOrganizationMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanDeleteOrganization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanDeleteOrganizationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanDeleteOrganization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanDeleteOrganization_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanDeleteOrganization(ctx, req.(*UserCanDeleteOrganizationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanDeleteRepository_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanDeleteRepositoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanDeleteRepository(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanDeleteRepository_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanDeleteRepository(ctx, req.(*UserCanDeleteRepositoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanDeleteTemplate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanDeleteTemplateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanDeleteTemplate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanDeleteTemplate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanDeleteTemplate(ctx, req.(*UserCanDeleteTemplateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanDeletePlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanDeletePluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanDeletePlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanDeletePlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanDeletePlugin(ctx, req.(*UserCanDeletePluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanDeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanDeleteUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanDeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanDeleteUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanDeleteUser(ctx, req.(*UserCanDeleteUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanSeeServerAdminPanel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanSeeServerAdminPanelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanSeeServerAdminPanel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanSeeServerAdminPanel_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanSeeServerAdminPanel(ctx, req.(*UserCanSeeServerAdminPanelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthzService_UserCanManageRepositoryContributors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserCanManageRepositoryContributorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).UserCanManageRepositoryContributors(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_UserCanManageRepositoryContributors_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).UserCanManageRepositoryContributors(ctx, req.(*UserCanManageRepositoryContributorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AuthzService_ServiceDesc is the grpc.ServiceDesc for AuthzService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AuthzService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.AuthzService", + HandlerType: (*AuthzServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UserCanCreateOrganizationRepository", + Handler: _AuthzService_UserCanCreateOrganizationRepository_Handler, + }, + { + MethodName: "UserCanSeeRepositorySettings", + Handler: _AuthzService_UserCanSeeRepositorySettings_Handler, + }, + { + MethodName: "UserCanSeeOrganizationSettings", + Handler: _AuthzService_UserCanSeeOrganizationSettings_Handler, + }, + { + MethodName: "UserCanReadPlugin", + Handler: _AuthzService_UserCanReadPlugin_Handler, + }, + { + MethodName: "UserCanCreatePluginVersion", + Handler: _AuthzService_UserCanCreatePluginVersion_Handler, + }, + { + MethodName: "UserCanCreateTemplateVersion", + Handler: _AuthzService_UserCanCreateTemplateVersion_Handler, + }, + { + MethodName: "UserCanCreateOrganizationPlugin", + Handler: _AuthzService_UserCanCreateOrganizationPlugin_Handler, + }, + { + MethodName: "UserCanCreateOrganizationTemplate", + Handler: _AuthzService_UserCanCreateOrganizationTemplate_Handler, + }, + { + MethodName: "UserCanSeePluginSettings", + Handler: _AuthzService_UserCanSeePluginSettings_Handler, + }, + { + MethodName: "UserCanSeeTemplateSettings", + Handler: _AuthzService_UserCanSeeTemplateSettings_Handler, + }, + { + MethodName: "UserCanAddOrganizationMember", + Handler: _AuthzService_UserCanAddOrganizationMember_Handler, + }, + { + MethodName: "UserCanUpdateOrganizationMember", + Handler: _AuthzService_UserCanUpdateOrganizationMember_Handler, + }, + { + MethodName: "UserCanRemoveOrganizationMember", + Handler: _AuthzService_UserCanRemoveOrganizationMember_Handler, + }, + { + MethodName: "UserCanDeleteOrganization", + Handler: _AuthzService_UserCanDeleteOrganization_Handler, + }, + { + MethodName: "UserCanDeleteRepository", + Handler: _AuthzService_UserCanDeleteRepository_Handler, + }, + { + MethodName: "UserCanDeleteTemplate", + Handler: _AuthzService_UserCanDeleteTemplate_Handler, + }, + { + MethodName: "UserCanDeletePlugin", + Handler: _AuthzService_UserCanDeletePlugin_Handler, + }, + { + MethodName: "UserCanDeleteUser", + Handler: _AuthzService_UserCanDeleteUser_Handler, + }, + { + MethodName: "UserCanSeeServerAdminPanel", + Handler: _AuthzService_UserCanSeeServerAdminPanel_Handler, + }, + { + MethodName: "UserCanManageRepositoryContributors", + Handler: _AuthzService_UserCanManageRepositoryContributors_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/authz.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/convert.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/convert.pb.go new file mode 100644 index 000000000..ca176eb0a --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/convert.pb.go @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/convert.proto + +package registryv1alpha1 + +import ( + v1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The supported formats for the serialized message conversion. +type ConvertFormat int32 + +const ( + ConvertFormat_CONVERT_FORMAT_UNSPECIFIED ConvertFormat = 0 + ConvertFormat_CONVERT_FORMAT_BIN ConvertFormat = 1 + ConvertFormat_CONVERT_FORMAT_JSON ConvertFormat = 2 +) + +// Enum value maps for ConvertFormat. +var ( + ConvertFormat_name = map[int32]string{ + 0: "CONVERT_FORMAT_UNSPECIFIED", + 1: "CONVERT_FORMAT_BIN", + 2: "CONVERT_FORMAT_JSON", + } + ConvertFormat_value = map[string]int32{ + "CONVERT_FORMAT_UNSPECIFIED": 0, + "CONVERT_FORMAT_BIN": 1, + "CONVERT_FORMAT_JSON": 2, + } +) + +func (x ConvertFormat) Enum() *ConvertFormat { + p := new(ConvertFormat) + *p = x + return p +} + +func (x ConvertFormat) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConvertFormat) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_convert_proto_enumTypes[0].Descriptor() +} + +func (ConvertFormat) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_convert_proto_enumTypes[0] +} + +func (x ConvertFormat) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConvertFormat.Descriptor instead. +func (ConvertFormat) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_convert_proto_rawDescGZIP(), []int{0} +} + +type ConvertRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // type_name is the full type name of the serialized message (like acme.weather.v1.Units). + TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + // image is the image source that defines the serialized message. + Image *v1.Image `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` + // payload is the serialized Protobuf message. + Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` + // request_format is the format of the payload. + RequestFormat ConvertFormat `protobuf:"varint,4,opt,name=request_format,json=requestFormat,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.ConvertFormat" json:"request_format,omitempty"` + // response_format is the desired format of the output result. + ResponseFormat ConvertFormat `protobuf:"varint,5,opt,name=response_format,json=responseFormat,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.ConvertFormat" json:"response_format,omitempty"` +} + +func (x *ConvertRequest) Reset() { + *x = ConvertRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_convert_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvertRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvertRequest) ProtoMessage() {} + +func (x *ConvertRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_convert_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvertRequest.ProtoReflect.Descriptor instead. +func (*ConvertRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_convert_proto_rawDescGZIP(), []int{0} +} + +func (x *ConvertRequest) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *ConvertRequest) GetImage() *v1.Image { + if x != nil { + return x.Image + } + return nil +} + +func (x *ConvertRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *ConvertRequest) GetRequestFormat() ConvertFormat { + if x != nil { + return x.RequestFormat + } + return ConvertFormat_CONVERT_FORMAT_UNSPECIFIED +} + +func (x *ConvertRequest) GetResponseFormat() ConvertFormat { + if x != nil { + return x.ResponseFormat + } + return ConvertFormat_CONVERT_FORMAT_UNSPECIFIED +} + +type ConvertResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // payload is the converted serialized message in one of the supported formats. + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *ConvertResponse) Reset() { + *x = ConvertResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_convert_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvertResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvertResponse) ProtoMessage() {} + +func (x *ConvertResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_convert_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvertResponse.ProtoReflect.Descriptor instead. +func (*ConvertResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_convert_proto_rawDescGZIP(), []int{1} +} + +func (x *ConvertResponse) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +var File_registry_v1alpha1_convert_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_convert_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x14, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xca, 0x02, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x5f, 0x0a, 0x0e, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52, 0x0d, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x61, 0x0a, 0x0f, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52, + 0x0e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, + 0x2b, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x60, 0x0a, 0x0d, + 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x1e, 0x0a, + 0x1a, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, + 0x12, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, + 0x42, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x54, + 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x02, 0x32, 0x93, + 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x80, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x39, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe7, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0c, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, + 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, + 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_convert_proto_rawDescOnce sync.Once + file_registry_v1alpha1_convert_proto_rawDescData = file_registry_v1alpha1_convert_proto_rawDesc +) + +func file_registry_v1alpha1_convert_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_convert_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_convert_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_convert_proto_rawDescData) + }) + return file_registry_v1alpha1_convert_proto_rawDescData +} + +var file_registry_v1alpha1_convert_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_convert_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_registry_v1alpha1_convert_proto_goTypes = []interface{}{ + (ConvertFormat)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.ConvertFormat + (*ConvertRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.ConvertRequest + (*ConvertResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.ConvertResponse + (*v1.Image)(nil), // 3: bufman.dubbo.apache.org.image.v1.Image +} +var file_registry_v1alpha1_convert_proto_depIdxs = []int32{ + 3, // 0: bufman.dubbo.apache.org.registry.v1alpha1.ConvertRequest.image:type_name -> bufman.dubbo.apache.org.image.v1.Image + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.ConvertRequest.request_format:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ConvertFormat + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.ConvertRequest.response_format:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ConvertFormat + 1, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ConvertService.Convert:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ConvertRequest + 2, // 4: bufman.dubbo.apache.org.registry.v1alpha1.ConvertService.Convert:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ConvertResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_convert_proto_init() } +func file_registry_v1alpha1_convert_proto_init() { + if File_registry_v1alpha1_convert_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_convert_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvertRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_convert_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvertResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_convert_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_convert_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_convert_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_convert_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_convert_proto_msgTypes, + }.Build() + File_registry_v1alpha1_convert_proto = out.File + file_registry_v1alpha1_convert_proto_rawDesc = nil + file_registry_v1alpha1_convert_proto_goTypes = nil + file_registry_v1alpha1_convert_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/convert_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/convert_grpc.pb.go new file mode 100644 index 000000000..70951d53c --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/convert_grpc.pb.go @@ -0,0 +1,113 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/convert.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + ConvertService_Convert_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ConvertService/Convert" +) + +// ConvertServiceClient is the client API for ConvertService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ConvertServiceClient interface { + // Convert converts a serialized message according to + // the provided type name using an image. + Convert(ctx context.Context, in *ConvertRequest, opts ...grpc.CallOption) (*ConvertResponse, error) +} + +type convertServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewConvertServiceClient(cc grpc.ClientConnInterface) ConvertServiceClient { + return &convertServiceClient{cc} +} + +func (c *convertServiceClient) Convert(ctx context.Context, in *ConvertRequest, opts ...grpc.CallOption) (*ConvertResponse, error) { + out := new(ConvertResponse) + err := c.cc.Invoke(ctx, ConvertService_Convert_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ConvertServiceServer is the server API for ConvertService service. +// All implementations must embed UnimplementedConvertServiceServer +// for forward compatibility +type ConvertServiceServer interface { + // Convert converts a serialized message according to + // the provided type name using an image. + Convert(context.Context, *ConvertRequest) (*ConvertResponse, error) + mustEmbedUnimplementedConvertServiceServer() +} + +// UnimplementedConvertServiceServer must be embedded to have forward compatible implementations. +type UnimplementedConvertServiceServer struct { +} + +func (UnimplementedConvertServiceServer) Convert(context.Context, *ConvertRequest) (*ConvertResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Convert not implemented") +} +func (UnimplementedConvertServiceServer) mustEmbedUnimplementedConvertServiceServer() {} + +// UnsafeConvertServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ConvertServiceServer will +// result in compilation errors. +type UnsafeConvertServiceServer interface { + mustEmbedUnimplementedConvertServiceServer() +} + +func RegisterConvertServiceServer(s grpc.ServiceRegistrar, srv ConvertServiceServer) { + s.RegisterService(&ConvertService_ServiceDesc, srv) +} + +func _ConvertService_Convert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConvertRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ConvertServiceServer).Convert(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ConvertService_Convert_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ConvertServiceServer).Convert(ctx, req.(*ConvertRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ConvertService_ServiceDesc is the grpc.ServiceDesc for ConvertService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ConvertService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.ConvertService", + HandlerType: (*ConvertServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Convert", + Handler: _ConvertService_Convert_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/convert.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/display.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/display.pb.go new file mode 100644 index 000000000..bceb9fed1 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/display.pb.go @@ -0,0 +1,1360 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/display.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DisplayOrganizationElementsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to check + // which elements should be displayed. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *DisplayOrganizationElementsRequest) Reset() { + *x = DisplayOrganizationElementsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayOrganizationElementsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayOrganizationElementsRequest) ProtoMessage() {} + +func (x *DisplayOrganizationElementsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayOrganizationElementsRequest.ProtoReflect.Descriptor instead. +func (*DisplayOrganizationElementsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{0} +} + +func (x *DisplayOrganizationElementsRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type DisplayOrganizationElementsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Display create organization repository element if true. + CreateRepository bool `protobuf:"varint,1,opt,name=create_repository,json=createRepository,proto3" json:"create_repository,omitempty"` + // Display create organization plugin element if true. + // + // Deprecated: Do not use. + CreatePlugin bool `protobuf:"varint,2,opt,name=create_plugin,json=createPlugin,proto3" json:"create_plugin,omitempty"` + // Display create organization template element if true. + // + // Deprecated: Do not use. + CreateTemplate bool `protobuf:"varint,3,opt,name=create_template,json=createTemplate,proto3" json:"create_template,omitempty"` + // Display organization settings element if true. + Settings bool `protobuf:"varint,4,opt,name=settings,proto3" json:"settings,omitempty"` + // Display update organization settings element if true. + UpdateSettings bool `protobuf:"varint,5,opt,name=update_settings,json=updateSettings,proto3" json:"update_settings,omitempty"` + // Display delete organization element if true. + Delete bool `protobuf:"varint,6,opt,name=delete,proto3" json:"delete,omitempty"` +} + +func (x *DisplayOrganizationElementsResponse) Reset() { + *x = DisplayOrganizationElementsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayOrganizationElementsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayOrganizationElementsResponse) ProtoMessage() {} + +func (x *DisplayOrganizationElementsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayOrganizationElementsResponse.ProtoReflect.Descriptor instead. +func (*DisplayOrganizationElementsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{1} +} + +func (x *DisplayOrganizationElementsResponse) GetCreateRepository() bool { + if x != nil { + return x.CreateRepository + } + return false +} + +// Deprecated: Do not use. +func (x *DisplayOrganizationElementsResponse) GetCreatePlugin() bool { + if x != nil { + return x.CreatePlugin + } + return false +} + +// Deprecated: Do not use. +func (x *DisplayOrganizationElementsResponse) GetCreateTemplate() bool { + if x != nil { + return x.CreateTemplate + } + return false +} + +func (x *DisplayOrganizationElementsResponse) GetSettings() bool { + if x != nil { + return x.Settings + } + return false +} + +func (x *DisplayOrganizationElementsResponse) GetUpdateSettings() bool { + if x != nil { + return x.UpdateSettings + } + return false +} + +func (x *DisplayOrganizationElementsResponse) GetDelete() bool { + if x != nil { + return x.Delete + } + return false +} + +type DisplayRepositoryElementsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to check + // which elements should be displayed. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` +} + +func (x *DisplayRepositoryElementsRequest) Reset() { + *x = DisplayRepositoryElementsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayRepositoryElementsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayRepositoryElementsRequest) ProtoMessage() {} + +func (x *DisplayRepositoryElementsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayRepositoryElementsRequest.ProtoReflect.Descriptor instead. +func (*DisplayRepositoryElementsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{2} +} + +func (x *DisplayRepositoryElementsRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +type DisplayRepositoryElementsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Display repository settings element if true. + Settings bool `protobuf:"varint,1,opt,name=settings,proto3" json:"settings,omitempty"` + // Display delete repository element if true. + Delete bool `protobuf:"varint,2,opt,name=delete,proto3" json:"delete,omitempty"` + // Display write repository element if true. + Write bool `protobuf:"varint,3,opt,name=write,proto3" json:"write,omitempty"` +} + +func (x *DisplayRepositoryElementsResponse) Reset() { + *x = DisplayRepositoryElementsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayRepositoryElementsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayRepositoryElementsResponse) ProtoMessage() {} + +func (x *DisplayRepositoryElementsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayRepositoryElementsResponse.ProtoReflect.Descriptor instead. +func (*DisplayRepositoryElementsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{3} +} + +func (x *DisplayRepositoryElementsResponse) GetSettings() bool { + if x != nil { + return x.Settings + } + return false +} + +func (x *DisplayRepositoryElementsResponse) GetDelete() bool { + if x != nil { + return x.Delete + } + return false +} + +func (x *DisplayRepositoryElementsResponse) GetWrite() bool { + if x != nil { + return x.Write + } + return false +} + +type DisplayUserElementsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DisplayUserElementsRequest) Reset() { + *x = DisplayUserElementsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayUserElementsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayUserElementsRequest) ProtoMessage() {} + +func (x *DisplayUserElementsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayUserElementsRequest.ProtoReflect.Descriptor instead. +func (*DisplayUserElementsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{4} +} + +type DisplayUserElementsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Display delete user element if true. + Delete bool `protobuf:"varint,1,opt,name=delete,proto3" json:"delete,omitempty"` +} + +func (x *DisplayUserElementsResponse) Reset() { + *x = DisplayUserElementsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayUserElementsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayUserElementsResponse) ProtoMessage() {} + +func (x *DisplayUserElementsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayUserElementsResponse.ProtoReflect.Descriptor instead. +func (*DisplayUserElementsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{5} +} + +func (x *DisplayUserElementsResponse) GetDelete() bool { + if x != nil { + return x.Delete + } + return false +} + +type DisplayServerElementsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DisplayServerElementsRequest) Reset() { + *x = DisplayServerElementsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayServerElementsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayServerElementsRequest) ProtoMessage() {} + +func (x *DisplayServerElementsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayServerElementsRequest.ProtoReflect.Descriptor instead. +func (*DisplayServerElementsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{6} +} + +type DisplayServerElementsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Display server admin panel element if true. + AdminPanel bool `protobuf:"varint,1,opt,name=admin_panel,json=adminPanel,proto3" json:"admin_panel,omitempty"` +} + +func (x *DisplayServerElementsResponse) Reset() { + *x = DisplayServerElementsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayServerElementsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayServerElementsResponse) ProtoMessage() {} + +func (x *DisplayServerElementsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayServerElementsResponse.ProtoReflect.Descriptor instead. +func (*DisplayServerElementsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{7} +} + +func (x *DisplayServerElementsResponse) GetAdminPanel() bool { + if x != nil { + return x.AdminPanel + } + return false +} + +type DisplayOwnerEntitledElementsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the owner for which to check + // which elements are entitled to be displayed. + OwnerName string `protobuf:"bytes,1,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` +} + +func (x *DisplayOwnerEntitledElementsRequest) Reset() { + *x = DisplayOwnerEntitledElementsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayOwnerEntitledElementsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayOwnerEntitledElementsRequest) ProtoMessage() {} + +func (x *DisplayOwnerEntitledElementsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayOwnerEntitledElementsRequest.ProtoReflect.Descriptor instead. +func (*DisplayOwnerEntitledElementsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{8} +} + +func (x *DisplayOwnerEntitledElementsRequest) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +type DisplayOwnerEntitledElementsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Display create private repository element if true. + CreatePrivateRepository bool `protobuf:"varint,1,opt,name=create_private_repository,json=createPrivateRepository,proto3" json:"create_private_repository,omitempty"` +} + +func (x *DisplayOwnerEntitledElementsResponse) Reset() { + *x = DisplayOwnerEntitledElementsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayOwnerEntitledElementsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayOwnerEntitledElementsResponse) ProtoMessage() {} + +func (x *DisplayOwnerEntitledElementsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayOwnerEntitledElementsResponse.ProtoReflect.Descriptor instead. +func (*DisplayOwnerEntitledElementsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{9} +} + +func (x *DisplayOwnerEntitledElementsResponse) GetCreatePrivateRepository() bool { + if x != nil { + return x.CreatePrivateRepository + } + return false +} + +type DisplayRepositoryEntitledElementsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to check + // which elements are entitled to be displayed. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` +} + +func (x *DisplayRepositoryEntitledElementsRequest) Reset() { + *x = DisplayRepositoryEntitledElementsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayRepositoryEntitledElementsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayRepositoryEntitledElementsRequest) ProtoMessage() {} + +func (x *DisplayRepositoryEntitledElementsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayRepositoryEntitledElementsRequest.ProtoReflect.Descriptor instead. +func (*DisplayRepositoryEntitledElementsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{10} +} + +func (x *DisplayRepositoryEntitledElementsRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +type DisplayRepositoryEntitledElementsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Display repository change to private setting element if true. + SetPrivate bool `protobuf:"varint,1,opt,name=set_private,json=setPrivate,proto3" json:"set_private,omitempty"` +} + +func (x *DisplayRepositoryEntitledElementsResponse) Reset() { + *x = DisplayRepositoryEntitledElementsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisplayRepositoryEntitledElementsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisplayRepositoryEntitledElementsResponse) ProtoMessage() {} + +func (x *DisplayRepositoryEntitledElementsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisplayRepositoryEntitledElementsResponse.ProtoReflect.Descriptor instead. +func (*DisplayRepositoryEntitledElementsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{11} +} + +func (x *DisplayRepositoryEntitledElementsResponse) GetSetPrivate() bool { + if x != nil { + return x.SetPrivate + } + return false +} + +type ListManageableRepositoryRolesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to check + // which roles should be displayed as manageable. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` +} + +func (x *ListManageableRepositoryRolesRequest) Reset() { + *x = ListManageableRepositoryRolesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListManageableRepositoryRolesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListManageableRepositoryRolesRequest) ProtoMessage() {} + +func (x *ListManageableRepositoryRolesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListManageableRepositoryRolesRequest.ProtoReflect.Descriptor instead. +func (*ListManageableRepositoryRolesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{12} +} + +func (x *ListManageableRepositoryRolesRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +type ListManageableRepositoryRolesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of roles that should be displayed + // to the user as manageable. + Roles []RepositoryRole `protobuf:"varint,1,rep,packed,name=roles,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"roles,omitempty"` +} + +func (x *ListManageableRepositoryRolesResponse) Reset() { + *x = ListManageableRepositoryRolesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListManageableRepositoryRolesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListManageableRepositoryRolesResponse) ProtoMessage() {} + +func (x *ListManageableRepositoryRolesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListManageableRepositoryRolesResponse.ProtoReflect.Descriptor instead. +func (*ListManageableRepositoryRolesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{13} +} + +func (x *ListManageableRepositoryRolesResponse) GetRoles() []RepositoryRole { + if x != nil { + return x.Roles + } + return nil +} + +type ListManageableUserRepositoryRolesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to check + // which roles should be displayed as manageable. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // The ID of the target user for which to check + // which roles are manageable. + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *ListManageableUserRepositoryRolesRequest) Reset() { + *x = ListManageableUserRepositoryRolesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListManageableUserRepositoryRolesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListManageableUserRepositoryRolesRequest) ProtoMessage() {} + +func (x *ListManageableUserRepositoryRolesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListManageableUserRepositoryRolesRequest.ProtoReflect.Descriptor instead. +func (*ListManageableUserRepositoryRolesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{14} +} + +func (x *ListManageableUserRepositoryRolesRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *ListManageableUserRepositoryRolesRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type ListManageableUserRepositoryRolesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of roles that should be displayed + // to the user as manageable. + Roles []RepositoryRole `protobuf:"varint,1,rep,packed,name=roles,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"roles,omitempty"` +} + +func (x *ListManageableUserRepositoryRolesResponse) Reset() { + *x = ListManageableUserRepositoryRolesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_display_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListManageableUserRepositoryRolesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListManageableUserRepositoryRolesResponse) ProtoMessage() {} + +func (x *ListManageableUserRepositoryRolesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_display_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListManageableUserRepositoryRolesResponse.ProtoReflect.Descriptor instead. +func (*ListManageableUserRepositoryRolesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_display_proto_rawDescGZIP(), []int{15} +} + +func (x *ListManageableUserRepositoryRolesResponse) GetRoles() []RepositoryRole { + if x != nil { + return x.Roles + } + return nil +} + +var File_registry_v1alpha1_display_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_display_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1c, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, + 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4d, 0x0a, 0x22, 0x44, 0x69, + 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x85, 0x02, 0x0a, 0x23, 0x44, 0x69, + 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x27, + 0x0a, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x2b, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x12, 0x27, 0x0a, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x22, 0x47, 0x0a, 0x20, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x22, 0x6d, 0x0a, 0x21, 0x44, 0x69, + 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x22, 0x1c, 0x0a, 0x1a, 0x44, 0x69, 0x73, + 0x70, 0x6c, 0x61, 0x79, 0x55, 0x73, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x35, 0x0a, 0x1b, 0x44, 0x69, 0x73, 0x70, 0x6c, + 0x61, 0x79, 0x55, 0x73, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x22, 0x1e, + 0x0a, 0x1c, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x45, + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x40, + 0x0a, 0x1d, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x45, + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1f, 0x0a, 0x0b, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x61, 0x6e, 0x65, 0x6c, + 0x22, 0x44, 0x0a, 0x23, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x45, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x64, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x62, 0x0a, 0x24, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, + 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x64, 0x45, 0x6c, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, + 0x0a, 0x19, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x17, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x4f, 0x0a, 0x28, 0x44, 0x69, + 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, + 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x64, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x22, 0x4c, 0x0a, 0x29, 0x44, + 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x45, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x64, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x74, 0x5f, + 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, + 0x65, 0x74, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x22, 0x4b, 0x0a, 0x24, 0x4c, 0x69, 0x73, + 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x22, 0x78, 0x0a, 0x25, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4f, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x39, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, + 0x22, 0x68, 0x0a, 0x28, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x61, 0x62, + 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, + 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x7c, 0x0a, 0x29, 0x4c, 0x69, + 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, + 0x65, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x32, 0xad, 0x0c, 0x0a, 0x0e, 0x44, 0x69, 0x73, + 0x70, 0x6c, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc1, 0x01, 0x0a, 0x1b, + 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x4d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6c, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4e, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, + 0xbb, 0x01, 0x0a, 0x19, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x4b, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, + 0x79, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, 0x6c, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4c, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa9, 0x01, + 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x55, 0x73, 0x65, 0x72, 0x45, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x55, 0x73, 0x65, 0x72, 0x45, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x55, 0x73, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xaf, 0x01, 0x0a, 0x15, 0x44, 0x69, + 0x73, 0x70, 0x6c, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x12, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x45, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x48, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xc4, 0x01, 0x0a, 0x1c, + 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x64, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x4e, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x64, 0x45, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4f, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x64, 0x45, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0xd3, 0x01, 0x0a, 0x21, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x64, + 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x53, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x64, 0x45, 0x6c, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x54, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, + 0x79, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x69, 0x74, + 0x6c, 0x65, 0x64, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xc7, 0x01, 0x0a, 0x1d, 0x4c, 0x69, 0x73, + 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x4f, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x50, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0xd3, 0x01, 0x0a, 0x21, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x53, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x61, + 0x62, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x54, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe7, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0c, 0x44, 0x69, 0x73, 0x70, + 0x6c, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, + 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, + 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_display_proto_rawDescOnce sync.Once + file_registry_v1alpha1_display_proto_rawDescData = file_registry_v1alpha1_display_proto_rawDesc +) + +func file_registry_v1alpha1_display_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_display_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_display_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_display_proto_rawDescData) + }) + return file_registry_v1alpha1_display_proto_rawDescData +} + +var file_registry_v1alpha1_display_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_registry_v1alpha1_display_proto_goTypes = []interface{}{ + (*DisplayOrganizationElementsRequest)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.DisplayOrganizationElementsRequest + (*DisplayOrganizationElementsResponse)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.DisplayOrganizationElementsResponse + (*DisplayRepositoryElementsRequest)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.DisplayRepositoryElementsRequest + (*DisplayRepositoryElementsResponse)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.DisplayRepositoryElementsResponse + (*DisplayUserElementsRequest)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.DisplayUserElementsRequest + (*DisplayUserElementsResponse)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.DisplayUserElementsResponse + (*DisplayServerElementsRequest)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.DisplayServerElementsRequest + (*DisplayServerElementsResponse)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.DisplayServerElementsResponse + (*DisplayOwnerEntitledElementsRequest)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.DisplayOwnerEntitledElementsRequest + (*DisplayOwnerEntitledElementsResponse)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.DisplayOwnerEntitledElementsResponse + (*DisplayRepositoryEntitledElementsRequest)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.DisplayRepositoryEntitledElementsRequest + (*DisplayRepositoryEntitledElementsResponse)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.DisplayRepositoryEntitledElementsResponse + (*ListManageableRepositoryRolesRequest)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.ListManageableRepositoryRolesRequest + (*ListManageableRepositoryRolesResponse)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.ListManageableRepositoryRolesResponse + (*ListManageableUserRepositoryRolesRequest)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.ListManageableUserRepositoryRolesRequest + (*ListManageableUserRepositoryRolesResponse)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.ListManageableUserRepositoryRolesResponse + (RepositoryRole)(0), // 16: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole +} +var file_registry_v1alpha1_display_proto_depIdxs = []int32{ + 16, // 0: bufman.dubbo.apache.org.registry.v1alpha1.ListManageableRepositoryRolesResponse.roles:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 16, // 1: bufman.dubbo.apache.org.registry.v1alpha1.ListManageableUserRepositoryRolesResponse.roles:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOrganizationElements:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayOrganizationElementsRequest + 2, // 3: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryElements:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayRepositoryElementsRequest + 4, // 4: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayUserElements:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayUserElementsRequest + 6, // 5: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayServerElements:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayServerElementsRequest + 8, // 6: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOwnerEntitledElements:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayOwnerEntitledElementsRequest + 10, // 7: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryEntitledElements:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayRepositoryEntitledElementsRequest + 12, // 8: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableRepositoryRoles:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListManageableRepositoryRolesRequest + 14, // 9: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableUserRepositoryRoles:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListManageableUserRepositoryRolesRequest + 1, // 10: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOrganizationElements:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayOrganizationElementsResponse + 3, // 11: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryElements:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayRepositoryElementsResponse + 5, // 12: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayUserElements:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayUserElementsResponse + 7, // 13: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayServerElements:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayServerElementsResponse + 9, // 14: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayOwnerEntitledElements:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayOwnerEntitledElementsResponse + 11, // 15: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.DisplayRepositoryEntitledElements:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DisplayRepositoryEntitledElementsResponse + 13, // 16: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableRepositoryRoles:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListManageableRepositoryRolesResponse + 15, // 17: bufman.dubbo.apache.org.registry.v1alpha1.DisplayService.ListManageableUserRepositoryRoles:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListManageableUserRepositoryRolesResponse + 10, // [10:18] is the sub-list for method output_type + 2, // [2:10] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_display_proto_init() } +func file_registry_v1alpha1_display_proto_init() { + if File_registry_v1alpha1_display_proto != nil { + return + } + file_registry_v1alpha1_role_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_display_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayOrganizationElementsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayOrganizationElementsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayRepositoryElementsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayRepositoryElementsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayUserElementsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayUserElementsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayServerElementsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayServerElementsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayOwnerEntitledElementsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayOwnerEntitledElementsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayRepositoryEntitledElementsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisplayRepositoryEntitledElementsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListManageableRepositoryRolesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListManageableRepositoryRolesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListManageableUserRepositoryRolesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_display_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListManageableUserRepositoryRolesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_display_proto_rawDesc, + NumEnums: 0, + NumMessages: 16, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_display_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_display_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_display_proto_msgTypes, + }.Build() + File_registry_v1alpha1_display_proto = out.File + file_registry_v1alpha1_display_proto_rawDesc = nil + file_registry_v1alpha1_display_proto_goTypes = nil + file_registry_v1alpha1_display_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/display_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/display_grpc.pb.go new file mode 100644 index 000000000..6a884bc6f --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/display_grpc.pb.go @@ -0,0 +1,388 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/display.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + DisplayService_DisplayOrganizationElements_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayOrganizationElements" + DisplayService_DisplayRepositoryElements_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayRepositoryElements" + DisplayService_DisplayUserElements_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayUserElements" + DisplayService_DisplayServerElements_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayServerElements" + DisplayService_DisplayOwnerEntitledElements_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayOwnerEntitledElements" + DisplayService_DisplayRepositoryEntitledElements_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/DisplayRepositoryEntitledElements" + DisplayService_ListManageableRepositoryRoles_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/ListManageableRepositoryRoles" + DisplayService_ListManageableUserRepositoryRoles_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DisplayService/ListManageableUserRepositoryRoles" +) + +// DisplayServiceClient is the client API for DisplayService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type DisplayServiceClient interface { + // DisplayOrganizationElements returns which organization elements should be displayed to the user. + DisplayOrganizationElements(ctx context.Context, in *DisplayOrganizationElementsRequest, opts ...grpc.CallOption) (*DisplayOrganizationElementsResponse, error) + // DisplayRepositoryElements returns which repository elements should be displayed to the user. + DisplayRepositoryElements(ctx context.Context, in *DisplayRepositoryElementsRequest, opts ...grpc.CallOption) (*DisplayRepositoryElementsResponse, error) + // DisplayUserElements returns which user elements should be displayed to the user. + DisplayUserElements(ctx context.Context, in *DisplayUserElementsRequest, opts ...grpc.CallOption) (*DisplayUserElementsResponse, error) + // DisplayServerElements returns which server elements should be displayed to the user. + DisplayServerElements(ctx context.Context, in *DisplayServerElementsRequest, opts ...grpc.CallOption) (*DisplayServerElementsResponse, error) + // DisplayOwnerEntitledElements returns which owner elements are entitled to be displayed to the user. + DisplayOwnerEntitledElements(ctx context.Context, in *DisplayOwnerEntitledElementsRequest, opts ...grpc.CallOption) (*DisplayOwnerEntitledElementsResponse, error) + // DisplayRepositoryEntitledElements returns which repository elements are entitled to be displayed to the user. + DisplayRepositoryEntitledElements(ctx context.Context, in *DisplayRepositoryEntitledElementsRequest, opts ...grpc.CallOption) (*DisplayRepositoryEntitledElementsResponse, error) + // ListManageableRepositoryRoles returns which roles should be displayed + // to the user when they are managing contributors on the repository. + ListManageableRepositoryRoles(ctx context.Context, in *ListManageableRepositoryRolesRequest, opts ...grpc.CallOption) (*ListManageableRepositoryRolesResponse, error) + // ListManageableUserRepositoryRoles returns which roles should be displayed + // to the user when they are managing a specific contributor on the repository. + ListManageableUserRepositoryRoles(ctx context.Context, in *ListManageableUserRepositoryRolesRequest, opts ...grpc.CallOption) (*ListManageableUserRepositoryRolesResponse, error) +} + +type displayServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewDisplayServiceClient(cc grpc.ClientConnInterface) DisplayServiceClient { + return &displayServiceClient{cc} +} + +func (c *displayServiceClient) DisplayOrganizationElements(ctx context.Context, in *DisplayOrganizationElementsRequest, opts ...grpc.CallOption) (*DisplayOrganizationElementsResponse, error) { + out := new(DisplayOrganizationElementsResponse) + err := c.cc.Invoke(ctx, DisplayService_DisplayOrganizationElements_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *displayServiceClient) DisplayRepositoryElements(ctx context.Context, in *DisplayRepositoryElementsRequest, opts ...grpc.CallOption) (*DisplayRepositoryElementsResponse, error) { + out := new(DisplayRepositoryElementsResponse) + err := c.cc.Invoke(ctx, DisplayService_DisplayRepositoryElements_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *displayServiceClient) DisplayUserElements(ctx context.Context, in *DisplayUserElementsRequest, opts ...grpc.CallOption) (*DisplayUserElementsResponse, error) { + out := new(DisplayUserElementsResponse) + err := c.cc.Invoke(ctx, DisplayService_DisplayUserElements_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *displayServiceClient) DisplayServerElements(ctx context.Context, in *DisplayServerElementsRequest, opts ...grpc.CallOption) (*DisplayServerElementsResponse, error) { + out := new(DisplayServerElementsResponse) + err := c.cc.Invoke(ctx, DisplayService_DisplayServerElements_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *displayServiceClient) DisplayOwnerEntitledElements(ctx context.Context, in *DisplayOwnerEntitledElementsRequest, opts ...grpc.CallOption) (*DisplayOwnerEntitledElementsResponse, error) { + out := new(DisplayOwnerEntitledElementsResponse) + err := c.cc.Invoke(ctx, DisplayService_DisplayOwnerEntitledElements_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *displayServiceClient) DisplayRepositoryEntitledElements(ctx context.Context, in *DisplayRepositoryEntitledElementsRequest, opts ...grpc.CallOption) (*DisplayRepositoryEntitledElementsResponse, error) { + out := new(DisplayRepositoryEntitledElementsResponse) + err := c.cc.Invoke(ctx, DisplayService_DisplayRepositoryEntitledElements_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *displayServiceClient) ListManageableRepositoryRoles(ctx context.Context, in *ListManageableRepositoryRolesRequest, opts ...grpc.CallOption) (*ListManageableRepositoryRolesResponse, error) { + out := new(ListManageableRepositoryRolesResponse) + err := c.cc.Invoke(ctx, DisplayService_ListManageableRepositoryRoles_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *displayServiceClient) ListManageableUserRepositoryRoles(ctx context.Context, in *ListManageableUserRepositoryRolesRequest, opts ...grpc.CallOption) (*ListManageableUserRepositoryRolesResponse, error) { + out := new(ListManageableUserRepositoryRolesResponse) + err := c.cc.Invoke(ctx, DisplayService_ListManageableUserRepositoryRoles_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DisplayServiceServer is the server API for DisplayService service. +// All implementations must embed UnimplementedDisplayServiceServer +// for forward compatibility +type DisplayServiceServer interface { + // DisplayOrganizationElements returns which organization elements should be displayed to the user. + DisplayOrganizationElements(context.Context, *DisplayOrganizationElementsRequest) (*DisplayOrganizationElementsResponse, error) + // DisplayRepositoryElements returns which repository elements should be displayed to the user. + DisplayRepositoryElements(context.Context, *DisplayRepositoryElementsRequest) (*DisplayRepositoryElementsResponse, error) + // DisplayUserElements returns which user elements should be displayed to the user. + DisplayUserElements(context.Context, *DisplayUserElementsRequest) (*DisplayUserElementsResponse, error) + // DisplayServerElements returns which server elements should be displayed to the user. + DisplayServerElements(context.Context, *DisplayServerElementsRequest) (*DisplayServerElementsResponse, error) + // DisplayOwnerEntitledElements returns which owner elements are entitled to be displayed to the user. + DisplayOwnerEntitledElements(context.Context, *DisplayOwnerEntitledElementsRequest) (*DisplayOwnerEntitledElementsResponse, error) + // DisplayRepositoryEntitledElements returns which repository elements are entitled to be displayed to the user. + DisplayRepositoryEntitledElements(context.Context, *DisplayRepositoryEntitledElementsRequest) (*DisplayRepositoryEntitledElementsResponse, error) + // ListManageableRepositoryRoles returns which roles should be displayed + // to the user when they are managing contributors on the repository. + ListManageableRepositoryRoles(context.Context, *ListManageableRepositoryRolesRequest) (*ListManageableRepositoryRolesResponse, error) + // ListManageableUserRepositoryRoles returns which roles should be displayed + // to the user when they are managing a specific contributor on the repository. + ListManageableUserRepositoryRoles(context.Context, *ListManageableUserRepositoryRolesRequest) (*ListManageableUserRepositoryRolesResponse, error) + mustEmbedUnimplementedDisplayServiceServer() +} + +// UnimplementedDisplayServiceServer must be embedded to have forward compatible implementations. +type UnimplementedDisplayServiceServer struct { +} + +func (UnimplementedDisplayServiceServer) DisplayOrganizationElements(context.Context, *DisplayOrganizationElementsRequest) (*DisplayOrganizationElementsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisplayOrganizationElements not implemented") +} +func (UnimplementedDisplayServiceServer) DisplayRepositoryElements(context.Context, *DisplayRepositoryElementsRequest) (*DisplayRepositoryElementsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisplayRepositoryElements not implemented") +} +func (UnimplementedDisplayServiceServer) DisplayUserElements(context.Context, *DisplayUserElementsRequest) (*DisplayUserElementsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisplayUserElements not implemented") +} +func (UnimplementedDisplayServiceServer) DisplayServerElements(context.Context, *DisplayServerElementsRequest) (*DisplayServerElementsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisplayServerElements not implemented") +} +func (UnimplementedDisplayServiceServer) DisplayOwnerEntitledElements(context.Context, *DisplayOwnerEntitledElementsRequest) (*DisplayOwnerEntitledElementsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisplayOwnerEntitledElements not implemented") +} +func (UnimplementedDisplayServiceServer) DisplayRepositoryEntitledElements(context.Context, *DisplayRepositoryEntitledElementsRequest) (*DisplayRepositoryEntitledElementsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisplayRepositoryEntitledElements not implemented") +} +func (UnimplementedDisplayServiceServer) ListManageableRepositoryRoles(context.Context, *ListManageableRepositoryRolesRequest) (*ListManageableRepositoryRolesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListManageableRepositoryRoles not implemented") +} +func (UnimplementedDisplayServiceServer) ListManageableUserRepositoryRoles(context.Context, *ListManageableUserRepositoryRolesRequest) (*ListManageableUserRepositoryRolesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListManageableUserRepositoryRoles not implemented") +} +func (UnimplementedDisplayServiceServer) mustEmbedUnimplementedDisplayServiceServer() {} + +// UnsafeDisplayServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DisplayServiceServer will +// result in compilation errors. +type UnsafeDisplayServiceServer interface { + mustEmbedUnimplementedDisplayServiceServer() +} + +func RegisterDisplayServiceServer(s grpc.ServiceRegistrar, srv DisplayServiceServer) { + s.RegisterService(&DisplayService_ServiceDesc, srv) +} + +func _DisplayService_DisplayOrganizationElements_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DisplayOrganizationElementsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DisplayServiceServer).DisplayOrganizationElements(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DisplayService_DisplayOrganizationElements_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DisplayServiceServer).DisplayOrganizationElements(ctx, req.(*DisplayOrganizationElementsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DisplayService_DisplayRepositoryElements_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DisplayRepositoryElementsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DisplayServiceServer).DisplayRepositoryElements(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DisplayService_DisplayRepositoryElements_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DisplayServiceServer).DisplayRepositoryElements(ctx, req.(*DisplayRepositoryElementsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DisplayService_DisplayUserElements_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DisplayUserElementsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DisplayServiceServer).DisplayUserElements(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DisplayService_DisplayUserElements_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DisplayServiceServer).DisplayUserElements(ctx, req.(*DisplayUserElementsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DisplayService_DisplayServerElements_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DisplayServerElementsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DisplayServiceServer).DisplayServerElements(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DisplayService_DisplayServerElements_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DisplayServiceServer).DisplayServerElements(ctx, req.(*DisplayServerElementsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DisplayService_DisplayOwnerEntitledElements_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DisplayOwnerEntitledElementsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DisplayServiceServer).DisplayOwnerEntitledElements(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DisplayService_DisplayOwnerEntitledElements_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DisplayServiceServer).DisplayOwnerEntitledElements(ctx, req.(*DisplayOwnerEntitledElementsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DisplayService_DisplayRepositoryEntitledElements_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DisplayRepositoryEntitledElementsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DisplayServiceServer).DisplayRepositoryEntitledElements(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DisplayService_DisplayRepositoryEntitledElements_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DisplayServiceServer).DisplayRepositoryEntitledElements(ctx, req.(*DisplayRepositoryEntitledElementsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DisplayService_ListManageableRepositoryRoles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListManageableRepositoryRolesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DisplayServiceServer).ListManageableRepositoryRoles(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DisplayService_ListManageableRepositoryRoles_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DisplayServiceServer).ListManageableRepositoryRoles(ctx, req.(*ListManageableRepositoryRolesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DisplayService_ListManageableUserRepositoryRoles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListManageableUserRepositoryRolesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DisplayServiceServer).ListManageableUserRepositoryRoles(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DisplayService_ListManageableUserRepositoryRoles_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DisplayServiceServer).ListManageableUserRepositoryRoles(ctx, req.(*ListManageableUserRepositoryRolesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// DisplayService_ServiceDesc is the grpc.ServiceDesc for DisplayService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DisplayService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.DisplayService", + HandlerType: (*DisplayServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "DisplayOrganizationElements", + Handler: _DisplayService_DisplayOrganizationElements_Handler, + }, + { + MethodName: "DisplayRepositoryElements", + Handler: _DisplayService_DisplayRepositoryElements_Handler, + }, + { + MethodName: "DisplayUserElements", + Handler: _DisplayService_DisplayUserElements_Handler, + }, + { + MethodName: "DisplayServerElements", + Handler: _DisplayService_DisplayServerElements_Handler, + }, + { + MethodName: "DisplayOwnerEntitledElements", + Handler: _DisplayService_DisplayOwnerEntitledElements_Handler, + }, + { + MethodName: "DisplayRepositoryEntitledElements", + Handler: _DisplayService_DisplayRepositoryEntitledElements_Handler, + }, + { + MethodName: "ListManageableRepositoryRoles", + Handler: _DisplayService_ListManageableRepositoryRoles_Handler, + }, + { + MethodName: "ListManageableUserRepositoryRoles", + Handler: _DisplayService_ListManageableUserRepositoryRoles_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/display.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/doc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/doc.pb.go new file mode 100644 index 000000000..c55b0cdea --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/doc.pb.go @@ -0,0 +1,3498 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/doc.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GetSourceDirectoryInfoRequest takes an owner, repository, and reference. +type GetSourceDirectoryInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *GetSourceDirectoryInfoRequest) Reset() { + *x = GetSourceDirectoryInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSourceDirectoryInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSourceDirectoryInfoRequest) ProtoMessage() {} + +func (x *GetSourceDirectoryInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSourceDirectoryInfoRequest.ProtoReflect.Descriptor instead. +func (*GetSourceDirectoryInfoRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{0} +} + +func (x *GetSourceDirectoryInfoRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetSourceDirectoryInfoRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetSourceDirectoryInfoRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +// GetSourceDirectoryInfoResponse returns the root FileInfo for the requested module. +type GetSourceDirectoryInfoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Root *FileInfo `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty"` +} + +func (x *GetSourceDirectoryInfoResponse) Reset() { + *x = GetSourceDirectoryInfoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSourceDirectoryInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSourceDirectoryInfoResponse) ProtoMessage() {} + +func (x *GetSourceDirectoryInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSourceDirectoryInfoResponse.ProtoReflect.Descriptor instead. +func (*GetSourceDirectoryInfoResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{1} +} + +func (x *GetSourceDirectoryInfoResponse) GetRoot() *FileInfo { + if x != nil { + return x.Root + } + return nil +} + +// FileInfo is a nested structure that contains the file path, whether or not it's a directory, +// and if so, the FileInfo children of that directory. +type FileInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // the normalized path of the directory, relative to the root of the module. + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + IsDir bool `protobuf:"varint,2,opt,name=is_dir,json=isDir,proto3" json:"is_dir,omitempty"` + Children []*FileInfo `protobuf:"bytes,3,rep,name=children,proto3" json:"children,omitempty"` +} + +func (x *FileInfo) Reset() { + *x = FileInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileInfo) ProtoMessage() {} + +func (x *FileInfo) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileInfo.ProtoReflect.Descriptor instead. +func (*FileInfo) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{2} +} + +func (x *FileInfo) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *FileInfo) GetIsDir() bool { + if x != nil { + return x.IsDir + } + return false +} + +func (x *FileInfo) GetChildren() []*FileInfo { + if x != nil { + return x.Children + } + return nil +} + +// GetSourceFileRequest takes an owner, repository, reference, and normalized path. +type GetSourceFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` + // the normalized path to the requested file, relative to the root of the module. + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *GetSourceFileRequest) Reset() { + *x = GetSourceFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSourceFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSourceFileRequest) ProtoMessage() {} + +func (x *GetSourceFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSourceFileRequest.ProtoReflect.Descriptor instead. +func (*GetSourceFileRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{3} +} + +func (x *GetSourceFileRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetSourceFileRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetSourceFileRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +func (x *GetSourceFileRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +// GetSourceFileResponse returns the source code contents of the requested file. +type GetSourceFileResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // content is the content of the file. + Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *GetSourceFileResponse) Reset() { + *x = GetSourceFileResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSourceFileResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSourceFileResponse) ProtoMessage() {} + +func (x *GetSourceFileResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSourceFileResponse.ProtoReflect.Descriptor instead. +func (*GetSourceFileResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{4} +} + +func (x *GetSourceFileResponse) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +// GetModulePackagesRequest takes an owner, repository, and reference. +type GetModulePackagesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *GetModulePackagesRequest) Reset() { + *x = GetModulePackagesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetModulePackagesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetModulePackagesRequest) ProtoMessage() {} + +func (x *GetModulePackagesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetModulePackagesRequest.ProtoReflect.Descriptor instead. +func (*GetModulePackagesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{5} +} + +func (x *GetModulePackagesRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetModulePackagesRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetModulePackagesRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +// GetModulePackagesResponse returns the list of ModulePackages for the requested module. +type GetModulePackagesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ModulePackages []*ModulePackage `protobuf:"bytes,2,rep,name=module_packages,json=modulePackages,proto3" json:"module_packages,omitempty"` +} + +func (x *GetModulePackagesResponse) Reset() { + *x = GetModulePackagesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetModulePackagesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetModulePackagesResponse) ProtoMessage() {} + +func (x *GetModulePackagesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetModulePackagesResponse.ProtoReflect.Descriptor instead. +func (*GetModulePackagesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{6} +} + +func (x *GetModulePackagesResponse) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetModulePackagesResponse) GetModulePackages() []*ModulePackage { + if x != nil { + return x.ModulePackages + } + return nil +} + +// ModulePackage provides the details about a module's associated package. +type ModulePackage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` +} + +func (x *ModulePackage) Reset() { + *x = ModulePackage{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModulePackage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModulePackage) ProtoMessage() {} + +func (x *ModulePackage) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModulePackage.ProtoReflect.Descriptor instead. +func (*ModulePackage) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{7} +} + +func (x *ModulePackage) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModulePackage) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +// GetModuleDocumentationRequest takes an owner, repository, and reference. +type GetModuleDocumentationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *GetModuleDocumentationRequest) Reset() { + *x = GetModuleDocumentationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetModuleDocumentationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetModuleDocumentationRequest) ProtoMessage() {} + +func (x *GetModuleDocumentationRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetModuleDocumentationRequest.ProtoReflect.Descriptor instead. +func (*GetModuleDocumentationRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{8} +} + +func (x *GetModuleDocumentationRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetModuleDocumentationRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetModuleDocumentationRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +// GetModuleDocumentationResponse returns the ModuleDocumentation for the requested module. +type GetModuleDocumentationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ModuleDocumentation *ModuleDocumentation `protobuf:"bytes,1,opt,name=module_documentation,json=moduleDocumentation,proto3" json:"module_documentation,omitempty"` +} + +func (x *GetModuleDocumentationResponse) Reset() { + *x = GetModuleDocumentationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetModuleDocumentationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetModuleDocumentationResponse) ProtoMessage() {} + +func (x *GetModuleDocumentationResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetModuleDocumentationResponse.ProtoReflect.Descriptor instead. +func (*GetModuleDocumentationResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{9} +} + +func (x *GetModuleDocumentationResponse) GetModuleDocumentation() *ModuleDocumentation { + if x != nil { + return x.ModuleDocumentation + } + return nil +} + +// ModuleDocumentation provides the name of the module and associated documentations. +type ModuleDocumentation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // This is the string representation of the contents of the buf.md file for module-level documentation. + // + // The buf.md file is a part of the module. + // string is used to enforce UTF-8 encoding or 7-bit ASCII text. + Documentation string `protobuf:"bytes,3,opt,name=documentation,proto3" json:"documentation,omitempty"` + // This is the string representation of the contents of the LICENSE file for module-level license. + // + // The LICENSE file is a part of the module. + // string is used to enforce UTF-8 encoding or 7-bit ASCII text. + License string `protobuf:"bytes,4,opt,name=license,proto3" json:"license,omitempty"` + // documentation_path is the path of the file which contains the module documentation. + // + // either `buf.md`, `README.md` or `README.markdown`. + // if empty, assumes buf.md. + DocumentationPath string `protobuf:"bytes,5,opt,name=documentation_path,json=documentationPath,proto3" json:"documentation_path,omitempty"` +} + +func (x *ModuleDocumentation) Reset() { + *x = ModuleDocumentation{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModuleDocumentation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModuleDocumentation) ProtoMessage() {} + +func (x *ModuleDocumentation) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModuleDocumentation.ProtoReflect.Descriptor instead. +func (*ModuleDocumentation) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{10} +} + +func (x *ModuleDocumentation) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ModuleDocumentation) GetDocumentation() string { + if x != nil { + return x.Documentation + } + return "" +} + +func (x *ModuleDocumentation) GetLicense() string { + if x != nil { + return x.License + } + return "" +} + +func (x *ModuleDocumentation) GetDocumentationPath() string { + if x != nil { + return x.DocumentationPath + } + return "" +} + +// GetPackageDocumentationRequest takes an owner, repository, reference, and package name. +type GetPackageDocumentationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` + // this is the fully qualified package name. + PackageName string `protobuf:"bytes,4,opt,name=package_name,json=packageName,proto3" json:"package_name,omitempty"` +} + +func (x *GetPackageDocumentationRequest) Reset() { + *x = GetPackageDocumentationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPackageDocumentationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPackageDocumentationRequest) ProtoMessage() {} + +func (x *GetPackageDocumentationRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPackageDocumentationRequest.ProtoReflect.Descriptor instead. +func (*GetPackageDocumentationRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{11} +} + +func (x *GetPackageDocumentationRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetPackageDocumentationRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetPackageDocumentationRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +func (x *GetPackageDocumentationRequest) GetPackageName() string { + if x != nil { + return x.PackageName + } + return "" +} + +// GetPackageDocumentationReponse returns the documentation for the requested package. +type GetPackageDocumentationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PackageDocumentation *PackageDocumentation `protobuf:"bytes,1,opt,name=package_documentation,json=packageDocumentation,proto3" json:"package_documentation,omitempty"` +} + +func (x *GetPackageDocumentationResponse) Reset() { + *x = GetPackageDocumentationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPackageDocumentationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPackageDocumentationResponse) ProtoMessage() {} + +func (x *GetPackageDocumentationResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPackageDocumentationResponse.ProtoReflect.Descriptor instead. +func (*GetPackageDocumentationResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{12} +} + +func (x *GetPackageDocumentationResponse) GetPackageDocumentation() *PackageDocumentation { + if x != nil { + return x.PackageDocumentation + } + return nil +} + +// PackageDocumentation provides the name, description, and top level types defined in the package. +type PackageDocumentation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // description contains the package-level comment documentation. + // There is currently no convention for this. + // + // This is derived from the leading comments at the top level of the package. + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // services contains all the services defined in the package in alphabetical order. + Services []*Service `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` + // enums contains all the enums defined in the package in alphabetical order. + Enums []*Enum `protobuf:"bytes,4,rep,name=enums,proto3" json:"enums,omitempty"` + // messages contains all the messages defined in the package in alphabetical order. + Messages []*Message `protobuf:"bytes,5,rep,name=messages,proto3" json:"messages,omitempty"` + // extensions contains all the file level extensions in the package in alphabetical order. + FileExtensions []*FileExtension `protobuf:"bytes,6,rep,name=file_extensions,json=fileExtensions,proto3" json:"file_extensions,omitempty"` +} + +func (x *PackageDocumentation) Reset() { + *x = PackageDocumentation{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PackageDocumentation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PackageDocumentation) ProtoMessage() {} + +func (x *PackageDocumentation) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PackageDocumentation.ProtoReflect.Descriptor instead. +func (*PackageDocumentation) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{13} +} + +func (x *PackageDocumentation) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PackageDocumentation) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *PackageDocumentation) GetServices() []*Service { + if x != nil { + return x.Services + } + return nil +} + +func (x *PackageDocumentation) GetEnums() []*Enum { + if x != nil { + return x.Enums + } + return nil +} + +func (x *PackageDocumentation) GetMessages() []*Message { + if x != nil { + return x.Messages + } + return nil +} + +func (x *PackageDocumentation) GetFileExtensions() []*FileExtension { + if x != nil { + return x.FileExtensions + } + return nil +} + +// Location provides the location information for the source code. +// +// This does not provide the leading or trailing comments as these will +// be parsed into descriptions or dropped respectively. +type Location struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StartLine int32 `protobuf:"varint,1,opt,name=start_line,json=startLine,proto3" json:"start_line,omitempty"` + StartColumn int32 `protobuf:"varint,2,opt,name=start_column,json=startColumn,proto3" json:"start_column,omitempty"` + EndLine int32 `protobuf:"varint,3,opt,name=end_line,json=endLine,proto3" json:"end_line,omitempty"` + EndColumn int32 `protobuf:"varint,4,opt,name=end_column,json=endColumn,proto3" json:"end_column,omitempty"` +} + +func (x *Location) Reset() { + *x = Location{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Location) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Location) ProtoMessage() {} + +func (x *Location) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Location.ProtoReflect.Descriptor instead. +func (*Location) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{14} +} + +func (x *Location) GetStartLine() int32 { + if x != nil { + return x.StartLine + } + return 0 +} + +func (x *Location) GetStartColumn() int32 { + if x != nil { + return x.StartColumn + } + return 0 +} + +func (x *Location) GetEndLine() int32 { + if x != nil { + return x.EndLine + } + return 0 +} + +func (x *Location) GetEndColumn() int32 { + if x != nil { + return x.EndColumn + } + return 0 +} + +// Service provides information for the documentation for a given service type in a file. +type Service struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // nested_name includes the nested types for a given type definition. + NestedName string `protobuf:"bytes,2,opt,name=nested_name,json=nestedName,proto3" json:"nested_name,omitempty"` + // full_name includes the package name and nested types for a given type definition. + FullName string `protobuf:"bytes,3,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` + // description is derived from the leading comments of a given service. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + // file_path is the normalized path of the file containing the service. + // This is used for navigating to the source code for the service. + FilePath string `protobuf:"bytes,5,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + Location *Location `protobuf:"bytes,6,opt,name=location,proto3" json:"location,omitempty"` + Methods []*Method `protobuf:"bytes,7,rep,name=methods,proto3" json:"methods,omitempty"` + ServiceOptions *ServiceOptions `protobuf:"bytes,8,opt,name=service_options,json=serviceOptions,proto3" json:"service_options,omitempty"` + // implicitly_deprecated is true if its enclosing file is deprecated. + ImplicitlyDeprecated bool `protobuf:"varint,9,opt,name=implicitly_deprecated,json=implicitlyDeprecated,proto3" json:"implicitly_deprecated,omitempty"` +} + +func (x *Service) Reset() { + *x = Service{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Service) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Service) ProtoMessage() {} + +func (x *Service) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Service.ProtoReflect.Descriptor instead. +func (*Service) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{15} +} + +func (x *Service) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Service) GetNestedName() string { + if x != nil { + return x.NestedName + } + return "" +} + +func (x *Service) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +func (x *Service) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Service) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + +func (x *Service) GetLocation() *Location { + if x != nil { + return x.Location + } + return nil +} + +func (x *Service) GetMethods() []*Method { + if x != nil { + return x.Methods + } + return nil +} + +func (x *Service) GetServiceOptions() *ServiceOptions { + if x != nil { + return x.ServiceOptions + } + return nil +} + +func (x *Service) GetImplicitlyDeprecated() bool { + if x != nil { + return x.ImplicitlyDeprecated + } + return false +} + +// ServiceOptions provides information for the documentation of options for a given service. +type ServiceOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Deprecated bool `protobuf:"varint,1,opt,name=deprecated,proto3" json:"deprecated,omitempty"` +} + +func (x *ServiceOptions) Reset() { + *x = ServiceOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServiceOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceOptions) ProtoMessage() {} + +func (x *ServiceOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceOptions.ProtoReflect.Descriptor instead. +func (*ServiceOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{16} +} + +func (x *ServiceOptions) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +// Method provides information for the documentation for a method of a given service. +type Method struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // description is derived from the leading comments of a given method. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Request *MethodRequestResponse `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"` + Response *MethodRequestResponse `protobuf:"bytes,4,opt,name=response,proto3" json:"response,omitempty"` + MethodOptions *MethodOptions `protobuf:"bytes,5,opt,name=method_options,json=methodOptions,proto3" json:"method_options,omitempty"` + // implicitly_deprecated is true if its enclosing file or parent element is deprecated. + ImplicitlyDeprecated bool `protobuf:"varint,6,opt,name=implicitly_deprecated,json=implicitlyDeprecated,proto3" json:"implicitly_deprecated,omitempty"` +} + +func (x *Method) Reset() { + *x = Method{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Method) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Method) ProtoMessage() {} + +func (x *Method) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Method.ProtoReflect.Descriptor instead. +func (*Method) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{17} +} + +func (x *Method) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Method) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Method) GetRequest() *MethodRequestResponse { + if x != nil { + return x.Request + } + return nil +} + +func (x *Method) GetResponse() *MethodRequestResponse { + if x != nil { + return x.Response + } + return nil +} + +func (x *Method) GetMethodOptions() *MethodOptions { + if x != nil { + return x.MethodOptions + } + return nil +} + +func (x *Method) GetImplicitlyDeprecated() bool { + if x != nil { + return x.ImplicitlyDeprecated + } + return false +} + +// MethodOptions provides information for the documentation of options for a method. +type MethodOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Deprecated bool `protobuf:"varint,1,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + // idempotency_level holds a value of the enumeration `google.protobuf.MethodOptions.IdempotencyLevel. + IdempotencyLevel int32 `protobuf:"varint,2,opt,name=idempotency_level,json=idempotencyLevel,proto3" json:"idempotency_level,omitempty"` +} + +func (x *MethodOptions) Reset() { + *x = MethodOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MethodOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MethodOptions) ProtoMessage() {} + +func (x *MethodOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MethodOptions.ProtoReflect.Descriptor instead. +func (*MethodOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{18} +} + +func (x *MethodOptions) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *MethodOptions) GetIdempotencyLevel() int32 { + if x != nil { + return x.IdempotencyLevel + } + return 0 +} + +// MethodRequestResponse provides information for the documentation of a Method request or response message. +type MethodRequestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // nested_type is the nested name of the message of the request or response. This includes nested definitions. + NestedType string `protobuf:"bytes,1,opt,name=nested_type,json=nestedType,proto3" json:"nested_type,omitempty"` + // full_type is the fully qualified name of the message of the request or response. This includes package and nested definitions. + FullType string `protobuf:"bytes,2,opt,name=full_type,json=fullType,proto3" json:"full_type,omitempty"` + // boolean flag for whether the streaming label is set on an method request or response. + Streaming bool `protobuf:"varint,3,opt,name=streaming,proto3" json:"streaming,omitempty"` + Message *Message `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` + // import_module_ref is included if the request or response is an imported type. + // It contains all the metadata for the import. + ImportModuleRef *ImportModuleRef `protobuf:"bytes,5,opt,name=import_module_ref,json=importModuleRef,proto3" json:"import_module_ref,omitempty"` +} + +func (x *MethodRequestResponse) Reset() { + *x = MethodRequestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MethodRequestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MethodRequestResponse) ProtoMessage() {} + +func (x *MethodRequestResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MethodRequestResponse.ProtoReflect.Descriptor instead. +func (*MethodRequestResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{19} +} + +func (x *MethodRequestResponse) GetNestedType() string { + if x != nil { + return x.NestedType + } + return "" +} + +func (x *MethodRequestResponse) GetFullType() string { + if x != nil { + return x.FullType + } + return "" +} + +func (x *MethodRequestResponse) GetStreaming() bool { + if x != nil { + return x.Streaming + } + return false +} + +func (x *MethodRequestResponse) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +func (x *MethodRequestResponse) GetImportModuleRef() *ImportModuleRef { + if x != nil { + return x.ImportModuleRef + } + return nil +} + +// Enum provides information for the documentation of an enum. +type Enum struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // nested_name includes the nested types for a given type definition. + NestedName string `protobuf:"bytes,2,opt,name=nested_name,json=nestedName,proto3" json:"nested_name,omitempty"` + // full_name includes the package name and nested types for a given type definition. + FullName string `protobuf:"bytes,3,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` + // description is derived from the leading comments of a given Enum. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + // file_path is the normalized path of the file containing the enum. + FilePath string `protobuf:"bytes,5,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + Location *Location `protobuf:"bytes,6,opt,name=location,proto3" json:"location,omitempty"` + Values []*EnumValue `protobuf:"bytes,7,rep,name=values,proto3" json:"values,omitempty"` + EnumOptions *EnumOptions `protobuf:"bytes,8,opt,name=enum_options,json=enumOptions,proto3" json:"enum_options,omitempty"` + // implicitly_deprecated is true if its enclosing file or parent element is deprecated. + ImplicitlyDeprecated bool `protobuf:"varint,9,opt,name=implicitly_deprecated,json=implicitlyDeprecated,proto3" json:"implicitly_deprecated,omitempty"` +} + +func (x *Enum) Reset() { + *x = Enum{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Enum) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Enum) ProtoMessage() {} + +func (x *Enum) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Enum.ProtoReflect.Descriptor instead. +func (*Enum) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{20} +} + +func (x *Enum) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Enum) GetNestedName() string { + if x != nil { + return x.NestedName + } + return "" +} + +func (x *Enum) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +func (x *Enum) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Enum) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + +func (x *Enum) GetLocation() *Location { + if x != nil { + return x.Location + } + return nil +} + +func (x *Enum) GetValues() []*EnumValue { + if x != nil { + return x.Values + } + return nil +} + +func (x *Enum) GetEnumOptions() *EnumOptions { + if x != nil { + return x.EnumOptions + } + return nil +} + +func (x *Enum) GetImplicitlyDeprecated() bool { + if x != nil { + return x.ImplicitlyDeprecated + } + return false +} + +// EnumOptions provides information for the documentation of options for an enum. +type EnumOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Deprecated bool `protobuf:"varint,1,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + AllowAlias bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias,proto3" json:"allow_alias,omitempty"` +} + +func (x *EnumOptions) Reset() { + *x = EnumOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumOptions) ProtoMessage() {} + +func (x *EnumOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumOptions.ProtoReflect.Descriptor instead. +func (*EnumOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{21} +} + +func (x *EnumOptions) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *EnumOptions) GetAllowAlias() bool { + if x != nil { + return x.AllowAlias + } + return false +} + +// EnumValue provides information for the documentation of an enum value. +type EnumValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Number int32 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` + // description is derived from the leading comments of a given enum value. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + EnumValueOptions *EnumValueOptions `protobuf:"bytes,4,opt,name=enum_value_options,json=enumValueOptions,proto3" json:"enum_value_options,omitempty"` +} + +func (x *EnumValue) Reset() { + *x = EnumValue{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumValue) ProtoMessage() {} + +func (x *EnumValue) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumValue.ProtoReflect.Descriptor instead. +func (*EnumValue) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{22} +} + +func (x *EnumValue) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *EnumValue) GetNumber() int32 { + if x != nil { + return x.Number + } + return 0 +} + +func (x *EnumValue) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *EnumValue) GetEnumValueOptions() *EnumValueOptions { + if x != nil { + return x.EnumValueOptions + } + return nil +} + +// EnumValueOptions provides information for the documentation of options for an enum value. +type EnumValueOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Deprecated bool `protobuf:"varint,1,opt,name=deprecated,proto3" json:"deprecated,omitempty"` +} + +func (x *EnumValueOptions) Reset() { + *x = EnumValueOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumValueOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumValueOptions) ProtoMessage() {} + +func (x *EnumValueOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumValueOptions.ProtoReflect.Descriptor instead. +func (*EnumValueOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{23} +} + +func (x *EnumValueOptions) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +// ImportRef provides the import metadata if a type is imported. +type ImportModuleRef struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Remote string `protobuf:"bytes,1,opt,name=remote,proto3" json:"remote,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,3,opt,name=repository,proto3" json:"repository,omitempty"` + // the commit is based on the module commit of the imported type provided + // by the image. + Commit string `protobuf:"bytes,4,opt,name=commit,proto3" json:"commit,omitempty"` + PackageName string `protobuf:"bytes,5,opt,name=package_name,json=packageName,proto3" json:"package_name,omitempty"` +} + +func (x *ImportModuleRef) Reset() { + *x = ImportModuleRef{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportModuleRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportModuleRef) ProtoMessage() {} + +func (x *ImportModuleRef) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportModuleRef.ProtoReflect.Descriptor instead. +func (*ImportModuleRef) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{24} +} + +func (x *ImportModuleRef) GetRemote() string { + if x != nil { + return x.Remote + } + return "" +} + +func (x *ImportModuleRef) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ImportModuleRef) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *ImportModuleRef) GetCommit() string { + if x != nil { + return x.Commit + } + return "" +} + +func (x *ImportModuleRef) GetPackageName() string { + if x != nil { + return x.PackageName + } + return "" +} + +// Message provides information for the documentation of a protobuf message. +type Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // nested_name includes the nested types for a given type definition. + NestedName string `protobuf:"bytes,2,opt,name=nested_name,json=nestedName,proto3" json:"nested_name,omitempty"` + // full_name includes the package name and nested types for a given type definition. + FullName string `protobuf:"bytes,3,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` + // description is derived from the leading comments of a given message. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + // file_path is the normalized path of the file containing the message. + FilePath string `protobuf:"bytes,5,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + IsMapEntry bool `protobuf:"varint,6,opt,name=is_map_entry,json=isMapEntry,proto3" json:"is_map_entry,omitempty"` + Fields []*MessageField `protobuf:"bytes,7,rep,name=fields,proto3" json:"fields,omitempty"` + Location *Location `protobuf:"bytes,8,opt,name=location,proto3" json:"location,omitempty"` + MessageExtensions []*Field `protobuf:"bytes,9,rep,name=message_extensions,json=messageExtensions,proto3" json:"message_extensions,omitempty"` + MessageOptions *MessageOptions `protobuf:"bytes,10,opt,name=message_options,json=messageOptions,proto3" json:"message_options,omitempty"` + // implicitly_deprecated is true if its enclosing file or parent element is deprecated. + ImplicitlyDeprecated bool `protobuf:"varint,11,opt,name=implicitly_deprecated,json=implicitlyDeprecated,proto3" json:"implicitly_deprecated,omitempty"` +} + +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Message.ProtoReflect.Descriptor instead. +func (*Message) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{25} +} + +func (x *Message) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Message) GetNestedName() string { + if x != nil { + return x.NestedName + } + return "" +} + +func (x *Message) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +func (x *Message) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Message) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + +func (x *Message) GetIsMapEntry() bool { + if x != nil { + return x.IsMapEntry + } + return false +} + +func (x *Message) GetFields() []*MessageField { + if x != nil { + return x.Fields + } + return nil +} + +func (x *Message) GetLocation() *Location { + if x != nil { + return x.Location + } + return nil +} + +func (x *Message) GetMessageExtensions() []*Field { + if x != nil { + return x.MessageExtensions + } + return nil +} + +func (x *Message) GetMessageOptions() *MessageOptions { + if x != nil { + return x.MessageOptions + } + return nil +} + +func (x *Message) GetImplicitlyDeprecated() bool { + if x != nil { + return x.ImplicitlyDeprecated + } + return false +} + +// MessageField can be either a single field or a oneof set of fields. +type MessageField struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to MessageField: + // + // *MessageField_Field + // *MessageField_Oneof + MessageField isMessageField_MessageField `protobuf_oneof:"message_field"` +} + +func (x *MessageField) Reset() { + *x = MessageField{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageField) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageField) ProtoMessage() {} + +func (x *MessageField) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageField.ProtoReflect.Descriptor instead. +func (*MessageField) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{26} +} + +func (m *MessageField) GetMessageField() isMessageField_MessageField { + if m != nil { + return m.MessageField + } + return nil +} + +func (x *MessageField) GetField() *Field { + if x, ok := x.GetMessageField().(*MessageField_Field); ok { + return x.Field + } + return nil +} + +func (x *MessageField) GetOneof() *Oneof { + if x, ok := x.GetMessageField().(*MessageField_Oneof); ok { + return x.Oneof + } + return nil +} + +type isMessageField_MessageField interface { + isMessageField_MessageField() +} + +type MessageField_Field struct { + Field *Field `protobuf:"bytes,1,opt,name=field,proto3,oneof"` +} + +type MessageField_Oneof struct { + Oneof *Oneof `protobuf:"bytes,2,opt,name=oneof,proto3,oneof"` +} + +func (*MessageField_Field) isMessageField_MessageField() {} + +func (*MessageField_Oneof) isMessageField_MessageField() {} + +// MessageOptions provides information for the documentation of options for a message. +type MessageOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Deprecated bool `protobuf:"varint,1,opt,name=deprecated,proto3" json:"deprecated,omitempty"` +} + +func (x *MessageOptions) Reset() { + *x = MessageOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageOptions) ProtoMessage() {} + +func (x *MessageOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageOptions.ProtoReflect.Descriptor instead. +func (*MessageOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{27} +} + +func (x *MessageOptions) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +// Oneof represents a oneof set of fields. +type Oneof struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Fields []*Field `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"` +} + +func (x *Oneof) Reset() { + *x = Oneof{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Oneof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Oneof) ProtoMessage() {} + +func (x *Oneof) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Oneof.ProtoReflect.Descriptor instead. +func (*Oneof) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{28} +} + +func (x *Oneof) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Oneof) GetFields() []*Field { + if x != nil { + return x.Fields + } + return nil +} + +// Field provides information for the documentation of a message field. +type Field struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // description is derived from the leading comments of a given message field. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + // string representation of the nested name of the field type, which includes nested definitions. + NestedType string `protobuf:"bytes,4,opt,name=nested_type,json=nestedType,proto3" json:"nested_type,omitempty"` + // string representation of the full name of the field type, which includes package name + // and nested definitions. + FullType string `protobuf:"bytes,5,opt,name=full_type,json=fullType,proto3" json:"full_type,omitempty"` + Tag uint32 `protobuf:"varint,6,opt,name=tag,proto3" json:"tag,omitempty"` + // MapEntry is present if the field is a map type. + MapEntry *MapEntry `protobuf:"bytes,7,opt,name=map_entry,json=mapEntry,proto3" json:"map_entry,omitempty"` + // import_module_ref is included if the field is an imported type. + // It contains all the metadata for the import. + ImportModuleRef *ImportModuleRef `protobuf:"bytes,8,opt,name=import_module_ref,json=importModuleRef,proto3" json:"import_module_ref,omitempty"` + // Extendee is the name of the type that is being extended if the field is an extension. + // This is an empty string for fields that are not extenions. + Extendee string `protobuf:"bytes,9,opt,name=extendee,proto3" json:"extendee,omitempty"` + FieldOptions *FieldOptions `protobuf:"bytes,10,opt,name=field_options,json=fieldOptions,proto3" json:"field_options,omitempty"` +} + +func (x *Field) Reset() { + *x = Field{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Field) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Field) ProtoMessage() {} + +func (x *Field) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Field.ProtoReflect.Descriptor instead. +func (*Field) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{29} +} + +func (x *Field) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Field) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Field) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *Field) GetNestedType() string { + if x != nil { + return x.NestedType + } + return "" +} + +func (x *Field) GetFullType() string { + if x != nil { + return x.FullType + } + return "" +} + +func (x *Field) GetTag() uint32 { + if x != nil { + return x.Tag + } + return 0 +} + +func (x *Field) GetMapEntry() *MapEntry { + if x != nil { + return x.MapEntry + } + return nil +} + +func (x *Field) GetImportModuleRef() *ImportModuleRef { + if x != nil { + return x.ImportModuleRef + } + return nil +} + +func (x *Field) GetExtendee() string { + if x != nil { + return x.Extendee + } + return "" +} + +func (x *Field) GetFieldOptions() *FieldOptions { + if x != nil { + return x.FieldOptions + } + return nil +} + +// FieldOptions provides information for the documentation of options for a field. +type FieldOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Deprecated bool `protobuf:"varint,1,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + Packed *bool `protobuf:"varint,2,opt,name=packed,proto3,oneof" json:"packed,omitempty"` + // ctype holds a value of the enumeration `google.protobuf.FieldOptions.CType. + Ctype int32 `protobuf:"varint,3,opt,name=ctype,proto3" json:"ctype,omitempty"` + // jstype holds a value of the enumeration `google.protobuf.FieldOptions.JSType. + Jstype int32 `protobuf:"varint,4,opt,name=jstype,proto3" json:"jstype,omitempty"` +} + +func (x *FieldOptions) Reset() { + *x = FieldOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldOptions) ProtoMessage() {} + +func (x *FieldOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldOptions.ProtoReflect.Descriptor instead. +func (*FieldOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{30} +} + +func (x *FieldOptions) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *FieldOptions) GetPacked() bool { + if x != nil && x.Packed != nil { + return *x.Packed + } + return false +} + +func (x *FieldOptions) GetCtype() int32 { + if x != nil { + return x.Ctype + } + return 0 +} + +func (x *FieldOptions) GetJstype() int32 { + if x != nil { + return x.Jstype + } + return 0 +} + +// MapEntry provides the key and value types for the MapEntry type for a map field. +type MapEntry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // string representation of the full name of the type for the map key. keys can only be + // scalar types: https://developers.google.com/protocol-buffers/docs/overview#maps + KeyFullType string `protobuf:"bytes,1,opt,name=key_full_type,json=keyFullType,proto3" json:"key_full_type,omitempty"` + // string representation of the nested name of the type for the map value. + ValueNestedType string `protobuf:"bytes,2,opt,name=value_nested_type,json=valueNestedType,proto3" json:"value_nested_type,omitempty"` + // string representation of the full name of the type for the map value. + ValueFullType string `protobuf:"bytes,3,opt,name=value_full_type,json=valueFullType,proto3" json:"value_full_type,omitempty"` + // if the value is an imported type, this is the import module ref + ValueImportModuleRef *ImportModuleRef `protobuf:"bytes,4,opt,name=value_import_module_ref,json=valueImportModuleRef,proto3" json:"value_import_module_ref,omitempty"` +} + +func (x *MapEntry) Reset() { + *x = MapEntry{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MapEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MapEntry) ProtoMessage() {} + +func (x *MapEntry) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MapEntry.ProtoReflect.Descriptor instead. +func (*MapEntry) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{31} +} + +func (x *MapEntry) GetKeyFullType() string { + if x != nil { + return x.KeyFullType + } + return "" +} + +func (x *MapEntry) GetValueNestedType() string { + if x != nil { + return x.ValueNestedType + } + return "" +} + +func (x *MapEntry) GetValueFullType() string { + if x != nil { + return x.ValueFullType + } + return "" +} + +func (x *MapEntry) GetValueImportModuleRef() *ImportModuleRef { + if x != nil { + return x.ValueImportModuleRef + } + return nil +} + +// FileExtension provides the information for the documentation of a file extension. +type FileExtension struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // extension_type is the string representation of the type being extended. + ExtensionType string `protobuf:"bytes,1,opt,name=extension_type,json=extensionType,proto3" json:"extension_type,omitempty"` + // description is derived from the leading comments of a given message field. + // + // Paragraph newlines (double new lines) are respected, however single newlines are not. + // Note that any leading and trailing `//` or spaces within a `/* */` block will be stripped. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // file_path is the normalized path of the file containing the message. + FilePath string `protobuf:"bytes,3,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + Location *Location `protobuf:"bytes,4,opt,name=location,proto3" json:"location,omitempty"` + // fields are all the fields that are associated with the extension. + Fields []*Field `protobuf:"bytes,5,rep,name=fields,proto3" json:"fields,omitempty"` + // implicitly_deprecated is true if its enclosing file or parent element is deprecated. + ImplicitlyDeprecated bool `protobuf:"varint,6,opt,name=implicitly_deprecated,json=implicitlyDeprecated,proto3" json:"implicitly_deprecated,omitempty"` +} + +func (x *FileExtension) Reset() { + *x = FileExtension{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileExtension) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileExtension) ProtoMessage() {} + +func (x *FileExtension) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_doc_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileExtension.ProtoReflect.Descriptor instead. +func (*FileExtension) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_doc_proto_rawDescGZIP(), []int{32} +} + +func (x *FileExtension) GetExtensionType() string { + if x != nil { + return x.ExtensionType + } + return "" +} + +func (x *FileExtension) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *FileExtension) GetFilePath() string { + if x != nil { + return x.FilePath + } + return "" +} + +func (x *FileExtension) GetLocation() *Location { + if x != nil { + return x.Location + } + return nil +} + +func (x *FileExtension) GetFields() []*Field { + if x != nil { + return x.Fields + } + return nil +} + +func (x *FileExtension) GetImplicitlyDeprecated() bool { + if x != nil { + return x.ImplicitlyDeprecated + } + return false +} + +var File_registry_v1alpha1_doc_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_doc_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x64, 0x6f, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, 0x73, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, + 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, + 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x69, 0x0a, + 0x1e, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x47, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x22, 0x86, 0x01, 0x0a, 0x08, 0x46, 0x69, 0x6c, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x69, 0x73, 0x5f, + 0x64, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x44, 0x69, 0x72, + 0x12, 0x4f, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, + 0x6e, 0x22, 0x7e, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, + 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, + 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x22, 0x31, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x22, 0x6e, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x61, 0x0a, 0x0f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x0e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, 0x45, 0x0a, 0x0d, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0x73, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x44, 0x6f, 0x63, + 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x14, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x5f, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x44, 0x6f, + 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x98, 0x01, 0x0a, 0x13, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, + 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, + 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x64, 0x6f, 0x63, 0x75, 0x6d, + 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x11, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x50, 0x61, 0x74, 0x68, 0x22, 0x97, 0x01, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, + 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, + 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x21, 0x0a, + 0x0c, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x22, 0x97, 0x01, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x44, + 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x15, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, + 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x14, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x44, 0x6f, 0x63, + 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x96, 0x03, 0x0a, 0x14, 0x50, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x08, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, + 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x05, 0x65, 0x6e, 0x75, + 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, + 0x12, 0x4e, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, + 0x12, 0x61, 0x0a, 0x0f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x66, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x22, 0x86, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x69, 0x6e, 0x65, 0x12, + 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x1d, 0x0a, + 0x0a, 0x65, 0x6e, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0xd1, 0x03, 0x0a, + 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, + 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, + 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x4f, 0x0a, 0x08, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4b, 0x0a, 0x07, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x07, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x62, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x15, 0x69, + 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x69, 0x6d, 0x70, 0x6c, + 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x22, 0x30, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x22, 0x8e, 0x03, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x5a, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x5c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, + 0x0e, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x0d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, + 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x5f, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x69, + 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x22, 0x5c, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, + 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x10, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, + 0x6c, 0x22, 0xa9, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, + 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x4c, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x66, 0x0a, 0x11, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x0f, 0x69, 0x6d, + 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x22, 0xc6, 0x03, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x65, + 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, + 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, + 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x4f, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4c, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x0c, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, 0x65, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x33, 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x5f, + 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x14, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x44, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0x4e, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, + 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x22, 0xc4, 0x01, 0x0a, 0x09, 0x45, 0x6e, 0x75, 0x6d, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x69, 0x0a, 0x12, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x10, 0x65, 0x6e, 0x75, + 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x32, 0x0a, + 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x22, 0x9a, 0x01, 0x0a, 0x0f, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x52, 0x65, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x70, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xd8, + 0x04, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, + 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x20, 0x0a, 0x0c, 0x69, + 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0a, 0x69, 0x73, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x4f, 0x0a, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x4f, + 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x5f, 0x0a, 0x12, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x11, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x62, 0x0a, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, + 0x6c, 0x79, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x14, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x44, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0xb3, 0x01, 0x0a, 0x0c, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x48, 0x0a, 0x05, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x00, 0x52, 0x05, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x12, 0x48, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x42, 0x0f, + 0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, + 0x30, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x22, 0x65, 0x0a, 0x05, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x48, + 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0xd7, 0x03, 0x0a, 0x05, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1f, + 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x74, 0x61, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x50, + 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x61, + 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x66, 0x0a, 0x11, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x0f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x65, 0x12, 0x5c, 0x0a, 0x0d, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x88, 0x01, 0x01, + 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x22, 0xf5, 0x01, 0x0a, 0x08, 0x4d, 0x61, + 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x75, + 0x6c, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6b, + 0x65, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, + 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x46, 0x75, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x71, + 0x0a, 0x17, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x6d, 0x70, 0x6f, + 0x72, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x14, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, + 0x66, 0x22, 0xc5, 0x02, 0x0a, 0x0d, 0x46, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, + 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x4f, 0x0a, 0x08, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x73, 0x12, 0x33, 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, + 0x6c, 0x79, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x14, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x6c, 0x79, 0x44, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x32, 0xee, 0x06, 0x0a, 0x0a, 0x44, 0x6f, + 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb2, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x49, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x97, 0x01, + 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, + 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa3, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x12, 0x43, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb2, 0x01, + 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, + 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x44, 0x6f, + 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0xb5, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x49, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe3, 0x02, 0x0a, 0x2d, 0x63, + 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x08, 0x44, 0x6f, + 0x63, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, + 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, + 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, + 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_doc_proto_rawDescOnce sync.Once + file_registry_v1alpha1_doc_proto_rawDescData = file_registry_v1alpha1_doc_proto_rawDesc +) + +func file_registry_v1alpha1_doc_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_doc_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_doc_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_doc_proto_rawDescData) + }) + return file_registry_v1alpha1_doc_proto_rawDescData +} + +var file_registry_v1alpha1_doc_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_registry_v1alpha1_doc_proto_goTypes = []interface{}{ + (*GetSourceDirectoryInfoRequest)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetSourceDirectoryInfoRequest + (*GetSourceDirectoryInfoResponse)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetSourceDirectoryInfoResponse + (*FileInfo)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.FileInfo + (*GetSourceFileRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetSourceFileRequest + (*GetSourceFileResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.GetSourceFileResponse + (*GetModulePackagesRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.GetModulePackagesRequest + (*GetModulePackagesResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.GetModulePackagesResponse + (*ModulePackage)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.ModulePackage + (*GetModuleDocumentationRequest)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetModuleDocumentationRequest + (*GetModuleDocumentationResponse)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetModuleDocumentationResponse + (*ModuleDocumentation)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.ModuleDocumentation + (*GetPackageDocumentationRequest)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.GetPackageDocumentationRequest + (*GetPackageDocumentationResponse)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.GetPackageDocumentationResponse + (*PackageDocumentation)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.PackageDocumentation + (*Location)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.Location + (*Service)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.Service + (*ServiceOptions)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.ServiceOptions + (*Method)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.Method + (*MethodOptions)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.MethodOptions + (*MethodRequestResponse)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.MethodRequestResponse + (*Enum)(nil), // 20: bufman.dubbo.apache.org.registry.v1alpha1.Enum + (*EnumOptions)(nil), // 21: bufman.dubbo.apache.org.registry.v1alpha1.EnumOptions + (*EnumValue)(nil), // 22: bufman.dubbo.apache.org.registry.v1alpha1.EnumValue + (*EnumValueOptions)(nil), // 23: bufman.dubbo.apache.org.registry.v1alpha1.EnumValueOptions + (*ImportModuleRef)(nil), // 24: bufman.dubbo.apache.org.registry.v1alpha1.ImportModuleRef + (*Message)(nil), // 25: bufman.dubbo.apache.org.registry.v1alpha1.Message + (*MessageField)(nil), // 26: bufman.dubbo.apache.org.registry.v1alpha1.MessageField + (*MessageOptions)(nil), // 27: bufman.dubbo.apache.org.registry.v1alpha1.MessageOptions + (*Oneof)(nil), // 28: bufman.dubbo.apache.org.registry.v1alpha1.Oneof + (*Field)(nil), // 29: bufman.dubbo.apache.org.registry.v1alpha1.Field + (*FieldOptions)(nil), // 30: bufman.dubbo.apache.org.registry.v1alpha1.FieldOptions + (*MapEntry)(nil), // 31: bufman.dubbo.apache.org.registry.v1alpha1.MapEntry + (*FileExtension)(nil), // 32: bufman.dubbo.apache.org.registry.v1alpha1.FileExtension +} +var file_registry_v1alpha1_doc_proto_depIdxs = []int32{ + 2, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetSourceDirectoryInfoResponse.root:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.FileInfo + 2, // 1: bufman.dubbo.apache.org.registry.v1alpha1.FileInfo.children:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.FileInfo + 7, // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetModulePackagesResponse.module_packages:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ModulePackage + 10, // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetModuleDocumentationResponse.module_documentation:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ModuleDocumentation + 13, // 4: bufman.dubbo.apache.org.registry.v1alpha1.GetPackageDocumentationResponse.package_documentation:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PackageDocumentation + 15, // 5: bufman.dubbo.apache.org.registry.v1alpha1.PackageDocumentation.services:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Service + 20, // 6: bufman.dubbo.apache.org.registry.v1alpha1.PackageDocumentation.enums:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Enum + 25, // 7: bufman.dubbo.apache.org.registry.v1alpha1.PackageDocumentation.messages:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Message + 32, // 8: bufman.dubbo.apache.org.registry.v1alpha1.PackageDocumentation.file_extensions:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.FileExtension + 14, // 9: bufman.dubbo.apache.org.registry.v1alpha1.Service.location:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Location + 17, // 10: bufman.dubbo.apache.org.registry.v1alpha1.Service.methods:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Method + 16, // 11: bufman.dubbo.apache.org.registry.v1alpha1.Service.service_options:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ServiceOptions + 19, // 12: bufman.dubbo.apache.org.registry.v1alpha1.Method.request:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MethodRequestResponse + 19, // 13: bufman.dubbo.apache.org.registry.v1alpha1.Method.response:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MethodRequestResponse + 18, // 14: bufman.dubbo.apache.org.registry.v1alpha1.Method.method_options:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MethodOptions + 25, // 15: bufman.dubbo.apache.org.registry.v1alpha1.MethodRequestResponse.message:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Message + 24, // 16: bufman.dubbo.apache.org.registry.v1alpha1.MethodRequestResponse.import_module_ref:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ImportModuleRef + 14, // 17: bufman.dubbo.apache.org.registry.v1alpha1.Enum.location:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Location + 22, // 18: bufman.dubbo.apache.org.registry.v1alpha1.Enum.values:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.EnumValue + 21, // 19: bufman.dubbo.apache.org.registry.v1alpha1.Enum.enum_options:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.EnumOptions + 23, // 20: bufman.dubbo.apache.org.registry.v1alpha1.EnumValue.enum_value_options:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.EnumValueOptions + 26, // 21: bufman.dubbo.apache.org.registry.v1alpha1.Message.fields:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MessageField + 14, // 22: bufman.dubbo.apache.org.registry.v1alpha1.Message.location:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Location + 29, // 23: bufman.dubbo.apache.org.registry.v1alpha1.Message.message_extensions:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Field + 27, // 24: bufman.dubbo.apache.org.registry.v1alpha1.Message.message_options:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MessageOptions + 29, // 25: bufman.dubbo.apache.org.registry.v1alpha1.MessageField.field:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Field + 28, // 26: bufman.dubbo.apache.org.registry.v1alpha1.MessageField.oneof:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Oneof + 29, // 27: bufman.dubbo.apache.org.registry.v1alpha1.Oneof.fields:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Field + 31, // 28: bufman.dubbo.apache.org.registry.v1alpha1.Field.map_entry:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MapEntry + 24, // 29: bufman.dubbo.apache.org.registry.v1alpha1.Field.import_module_ref:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ImportModuleRef + 30, // 30: bufman.dubbo.apache.org.registry.v1alpha1.Field.field_options:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.FieldOptions + 24, // 31: bufman.dubbo.apache.org.registry.v1alpha1.MapEntry.value_import_module_ref:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ImportModuleRef + 14, // 32: bufman.dubbo.apache.org.registry.v1alpha1.FileExtension.location:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Location + 29, // 33: bufman.dubbo.apache.org.registry.v1alpha1.FileExtension.fields:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Field + 0, // 34: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceDirectoryInfo:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetSourceDirectoryInfoRequest + 3, // 35: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceFile:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetSourceFileRequest + 5, // 36: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModulePackages:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetModulePackagesRequest + 8, // 37: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModuleDocumentation:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetModuleDocumentationRequest + 11, // 38: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetPackageDocumentation:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetPackageDocumentationRequest + 1, // 39: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceDirectoryInfo:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetSourceDirectoryInfoResponse + 4, // 40: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetSourceFile:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetSourceFileResponse + 6, // 41: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModulePackages:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetModulePackagesResponse + 9, // 42: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetModuleDocumentation:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetModuleDocumentationResponse + 12, // 43: bufman.dubbo.apache.org.registry.v1alpha1.DocService.GetPackageDocumentation:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetPackageDocumentationResponse + 39, // [39:44] is the sub-list for method output_type + 34, // [34:39] is the sub-list for method input_type + 34, // [34:34] is the sub-list for extension type_name + 34, // [34:34] is the sub-list for extension extendee + 0, // [0:34] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_doc_proto_init() } +func file_registry_v1alpha1_doc_proto_init() { + if File_registry_v1alpha1_doc_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_doc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSourceDirectoryInfoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSourceDirectoryInfoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSourceFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSourceFileResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetModulePackagesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetModulePackagesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModulePackage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetModuleDocumentationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetModuleDocumentationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModuleDocumentation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPackageDocumentationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPackageDocumentationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PackageDocumentation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Location); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Service); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServiceOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Method); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MethodOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MethodRequestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Enum); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumValueOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportModuleRef); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageField); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Oneof); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Field); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FieldOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MapEntry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_doc_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileExtension); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_doc_proto_msgTypes[26].OneofWrappers = []interface{}{ + (*MessageField_Field)(nil), + (*MessageField_Oneof)(nil), + } + file_registry_v1alpha1_doc_proto_msgTypes[30].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_doc_proto_rawDesc, + NumEnums: 0, + NumMessages: 33, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_doc_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_doc_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_doc_proto_msgTypes, + }.Build() + File_registry_v1alpha1_doc_proto = out.File + file_registry_v1alpha1_doc_proto_rawDesc = nil + file_registry_v1alpha1_doc_proto_goTypes = nil + file_registry_v1alpha1_doc_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/doc_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/doc_grpc.pb.go new file mode 100644 index 000000000..22899761e --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/doc_grpc.pb.go @@ -0,0 +1,283 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/doc.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + DocService_GetSourceDirectoryInfo_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetSourceDirectoryInfo" + DocService_GetSourceFile_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetSourceFile" + DocService_GetModulePackages_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetModulePackages" + DocService_GetModuleDocumentation_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetModuleDocumentation" + DocService_GetPackageDocumentation_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DocService/GetPackageDocumentation" +) + +// DocServiceClient is the client API for DocService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type DocServiceClient interface { + // GetSourceDirectoryInfo retrieves the directory and file structure for the + // given owner, repository and reference. + // + // The purpose of this is to get a representation of the file tree for a given + // module to enable exploring the module by navigating through its contents. + GetSourceDirectoryInfo(ctx context.Context, in *GetSourceDirectoryInfoRequest, opts ...grpc.CallOption) (*GetSourceDirectoryInfoResponse, error) + // GetSourceFile retrieves the source contents for the given owner, repository, + // reference, and path. + GetSourceFile(ctx context.Context, in *GetSourceFileRequest, opts ...grpc.CallOption) (*GetSourceFileResponse, error) + // GetModulePackages retrieves the list of packages for the module based on the given + // owner, repository, and reference. + GetModulePackages(ctx context.Context, in *GetModulePackagesRequest, opts ...grpc.CallOption) (*GetModulePackagesResponse, error) + // GetModuleDocumentation retrieves the documentations including buf.md and LICENSE files + // for module based on the given owner, repository, and reference. + GetModuleDocumentation(ctx context.Context, in *GetModuleDocumentationRequest, opts ...grpc.CallOption) (*GetModuleDocumentationResponse, error) + // GetPackageDocumentation retrieves a a slice of documentation structures + // for the given owner, repository, reference, and package name. + GetPackageDocumentation(ctx context.Context, in *GetPackageDocumentationRequest, opts ...grpc.CallOption) (*GetPackageDocumentationResponse, error) +} + +type docServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewDocServiceClient(cc grpc.ClientConnInterface) DocServiceClient { + return &docServiceClient{cc} +} + +func (c *docServiceClient) GetSourceDirectoryInfo(ctx context.Context, in *GetSourceDirectoryInfoRequest, opts ...grpc.CallOption) (*GetSourceDirectoryInfoResponse, error) { + out := new(GetSourceDirectoryInfoResponse) + err := c.cc.Invoke(ctx, DocService_GetSourceDirectoryInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *docServiceClient) GetSourceFile(ctx context.Context, in *GetSourceFileRequest, opts ...grpc.CallOption) (*GetSourceFileResponse, error) { + out := new(GetSourceFileResponse) + err := c.cc.Invoke(ctx, DocService_GetSourceFile_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *docServiceClient) GetModulePackages(ctx context.Context, in *GetModulePackagesRequest, opts ...grpc.CallOption) (*GetModulePackagesResponse, error) { + out := new(GetModulePackagesResponse) + err := c.cc.Invoke(ctx, DocService_GetModulePackages_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *docServiceClient) GetModuleDocumentation(ctx context.Context, in *GetModuleDocumentationRequest, opts ...grpc.CallOption) (*GetModuleDocumentationResponse, error) { + out := new(GetModuleDocumentationResponse) + err := c.cc.Invoke(ctx, DocService_GetModuleDocumentation_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *docServiceClient) GetPackageDocumentation(ctx context.Context, in *GetPackageDocumentationRequest, opts ...grpc.CallOption) (*GetPackageDocumentationResponse, error) { + out := new(GetPackageDocumentationResponse) + err := c.cc.Invoke(ctx, DocService_GetPackageDocumentation_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DocServiceServer is the server API for DocService service. +// All implementations must embed UnimplementedDocServiceServer +// for forward compatibility +type DocServiceServer interface { + // GetSourceDirectoryInfo retrieves the directory and file structure for the + // given owner, repository and reference. + // + // The purpose of this is to get a representation of the file tree for a given + // module to enable exploring the module by navigating through its contents. + GetSourceDirectoryInfo(context.Context, *GetSourceDirectoryInfoRequest) (*GetSourceDirectoryInfoResponse, error) + // GetSourceFile retrieves the source contents for the given owner, repository, + // reference, and path. + GetSourceFile(context.Context, *GetSourceFileRequest) (*GetSourceFileResponse, error) + // GetModulePackages retrieves the list of packages for the module based on the given + // owner, repository, and reference. + GetModulePackages(context.Context, *GetModulePackagesRequest) (*GetModulePackagesResponse, error) + // GetModuleDocumentation retrieves the documentations including buf.md and LICENSE files + // for module based on the given owner, repository, and reference. + GetModuleDocumentation(context.Context, *GetModuleDocumentationRequest) (*GetModuleDocumentationResponse, error) + // GetPackageDocumentation retrieves a a slice of documentation structures + // for the given owner, repository, reference, and package name. + GetPackageDocumentation(context.Context, *GetPackageDocumentationRequest) (*GetPackageDocumentationResponse, error) + mustEmbedUnimplementedDocServiceServer() +} + +// UnimplementedDocServiceServer must be embedded to have forward compatible implementations. +type UnimplementedDocServiceServer struct { +} + +func (UnimplementedDocServiceServer) GetSourceDirectoryInfo(context.Context, *GetSourceDirectoryInfoRequest) (*GetSourceDirectoryInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSourceDirectoryInfo not implemented") +} +func (UnimplementedDocServiceServer) GetSourceFile(context.Context, *GetSourceFileRequest) (*GetSourceFileResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSourceFile not implemented") +} +func (UnimplementedDocServiceServer) GetModulePackages(context.Context, *GetModulePackagesRequest) (*GetModulePackagesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetModulePackages not implemented") +} +func (UnimplementedDocServiceServer) GetModuleDocumentation(context.Context, *GetModuleDocumentationRequest) (*GetModuleDocumentationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetModuleDocumentation not implemented") +} +func (UnimplementedDocServiceServer) GetPackageDocumentation(context.Context, *GetPackageDocumentationRequest) (*GetPackageDocumentationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPackageDocumentation not implemented") +} +func (UnimplementedDocServiceServer) mustEmbedUnimplementedDocServiceServer() {} + +// UnsafeDocServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DocServiceServer will +// result in compilation errors. +type UnsafeDocServiceServer interface { + mustEmbedUnimplementedDocServiceServer() +} + +func RegisterDocServiceServer(s grpc.ServiceRegistrar, srv DocServiceServer) { + s.RegisterService(&DocService_ServiceDesc, srv) +} + +func _DocService_GetSourceDirectoryInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSourceDirectoryInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DocServiceServer).GetSourceDirectoryInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DocService_GetSourceDirectoryInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DocServiceServer).GetSourceDirectoryInfo(ctx, req.(*GetSourceDirectoryInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DocService_GetSourceFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSourceFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DocServiceServer).GetSourceFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DocService_GetSourceFile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DocServiceServer).GetSourceFile(ctx, req.(*GetSourceFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DocService_GetModulePackages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetModulePackagesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DocServiceServer).GetModulePackages(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DocService_GetModulePackages_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DocServiceServer).GetModulePackages(ctx, req.(*GetModulePackagesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DocService_GetModuleDocumentation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetModuleDocumentationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DocServiceServer).GetModuleDocumentation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DocService_GetModuleDocumentation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DocServiceServer).GetModuleDocumentation(ctx, req.(*GetModuleDocumentationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DocService_GetPackageDocumentation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPackageDocumentationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DocServiceServer).GetPackageDocumentation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DocService_GetPackageDocumentation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DocServiceServer).GetPackageDocumentation(ctx, req.(*GetPackageDocumentationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// DocService_ServiceDesc is the grpc.ServiceDesc for DocService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DocService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.DocService", + HandlerType: (*DocServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSourceDirectoryInfo", + Handler: _DocService_GetSourceDirectoryInfo_Handler, + }, + { + MethodName: "GetSourceFile", + Handler: _DocService_GetSourceFile_Handler, + }, + { + MethodName: "GetModulePackages", + Handler: _DocService_GetModulePackages_Handler, + }, + { + MethodName: "GetModuleDocumentation", + Handler: _DocService_GetModuleDocumentation_Handler, + }, + { + MethodName: "GetPackageDocumentation", + Handler: _DocService_GetPackageDocumentation_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/doc.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/docker.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/docker.pb.go new file mode 100644 index 000000000..032fd2c22 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/docker.pb.go @@ -0,0 +1,1213 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/docker.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DockerRepo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + Note string `protobuf:"bytes,7,opt,name=note,proto3" json:"note,omitempty"` +} + +func (x *DockerRepo) Reset() { + *x = DockerRepo{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DockerRepo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DockerRepo) ProtoMessage() {} + +func (x *DockerRepo) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DockerRepo.ProtoReflect.Descriptor instead. +func (*DockerRepo) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{0} +} + +func (x *DockerRepo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DockerRepo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DockerRepo) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *DockerRepo) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *DockerRepo) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *DockerRepo) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +func (x *DockerRepo) GetNote() string { + if x != nil { + return x.Note + } + return "" +} + +type CreateDockerRepoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` + Note string `protobuf:"bytes,5,opt,name=note,proto3" json:"note,omitempty"` +} + +func (x *CreateDockerRepoRequest) Reset() { + *x = CreateDockerRepoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateDockerRepoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDockerRepoRequest) ProtoMessage() {} + +func (x *CreateDockerRepoRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateDockerRepoRequest.ProtoReflect.Descriptor instead. +func (*CreateDockerRepoRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateDockerRepoRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateDockerRepoRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *CreateDockerRepoRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *CreateDockerRepoRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *CreateDockerRepoRequest) GetNote() string { + if x != nil { + return x.Note + } + return "" +} + +type CreateDockerRepoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DockerRepo *DockerRepo `protobuf:"bytes,1,opt,name=docker_repo,json=dockerRepo,proto3" json:"docker_repo,omitempty"` +} + +func (x *CreateDockerRepoResponse) Reset() { + *x = CreateDockerRepoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateDockerRepoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDockerRepoResponse) ProtoMessage() {} + +func (x *CreateDockerRepoResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateDockerRepoResponse.ProtoReflect.Descriptor instead. +func (*CreateDockerRepoResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateDockerRepoResponse) GetDockerRepo() *DockerRepo { + if x != nil { + return x.DockerRepo + } + return nil +} + +type GetDockerRepoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetDockerRepoRequest) Reset() { + *x = GetDockerRepoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDockerRepoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDockerRepoRequest) ProtoMessage() {} + +func (x *GetDockerRepoRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDockerRepoRequest.ProtoReflect.Descriptor instead. +func (*GetDockerRepoRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{3} +} + +func (x *GetDockerRepoRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetDockerRepoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DockerRepo *DockerRepo `protobuf:"bytes,1,opt,name=docker_repo,json=dockerRepo,proto3" json:"docker_repo,omitempty"` +} + +func (x *GetDockerRepoResponse) Reset() { + *x = GetDockerRepoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDockerRepoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDockerRepoResponse) ProtoMessage() {} + +func (x *GetDockerRepoResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDockerRepoResponse.ProtoReflect.Descriptor instead. +func (*GetDockerRepoResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{4} +} + +func (x *GetDockerRepoResponse) GetDockerRepo() *DockerRepo { + if x != nil { + return x.DockerRepo + } + return nil +} + +type GetDockerRepoByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetDockerRepoByNameRequest) Reset() { + *x = GetDockerRepoByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDockerRepoByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDockerRepoByNameRequest) ProtoMessage() {} + +func (x *GetDockerRepoByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDockerRepoByNameRequest.ProtoReflect.Descriptor instead. +func (*GetDockerRepoByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{5} +} + +func (x *GetDockerRepoByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetDockerRepoByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DockerRepo *DockerRepo `protobuf:"bytes,1,opt,name=docker_repo,json=dockerRepo,proto3" json:"docker_repo,omitempty"` +} + +func (x *GetDockerRepoByNameResponse) Reset() { + *x = GetDockerRepoByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDockerRepoByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDockerRepoByNameResponse) ProtoMessage() {} + +func (x *GetDockerRepoByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDockerRepoByNameResponse.ProtoReflect.Descriptor instead. +func (*GetDockerRepoByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{6} +} + +func (x *GetDockerRepoByNameResponse) GetDockerRepo() *DockerRepo { + if x != nil { + return x.DockerRepo + } + return nil +} + +type ListDockerReposRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListDockerReposRequest) Reset() { + *x = ListDockerReposRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDockerReposRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDockerReposRequest) ProtoMessage() {} + +func (x *ListDockerReposRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDockerReposRequest.ProtoReflect.Descriptor instead. +func (*ListDockerReposRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{7} +} + +func (x *ListDockerReposRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListDockerReposRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListDockerReposRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListDockerReposResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DockerRepos []*DockerRepo `protobuf:"bytes,1,rep,name=docker_repos,json=dockerRepos,proto3" json:"docker_repos,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListDockerReposResponse) Reset() { + *x = ListDockerReposResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDockerReposResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDockerReposResponse) ProtoMessage() {} + +func (x *ListDockerReposResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDockerReposResponse.ProtoReflect.Descriptor instead. +func (*ListDockerReposResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{8} +} + +func (x *ListDockerReposResponse) GetDockerRepos() []*DockerRepo { + if x != nil { + return x.DockerRepos + } + return nil +} + +func (x *ListDockerReposResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type UpdateDockerRepoByIDRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // given a id, to update address、username、password + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *UpdateDockerRepoByIDRequest) Reset() { + *x = UpdateDockerRepoByIDRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDockerRepoByIDRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDockerRepoByIDRequest) ProtoMessage() {} + +func (x *UpdateDockerRepoByIDRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateDockerRepoByIDRequest.ProtoReflect.Descriptor instead. +func (*UpdateDockerRepoByIDRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{9} +} + +func (x *UpdateDockerRepoByIDRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateDockerRepoByIDRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *UpdateDockerRepoByIDRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UpdateDockerRepoByIDRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type UpdateDockerRepoByIDResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateDockerRepoByIDResponse) Reset() { + *x = UpdateDockerRepoByIDResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDockerRepoByIDResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDockerRepoByIDResponse) ProtoMessage() {} + +func (x *UpdateDockerRepoByIDResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateDockerRepoByIDResponse.ProtoReflect.Descriptor instead. +func (*UpdateDockerRepoByIDResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{10} +} + +type UpdateDockerRepoByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // given a name, to update address、username、password + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *UpdateDockerRepoByNameRequest) Reset() { + *x = UpdateDockerRepoByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDockerRepoByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDockerRepoByNameRequest) ProtoMessage() {} + +func (x *UpdateDockerRepoByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateDockerRepoByNameRequest.ProtoReflect.Descriptor instead. +func (*UpdateDockerRepoByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{11} +} + +func (x *UpdateDockerRepoByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateDockerRepoByNameRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *UpdateDockerRepoByNameRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UpdateDockerRepoByNameRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type UpdateDockerRepoByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateDockerRepoByNameResponse) Reset() { + *x = UpdateDockerRepoByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDockerRepoByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDockerRepoByNameResponse) ProtoMessage() {} + +func (x *UpdateDockerRepoByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_docker_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateDockerRepoByNameResponse.ProtoReflect.Descriptor instead. +func (*UpdateDockerRepoByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_docker_proto_rawDescGZIP(), []int{12} +} + +var File_registry_v1alpha1_docker_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_docker_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf4, 0x01, 0x0a, + 0x0a, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x6f, 0x74, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, + 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x22, 0x72, 0x0a, 0x18, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x5f, + 0x72, 0x65, 0x70, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, + 0x6f, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x22, 0x26, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x6f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, 0x6b, + 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, + 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x6b, + 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x22, 0x30, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, + 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x75, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x44, + 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x6b, 0x65, + 0x72, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6f, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x22, + 0x6e, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, + 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, + 0x9b, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0c, 0x64, + 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x6f, + 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x0b, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x7f, 0x0a, + 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, + 0x6f, 0x42, 0x79, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x1e, + 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, + 0x70, 0x6f, 0x42, 0x79, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, + 0x01, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, + 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x20, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x80, 0x08, 0x0a, 0x11, 0x44, 0x6f, 0x63, + 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa0, + 0x01, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6f, 0x12, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, + 0x52, 0x65, 0x70, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x02, 0x12, 0x97, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6f, 0x12, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa9, 0x01, 0x0a, 0x13, + 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, + 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x9d, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, + 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x12, 0x41, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x6b, + 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x42, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, + 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb2, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x49, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, + 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0xac, 0x01, 0x0a, + 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, + 0x6f, 0x42, 0x79, 0x49, 0x44, 0x12, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, + 0x70, 0x6f, 0x42, 0x79, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x47, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x42, 0x79, 0x49, 0x44, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x42, 0xe6, 0x02, 0x0a, 0x2d, + 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x44, + 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, + 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, + 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, + 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_docker_proto_rawDescOnce sync.Once + file_registry_v1alpha1_docker_proto_rawDescData = file_registry_v1alpha1_docker_proto_rawDesc +) + +func file_registry_v1alpha1_docker_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_docker_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_docker_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_docker_proto_rawDescData) + }) + return file_registry_v1alpha1_docker_proto_rawDescData +} + +var file_registry_v1alpha1_docker_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_registry_v1alpha1_docker_proto_goTypes = []interface{}{ + (*DockerRepo)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepo + (*CreateDockerRepoRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateDockerRepoRequest + (*CreateDockerRepoResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateDockerRepoResponse + (*GetDockerRepoRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoRequest + (*GetDockerRepoResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoResponse + (*GetDockerRepoByNameRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoByNameRequest + (*GetDockerRepoByNameResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoByNameResponse + (*ListDockerReposRequest)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.ListDockerReposRequest + (*ListDockerReposResponse)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.ListDockerReposResponse + (*UpdateDockerRepoByIDRequest)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.UpdateDockerRepoByIDRequest + (*UpdateDockerRepoByIDResponse)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.UpdateDockerRepoByIDResponse + (*UpdateDockerRepoByNameRequest)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.UpdateDockerRepoByNameRequest + (*UpdateDockerRepoByNameResponse)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.UpdateDockerRepoByNameResponse + (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp +} +var file_registry_v1alpha1_docker_proto_depIdxs = []int32{ + 13, // 0: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepo.create_time:type_name -> google.protobuf.Timestamp + 13, // 1: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepo.update_time:type_name -> google.protobuf.Timestamp + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateDockerRepoResponse.docker_repo:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.DockerRepo + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoResponse.docker_repo:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.DockerRepo + 0, // 4: bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoByNameResponse.docker_repo:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.DockerRepo + 0, // 5: bufman.dubbo.apache.org.registry.v1alpha1.ListDockerReposResponse.docker_repos:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.DockerRepo + 1, // 6: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.CreateDockerRepo:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateDockerRepoRequest + 3, // 7: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepo:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoRequest + 5, // 8: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepoByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoByNameRequest + 7, // 9: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.ListDockerRepos:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListDockerReposRequest + 11, // 10: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateDockerRepoByNameRequest + 9, // 11: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByID:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateDockerRepoByIDRequest + 2, // 12: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.CreateDockerRepo:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateDockerRepoResponse + 4, // 13: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepo:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoResponse + 6, // 14: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.GetDockerRepoByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetDockerRepoByNameResponse + 8, // 15: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.ListDockerRepos:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListDockerReposResponse + 12, // 16: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateDockerRepoByNameResponse + 10, // 17: bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService.UpdateDockerRepoByID:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateDockerRepoByIDResponse + 12, // [12:18] is the sub-list for method output_type + 6, // [6:12] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_docker_proto_init() } +func file_registry_v1alpha1_docker_proto_init() { + if File_registry_v1alpha1_docker_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_docker_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DockerRepo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateDockerRepoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateDockerRepoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDockerRepoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDockerRepoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDockerRepoByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDockerRepoByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDockerReposRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDockerReposResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDockerRepoByIDRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDockerRepoByIDResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDockerRepoByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_docker_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDockerRepoByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_docker_proto_rawDesc, + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_docker_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_docker_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_docker_proto_msgTypes, + }.Build() + File_registry_v1alpha1_docker_proto = out.File + file_registry_v1alpha1_docker_proto_rawDesc = nil + file_registry_v1alpha1_docker_proto_goTypes = nil + file_registry_v1alpha1_docker_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/docker_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/docker_grpc.pb.go new file mode 100644 index 000000000..5566e61de --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/docker_grpc.pb.go @@ -0,0 +1,345 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/docker.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + DockerRepoService_CreateDockerRepo_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/CreateDockerRepo" + DockerRepoService_GetDockerRepo_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/GetDockerRepo" + DockerRepoService_GetDockerRepoByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/GetDockerRepoByName" + DockerRepoService_ListDockerRepos_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/ListDockerRepos" + DockerRepoService_UpdateDockerRepoByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/UpdateDockerRepoByName" + DockerRepoService_UpdateDockerRepoByID_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService/UpdateDockerRepoByID" +) + +// DockerRepoServiceClient is the client API for DockerRepoService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type DockerRepoServiceClient interface { + // CreateDockerRepo create a docker repo for user + // + // This method requires authentication. + CreateDockerRepo(ctx context.Context, in *CreateDockerRepoRequest, opts ...grpc.CallOption) (*CreateDockerRepoResponse, error) + // GetDockerRepo get a user's docker repo by id + // + // This method requires authentication. + GetDockerRepo(ctx context.Context, in *GetDockerRepoRequest, opts ...grpc.CallOption) (*GetDockerRepoResponse, error) + // GetDockerRepoByName get a user's docker repo by name + // + // This method requires authentication. + GetDockerRepoByName(ctx context.Context, in *GetDockerRepoByNameRequest, opts ...grpc.CallOption) (*GetDockerRepoByNameResponse, error) + // ListDockerRepos lists the user's all docker repo entries + // + // This method requires authentication. + ListDockerRepos(ctx context.Context, in *ListDockerReposRequest, opts ...grpc.CallOption) (*ListDockerReposResponse, error) + // UpdateDockerRepoByName given a name, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByName(ctx context.Context, in *UpdateDockerRepoByNameRequest, opts ...grpc.CallOption) (*UpdateDockerRepoByNameResponse, error) + // UpdateDockerRepoByName given a id, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByID(ctx context.Context, in *UpdateDockerRepoByIDRequest, opts ...grpc.CallOption) (*UpdateDockerRepoByIDResponse, error) +} + +type dockerRepoServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewDockerRepoServiceClient(cc grpc.ClientConnInterface) DockerRepoServiceClient { + return &dockerRepoServiceClient{cc} +} + +func (c *dockerRepoServiceClient) CreateDockerRepo(ctx context.Context, in *CreateDockerRepoRequest, opts ...grpc.CallOption) (*CreateDockerRepoResponse, error) { + out := new(CreateDockerRepoResponse) + err := c.cc.Invoke(ctx, DockerRepoService_CreateDockerRepo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dockerRepoServiceClient) GetDockerRepo(ctx context.Context, in *GetDockerRepoRequest, opts ...grpc.CallOption) (*GetDockerRepoResponse, error) { + out := new(GetDockerRepoResponse) + err := c.cc.Invoke(ctx, DockerRepoService_GetDockerRepo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dockerRepoServiceClient) GetDockerRepoByName(ctx context.Context, in *GetDockerRepoByNameRequest, opts ...grpc.CallOption) (*GetDockerRepoByNameResponse, error) { + out := new(GetDockerRepoByNameResponse) + err := c.cc.Invoke(ctx, DockerRepoService_GetDockerRepoByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dockerRepoServiceClient) ListDockerRepos(ctx context.Context, in *ListDockerReposRequest, opts ...grpc.CallOption) (*ListDockerReposResponse, error) { + out := new(ListDockerReposResponse) + err := c.cc.Invoke(ctx, DockerRepoService_ListDockerRepos_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dockerRepoServiceClient) UpdateDockerRepoByName(ctx context.Context, in *UpdateDockerRepoByNameRequest, opts ...grpc.CallOption) (*UpdateDockerRepoByNameResponse, error) { + out := new(UpdateDockerRepoByNameResponse) + err := c.cc.Invoke(ctx, DockerRepoService_UpdateDockerRepoByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dockerRepoServiceClient) UpdateDockerRepoByID(ctx context.Context, in *UpdateDockerRepoByIDRequest, opts ...grpc.CallOption) (*UpdateDockerRepoByIDResponse, error) { + out := new(UpdateDockerRepoByIDResponse) + err := c.cc.Invoke(ctx, DockerRepoService_UpdateDockerRepoByID_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DockerRepoServiceServer is the server API for DockerRepoService service. +// All implementations must embed UnimplementedDockerRepoServiceServer +// for forward compatibility +type DockerRepoServiceServer interface { + // CreateDockerRepo create a docker repo for user + // + // This method requires authentication. + CreateDockerRepo(context.Context, *CreateDockerRepoRequest) (*CreateDockerRepoResponse, error) + // GetDockerRepo get a user's docker repo by id + // + // This method requires authentication. + GetDockerRepo(context.Context, *GetDockerRepoRequest) (*GetDockerRepoResponse, error) + // GetDockerRepoByName get a user's docker repo by name + // + // This method requires authentication. + GetDockerRepoByName(context.Context, *GetDockerRepoByNameRequest) (*GetDockerRepoByNameResponse, error) + // ListDockerRepos lists the user's all docker repo entries + // + // This method requires authentication. + ListDockerRepos(context.Context, *ListDockerReposRequest) (*ListDockerReposResponse, error) + // UpdateDockerRepoByName given a name, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByName(context.Context, *UpdateDockerRepoByNameRequest) (*UpdateDockerRepoByNameResponse, error) + // UpdateDockerRepoByName given a id, to update address、username、password + // + // This method requires authentication. + UpdateDockerRepoByID(context.Context, *UpdateDockerRepoByIDRequest) (*UpdateDockerRepoByIDResponse, error) + mustEmbedUnimplementedDockerRepoServiceServer() +} + +// UnimplementedDockerRepoServiceServer must be embedded to have forward compatible implementations. +type UnimplementedDockerRepoServiceServer struct { +} + +func (UnimplementedDockerRepoServiceServer) CreateDockerRepo(context.Context, *CreateDockerRepoRequest) (*CreateDockerRepoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateDockerRepo not implemented") +} +func (UnimplementedDockerRepoServiceServer) GetDockerRepo(context.Context, *GetDockerRepoRequest) (*GetDockerRepoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDockerRepo not implemented") +} +func (UnimplementedDockerRepoServiceServer) GetDockerRepoByName(context.Context, *GetDockerRepoByNameRequest) (*GetDockerRepoByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDockerRepoByName not implemented") +} +func (UnimplementedDockerRepoServiceServer) ListDockerRepos(context.Context, *ListDockerReposRequest) (*ListDockerReposResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListDockerRepos not implemented") +} +func (UnimplementedDockerRepoServiceServer) UpdateDockerRepoByName(context.Context, *UpdateDockerRepoByNameRequest) (*UpdateDockerRepoByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateDockerRepoByName not implemented") +} +func (UnimplementedDockerRepoServiceServer) UpdateDockerRepoByID(context.Context, *UpdateDockerRepoByIDRequest) (*UpdateDockerRepoByIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateDockerRepoByID not implemented") +} +func (UnimplementedDockerRepoServiceServer) mustEmbedUnimplementedDockerRepoServiceServer() {} + +// UnsafeDockerRepoServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DockerRepoServiceServer will +// result in compilation errors. +type UnsafeDockerRepoServiceServer interface { + mustEmbedUnimplementedDockerRepoServiceServer() +} + +func RegisterDockerRepoServiceServer(s grpc.ServiceRegistrar, srv DockerRepoServiceServer) { + s.RegisterService(&DockerRepoService_ServiceDesc, srv) +} + +func _DockerRepoService_CreateDockerRepo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateDockerRepoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DockerRepoServiceServer).CreateDockerRepo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DockerRepoService_CreateDockerRepo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DockerRepoServiceServer).CreateDockerRepo(ctx, req.(*CreateDockerRepoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DockerRepoService_GetDockerRepo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDockerRepoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DockerRepoServiceServer).GetDockerRepo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DockerRepoService_GetDockerRepo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DockerRepoServiceServer).GetDockerRepo(ctx, req.(*GetDockerRepoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DockerRepoService_GetDockerRepoByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDockerRepoByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DockerRepoServiceServer).GetDockerRepoByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DockerRepoService_GetDockerRepoByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DockerRepoServiceServer).GetDockerRepoByName(ctx, req.(*GetDockerRepoByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DockerRepoService_ListDockerRepos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListDockerReposRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DockerRepoServiceServer).ListDockerRepos(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DockerRepoService_ListDockerRepos_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DockerRepoServiceServer).ListDockerRepos(ctx, req.(*ListDockerReposRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DockerRepoService_UpdateDockerRepoByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateDockerRepoByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DockerRepoServiceServer).UpdateDockerRepoByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DockerRepoService_UpdateDockerRepoByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DockerRepoServiceServer).UpdateDockerRepoByName(ctx, req.(*UpdateDockerRepoByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DockerRepoService_UpdateDockerRepoByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateDockerRepoByIDRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DockerRepoServiceServer).UpdateDockerRepoByID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DockerRepoService_UpdateDockerRepoByID_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DockerRepoServiceServer).UpdateDockerRepoByID(ctx, req.(*UpdateDockerRepoByIDRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// DockerRepoService_ServiceDesc is the grpc.ServiceDesc for DockerRepoService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DockerRepoService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.DockerRepoService", + HandlerType: (*DockerRepoServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateDockerRepo", + Handler: _DockerRepoService_CreateDockerRepo_Handler, + }, + { + MethodName: "GetDockerRepo", + Handler: _DockerRepoService_GetDockerRepo_Handler, + }, + { + MethodName: "GetDockerRepoByName", + Handler: _DockerRepoService_GetDockerRepoByName_Handler, + }, + { + MethodName: "ListDockerRepos", + Handler: _DockerRepoService_ListDockerRepos_Handler, + }, + { + MethodName: "UpdateDockerRepoByName", + Handler: _DockerRepoService_UpdateDockerRepoByName_Handler, + }, + { + MethodName: "UpdateDockerRepoByID", + Handler: _DockerRepoService_UpdateDockerRepoByID_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/docker.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/download.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/download.pb.go new file mode 100644 index 000000000..533b4f94b --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/download.pb.go @@ -0,0 +1,456 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/download.proto + +package registryv1alpha1 + +import ( + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// DownloadRequest specifies the module to download. +type DownloadRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *DownloadRequest) Reset() { + *x = DownloadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_download_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownloadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownloadRequest) ProtoMessage() {} + +func (x *DownloadRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_download_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DownloadRequest.ProtoReflect.Descriptor instead. +func (*DownloadRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_download_proto_rawDescGZIP(), []int{0} +} + +func (x *DownloadRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *DownloadRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *DownloadRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +// DownloadResponse contains the remote module. +type DownloadResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Module *v1alpha1.Module `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` +} + +func (x *DownloadResponse) Reset() { + *x = DownloadResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_download_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownloadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownloadResponse) ProtoMessage() {} + +func (x *DownloadResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_download_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DownloadResponse.ProtoReflect.Descriptor instead. +func (*DownloadResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_download_proto_rawDescGZIP(), []int{1} +} + +func (x *DownloadResponse) GetModule() *v1alpha1.Module { + if x != nil { + return x.Module + } + return nil +} + +// DownloadManifestAndBlobsRequest specifies the module to download. +type DownloadManifestAndBlobsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *DownloadManifestAndBlobsRequest) Reset() { + *x = DownloadManifestAndBlobsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_download_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownloadManifestAndBlobsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownloadManifestAndBlobsRequest) ProtoMessage() {} + +func (x *DownloadManifestAndBlobsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_download_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DownloadManifestAndBlobsRequest.ProtoReflect.Descriptor instead. +func (*DownloadManifestAndBlobsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_download_proto_rawDescGZIP(), []int{2} +} + +func (x *DownloadManifestAndBlobsRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *DownloadManifestAndBlobsRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *DownloadManifestAndBlobsRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +// DownloadManifestAndBlobsResponse is the returned resolved remote module. +type DownloadManifestAndBlobsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // manifest is the manifest of the module's content. + Manifest *v1alpha1.Blob `protobuf:"bytes,1,opt,name=manifest,proto3" json:"manifest,omitempty"` + // blobs is a set of blobs that closes on the module's manifest to form the + // complete module's content. + Blobs []*v1alpha1.Blob `protobuf:"bytes,2,rep,name=blobs,proto3" json:"blobs,omitempty"` +} + +func (x *DownloadManifestAndBlobsResponse) Reset() { + *x = DownloadManifestAndBlobsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_download_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownloadManifestAndBlobsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownloadManifestAndBlobsResponse) ProtoMessage() {} + +func (x *DownloadManifestAndBlobsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_download_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DownloadManifestAndBlobsResponse.ProtoReflect.Descriptor instead. +func (*DownloadManifestAndBlobsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_download_proto_rawDescGZIP(), []int{3} +} + +func (x *DownloadManifestAndBlobsResponse) GetManifest() *v1alpha1.Blob { + if x != nil { + return x.Manifest + } + return nil +} + +func (x *DownloadManifestAndBlobsResponse) GetBlobs() []*v1alpha1.Blob { + if x != nil { + return x.Blobs + } + return nil +} + +var File_registry_v1alpha1_download_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_download_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1c, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x65, 0x0a, 0x0f, 0x44, + 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x22, 0x5b, 0x0a, 0x10, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x22, + 0x75, 0x0a, 0x1f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, + 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, + 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0xb2, 0x01, 0x0a, 0x20, 0x44, 0x6f, 0x77, 0x6e, 0x6c, + 0x6f, 0x61, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x42, 0x6c, + 0x6f, 0x62, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x08, 0x6d, + 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x08, 0x6d, 0x61, + 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, 0x32, 0xd7, 0x02, 0x0a, 0x0f, + 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x88, 0x01, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x3a, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, + 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb8, 0x01, 0x0a, 0x18, 0x44, + 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x41, + 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x12, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x61, 0x6e, 0x69, + 0x66, 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x4b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, + 0x41, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe8, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0d, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, + 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, + 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, + 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, + 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_download_proto_rawDescOnce sync.Once + file_registry_v1alpha1_download_proto_rawDescData = file_registry_v1alpha1_download_proto_rawDesc +) + +func file_registry_v1alpha1_download_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_download_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_download_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_download_proto_rawDescData) + }) + return file_registry_v1alpha1_download_proto_rawDescData +} + +var file_registry_v1alpha1_download_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_registry_v1alpha1_download_proto_goTypes = []interface{}{ + (*DownloadRequest)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.DownloadRequest + (*DownloadResponse)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.DownloadResponse + (*DownloadManifestAndBlobsRequest)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.DownloadManifestAndBlobsRequest + (*DownloadManifestAndBlobsResponse)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.DownloadManifestAndBlobsResponse + (*v1alpha1.Module)(nil), // 4: bufman.dubbo.apache.org.module.v1alpha1.Module + (*v1alpha1.Blob)(nil), // 5: bufman.dubbo.apache.org.module.v1alpha1.Blob +} +var file_registry_v1alpha1_download_proto_depIdxs = []int32{ + 4, // 0: bufman.dubbo.apache.org.registry.v1alpha1.DownloadResponse.module:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Module + 5, // 1: bufman.dubbo.apache.org.registry.v1alpha1.DownloadManifestAndBlobsResponse.manifest:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Blob + 5, // 2: bufman.dubbo.apache.org.registry.v1alpha1.DownloadManifestAndBlobsResponse.blobs:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Blob + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.Download:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DownloadRequest + 2, // 4: bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.DownloadManifestAndBlobs:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DownloadManifestAndBlobsRequest + 1, // 5: bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.Download:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DownloadResponse + 3, // 6: bufman.dubbo.apache.org.registry.v1alpha1.DownloadService.DownloadManifestAndBlobs:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DownloadManifestAndBlobsResponse + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_download_proto_init() } +func file_registry_v1alpha1_download_proto_init() { + if File_registry_v1alpha1_download_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_download_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownloadRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_download_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownloadResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_download_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownloadManifestAndBlobsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_download_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownloadManifestAndBlobsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_download_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_download_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_download_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_download_proto_msgTypes, + }.Build() + File_registry_v1alpha1_download_proto = out.File + file_registry_v1alpha1_download_proto_rawDesc = nil + file_registry_v1alpha1_download_proto_goTypes = nil + file_registry_v1alpha1_download_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/download_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/download_grpc.pb.go new file mode 100644 index 000000000..40fa8451e --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/download_grpc.pb.go @@ -0,0 +1,152 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/download.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + DownloadService_Download_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DownloadService/Download" + DownloadService_DownloadManifestAndBlobs_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.DownloadService/DownloadManifestAndBlobs" +) + +// DownloadServiceClient is the client API for DownloadService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type DownloadServiceClient interface { + // Download downloads a BSR module. + // NOTE: Newer clients should use DownloadManifestAndBlobs instead. + Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (*DownloadResponse, error) + // DownloadManifestAndBlobs downloads a module in the manifest+blobs encoding format. + DownloadManifestAndBlobs(ctx context.Context, in *DownloadManifestAndBlobsRequest, opts ...grpc.CallOption) (*DownloadManifestAndBlobsResponse, error) +} + +type downloadServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewDownloadServiceClient(cc grpc.ClientConnInterface) DownloadServiceClient { + return &downloadServiceClient{cc} +} + +func (c *downloadServiceClient) Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (*DownloadResponse, error) { + out := new(DownloadResponse) + err := c.cc.Invoke(ctx, DownloadService_Download_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *downloadServiceClient) DownloadManifestAndBlobs(ctx context.Context, in *DownloadManifestAndBlobsRequest, opts ...grpc.CallOption) (*DownloadManifestAndBlobsResponse, error) { + out := new(DownloadManifestAndBlobsResponse) + err := c.cc.Invoke(ctx, DownloadService_DownloadManifestAndBlobs_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DownloadServiceServer is the server API for DownloadService service. +// All implementations must embed UnimplementedDownloadServiceServer +// for forward compatibility +type DownloadServiceServer interface { + // Download downloads a BSR module. + // NOTE: Newer clients should use DownloadManifestAndBlobs instead. + Download(context.Context, *DownloadRequest) (*DownloadResponse, error) + // DownloadManifestAndBlobs downloads a module in the manifest+blobs encoding format. + DownloadManifestAndBlobs(context.Context, *DownloadManifestAndBlobsRequest) (*DownloadManifestAndBlobsResponse, error) + mustEmbedUnimplementedDownloadServiceServer() +} + +// UnimplementedDownloadServiceServer must be embedded to have forward compatible implementations. +type UnimplementedDownloadServiceServer struct { +} + +func (UnimplementedDownloadServiceServer) Download(context.Context, *DownloadRequest) (*DownloadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Download not implemented") +} +func (UnimplementedDownloadServiceServer) DownloadManifestAndBlobs(context.Context, *DownloadManifestAndBlobsRequest) (*DownloadManifestAndBlobsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DownloadManifestAndBlobs not implemented") +} +func (UnimplementedDownloadServiceServer) mustEmbedUnimplementedDownloadServiceServer() {} + +// UnsafeDownloadServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DownloadServiceServer will +// result in compilation errors. +type UnsafeDownloadServiceServer interface { + mustEmbedUnimplementedDownloadServiceServer() +} + +func RegisterDownloadServiceServer(s grpc.ServiceRegistrar, srv DownloadServiceServer) { + s.RegisterService(&DownloadService_ServiceDesc, srv) +} + +func _DownloadService_Download_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DownloadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DownloadServiceServer).Download(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DownloadService_Download_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DownloadServiceServer).Download(ctx, req.(*DownloadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DownloadService_DownloadManifestAndBlobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DownloadManifestAndBlobsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DownloadServiceServer).DownloadManifestAndBlobs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DownloadService_DownloadManifestAndBlobs_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DownloadServiceServer).DownloadManifestAndBlobs(ctx, req.(*DownloadManifestAndBlobsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// DownloadService_ServiceDesc is the grpc.ServiceDesc for DownloadService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DownloadService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.DownloadService", + HandlerType: (*DownloadServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Download", + Handler: _DownloadService_Download_Handler, + }, + { + MethodName: "DownloadManifestAndBlobs", + Handler: _DownloadService_DownloadManifestAndBlobs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/download.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/generate.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/generate.pb.go new file mode 100644 index 000000000..530547313 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/generate.pb.go @@ -0,0 +1,821 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// registry/v1alpha1/generate.proto is a deprecated file. + +package registryv1alpha1 + +import ( + v1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + pluginpb "google.golang.org/protobuf/types/pluginpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// File defines a file with a path and some content. +type File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // path is the relative path of the file. + // Path can only use '/' as the separator character, and includes no ".." components. + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + // content is the content of the file. + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *File) Reset() { + *x = File{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *File) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*File) ProtoMessage() {} + +func (x *File) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use File.ProtoReflect.Descriptor instead. +func (*File) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{0} +} + +func (x *File) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *File) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +// RuntimeLibrary describes a pinned runtime library dependency of the generated code. +type RuntimeLibrary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the runtime library dependency. The format should match the + // format used for dependencies in the dependency management tooling of the + // associated language ecosystem. This is set by the user using Dockerfile Labels. + // For example, for the plugin "protoc-gen-go", this might be "google.golang.org/protobuf". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The version of the runtime library dependency associated with the generated + // code. The format should match the format used for dependency versions in the + // dependency management tooling of the associated language ecosystem. + // This is set by the user using Dockerfile Labels. + // For example, for the plugin "protoc-gen-go", this might be "v1.26.0". + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *RuntimeLibrary) Reset() { + *x = RuntimeLibrary{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RuntimeLibrary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RuntimeLibrary) ProtoMessage() {} + +func (x *RuntimeLibrary) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RuntimeLibrary.ProtoReflect.Descriptor instead. +func (*RuntimeLibrary) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{1} +} + +func (x *RuntimeLibrary) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RuntimeLibrary) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type PluginReference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin which identifies the + // plugins to use with this generation. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin which identifies the + // plugins to use with this generation. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The plugin version to use with this generation. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + // The parameters to pass to the plugin. These will + // be merged into a single, comma-separated string. + Parameters []string `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty"` +} + +func (x *PluginReference) Reset() { + *x = PluginReference{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginReference) ProtoMessage() {} + +func (x *PluginReference) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PluginReference.ProtoReflect.Descriptor instead. +func (*PluginReference) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{2} +} + +func (x *PluginReference) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *PluginReference) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PluginReference) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *PluginReference) GetParameters() []string { + if x != nil { + return x.Parameters + } + return nil +} + +type GeneratePluginsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The image to run plugins against to generate the desired file outputs. + // + // All image files that are not imports and not well-known types will be generated. + // If you want to filter what files are generated, modify the image. + // If you want to include imports, set include_imports. + Image *v1.Image `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` + // The array of plugins to use. + Plugins []*PluginReference `protobuf:"bytes,2,rep,name=plugins,proto3" json:"plugins,omitempty"` + // Include imports from the Image in generation. + IncludeImports bool `protobuf:"varint,3,opt,name=include_imports,json=includeImports,proto3" json:"include_imports,omitempty"` + // Include Well-Known Types from the Image in generation. + // + // include_imports must be set if include_well_known_types is set. + IncludeWellKnownTypes bool `protobuf:"varint,4,opt,name=include_well_known_types,json=includeWellKnownTypes,proto3" json:"include_well_known_types,omitempty"` +} + +func (x *GeneratePluginsRequest) Reset() { + *x = GeneratePluginsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GeneratePluginsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GeneratePluginsRequest) ProtoMessage() {} + +func (x *GeneratePluginsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GeneratePluginsRequest.ProtoReflect.Descriptor instead. +func (*GeneratePluginsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{3} +} + +func (x *GeneratePluginsRequest) GetImage() *v1.Image { + if x != nil { + return x.Image + } + return nil +} + +func (x *GeneratePluginsRequest) GetPlugins() []*PluginReference { + if x != nil { + return x.Plugins + } + return nil +} + +func (x *GeneratePluginsRequest) GetIncludeImports() bool { + if x != nil { + return x.IncludeImports + } + return false +} + +func (x *GeneratePluginsRequest) GetIncludeWellKnownTypes() bool { + if x != nil { + return x.IncludeWellKnownTypes + } + return false +} + +type GeneratePluginsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Contains all the responses from the generated plugins. The order + // is defined by the order of the plugins in the request. + Responses []*pluginpb.CodeGeneratorResponse `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"` + // An optional array defining runtime libraries that the generated code + // requires to run, as specified by the plugin author. This may contain + // duplicate entries as the generation can be the result of multiple plugins, + // each of which declares its own runtime library dependencies. The libraries + // returned are lexicographically ordered by their name, but not deduplicated. + // How to handle duplicate libraries is left to the user. + RuntimeLibraries []*RuntimeLibrary `protobuf:"bytes,2,rep,name=runtime_libraries,json=runtimeLibraries,proto3" json:"runtime_libraries,omitempty"` +} + +func (x *GeneratePluginsResponse) Reset() { + *x = GeneratePluginsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GeneratePluginsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GeneratePluginsResponse) ProtoMessage() {} + +func (x *GeneratePluginsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GeneratePluginsResponse.ProtoReflect.Descriptor instead. +func (*GeneratePluginsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{4} +} + +func (x *GeneratePluginsResponse) GetResponses() []*pluginpb.CodeGeneratorResponse { + if x != nil { + return x.Responses + } + return nil +} + +func (x *GeneratePluginsResponse) GetRuntimeLibraries() []*RuntimeLibrary { + if x != nil { + return x.RuntimeLibraries + } + return nil +} + +type GenerateTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The image to run plugins against to generate the desired file outputs. + // + // All image files that are not imports and not well-known types will be generated. + // If you want to filter what files are generated, modify the image. + // If you want to include imports, set include_imports. + Image *v1.Image `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` + // The owner of the template which identifies the + // plugins to use with this generation. + TemplateOwner string `protobuf:"bytes,2,opt,name=template_owner,json=templateOwner,proto3" json:"template_owner,omitempty"` + // The name of the template which identifies the + // plugins to use with this generation. + TemplateName string `protobuf:"bytes,3,opt,name=template_name,json=templateName,proto3" json:"template_name,omitempty"` + // The template version to use to determine the + // plugin versions in the template. + TemplateVersion string `protobuf:"bytes,4,opt,name=template_version,json=templateVersion,proto3" json:"template_version,omitempty"` + // Include imports from the Image in generation. + IncludeImports bool `protobuf:"varint,5,opt,name=include_imports,json=includeImports,proto3" json:"include_imports,omitempty"` + // Include Well-Known Types from the Image in generation. + // + // include_imports must be set if include_well_known_types is set. + IncludeWellKnownTypes bool `protobuf:"varint,6,opt,name=include_well_known_types,json=includeWellKnownTypes,proto3" json:"include_well_known_types,omitempty"` +} + +func (x *GenerateTemplateRequest) Reset() { + *x = GenerateTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateTemplateRequest) ProtoMessage() {} + +func (x *GenerateTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateTemplateRequest.ProtoReflect.Descriptor instead. +func (*GenerateTemplateRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{5} +} + +func (x *GenerateTemplateRequest) GetImage() *v1.Image { + if x != nil { + return x.Image + } + return nil +} + +func (x *GenerateTemplateRequest) GetTemplateOwner() string { + if x != nil { + return x.TemplateOwner + } + return "" +} + +func (x *GenerateTemplateRequest) GetTemplateName() string { + if x != nil { + return x.TemplateName + } + return "" +} + +func (x *GenerateTemplateRequest) GetTemplateVersion() string { + if x != nil { + return x.TemplateVersion + } + return "" +} + +func (x *GenerateTemplateRequest) GetIncludeImports() bool { + if x != nil { + return x.IncludeImports + } + return false +} + +func (x *GenerateTemplateRequest) GetIncludeWellKnownTypes() bool { + if x != nil { + return x.IncludeWellKnownTypes + } + return false +} + +type GenerateTemplateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // files contains all the files output by the generation, + // in lexicographical order. + Files []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + // An optional array defining runtime libraries that the generated code + // requires to run. This may contain duplicate entries as the generation + // can be the result of multiple plugins, each of which declares its own + // runtime library dependencies. + RuntimeLibraries []*RuntimeLibrary `protobuf:"bytes,2,rep,name=runtime_libraries,json=runtimeLibraries,proto3" json:"runtime_libraries,omitempty"` +} + +func (x *GenerateTemplateResponse) Reset() { + *x = GenerateTemplateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateTemplateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateTemplateResponse) ProtoMessage() {} + +func (x *GenerateTemplateResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_generate_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateTemplateResponse.ProtoReflect.Descriptor instead. +func (*GenerateTemplateResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{6} +} + +func (x *GenerateTemplateResponse) GetFiles() []*File { + if x != nil { + return x.Files + } + return nil +} + +func (x *GenerateTemplateResponse) GetRuntimeLibraries() []*RuntimeLibrary { + if x != nil { + return x.RuntimeLibraries + } + return nil +} + +var File_registry_v1alpha1_generate_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_generate_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x14, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x04, 0x46, 0x69, + 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x22, 0x3e, 0x0a, 0x0e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x22, 0x75, 0x0a, 0x0f, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x22, 0x8f, 0x02, 0x0a, 0x16, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x12, 0x54, 0x0a, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x07, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x12, 0x37, 0x0a, 0x18, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x77, 0x65, 0x6c, 0x6c, + 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x57, 0x65, 0x6c, 0x6c, 0x4b, + 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0xd0, 0x01, 0x0a, 0x17, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, + 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x73, 0x12, 0x66, 0x0a, 0x11, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, + 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x10, 0x72, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x22, 0xb1, 0x02, 0x0a, + 0x17, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, + 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x23, + 0x0a, 0x0d, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, + 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, + 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x18, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x5f, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, + 0x22, 0xc9, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, + 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x12, 0x66, 0x0a, 0x11, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, + 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x10, 0x72, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x32, 0xca, 0x02, 0x0a, + 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x98, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x73, 0x12, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x9b, 0x01, 0x0a, 0x10, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x12, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xeb, 0x02, 0x0a, 0x2d, 0x63, 0x6f, + 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0d, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xb8, 0x01, 0x01, 0xa2, 0x02, + 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, + 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, + 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, + 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, + 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_generate_proto_rawDescOnce sync.Once + file_registry_v1alpha1_generate_proto_rawDescData = file_registry_v1alpha1_generate_proto_rawDesc +) + +func file_registry_v1alpha1_generate_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_generate_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_generate_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_generate_proto_rawDescData) + }) + return file_registry_v1alpha1_generate_proto_rawDescData +} + +var file_registry_v1alpha1_generate_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_registry_v1alpha1_generate_proto_goTypes = []interface{}{ + (*File)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.File + (*RuntimeLibrary)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.RuntimeLibrary + (*PluginReference)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.PluginReference + (*GeneratePluginsRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.GeneratePluginsRequest + (*GeneratePluginsResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.GeneratePluginsResponse + (*GenerateTemplateRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.GenerateTemplateRequest + (*GenerateTemplateResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.GenerateTemplateResponse + (*v1.Image)(nil), // 7: bufman.dubbo.apache.org.image.v1.Image + (*pluginpb.CodeGeneratorResponse)(nil), // 8: google.protobuf.compiler.CodeGeneratorResponse +} +var file_registry_v1alpha1_generate_proto_depIdxs = []int32{ + 7, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GeneratePluginsRequest.image:type_name -> bufman.dubbo.apache.org.image.v1.Image + 2, // 1: bufman.dubbo.apache.org.registry.v1alpha1.GeneratePluginsRequest.plugins:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginReference + 8, // 2: bufman.dubbo.apache.org.registry.v1alpha1.GeneratePluginsResponse.responses:type_name -> google.protobuf.compiler.CodeGeneratorResponse + 1, // 3: bufman.dubbo.apache.org.registry.v1alpha1.GeneratePluginsResponse.runtime_libraries:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RuntimeLibrary + 7, // 4: bufman.dubbo.apache.org.registry.v1alpha1.GenerateTemplateRequest.image:type_name -> bufman.dubbo.apache.org.image.v1.Image + 0, // 5: bufman.dubbo.apache.org.registry.v1alpha1.GenerateTemplateResponse.files:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.File + 1, // 6: bufman.dubbo.apache.org.registry.v1alpha1.GenerateTemplateResponse.runtime_libraries:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RuntimeLibrary + 3, // 7: bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GeneratePlugins:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GeneratePluginsRequest + 5, // 8: bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GenerateTemplate:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GenerateTemplateRequest + 4, // 9: bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GeneratePlugins:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GeneratePluginsResponse + 6, // 10: bufman.dubbo.apache.org.registry.v1alpha1.GenerateService.GenerateTemplate:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GenerateTemplateResponse + 9, // [9:11] is the sub-list for method output_type + 7, // [7:9] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_generate_proto_init() } +func file_registry_v1alpha1_generate_proto_init() { + if File_registry_v1alpha1_generate_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_generate_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*File); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_generate_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RuntimeLibrary); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_generate_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginReference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_generate_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GeneratePluginsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_generate_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GeneratePluginsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_generate_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_generate_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateTemplateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_generate_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_generate_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_generate_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_generate_proto_msgTypes, + }.Build() + File_registry_v1alpha1_generate_proto = out.File + file_registry_v1alpha1_generate_proto_rawDesc = nil + file_registry_v1alpha1_generate_proto_goTypes = nil + file_registry_v1alpha1_generate_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/generate_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/generate_grpc.pb.go new file mode 100644 index 000000000..746171f29 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/generate_grpc.pb.go @@ -0,0 +1,156 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// registry/v1alpha1/generate.proto is a deprecated file. + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + GenerateService_GeneratePlugins_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.GenerateService/GeneratePlugins" + GenerateService_GenerateTemplate_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.GenerateService/GenerateTemplate" +) + +// GenerateServiceClient is the client API for GenerateService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type GenerateServiceClient interface { + // GeneratePlugins generates an array of files given the provided + // module reference and plugin version and option tuples. No attempt + // is made at merging insertion points. + GeneratePlugins(ctx context.Context, in *GeneratePluginsRequest, opts ...grpc.CallOption) (*GeneratePluginsResponse, error) + // GenerateTemplate generates an array of files given the provided + // module reference and template version. + GenerateTemplate(ctx context.Context, in *GenerateTemplateRequest, opts ...grpc.CallOption) (*GenerateTemplateResponse, error) +} + +type generateServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewGenerateServiceClient(cc grpc.ClientConnInterface) GenerateServiceClient { + return &generateServiceClient{cc} +} + +func (c *generateServiceClient) GeneratePlugins(ctx context.Context, in *GeneratePluginsRequest, opts ...grpc.CallOption) (*GeneratePluginsResponse, error) { + out := new(GeneratePluginsResponse) + err := c.cc.Invoke(ctx, GenerateService_GeneratePlugins_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *generateServiceClient) GenerateTemplate(ctx context.Context, in *GenerateTemplateRequest, opts ...grpc.CallOption) (*GenerateTemplateResponse, error) { + out := new(GenerateTemplateResponse) + err := c.cc.Invoke(ctx, GenerateService_GenerateTemplate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// GenerateServiceServer is the server API for GenerateService service. +// All implementations must embed UnimplementedGenerateServiceServer +// for forward compatibility +type GenerateServiceServer interface { + // GeneratePlugins generates an array of files given the provided + // module reference and plugin version and option tuples. No attempt + // is made at merging insertion points. + GeneratePlugins(context.Context, *GeneratePluginsRequest) (*GeneratePluginsResponse, error) + // GenerateTemplate generates an array of files given the provided + // module reference and template version. + GenerateTemplate(context.Context, *GenerateTemplateRequest) (*GenerateTemplateResponse, error) + mustEmbedUnimplementedGenerateServiceServer() +} + +// UnimplementedGenerateServiceServer must be embedded to have forward compatible implementations. +type UnimplementedGenerateServiceServer struct { +} + +func (UnimplementedGenerateServiceServer) GeneratePlugins(context.Context, *GeneratePluginsRequest) (*GeneratePluginsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GeneratePlugins not implemented") +} +func (UnimplementedGenerateServiceServer) GenerateTemplate(context.Context, *GenerateTemplateRequest) (*GenerateTemplateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateTemplate not implemented") +} +func (UnimplementedGenerateServiceServer) mustEmbedUnimplementedGenerateServiceServer() {} + +// UnsafeGenerateServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GenerateServiceServer will +// result in compilation errors. +type UnsafeGenerateServiceServer interface { + mustEmbedUnimplementedGenerateServiceServer() +} + +func RegisterGenerateServiceServer(s grpc.ServiceRegistrar, srv GenerateServiceServer) { + s.RegisterService(&GenerateService_ServiceDesc, srv) +} + +func _GenerateService_GeneratePlugins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GeneratePluginsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GenerateServiceServer).GeneratePlugins(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GenerateService_GeneratePlugins_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GenerateServiceServer).GeneratePlugins(ctx, req.(*GeneratePluginsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GenerateService_GenerateTemplate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateTemplateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GenerateServiceServer).GenerateTemplate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GenerateService_GenerateTemplate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GenerateServiceServer).GenerateTemplate(ctx, req.(*GenerateTemplateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// GenerateService_ServiceDesc is the grpc.ServiceDesc for GenerateService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var GenerateService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.GenerateService", + HandlerType: (*GenerateServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GeneratePlugins", + Handler: _GenerateService_GeneratePlugins_Handler, + }, + { + MethodName: "GenerateTemplate", + Handler: _GenerateService_GenerateTemplate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/generate.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/git_metadata.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/git_metadata.pb.go new file mode 100644 index 000000000..f1a9ddcc4 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/git_metadata.pb.go @@ -0,0 +1,312 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/git_metadata.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GitIdentity is a Git user identity, typically either an author or a commiter. +type GitIdentity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name is the name of the Git identity. This is not the BSR user's username. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Email is the email of the Git identity. This is not the BSR user's email. + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + // Time is the time at which this identity was captured. + Time *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=time,proto3" json:"time,omitempty"` +} + +func (x *GitIdentity) Reset() { + *x = GitIdentity{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_git_metadata_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GitIdentity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GitIdentity) ProtoMessage() {} + +func (x *GitIdentity) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_git_metadata_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GitIdentity.ProtoReflect.Descriptor instead. +func (*GitIdentity) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_git_metadata_proto_rawDescGZIP(), []int{0} +} + +func (x *GitIdentity) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GitIdentity) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *GitIdentity) GetTime() *timestamppb.Timestamp { + if x != nil { + return x.Time + } + return nil +} + +// GitCommitMetadata is Git metadata associated with a BSR commit. +type GitCommitMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Hash is the SHA1 has of the Git commit. + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // Author is the author of the Git commit. This is typically an end-user. + Author *GitIdentity `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"` + // Commiter is the commiter of the Git commit. This typically a CI system. + Commiter *GitIdentity `protobuf:"bytes,3,opt,name=commiter,proto3" json:"commiter,omitempty"` + // Branch is the Git branch to which this Git commit belongs. + Branch string `protobuf:"bytes,4,opt,name=branch,proto3" json:"branch,omitempty"` + // Tags are the Git tags which point to this commit. + Tags []string `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"` +} + +func (x *GitCommitMetadata) Reset() { + *x = GitCommitMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_git_metadata_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GitCommitMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GitCommitMetadata) ProtoMessage() {} + +func (x *GitCommitMetadata) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_git_metadata_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GitCommitMetadata.ProtoReflect.Descriptor instead. +func (*GitCommitMetadata) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_git_metadata_proto_rawDescGZIP(), []int{1} +} + +func (x *GitCommitMetadata) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + +func (x *GitCommitMetadata) GetAuthor() *GitIdentity { + if x != nil { + return x.Author + } + return nil +} + +func (x *GitCommitMetadata) GetCommiter() *GitIdentity { + if x != nil { + return x.Commiter + } + return nil +} + +func (x *GitCommitMetadata) GetBranch() string { + if x != nil { + return x.Branch + } + return "" +} + +func (x *GitCommitMetadata) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +var File_registry_v1alpha1_git_metadata_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_git_metadata_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x67, 0x69, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x67, 0x0a, 0x0b, 0x47, 0x69, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2e, 0x0a, 0x04, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x22, 0xf7, 0x01, 0x0a, 0x11, + 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x4e, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x47, 0x69, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x06, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x52, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x47, 0x69, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, + 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x72, 0x61, + 0x6e, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, + 0x68, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x61, 0x67, 0x73, 0x42, 0xeb, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x47, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, + 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, + 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, + 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_git_metadata_proto_rawDescOnce sync.Once + file_registry_v1alpha1_git_metadata_proto_rawDescData = file_registry_v1alpha1_git_metadata_proto_rawDesc +) + +func file_registry_v1alpha1_git_metadata_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_git_metadata_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_git_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_git_metadata_proto_rawDescData) + }) + return file_registry_v1alpha1_git_metadata_proto_rawDescData +} + +var file_registry_v1alpha1_git_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_registry_v1alpha1_git_metadata_proto_goTypes = []interface{}{ + (*GitIdentity)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.GitIdentity + (*GitCommitMetadata)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GitCommitMetadata + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp +} +var file_registry_v1alpha1_git_metadata_proto_depIdxs = []int32{ + 2, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GitIdentity.time:type_name -> google.protobuf.Timestamp + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.GitCommitMetadata.author:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GitIdentity + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.GitCommitMetadata.commiter:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GitIdentity + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_git_metadata_proto_init() } +func file_registry_v1alpha1_git_metadata_proto_init() { + if File_registry_v1alpha1_git_metadata_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_git_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GitIdentity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_git_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GitCommitMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_git_metadata_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_registry_v1alpha1_git_metadata_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_git_metadata_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_git_metadata_proto_msgTypes, + }.Build() + File_registry_v1alpha1_git_metadata_proto = out.File + file_registry_v1alpha1_git_metadata_proto_rawDesc = nil + file_registry_v1alpha1_git_metadata_proto_goTypes = nil + file_registry_v1alpha1_git_metadata_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/github.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/github.pb.go new file mode 100644 index 000000000..540693aab --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/github.pb.go @@ -0,0 +1,302 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/github.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GithubAppConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` +} + +func (x *GithubAppConfig) Reset() { + *x = GithubAppConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_github_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GithubAppConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GithubAppConfig) ProtoMessage() {} + +func (x *GithubAppConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_github_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GithubAppConfig.ProtoReflect.Descriptor instead. +func (*GithubAppConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_github_proto_rawDescGZIP(), []int{0} +} + +func (x *GithubAppConfig) GetAppId() string { + if x != nil { + return x.AppId + } + return "" +} + +type GetGithubAppConfigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetGithubAppConfigRequest) Reset() { + *x = GetGithubAppConfigRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_github_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGithubAppConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGithubAppConfigRequest) ProtoMessage() {} + +func (x *GetGithubAppConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_github_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetGithubAppConfigRequest.ProtoReflect.Descriptor instead. +func (*GetGithubAppConfigRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_github_proto_rawDescGZIP(), []int{1} +} + +type GetGithubAppConfigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AppConfig *GithubAppConfig `protobuf:"bytes,1,opt,name=app_config,json=appConfig,proto3" json:"app_config,omitempty"` +} + +func (x *GetGithubAppConfigResponse) Reset() { + *x = GetGithubAppConfigResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_github_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGithubAppConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGithubAppConfigResponse) ProtoMessage() {} + +func (x *GetGithubAppConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_github_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetGithubAppConfigResponse.ProtoReflect.Descriptor instead. +func (*GetGithubAppConfigResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_github_proto_rawDescGZIP(), []int{2} +} + +func (x *GetGithubAppConfigResponse) GetAppConfig() *GithubAppConfig { + if x != nil { + return x.AppConfig + } + return nil +} + +var File_registry_v1alpha1_github_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_github_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, 0x28, 0x0a, 0x0f, 0x47, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x41, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x15, + 0x0a, 0x06, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x61, 0x70, 0x70, 0x49, 0x64, 0x22, 0x1b, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x47, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x41, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x77, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, 0x41, + 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x59, 0x0a, 0x0a, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, 0x41, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x52, 0x09, 0x61, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x32, 0xb8, 0x01, 0x0a, 0x0d, + 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa6, 0x01, + 0x0a, 0x12, 0x47, 0x65, 0x74, 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, 0x41, 0x70, 0x70, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, 0x41, 0x70, 0x70, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x41, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe6, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, + 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, + 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_github_proto_rawDescOnce sync.Once + file_registry_v1alpha1_github_proto_rawDescData = file_registry_v1alpha1_github_proto_rawDesc +) + +func file_registry_v1alpha1_github_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_github_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_github_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_github_proto_rawDescData) + }) + return file_registry_v1alpha1_github_proto_rawDescData +} + +var file_registry_v1alpha1_github_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_registry_v1alpha1_github_proto_goTypes = []interface{}{ + (*GithubAppConfig)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.GithubAppConfig + (*GetGithubAppConfigRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetGithubAppConfigRequest + (*GetGithubAppConfigResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetGithubAppConfigResponse +} +var file_registry_v1alpha1_github_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetGithubAppConfigResponse.app_config:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GithubAppConfig + 1, // 1: bufman.dubbo.apache.org.registry.v1alpha1.GithubService.GetGithubAppConfig:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetGithubAppConfigRequest + 2, // 2: bufman.dubbo.apache.org.registry.v1alpha1.GithubService.GetGithubAppConfig:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetGithubAppConfigResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_github_proto_init() } +func file_registry_v1alpha1_github_proto_init() { + if File_registry_v1alpha1_github_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_github_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GithubAppConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_github_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGithubAppConfigRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_github_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGithubAppConfigResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_github_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_github_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_github_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_github_proto_msgTypes, + }.Build() + File_registry_v1alpha1_github_proto = out.File + file_registry_v1alpha1_github_proto_rawDesc = nil + file_registry_v1alpha1_github_proto_goTypes = nil + file_registry_v1alpha1_github_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/github_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/github_grpc.pb.go new file mode 100644 index 000000000..54c1a893f --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/github_grpc.pb.go @@ -0,0 +1,111 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/github.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + GithubService_GetGithubAppConfig_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.GithubService/GetGithubAppConfig" +) + +// GithubServiceClient is the client API for GithubService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type GithubServiceClient interface { + // GetGithubAppConfig returns a Github Application Configuration. + GetGithubAppConfig(ctx context.Context, in *GetGithubAppConfigRequest, opts ...grpc.CallOption) (*GetGithubAppConfigResponse, error) +} + +type githubServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewGithubServiceClient(cc grpc.ClientConnInterface) GithubServiceClient { + return &githubServiceClient{cc} +} + +func (c *githubServiceClient) GetGithubAppConfig(ctx context.Context, in *GetGithubAppConfigRequest, opts ...grpc.CallOption) (*GetGithubAppConfigResponse, error) { + out := new(GetGithubAppConfigResponse) + err := c.cc.Invoke(ctx, GithubService_GetGithubAppConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// GithubServiceServer is the server API for GithubService service. +// All implementations must embed UnimplementedGithubServiceServer +// for forward compatibility +type GithubServiceServer interface { + // GetGithubAppConfig returns a Github Application Configuration. + GetGithubAppConfig(context.Context, *GetGithubAppConfigRequest) (*GetGithubAppConfigResponse, error) + mustEmbedUnimplementedGithubServiceServer() +} + +// UnimplementedGithubServiceServer must be embedded to have forward compatible implementations. +type UnimplementedGithubServiceServer struct { +} + +func (UnimplementedGithubServiceServer) GetGithubAppConfig(context.Context, *GetGithubAppConfigRequest) (*GetGithubAppConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGithubAppConfig not implemented") +} +func (UnimplementedGithubServiceServer) mustEmbedUnimplementedGithubServiceServer() {} + +// UnsafeGithubServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GithubServiceServer will +// result in compilation errors. +type UnsafeGithubServiceServer interface { + mustEmbedUnimplementedGithubServiceServer() +} + +func RegisterGithubServiceServer(s grpc.ServiceRegistrar, srv GithubServiceServer) { + s.RegisterService(&GithubService_ServiceDesc, srv) +} + +func _GithubService_GetGithubAppConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGithubAppConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GithubServiceServer).GetGithubAppConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GithubService_GetGithubAppConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GithubServiceServer).GetGithubAppConfig(ctx, req.(*GetGithubAppConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// GithubService_ServiceDesc is the grpc.ServiceDesc for GithubService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var GithubService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.GithubService", + HandlerType: (*GithubServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetGithubAppConfig", + Handler: _GithubService_GetGithubAppConfig_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/github.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/image.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/image.pb.go new file mode 100644 index 000000000..05482f207 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/image.pb.go @@ -0,0 +1,398 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/image.proto + +package registryv1alpha1 + +import ( + v1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// ImageMask is used in GetImageRequest to specify which parts of an image +// should be masked in responses. +type ImageMask int32 + +const ( + ImageMask_IMAGE_MASK_UNSPECIFIED ImageMask = 0 + // IMAGE_MASK_MESSAGES refers to ImageFile's `google.protobuf.DescriptorProto + // message_type` field. + ImageMask_IMAGE_MASK_MESSAGES ImageMask = 1 + // IMAGE_MASK_ENUMS refers to ImageFile's `google.protobuf.EnumDescriptorProto + // enum_type` field. + ImageMask_IMAGE_MASK_ENUMS ImageMask = 2 + // IMAGE_MASK_SERVICES refers to ImageFile's + // `google.protobuf.ServiceDescriptorProto service` field. + ImageMask_IMAGE_MASK_SERVICES ImageMask = 3 +) + +// Enum value maps for ImageMask. +var ( + ImageMask_name = map[int32]string{ + 0: "IMAGE_MASK_UNSPECIFIED", + 1: "IMAGE_MASK_MESSAGES", + 2: "IMAGE_MASK_ENUMS", + 3: "IMAGE_MASK_SERVICES", + } + ImageMask_value = map[string]int32{ + "IMAGE_MASK_UNSPECIFIED": 0, + "IMAGE_MASK_MESSAGES": 1, + "IMAGE_MASK_ENUMS": 2, + "IMAGE_MASK_SERVICES": 3, + } +) + +func (x ImageMask) Enum() *ImageMask { + p := new(ImageMask) + *p = x + return p +} + +func (x ImageMask) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ImageMask) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_image_proto_enumTypes[0].Descriptor() +} + +func (ImageMask) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_image_proto_enumTypes[0] +} + +func (x ImageMask) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ImageMask.Descriptor instead. +func (ImageMask) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_image_proto_rawDescGZIP(), []int{0} +} + +type GetImageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` + // Exclude files from imported buf modules in this image. + ExcludeImports bool `protobuf:"varint,4,opt,name=exclude_imports,json=excludeImports,proto3" json:"exclude_imports,omitempty"` + // Exclude source_code_info fields from each ImageFile. + ExcludeSourceInfo bool `protobuf:"varint,5,opt,name=exclude_source_info,json=excludeSourceInfo,proto3" json:"exclude_source_info,omitempty"` + // When specified the returned image will only contain the necessary files and + // descriptors in those files to describe these types. Accepts messages, enums + // and services. All types must be defined in the buf module, types in + // dependencies are not accepted. + // + // At this time specifying `types` requires `exclude_source_info` to be set to + // true. + Types []string `protobuf:"bytes,6,rep,name=types,proto3" json:"types,omitempty"` + // When not empty, the returned image's files will only include + // *DescriptorProto fields for the elements specified here. The masks are + // applied without regard for dependencies between types. For example, if + // `IMAGE_MASK_MESSAGES` is specified without `IMAGE_MASK_ENUMS` the resulting + // image will NOT contain enum definitions even if they are referenced from + // message fields. + IncludeMask []ImageMask `protobuf:"varint,7,rep,packed,name=include_mask,json=includeMask,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.ImageMask" json:"include_mask,omitempty"` +} + +func (x *GetImageRequest) Reset() { + *x = GetImageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_image_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetImageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetImageRequest) ProtoMessage() {} + +func (x *GetImageRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_image_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetImageRequest.ProtoReflect.Descriptor instead. +func (*GetImageRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_image_proto_rawDescGZIP(), []int{0} +} + +func (x *GetImageRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetImageRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetImageRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +func (x *GetImageRequest) GetExcludeImports() bool { + if x != nil { + return x.ExcludeImports + } + return false +} + +func (x *GetImageRequest) GetExcludeSourceInfo() bool { + if x != nil { + return x.ExcludeSourceInfo + } + return false +} + +func (x *GetImageRequest) GetTypes() []string { + if x != nil { + return x.Types + } + return nil +} + +func (x *GetImageRequest) GetIncludeMask() []ImageMask { + if x != nil { + return x.IncludeMask + } + return nil +} + +type GetImageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Image *v1.Image `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` +} + +func (x *GetImageResponse) Reset() { + *x = GetImageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_image_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetImageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetImageResponse) ProtoMessage() {} + +func (x *GetImageResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_image_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetImageResponse.ProtoReflect.Descriptor instead. +func (*GetImageResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_image_proto_rawDescGZIP(), []int{1} +} + +func (x *GetImageResponse) GetImage() *v1.Image { + if x != nil { + return x.Image + } + return nil +} + +var File_registry_v1alpha1_image_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_image_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x14, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xad, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x63, 0x6c, + 0x75, 0x64, 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0e, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, + 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x34, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4d, + 0x61, 0x73, 0x6b, 0x52, 0x0b, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4d, 0x61, 0x73, 0x6b, + 0x22, 0x51, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x2a, 0x6f, 0x0a, 0x09, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x73, 0x6b, + 0x12, 0x1a, 0x0a, 0x16, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x4d, 0x41, 0x53, 0x4b, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, + 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x4d, 0x41, 0x53, 0x4b, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, + 0x47, 0x45, 0x53, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x4d, + 0x41, 0x53, 0x4b, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x53, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x49, + 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x4d, 0x41, 0x53, 0x4b, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, + 0x45, 0x53, 0x10, 0x03, 0x32, 0x99, 0x01, 0x0a, 0x0c, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x88, 0x01, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x12, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6d, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, + 0x42, 0xe5, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x42, 0x0a, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, + 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, + 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, + 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, + 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_image_proto_rawDescOnce sync.Once + file_registry_v1alpha1_image_proto_rawDescData = file_registry_v1alpha1_image_proto_rawDesc +) + +func file_registry_v1alpha1_image_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_image_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_image_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_image_proto_rawDescData) + }) + return file_registry_v1alpha1_image_proto_rawDescData +} + +var file_registry_v1alpha1_image_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_image_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_registry_v1alpha1_image_proto_goTypes = []interface{}{ + (ImageMask)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.ImageMask + (*GetImageRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetImageRequest + (*GetImageResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetImageResponse + (*v1.Image)(nil), // 3: bufman.dubbo.apache.org.image.v1.Image +} +var file_registry_v1alpha1_image_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetImageRequest.include_mask:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ImageMask + 3, // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetImageResponse.image:type_name -> bufman.dubbo.apache.org.image.v1.Image + 1, // 2: bufman.dubbo.apache.org.registry.v1alpha1.ImageService.GetImage:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetImageRequest + 2, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ImageService.GetImage:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetImageResponse + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_image_proto_init() } +func file_registry_v1alpha1_image_proto_init() { + if File_registry_v1alpha1_image_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_image_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetImageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_image_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetImageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_image_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_image_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_image_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_image_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_image_proto_msgTypes, + }.Build() + File_registry_v1alpha1_image_proto = out.File + file_registry_v1alpha1_image_proto_rawDesc = nil + file_registry_v1alpha1_image_proto_goTypes = nil + file_registry_v1alpha1_image_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/image_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/image_grpc.pb.go new file mode 100644 index 000000000..f1a8da16e --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/image_grpc.pb.go @@ -0,0 +1,113 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/image.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + ImageService_GetImage_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ImageService/GetImage" +) + +// ImageServiceClient is the client API for ImageService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ImageServiceClient interface { + // GetImage serves a compiled image for the local module. It automatically + // downloads dependencies if necessary. + GetImage(ctx context.Context, in *GetImageRequest, opts ...grpc.CallOption) (*GetImageResponse, error) +} + +type imageServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewImageServiceClient(cc grpc.ClientConnInterface) ImageServiceClient { + return &imageServiceClient{cc} +} + +func (c *imageServiceClient) GetImage(ctx context.Context, in *GetImageRequest, opts ...grpc.CallOption) (*GetImageResponse, error) { + out := new(GetImageResponse) + err := c.cc.Invoke(ctx, ImageService_GetImage_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ImageServiceServer is the server API for ImageService service. +// All implementations must embed UnimplementedImageServiceServer +// for forward compatibility +type ImageServiceServer interface { + // GetImage serves a compiled image for the local module. It automatically + // downloads dependencies if necessary. + GetImage(context.Context, *GetImageRequest) (*GetImageResponse, error) + mustEmbedUnimplementedImageServiceServer() +} + +// UnimplementedImageServiceServer must be embedded to have forward compatible implementations. +type UnimplementedImageServiceServer struct { +} + +func (UnimplementedImageServiceServer) GetImage(context.Context, *GetImageRequest) (*GetImageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetImage not implemented") +} +func (UnimplementedImageServiceServer) mustEmbedUnimplementedImageServiceServer() {} + +// UnsafeImageServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ImageServiceServer will +// result in compilation errors. +type UnsafeImageServiceServer interface { + mustEmbedUnimplementedImageServiceServer() +} + +func RegisterImageServiceServer(s grpc.ServiceRegistrar, srv ImageServiceServer) { + s.RegisterService(&ImageService_ServiceDesc, srv) +} + +func _ImageService_GetImage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetImageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ImageServiceServer).GetImage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ImageService_GetImage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ImageServiceServer).GetImage(ctx, req.(*GetImageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ImageService_ServiceDesc is the grpc.ServiceDesc for ImageService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ImageService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.ImageService", + HandlerType: (*ImageServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetImage", + Handler: _ImageService_GetImage_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/image.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/jsonschema.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/jsonschema.pb.go new file mode 100644 index 000000000..465a32dcb --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/jsonschema.pb.go @@ -0,0 +1,281 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/jsonschema.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetJSONSchemaRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` + // A fully qualified name of the type to generate a JSONSchema for, e.g. + // "pkg.foo.Bar". The type needs to resolve in the referenced module or any of + // its dependencies. Currently only messages types are supported. + TypeName string `protobuf:"bytes,4,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` +} + +func (x *GetJSONSchemaRequest) Reset() { + *x = GetJSONSchemaRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_jsonschema_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetJSONSchemaRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetJSONSchemaRequest) ProtoMessage() {} + +func (x *GetJSONSchemaRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_jsonschema_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetJSONSchemaRequest.ProtoReflect.Descriptor instead. +func (*GetJSONSchemaRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_jsonschema_proto_rawDescGZIP(), []int{0} +} + +func (x *GetJSONSchemaRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetJSONSchemaRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetJSONSchemaRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +func (x *GetJSONSchemaRequest) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +type GetJSONSchemaResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A json schema representing what the json encoded payload for type_name + // should conform to. This schema is an approximation to be used by editors + // for validation and autocompletion, not a lossless representation of the + // type's descriptor. + JsonSchema []byte `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema,proto3" json:"json_schema,omitempty"` +} + +func (x *GetJSONSchemaResponse) Reset() { + *x = GetJSONSchemaResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_jsonschema_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetJSONSchemaResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetJSONSchemaResponse) ProtoMessage() {} + +func (x *GetJSONSchemaResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_jsonschema_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetJSONSchemaResponse.ProtoReflect.Descriptor instead. +func (*GetJSONSchemaResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_jsonschema_proto_rawDescGZIP(), []int{1} +} + +func (x *GetJSONSchemaResponse) GetJsonSchema() []byte { + if x != nil { + return x.JsonSchema + } + return nil +} + +var File_registry_v1alpha1_jsonschema_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_jsonschema_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, + 0x87, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, + 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, + 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x38, 0x0a, 0x15, 0x47, 0x65, 0x74, + 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6a, 0x73, 0x6f, 0x6e, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x32, 0xad, 0x01, 0x0a, 0x11, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x97, 0x01, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3f, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4a, 0x53, 0x4f, 0x4e, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x01, 0x42, 0xea, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0f, 0x4a, 0x73, 0x6f, 0x6e, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, + 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, + 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, + 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_jsonschema_proto_rawDescOnce sync.Once + file_registry_v1alpha1_jsonschema_proto_rawDescData = file_registry_v1alpha1_jsonschema_proto_rawDesc +) + +func file_registry_v1alpha1_jsonschema_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_jsonschema_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_jsonschema_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_jsonschema_proto_rawDescData) + }) + return file_registry_v1alpha1_jsonschema_proto_rawDescData +} + +var file_registry_v1alpha1_jsonschema_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_registry_v1alpha1_jsonschema_proto_goTypes = []interface{}{ + (*GetJSONSchemaRequest)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetJSONSchemaRequest + (*GetJSONSchemaResponse)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetJSONSchemaResponse +} +var file_registry_v1alpha1_jsonschema_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService.GetJSONSchema:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetJSONSchemaRequest + 1, // 1: bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService.GetJSONSchema:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetJSONSchemaResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_jsonschema_proto_init() } +func file_registry_v1alpha1_jsonschema_proto_init() { + if File_registry_v1alpha1_jsonschema_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_jsonschema_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetJSONSchemaRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_jsonschema_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetJSONSchemaResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_jsonschema_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_jsonschema_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_jsonschema_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_jsonschema_proto_msgTypes, + }.Build() + File_registry_v1alpha1_jsonschema_proto = out.File + file_registry_v1alpha1_jsonschema_proto_rawDesc = nil + file_registry_v1alpha1_jsonschema_proto_goTypes = nil + file_registry_v1alpha1_jsonschema_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/jsonschema_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/jsonschema_grpc.pb.go new file mode 100644 index 000000000..f8b39b7f7 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/jsonschema_grpc.pb.go @@ -0,0 +1,113 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/jsonschema.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + JSONSchemaService_GetJSONSchema_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService/GetJSONSchema" +) + +// JSONSchemaServiceClient is the client API for JSONSchemaService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type JSONSchemaServiceClient interface { + // GetJSONSchema allows users to get an (approximate) json schema for a + // protobuf type. + GetJSONSchema(ctx context.Context, in *GetJSONSchemaRequest, opts ...grpc.CallOption) (*GetJSONSchemaResponse, error) +} + +type jSONSchemaServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewJSONSchemaServiceClient(cc grpc.ClientConnInterface) JSONSchemaServiceClient { + return &jSONSchemaServiceClient{cc} +} + +func (c *jSONSchemaServiceClient) GetJSONSchema(ctx context.Context, in *GetJSONSchemaRequest, opts ...grpc.CallOption) (*GetJSONSchemaResponse, error) { + out := new(GetJSONSchemaResponse) + err := c.cc.Invoke(ctx, JSONSchemaService_GetJSONSchema_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// JSONSchemaServiceServer is the server API for JSONSchemaService service. +// All implementations must embed UnimplementedJSONSchemaServiceServer +// for forward compatibility +type JSONSchemaServiceServer interface { + // GetJSONSchema allows users to get an (approximate) json schema for a + // protobuf type. + GetJSONSchema(context.Context, *GetJSONSchemaRequest) (*GetJSONSchemaResponse, error) + mustEmbedUnimplementedJSONSchemaServiceServer() +} + +// UnimplementedJSONSchemaServiceServer must be embedded to have forward compatible implementations. +type UnimplementedJSONSchemaServiceServer struct { +} + +func (UnimplementedJSONSchemaServiceServer) GetJSONSchema(context.Context, *GetJSONSchemaRequest) (*GetJSONSchemaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetJSONSchema not implemented") +} +func (UnimplementedJSONSchemaServiceServer) mustEmbedUnimplementedJSONSchemaServiceServer() {} + +// UnsafeJSONSchemaServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to JSONSchemaServiceServer will +// result in compilation errors. +type UnsafeJSONSchemaServiceServer interface { + mustEmbedUnimplementedJSONSchemaServiceServer() +} + +func RegisterJSONSchemaServiceServer(s grpc.ServiceRegistrar, srv JSONSchemaServiceServer) { + s.RegisterService(&JSONSchemaService_ServiceDesc, srv) +} + +func _JSONSchemaService_GetJSONSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetJSONSchemaRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(JSONSchemaServiceServer).GetJSONSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: JSONSchemaService_GetJSONSchema_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(JSONSchemaServiceServer).GetJSONSchema(ctx, req.(*GetJSONSchemaRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// JSONSchemaService_ServiceDesc is the grpc.ServiceDesc for JSONSchemaService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var JSONSchemaService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.JSONSchemaService", + HandlerType: (*JSONSchemaServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetJSONSchema", + Handler: _JSONSchemaService_GetJSONSchema_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/jsonschema.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/labels.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/labels.pb.go new file mode 100644 index 000000000..9ae5471a8 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/labels.pb.go @@ -0,0 +1,934 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/labels.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LabelNamespace int32 + +const ( + LabelNamespace_LABEL_NAMESPACE_UNSPECIFIED LabelNamespace = 0 + LabelNamespace_LABEL_NAMESPACE_TAG LabelNamespace = 1 + LabelNamespace_LABEL_NAMESPACE_BRANCH LabelNamespace = 2 + LabelNamespace_LABEL_NAMESPACE_GIT_COMMIT LabelNamespace = 3 + LabelNamespace_LABEL_NAMESPACE_REVIEW LabelNamespace = 4 + LabelNamespace_LABEL_NAMESPACE_BSR_HEAD LabelNamespace = 5 +) + +// Enum value maps for LabelNamespace. +var ( + LabelNamespace_name = map[int32]string{ + 0: "LABEL_NAMESPACE_UNSPECIFIED", + 1: "LABEL_NAMESPACE_TAG", + 2: "LABEL_NAMESPACE_BRANCH", + 3: "LABEL_NAMESPACE_GIT_COMMIT", + 4: "LABEL_NAMESPACE_REVIEW", + 5: "LABEL_NAMESPACE_BSR_HEAD", + } + LabelNamespace_value = map[string]int32{ + "LABEL_NAMESPACE_UNSPECIFIED": 0, + "LABEL_NAMESPACE_TAG": 1, + "LABEL_NAMESPACE_BRANCH": 2, + "LABEL_NAMESPACE_GIT_COMMIT": 3, + "LABEL_NAMESPACE_REVIEW": 4, + "LABEL_NAMESPACE_BSR_HEAD": 5, + } +) + +func (x LabelNamespace) Enum() *LabelNamespace { + p := new(LabelNamespace) + *p = x + return p +} + +func (x LabelNamespace) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LabelNamespace) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_labels_proto_enumTypes[0].Descriptor() +} + +func (LabelNamespace) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_labels_proto_enumTypes[0] +} + +func (x LabelNamespace) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use LabelNamespace.Descriptor instead. +func (LabelNamespace) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{0} +} + +type Label struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LabelName *LabelName `protobuf:"bytes,1,opt,name=label_name,json=labelName,proto3" json:"label_name,omitempty"` + LabelValue *LabelValue `protobuf:"bytes,2,opt,name=label_value,json=labelValue,proto3" json:"label_value,omitempty"` +} + +func (x *Label) Reset() { + *x = Label{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Label) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Label) ProtoMessage() {} + +func (x *Label) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Label.ProtoReflect.Descriptor instead. +func (*Label) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{0} +} + +func (x *Label) GetLabelName() *LabelName { + if x != nil { + return x.LabelName + } + return nil +} + +func (x *Label) GetLabelValue() *LabelValue { + if x != nil { + return x.LabelValue + } + return nil +} + +type LabelName struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Namespace LabelNamespace `protobuf:"varint,1,opt,name=namespace,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.LabelNamespace" json:"namespace,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *LabelName) Reset() { + *x = LabelName{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LabelName) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LabelName) ProtoMessage() {} + +func (x *LabelName) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LabelName.ProtoReflect.Descriptor instead. +func (*LabelName) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{1} +} + +func (x *LabelName) GetNamespace() LabelNamespace { + if x != nil { + return x.Namespace + } + return LabelNamespace_LABEL_NAMESPACE_UNSPECIFIED +} + +func (x *LabelName) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type LabelValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CommitId string `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` +} + +func (x *LabelValue) Reset() { + *x = LabelValue{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LabelValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LabelValue) ProtoMessage() {} + +func (x *LabelValue) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LabelValue.ProtoReflect.Descriptor instead. +func (*LabelValue) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{2} +} + +func (x *LabelValue) GetCommitId() string { + if x != nil { + return x.CommitId + } + return "" +} + +type CreateLabelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LabelName *LabelName `protobuf:"bytes,1,opt,name=label_name,json=labelName,proto3" json:"label_name,omitempty"` + LabelValue *LabelValue `protobuf:"bytes,2,opt,name=label_value,json=labelValue,proto3" json:"label_value,omitempty"` + Author *string `protobuf:"bytes,3,opt,name=author,proto3,oneof" json:"author,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3,oneof" json:"create_time,omitempty"` +} + +func (x *CreateLabelRequest) Reset() { + *x = CreateLabelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateLabelRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateLabelRequest) ProtoMessage() {} + +func (x *CreateLabelRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateLabelRequest.ProtoReflect.Descriptor instead. +func (*CreateLabelRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateLabelRequest) GetLabelName() *LabelName { + if x != nil { + return x.LabelName + } + return nil +} + +func (x *CreateLabelRequest) GetLabelValue() *LabelValue { + if x != nil { + return x.LabelValue + } + return nil +} + +func (x *CreateLabelRequest) GetAuthor() string { + if x != nil && x.Author != nil { + return *x.Author + } + return "" +} + +func (x *CreateLabelRequest) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +type CreateLabelResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CommitId *LabelValue `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` +} + +func (x *CreateLabelResponse) Reset() { + *x = CreateLabelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateLabelResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateLabelResponse) ProtoMessage() {} + +func (x *CreateLabelResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateLabelResponse.ProtoReflect.Descriptor instead. +func (*CreateLabelResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateLabelResponse) GetCommitId() *LabelValue { + if x != nil { + return x.CommitId + } + return nil +} + +type MoveLabelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LabelName *LabelName `protobuf:"bytes,1,opt,name=label_name,json=labelName,proto3" json:"label_name,omitempty"` + From *LabelValue `protobuf:"bytes,2,opt,name=from,proto3,oneof" json:"from,omitempty"` + To *LabelValue `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` +} + +func (x *MoveLabelRequest) Reset() { + *x = MoveLabelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MoveLabelRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MoveLabelRequest) ProtoMessage() {} + +func (x *MoveLabelRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MoveLabelRequest.ProtoReflect.Descriptor instead. +func (*MoveLabelRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{5} +} + +func (x *MoveLabelRequest) GetLabelName() *LabelName { + if x != nil { + return x.LabelName + } + return nil +} + +func (x *MoveLabelRequest) GetFrom() *LabelValue { + if x != nil { + return x.From + } + return nil +} + +func (x *MoveLabelRequest) GetTo() *LabelValue { + if x != nil { + return x.To + } + return nil +} + +type MoveLabelResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MoveLabelResponse) Reset() { + *x = MoveLabelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MoveLabelResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MoveLabelResponse) ProtoMessage() {} + +func (x *MoveLabelResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MoveLabelResponse.ProtoReflect.Descriptor instead. +func (*MoveLabelResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{6} +} + +type GetLabelsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + LabelName *LabelName `protobuf:"bytes,3,opt,name=label_name,json=labelName,proto3,oneof" json:"label_name,omitempty"` + LabelValue *LabelValue `protobuf:"bytes,4,opt,name=label_value,json=labelValue,proto3,oneof" json:"label_value,omitempty"` +} + +func (x *GetLabelsRequest) Reset() { + *x = GetLabelsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetLabelsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLabelsRequest) ProtoMessage() {} + +func (x *GetLabelsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLabelsRequest.ProtoReflect.Descriptor instead. +func (*GetLabelsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{7} +} + +func (x *GetLabelsRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *GetLabelsRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *GetLabelsRequest) GetLabelName() *LabelName { + if x != nil { + return x.LabelName + } + return nil +} + +func (x *GetLabelsRequest) GetLabelValue() *LabelValue { + if x != nil { + return x.LabelValue + } + return nil +} + +type GetLabelsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Labels []*Label `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` +} + +func (x *GetLabelsResponse) Reset() { + *x = GetLabelsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetLabelsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLabelsResponse) ProtoMessage() {} + +func (x *GetLabelsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_labels_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLabelsResponse.ProtoReflect.Descriptor instead. +func (*GetLabelsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_labels_proto_rawDescGZIP(), []int{8} +} + +func (x *GetLabelsResponse) GetLabels() []*Label { + if x != nil { + return x.Labels + } + return nil +} + +var File_registry_v1alpha1_labels_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_labels_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb4, 0x01, 0x0a, + 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x53, 0x0a, 0x0a, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x52, 0x09, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x56, 0x0a, 0x0b, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0x78, 0x0a, 0x09, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x57, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x09, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x29, 0x0a, + 0x0a, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x22, 0xbb, 0x02, 0x0a, 0x12, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x53, 0x0a, 0x0a, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x09, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x56, 0x0a, 0x0b, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x0a, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x06, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x40, 0x0a, 0x0b, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, 0x01, 0x52, 0x0a, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x69, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, + 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, + 0x64, 0x22, 0x87, 0x02, 0x0a, 0x10, 0x4d, 0x6f, 0x76, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x0a, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x52, 0x09, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x4e, 0x0a, 0x04, 0x66, + 0x72, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x48, 0x00, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x12, 0x45, 0x0a, 0x02, 0x74, + 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x02, + 0x74, 0x6f, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x22, 0x13, 0x0a, 0x11, 0x4d, + 0x6f, 0x76, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xbc, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x58, 0x0a, 0x0a, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4e, + 0x61, 0x6d, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x5b, 0x0a, 0x0b, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, + 0x01, 0x52, 0x0a, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, + 0x0e, 0x0a, 0x0c, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x5d, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x2a, 0xc0, + 0x01, 0x0a, 0x0e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x53, + 0x50, 0x41, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4e, 0x41, 0x4d, 0x45, + 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x54, 0x41, 0x47, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x4c, + 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x42, + 0x52, 0x41, 0x4e, 0x43, 0x48, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x4c, 0x41, 0x42, 0x45, 0x4c, + 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x5f, 0x43, + 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4c, 0x41, 0x42, 0x45, 0x4c, + 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x52, 0x45, 0x56, 0x49, 0x45, + 0x57, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4e, 0x41, 0x4d, + 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x42, 0x53, 0x52, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x10, + 0x05, 0x32, 0xb9, 0x03, 0x0a, 0x0c, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x91, 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x12, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0x86, 0x01, 0x0a, 0x09, 0x4d, 0x6f, 0x76, 0x65, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4d, 0x6f, 0x76, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, + 0x76, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x8b, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x3b, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3c, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe6, 0x02, + 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, + 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, + 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, + 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, + 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, + 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_labels_proto_rawDescOnce sync.Once + file_registry_v1alpha1_labels_proto_rawDescData = file_registry_v1alpha1_labels_proto_rawDesc +) + +func file_registry_v1alpha1_labels_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_labels_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_labels_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_labels_proto_rawDescData) + }) + return file_registry_v1alpha1_labels_proto_rawDescData +} + +var file_registry_v1alpha1_labels_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_labels_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_registry_v1alpha1_labels_proto_goTypes = []interface{}{ + (LabelNamespace)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.LabelNamespace + (*Label)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.Label + (*LabelName)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.LabelName + (*LabelValue)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.LabelValue + (*CreateLabelRequest)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.CreateLabelRequest + (*CreateLabelResponse)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.CreateLabelResponse + (*MoveLabelRequest)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.MoveLabelRequest + (*MoveLabelResponse)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.MoveLabelResponse + (*GetLabelsRequest)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetLabelsRequest + (*GetLabelsResponse)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetLabelsResponse + (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp +} +var file_registry_v1alpha1_labels_proto_depIdxs = []int32{ + 2, // 0: bufman.dubbo.apache.org.registry.v1alpha1.Label.label_name:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelName + 3, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Label.label_value:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelValue + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.LabelName.namespace:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelNamespace + 2, // 3: bufman.dubbo.apache.org.registry.v1alpha1.CreateLabelRequest.label_name:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelName + 3, // 4: bufman.dubbo.apache.org.registry.v1alpha1.CreateLabelRequest.label_value:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelValue + 10, // 5: bufman.dubbo.apache.org.registry.v1alpha1.CreateLabelRequest.create_time:type_name -> google.protobuf.Timestamp + 3, // 6: bufman.dubbo.apache.org.registry.v1alpha1.CreateLabelResponse.commit_id:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelValue + 2, // 7: bufman.dubbo.apache.org.registry.v1alpha1.MoveLabelRequest.label_name:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelName + 3, // 8: bufman.dubbo.apache.org.registry.v1alpha1.MoveLabelRequest.from:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelValue + 3, // 9: bufman.dubbo.apache.org.registry.v1alpha1.MoveLabelRequest.to:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelValue + 2, // 10: bufman.dubbo.apache.org.registry.v1alpha1.GetLabelsRequest.label_name:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelName + 3, // 11: bufman.dubbo.apache.org.registry.v1alpha1.GetLabelsRequest.label_value:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LabelValue + 1, // 12: bufman.dubbo.apache.org.registry.v1alpha1.GetLabelsResponse.labels:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Label + 4, // 13: bufman.dubbo.apache.org.registry.v1alpha1.LabelService.CreateLabel:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateLabelRequest + 6, // 14: bufman.dubbo.apache.org.registry.v1alpha1.LabelService.MoveLabel:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.MoveLabelRequest + 8, // 15: bufman.dubbo.apache.org.registry.v1alpha1.LabelService.GetLabels:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetLabelsRequest + 5, // 16: bufman.dubbo.apache.org.registry.v1alpha1.LabelService.CreateLabel:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateLabelResponse + 7, // 17: bufman.dubbo.apache.org.registry.v1alpha1.LabelService.MoveLabel:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.MoveLabelResponse + 9, // 18: bufman.dubbo.apache.org.registry.v1alpha1.LabelService.GetLabels:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetLabelsResponse + 16, // [16:19] is the sub-list for method output_type + 13, // [13:16] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_labels_proto_init() } +func file_registry_v1alpha1_labels_proto_init() { + if File_registry_v1alpha1_labels_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_labels_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Label); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_labels_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LabelName); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_labels_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LabelValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_labels_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateLabelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_labels_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateLabelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_labels_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MoveLabelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_labels_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MoveLabelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_labels_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetLabelsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_labels_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetLabelsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_labels_proto_msgTypes[3].OneofWrappers = []interface{}{} + file_registry_v1alpha1_labels_proto_msgTypes[5].OneofWrappers = []interface{}{} + file_registry_v1alpha1_labels_proto_msgTypes[7].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_labels_proto_rawDesc, + NumEnums: 1, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_labels_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_labels_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_labels_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_labels_proto_msgTypes, + }.Build() + File_registry_v1alpha1_labels_proto = out.File + file_registry_v1alpha1_labels_proto_rawDesc = nil + file_registry_v1alpha1_labels_proto_goTypes = nil + file_registry_v1alpha1_labels_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/labels_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/labels_grpc.pb.go new file mode 100644 index 000000000..cec3ea334 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/labels_grpc.pb.go @@ -0,0 +1,183 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/labels.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + LabelService_CreateLabel_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/CreateLabel" + LabelService_MoveLabel_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/MoveLabel" + LabelService_GetLabels_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.LabelService/GetLabels" +) + +// LabelServiceClient is the client API for LabelService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type LabelServiceClient interface { + CreateLabel(ctx context.Context, in *CreateLabelRequest, opts ...grpc.CallOption) (*CreateLabelResponse, error) + MoveLabel(ctx context.Context, in *MoveLabelRequest, opts ...grpc.CallOption) (*MoveLabelResponse, error) + GetLabels(ctx context.Context, in *GetLabelsRequest, opts ...grpc.CallOption) (*GetLabelsResponse, error) +} + +type labelServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewLabelServiceClient(cc grpc.ClientConnInterface) LabelServiceClient { + return &labelServiceClient{cc} +} + +func (c *labelServiceClient) CreateLabel(ctx context.Context, in *CreateLabelRequest, opts ...grpc.CallOption) (*CreateLabelResponse, error) { + out := new(CreateLabelResponse) + err := c.cc.Invoke(ctx, LabelService_CreateLabel_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *labelServiceClient) MoveLabel(ctx context.Context, in *MoveLabelRequest, opts ...grpc.CallOption) (*MoveLabelResponse, error) { + out := new(MoveLabelResponse) + err := c.cc.Invoke(ctx, LabelService_MoveLabel_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *labelServiceClient) GetLabels(ctx context.Context, in *GetLabelsRequest, opts ...grpc.CallOption) (*GetLabelsResponse, error) { + out := new(GetLabelsResponse) + err := c.cc.Invoke(ctx, LabelService_GetLabels_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LabelServiceServer is the server API for LabelService service. +// All implementations must embed UnimplementedLabelServiceServer +// for forward compatibility +type LabelServiceServer interface { + CreateLabel(context.Context, *CreateLabelRequest) (*CreateLabelResponse, error) + MoveLabel(context.Context, *MoveLabelRequest) (*MoveLabelResponse, error) + GetLabels(context.Context, *GetLabelsRequest) (*GetLabelsResponse, error) + mustEmbedUnimplementedLabelServiceServer() +} + +// UnimplementedLabelServiceServer must be embedded to have forward compatible implementations. +type UnimplementedLabelServiceServer struct { +} + +func (UnimplementedLabelServiceServer) CreateLabel(context.Context, *CreateLabelRequest) (*CreateLabelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateLabel not implemented") +} +func (UnimplementedLabelServiceServer) MoveLabel(context.Context, *MoveLabelRequest) (*MoveLabelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MoveLabel not implemented") +} +func (UnimplementedLabelServiceServer) GetLabels(context.Context, *GetLabelsRequest) (*GetLabelsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLabels not implemented") +} +func (UnimplementedLabelServiceServer) mustEmbedUnimplementedLabelServiceServer() {} + +// UnsafeLabelServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LabelServiceServer will +// result in compilation errors. +type UnsafeLabelServiceServer interface { + mustEmbedUnimplementedLabelServiceServer() +} + +func RegisterLabelServiceServer(s grpc.ServiceRegistrar, srv LabelServiceServer) { + s.RegisterService(&LabelService_ServiceDesc, srv) +} + +func _LabelService_CreateLabel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateLabelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LabelServiceServer).CreateLabel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LabelService_CreateLabel_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LabelServiceServer).CreateLabel(ctx, req.(*CreateLabelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LabelService_MoveLabel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MoveLabelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LabelServiceServer).MoveLabel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LabelService_MoveLabel_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LabelServiceServer).MoveLabel(ctx, req.(*MoveLabelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LabelService_GetLabels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetLabelsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LabelServiceServer).GetLabels(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LabelService_GetLabels_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LabelServiceServer).GetLabels(ctx, req.(*GetLabelsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// LabelService_ServiceDesc is the grpc.ServiceDesc for LabelService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LabelService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.LabelService", + HandlerType: (*LabelServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateLabel", + Handler: _LabelService_CreateLabel_Handler, + }, + { + MethodName: "MoveLabel", + Handler: _LabelService_MoveLabel_Handler, + }, + { + MethodName: "GetLabels", + Handler: _LabelService_GetLabels_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/labels.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/module.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/module.pb.go new file mode 100644 index 000000000..9c33c1ae5 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/module.pb.go @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/module.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// LocalModuleReference is a local module reference. +// +// It does not include a remote. +type LocalModuleReference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + // either branch or commit + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *LocalModuleReference) Reset() { + *x = LocalModuleReference{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalModuleReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalModuleReference) ProtoMessage() {} + +func (x *LocalModuleReference) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalModuleReference.ProtoReflect.Descriptor instead. +func (*LocalModuleReference) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_module_proto_rawDescGZIP(), []int{0} +} + +func (x *LocalModuleReference) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *LocalModuleReference) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *LocalModuleReference) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +// LocalModulePin is a local module pin. +// +// It does not include a remote. +type LocalModulePin struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Branch string `protobuf:"bytes,3,opt,name=branch,proto3" json:"branch,omitempty"` + Commit string `protobuf:"bytes,4,opt,name=commit,proto3" json:"commit,omitempty"` + // Module's manifest digest. Replacement for previous b1/b3 digests. + ManifestDigest string `protobuf:"bytes,6,opt,name=manifest_digest,json=manifestDigest,proto3" json:"manifest_digest,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + DraftName string `protobuf:"bytes,8,opt,name=draft_name,json=draftName,proto3" json:"draft_name,omitempty"` +} + +func (x *LocalModulePin) Reset() { + *x = LocalModulePin{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_module_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalModulePin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalModulePin) ProtoMessage() {} + +func (x *LocalModulePin) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_module_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalModulePin.ProtoReflect.Descriptor instead. +func (*LocalModulePin) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_module_proto_rawDescGZIP(), []int{1} +} + +func (x *LocalModulePin) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *LocalModulePin) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *LocalModulePin) GetBranch() string { + if x != nil { + return x.Branch + } + return "" +} + +func (x *LocalModulePin) GetCommit() string { + if x != nil { + return x.Commit + } + return "" +} + +func (x *LocalModulePin) GetManifestDigest() string { + if x != nil { + return x.ManifestDigest + } + return "" +} + +func (x *LocalModulePin) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *LocalModulePin) GetDraftName() string { + if x != nil { + return x.DraftName + } + return "" +} + +var File_registry_v1alpha1_module_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_module_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a, 0x0a, 0x14, + 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x89, 0x02, 0x0a, 0x0e, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x69, + 0x67, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x61, 0x6e, 0x69, + 0x66, 0x65, 0x73, 0x74, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x72, 0x61, 0x66, 0x74, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x72, 0x61, + 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x52, 0x06, 0x64, 0x69, + 0x67, 0x65, 0x73, 0x74, 0x42, 0xe6, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, + 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, + 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_module_proto_rawDescOnce sync.Once + file_registry_v1alpha1_module_proto_rawDescData = file_registry_v1alpha1_module_proto_rawDesc +) + +func file_registry_v1alpha1_module_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_module_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_module_proto_rawDescData) + }) + return file_registry_v1alpha1_module_proto_rawDescData +} + +var file_registry_v1alpha1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_registry_v1alpha1_module_proto_goTypes = []interface{}{ + (*LocalModuleReference)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference + (*LocalModulePin)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.LocalModulePin + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp +} +var file_registry_v1alpha1_module_proto_depIdxs = []int32{ + 2, // 0: bufman.dubbo.apache.org.registry.v1alpha1.LocalModulePin.create_time:type_name -> google.protobuf.Timestamp + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_module_proto_init() } +func file_registry_v1alpha1_module_proto_init() { + if File_registry_v1alpha1_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalModuleReference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_module_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalModulePin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_registry_v1alpha1_module_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_module_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_module_proto_msgTypes, + }.Build() + File_registry_v1alpha1_module_proto = out.File + file_registry_v1alpha1_module_proto_rawDesc = nil + file_registry_v1alpha1_module_proto_goTypes = nil + file_registry_v1alpha1_module_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/organization.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/organization.pb.go new file mode 100644 index 000000000..e6ca6ed4b --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/organization.pb.go @@ -0,0 +1,2893 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/organization.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Organization struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // primary key, unique, immutable + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // immutable + CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // mutable + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + // unique, mutable + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // description is the user configurable description of the organization. + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + // url is the user configurable URL in the description of the organization, + // always included the scheme and will not have a #fragment suffix. + Url string `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"` + // verification status of the organization, configurable by server admin. + VerificationStatus VerificationStatus `protobuf:"varint,7,opt,name=verification_status,json=verificationStatus,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus" json:"verification_status,omitempty"` +} + +func (x *Organization) Reset() { + *x = Organization{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Organization) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Organization) ProtoMessage() {} + +func (x *Organization) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Organization.ProtoReflect.Descriptor instead. +func (*Organization) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{0} +} + +func (x *Organization) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Organization) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *Organization) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +func (x *Organization) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Organization) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Organization) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Organization) GetVerificationStatus() VerificationStatus { + if x != nil { + return x.VerificationStatus + } + return VerificationStatus_VERIFICATION_STATUS_UNSPECIFIED +} + +// OrganizationMembership is a nested structure that contains +// the organization and user membership information on that organization. +type OrganizationMembership struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Organization *Organization `protobuf:"bytes,1,opt,name=organization,proto3" json:"organization,omitempty"` + OrganizationRole OrganizationRole `protobuf:"varint,2,opt,name=organization_role,json=organizationRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"organization_role,omitempty"` +} + +func (x *OrganizationMembership) Reset() { + *x = OrganizationMembership{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OrganizationMembership) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OrganizationMembership) ProtoMessage() {} + +func (x *OrganizationMembership) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OrganizationMembership.ProtoReflect.Descriptor instead. +func (*OrganizationMembership) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{1} +} + +func (x *OrganizationMembership) GetOrganization() *Organization { + if x != nil { + return x.Organization + } + return nil +} + +func (x *OrganizationMembership) GetOrganizationRole() OrganizationRole { + if x != nil { + return x.OrganizationRole + } + return OrganizationRole_ORGANIZATION_ROLE_UNSPECIFIED +} + +type GetOrganizationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetOrganizationRequest) Reset() { + *x = GetOrganizationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOrganizationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrganizationRequest) ProtoMessage() {} + +func (x *GetOrganizationRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrganizationRequest.ProtoReflect.Descriptor instead. +func (*GetOrganizationRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{2} +} + +func (x *GetOrganizationRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetOrganizationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Organization *Organization `protobuf:"bytes,1,opt,name=organization,proto3" json:"organization,omitempty"` +} + +func (x *GetOrganizationResponse) Reset() { + *x = GetOrganizationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOrganizationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrganizationResponse) ProtoMessage() {} + +func (x *GetOrganizationResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrganizationResponse.ProtoReflect.Descriptor instead. +func (*GetOrganizationResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{3} +} + +func (x *GetOrganizationResponse) GetOrganization() *Organization { + if x != nil { + return x.Organization + } + return nil +} + +type GetOrganizationByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetOrganizationByNameRequest) Reset() { + *x = GetOrganizationByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOrganizationByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrganizationByNameRequest) ProtoMessage() {} + +func (x *GetOrganizationByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrganizationByNameRequest.ProtoReflect.Descriptor instead. +func (*GetOrganizationByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{4} +} + +func (x *GetOrganizationByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetOrganizationByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Organization *Organization `protobuf:"bytes,1,opt,name=organization,proto3" json:"organization,omitempty"` +} + +func (x *GetOrganizationByNameResponse) Reset() { + *x = GetOrganizationByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOrganizationByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrganizationByNameResponse) ProtoMessage() {} + +func (x *GetOrganizationByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrganizationByNameResponse.ProtoReflect.Descriptor instead. +func (*GetOrganizationByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{5} +} + +func (x *GetOrganizationByNameResponse) GetOrganization() *Organization { + if x != nil { + return x.Organization + } + return nil +} + +type ListOrganizationsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListOrganizationsRequest) Reset() { + *x = ListOrganizationsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationsRequest) ProtoMessage() {} + +func (x *ListOrganizationsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationsRequest.ProtoReflect.Descriptor instead. +func (*ListOrganizationsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{6} +} + +func (x *ListOrganizationsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListOrganizationsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListOrganizationsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListOrganizationsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Organizations []*Organization `protobuf:"bytes,1,rep,name=organizations,proto3" json:"organizations,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListOrganizationsResponse) Reset() { + *x = ListOrganizationsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationsResponse) ProtoMessage() {} + +func (x *ListOrganizationsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationsResponse.ProtoReflect.Descriptor instead. +func (*ListOrganizationsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{7} +} + +func (x *ListOrganizationsResponse) GetOrganizations() []*Organization { + if x != nil { + return x.Organizations + } + return nil +} + +func (x *ListOrganizationsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListUserOrganizationsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the user whose organizations should be listed. + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListUserOrganizationsRequest) Reset() { + *x = ListUserOrganizationsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserOrganizationsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserOrganizationsRequest) ProtoMessage() {} + +func (x *ListUserOrganizationsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserOrganizationsRequest.ProtoReflect.Descriptor instead. +func (*ListUserOrganizationsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{8} +} + +func (x *ListUserOrganizationsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ListUserOrganizationsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUserOrganizationsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListUserOrganizationsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListUserOrganizationsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Organizations []*OrganizationMembership `protobuf:"bytes,1,rep,name=organizations,proto3" json:"organizations,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListUserOrganizationsResponse) Reset() { + *x = ListUserOrganizationsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserOrganizationsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserOrganizationsResponse) ProtoMessage() {} + +func (x *ListUserOrganizationsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserOrganizationsResponse.ProtoReflect.Descriptor instead. +func (*ListUserOrganizationsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{9} +} + +func (x *ListUserOrganizationsResponse) GetOrganizations() []*OrganizationMembership { + if x != nil { + return x.Organizations + } + return nil +} + +func (x *ListUserOrganizationsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type GetUserOrganizationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the user whose membership should be retrieved. + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // The ID of the organization. + OrganizationId string `protobuf:"bytes,2,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *GetUserOrganizationRequest) Reset() { + *x = GetUserOrganizationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserOrganizationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserOrganizationRequest) ProtoMessage() {} + +func (x *GetUserOrganizationRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserOrganizationRequest.ProtoReflect.Descriptor instead. +func (*GetUserOrganizationRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{10} +} + +func (x *GetUserOrganizationRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *GetUserOrganizationRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type GetUserOrganizationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrganizationMembership *OrganizationMembership `protobuf:"bytes,1,opt,name=organization_membership,json=organizationMembership,proto3" json:"organization_membership,omitempty"` +} + +func (x *GetUserOrganizationResponse) Reset() { + *x = GetUserOrganizationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserOrganizationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserOrganizationResponse) ProtoMessage() {} + +func (x *GetUserOrganizationResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserOrganizationResponse.ProtoReflect.Descriptor instead. +func (*GetUserOrganizationResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{11} +} + +func (x *GetUserOrganizationResponse) GetOrganizationMembership() *OrganizationMembership { + if x != nil { + return x.OrganizationMembership + } + return nil +} + +type CreateOrganizationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Must be unique across organizations. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *CreateOrganizationRequest) Reset() { + *x = CreateOrganizationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateOrganizationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOrganizationRequest) ProtoMessage() {} + +func (x *CreateOrganizationRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateOrganizationRequest.ProtoReflect.Descriptor instead. +func (*CreateOrganizationRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{12} +} + +func (x *CreateOrganizationRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type CreateOrganizationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Organization *Organization `protobuf:"bytes,1,opt,name=organization,proto3" json:"organization,omitempty"` +} + +func (x *CreateOrganizationResponse) Reset() { + *x = CreateOrganizationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateOrganizationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOrganizationResponse) ProtoMessage() {} + +func (x *CreateOrganizationResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateOrganizationResponse.ProtoReflect.Descriptor instead. +func (*CreateOrganizationResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{13} +} + +func (x *CreateOrganizationResponse) GetOrganization() *Organization { + if x != nil { + return x.Organization + } + return nil +} + +type DeleteOrganizationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteOrganizationRequest) Reset() { + *x = DeleteOrganizationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteOrganizationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteOrganizationRequest) ProtoMessage() {} + +func (x *DeleteOrganizationRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteOrganizationRequest.ProtoReflect.Descriptor instead. +func (*DeleteOrganizationRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{14} +} + +func (x *DeleteOrganizationRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeleteOrganizationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteOrganizationResponse) Reset() { + *x = DeleteOrganizationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteOrganizationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteOrganizationResponse) ProtoMessage() {} + +func (x *DeleteOrganizationResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteOrganizationResponse.ProtoReflect.Descriptor instead. +func (*DeleteOrganizationResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{15} +} + +type DeleteOrganizationByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *DeleteOrganizationByNameRequest) Reset() { + *x = DeleteOrganizationByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteOrganizationByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteOrganizationByNameRequest) ProtoMessage() {} + +func (x *DeleteOrganizationByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteOrganizationByNameRequest.ProtoReflect.Descriptor instead. +func (*DeleteOrganizationByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{16} +} + +func (x *DeleteOrganizationByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteOrganizationByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteOrganizationByNameResponse) Reset() { + *x = DeleteOrganizationByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteOrganizationByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteOrganizationByNameResponse) ProtoMessage() {} + +func (x *DeleteOrganizationByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteOrganizationByNameResponse.ProtoReflect.Descriptor instead. +func (*DeleteOrganizationByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{17} +} + +type AddOrganizationMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which the user will be added to. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // The ID of the user for which to be added to the organization. + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // The new role of the user in the organization. + OrganizationRole OrganizationRole `protobuf:"varint,3,opt,name=organization_role,json=organizationRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"organization_role,omitempty"` +} + +func (x *AddOrganizationMemberRequest) Reset() { + *x = AddOrganizationMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddOrganizationMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddOrganizationMemberRequest) ProtoMessage() {} + +func (x *AddOrganizationMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddOrganizationMemberRequest.ProtoReflect.Descriptor instead. +func (*AddOrganizationMemberRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{18} +} + +func (x *AddOrganizationMemberRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *AddOrganizationMemberRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AddOrganizationMemberRequest) GetOrganizationRole() OrganizationRole { + if x != nil { + return x.OrganizationRole + } + return OrganizationRole_ORGANIZATION_ROLE_UNSPECIFIED +} + +type AddOrganizationMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AddOrganizationMemberResponse) Reset() { + *x = AddOrganizationMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddOrganizationMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddOrganizationMemberResponse) ProtoMessage() {} + +func (x *AddOrganizationMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddOrganizationMemberResponse.ProtoReflect.Descriptor instead. +func (*AddOrganizationMemberResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{19} +} + +type UpdateOrganizationMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which the member belongs to. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // The ID of the user for which to be updated the role. + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // The new role of the user in the organization. + OrganizationRole OrganizationRole `protobuf:"varint,3,opt,name=organization_role,json=organizationRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"organization_role,omitempty"` +} + +func (x *UpdateOrganizationMemberRequest) Reset() { + *x = UpdateOrganizationMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateOrganizationMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateOrganizationMemberRequest) ProtoMessage() {} + +func (x *UpdateOrganizationMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateOrganizationMemberRequest.ProtoReflect.Descriptor instead. +func (*UpdateOrganizationMemberRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{20} +} + +func (x *UpdateOrganizationMemberRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *UpdateOrganizationMemberRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateOrganizationMemberRequest) GetOrganizationRole() OrganizationRole { + if x != nil { + return x.OrganizationRole + } + return OrganizationRole_ORGANIZATION_ROLE_UNSPECIFIED +} + +type UpdateOrganizationMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateOrganizationMemberResponse) Reset() { + *x = UpdateOrganizationMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateOrganizationMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateOrganizationMemberResponse) ProtoMessage() {} + +func (x *UpdateOrganizationMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateOrganizationMemberResponse.ProtoReflect.Descriptor instead. +func (*UpdateOrganizationMemberResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{21} +} + +type RemoveOrganizationMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which the member belongs to. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // The ID of the user for which to be removed the role. + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *RemoveOrganizationMemberRequest) Reset() { + *x = RemoveOrganizationMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveOrganizationMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveOrganizationMemberRequest) ProtoMessage() {} + +func (x *RemoveOrganizationMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveOrganizationMemberRequest.ProtoReflect.Descriptor instead. +func (*RemoveOrganizationMemberRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{22} +} + +func (x *RemoveOrganizationMemberRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *RemoveOrganizationMemberRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type RemoveOrganizationMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveOrganizationMemberResponse) Reset() { + *x = RemoveOrganizationMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveOrganizationMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveOrganizationMemberResponse) ProtoMessage() {} + +func (x *RemoveOrganizationMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveOrganizationMemberResponse.ProtoReflect.Descriptor instead. +func (*RemoveOrganizationMemberResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{23} +} + +type SetOrganizationMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which the user's role will be set. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // The ID of the user whose role will be set. + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // The role to assign to the user. + // Setting UNSPECIFIED means removing the user's role. + OrganizationRole OrganizationRole `protobuf:"varint,3,opt,name=organization_role,json=organizationRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"organization_role,omitempty"` +} + +func (x *SetOrganizationMemberRequest) Reset() { + *x = SetOrganizationMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetOrganizationMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetOrganizationMemberRequest) ProtoMessage() {} + +func (x *SetOrganizationMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetOrganizationMemberRequest.ProtoReflect.Descriptor instead. +func (*SetOrganizationMemberRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{24} +} + +func (x *SetOrganizationMemberRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *SetOrganizationMemberRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *SetOrganizationMemberRequest) GetOrganizationRole() OrganizationRole { + if x != nil { + return x.OrganizationRole + } + return OrganizationRole_ORGANIZATION_ROLE_UNSPECIFIED +} + +type SetOrganizationMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SetOrganizationMemberResponse) Reset() { + *x = SetOrganizationMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetOrganizationMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetOrganizationMemberResponse) ProtoMessage() {} + +func (x *SetOrganizationMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetOrganizationMemberResponse.ProtoReflect.Descriptor instead. +func (*SetOrganizationMemberResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{25} +} + +type GetOrganizationSettingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to get the settings. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` +} + +func (x *GetOrganizationSettingsRequest) Reset() { + *x = GetOrganizationSettingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOrganizationSettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrganizationSettingsRequest) ProtoMessage() {} + +func (x *GetOrganizationSettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrganizationSettingsRequest.ProtoReflect.Descriptor instead. +func (*GetOrganizationSettingsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{26} +} + +func (x *GetOrganizationSettingsRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +type GetOrganizationSettingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryBaseRole RepositoryRole `protobuf:"varint,1,opt,name=repository_base_role,json=repositoryBaseRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"repository_base_role,omitempty"` + // Deprecated: Do not use. + PluginBaseRole PluginRole `protobuf:"varint,2,opt,name=plugin_base_role,json=pluginBaseRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginRole" json:"plugin_base_role,omitempty"` + // Deprecated: Do not use. + TemplateBaseRole TemplateRole `protobuf:"varint,3,opt,name=template_base_role,json=templateBaseRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.TemplateRole" json:"template_base_role,omitempty"` + // The number of members in the organization. + MembersCount uint32 `protobuf:"varint,4,opt,name=members_count,json=membersCount,proto3" json:"members_count,omitempty"` + // The IdP groups associated with the organization. + IdpGroups []string `protobuf:"bytes,5,rep,name=idp_groups,json=idpGroups,proto3" json:"idp_groups,omitempty"` +} + +func (x *GetOrganizationSettingsResponse) Reset() { + *x = GetOrganizationSettingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOrganizationSettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrganizationSettingsResponse) ProtoMessage() {} + +func (x *GetOrganizationSettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrganizationSettingsResponse.ProtoReflect.Descriptor instead. +func (*GetOrganizationSettingsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{27} +} + +func (x *GetOrganizationSettingsResponse) GetRepositoryBaseRole() RepositoryRole { + if x != nil { + return x.RepositoryBaseRole + } + return RepositoryRole_REPOSITORY_ROLE_UNSPECIFIED +} + +// Deprecated: Do not use. +func (x *GetOrganizationSettingsResponse) GetPluginBaseRole() PluginRole { + if x != nil { + return x.PluginBaseRole + } + return PluginRole_PLUGIN_ROLE_UNSPECIFIED +} + +// Deprecated: Do not use. +func (x *GetOrganizationSettingsResponse) GetTemplateBaseRole() TemplateRole { + if x != nil { + return x.TemplateBaseRole + } + return TemplateRole_TEMPLATE_ROLE_UNSPECIFIED +} + +func (x *GetOrganizationSettingsResponse) GetMembersCount() uint32 { + if x != nil { + return x.MembersCount + } + return 0 +} + +func (x *GetOrganizationSettingsResponse) GetIdpGroups() []string { + if x != nil { + return x.IdpGroups + } + return nil +} + +type UpdateOrganizationSettingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to update the base roles. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // optional, no update to this base role will be made if this is unspecified. + RepositoryBaseRole RepositoryRole `protobuf:"varint,2,opt,name=repository_base_role,json=repositoryBaseRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"repository_base_role,omitempty"` + // optional, no update to this base role will be made if this is unspecified. + // + // Deprecated: Do not use. + PluginBaseRole PluginRole `protobuf:"varint,3,opt,name=plugin_base_role,json=pluginBaseRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginRole" json:"plugin_base_role,omitempty"` + // optional, no update to this base role will be made if this is unspecified. + // + // Deprecated: Do not use. + TemplateBaseRole TemplateRole `protobuf:"varint,4,opt,name=template_base_role,json=templateBaseRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.TemplateRole" json:"template_base_role,omitempty"` + // optional, update to description will only be made when this is present + Description *string `protobuf:"bytes,5,opt,name=description,proto3,oneof" json:"description,omitempty"` + // optional, update to url will only be made when this is present + Url *string `protobuf:"bytes,6,opt,name=url,proto3,oneof" json:"url,omitempty"` +} + +func (x *UpdateOrganizationSettingsRequest) Reset() { + *x = UpdateOrganizationSettingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateOrganizationSettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateOrganizationSettingsRequest) ProtoMessage() {} + +func (x *UpdateOrganizationSettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateOrganizationSettingsRequest.ProtoReflect.Descriptor instead. +func (*UpdateOrganizationSettingsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{28} +} + +func (x *UpdateOrganizationSettingsRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *UpdateOrganizationSettingsRequest) GetRepositoryBaseRole() RepositoryRole { + if x != nil { + return x.RepositoryBaseRole + } + return RepositoryRole_REPOSITORY_ROLE_UNSPECIFIED +} + +// Deprecated: Do not use. +func (x *UpdateOrganizationSettingsRequest) GetPluginBaseRole() PluginRole { + if x != nil { + return x.PluginBaseRole + } + return PluginRole_PLUGIN_ROLE_UNSPECIFIED +} + +// Deprecated: Do not use. +func (x *UpdateOrganizationSettingsRequest) GetTemplateBaseRole() TemplateRole { + if x != nil { + return x.TemplateBaseRole + } + return TemplateRole_TEMPLATE_ROLE_UNSPECIFIED +} + +func (x *UpdateOrganizationSettingsRequest) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *UpdateOrganizationSettingsRequest) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +type UpdateOrganizationSettingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateOrganizationSettingsResponse) Reset() { + *x = UpdateOrganizationSettingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateOrganizationSettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateOrganizationSettingsResponse) ProtoMessage() {} + +func (x *UpdateOrganizationSettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateOrganizationSettingsResponse.ProtoReflect.Descriptor instead. +func (*UpdateOrganizationSettingsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{29} +} + +type AddOrganizationGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to add the group. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // The name of the group to add. + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (x *AddOrganizationGroupRequest) Reset() { + *x = AddOrganizationGroupRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddOrganizationGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddOrganizationGroupRequest) ProtoMessage() {} + +func (x *AddOrganizationGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddOrganizationGroupRequest.ProtoReflect.Descriptor instead. +func (*AddOrganizationGroupRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{30} +} + +func (x *AddOrganizationGroupRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *AddOrganizationGroupRequest) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +type AddOrganizationGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AddOrganizationGroupResponse) Reset() { + *x = AddOrganizationGroupResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddOrganizationGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddOrganizationGroupResponse) ProtoMessage() {} + +func (x *AddOrganizationGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddOrganizationGroupResponse.ProtoReflect.Descriptor instead. +func (*AddOrganizationGroupResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{31} +} + +type RemoveOrganizationGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization for which to remove the group. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // The name of the group to remove. + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (x *RemoveOrganizationGroupRequest) Reset() { + *x = RemoveOrganizationGroupRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveOrganizationGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveOrganizationGroupRequest) ProtoMessage() {} + +func (x *RemoveOrganizationGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveOrganizationGroupRequest.ProtoReflect.Descriptor instead. +func (*RemoveOrganizationGroupRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{32} +} + +func (x *RemoveOrganizationGroupRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *RemoveOrganizationGroupRequest) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +type RemoveOrganizationGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveOrganizationGroupResponse) Reset() { + *x = RemoveOrganizationGroupResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveOrganizationGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveOrganizationGroupResponse) ProtoMessage() {} + +func (x *RemoveOrganizationGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_organization_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveOrganizationGroupResponse.ProtoReflect.Descriptor instead. +func (*RemoveOrganizationGroupResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_organization_proto_rawDescGZIP(), []int{33} +} + +var File_registry_v1alpha1_organization_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_organization_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x1a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x2b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd0, 0x02, + 0x0a, 0x0c, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, + 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, + 0x12, 0x6e, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x12, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0xdf, 0x01, 0x0a, 0x16, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x5b, 0x0a, 0x0c, 0x6f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x68, 0x0a, 0x11, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, + 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, + 0x6c, 0x65, 0x22, 0x28, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x76, 0x0a, 0x17, + 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x32, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x7c, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x4e, 0x61, 0x6d, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0c, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x70, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, + 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xa2, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, + 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5d, 0x0a, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x8d, 0x01, + 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, + 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xb0, 0x01, + 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x67, 0x0a, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, + 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x5e, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, + 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x22, 0x99, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x7a, 0x0a, 0x17, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x73, 0x68, 0x69, 0x70, 0x52, 0x16, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x22, 0x2f, 0x0a, 0x19, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x79, 0x0a, + 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0c, 0x6f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x35, 0x0a, 0x1f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x20, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xca, + 0x01, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x68, 0x0a, 0x11, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x41, + 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xcd, 0x01, 0x0a, + 0x1f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x68, 0x0a, 0x11, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x22, 0x0a, 0x20, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x63, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x22, 0x0a, 0x20, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xca, 0x01, 0x0a, 0x1c, 0x53, 0x65, + 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x68, 0x0a, 0x11, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6c, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x49, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x22, 0xa2, 0x03, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x14, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x52, + 0x12, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x61, 0x73, 0x65, 0x52, + 0x6f, 0x6c, 0x65, 0x12, 0x63, 0x0a, 0x10, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x62, 0x61, + 0x73, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x42, 0x61, 0x73, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x69, 0x0a, 0x12, 0x74, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x02, 0x18, + 0x01, 0x52, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x42, 0x61, 0x73, 0x65, 0x52, + 0x6f, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x64, 0x70, 0x5f, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x69, 0x64, + 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0xdf, 0x03, 0x0a, 0x21, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, + 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x6b, 0x0a, 0x14, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x52, + 0x12, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x61, 0x73, 0x65, 0x52, + 0x6f, 0x6c, 0x65, 0x12, 0x63, 0x0a, 0x10, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x62, 0x61, + 0x73, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x42, 0x61, 0x73, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x69, 0x0a, 0x12, 0x74, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x02, 0x18, + 0x01, 0x52, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x42, 0x61, 0x73, 0x65, 0x52, + 0x6f, 0x6c, 0x65, 0x12, 0x25, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x75, 0x72, + 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x88, 0x01, + 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x75, 0x72, 0x6c, 0x22, 0x24, 0x0a, 0x22, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x65, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, + 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x1e, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x68, 0x0a, 0x1e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, + 0x22, 0x21, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0xa3, 0x16, 0x0a, 0x13, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9d, 0x01, 0x0a, 0x0f, + 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xaf, 0x01, 0x0a, 0x15, + 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x48, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa3, 0x01, + 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x01, 0x12, 0xaf, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x47, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa9, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x01, 0x12, 0xa6, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0xa6, 0x01, 0x0a, 0x12, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x02, 0x12, 0xb8, 0x01, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4b, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x4e, 0x61, 0x6d, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0xaf, + 0x01, 0x0a, 0x15, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x64, + 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, + 0x12, 0xb3, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x4a, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4b, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xb8, 0x01, 0x0a, 0x18, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x4b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x02, 0x12, 0xaa, 0x01, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x47, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xb5, + 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x49, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb9, 0x01, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0xac, 0x01, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x46, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x41, 0x64, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x02, 0x12, 0xb5, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x49, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x42, 0xec, 0x02, 0x0a, 0x2d, 0x63, 0x6f, + 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x11, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, + 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, + 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, + 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, + 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_organization_proto_rawDescOnce sync.Once + file_registry_v1alpha1_organization_proto_rawDescData = file_registry_v1alpha1_organization_proto_rawDesc +) + +func file_registry_v1alpha1_organization_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_organization_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_organization_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_organization_proto_rawDescData) + }) + return file_registry_v1alpha1_organization_proto_rawDescData +} + +var file_registry_v1alpha1_organization_proto_msgTypes = make([]protoimpl.MessageInfo, 34) +var file_registry_v1alpha1_organization_proto_goTypes = []interface{}{ + (*Organization)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.Organization + (*OrganizationMembership)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationMembership + (*GetOrganizationRequest)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationRequest + (*GetOrganizationResponse)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationResponse + (*GetOrganizationByNameRequest)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationByNameRequest + (*GetOrganizationByNameResponse)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationByNameResponse + (*ListOrganizationsRequest)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationsRequest + (*ListOrganizationsResponse)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationsResponse + (*ListUserOrganizationsRequest)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.ListUserOrganizationsRequest + (*ListUserOrganizationsResponse)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.ListUserOrganizationsResponse + (*GetUserOrganizationRequest)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.GetUserOrganizationRequest + (*GetUserOrganizationResponse)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.GetUserOrganizationResponse + (*CreateOrganizationRequest)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.CreateOrganizationRequest + (*CreateOrganizationResponse)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.CreateOrganizationResponse + (*DeleteOrganizationRequest)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.DeleteOrganizationRequest + (*DeleteOrganizationResponse)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.DeleteOrganizationResponse + (*DeleteOrganizationByNameRequest)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.DeleteOrganizationByNameRequest + (*DeleteOrganizationByNameResponse)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.DeleteOrganizationByNameResponse + (*AddOrganizationMemberRequest)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationMemberRequest + (*AddOrganizationMemberResponse)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationMemberResponse + (*UpdateOrganizationMemberRequest)(nil), // 20: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationMemberRequest + (*UpdateOrganizationMemberResponse)(nil), // 21: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationMemberResponse + (*RemoveOrganizationMemberRequest)(nil), // 22: bufman.dubbo.apache.org.registry.v1alpha1.RemoveOrganizationMemberRequest + (*RemoveOrganizationMemberResponse)(nil), // 23: bufman.dubbo.apache.org.registry.v1alpha1.RemoveOrganizationMemberResponse + (*SetOrganizationMemberRequest)(nil), // 24: bufman.dubbo.apache.org.registry.v1alpha1.SetOrganizationMemberRequest + (*SetOrganizationMemberResponse)(nil), // 25: bufman.dubbo.apache.org.registry.v1alpha1.SetOrganizationMemberResponse + (*GetOrganizationSettingsRequest)(nil), // 26: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationSettingsRequest + (*GetOrganizationSettingsResponse)(nil), // 27: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationSettingsResponse + (*UpdateOrganizationSettingsRequest)(nil), // 28: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationSettingsRequest + (*UpdateOrganizationSettingsResponse)(nil), // 29: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationSettingsResponse + (*AddOrganizationGroupRequest)(nil), // 30: bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationGroupRequest + (*AddOrganizationGroupResponse)(nil), // 31: bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationGroupResponse + (*RemoveOrganizationGroupRequest)(nil), // 32: bufman.dubbo.apache.org.registry.v1alpha1.RemoveOrganizationGroupRequest + (*RemoveOrganizationGroupResponse)(nil), // 33: bufman.dubbo.apache.org.registry.v1alpha1.RemoveOrganizationGroupResponse + (*timestamppb.Timestamp)(nil), // 34: google.protobuf.Timestamp + (VerificationStatus)(0), // 35: bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus + (OrganizationRole)(0), // 36: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + (RepositoryRole)(0), // 37: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + (PluginRole)(0), // 38: bufman.dubbo.apache.org.registry.v1alpha1.PluginRole + (TemplateRole)(0), // 39: bufman.dubbo.apache.org.registry.v1alpha1.TemplateRole +} +var file_registry_v1alpha1_organization_proto_depIdxs = []int32{ + 34, // 0: bufman.dubbo.apache.org.registry.v1alpha1.Organization.create_time:type_name -> google.protobuf.Timestamp + 34, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Organization.update_time:type_name -> google.protobuf.Timestamp + 35, // 2: bufman.dubbo.apache.org.registry.v1alpha1.Organization.verification_status:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationMembership.organization:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Organization + 36, // 4: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationMembership.organization_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 0, // 5: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationResponse.organization:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Organization + 0, // 6: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationByNameResponse.organization:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Organization + 0, // 7: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationsResponse.organizations:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Organization + 1, // 8: bufman.dubbo.apache.org.registry.v1alpha1.ListUserOrganizationsResponse.organizations:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationMembership + 1, // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetUserOrganizationResponse.organization_membership:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationMembership + 0, // 10: bufman.dubbo.apache.org.registry.v1alpha1.CreateOrganizationResponse.organization:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Organization + 36, // 11: bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationMemberRequest.organization_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 36, // 12: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationMemberRequest.organization_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 36, // 13: bufman.dubbo.apache.org.registry.v1alpha1.SetOrganizationMemberRequest.organization_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 37, // 14: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationSettingsResponse.repository_base_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 38, // 15: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationSettingsResponse.plugin_base_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginRole + 39, // 16: bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationSettingsResponse.template_base_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.TemplateRole + 37, // 17: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationSettingsRequest.repository_base_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 38, // 18: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationSettingsRequest.plugin_base_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginRole + 39, // 19: bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationSettingsRequest.template_base_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.TemplateRole + 2, // 20: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganization:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationRequest + 4, // 21: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationByNameRequest + 6, // 22: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListOrganizations:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationsRequest + 8, // 23: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListUserOrganizations:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUserOrganizationsRequest + 10, // 24: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetUserOrganization:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetUserOrganizationRequest + 12, // 25: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.CreateOrganization:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateOrganizationRequest + 14, // 26: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganization:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteOrganizationRequest + 16, // 27: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganizationByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteOrganizationByNameRequest + 18, // 28: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationMember:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationMemberRequest + 20, // 29: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationMember:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationMemberRequest + 22, // 30: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationMember:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.RemoveOrganizationMemberRequest + 24, // 31: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.SetOrganizationMember:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SetOrganizationMemberRequest + 26, // 32: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationSettings:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationSettingsRequest + 28, // 33: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationSettings:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationSettingsRequest + 30, // 34: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationGroup:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationGroupRequest + 32, // 35: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationGroup:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.RemoveOrganizationGroupRequest + 3, // 36: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganization:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationResponse + 5, // 37: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationByNameResponse + 7, // 38: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListOrganizations:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationsResponse + 9, // 39: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.ListUserOrganizations:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUserOrganizationsResponse + 11, // 40: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetUserOrganization:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetUserOrganizationResponse + 13, // 41: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.CreateOrganization:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateOrganizationResponse + 15, // 42: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganization:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteOrganizationResponse + 17, // 43: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.DeleteOrganizationByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteOrganizationByNameResponse + 19, // 44: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationMember:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationMemberResponse + 21, // 45: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationMember:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationMemberResponse + 23, // 46: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationMember:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.RemoveOrganizationMemberResponse + 25, // 47: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.SetOrganizationMember:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SetOrganizationMemberResponse + 27, // 48: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.GetOrganizationSettings:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetOrganizationSettingsResponse + 29, // 49: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.UpdateOrganizationSettings:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateOrganizationSettingsResponse + 31, // 50: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.AddOrganizationGroup:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.AddOrganizationGroupResponse + 33, // 51: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService.RemoveOrganizationGroup:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.RemoveOrganizationGroupResponse + 36, // [36:52] is the sub-list for method output_type + 20, // [20:36] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_organization_proto_init() } +func file_registry_v1alpha1_organization_proto_init() { + if File_registry_v1alpha1_organization_proto != nil { + return + } + file_registry_v1alpha1_role_proto_init() + file_registry_v1alpha1_verification_status_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_organization_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Organization); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OrganizationMembership); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOrganizationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOrganizationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOrganizationByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOrganizationByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserOrganizationsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserOrganizationsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserOrganizationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserOrganizationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateOrganizationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateOrganizationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteOrganizationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteOrganizationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteOrganizationByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteOrganizationByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddOrganizationMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddOrganizationMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateOrganizationMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateOrganizationMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveOrganizationMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveOrganizationMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetOrganizationMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetOrganizationMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOrganizationSettingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOrganizationSettingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateOrganizationSettingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateOrganizationSettingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddOrganizationGroupRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddOrganizationGroupResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveOrganizationGroupRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_organization_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveOrganizationGroupResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_organization_proto_msgTypes[28].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_organization_proto_rawDesc, + NumEnums: 0, + NumMessages: 34, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_organization_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_organization_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_organization_proto_msgTypes, + }.Build() + File_registry_v1alpha1_organization_proto = out.File + file_registry_v1alpha1_organization_proto_rawDesc = nil + file_registry_v1alpha1_organization_proto_goTypes = nil + file_registry_v1alpha1_organization_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/organization_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/organization_grpc.pb.go new file mode 100644 index 000000000..78085e7bb --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/organization_grpc.pb.go @@ -0,0 +1,694 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/organization.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + OrganizationService_GetOrganization_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganization" + OrganizationService_GetOrganizationByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganizationByName" + OrganizationService_ListOrganizations_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/ListOrganizations" + OrganizationService_ListUserOrganizations_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/ListUserOrganizations" + OrganizationService_GetUserOrganization_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetUserOrganization" + OrganizationService_CreateOrganization_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/CreateOrganization" + OrganizationService_DeleteOrganization_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/DeleteOrganization" + OrganizationService_DeleteOrganizationByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/DeleteOrganizationByName" + OrganizationService_AddOrganizationMember_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/AddOrganizationMember" + OrganizationService_UpdateOrganizationMember_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/UpdateOrganizationMember" + OrganizationService_RemoveOrganizationMember_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/RemoveOrganizationMember" + OrganizationService_SetOrganizationMember_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/SetOrganizationMember" + OrganizationService_GetOrganizationSettings_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/GetOrganizationSettings" + OrganizationService_UpdateOrganizationSettings_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/UpdateOrganizationSettings" + OrganizationService_AddOrganizationGroup_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/AddOrganizationGroup" + OrganizationService_RemoveOrganizationGroup_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService/RemoveOrganizationGroup" +) + +// OrganizationServiceClient is the client API for OrganizationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type OrganizationServiceClient interface { + // GetOrganization gets a organization by ID. + GetOrganization(ctx context.Context, in *GetOrganizationRequest, opts ...grpc.CallOption) (*GetOrganizationResponse, error) + // GetOrganizationByName gets a organization by name. + GetOrganizationByName(ctx context.Context, in *GetOrganizationByNameRequest, opts ...grpc.CallOption) (*GetOrganizationByNameResponse, error) + // ListOrganizations lists all organizations. + ListOrganizations(ctx context.Context, in *ListOrganizationsRequest, opts ...grpc.CallOption) (*ListOrganizationsResponse, error) + // ListUserOrganizations lists all organizations a user is member of. + ListUserOrganizations(ctx context.Context, in *ListUserOrganizationsRequest, opts ...grpc.CallOption) (*ListUserOrganizationsResponse, error) + GetUserOrganization(ctx context.Context, in *GetUserOrganizationRequest, opts ...grpc.CallOption) (*GetUserOrganizationResponse, error) + // CreateOrganization creates a new organization. + CreateOrganization(ctx context.Context, in *CreateOrganizationRequest, opts ...grpc.CallOption) (*CreateOrganizationResponse, error) + // DeleteOrganization deletes a organization. + DeleteOrganization(ctx context.Context, in *DeleteOrganizationRequest, opts ...grpc.CallOption) (*DeleteOrganizationResponse, error) + // DeleteOrganizationByName deletes a organization by name. + DeleteOrganizationByName(ctx context.Context, in *DeleteOrganizationByNameRequest, opts ...grpc.CallOption) (*DeleteOrganizationByNameResponse, error) + // AddOrganizationMember add a role to an user in the organization. + AddOrganizationMember(ctx context.Context, in *AddOrganizationMemberRequest, opts ...grpc.CallOption) (*AddOrganizationMemberResponse, error) + // UpdateOrganizationMember update the user's membership information in the organization. + UpdateOrganizationMember(ctx context.Context, in *UpdateOrganizationMemberRequest, opts ...grpc.CallOption) (*UpdateOrganizationMemberResponse, error) + // RemoveOrganizationMember remove the role of an user in the organization. + RemoveOrganizationMember(ctx context.Context, in *RemoveOrganizationMemberRequest, opts ...grpc.CallOption) (*RemoveOrganizationMemberResponse, error) + // SetOrganizationMember sets the role of a user in the organization. + SetOrganizationMember(ctx context.Context, in *SetOrganizationMemberRequest, opts ...grpc.CallOption) (*SetOrganizationMemberResponse, error) + // GetOrganizationSettings gets the settings of an organization, including organization base roles. + GetOrganizationSettings(ctx context.Context, in *GetOrganizationSettingsRequest, opts ...grpc.CallOption) (*GetOrganizationSettingsResponse, error) + // UpdateOrganizationSettings update the organization settings including base roles. + UpdateOrganizationSettings(ctx context.Context, in *UpdateOrganizationSettingsRequest, opts ...grpc.CallOption) (*UpdateOrganizationSettingsResponse, error) + // AddOrganizationGroup adds an IdP Group to the organization. + AddOrganizationGroup(ctx context.Context, in *AddOrganizationGroupRequest, opts ...grpc.CallOption) (*AddOrganizationGroupResponse, error) + // RemoveOrganizationGroup removes an IdP Group from the organization. + RemoveOrganizationGroup(ctx context.Context, in *RemoveOrganizationGroupRequest, opts ...grpc.CallOption) (*RemoveOrganizationGroupResponse, error) +} + +type organizationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewOrganizationServiceClient(cc grpc.ClientConnInterface) OrganizationServiceClient { + return &organizationServiceClient{cc} +} + +func (c *organizationServiceClient) GetOrganization(ctx context.Context, in *GetOrganizationRequest, opts ...grpc.CallOption) (*GetOrganizationResponse, error) { + out := new(GetOrganizationResponse) + err := c.cc.Invoke(ctx, OrganizationService_GetOrganization_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) GetOrganizationByName(ctx context.Context, in *GetOrganizationByNameRequest, opts ...grpc.CallOption) (*GetOrganizationByNameResponse, error) { + out := new(GetOrganizationByNameResponse) + err := c.cc.Invoke(ctx, OrganizationService_GetOrganizationByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) ListOrganizations(ctx context.Context, in *ListOrganizationsRequest, opts ...grpc.CallOption) (*ListOrganizationsResponse, error) { + out := new(ListOrganizationsResponse) + err := c.cc.Invoke(ctx, OrganizationService_ListOrganizations_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) ListUserOrganizations(ctx context.Context, in *ListUserOrganizationsRequest, opts ...grpc.CallOption) (*ListUserOrganizationsResponse, error) { + out := new(ListUserOrganizationsResponse) + err := c.cc.Invoke(ctx, OrganizationService_ListUserOrganizations_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) GetUserOrganization(ctx context.Context, in *GetUserOrganizationRequest, opts ...grpc.CallOption) (*GetUserOrganizationResponse, error) { + out := new(GetUserOrganizationResponse) + err := c.cc.Invoke(ctx, OrganizationService_GetUserOrganization_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) CreateOrganization(ctx context.Context, in *CreateOrganizationRequest, opts ...grpc.CallOption) (*CreateOrganizationResponse, error) { + out := new(CreateOrganizationResponse) + err := c.cc.Invoke(ctx, OrganizationService_CreateOrganization_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) DeleteOrganization(ctx context.Context, in *DeleteOrganizationRequest, opts ...grpc.CallOption) (*DeleteOrganizationResponse, error) { + out := new(DeleteOrganizationResponse) + err := c.cc.Invoke(ctx, OrganizationService_DeleteOrganization_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) DeleteOrganizationByName(ctx context.Context, in *DeleteOrganizationByNameRequest, opts ...grpc.CallOption) (*DeleteOrganizationByNameResponse, error) { + out := new(DeleteOrganizationByNameResponse) + err := c.cc.Invoke(ctx, OrganizationService_DeleteOrganizationByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) AddOrganizationMember(ctx context.Context, in *AddOrganizationMemberRequest, opts ...grpc.CallOption) (*AddOrganizationMemberResponse, error) { + out := new(AddOrganizationMemberResponse) + err := c.cc.Invoke(ctx, OrganizationService_AddOrganizationMember_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) UpdateOrganizationMember(ctx context.Context, in *UpdateOrganizationMemberRequest, opts ...grpc.CallOption) (*UpdateOrganizationMemberResponse, error) { + out := new(UpdateOrganizationMemberResponse) + err := c.cc.Invoke(ctx, OrganizationService_UpdateOrganizationMember_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) RemoveOrganizationMember(ctx context.Context, in *RemoveOrganizationMemberRequest, opts ...grpc.CallOption) (*RemoveOrganizationMemberResponse, error) { + out := new(RemoveOrganizationMemberResponse) + err := c.cc.Invoke(ctx, OrganizationService_RemoveOrganizationMember_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) SetOrganizationMember(ctx context.Context, in *SetOrganizationMemberRequest, opts ...grpc.CallOption) (*SetOrganizationMemberResponse, error) { + out := new(SetOrganizationMemberResponse) + err := c.cc.Invoke(ctx, OrganizationService_SetOrganizationMember_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) GetOrganizationSettings(ctx context.Context, in *GetOrganizationSettingsRequest, opts ...grpc.CallOption) (*GetOrganizationSettingsResponse, error) { + out := new(GetOrganizationSettingsResponse) + err := c.cc.Invoke(ctx, OrganizationService_GetOrganizationSettings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) UpdateOrganizationSettings(ctx context.Context, in *UpdateOrganizationSettingsRequest, opts ...grpc.CallOption) (*UpdateOrganizationSettingsResponse, error) { + out := new(UpdateOrganizationSettingsResponse) + err := c.cc.Invoke(ctx, OrganizationService_UpdateOrganizationSettings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) AddOrganizationGroup(ctx context.Context, in *AddOrganizationGroupRequest, opts ...grpc.CallOption) (*AddOrganizationGroupResponse, error) { + out := new(AddOrganizationGroupResponse) + err := c.cc.Invoke(ctx, OrganizationService_AddOrganizationGroup_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) RemoveOrganizationGroup(ctx context.Context, in *RemoveOrganizationGroupRequest, opts ...grpc.CallOption) (*RemoveOrganizationGroupResponse, error) { + out := new(RemoveOrganizationGroupResponse) + err := c.cc.Invoke(ctx, OrganizationService_RemoveOrganizationGroup_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// OrganizationServiceServer is the server API for OrganizationService service. +// All implementations must embed UnimplementedOrganizationServiceServer +// for forward compatibility +type OrganizationServiceServer interface { + // GetOrganization gets a organization by ID. + GetOrganization(context.Context, *GetOrganizationRequest) (*GetOrganizationResponse, error) + // GetOrganizationByName gets a organization by name. + GetOrganizationByName(context.Context, *GetOrganizationByNameRequest) (*GetOrganizationByNameResponse, error) + // ListOrganizations lists all organizations. + ListOrganizations(context.Context, *ListOrganizationsRequest) (*ListOrganizationsResponse, error) + // ListUserOrganizations lists all organizations a user is member of. + ListUserOrganizations(context.Context, *ListUserOrganizationsRequest) (*ListUserOrganizationsResponse, error) + GetUserOrganization(context.Context, *GetUserOrganizationRequest) (*GetUserOrganizationResponse, error) + // CreateOrganization creates a new organization. + CreateOrganization(context.Context, *CreateOrganizationRequest) (*CreateOrganizationResponse, error) + // DeleteOrganization deletes a organization. + DeleteOrganization(context.Context, *DeleteOrganizationRequest) (*DeleteOrganizationResponse, error) + // DeleteOrganizationByName deletes a organization by name. + DeleteOrganizationByName(context.Context, *DeleteOrganizationByNameRequest) (*DeleteOrganizationByNameResponse, error) + // AddOrganizationMember add a role to an user in the organization. + AddOrganizationMember(context.Context, *AddOrganizationMemberRequest) (*AddOrganizationMemberResponse, error) + // UpdateOrganizationMember update the user's membership information in the organization. + UpdateOrganizationMember(context.Context, *UpdateOrganizationMemberRequest) (*UpdateOrganizationMemberResponse, error) + // RemoveOrganizationMember remove the role of an user in the organization. + RemoveOrganizationMember(context.Context, *RemoveOrganizationMemberRequest) (*RemoveOrganizationMemberResponse, error) + // SetOrganizationMember sets the role of a user in the organization. + SetOrganizationMember(context.Context, *SetOrganizationMemberRequest) (*SetOrganizationMemberResponse, error) + // GetOrganizationSettings gets the settings of an organization, including organization base roles. + GetOrganizationSettings(context.Context, *GetOrganizationSettingsRequest) (*GetOrganizationSettingsResponse, error) + // UpdateOrganizationSettings update the organization settings including base roles. + UpdateOrganizationSettings(context.Context, *UpdateOrganizationSettingsRequest) (*UpdateOrganizationSettingsResponse, error) + // AddOrganizationGroup adds an IdP Group to the organization. + AddOrganizationGroup(context.Context, *AddOrganizationGroupRequest) (*AddOrganizationGroupResponse, error) + // RemoveOrganizationGroup removes an IdP Group from the organization. + RemoveOrganizationGroup(context.Context, *RemoveOrganizationGroupRequest) (*RemoveOrganizationGroupResponse, error) + mustEmbedUnimplementedOrganizationServiceServer() +} + +// UnimplementedOrganizationServiceServer must be embedded to have forward compatible implementations. +type UnimplementedOrganizationServiceServer struct { +} + +func (UnimplementedOrganizationServiceServer) GetOrganization(context.Context, *GetOrganizationRequest) (*GetOrganizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetOrganization not implemented") +} +func (UnimplementedOrganizationServiceServer) GetOrganizationByName(context.Context, *GetOrganizationByNameRequest) (*GetOrganizationByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetOrganizationByName not implemented") +} +func (UnimplementedOrganizationServiceServer) ListOrganizations(context.Context, *ListOrganizationsRequest) (*ListOrganizationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListOrganizations not implemented") +} +func (UnimplementedOrganizationServiceServer) ListUserOrganizations(context.Context, *ListUserOrganizationsRequest) (*ListUserOrganizationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUserOrganizations not implemented") +} +func (UnimplementedOrganizationServiceServer) GetUserOrganization(context.Context, *GetUserOrganizationRequest) (*GetUserOrganizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserOrganization not implemented") +} +func (UnimplementedOrganizationServiceServer) CreateOrganization(context.Context, *CreateOrganizationRequest) (*CreateOrganizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateOrganization not implemented") +} +func (UnimplementedOrganizationServiceServer) DeleteOrganization(context.Context, *DeleteOrganizationRequest) (*DeleteOrganizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteOrganization not implemented") +} +func (UnimplementedOrganizationServiceServer) DeleteOrganizationByName(context.Context, *DeleteOrganizationByNameRequest) (*DeleteOrganizationByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteOrganizationByName not implemented") +} +func (UnimplementedOrganizationServiceServer) AddOrganizationMember(context.Context, *AddOrganizationMemberRequest) (*AddOrganizationMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddOrganizationMember not implemented") +} +func (UnimplementedOrganizationServiceServer) UpdateOrganizationMember(context.Context, *UpdateOrganizationMemberRequest) (*UpdateOrganizationMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateOrganizationMember not implemented") +} +func (UnimplementedOrganizationServiceServer) RemoveOrganizationMember(context.Context, *RemoveOrganizationMemberRequest) (*RemoveOrganizationMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveOrganizationMember not implemented") +} +func (UnimplementedOrganizationServiceServer) SetOrganizationMember(context.Context, *SetOrganizationMemberRequest) (*SetOrganizationMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetOrganizationMember not implemented") +} +func (UnimplementedOrganizationServiceServer) GetOrganizationSettings(context.Context, *GetOrganizationSettingsRequest) (*GetOrganizationSettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetOrganizationSettings not implemented") +} +func (UnimplementedOrganizationServiceServer) UpdateOrganizationSettings(context.Context, *UpdateOrganizationSettingsRequest) (*UpdateOrganizationSettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateOrganizationSettings not implemented") +} +func (UnimplementedOrganizationServiceServer) AddOrganizationGroup(context.Context, *AddOrganizationGroupRequest) (*AddOrganizationGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddOrganizationGroup not implemented") +} +func (UnimplementedOrganizationServiceServer) RemoveOrganizationGroup(context.Context, *RemoveOrganizationGroupRequest) (*RemoveOrganizationGroupResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveOrganizationGroup not implemented") +} +func (UnimplementedOrganizationServiceServer) mustEmbedUnimplementedOrganizationServiceServer() {} + +// UnsafeOrganizationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to OrganizationServiceServer will +// result in compilation errors. +type UnsafeOrganizationServiceServer interface { + mustEmbedUnimplementedOrganizationServiceServer() +} + +func RegisterOrganizationServiceServer(s grpc.ServiceRegistrar, srv OrganizationServiceServer) { + s.RegisterService(&OrganizationService_ServiceDesc, srv) +} + +func _OrganizationService_GetOrganization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOrganizationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).GetOrganization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_GetOrganization_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).GetOrganization(ctx, req.(*GetOrganizationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_GetOrganizationByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOrganizationByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).GetOrganizationByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_GetOrganizationByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).GetOrganizationByName(ctx, req.(*GetOrganizationByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_ListOrganizations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListOrganizationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).ListOrganizations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_ListOrganizations_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).ListOrganizations(ctx, req.(*ListOrganizationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_ListUserOrganizations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserOrganizationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).ListUserOrganizations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_ListUserOrganizations_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).ListUserOrganizations(ctx, req.(*ListUserOrganizationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_GetUserOrganization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserOrganizationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).GetUserOrganization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_GetUserOrganization_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).GetUserOrganization(ctx, req.(*GetUserOrganizationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_CreateOrganization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateOrganizationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).CreateOrganization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_CreateOrganization_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).CreateOrganization(ctx, req.(*CreateOrganizationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_DeleteOrganization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteOrganizationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).DeleteOrganization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_DeleteOrganization_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).DeleteOrganization(ctx, req.(*DeleteOrganizationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_DeleteOrganizationByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteOrganizationByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).DeleteOrganizationByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_DeleteOrganizationByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).DeleteOrganizationByName(ctx, req.(*DeleteOrganizationByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_AddOrganizationMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddOrganizationMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).AddOrganizationMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_AddOrganizationMember_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).AddOrganizationMember(ctx, req.(*AddOrganizationMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_UpdateOrganizationMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateOrganizationMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).UpdateOrganizationMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_UpdateOrganizationMember_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).UpdateOrganizationMember(ctx, req.(*UpdateOrganizationMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_RemoveOrganizationMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveOrganizationMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).RemoveOrganizationMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_RemoveOrganizationMember_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).RemoveOrganizationMember(ctx, req.(*RemoveOrganizationMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_SetOrganizationMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetOrganizationMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).SetOrganizationMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_SetOrganizationMember_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).SetOrganizationMember(ctx, req.(*SetOrganizationMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_GetOrganizationSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOrganizationSettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).GetOrganizationSettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_GetOrganizationSettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).GetOrganizationSettings(ctx, req.(*GetOrganizationSettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_UpdateOrganizationSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateOrganizationSettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).UpdateOrganizationSettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_UpdateOrganizationSettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).UpdateOrganizationSettings(ctx, req.(*UpdateOrganizationSettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_AddOrganizationGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddOrganizationGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).AddOrganizationGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_AddOrganizationGroup_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).AddOrganizationGroup(ctx, req.(*AddOrganizationGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_RemoveOrganizationGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveOrganizationGroupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).RemoveOrganizationGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OrganizationService_RemoveOrganizationGroup_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).RemoveOrganizationGroup(ctx, req.(*RemoveOrganizationGroupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// OrganizationService_ServiceDesc is the grpc.ServiceDesc for OrganizationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var OrganizationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.OrganizationService", + HandlerType: (*OrganizationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetOrganization", + Handler: _OrganizationService_GetOrganization_Handler, + }, + { + MethodName: "GetOrganizationByName", + Handler: _OrganizationService_GetOrganizationByName_Handler, + }, + { + MethodName: "ListOrganizations", + Handler: _OrganizationService_ListOrganizations_Handler, + }, + { + MethodName: "ListUserOrganizations", + Handler: _OrganizationService_ListUserOrganizations_Handler, + }, + { + MethodName: "GetUserOrganization", + Handler: _OrganizationService_GetUserOrganization_Handler, + }, + { + MethodName: "CreateOrganization", + Handler: _OrganizationService_CreateOrganization_Handler, + }, + { + MethodName: "DeleteOrganization", + Handler: _OrganizationService_DeleteOrganization_Handler, + }, + { + MethodName: "DeleteOrganizationByName", + Handler: _OrganizationService_DeleteOrganizationByName_Handler, + }, + { + MethodName: "AddOrganizationMember", + Handler: _OrganizationService_AddOrganizationMember_Handler, + }, + { + MethodName: "UpdateOrganizationMember", + Handler: _OrganizationService_UpdateOrganizationMember_Handler, + }, + { + MethodName: "RemoveOrganizationMember", + Handler: _OrganizationService_RemoveOrganizationMember_Handler, + }, + { + MethodName: "SetOrganizationMember", + Handler: _OrganizationService_SetOrganizationMember_Handler, + }, + { + MethodName: "GetOrganizationSettings", + Handler: _OrganizationService_GetOrganizationSettings_Handler, + }, + { + MethodName: "UpdateOrganizationSettings", + Handler: _OrganizationService_UpdateOrganizationSettings_Handler, + }, + { + MethodName: "AddOrganizationGroup", + Handler: _OrganizationService_AddOrganizationGroup_Handler, + }, + { + MethodName: "RemoveOrganizationGroup", + Handler: _OrganizationService_RemoveOrganizationGroup_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/organization.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/owner.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/owner.pb.go new file mode 100644 index 000000000..c71d1d1ee --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/owner.pb.go @@ -0,0 +1,370 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/owner.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Owner struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Owner: + // + // *Owner_User + // *Owner_Organization + Owner isOwner_Owner `protobuf_oneof:"owner"` +} + +func (x *Owner) Reset() { + *x = Owner{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_owner_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Owner) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Owner) ProtoMessage() {} + +func (x *Owner) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_owner_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Owner.ProtoReflect.Descriptor instead. +func (*Owner) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_owner_proto_rawDescGZIP(), []int{0} +} + +func (m *Owner) GetOwner() isOwner_Owner { + if m != nil { + return m.Owner + } + return nil +} + +func (x *Owner) GetUser() *User { + if x, ok := x.GetOwner().(*Owner_User); ok { + return x.User + } + return nil +} + +func (x *Owner) GetOrganization() *Organization { + if x, ok := x.GetOwner().(*Owner_Organization); ok { + return x.Organization + } + return nil +} + +type isOwner_Owner interface { + isOwner_Owner() +} + +type Owner_User struct { + // The requested owner is a `User`. + User *User `protobuf:"bytes,1,opt,name=user,proto3,oneof"` +} + +type Owner_Organization struct { + // The requested owner is a `Organization`. + Organization *Organization `protobuf:"bytes,2,opt,name=organization,proto3,oneof"` +} + +func (*Owner_User) isOwner_Owner() {} + +func (*Owner_Organization) isOwner_Owner() {} + +type GetOwnerByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the requested owner. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetOwnerByNameRequest) Reset() { + *x = GetOwnerByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_owner_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOwnerByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOwnerByNameRequest) ProtoMessage() {} + +func (x *GetOwnerByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_owner_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOwnerByNameRequest.ProtoReflect.Descriptor instead. +func (*GetOwnerByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_owner_proto_rawDescGZIP(), []int{1} +} + +func (x *GetOwnerByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetOwnerByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner *Owner `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (x *GetOwnerByNameResponse) Reset() { + *x = GetOwnerByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_owner_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOwnerByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOwnerByNameResponse) ProtoMessage() {} + +func (x *GetOwnerByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_owner_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOwnerByNameResponse.ProtoReflect.Descriptor instead. +func (*GetOwnerByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_owner_proto_rawDescGZIP(), []int{2} +} + +func (x *GetOwnerByNameResponse) GetOwner() *Owner { + if x != nil { + return x.Owner + } + return nil +} + +var File_registry_v1alpha1_owner_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_owner_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x24, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb6, + 0x01, 0x0a, 0x05, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x45, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x48, 0x00, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, + 0x5d, 0x0a, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, + 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, + 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x2b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x77, + 0x6e, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x60, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, + 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x32, 0xab, 0x01, 0x0a, 0x0c, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9a, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x40, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, + 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x03, 0x90, 0x02, 0x01, 0x42, 0xe5, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0a, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, + 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, + 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_owner_proto_rawDescOnce sync.Once + file_registry_v1alpha1_owner_proto_rawDescData = file_registry_v1alpha1_owner_proto_rawDesc +) + +func file_registry_v1alpha1_owner_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_owner_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_owner_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_owner_proto_rawDescData) + }) + return file_registry_v1alpha1_owner_proto_rawDescData +} + +var file_registry_v1alpha1_owner_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_registry_v1alpha1_owner_proto_goTypes = []interface{}{ + (*Owner)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.Owner + (*GetOwnerByNameRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetOwnerByNameRequest + (*GetOwnerByNameResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetOwnerByNameResponse + (*User)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.User + (*Organization)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.Organization +} +var file_registry_v1alpha1_owner_proto_depIdxs = []int32{ + 3, // 0: bufman.dubbo.apache.org.registry.v1alpha1.Owner.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 4, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Owner.organization:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Organization + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetOwnerByNameResponse.owner:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Owner + 1, // 3: bufman.dubbo.apache.org.registry.v1alpha1.OwnerService.GetOwnerByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetOwnerByNameRequest + 2, // 4: bufman.dubbo.apache.org.registry.v1alpha1.OwnerService.GetOwnerByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetOwnerByNameResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_owner_proto_init() } +func file_registry_v1alpha1_owner_proto_init() { + if File_registry_v1alpha1_owner_proto != nil { + return + } + file_registry_v1alpha1_organization_proto_init() + file_registry_v1alpha1_user_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_owner_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Owner); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_owner_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOwnerByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_owner_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOwnerByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_owner_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Owner_User)(nil), + (*Owner_Organization)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_owner_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_owner_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_owner_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_owner_proto_msgTypes, + }.Build() + File_registry_v1alpha1_owner_proto = out.File + file_registry_v1alpha1_owner_proto_rawDesc = nil + file_registry_v1alpha1_owner_proto_goTypes = nil + file_registry_v1alpha1_owner_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/owner_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/owner_grpc.pb.go new file mode 100644 index 000000000..8f95949ea --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/owner_grpc.pb.go @@ -0,0 +1,113 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/owner.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + OwnerService_GetOwnerByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.OwnerService/GetOwnerByName" +) + +// OwnerServiceClient is the client API for OwnerService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type OwnerServiceClient interface { + // GetOwnerByName takes an owner name and returns the owner as + // either a user or organization. + GetOwnerByName(ctx context.Context, in *GetOwnerByNameRequest, opts ...grpc.CallOption) (*GetOwnerByNameResponse, error) +} + +type ownerServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewOwnerServiceClient(cc grpc.ClientConnInterface) OwnerServiceClient { + return &ownerServiceClient{cc} +} + +func (c *ownerServiceClient) GetOwnerByName(ctx context.Context, in *GetOwnerByNameRequest, opts ...grpc.CallOption) (*GetOwnerByNameResponse, error) { + out := new(GetOwnerByNameResponse) + err := c.cc.Invoke(ctx, OwnerService_GetOwnerByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// OwnerServiceServer is the server API for OwnerService service. +// All implementations must embed UnimplementedOwnerServiceServer +// for forward compatibility +type OwnerServiceServer interface { + // GetOwnerByName takes an owner name and returns the owner as + // either a user or organization. + GetOwnerByName(context.Context, *GetOwnerByNameRequest) (*GetOwnerByNameResponse, error) + mustEmbedUnimplementedOwnerServiceServer() +} + +// UnimplementedOwnerServiceServer must be embedded to have forward compatible implementations. +type UnimplementedOwnerServiceServer struct { +} + +func (UnimplementedOwnerServiceServer) GetOwnerByName(context.Context, *GetOwnerByNameRequest) (*GetOwnerByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetOwnerByName not implemented") +} +func (UnimplementedOwnerServiceServer) mustEmbedUnimplementedOwnerServiceServer() {} + +// UnsafeOwnerServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to OwnerServiceServer will +// result in compilation errors. +type UnsafeOwnerServiceServer interface { + mustEmbedUnimplementedOwnerServiceServer() +} + +func RegisterOwnerServiceServer(s grpc.ServiceRegistrar, srv OwnerServiceServer) { + s.RegisterService(&OwnerService_ServiceDesc, srv) +} + +func _OwnerService_GetOwnerByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOwnerByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OwnerServiceServer).GetOwnerByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OwnerService_GetOwnerByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OwnerServiceServer).GetOwnerByName(ctx, req.(*GetOwnerByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// OwnerService_ServiceDesc is the grpc.ServiceDesc for OwnerService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var OwnerService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.OwnerService", + HandlerType: (*OwnerServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetOwnerByName", + Handler: _OwnerService_GetOwnerByName_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/owner.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin.pb.go new file mode 100644 index 000000000..1140da0ac --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin.pb.go @@ -0,0 +1,3539 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// registry/v1alpha1/plugin.proto is a deprecated file. + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// PluginVisibility defines the visibility options available +// for Plugins and Templates. +type PluginVisibility int32 + +const ( + PluginVisibility_PLUGIN_VISIBILITY_UNSPECIFIED PluginVisibility = 0 + PluginVisibility_PLUGIN_VISIBILITY_PUBLIC PluginVisibility = 1 + PluginVisibility_PLUGIN_VISIBILITY_PRIVATE PluginVisibility = 2 +) + +// Enum value maps for PluginVisibility. +var ( + PluginVisibility_name = map[int32]string{ + 0: "PLUGIN_VISIBILITY_UNSPECIFIED", + 1: "PLUGIN_VISIBILITY_PUBLIC", + 2: "PLUGIN_VISIBILITY_PRIVATE", + } + PluginVisibility_value = map[string]int32{ + "PLUGIN_VISIBILITY_UNSPECIFIED": 0, + "PLUGIN_VISIBILITY_PUBLIC": 1, + "PLUGIN_VISIBILITY_PRIVATE": 2, + } +) + +func (x PluginVisibility) Enum() *PluginVisibility { + p := new(PluginVisibility) + *p = x + return p +} + +func (x PluginVisibility) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PluginVisibility) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_plugin_proto_enumTypes[0].Descriptor() +} + +func (PluginVisibility) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_plugin_proto_enumTypes[0] +} + +func (x PluginVisibility) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PluginVisibility.Descriptor instead. +func (PluginVisibility) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{0} +} + +// Plugin represents a protoc plugin, such as protoc-gen-go. +type Plugin struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the plugin, which uniquely identifies the plugin. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the plugin, i.e. "protoc-gen-go". + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the owner of the plugin. Either a username or + // organization name. + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + // The visibility of the plugin. + Visibility PluginVisibility `protobuf:"varint,4,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility" json:"visibility,omitempty"` + // deprecated means this plugin is deprecated. + Deprecated bool `protobuf:"varint,5,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + // deprecation_message is the message shown if the plugin is deprecated. + DeprecationMessage string `protobuf:"bytes,6,opt,name=deprecation_message,json=deprecationMessage,proto3" json:"deprecation_message,omitempty"` + // The creation time of the plugin. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // The last update time of the plugin object. + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` +} + +func (x *Plugin) Reset() { + *x = Plugin{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Plugin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Plugin) ProtoMessage() {} + +func (x *Plugin) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Plugin.ProtoReflect.Descriptor instead. +func (*Plugin) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{0} +} + +func (x *Plugin) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Plugin) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Plugin) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *Plugin) GetVisibility() PluginVisibility { + if x != nil { + return x.Visibility + } + return PluginVisibility_PLUGIN_VISIBILITY_UNSPECIFIED +} + +func (x *Plugin) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *Plugin) GetDeprecationMessage() string { + if x != nil { + return x.DeprecationMessage + } + return "" +} + +func (x *Plugin) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *Plugin) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +// PluginVersion represents a specific build of a plugin, +// such as protoc-gen-go v1.4.0. +type PluginVersion struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the plugin version, which uniquely identifies the plugin version. + // Mostly used for pagination. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the version, i.e. "v1.4.0". + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the plugin to which this version relates. + PluginName string `protobuf:"bytes,3,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty"` + // The owner of the plugin to which this version relates. + PluginOwner string `protobuf:"bytes,4,opt,name=plugin_owner,json=pluginOwner,proto3" json:"plugin_owner,omitempty"` + // The full container image digest associated with this plugin version including + // the algorithm. + // Ref: https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests + ContainerImageDigest string `protobuf:"bytes,5,opt,name=container_image_digest,json=containerImageDigest,proto3" json:"container_image_digest,omitempty"` + // Optionally define the runtime libraries. + RuntimeLibraries []*RuntimeLibrary `protobuf:"bytes,6,rep,name=runtime_libraries,json=runtimeLibraries,proto3" json:"runtime_libraries,omitempty"` +} + +func (x *PluginVersion) Reset() { + *x = PluginVersion{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginVersion) ProtoMessage() {} + +func (x *PluginVersion) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PluginVersion.ProtoReflect.Descriptor instead. +func (*PluginVersion) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{1} +} + +func (x *PluginVersion) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PluginVersion) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PluginVersion) GetPluginName() string { + if x != nil { + return x.PluginName + } + return "" +} + +func (x *PluginVersion) GetPluginOwner() string { + if x != nil { + return x.PluginOwner + } + return "" +} + +func (x *PluginVersion) GetContainerImageDigest() string { + if x != nil { + return x.ContainerImageDigest + } + return "" +} + +func (x *PluginVersion) GetRuntimeLibraries() []*RuntimeLibrary { + if x != nil { + return x.RuntimeLibraries + } + return nil +} + +// Template defines a set of plugins that should be used together +// i.e. "go-grpc" would include protoc-gen-go and protoc-gen-go-grpc. +type Template struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the template, which uniquely identifies the template. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the template, i.e. "grpc-go". + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the owner of the template. Either a + // username or organization name. + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + // Must not contain duplicate plugins. Order of plugin configs + // dictates insertion point order. Note that we're + // intentionally putting most of the plugin configuration + // in the template, so that template versions are + // less likely to cause breakages for users. + PluginConfigs []*PluginConfig `protobuf:"bytes,4,rep,name=plugin_configs,json=pluginConfigs,proto3" json:"plugin_configs,omitempty"` + // The visibility of the template. + Visibility PluginVisibility `protobuf:"varint,5,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility" json:"visibility,omitempty"` + // deprecated means this template is deprecated. + Deprecated bool `protobuf:"varint,8,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + // deprecation_message is the message shown if the template is deprecated. + DeprecationMessage string `protobuf:"bytes,9,opt,name=deprecation_message,json=deprecationMessage,proto3" json:"deprecation_message,omitempty"` + // The creation time of the template. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // The last update time of the template object. + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` +} + +func (x *Template) Reset() { + *x = Template{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Template) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Template) ProtoMessage() {} + +func (x *Template) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Template.ProtoReflect.Descriptor instead. +func (*Template) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{2} +} + +func (x *Template) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Template) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Template) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *Template) GetPluginConfigs() []*PluginConfig { + if x != nil { + return x.PluginConfigs + } + return nil +} + +func (x *Template) GetVisibility() PluginVisibility { + if x != nil { + return x.Visibility + } + return PluginVisibility_PLUGIN_VISIBILITY_UNSPECIFIED +} + +func (x *Template) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *Template) GetDeprecationMessage() string { + if x != nil { + return x.DeprecationMessage + } + return "" +} + +func (x *Template) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *Template) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +// PluginConfig defines a runtime configuration for a plugin. +type PluginConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin to which this config relates. + PluginOwner string `protobuf:"bytes,1,opt,name=plugin_owner,json=pluginOwner,proto3" json:"plugin_owner,omitempty"` + // The name of the plugin to which this config relates. + PluginName string `protobuf:"bytes,2,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty"` + // Parameters that should be provided to the plugin. These are + // joined with a "," before being provided to the plugin at runtime. + Parameters []string `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty"` + // True if the source plugin is inaccessible by the user. + Inaccessible bool `protobuf:"varint,5,opt,name=inaccessible,proto3" json:"inaccessible,omitempty"` +} + +func (x *PluginConfig) Reset() { + *x = PluginConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginConfig) ProtoMessage() {} + +func (x *PluginConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PluginConfig.ProtoReflect.Descriptor instead. +func (*PluginConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{3} +} + +func (x *PluginConfig) GetPluginOwner() string { + if x != nil { + return x.PluginOwner + } + return "" +} + +func (x *PluginConfig) GetPluginName() string { + if x != nil { + return x.PluginName + } + return "" +} + +func (x *PluginConfig) GetParameters() []string { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *PluginConfig) GetInaccessible() bool { + if x != nil { + return x.Inaccessible + } + return false +} + +// TemplateVersion defines a template at a +// specific set of versions for the contained plugins. +type TemplateVersion struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the template version, which uniquely identifies the template version. + // Mostly used for pagination. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the template version, i.e. "v1". + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The owner of the template to which this version relates. + TemplateOwner string `protobuf:"bytes,3,opt,name=template_owner,json=templateOwner,proto3" json:"template_owner,omitempty"` + // The name of the template to which this version relates. + TemplateName string `protobuf:"bytes,4,opt,name=template_name,json=templateName,proto3" json:"template_name,omitempty"` + // A map from plugin owner and name to version for the plugins + // defined in the template. Every plugin in the template + // must have a corresponding version in this array. + PluginVersions []*PluginVersionMapping `protobuf:"bytes,5,rep,name=plugin_versions,json=pluginVersions,proto3" json:"plugin_versions,omitempty"` +} + +func (x *TemplateVersion) Reset() { + *x = TemplateVersion{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateVersion) ProtoMessage() {} + +func (x *TemplateVersion) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateVersion.ProtoReflect.Descriptor instead. +func (*TemplateVersion) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{4} +} + +func (x *TemplateVersion) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TemplateVersion) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TemplateVersion) GetTemplateOwner() string { + if x != nil { + return x.TemplateOwner + } + return "" +} + +func (x *TemplateVersion) GetTemplateName() string { + if x != nil { + return x.TemplateName + } + return "" +} + +func (x *TemplateVersion) GetPluginVersions() []*PluginVersionMapping { + if x != nil { + return x.PluginVersions + } + return nil +} + +// PluginVersionMapping maps a plugin_id to a version. +type PluginVersionMapping struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin to which this mapping relates. + PluginOwner string `protobuf:"bytes,1,opt,name=plugin_owner,json=pluginOwner,proto3" json:"plugin_owner,omitempty"` + // The name of the plugin to which this mapping relates. + PluginName string `protobuf:"bytes,2,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty"` + // The version of the plugin to use, i.e. "v1.4.0". + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + // True if the source plugin is inaccessible by the user. + Inaccessible bool `protobuf:"varint,5,opt,name=inaccessible,proto3" json:"inaccessible,omitempty"` +} + +func (x *PluginVersionMapping) Reset() { + *x = PluginVersionMapping{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginVersionMapping) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginVersionMapping) ProtoMessage() {} + +func (x *PluginVersionMapping) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PluginVersionMapping.ProtoReflect.Descriptor instead. +func (*PluginVersionMapping) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{5} +} + +func (x *PluginVersionMapping) GetPluginOwner() string { + if x != nil { + return x.PluginOwner + } + return "" +} + +func (x *PluginVersionMapping) GetPluginName() string { + if x != nil { + return x.PluginName + } + return "" +} + +func (x *PluginVersionMapping) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *PluginVersionMapping) GetInaccessible() bool { + if x != nil { + return x.Inaccessible + } + return false +} + +type ListPluginsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListPluginsRequest) Reset() { + *x = ListPluginsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPluginsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPluginsRequest) ProtoMessage() {} + +func (x *ListPluginsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListPluginsRequest.ProtoReflect.Descriptor instead. +func (*ListPluginsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{6} +} + +func (x *ListPluginsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListPluginsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListPluginsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListPluginsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Plugins []*Plugin `protobuf:"bytes,1,rep,name=plugins,proto3" json:"plugins,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListPluginsResponse) Reset() { + *x = ListPluginsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPluginsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPluginsResponse) ProtoMessage() {} + +func (x *ListPluginsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListPluginsResponse.ProtoReflect.Descriptor instead. +func (*ListPluginsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{7} +} + +func (x *ListPluginsResponse) GetPlugins() []*Plugin { + if x != nil { + return x.Plugins + } + return nil +} + +func (x *ListPluginsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListUserPluginsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner to list plugins for. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListUserPluginsRequest) Reset() { + *x = ListUserPluginsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserPluginsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserPluginsRequest) ProtoMessage() {} + +func (x *ListUserPluginsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserPluginsRequest.ProtoReflect.Descriptor instead. +func (*ListUserPluginsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{8} +} + +func (x *ListUserPluginsRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ListUserPluginsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUserPluginsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListUserPluginsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListUserPluginsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Plugins []*Plugin `protobuf:"bytes,1,rep,name=plugins,proto3" json:"plugins,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListUserPluginsResponse) Reset() { + *x = ListUserPluginsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserPluginsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserPluginsResponse) ProtoMessage() {} + +func (x *ListUserPluginsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserPluginsResponse.ProtoReflect.Descriptor instead. +func (*ListUserPluginsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{9} +} + +func (x *ListUserPluginsResponse) GetPlugins() []*Plugin { + if x != nil { + return x.Plugins + } + return nil +} + +func (x *ListUserPluginsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListOrganizationPluginsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The organization to list plugins for. + Organization string `protobuf:"bytes,1,opt,name=organization,proto3" json:"organization,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListOrganizationPluginsRequest) Reset() { + *x = ListOrganizationPluginsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationPluginsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationPluginsRequest) ProtoMessage() {} + +func (x *ListOrganizationPluginsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationPluginsRequest.ProtoReflect.Descriptor instead. +func (*ListOrganizationPluginsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{10} +} + +func (x *ListOrganizationPluginsRequest) GetOrganization() string { + if x != nil { + return x.Organization + } + return "" +} + +func (x *ListOrganizationPluginsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListOrganizationPluginsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListOrganizationPluginsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListOrganizationPluginsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Plugins []*Plugin `protobuf:"bytes,1,rep,name=plugins,proto3" json:"plugins,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListOrganizationPluginsResponse) Reset() { + *x = ListOrganizationPluginsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationPluginsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationPluginsResponse) ProtoMessage() {} + +func (x *ListOrganizationPluginsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationPluginsResponse.ProtoReflect.Descriptor instead. +func (*ListOrganizationPluginsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{11} +} + +func (x *ListOrganizationPluginsResponse) GetPlugins() []*Plugin { + if x != nil { + return x.Plugins + } + return nil +} + +func (x *ListOrganizationPluginsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type GetPluginVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin the version belongs to. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin the version belongs to. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the version. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GetPluginVersionRequest) Reset() { + *x = GetPluginVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPluginVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPluginVersionRequest) ProtoMessage() {} + +func (x *GetPluginVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPluginVersionRequest.ProtoReflect.Descriptor instead. +func (*GetPluginVersionRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{12} +} + +func (x *GetPluginVersionRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetPluginVersionRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetPluginVersionRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type GetPluginVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PluginVersion *PluginVersion `protobuf:"bytes,1,opt,name=plugin_version,json=pluginVersion,proto3" json:"plugin_version,omitempty"` +} + +func (x *GetPluginVersionResponse) Reset() { + *x = GetPluginVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPluginVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPluginVersionResponse) ProtoMessage() {} + +func (x *GetPluginVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPluginVersionResponse.ProtoReflect.Descriptor instead. +func (*GetPluginVersionResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{13} +} + +func (x *GetPluginVersionResponse) GetPluginVersion() *PluginVersion { + if x != nil { + return x.PluginVersion + } + return nil +} + +type ListPluginVersionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin to list versions for. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin to list versions for. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The number of items to return. + PageSize uint32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListPluginVersionsRequest) Reset() { + *x = ListPluginVersionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPluginVersionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPluginVersionsRequest) ProtoMessage() {} + +func (x *ListPluginVersionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListPluginVersionsRequest.ProtoReflect.Descriptor instead. +func (*ListPluginVersionsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{14} +} + +func (x *ListPluginVersionsRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ListPluginVersionsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ListPluginVersionsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListPluginVersionsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListPluginVersionsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListPluginVersionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PluginVersions []*PluginVersion `protobuf:"bytes,1,rep,name=plugin_versions,json=pluginVersions,proto3" json:"plugin_versions,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListPluginVersionsResponse) Reset() { + *x = ListPluginVersionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPluginVersionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPluginVersionsResponse) ProtoMessage() {} + +func (x *ListPluginVersionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListPluginVersionsResponse.ProtoReflect.Descriptor instead. +func (*ListPluginVersionsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{15} +} + +func (x *ListPluginVersionsResponse) GetPluginVersions() []*PluginVersion { + if x != nil { + return x.PluginVersions + } + return nil +} + +func (x *ListPluginVersionsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type GetPluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetPluginRequest) Reset() { + *x = GetPluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPluginRequest) ProtoMessage() {} + +func (x *GetPluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPluginRequest.ProtoReflect.Descriptor instead. +func (*GetPluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{16} +} + +func (x *GetPluginRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetPluginRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetPluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Plugin *Plugin `protobuf:"bytes,1,opt,name=plugin,proto3" json:"plugin,omitempty"` +} + +func (x *GetPluginResponse) Reset() { + *x = GetPluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPluginResponse) ProtoMessage() {} + +func (x *GetPluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPluginResponse.ProtoReflect.Descriptor instead. +func (*GetPluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{17} +} + +func (x *GetPluginResponse) GetPlugin() *Plugin { + if x != nil { + return x.Plugin + } + return nil +} + +type DeletePluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin to delete. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin to delete. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *DeletePluginRequest) Reset() { + *x = DeletePluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePluginRequest) ProtoMessage() {} + +func (x *DeletePluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletePluginRequest.ProtoReflect.Descriptor instead. +func (*DeletePluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{18} +} + +func (x *DeletePluginRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *DeletePluginRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeletePluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeletePluginResponse) Reset() { + *x = DeletePluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePluginResponse) ProtoMessage() {} + +func (x *DeletePluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletePluginResponse.ProtoReflect.Descriptor instead. +func (*DeletePluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{19} +} + +type GetTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the template. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the template. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetTemplateRequest) Reset() { + *x = GetTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTemplateRequest) ProtoMessage() {} + +func (x *GetTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTemplateRequest.ProtoReflect.Descriptor instead. +func (*GetTemplateRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{20} +} + +func (x *GetTemplateRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetTemplateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetTemplateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Template *Template `protobuf:"bytes,1,opt,name=template,proto3" json:"template,omitempty"` +} + +func (x *GetTemplateResponse) Reset() { + *x = GetTemplateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTemplateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTemplateResponse) ProtoMessage() {} + +func (x *GetTemplateResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTemplateResponse.ProtoReflect.Descriptor instead. +func (*GetTemplateResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{21} +} + +func (x *GetTemplateResponse) GetTemplate() *Template { + if x != nil { + return x.Template + } + return nil +} + +type ListTemplatesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListTemplatesRequest) Reset() { + *x = ListTemplatesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTemplatesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTemplatesRequest) ProtoMessage() {} + +func (x *ListTemplatesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListTemplatesRequest.ProtoReflect.Descriptor instead. +func (*ListTemplatesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{22} +} + +func (x *ListTemplatesRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListTemplatesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListTemplatesRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListTemplatesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Templates []*Template `protobuf:"bytes,1,rep,name=templates,proto3" json:"templates,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListTemplatesResponse) Reset() { + *x = ListTemplatesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTemplatesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTemplatesResponse) ProtoMessage() {} + +func (x *ListTemplatesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListTemplatesResponse.ProtoReflect.Descriptor instead. +func (*ListTemplatesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{23} +} + +func (x *ListTemplatesResponse) GetTemplates() []*Template { + if x != nil { + return x.Templates + } + return nil +} + +func (x *ListTemplatesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListTemplatesUserCanAccessRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListTemplatesUserCanAccessRequest) Reset() { + *x = ListTemplatesUserCanAccessRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTemplatesUserCanAccessRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTemplatesUserCanAccessRequest) ProtoMessage() {} + +func (x *ListTemplatesUserCanAccessRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListTemplatesUserCanAccessRequest.ProtoReflect.Descriptor instead. +func (*ListTemplatesUserCanAccessRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{24} +} + +func (x *ListTemplatesUserCanAccessRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListTemplatesUserCanAccessRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListTemplatesUserCanAccessRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListTemplatesUserCanAccessResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Templates []*Template `protobuf:"bytes,1,rep,name=templates,proto3" json:"templates,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListTemplatesUserCanAccessResponse) Reset() { + *x = ListTemplatesUserCanAccessResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTemplatesUserCanAccessResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTemplatesUserCanAccessResponse) ProtoMessage() {} + +func (x *ListTemplatesUserCanAccessResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListTemplatesUserCanAccessResponse.ProtoReflect.Descriptor instead. +func (*ListTemplatesUserCanAccessResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{25} +} + +func (x *ListTemplatesUserCanAccessResponse) GetTemplates() []*Template { + if x != nil { + return x.Templates + } + return nil +} + +func (x *ListTemplatesUserCanAccessResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListUserTemplatesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the templates to list for. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListUserTemplatesRequest) Reset() { + *x = ListUserTemplatesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserTemplatesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserTemplatesRequest) ProtoMessage() {} + +func (x *ListUserTemplatesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserTemplatesRequest.ProtoReflect.Descriptor instead. +func (*ListUserTemplatesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{26} +} + +func (x *ListUserTemplatesRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ListUserTemplatesRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUserTemplatesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListUserTemplatesRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListUserTemplatesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Templates []*Template `protobuf:"bytes,1,rep,name=templates,proto3" json:"templates,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListUserTemplatesResponse) Reset() { + *x = ListUserTemplatesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserTemplatesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserTemplatesResponse) ProtoMessage() {} + +func (x *ListUserTemplatesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserTemplatesResponse.ProtoReflect.Descriptor instead. +func (*ListUserTemplatesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{27} +} + +func (x *ListUserTemplatesResponse) GetTemplates() []*Template { + if x != nil { + return x.Templates + } + return nil +} + +func (x *ListUserTemplatesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type GetTemplateVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the template the version belongs to. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the template the version belongs to. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the version. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GetTemplateVersionRequest) Reset() { + *x = GetTemplateVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTemplateVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTemplateVersionRequest) ProtoMessage() {} + +func (x *GetTemplateVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTemplateVersionRequest.ProtoReflect.Descriptor instead. +func (*GetTemplateVersionRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{28} +} + +func (x *GetTemplateVersionRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetTemplateVersionRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetTemplateVersionRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type GetTemplateVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TemplateVersion *TemplateVersion `protobuf:"bytes,1,opt,name=template_version,json=templateVersion,proto3" json:"template_version,omitempty"` +} + +func (x *GetTemplateVersionResponse) Reset() { + *x = GetTemplateVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTemplateVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTemplateVersionResponse) ProtoMessage() {} + +func (x *GetTemplateVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTemplateVersionResponse.ProtoReflect.Descriptor instead. +func (*GetTemplateVersionResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{29} +} + +func (x *GetTemplateVersionResponse) GetTemplateVersion() *TemplateVersion { + if x != nil { + return x.TemplateVersion + } + return nil +} + +type ListOrganizationTemplatesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The organization of the templates to list for. + Organization string `protobuf:"bytes,1,opt,name=organization,proto3" json:"organization,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListOrganizationTemplatesRequest) Reset() { + *x = ListOrganizationTemplatesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationTemplatesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationTemplatesRequest) ProtoMessage() {} + +func (x *ListOrganizationTemplatesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationTemplatesRequest.ProtoReflect.Descriptor instead. +func (*ListOrganizationTemplatesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{30} +} + +func (x *ListOrganizationTemplatesRequest) GetOrganization() string { + if x != nil { + return x.Organization + } + return "" +} + +func (x *ListOrganizationTemplatesRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListOrganizationTemplatesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListOrganizationTemplatesRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListOrganizationTemplatesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Templates []*Template `protobuf:"bytes,1,rep,name=templates,proto3" json:"templates,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListOrganizationTemplatesResponse) Reset() { + *x = ListOrganizationTemplatesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationTemplatesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationTemplatesResponse) ProtoMessage() {} + +func (x *ListOrganizationTemplatesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationTemplatesResponse.ProtoReflect.Descriptor instead. +func (*ListOrganizationTemplatesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{31} +} + +func (x *ListOrganizationTemplatesResponse) GetTemplates() []*Template { + if x != nil { + return x.Templates + } + return nil +} + +func (x *ListOrganizationTemplatesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListTemplateVersionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the template to list versions for. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the template to list versions for. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The number of items to return. + PageSize uint32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListTemplateVersionsRequest) Reset() { + *x = ListTemplateVersionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTemplateVersionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTemplateVersionsRequest) ProtoMessage() {} + +func (x *ListTemplateVersionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListTemplateVersionsRequest.ProtoReflect.Descriptor instead. +func (*ListTemplateVersionsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{32} +} + +func (x *ListTemplateVersionsRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ListTemplateVersionsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ListTemplateVersionsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListTemplateVersionsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListTemplateVersionsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListTemplateVersionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TemplateVersions []*TemplateVersion `protobuf:"bytes,1,rep,name=template_versions,json=templateVersions,proto3" json:"template_versions,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListTemplateVersionsResponse) Reset() { + *x = ListTemplateVersionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTemplateVersionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTemplateVersionsResponse) ProtoMessage() {} + +func (x *ListTemplateVersionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListTemplateVersionsResponse.ProtoReflect.Descriptor instead. +func (*ListTemplateVersionsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{33} +} + +func (x *ListTemplateVersionsResponse) GetTemplateVersions() []*TemplateVersion { + if x != nil { + return x.TemplateVersions + } + return nil +} + +func (x *ListTemplateVersionsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type DeleteTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the template to delete. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the template to delete. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *DeleteTemplateRequest) Reset() { + *x = DeleteTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTemplateRequest) ProtoMessage() {} + +func (x *DeleteTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTemplateRequest.ProtoReflect.Descriptor instead. +func (*DeleteTemplateRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{34} +} + +func (x *DeleteTemplateRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *DeleteTemplateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteTemplateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteTemplateResponse) Reset() { + *x = DeleteTemplateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteTemplateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTemplateResponse) ProtoMessage() {} + +func (x *DeleteTemplateResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTemplateResponse.ProtoReflect.Descriptor instead. +func (*DeleteTemplateResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_proto_rawDescGZIP(), []int{35} +} + +var File_registry_v1alpha1_plugin_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_plugin_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x20, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xea, + 0x02, 0x0a, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x12, 0x5b, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, + 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x95, 0x02, 0x0a, 0x0d, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x6d, 0x61, 0x67, 0x65, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x66, 0x0a, 0x11, 0x72, + 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x52, 0x10, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x69, 0x65, 0x73, 0x22, 0xcc, 0x03, 0x0a, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x5e, 0x0a, 0x0e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x5b, 0x0a, 0x0a, 0x76, 0x69, + 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, + 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x22, 0xa5, 0x01, 0x0a, 0x0c, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, + 0x6e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x4a, 0x04, 0x08, 0x04, 0x10, + 0x05, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x22, 0xeb, 0x01, 0x0a, 0x0f, 0x54, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x68, + 0x0a, 0x0f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x14, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, + 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x6e, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x69, + 0x62, 0x6c, 0x65, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x22, 0x6a, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0x8a, + 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x07, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, + 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x84, 0x01, 0x0a, 0x16, + 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, + 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, + 0x0a, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x31, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x52, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, + 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x22, 0x9a, 0x01, 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, + 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x22, 0x96, 0x01, 0x0a, 0x1f, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, + 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x5d, 0x0a, 0x17, 0x47, 0x65, 0x74, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x7b, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x9b, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x3c, 0x0a, + 0x10, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x5e, 0x0a, 0x11, 0x47, + 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x49, 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x31, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x52, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x22, 0x3f, 0x0a, 0x13, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x16, 0x0a, 0x14, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x66, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x08, 0x74, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x6c, 0x0a, 0x14, + 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x15, 0x4c, + 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x09, 0x74, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x79, 0x0a, 0x21, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0x9f, 0x01, 0x0a, 0x22, 0x4c, + 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x51, 0x0a, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, + 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x86, 0x01, 0x0a, + 0x18, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, + 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, + 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, + 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x09, 0x74, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x5f, + 0x0a, 0x19, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, + 0x83, 0x01, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, + 0x0a, 0x10, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x9c, 0x01, 0x0a, 0x20, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, + 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x21, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x09, 0x74, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x52, 0x09, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x26, 0x0a, + 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, + 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, + 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x11, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x74, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, + 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x41, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0x72, 0x0a, 0x10, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x69, + 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x4c, 0x55, 0x47, + 0x49, 0x4e, 0x5f, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x50, + 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, + 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x4c, 0x55, + 0x47, 0x49, 0x4e, 0x5f, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, + 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x02, 0x32, 0xb4, 0x13, 0x0a, 0x0d, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x91, 0x01, 0x0a, 0x0b, 0x4c, + 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x3d, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x9d, + 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x73, 0x12, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb5, + 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x49, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa0, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa6, 0x01, 0x0a, 0x12, 0x4c, 0x69, + 0x73, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0x8b, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x12, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3c, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, + 0x12, 0x94, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x12, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0x91, 0x01, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x97, 0x01, 0x0a, 0x0d, + 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x3f, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xbe, 0x01, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x55, 0x73, + 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa3, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x43, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xbb, 0x01, 0x0a, + 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x4b, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa6, 0x01, 0x0a, 0x12, 0x47, + 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x01, 0x12, 0xac, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x46, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0x9a, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x42, + 0xe9, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x42, 0x0b, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xb8, + 0x01, 0x01, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, + 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_plugin_proto_rawDescOnce sync.Once + file_registry_v1alpha1_plugin_proto_rawDescData = file_registry_v1alpha1_plugin_proto_rawDesc +) + +func file_registry_v1alpha1_plugin_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_plugin_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_plugin_proto_rawDescData) + }) + return file_registry_v1alpha1_plugin_proto_rawDescData +} + +var file_registry_v1alpha1_plugin_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 36) +var file_registry_v1alpha1_plugin_proto_goTypes = []interface{}{ + (PluginVisibility)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility + (*Plugin)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.Plugin + (*PluginVersion)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.PluginVersion + (*Template)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.Template + (*PluginConfig)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.PluginConfig + (*TemplateVersion)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.TemplateVersion + (*PluginVersionMapping)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.PluginVersionMapping + (*ListPluginsRequest)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.ListPluginsRequest + (*ListPluginsResponse)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.ListPluginsResponse + (*ListUserPluginsRequest)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.ListUserPluginsRequest + (*ListUserPluginsResponse)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.ListUserPluginsResponse + (*ListOrganizationPluginsRequest)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationPluginsRequest + (*ListOrganizationPluginsResponse)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationPluginsResponse + (*GetPluginVersionRequest)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.GetPluginVersionRequest + (*GetPluginVersionResponse)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.GetPluginVersionResponse + (*ListPluginVersionsRequest)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.ListPluginVersionsRequest + (*ListPluginVersionsResponse)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.ListPluginVersionsResponse + (*GetPluginRequest)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.GetPluginRequest + (*GetPluginResponse)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.GetPluginResponse + (*DeletePluginRequest)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.DeletePluginRequest + (*DeletePluginResponse)(nil), // 20: bufman.dubbo.apache.org.registry.v1alpha1.DeletePluginResponse + (*GetTemplateRequest)(nil), // 21: bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateRequest + (*GetTemplateResponse)(nil), // 22: bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateResponse + (*ListTemplatesRequest)(nil), // 23: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesRequest + (*ListTemplatesResponse)(nil), // 24: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesResponse + (*ListTemplatesUserCanAccessRequest)(nil), // 25: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesUserCanAccessRequest + (*ListTemplatesUserCanAccessResponse)(nil), // 26: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesUserCanAccessResponse + (*ListUserTemplatesRequest)(nil), // 27: bufman.dubbo.apache.org.registry.v1alpha1.ListUserTemplatesRequest + (*ListUserTemplatesResponse)(nil), // 28: bufman.dubbo.apache.org.registry.v1alpha1.ListUserTemplatesResponse + (*GetTemplateVersionRequest)(nil), // 29: bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateVersionRequest + (*GetTemplateVersionResponse)(nil), // 30: bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateVersionResponse + (*ListOrganizationTemplatesRequest)(nil), // 31: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationTemplatesRequest + (*ListOrganizationTemplatesResponse)(nil), // 32: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationTemplatesResponse + (*ListTemplateVersionsRequest)(nil), // 33: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplateVersionsRequest + (*ListTemplateVersionsResponse)(nil), // 34: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplateVersionsResponse + (*DeleteTemplateRequest)(nil), // 35: bufman.dubbo.apache.org.registry.v1alpha1.DeleteTemplateRequest + (*DeleteTemplateResponse)(nil), // 36: bufman.dubbo.apache.org.registry.v1alpha1.DeleteTemplateResponse + (*timestamppb.Timestamp)(nil), // 37: google.protobuf.Timestamp + (*RuntimeLibrary)(nil), // 38: bufman.dubbo.apache.org.registry.v1alpha1.RuntimeLibrary +} +var file_registry_v1alpha1_plugin_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.registry.v1alpha1.Plugin.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility + 37, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Plugin.create_time:type_name -> google.protobuf.Timestamp + 37, // 2: bufman.dubbo.apache.org.registry.v1alpha1.Plugin.update_time:type_name -> google.protobuf.Timestamp + 38, // 3: bufman.dubbo.apache.org.registry.v1alpha1.PluginVersion.runtime_libraries:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RuntimeLibrary + 4, // 4: bufman.dubbo.apache.org.registry.v1alpha1.Template.plugin_configs:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginConfig + 0, // 5: bufman.dubbo.apache.org.registry.v1alpha1.Template.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginVisibility + 37, // 6: bufman.dubbo.apache.org.registry.v1alpha1.Template.create_time:type_name -> google.protobuf.Timestamp + 37, // 7: bufman.dubbo.apache.org.registry.v1alpha1.Template.update_time:type_name -> google.protobuf.Timestamp + 6, // 8: bufman.dubbo.apache.org.registry.v1alpha1.TemplateVersion.plugin_versions:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginVersionMapping + 1, // 9: bufman.dubbo.apache.org.registry.v1alpha1.ListPluginsResponse.plugins:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Plugin + 1, // 10: bufman.dubbo.apache.org.registry.v1alpha1.ListUserPluginsResponse.plugins:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Plugin + 1, // 11: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationPluginsResponse.plugins:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Plugin + 2, // 12: bufman.dubbo.apache.org.registry.v1alpha1.GetPluginVersionResponse.plugin_version:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginVersion + 2, // 13: bufman.dubbo.apache.org.registry.v1alpha1.ListPluginVersionsResponse.plugin_versions:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginVersion + 1, // 14: bufman.dubbo.apache.org.registry.v1alpha1.GetPluginResponse.plugin:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Plugin + 3, // 15: bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateResponse.template:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Template + 3, // 16: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesResponse.templates:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Template + 3, // 17: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesUserCanAccessResponse.templates:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Template + 3, // 18: bufman.dubbo.apache.org.registry.v1alpha1.ListUserTemplatesResponse.templates:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Template + 5, // 19: bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateVersionResponse.template_version:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.TemplateVersion + 3, // 20: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationTemplatesResponse.templates:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Template + 5, // 21: bufman.dubbo.apache.org.registry.v1alpha1.ListTemplateVersionsResponse.template_versions:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.TemplateVersion + 7, // 22: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPlugins:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListPluginsRequest + 9, // 23: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserPlugins:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUserPluginsRequest + 11, // 24: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationPlugins:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationPluginsRequest + 13, // 25: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPluginVersion:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetPluginVersionRequest + 15, // 26: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPluginVersions:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListPluginVersionsRequest + 17, // 27: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetPluginRequest + 19, // 28: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeletePlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeletePluginRequest + 21, // 29: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplate:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateRequest + 23, // 30: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplates:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesRequest + 25, // 31: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplatesUserCanAccess:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesUserCanAccessRequest + 27, // 32: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserTemplates:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUserTemplatesRequest + 31, // 33: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationTemplates:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationTemplatesRequest + 29, // 34: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplateVersion:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateVersionRequest + 33, // 35: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplateVersions:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListTemplateVersionsRequest + 35, // 36: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeleteTemplate:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteTemplateRequest + 8, // 37: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPlugins:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListPluginsResponse + 10, // 38: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserPlugins:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUserPluginsResponse + 12, // 39: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationPlugins:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationPluginsResponse + 14, // 40: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPluginVersion:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetPluginVersionResponse + 16, // 41: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListPluginVersions:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListPluginVersionsResponse + 18, // 42: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetPlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetPluginResponse + 20, // 43: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeletePlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeletePluginResponse + 22, // 44: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplate:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateResponse + 24, // 45: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplates:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesResponse + 26, // 46: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplatesUserCanAccess:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListTemplatesUserCanAccessResponse + 28, // 47: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListUserTemplates:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUserTemplatesResponse + 32, // 48: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListOrganizationTemplates:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationTemplatesResponse + 30, // 49: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.GetTemplateVersion:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetTemplateVersionResponse + 34, // 50: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.ListTemplateVersions:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListTemplateVersionsResponse + 36, // 51: bufman.dubbo.apache.org.registry.v1alpha1.PluginService.DeleteTemplate:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteTemplateResponse + 37, // [37:52] is the sub-list for method output_type + 22, // [22:37] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_plugin_proto_init() } +func file_registry_v1alpha1_plugin_proto_init() { + if File_registry_v1alpha1_plugin_proto != nil { + return + } + file_registry_v1alpha1_generate_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_plugin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Plugin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginVersion); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Template); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateVersion); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginVersionMapping); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPluginsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPluginsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserPluginsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserPluginsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationPluginsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationPluginsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPluginVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPluginVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPluginVersionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPluginVersionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTemplateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListTemplatesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListTemplatesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListTemplatesUserCanAccessRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListTemplatesUserCanAccessResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserTemplatesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserTemplatesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTemplateVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTemplateVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationTemplatesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationTemplatesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListTemplateVersionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListTemplateVersionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTemplateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_plugin_proto_rawDesc, + NumEnums: 1, + NumMessages: 36, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_plugin_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_plugin_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_plugin_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_plugin_proto_msgTypes, + }.Build() + File_registry_v1alpha1_plugin_proto = out.File + file_registry_v1alpha1_plugin_proto_rawDesc = nil + file_registry_v1alpha1_plugin_proto_goTypes = nil + file_registry_v1alpha1_plugin_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_curation.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_curation.pb.go new file mode 100644 index 000000000..e2a4f3693 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_curation.pb.go @@ -0,0 +1,3613 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/plugin_curation.proto + +package registryv1alpha1 + +import ( + v1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + pluginpb "google.golang.org/protobuf/types/pluginpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// CuratedPluginVisibility defines the visibility options available +// for Curated Plugins. +type CuratedPluginVisibility int32 + +const ( + CuratedPluginVisibility_CURATED_PLUGIN_VISIBILITY_UNSPECIFIED CuratedPluginVisibility = 0 + CuratedPluginVisibility_CURATED_PLUGIN_VISIBILITY_PUBLIC CuratedPluginVisibility = 1 + CuratedPluginVisibility_CURATED_PLUGIN_VISIBILITY_PRIVATE CuratedPluginVisibility = 2 +) + +// Enum value maps for CuratedPluginVisibility. +var ( + CuratedPluginVisibility_name = map[int32]string{ + 0: "CURATED_PLUGIN_VISIBILITY_UNSPECIFIED", + 1: "CURATED_PLUGIN_VISIBILITY_PUBLIC", + 2: "CURATED_PLUGIN_VISIBILITY_PRIVATE", + } + CuratedPluginVisibility_value = map[string]int32{ + "CURATED_PLUGIN_VISIBILITY_UNSPECIFIED": 0, + "CURATED_PLUGIN_VISIBILITY_PUBLIC": 1, + "CURATED_PLUGIN_VISIBILITY_PRIVATE": 2, + } +) + +func (x CuratedPluginVisibility) Enum() *CuratedPluginVisibility { + p := new(CuratedPluginVisibility) + *p = x + return p +} + +func (x CuratedPluginVisibility) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CuratedPluginVisibility) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_plugin_curation_proto_enumTypes[0].Descriptor() +} + +func (CuratedPluginVisibility) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_plugin_curation_proto_enumTypes[0] +} + +func (x CuratedPluginVisibility) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CuratedPluginVisibility.Descriptor instead. +func (CuratedPluginVisibility) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{0} +} + +// The supported plugin registries for curated plugins. +type PluginRegistryType int32 + +const ( + PluginRegistryType_PLUGIN_REGISTRY_TYPE_UNSPECIFIED PluginRegistryType = 0 + PluginRegistryType_PLUGIN_REGISTRY_TYPE_GO PluginRegistryType = 1 + PluginRegistryType_PLUGIN_REGISTRY_TYPE_NPM PluginRegistryType = 2 + PluginRegistryType_PLUGIN_REGISTRY_TYPE_MAVEN PluginRegistryType = 3 + PluginRegistryType_PLUGIN_REGISTRY_TYPE_SWIFT PluginRegistryType = 4 +) + +// Enum value maps for PluginRegistryType. +var ( + PluginRegistryType_name = map[int32]string{ + 0: "PLUGIN_REGISTRY_TYPE_UNSPECIFIED", + 1: "PLUGIN_REGISTRY_TYPE_GO", + 2: "PLUGIN_REGISTRY_TYPE_NPM", + 3: "PLUGIN_REGISTRY_TYPE_MAVEN", + 4: "PLUGIN_REGISTRY_TYPE_SWIFT", + } + PluginRegistryType_value = map[string]int32{ + "PLUGIN_REGISTRY_TYPE_UNSPECIFIED": 0, + "PLUGIN_REGISTRY_TYPE_GO": 1, + "PLUGIN_REGISTRY_TYPE_NPM": 2, + "PLUGIN_REGISTRY_TYPE_MAVEN": 3, + "PLUGIN_REGISTRY_TYPE_SWIFT": 4, + } +) + +func (x PluginRegistryType) Enum() *PluginRegistryType { + p := new(PluginRegistryType) + *p = x + return p +} + +func (x PluginRegistryType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PluginRegistryType) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_plugin_curation_proto_enumTypes[1].Descriptor() +} + +func (PluginRegistryType) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_plugin_curation_proto_enumTypes[1] +} + +func (x PluginRegistryType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PluginRegistryType.Descriptor instead. +func (PluginRegistryType) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{1} +} + +// PluginLanguage is used to specify the output languages a plugin supports. +type PluginLanguage int32 + +const ( + PluginLanguage_PLUGIN_LANGUAGE_UNSPECIFIED PluginLanguage = 0 + PluginLanguage_PLUGIN_LANGUAGE_GO PluginLanguage = 1 + PluginLanguage_PLUGIN_LANGUAGE_JAVASCRIPT PluginLanguage = 2 + PluginLanguage_PLUGIN_LANGUAGE_TYPESCRIPT PluginLanguage = 3 + PluginLanguage_PLUGIN_LANGUAGE_SWIFT PluginLanguage = 4 + PluginLanguage_PLUGIN_LANGUAGE_CPP PluginLanguage = 5 + PluginLanguage_PLUGIN_LANGUAGE_JAVA PluginLanguage = 6 + PluginLanguage_PLUGIN_LANGUAGE_DART PluginLanguage = 7 + PluginLanguage_PLUGIN_LANGUAGE_RUST PluginLanguage = 8 + PluginLanguage_PLUGIN_LANGUAGE_PYTHON PluginLanguage = 9 + PluginLanguage_PLUGIN_LANGUAGE_RUBY PluginLanguage = 10 + PluginLanguage_PLUGIN_LANGUAGE_KOTLIN PluginLanguage = 11 + PluginLanguage_PLUGIN_LANGUAGE_OBJECTIVE_C PluginLanguage = 12 + PluginLanguage_PLUGIN_LANGUAGE_PHP PluginLanguage = 13 + PluginLanguage_PLUGIN_LANGUAGE_CSHARP PluginLanguage = 14 + PluginLanguage_PLUGIN_LANGUAGE_SCALA PluginLanguage = 15 +) + +// Enum value maps for PluginLanguage. +var ( + PluginLanguage_name = map[int32]string{ + 0: "PLUGIN_LANGUAGE_UNSPECIFIED", + 1: "PLUGIN_LANGUAGE_GO", + 2: "PLUGIN_LANGUAGE_JAVASCRIPT", + 3: "PLUGIN_LANGUAGE_TYPESCRIPT", + 4: "PLUGIN_LANGUAGE_SWIFT", + 5: "PLUGIN_LANGUAGE_CPP", + 6: "PLUGIN_LANGUAGE_JAVA", + 7: "PLUGIN_LANGUAGE_DART", + 8: "PLUGIN_LANGUAGE_RUST", + 9: "PLUGIN_LANGUAGE_PYTHON", + 10: "PLUGIN_LANGUAGE_RUBY", + 11: "PLUGIN_LANGUAGE_KOTLIN", + 12: "PLUGIN_LANGUAGE_OBJECTIVE_C", + 13: "PLUGIN_LANGUAGE_PHP", + 14: "PLUGIN_LANGUAGE_CSHARP", + 15: "PLUGIN_LANGUAGE_SCALA", + } + PluginLanguage_value = map[string]int32{ + "PLUGIN_LANGUAGE_UNSPECIFIED": 0, + "PLUGIN_LANGUAGE_GO": 1, + "PLUGIN_LANGUAGE_JAVASCRIPT": 2, + "PLUGIN_LANGUAGE_TYPESCRIPT": 3, + "PLUGIN_LANGUAGE_SWIFT": 4, + "PLUGIN_LANGUAGE_CPP": 5, + "PLUGIN_LANGUAGE_JAVA": 6, + "PLUGIN_LANGUAGE_DART": 7, + "PLUGIN_LANGUAGE_RUST": 8, + "PLUGIN_LANGUAGE_PYTHON": 9, + "PLUGIN_LANGUAGE_RUBY": 10, + "PLUGIN_LANGUAGE_KOTLIN": 11, + "PLUGIN_LANGUAGE_OBJECTIVE_C": 12, + "PLUGIN_LANGUAGE_PHP": 13, + "PLUGIN_LANGUAGE_CSHARP": 14, + "PLUGIN_LANGUAGE_SCALA": 15, + } +) + +func (x PluginLanguage) Enum() *PluginLanguage { + p := new(PluginLanguage) + *p = x + return p +} + +func (x PluginLanguage) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PluginLanguage) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_plugin_curation_proto_enumTypes[2].Descriptor() +} + +func (PluginLanguage) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_plugin_curation_proto_enumTypes[2] +} + +func (x PluginLanguage) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PluginLanguage.Descriptor instead. +func (PluginLanguage) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{2} +} + +// NPMImportStyle is used to specify the import style the plugin supports. +type NPMImportStyle int32 + +const ( + NPMImportStyle_NPM_IMPORT_STYLE_UNSPECIFIED NPMImportStyle = 0 + NPMImportStyle_NPM_IMPORT_STYLE_MODULE NPMImportStyle = 1 + NPMImportStyle_NPM_IMPORT_STYLE_COMMONJS NPMImportStyle = 2 +) + +// Enum value maps for NPMImportStyle. +var ( + NPMImportStyle_name = map[int32]string{ + 0: "NPM_IMPORT_STYLE_UNSPECIFIED", + 1: "NPM_IMPORT_STYLE_MODULE", + 2: "NPM_IMPORT_STYLE_COMMONJS", + } + NPMImportStyle_value = map[string]int32{ + "NPM_IMPORT_STYLE_UNSPECIFIED": 0, + "NPM_IMPORT_STYLE_MODULE": 1, + "NPM_IMPORT_STYLE_COMMONJS": 2, + } +) + +func (x NPMImportStyle) Enum() *NPMImportStyle { + p := new(NPMImportStyle) + *p = x + return p +} + +func (x NPMImportStyle) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NPMImportStyle) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_plugin_curation_proto_enumTypes[3].Descriptor() +} + +func (NPMImportStyle) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_plugin_curation_proto_enumTypes[3] +} + +func (x NPMImportStyle) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NPMImportStyle.Descriptor instead. +func (NPMImportStyle) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{3} +} + +// SwiftPlatformType is used to specify the platform type for a Swift plugins minimum compatible version. +type SwiftPlatformType int32 + +const ( + SwiftPlatformType_SWIFT_PLATFORM_TYPE_UNSPECIFIED SwiftPlatformType = 0 + SwiftPlatformType_SWIFT_PLATFORM_TYPE_MACOS SwiftPlatformType = 1 + SwiftPlatformType_SWIFT_PLATFORM_TYPE_IOS SwiftPlatformType = 2 + SwiftPlatformType_SWIFT_PLATFORM_TYPE_WATCHOS SwiftPlatformType = 3 + SwiftPlatformType_SWIFT_PLATFORM_TYPE_TVOS SwiftPlatformType = 4 +) + +// Enum value maps for SwiftPlatformType. +var ( + SwiftPlatformType_name = map[int32]string{ + 0: "SWIFT_PLATFORM_TYPE_UNSPECIFIED", + 1: "SWIFT_PLATFORM_TYPE_MACOS", + 2: "SWIFT_PLATFORM_TYPE_IOS", + 3: "SWIFT_PLATFORM_TYPE_WATCHOS", + 4: "SWIFT_PLATFORM_TYPE_TVOS", + } + SwiftPlatformType_value = map[string]int32{ + "SWIFT_PLATFORM_TYPE_UNSPECIFIED": 0, + "SWIFT_PLATFORM_TYPE_MACOS": 1, + "SWIFT_PLATFORM_TYPE_IOS": 2, + "SWIFT_PLATFORM_TYPE_WATCHOS": 3, + "SWIFT_PLATFORM_TYPE_TVOS": 4, + } +) + +func (x SwiftPlatformType) Enum() *SwiftPlatformType { + p := new(SwiftPlatformType) + *p = x + return p +} + +func (x SwiftPlatformType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SwiftPlatformType) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_plugin_curation_proto_enumTypes[4].Descriptor() +} + +func (SwiftPlatformType) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_plugin_curation_proto_enumTypes[4] +} + +func (x SwiftPlatformType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SwiftPlatformType.Descriptor instead. +func (SwiftPlatformType) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{4} +} + +// GoConfig is the configuration for a Go plugin. +type GoConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Optionally define the runtime libraries for the plugin. + RuntimeLibraries []*GoConfig_RuntimeLibrary `protobuf:"bytes,1,rep,name=runtime_libraries,json=runtimeLibraries,proto3" json:"runtime_libraries,omitempty"` + // The minimum Go version required by the plugin. + MinimumVersion string `protobuf:"bytes,2,opt,name=minimum_version,json=minimumVersion,proto3" json:"minimum_version,omitempty"` +} + +func (x *GoConfig) Reset() { + *x = GoConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GoConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GoConfig) ProtoMessage() {} + +func (x *GoConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GoConfig.ProtoReflect.Descriptor instead. +func (*GoConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{0} +} + +func (x *GoConfig) GetRuntimeLibraries() []*GoConfig_RuntimeLibrary { + if x != nil { + return x.RuntimeLibraries + } + return nil +} + +func (x *GoConfig) GetMinimumVersion() string { + if x != nil { + return x.MinimumVersion + } + return "" +} + +// NPMConfig is the configuration for a JavaScript NPM plugin. +type NPMConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Optionally define the runtime libraries for the plugin. + RuntimeLibraries []*NPMConfig_RuntimeLibrary `protobuf:"bytes,1,rep,name=runtime_libraries,json=runtimeLibraries,proto3" json:"runtime_libraries,omitempty"` + // Optionally define a configuration for rewriting import paths, a feature mainly + // used for remote code generation in the BSR npm registry, which makes it possible + // to serve the output of a BSR module and a plugin in an individual package. + // + // All plugins based on @bufbuild/protoplugin support the option "rewrite_imports". + // Setting this value, i.e. "connectweb.js" or "pb.js", informs the BSR npm registry + // that the plugin supports import rewrites with the given import suffix. + RewriteImportPathSuffix string `protobuf:"bytes,2,opt,name=rewrite_import_path_suffix,json=rewriteImportPathSuffix,proto3" json:"rewrite_import_path_suffix,omitempty"` + // The import style used for the "type" field in the package.json file. + // This exists to support legacy plugins that require "commonjs" support. + ImportStyle NPMImportStyle `protobuf:"varint,3,opt,name=import_style,json=importStyle,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.NPMImportStyle" json:"import_style,omitempty"` +} + +func (x *NPMConfig) Reset() { + *x = NPMConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NPMConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NPMConfig) ProtoMessage() {} + +func (x *NPMConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NPMConfig.ProtoReflect.Descriptor instead. +func (*NPMConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{1} +} + +func (x *NPMConfig) GetRuntimeLibraries() []*NPMConfig_RuntimeLibrary { + if x != nil { + return x.RuntimeLibraries + } + return nil +} + +func (x *NPMConfig) GetRewriteImportPathSuffix() string { + if x != nil { + return x.RewriteImportPathSuffix + } + return "" +} + +func (x *NPMConfig) GetImportStyle() NPMImportStyle { + if x != nil { + return x.ImportStyle + } + return NPMImportStyle_NPM_IMPORT_STYLE_UNSPECIFIED +} + +// MavenConfig is the configuration for a Maven plugin. +type MavenConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Optionally define the runtime libraries for the plugin. + RuntimeLibraries []*MavenConfig_RuntimeLibrary `protobuf:"bytes,1,rep,name=runtime_libraries,json=runtimeLibraries,proto3" json:"runtime_libraries,omitempty"` + // Settings for the Java/Kotlin compiler used to compile the generated code. + Compiler *MavenConfig_CompilerConfig `protobuf:"bytes,2,opt,name=compiler,proto3" json:"compiler,omitempty"` + // Optional additional runtimes supported by the plugin. + AdditionalRuntimes []*MavenConfig_RuntimeConfig `protobuf:"bytes,3,rep,name=additional_runtimes,json=additionalRuntimes,proto3" json:"additional_runtimes,omitempty"` +} + +func (x *MavenConfig) Reset() { + *x = MavenConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MavenConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MavenConfig) ProtoMessage() {} + +func (x *MavenConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MavenConfig.ProtoReflect.Descriptor instead. +func (*MavenConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{2} +} + +func (x *MavenConfig) GetRuntimeLibraries() []*MavenConfig_RuntimeLibrary { + if x != nil { + return x.RuntimeLibraries + } + return nil +} + +func (x *MavenConfig) GetCompiler() *MavenConfig_CompilerConfig { + if x != nil { + return x.Compiler + } + return nil +} + +func (x *MavenConfig) GetAdditionalRuntimes() []*MavenConfig_RuntimeConfig { + if x != nil { + return x.AdditionalRuntimes + } + return nil +} + +type SwiftConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Optionally define the runtime libraries for the plugin. + RuntimeLibraries []*SwiftConfig_RuntimeLibrary `protobuf:"bytes,1,rep,name=runtime_libraries,json=runtimeLibraries,proto3" json:"runtime_libraries,omitempty"` +} + +func (x *SwiftConfig) Reset() { + *x = SwiftConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SwiftConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SwiftConfig) ProtoMessage() {} + +func (x *SwiftConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SwiftConfig.ProtoReflect.Descriptor instead. +func (*SwiftConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{3} +} + +func (x *SwiftConfig) GetRuntimeLibraries() []*SwiftConfig_RuntimeLibrary { + if x != nil { + return x.RuntimeLibraries + } + return nil +} + +// RegistryConfig is the configuration for the remote registry of a plugin. +type RegistryConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to RegistryConfig: + // + // *RegistryConfig_GoConfig + // *RegistryConfig_NpmConfig + // *RegistryConfig_MavenConfig + // *RegistryConfig_SwiftConfig + RegistryConfig isRegistryConfig_RegistryConfig `protobuf_oneof:"registry_config"` + // The options to pass to the plugin. These will + // be merged into a single, comma-separated string. + Options []string `protobuf:"bytes,10,rep,name=options,proto3" json:"options,omitempty"` +} + +func (x *RegistryConfig) Reset() { + *x = RegistryConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegistryConfig) ProtoMessage() {} + +func (x *RegistryConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegistryConfig.ProtoReflect.Descriptor instead. +func (*RegistryConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{4} +} + +func (m *RegistryConfig) GetRegistryConfig() isRegistryConfig_RegistryConfig { + if m != nil { + return m.RegistryConfig + } + return nil +} + +func (x *RegistryConfig) GetGoConfig() *GoConfig { + if x, ok := x.GetRegistryConfig().(*RegistryConfig_GoConfig); ok { + return x.GoConfig + } + return nil +} + +func (x *RegistryConfig) GetNpmConfig() *NPMConfig { + if x, ok := x.GetRegistryConfig().(*RegistryConfig_NpmConfig); ok { + return x.NpmConfig + } + return nil +} + +func (x *RegistryConfig) GetMavenConfig() *MavenConfig { + if x, ok := x.GetRegistryConfig().(*RegistryConfig_MavenConfig); ok { + return x.MavenConfig + } + return nil +} + +func (x *RegistryConfig) GetSwiftConfig() *SwiftConfig { + if x, ok := x.GetRegistryConfig().(*RegistryConfig_SwiftConfig); ok { + return x.SwiftConfig + } + return nil +} + +func (x *RegistryConfig) GetOptions() []string { + if x != nil { + return x.Options + } + return nil +} + +type isRegistryConfig_RegistryConfig interface { + isRegistryConfig_RegistryConfig() +} + +type RegistryConfig_GoConfig struct { + GoConfig *GoConfig `protobuf:"bytes,1,opt,name=go_config,json=goConfig,proto3,oneof"` +} + +type RegistryConfig_NpmConfig struct { + NpmConfig *NPMConfig `protobuf:"bytes,2,opt,name=npm_config,json=npmConfig,proto3,oneof"` +} + +type RegistryConfig_MavenConfig struct { + MavenConfig *MavenConfig `protobuf:"bytes,3,opt,name=maven_config,json=mavenConfig,proto3,oneof"` +} + +type RegistryConfig_SwiftConfig struct { + SwiftConfig *SwiftConfig `protobuf:"bytes,4,opt,name=swift_config,json=swiftConfig,proto3,oneof"` +} + +func (*RegistryConfig_GoConfig) isRegistryConfig_RegistryConfig() {} + +func (*RegistryConfig_NpmConfig) isRegistryConfig_RegistryConfig() {} + +func (*RegistryConfig_MavenConfig) isRegistryConfig_RegistryConfig() {} + +func (*RegistryConfig_SwiftConfig) isRegistryConfig_RegistryConfig() {} + +type CuratedPluginReference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin, i.e. "library". + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin, i.e. "connect-go". + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Semver-formatted plugin version. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + // The revision for this plugin version. + Revision uint32 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` +} + +func (x *CuratedPluginReference) Reset() { + *x = CuratedPluginReference{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CuratedPluginReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CuratedPluginReference) ProtoMessage() {} + +func (x *CuratedPluginReference) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CuratedPluginReference.ProtoReflect.Descriptor instead. +func (*CuratedPluginReference) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{5} +} + +func (x *CuratedPluginReference) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *CuratedPluginReference) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CuratedPluginReference) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *CuratedPluginReference) GetRevision() uint32 { + if x != nil { + return x.Revision + } + return 0 +} + +// CuratedPlugin represents a protoc plugin curated by Buf, such as protoc-gen-go. +type CuratedPlugin struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the plugin, which uniquely identifies the plugin. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The owner of the plugin, i.e. "library". + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin, i.e. "connect-go". + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + // The optional registry type of the plugin. + RegistryType PluginRegistryType `protobuf:"varint,4,opt,name=registry_type,json=registryType,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginRegistryType" json:"registry_type,omitempty"` + // Semver-formatted plugin version. + Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` + // The full container image digest associated with this plugin version including + // the algorithm. + // Ref: https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests + ContainerImageDigest string `protobuf:"bytes,6,opt,name=container_image_digest,json=containerImageDigest,proto3" json:"container_image_digest,omitempty"` + // The creation time of the plugin. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // List of plugin dependencies. + Dependencies []*CuratedPluginReference `protobuf:"bytes,9,rep,name=dependencies,proto3" json:"dependencies,omitempty"` + // Optionally specify the URL leading to the source code of the plugin, if available. + SourceUrl string `protobuf:"bytes,10,opt,name=source_url,json=sourceUrl,proto3" json:"source_url,omitempty"` + // Optionally specify a brief description of the plugin functionality. + Description string `protobuf:"bytes,11,opt,name=description,proto3" json:"description,omitempty"` + // The configuration for the remote registry of the plugin. + RegistryConfig *RegistryConfig `protobuf:"bytes,12,opt,name=registry_config,json=registryConfig,proto3" json:"registry_config,omitempty"` + // The revision for this plugin version. + Revision uint32 `protobuf:"varint,13,opt,name=revision,proto3" json:"revision,omitempty"` + // The output languages supported by the plugin. + OutputLanguages []PluginLanguage `protobuf:"varint,14,rep,packed,name=output_languages,json=outputLanguages,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginLanguage" json:"output_languages,omitempty"` + // spdx_license_id is the license of the plugin, which should be one of the identifiers + // defined in https://spdx.org/licenses + SpdxLicenseId string `protobuf:"bytes,15,opt,name=spdx_license_id,json=spdxLicenseId,proto3" json:"spdx_license_id,omitempty"` + // license_url specifies an optional URL for the plugin's license (if not using a standard spdx_license_id). + LicenseUrl string `protobuf:"bytes,16,opt,name=license_url,json=licenseUrl,proto3" json:"license_url,omitempty"` + // verified indicates the plugin has been verified. Verification is a property + // of the BSR and cannot be set by end-users. + Verified bool `protobuf:"varint,17,opt,name=verified,proto3" json:"verified,omitempty"` + // Visibility indicates whether the plugin is public or private. + Visibility CuratedPluginVisibility `protobuf:"varint,18,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginVisibility" json:"visibility,omitempty"` + // Deprecated indicates whether the plugin is deprecated. + Deprecated bool `protobuf:"varint,19,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + // Optionally specify a message to be displayed when the plugin is deprecated. + DeprecationMessage string `protobuf:"bytes,20,opt,name=deprecation_message,json=deprecationMessage,proto3" json:"deprecation_message,omitempty"` +} + +func (x *CuratedPlugin) Reset() { + *x = CuratedPlugin{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CuratedPlugin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CuratedPlugin) ProtoMessage() {} + +func (x *CuratedPlugin) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CuratedPlugin.ProtoReflect.Descriptor instead. +func (*CuratedPlugin) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{6} +} + +func (x *CuratedPlugin) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CuratedPlugin) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *CuratedPlugin) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CuratedPlugin) GetRegistryType() PluginRegistryType { + if x != nil { + return x.RegistryType + } + return PluginRegistryType_PLUGIN_REGISTRY_TYPE_UNSPECIFIED +} + +func (x *CuratedPlugin) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *CuratedPlugin) GetContainerImageDigest() string { + if x != nil { + return x.ContainerImageDigest + } + return "" +} + +func (x *CuratedPlugin) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *CuratedPlugin) GetDependencies() []*CuratedPluginReference { + if x != nil { + return x.Dependencies + } + return nil +} + +func (x *CuratedPlugin) GetSourceUrl() string { + if x != nil { + return x.SourceUrl + } + return "" +} + +func (x *CuratedPlugin) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CuratedPlugin) GetRegistryConfig() *RegistryConfig { + if x != nil { + return x.RegistryConfig + } + return nil +} + +func (x *CuratedPlugin) GetRevision() uint32 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *CuratedPlugin) GetOutputLanguages() []PluginLanguage { + if x != nil { + return x.OutputLanguages + } + return nil +} + +func (x *CuratedPlugin) GetSpdxLicenseId() string { + if x != nil { + return x.SpdxLicenseId + } + return "" +} + +func (x *CuratedPlugin) GetLicenseUrl() string { + if x != nil { + return x.LicenseUrl + } + return "" +} + +func (x *CuratedPlugin) GetVerified() bool { + if x != nil { + return x.Verified + } + return false +} + +func (x *CuratedPlugin) GetVisibility() CuratedPluginVisibility { + if x != nil { + return x.Visibility + } + return CuratedPluginVisibility_CURATED_PLUGIN_VISIBILITY_UNSPECIFIED +} + +func (x *CuratedPlugin) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *CuratedPlugin) GetDeprecationMessage() string { + if x != nil { + return x.DeprecationMessage + } + return "" +} + +type GenerateCodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The image to run plugins against to generate the desired file outputs. + // + // All image files that are not imports and not well-known types will be generated. + // If you want to filter what files are generated, modify the image. + // If you want to include imports, set include_imports. + Image *v1.Image `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` + Requests []*PluginGenerationRequest `protobuf:"bytes,2,rep,name=requests,proto3" json:"requests,omitempty"` + // Include imports from the Image in generation. If include_imports is also set + // in one of requests, use the request's value for that plugin. + IncludeImports bool `protobuf:"varint,3,opt,name=include_imports,json=includeImports,proto3" json:"include_imports,omitempty"` + // Include Well-Known Types from the Image in generation. + // + // include_imports must be set if include_well_known_types is set. If include_well_known_types + // is also set in one of requests, use the request's value for that plugin. + IncludeWellKnownTypes bool `protobuf:"varint,4,opt,name=include_well_known_types,json=includeWellKnownTypes,proto3" json:"include_well_known_types,omitempty"` +} + +func (x *GenerateCodeRequest) Reset() { + *x = GenerateCodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateCodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateCodeRequest) ProtoMessage() {} + +func (x *GenerateCodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateCodeRequest.ProtoReflect.Descriptor instead. +func (*GenerateCodeRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{7} +} + +func (x *GenerateCodeRequest) GetImage() *v1.Image { + if x != nil { + return x.Image + } + return nil +} + +func (x *GenerateCodeRequest) GetRequests() []*PluginGenerationRequest { + if x != nil { + return x.Requests + } + return nil +} + +func (x *GenerateCodeRequest) GetIncludeImports() bool { + if x != nil { + return x.IncludeImports + } + return false +} + +func (x *GenerateCodeRequest) GetIncludeWellKnownTypes() bool { + if x != nil { + return x.IncludeWellKnownTypes + } + return false +} + +type GenerateCodeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Responses from each plugin execution. + // The order of each response matches the order in the GenerateCodeRequest. + Responses []*PluginGenerationResponse `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"` +} + +func (x *GenerateCodeResponse) Reset() { + *x = GenerateCodeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateCodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateCodeResponse) ProtoMessage() {} + +func (x *GenerateCodeResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateCodeResponse.ProtoReflect.Descriptor instead. +func (*GenerateCodeResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{8} +} + +func (x *GenerateCodeResponse) GetResponses() []*PluginGenerationResponse { + if x != nil { + return x.Responses + } + return nil +} + +// Request for performing code generation using the specified plugin. +type PluginGenerationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The plugin to execute. + PluginReference *CuratedPluginReference `protobuf:"bytes,1,opt,name=plugin_reference,json=pluginReference,proto3" json:"plugin_reference,omitempty"` + // The options to pass to the plugin. These will + // be merged into a single, comma-separated string. + Options []string `protobuf:"bytes,2,rep,name=options,proto3" json:"options,omitempty"` + // Include imports from the Image in generation. + IncludeImports *bool `protobuf:"varint,3,opt,name=include_imports,json=includeImports,proto3,oneof" json:"include_imports,omitempty"` + // Include Well-Known Types from the Image in generation. + // + // include_imports must be set if include_well_known_types is set. + IncludeWellKnownTypes *bool `protobuf:"varint,4,opt,name=include_well_known_types,json=includeWellKnownTypes,proto3,oneof" json:"include_well_known_types,omitempty"` +} + +func (x *PluginGenerationRequest) Reset() { + *x = PluginGenerationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginGenerationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginGenerationRequest) ProtoMessage() {} + +func (x *PluginGenerationRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PluginGenerationRequest.ProtoReflect.Descriptor instead. +func (*PluginGenerationRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{9} +} + +func (x *PluginGenerationRequest) GetPluginReference() *CuratedPluginReference { + if x != nil { + return x.PluginReference + } + return nil +} + +func (x *PluginGenerationRequest) GetOptions() []string { + if x != nil { + return x.Options + } + return nil +} + +func (x *PluginGenerationRequest) GetIncludeImports() bool { + if x != nil && x.IncludeImports != nil { + return *x.IncludeImports + } + return false +} + +func (x *PluginGenerationRequest) GetIncludeWellKnownTypes() bool { + if x != nil && x.IncludeWellKnownTypes != nil { + return *x.IncludeWellKnownTypes + } + return false +} + +// Response from code generation for a given plugin. +type PluginGenerationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Generated code from the plugin. + Response *pluginpb.CodeGeneratorResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (x *PluginGenerationResponse) Reset() { + *x = PluginGenerationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginGenerationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginGenerationResponse) ProtoMessage() {} + +func (x *PluginGenerationResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PluginGenerationResponse.ProtoReflect.Descriptor instead. +func (*PluginGenerationResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{10} +} + +func (x *PluginGenerationResponse) GetResponse() *pluginpb.CodeGeneratorResponse { + if x != nil { + return x.Response + } + return nil +} + +type DeleteCuratedPluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin to delete. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin to delete. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Version is the plugin version and is optional. If this field is not set then delete all versions, + // otherwise delete only the specified version which includes all revisions. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *DeleteCuratedPluginRequest) Reset() { + *x = DeleteCuratedPluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteCuratedPluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteCuratedPluginRequest) ProtoMessage() {} + +func (x *DeleteCuratedPluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteCuratedPluginRequest.ProtoReflect.Descriptor instead. +func (*DeleteCuratedPluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{11} +} + +func (x *DeleteCuratedPluginRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *DeleteCuratedPluginRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DeleteCuratedPluginRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type DeleteCuratedPluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteCuratedPluginResponse) Reset() { + *x = DeleteCuratedPluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteCuratedPluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteCuratedPluginResponse) ProtoMessage() {} + +func (x *DeleteCuratedPluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteCuratedPluginResponse.ProtoReflect.Descriptor instead. +func (*DeleteCuratedPluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{12} +} + +type CreateCuratedPluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin, i.e. "library". + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin, i.e. "connect-go". + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The optional registry type of the plugin. + RegistryType PluginRegistryType `protobuf:"varint,3,opt,name=registry_type,json=registryType,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginRegistryType" json:"registry_type,omitempty"` + // Semver-formatted plugin version. + Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + // Image Name and Image Digest define a unique plugin image + // Image Digest is like sha256:febcf61cd6e1ac9628f6ac14fa40836d16f3c6ddef3b303ff0321606e55ddd0b + ImageDigest string `protobuf:"bytes,5,opt,name=image_digest,json=imageDigest,proto3" json:"image_digest,omitempty"` + // List of plugin dependencies. + Dependencies []*CuratedPluginReference `protobuf:"bytes,7,rep,name=dependencies,proto3" json:"dependencies,omitempty"` + // The URL leading to the source code of the plugin, if available. + SourceUrl string `protobuf:"bytes,8,opt,name=source_url,json=sourceUrl,proto3" json:"source_url,omitempty"` + // A brief description of the plugin functionality. + Description string `protobuf:"bytes,9,opt,name=description,proto3" json:"description,omitempty"` + // The configuration for the remote registry of the plugin. + RegistryConfig *RegistryConfig `protobuf:"bytes,12,opt,name=registry_config,json=registryConfig,proto3" json:"registry_config,omitempty"` + // The revision for this plugin version. + Revision uint32 `protobuf:"varint,13,opt,name=revision,proto3" json:"revision,omitempty"` + // The output languages supported by the plugin. + OutputLanguages []PluginLanguage `protobuf:"varint,14,rep,packed,name=output_languages,json=outputLanguages,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.PluginLanguage" json:"output_languages,omitempty"` + // spdx_license_id is the license of the plugin, which should be one of the identifiers + // defined in https://spdx.org/licenses + SpdxLicenseId string `protobuf:"bytes,15,opt,name=spdx_license_id,json=spdxLicenseId,proto3" json:"spdx_license_id,omitempty"` + // license_url specifies an optional URL for the plugin's license (if not using a standard spdx_license_id). + LicenseUrl string `protobuf:"bytes,16,opt,name=license_url,json=licenseUrl,proto3" json:"license_url,omitempty"` + // Visibility indicates whether the plugin is public or private. + Visibility CuratedPluginVisibility `protobuf:"varint,17,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginVisibility" json:"visibility,omitempty"` + // Image Name and Image Digest define a unique plugin image + ImageName string `protobuf:"bytes,18,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"` + // Docker Repo Name is define to access user's docker hub + DockerRepoName string `protobuf:"bytes,19,opt,name=docker_repo_name,json=dockerRepoName,proto3" json:"docker_repo_name,omitempty"` +} + +func (x *CreateCuratedPluginRequest) Reset() { + *x = CreateCuratedPluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateCuratedPluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateCuratedPluginRequest) ProtoMessage() {} + +func (x *CreateCuratedPluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateCuratedPluginRequest.ProtoReflect.Descriptor instead. +func (*CreateCuratedPluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{13} +} + +func (x *CreateCuratedPluginRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetRegistryType() PluginRegistryType { + if x != nil { + return x.RegistryType + } + return PluginRegistryType_PLUGIN_REGISTRY_TYPE_UNSPECIFIED +} + +func (x *CreateCuratedPluginRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetImageDigest() string { + if x != nil { + return x.ImageDigest + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetDependencies() []*CuratedPluginReference { + if x != nil { + return x.Dependencies + } + return nil +} + +func (x *CreateCuratedPluginRequest) GetSourceUrl() string { + if x != nil { + return x.SourceUrl + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetRegistryConfig() *RegistryConfig { + if x != nil { + return x.RegistryConfig + } + return nil +} + +func (x *CreateCuratedPluginRequest) GetRevision() uint32 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *CreateCuratedPluginRequest) GetOutputLanguages() []PluginLanguage { + if x != nil { + return x.OutputLanguages + } + return nil +} + +func (x *CreateCuratedPluginRequest) GetSpdxLicenseId() string { + if x != nil { + return x.SpdxLicenseId + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetLicenseUrl() string { + if x != nil { + return x.LicenseUrl + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetVisibility() CuratedPluginVisibility { + if x != nil { + return x.Visibility + } + return CuratedPluginVisibility_CURATED_PLUGIN_VISIBILITY_UNSPECIFIED +} + +func (x *CreateCuratedPluginRequest) GetImageName() string { + if x != nil { + return x.ImageName + } + return "" +} + +func (x *CreateCuratedPluginRequest) GetDockerRepoName() string { + if x != nil { + return x.DockerRepoName + } + return "" +} + +type CreateCuratedPluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The created plugin. + Configuration *CuratedPlugin `protobuf:"bytes,1,opt,name=configuration,proto3" json:"configuration,omitempty"` +} + +func (x *CreateCuratedPluginResponse) Reset() { + *x = CreateCuratedPluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateCuratedPluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateCuratedPluginResponse) ProtoMessage() {} + +func (x *CreateCuratedPluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateCuratedPluginResponse.ProtoReflect.Descriptor instead. +func (*CreateCuratedPluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{14} +} + +func (x *CreateCuratedPluginResponse) GetConfiguration() *CuratedPlugin { + if x != nil { + return x.Configuration + } + return nil +} + +type ListCuratedPluginsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` + // If true, will only return plugins which support remote packages (registry_type is set). + SupportsRemotePackages bool `protobuf:"varint,4,opt,name=supports_remote_packages,json=supportsRemotePackages,proto3" json:"supports_remote_packages,omitempty"` + // If true, will include deprecated plugins. + IncludeDeprecated bool `protobuf:"varint,5,opt,name=include_deprecated,json=includeDeprecated,proto3" json:"include_deprecated,omitempty"` +} + +func (x *ListCuratedPluginsRequest) Reset() { + *x = ListCuratedPluginsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListCuratedPluginsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCuratedPluginsRequest) ProtoMessage() {} + +func (x *ListCuratedPluginsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListCuratedPluginsRequest.ProtoReflect.Descriptor instead. +func (*ListCuratedPluginsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{15} +} + +func (x *ListCuratedPluginsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListCuratedPluginsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListCuratedPluginsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +func (x *ListCuratedPluginsRequest) GetSupportsRemotePackages() bool { + if x != nil { + return x.SupportsRemotePackages + } + return false +} + +func (x *ListCuratedPluginsRequest) GetIncludeDeprecated() bool { + if x != nil { + return x.IncludeDeprecated + } + return false +} + +type ListCuratedPluginsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Plugins []*CuratedPlugin `protobuf:"bytes,1,rep,name=plugins,proto3" json:"plugins,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListCuratedPluginsResponse) Reset() { + *x = ListCuratedPluginsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListCuratedPluginsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCuratedPluginsResponse) ProtoMessage() {} + +func (x *ListCuratedPluginsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListCuratedPluginsResponse.ProtoReflect.Descriptor instead. +func (*ListCuratedPluginsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{16} +} + +func (x *ListCuratedPluginsResponse) GetPlugins() []*CuratedPlugin { + if x != nil { + return x.Plugins + } + return nil +} + +func (x *ListCuratedPluginsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type GetLatestCuratedPluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin, i.e. "library". + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin, i.e. "connect-go". + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Both version (semver-formatted) and revision are optional, which means + // return the latest plugin. + // If version is set, but revision is omitted, then return the latest + // revision for that version. + // If version and revision are both set, return specific plugin. + // It is an error to set a revision without a corresponding version. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Revision uint32 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + // If true, will only return versions (and revisions) which support remote packages (registry_type is set). + SupportsRemotePackages bool `protobuf:"varint,5,opt,name=supports_remote_packages,json=supportsRemotePackages,proto3" json:"supports_remote_packages,omitempty"` +} + +func (x *GetLatestCuratedPluginRequest) Reset() { + *x = GetLatestCuratedPluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetLatestCuratedPluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLatestCuratedPluginRequest) ProtoMessage() {} + +func (x *GetLatestCuratedPluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLatestCuratedPluginRequest.ProtoReflect.Descriptor instead. +func (*GetLatestCuratedPluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{17} +} + +func (x *GetLatestCuratedPluginRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetLatestCuratedPluginRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetLatestCuratedPluginRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *GetLatestCuratedPluginRequest) GetRevision() uint32 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *GetLatestCuratedPluginRequest) GetSupportsRemotePackages() bool { + if x != nil { + return x.SupportsRemotePackages + } + return false +} + +type GetLatestCuratedPluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Plugin *CuratedPlugin `protobuf:"bytes,1,opt,name=plugin,proto3" json:"plugin,omitempty"` + // versions is a semver-sorted list in descending order. + Versions []*CuratedPluginVersionRevisions `protobuf:"bytes,2,rep,name=versions,proto3" json:"versions,omitempty"` +} + +func (x *GetLatestCuratedPluginResponse) Reset() { + *x = GetLatestCuratedPluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetLatestCuratedPluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLatestCuratedPluginResponse) ProtoMessage() {} + +func (x *GetLatestCuratedPluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLatestCuratedPluginResponse.ProtoReflect.Descriptor instead. +func (*GetLatestCuratedPluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{18} +} + +func (x *GetLatestCuratedPluginResponse) GetPlugin() *CuratedPlugin { + if x != nil { + return x.Plugin + } + return nil +} + +func (x *GetLatestCuratedPluginResponse) GetVersions() []*CuratedPluginVersionRevisions { + if x != nil { + return x.Versions + } + return nil +} + +type CuratedPluginVersionRevisions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // revisions is a sorted list in descending order. + Revisions []uint32 `protobuf:"varint,2,rep,packed,name=revisions,proto3" json:"revisions,omitempty"` +} + +func (x *CuratedPluginVersionRevisions) Reset() { + *x = CuratedPluginVersionRevisions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CuratedPluginVersionRevisions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CuratedPluginVersionRevisions) ProtoMessage() {} + +func (x *CuratedPluginVersionRevisions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CuratedPluginVersionRevisions.ProtoReflect.Descriptor instead. +func (*CuratedPluginVersionRevisions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{19} +} + +func (x *CuratedPluginVersionRevisions) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *CuratedPluginVersionRevisions) GetRevisions() []uint32 { + if x != nil { + return x.Revisions + } + return nil +} + +// RuntimeLibrary describes the runtime library dependency of the generated code. +type GoConfig_RuntimeLibrary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the runtime library module, i.e. "google.golang.org/protobuf". + Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` + // The version of the runtime library, i.e. "v1.27.1". + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GoConfig_RuntimeLibrary) Reset() { + *x = GoConfig_RuntimeLibrary{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GoConfig_RuntimeLibrary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GoConfig_RuntimeLibrary) ProtoMessage() {} + +func (x *GoConfig_RuntimeLibrary) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GoConfig_RuntimeLibrary.ProtoReflect.Descriptor instead. +func (*GoConfig_RuntimeLibrary) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *GoConfig_RuntimeLibrary) GetModule() string { + if x != nil { + return x.Module + } + return "" +} + +func (x *GoConfig_RuntimeLibrary) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +// RuntimeLibrary describes the runtime library dependency of the generated code. +type NPMConfig_RuntimeLibrary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the runtime library package, i.e. "@grpc/grpc-js". + Package string `protobuf:"bytes,1,opt,name=package,proto3" json:"package,omitempty"` + // The version of the runtime library, i.e. "^1.27.1". + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *NPMConfig_RuntimeLibrary) Reset() { + *x = NPMConfig_RuntimeLibrary{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NPMConfig_RuntimeLibrary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NPMConfig_RuntimeLibrary) ProtoMessage() {} + +func (x *NPMConfig_RuntimeLibrary) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NPMConfig_RuntimeLibrary.ProtoReflect.Descriptor instead. +func (*NPMConfig_RuntimeLibrary) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *NPMConfig_RuntimeLibrary) GetPackage() string { + if x != nil { + return x.Package + } + return "" +} + +func (x *NPMConfig_RuntimeLibrary) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +// RuntimeLibrary describes a runtime dependency of the generated code. +type MavenConfig_RuntimeLibrary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + ArtifactId string `protobuf:"bytes,2,opt,name=artifact_id,json=artifactId,proto3" json:"artifact_id,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Classifier string `protobuf:"bytes,4,opt,name=classifier,proto3" json:"classifier,omitempty"` + Extension string `protobuf:"bytes,5,opt,name=extension,proto3" json:"extension,omitempty"` +} + +func (x *MavenConfig_RuntimeLibrary) Reset() { + *x = MavenConfig_RuntimeLibrary{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MavenConfig_RuntimeLibrary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MavenConfig_RuntimeLibrary) ProtoMessage() {} + +func (x *MavenConfig_RuntimeLibrary) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MavenConfig_RuntimeLibrary.ProtoReflect.Descriptor instead. +func (*MavenConfig_RuntimeLibrary) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *MavenConfig_RuntimeLibrary) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *MavenConfig_RuntimeLibrary) GetArtifactId() string { + if x != nil { + return x.ArtifactId + } + return "" +} + +func (x *MavenConfig_RuntimeLibrary) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *MavenConfig_RuntimeLibrary) GetClassifier() string { + if x != nil { + return x.Classifier + } + return "" +} + +func (x *MavenConfig_RuntimeLibrary) GetExtension() string { + if x != nil { + return x.Extension + } + return "" +} + +// CompilerConfig contains configuration for the Java and/or Kotlin compiler used when compiling the generated code. +type MavenConfig_CompilerConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Java *MavenConfig_CompilerJavaConfig `protobuf:"bytes,1,opt,name=java,proto3" json:"java,omitempty"` + Kotlin *MavenConfig_CompilerKotlinConfig `protobuf:"bytes,2,opt,name=kotlin,proto3" json:"kotlin,omitempty"` +} + +func (x *MavenConfig_CompilerConfig) Reset() { + *x = MavenConfig_CompilerConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MavenConfig_CompilerConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MavenConfig_CompilerConfig) ProtoMessage() {} + +func (x *MavenConfig_CompilerConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MavenConfig_CompilerConfig.ProtoReflect.Descriptor instead. +func (*MavenConfig_CompilerConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *MavenConfig_CompilerConfig) GetJava() *MavenConfig_CompilerJavaConfig { + if x != nil { + return x.Java + } + return nil +} + +func (x *MavenConfig_CompilerConfig) GetKotlin() *MavenConfig_CompilerKotlinConfig { + if x != nil { + return x.Kotlin + } + return nil +} + +// CompilerJavaConfig contains settings for the Java compiler. +type MavenConfig_CompilerJavaConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // File encoding (default: UTF-8). + Encoding string `protobuf:"bytes,1,opt,name=encoding,proto3" json:"encoding,omitempty"` + // Release version (default: 8). + Release int32 `protobuf:"varint,2,opt,name=release,proto3" json:"release,omitempty"` + // Source version (default: 8). + Source int32 `protobuf:"varint,3,opt,name=source,proto3" json:"source,omitempty"` + // Target version (default: 8). + Target int32 `protobuf:"varint,4,opt,name=target,proto3" json:"target,omitempty"` +} + +func (x *MavenConfig_CompilerJavaConfig) Reset() { + *x = MavenConfig_CompilerJavaConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MavenConfig_CompilerJavaConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MavenConfig_CompilerJavaConfig) ProtoMessage() {} + +func (x *MavenConfig_CompilerJavaConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MavenConfig_CompilerJavaConfig.ProtoReflect.Descriptor instead. +func (*MavenConfig_CompilerJavaConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{2, 2} +} + +func (x *MavenConfig_CompilerJavaConfig) GetEncoding() string { + if x != nil { + return x.Encoding + } + return "" +} + +func (x *MavenConfig_CompilerJavaConfig) GetRelease() int32 { + if x != nil { + return x.Release + } + return 0 +} + +func (x *MavenConfig_CompilerJavaConfig) GetSource() int32 { + if x != nil { + return x.Source + } + return 0 +} + +func (x *MavenConfig_CompilerJavaConfig) GetTarget() int32 { + if x != nil { + return x.Target + } + return 0 +} + +// CompilerKotlinConfig contains settings for the Kotlin compiler. +type MavenConfig_CompilerKotlinConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Version of the Kotlin compiler used to compile the generated code. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // Version of the Kotlin API to target. + ApiVersion string `protobuf:"bytes,2,opt,name=api_version,json=apiVersion,proto3" json:"api_version,omitempty"` + // Target version of the JVM bytecode (default: 1.8). + JvmTarget string `protobuf:"bytes,3,opt,name=jvm_target,json=jvmTarget,proto3" json:"jvm_target,omitempty"` + // Kotlin language version used for source compatibility. + LanguageVersion string `protobuf:"bytes,4,opt,name=language_version,json=languageVersion,proto3" json:"language_version,omitempty"` +} + +func (x *MavenConfig_CompilerKotlinConfig) Reset() { + *x = MavenConfig_CompilerKotlinConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MavenConfig_CompilerKotlinConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MavenConfig_CompilerKotlinConfig) ProtoMessage() {} + +func (x *MavenConfig_CompilerKotlinConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MavenConfig_CompilerKotlinConfig.ProtoReflect.Descriptor instead. +func (*MavenConfig_CompilerKotlinConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{2, 3} +} + +func (x *MavenConfig_CompilerKotlinConfig) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *MavenConfig_CompilerKotlinConfig) GetApiVersion() string { + if x != nil { + return x.ApiVersion + } + return "" +} + +func (x *MavenConfig_CompilerKotlinConfig) GetJvmTarget() string { + if x != nil { + return x.JvmTarget + } + return "" +} + +func (x *MavenConfig_CompilerKotlinConfig) GetLanguageVersion() string { + if x != nil { + return x.LanguageVersion + } + return "" +} + +// RuntimeConfig allows configuring additional runtimes (like the 'lite' runtime). +// They can use different runtime dependencies and plugin options. +type MavenConfig_RuntimeConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + RuntimeLibraries []*MavenConfig_RuntimeLibrary `protobuf:"bytes,2,rep,name=runtime_libraries,json=runtimeLibraries,proto3" json:"runtime_libraries,omitempty"` + // The options to pass to the plugin. These will + // be merged into a single, comma-separated string. + Options []string `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"` +} + +func (x *MavenConfig_RuntimeConfig) Reset() { + *x = MavenConfig_RuntimeConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MavenConfig_RuntimeConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MavenConfig_RuntimeConfig) ProtoMessage() {} + +func (x *MavenConfig_RuntimeConfig) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MavenConfig_RuntimeConfig.ProtoReflect.Descriptor instead. +func (*MavenConfig_RuntimeConfig) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{2, 4} +} + +func (x *MavenConfig_RuntimeConfig) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MavenConfig_RuntimeConfig) GetRuntimeLibraries() []*MavenConfig_RuntimeLibrary { + if x != nil { + return x.RuntimeLibraries + } + return nil +} + +func (x *MavenConfig_RuntimeConfig) GetOptions() []string { + if x != nil { + return x.Options + } + return nil +} + +// RuntimeLibrary describes a runtime library dependency of the generated code. +type SwiftConfig_RuntimeLibrary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The source of the runtime library package, e.g. https://github.com/apple/swift-protobuf.git. + Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + // The name of the runtime library package, e.g. "swift-protobuf". + Package string `protobuf:"bytes,2,opt,name=package,proto3" json:"package,omitempty"` + // The version of the runtime library, e.g. "1.21.0". + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + // The products exported by the runtime library, e.g. "SwiftProtobuf". + Products []string `protobuf:"bytes,4,rep,name=products,proto3" json:"products,omitempty"` + // The minimum compatible platform versions of the runtime library. + Platforms []*SwiftConfig_RuntimeLibrary_Platform `protobuf:"bytes,5,rep,name=platforms,proto3" json:"platforms,omitempty"` + // The supported Swift language versions of the runtime library, e.g. ".v5". + SwiftVersions []string `protobuf:"bytes,6,rep,name=swift_versions,json=swiftVersions,proto3" json:"swift_versions,omitempty"` +} + +func (x *SwiftConfig_RuntimeLibrary) Reset() { + *x = SwiftConfig_RuntimeLibrary{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SwiftConfig_RuntimeLibrary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SwiftConfig_RuntimeLibrary) ProtoMessage() {} + +func (x *SwiftConfig_RuntimeLibrary) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SwiftConfig_RuntimeLibrary.ProtoReflect.Descriptor instead. +func (*SwiftConfig_RuntimeLibrary) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *SwiftConfig_RuntimeLibrary) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *SwiftConfig_RuntimeLibrary) GetPackage() string { + if x != nil { + return x.Package + } + return "" +} + +func (x *SwiftConfig_RuntimeLibrary) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *SwiftConfig_RuntimeLibrary) GetProducts() []string { + if x != nil { + return x.Products + } + return nil +} + +func (x *SwiftConfig_RuntimeLibrary) GetPlatforms() []*SwiftConfig_RuntimeLibrary_Platform { + if x != nil { + return x.Platforms + } + return nil +} + +func (x *SwiftConfig_RuntimeLibrary) GetSwiftVersions() []string { + if x != nil { + return x.SwiftVersions + } + return nil +} + +// The minimum compatible platform versions of the runtime library. +type SwiftConfig_RuntimeLibrary_Platform struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the platform. + Name SwiftPlatformType `protobuf:"varint,1,opt,name=name,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.SwiftPlatformType" json:"name,omitempty"` + // The minimum compatible version of the platform. + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *SwiftConfig_RuntimeLibrary_Platform) Reset() { + *x = SwiftConfig_RuntimeLibrary_Platform{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SwiftConfig_RuntimeLibrary_Platform) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SwiftConfig_RuntimeLibrary_Platform) ProtoMessage() {} + +func (x *SwiftConfig_RuntimeLibrary_Platform) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_plugin_curation_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SwiftConfig_RuntimeLibrary_Platform.ProtoReflect.Descriptor instead. +func (*SwiftConfig_RuntimeLibrary_Platform) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP(), []int{3, 0, 0} +} + +func (x *SwiftConfig_RuntimeLibrary_Platform) GetName() SwiftPlatformType { + if x != nil { + return x.Name + } + return SwiftPlatformType_SWIFT_PLATFORM_TYPE_UNSPECIFIED +} + +func (x *SwiftConfig_RuntimeLibrary_Platform) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +var File_registry_v1alpha1_plugin_curation_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_plugin_curation_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x63, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x1a, 0x14, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x63, 0x6f, 0x6d, 0x70, + 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xe8, 0x01, 0x0a, 0x08, 0x47, 0x6f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x6f, 0x0a, 0x11, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x6f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, + 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x10, + 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, + 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, + 0x75, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x42, 0x0a, 0x0e, 0x52, 0x75, 0x6e, + 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xde, 0x02, + 0x0a, 0x09, 0x4e, 0x50, 0x4d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x70, 0x0a, 0x11, 0x72, + 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4e, 0x50, 0x4d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, 0x75, 0x6e, + 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x10, 0x72, 0x75, 0x6e, + 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3b, 0x0a, + 0x1a, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, + 0x70, 0x61, 0x74, 0x68, 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x17, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x50, 0x61, 0x74, 0x68, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x5c, 0x0a, 0x0c, 0x69, 0x6d, + 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4e, 0x50, 0x4d, + 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x52, 0x0b, 0x69, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x1a, 0x44, 0x0a, 0x0e, 0x52, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, + 0x09, 0x0a, 0x0b, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x72, + 0x0a, 0x11, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x52, 0x10, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, + 0x65, 0x73, 0x12, 0x61, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x72, 0x12, 0x75, 0x0a, 0x13, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, + 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, + 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x12, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x61, 0x6c, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x1a, 0xa4, 0x01, 0x0a, + 0x0e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, + 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x72, + 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x1a, 0xd4, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x5d, 0x0a, 0x04, 0x6a, 0x61, 0x76, 0x61, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x72, 0x4a, 0x61, 0x76, 0x61, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, + 0x04, 0x6a, 0x61, 0x76, 0x61, 0x12, 0x63, 0x0a, 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, + 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x4b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x1a, 0x7a, 0x0a, 0x12, 0x43, 0x6f, + 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x4a, 0x61, 0x76, 0x61, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, + 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x1a, 0x9b, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x70, 0x69, + 0x6c, 0x65, 0x72, 0x4b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x6a, 0x76, + 0x6d, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6a, 0x76, 0x6d, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x61, 0x6e, + 0x67, 0x75, 0x61, 0x67, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0xb1, 0x01, 0x0a, 0x0d, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x72, 0x0a, 0x11, 0x72, 0x75, + 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, 0x75, + 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x10, 0x72, 0x75, + 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x18, + 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x04, 0x0a, 0x0b, 0x53, 0x77, 0x69, + 0x66, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x72, 0x0a, 0x11, 0x72, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x53, 0x77, 0x69, 0x66, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x10, 0x72, 0x75, 0x6e, 0x74, + 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x85, 0x03, 0x0a, + 0x0e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x12, 0x6c, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x74, 0x66, + 0x6f, 0x72, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4e, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x77, 0x69, 0x66, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x09, 0x70, 0x6c, 0x61, 0x74, + 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x73, + 0x77, 0x69, 0x66, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x76, 0x0a, 0x08, + 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x50, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x53, 0x77, 0x69, 0x66, 0x74, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa8, 0x03, 0x0a, 0x0e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x52, 0x0a, 0x09, 0x67, 0x6f, 0x5f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x6f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, + 0x00, 0x52, 0x08, 0x67, 0x6f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x55, 0x0a, 0x0a, 0x6e, + 0x70, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x34, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4e, 0x50, 0x4d, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x70, 0x6d, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x5b, 0x0a, 0x0c, 0x6d, 0x61, 0x76, 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x48, 0x00, 0x52, 0x0b, 0x6d, 0x61, 0x76, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x5b, 0x0a, 0x0c, 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x53, 0x77, 0x69, 0x66, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, + 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x11, 0x0a, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x0a, 0x22, + 0x78, 0x0a, 0x16, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, + 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe2, 0x07, 0x0a, 0x0d, 0x43, 0x75, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x6d, + 0x61, 0x67, 0x65, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x65, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, + 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, + 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x62, + 0x0a, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x64, + 0x0a, 0x10, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, + 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4c, 0x61, 0x6e, 0x67, 0x75, + 0x61, 0x67, 0x65, 0x52, 0x0f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4c, 0x61, 0x6e, 0x67, 0x75, + 0x61, 0x67, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x73, 0x70, 0x64, 0x78, 0x5f, 0x6c, 0x69, 0x63, + 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, + 0x70, 0x64, 0x78, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, + 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, + 0x08, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x62, 0x0a, 0x0a, 0x76, 0x69, 0x73, + 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x42, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1e, 0x0a, + 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2f, 0x0a, + 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x64, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x96, + 0x02, 0x0a, 0x13, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x05, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x5e, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, + 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, + 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x37, + 0x0a, 0x18, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, + 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x79, 0x0a, 0x14, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x61, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x73, 0x22, 0xbe, 0x02, 0x0a, 0x17, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x6c, + 0x0a, 0x10, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, + 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x48, + 0x00, 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x73, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x18, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, + 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, + 0x65, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x88, + 0x01, 0x01, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x69, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x42, 0x1b, 0x0a, 0x19, 0x5f, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x5f, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x22, 0x67, 0x0a, 0x18, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4b, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x64, + 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x60, 0x0a, 0x1a, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x1d, + 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xeb, 0x06, + 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x69, + 0x67, 0x65, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x65, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, + 0x52, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x12, 0x1d, + 0x0a, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x62, 0x0a, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x64, 0x0a, 0x10, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, + 0x67, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4c, 0x61, 0x6e, 0x67, + 0x75, 0x61, 0x67, 0x65, 0x52, 0x0f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4c, 0x61, 0x6e, 0x67, + 0x75, 0x61, 0x67, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x73, 0x70, 0x64, 0x78, 0x5f, 0x6c, 0x69, + 0x63, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x73, 0x70, 0x64, 0x78, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, + 0x0b, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x10, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x62, + 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, + 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x69, 0x73, 0x69, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x28, 0x0a, 0x10, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x70, 0x6f, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x6f, 0x63, + 0x6b, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x7d, 0x0a, 0x1b, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0d, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xda, 0x01, 0x0a, 0x19, 0x4c, + 0x69, 0x73, 0x74, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x38, + 0x0a, 0x18, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x74, + 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x16, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x69, 0x6e, 0x63, 0x6c, + 0x75, 0x64, 0x65, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x44, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0x98, 0x01, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, + 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x52, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0xb9, 0x01, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, + 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, 0xd8, + 0x01, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x75, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x50, 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x06, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x12, 0x64, 0x0a, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x57, 0x0a, 0x1d, 0x43, 0x75, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x2a, 0x91, 0x01, 0x0a, 0x17, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x29, + 0x0a, 0x25, 0x43, 0x55, 0x52, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, + 0x5f, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x43, 0x55, 0x52, + 0x41, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x56, 0x49, 0x53, 0x49, + 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x01, 0x12, + 0x25, 0x0a, 0x21, 0x43, 0x55, 0x52, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, + 0x4e, 0x5f, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52, 0x49, + 0x56, 0x41, 0x54, 0x45, 0x10, 0x02, 0x2a, 0xb5, 0x01, 0x0a, 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, + 0x20, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x52, 0x59, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x45, + 0x47, 0x49, 0x53, 0x54, 0x52, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x4f, 0x10, 0x01, + 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x53, + 0x54, 0x52, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x50, 0x4d, 0x10, 0x02, 0x12, 0x1e, + 0x0a, 0x1a, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x52, + 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x56, 0x45, 0x4e, 0x10, 0x03, 0x12, 0x1e, + 0x0a, 0x1a, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x52, + 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x57, 0x49, 0x46, 0x54, 0x10, 0x04, 0x2a, 0xce, + 0x03, 0x0a, 0x0e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, + 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, + 0x55, 0x41, 0x47, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, + 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x47, 0x4f, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x50, 0x4c, + 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x4a, 0x41, + 0x56, 0x41, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x50, 0x4c, + 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x50, 0x4c, + 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x57, + 0x49, 0x46, 0x54, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, + 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x43, 0x50, 0x50, 0x10, 0x05, 0x12, 0x18, + 0x0a, 0x14, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, + 0x45, 0x5f, 0x4a, 0x41, 0x56, 0x41, 0x10, 0x06, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x4c, 0x55, 0x47, + 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x44, 0x41, 0x52, 0x54, + 0x10, 0x07, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, + 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x52, 0x55, 0x53, 0x54, 0x10, 0x08, 0x12, 0x1a, 0x0a, 0x16, + 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, + 0x50, 0x59, 0x54, 0x48, 0x4f, 0x4e, 0x10, 0x09, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x4c, 0x55, 0x47, + 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x52, 0x55, 0x42, 0x59, + 0x10, 0x0a, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, + 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x4b, 0x4f, 0x54, 0x4c, 0x49, 0x4e, 0x10, 0x0b, 0x12, 0x1f, + 0x0a, 0x1b, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, + 0x45, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x43, 0x10, 0x0c, 0x12, + 0x17, 0x0a, 0x13, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, + 0x47, 0x45, 0x5f, 0x50, 0x48, 0x50, 0x10, 0x0d, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x4c, 0x55, 0x47, + 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x43, 0x53, 0x48, 0x41, + 0x52, 0x50, 0x10, 0x0e, 0x12, 0x19, 0x0a, 0x15, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x4c, + 0x41, 0x4e, 0x47, 0x55, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x43, 0x41, 0x4c, 0x41, 0x10, 0x0f, 0x2a, + 0x6e, 0x0a, 0x0e, 0x4e, 0x50, 0x4d, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x79, 0x6c, + 0x65, 0x12, 0x20, 0x0a, 0x1c, 0x4e, 0x50, 0x4d, 0x5f, 0x49, 0x4d, 0x50, 0x4f, 0x52, 0x54, 0x5f, + 0x53, 0x54, 0x59, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x50, 0x4d, 0x5f, 0x49, 0x4d, 0x50, 0x4f, 0x52, + 0x54, 0x5f, 0x53, 0x54, 0x59, 0x4c, 0x45, 0x5f, 0x4d, 0x4f, 0x44, 0x55, 0x4c, 0x45, 0x10, 0x01, + 0x12, 0x1d, 0x0a, 0x19, 0x4e, 0x50, 0x4d, 0x5f, 0x49, 0x4d, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x53, + 0x54, 0x59, 0x4c, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x4a, 0x53, 0x10, 0x02, 0x2a, + 0xb3, 0x01, 0x0a, 0x11, 0x53, 0x77, 0x69, 0x66, 0x74, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, + 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x23, 0x0a, 0x1f, 0x53, 0x57, 0x49, 0x46, 0x54, 0x5f, 0x50, + 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x57, + 0x49, 0x46, 0x54, 0x5f, 0x50, 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x4d, 0x41, 0x43, 0x4f, 0x53, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x57, 0x49, + 0x46, 0x54, 0x5f, 0x50, 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x49, 0x4f, 0x53, 0x10, 0x02, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x57, 0x49, 0x46, 0x54, 0x5f, + 0x50, 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x57, 0x41, + 0x54, 0x43, 0x48, 0x4f, 0x53, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x57, 0x49, 0x46, 0x54, + 0x5f, 0x50, 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, + 0x56, 0x4f, 0x53, 0x10, 0x04, 0x32, 0xcd, 0x05, 0x0a, 0x15, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x43, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0xa6, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x75, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa9, 0x01, 0x0a, 0x13, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x03, 0x90, 0x02, 0x02, 0x12, 0xb2, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, + 0x73, 0x74, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, + 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, + 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, + 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa9, 0x01, 0x0a, 0x13, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, + 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x02, 0x32, 0xa9, 0x01, 0x0a, 0x15, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x8f, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, + 0x12, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0xee, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x42, 0x13, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, + 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, + 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_plugin_curation_proto_rawDescOnce sync.Once + file_registry_v1alpha1_plugin_curation_proto_rawDescData = file_registry_v1alpha1_plugin_curation_proto_rawDesc +) + +func file_registry_v1alpha1_plugin_curation_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_plugin_curation_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_plugin_curation_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_plugin_curation_proto_rawDescData) + }) + return file_registry_v1alpha1_plugin_curation_proto_rawDescData +} + +var file_registry_v1alpha1_plugin_curation_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_registry_v1alpha1_plugin_curation_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_registry_v1alpha1_plugin_curation_proto_goTypes = []interface{}{ + (CuratedPluginVisibility)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginVisibility + (PluginRegistryType)(0), // 1: bufman.dubbo.apache.org.registry.v1alpha1.PluginRegistryType + (PluginLanguage)(0), // 2: bufman.dubbo.apache.org.registry.v1alpha1.PluginLanguage + (NPMImportStyle)(0), // 3: bufman.dubbo.apache.org.registry.v1alpha1.NPMImportStyle + (SwiftPlatformType)(0), // 4: bufman.dubbo.apache.org.registry.v1alpha1.SwiftPlatformType + (*GoConfig)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.GoConfig + (*NPMConfig)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.NPMConfig + (*MavenConfig)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig + (*SwiftConfig)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig + (*RegistryConfig)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.RegistryConfig + (*CuratedPluginReference)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginReference + (*CuratedPlugin)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin + (*GenerateCodeRequest)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.GenerateCodeRequest + (*GenerateCodeResponse)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.GenerateCodeResponse + (*PluginGenerationRequest)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.PluginGenerationRequest + (*PluginGenerationResponse)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.PluginGenerationResponse + (*DeleteCuratedPluginRequest)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.DeleteCuratedPluginRequest + (*DeleteCuratedPluginResponse)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.DeleteCuratedPluginResponse + (*CreateCuratedPluginRequest)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginRequest + (*CreateCuratedPluginResponse)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginResponse + (*ListCuratedPluginsRequest)(nil), // 20: bufman.dubbo.apache.org.registry.v1alpha1.ListCuratedPluginsRequest + (*ListCuratedPluginsResponse)(nil), // 21: bufman.dubbo.apache.org.registry.v1alpha1.ListCuratedPluginsResponse + (*GetLatestCuratedPluginRequest)(nil), // 22: bufman.dubbo.apache.org.registry.v1alpha1.GetLatestCuratedPluginRequest + (*GetLatestCuratedPluginResponse)(nil), // 23: bufman.dubbo.apache.org.registry.v1alpha1.GetLatestCuratedPluginResponse + (*CuratedPluginVersionRevisions)(nil), // 24: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginVersionRevisions + (*GoConfig_RuntimeLibrary)(nil), // 25: bufman.dubbo.apache.org.registry.v1alpha1.GoConfig.RuntimeLibrary + (*NPMConfig_RuntimeLibrary)(nil), // 26: bufman.dubbo.apache.org.registry.v1alpha1.NPMConfig.RuntimeLibrary + (*MavenConfig_RuntimeLibrary)(nil), // 27: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.RuntimeLibrary + (*MavenConfig_CompilerConfig)(nil), // 28: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.CompilerConfig + (*MavenConfig_CompilerJavaConfig)(nil), // 29: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.CompilerJavaConfig + (*MavenConfig_CompilerKotlinConfig)(nil), // 30: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.CompilerKotlinConfig + (*MavenConfig_RuntimeConfig)(nil), // 31: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.RuntimeConfig + (*SwiftConfig_RuntimeLibrary)(nil), // 32: bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig.RuntimeLibrary + (*SwiftConfig_RuntimeLibrary_Platform)(nil), // 33: bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig.RuntimeLibrary.Platform + (*timestamppb.Timestamp)(nil), // 34: google.protobuf.Timestamp + (*v1.Image)(nil), // 35: bufman.dubbo.apache.org.image.v1.Image + (*pluginpb.CodeGeneratorResponse)(nil), // 36: google.protobuf.compiler.CodeGeneratorResponse +} +var file_registry_v1alpha1_plugin_curation_proto_depIdxs = []int32{ + 25, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GoConfig.runtime_libraries:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GoConfig.RuntimeLibrary + 26, // 1: bufman.dubbo.apache.org.registry.v1alpha1.NPMConfig.runtime_libraries:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.NPMConfig.RuntimeLibrary + 3, // 2: bufman.dubbo.apache.org.registry.v1alpha1.NPMConfig.import_style:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.NPMImportStyle + 27, // 3: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.runtime_libraries:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.RuntimeLibrary + 28, // 4: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.compiler:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.CompilerConfig + 31, // 5: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.additional_runtimes:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.RuntimeConfig + 32, // 6: bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig.runtime_libraries:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig.RuntimeLibrary + 5, // 7: bufman.dubbo.apache.org.registry.v1alpha1.RegistryConfig.go_config:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GoConfig + 6, // 8: bufman.dubbo.apache.org.registry.v1alpha1.RegistryConfig.npm_config:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.NPMConfig + 7, // 9: bufman.dubbo.apache.org.registry.v1alpha1.RegistryConfig.maven_config:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig + 8, // 10: bufman.dubbo.apache.org.registry.v1alpha1.RegistryConfig.swift_config:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig + 1, // 11: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin.registry_type:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginRegistryType + 34, // 12: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin.create_time:type_name -> google.protobuf.Timestamp + 10, // 13: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin.dependencies:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginReference + 9, // 14: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin.registry_config:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RegistryConfig + 2, // 15: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin.output_languages:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginLanguage + 0, // 16: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginVisibility + 35, // 17: bufman.dubbo.apache.org.registry.v1alpha1.GenerateCodeRequest.image:type_name -> bufman.dubbo.apache.org.image.v1.Image + 14, // 18: bufman.dubbo.apache.org.registry.v1alpha1.GenerateCodeRequest.requests:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginGenerationRequest + 15, // 19: bufman.dubbo.apache.org.registry.v1alpha1.GenerateCodeResponse.responses:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginGenerationResponse + 10, // 20: bufman.dubbo.apache.org.registry.v1alpha1.PluginGenerationRequest.plugin_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginReference + 36, // 21: bufman.dubbo.apache.org.registry.v1alpha1.PluginGenerationResponse.response:type_name -> google.protobuf.compiler.CodeGeneratorResponse + 1, // 22: bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginRequest.registry_type:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginRegistryType + 10, // 23: bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginRequest.dependencies:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginReference + 9, // 24: bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginRequest.registry_config:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RegistryConfig + 2, // 25: bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginRequest.output_languages:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.PluginLanguage + 0, // 26: bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginRequest.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginVisibility + 11, // 27: bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginResponse.configuration:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin + 11, // 28: bufman.dubbo.apache.org.registry.v1alpha1.ListCuratedPluginsResponse.plugins:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin + 11, // 29: bufman.dubbo.apache.org.registry.v1alpha1.GetLatestCuratedPluginResponse.plugin:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin + 24, // 30: bufman.dubbo.apache.org.registry.v1alpha1.GetLatestCuratedPluginResponse.versions:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginVersionRevisions + 29, // 31: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.CompilerConfig.java:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.CompilerJavaConfig + 30, // 32: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.CompilerConfig.kotlin:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.CompilerKotlinConfig + 27, // 33: bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.RuntimeConfig.runtime_libraries:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.MavenConfig.RuntimeLibrary + 33, // 34: bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig.RuntimeLibrary.platforms:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig.RuntimeLibrary.Platform + 4, // 35: bufman.dubbo.apache.org.registry.v1alpha1.SwiftConfig.RuntimeLibrary.Platform.name:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.SwiftPlatformType + 20, // 36: bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.ListCuratedPlugins:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListCuratedPluginsRequest + 18, // 37: bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.CreateCuratedPlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginRequest + 22, // 38: bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.GetLatestCuratedPlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetLatestCuratedPluginRequest + 16, // 39: bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.DeleteCuratedPlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteCuratedPluginRequest + 12, // 40: bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService.GenerateCode:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GenerateCodeRequest + 21, // 41: bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.ListCuratedPlugins:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListCuratedPluginsResponse + 19, // 42: bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.CreateCuratedPlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateCuratedPluginResponse + 23, // 43: bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.GetLatestCuratedPlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetLatestCuratedPluginResponse + 17, // 44: bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService.DeleteCuratedPlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteCuratedPluginResponse + 13, // 45: bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService.GenerateCode:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GenerateCodeResponse + 41, // [41:46] is the sub-list for method output_type + 36, // [36:41] is the sub-list for method input_type + 36, // [36:36] is the sub-list for extension type_name + 36, // [36:36] is the sub-list for extension extendee + 0, // [0:36] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_plugin_curation_proto_init() } +func file_registry_v1alpha1_plugin_curation_proto_init() { + if File_registry_v1alpha1_plugin_curation_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_plugin_curation_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GoConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NPMConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MavenConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SwiftConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CuratedPluginReference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CuratedPlugin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateCodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateCodeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginGenerationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginGenerationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteCuratedPluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteCuratedPluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateCuratedPluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateCuratedPluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListCuratedPluginsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListCuratedPluginsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetLatestCuratedPluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetLatestCuratedPluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CuratedPluginVersionRevisions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GoConfig_RuntimeLibrary); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NPMConfig_RuntimeLibrary); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MavenConfig_RuntimeLibrary); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MavenConfig_CompilerConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MavenConfig_CompilerJavaConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MavenConfig_CompilerKotlinConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MavenConfig_RuntimeConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SwiftConfig_RuntimeLibrary); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SwiftConfig_RuntimeLibrary_Platform); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*RegistryConfig_GoConfig)(nil), + (*RegistryConfig_NpmConfig)(nil), + (*RegistryConfig_MavenConfig)(nil), + (*RegistryConfig_SwiftConfig)(nil), + } + file_registry_v1alpha1_plugin_curation_proto_msgTypes[9].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_plugin_curation_proto_rawDesc, + NumEnums: 5, + NumMessages: 29, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_registry_v1alpha1_plugin_curation_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_plugin_curation_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_plugin_curation_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_plugin_curation_proto_msgTypes, + }.Build() + File_registry_v1alpha1_plugin_curation_proto = out.File + file_registry_v1alpha1_plugin_curation_proto_rawDesc = nil + file_registry_v1alpha1_plugin_curation_proto_goTypes = nil + file_registry_v1alpha1_plugin_curation_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_curation_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_curation_grpc.pb.go new file mode 100644 index 000000000..6c868fc63 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_curation_grpc.pb.go @@ -0,0 +1,320 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/plugin_curation.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + PluginCurationService_ListCuratedPlugins_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/ListCuratedPlugins" + PluginCurationService_CreateCuratedPlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/CreateCuratedPlugin" + PluginCurationService_GetLatestCuratedPlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/GetLatestCuratedPlugin" + PluginCurationService_DeleteCuratedPlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService/DeleteCuratedPlugin" +) + +// PluginCurationServiceClient is the client API for PluginCurationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PluginCurationServiceClient interface { + // ListCuratedPlugins returns all the curated plugins available. + ListCuratedPlugins(ctx context.Context, in *ListCuratedPluginsRequest, opts ...grpc.CallOption) (*ListCuratedPluginsResponse, error) + // CreateCuratedPlugin creates a new curated plugin. + CreateCuratedPlugin(ctx context.Context, in *CreateCuratedPluginRequest, opts ...grpc.CallOption) (*CreateCuratedPluginResponse, error) + // GetLatestCuratedPlugin returns the latest version of a plugin matching given parameters. + GetLatestCuratedPlugin(ctx context.Context, in *GetLatestCuratedPluginRequest, opts ...grpc.CallOption) (*GetLatestCuratedPluginResponse, error) + // DeleteCuratedPlugin deletes a curated plugin based on the given parameters. + DeleteCuratedPlugin(ctx context.Context, in *DeleteCuratedPluginRequest, opts ...grpc.CallOption) (*DeleteCuratedPluginResponse, error) +} + +type pluginCurationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPluginCurationServiceClient(cc grpc.ClientConnInterface) PluginCurationServiceClient { + return &pluginCurationServiceClient{cc} +} + +func (c *pluginCurationServiceClient) ListCuratedPlugins(ctx context.Context, in *ListCuratedPluginsRequest, opts ...grpc.CallOption) (*ListCuratedPluginsResponse, error) { + out := new(ListCuratedPluginsResponse) + err := c.cc.Invoke(ctx, PluginCurationService_ListCuratedPlugins_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginCurationServiceClient) CreateCuratedPlugin(ctx context.Context, in *CreateCuratedPluginRequest, opts ...grpc.CallOption) (*CreateCuratedPluginResponse, error) { + out := new(CreateCuratedPluginResponse) + err := c.cc.Invoke(ctx, PluginCurationService_CreateCuratedPlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginCurationServiceClient) GetLatestCuratedPlugin(ctx context.Context, in *GetLatestCuratedPluginRequest, opts ...grpc.CallOption) (*GetLatestCuratedPluginResponse, error) { + out := new(GetLatestCuratedPluginResponse) + err := c.cc.Invoke(ctx, PluginCurationService_GetLatestCuratedPlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginCurationServiceClient) DeleteCuratedPlugin(ctx context.Context, in *DeleteCuratedPluginRequest, opts ...grpc.CallOption) (*DeleteCuratedPluginResponse, error) { + out := new(DeleteCuratedPluginResponse) + err := c.cc.Invoke(ctx, PluginCurationService_DeleteCuratedPlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PluginCurationServiceServer is the server API for PluginCurationService service. +// All implementations must embed UnimplementedPluginCurationServiceServer +// for forward compatibility +type PluginCurationServiceServer interface { + // ListCuratedPlugins returns all the curated plugins available. + ListCuratedPlugins(context.Context, *ListCuratedPluginsRequest) (*ListCuratedPluginsResponse, error) + // CreateCuratedPlugin creates a new curated plugin. + CreateCuratedPlugin(context.Context, *CreateCuratedPluginRequest) (*CreateCuratedPluginResponse, error) + // GetLatestCuratedPlugin returns the latest version of a plugin matching given parameters. + GetLatestCuratedPlugin(context.Context, *GetLatestCuratedPluginRequest) (*GetLatestCuratedPluginResponse, error) + // DeleteCuratedPlugin deletes a curated plugin based on the given parameters. + DeleteCuratedPlugin(context.Context, *DeleteCuratedPluginRequest) (*DeleteCuratedPluginResponse, error) + mustEmbedUnimplementedPluginCurationServiceServer() +} + +// UnimplementedPluginCurationServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPluginCurationServiceServer struct { +} + +func (UnimplementedPluginCurationServiceServer) ListCuratedPlugins(context.Context, *ListCuratedPluginsRequest) (*ListCuratedPluginsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListCuratedPlugins not implemented") +} +func (UnimplementedPluginCurationServiceServer) CreateCuratedPlugin(context.Context, *CreateCuratedPluginRequest) (*CreateCuratedPluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateCuratedPlugin not implemented") +} +func (UnimplementedPluginCurationServiceServer) GetLatestCuratedPlugin(context.Context, *GetLatestCuratedPluginRequest) (*GetLatestCuratedPluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLatestCuratedPlugin not implemented") +} +func (UnimplementedPluginCurationServiceServer) DeleteCuratedPlugin(context.Context, *DeleteCuratedPluginRequest) (*DeleteCuratedPluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteCuratedPlugin not implemented") +} +func (UnimplementedPluginCurationServiceServer) mustEmbedUnimplementedPluginCurationServiceServer() {} + +// UnsafePluginCurationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PluginCurationServiceServer will +// result in compilation errors. +type UnsafePluginCurationServiceServer interface { + mustEmbedUnimplementedPluginCurationServiceServer() +} + +func RegisterPluginCurationServiceServer(s grpc.ServiceRegistrar, srv PluginCurationServiceServer) { + s.RegisterService(&PluginCurationService_ServiceDesc, srv) +} + +func _PluginCurationService_ListCuratedPlugins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListCuratedPluginsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginCurationServiceServer).ListCuratedPlugins(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginCurationService_ListCuratedPlugins_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginCurationServiceServer).ListCuratedPlugins(ctx, req.(*ListCuratedPluginsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginCurationService_CreateCuratedPlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateCuratedPluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginCurationServiceServer).CreateCuratedPlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginCurationService_CreateCuratedPlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginCurationServiceServer).CreateCuratedPlugin(ctx, req.(*CreateCuratedPluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginCurationService_GetLatestCuratedPlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetLatestCuratedPluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginCurationServiceServer).GetLatestCuratedPlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginCurationService_GetLatestCuratedPlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginCurationServiceServer).GetLatestCuratedPlugin(ctx, req.(*GetLatestCuratedPluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginCurationService_DeleteCuratedPlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteCuratedPluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginCurationServiceServer).DeleteCuratedPlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginCurationService_DeleteCuratedPlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginCurationServiceServer).DeleteCuratedPlugin(ctx, req.(*DeleteCuratedPluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PluginCurationService_ServiceDesc is the grpc.ServiceDesc for PluginCurationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PluginCurationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.PluginCurationService", + HandlerType: (*PluginCurationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListCuratedPlugins", + Handler: _PluginCurationService_ListCuratedPlugins_Handler, + }, + { + MethodName: "CreateCuratedPlugin", + Handler: _PluginCurationService_CreateCuratedPlugin_Handler, + }, + { + MethodName: "GetLatestCuratedPlugin", + Handler: _PluginCurationService_GetLatestCuratedPlugin_Handler, + }, + { + MethodName: "DeleteCuratedPlugin", + Handler: _PluginCurationService_DeleteCuratedPlugin_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/plugin_curation.proto", +} + +const ( + CodeGenerationService_GenerateCode_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService/GenerateCode" +) + +// CodeGenerationServiceClient is the client API for CodeGenerationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CodeGenerationServiceClient interface { + // GenerateCode generates code using the specified remote plugins. + GenerateCode(ctx context.Context, in *GenerateCodeRequest, opts ...grpc.CallOption) (*GenerateCodeResponse, error) +} + +type codeGenerationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCodeGenerationServiceClient(cc grpc.ClientConnInterface) CodeGenerationServiceClient { + return &codeGenerationServiceClient{cc} +} + +func (c *codeGenerationServiceClient) GenerateCode(ctx context.Context, in *GenerateCodeRequest, opts ...grpc.CallOption) (*GenerateCodeResponse, error) { + out := new(GenerateCodeResponse) + err := c.cc.Invoke(ctx, CodeGenerationService_GenerateCode_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CodeGenerationServiceServer is the server API for CodeGenerationService service. +// All implementations must embed UnimplementedCodeGenerationServiceServer +// for forward compatibility +type CodeGenerationServiceServer interface { + // GenerateCode generates code using the specified remote plugins. + GenerateCode(context.Context, *GenerateCodeRequest) (*GenerateCodeResponse, error) + mustEmbedUnimplementedCodeGenerationServiceServer() +} + +// UnimplementedCodeGenerationServiceServer must be embedded to have forward compatible implementations. +type UnimplementedCodeGenerationServiceServer struct { +} + +func (UnimplementedCodeGenerationServiceServer) GenerateCode(context.Context, *GenerateCodeRequest) (*GenerateCodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateCode not implemented") +} +func (UnimplementedCodeGenerationServiceServer) mustEmbedUnimplementedCodeGenerationServiceServer() {} + +// UnsafeCodeGenerationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CodeGenerationServiceServer will +// result in compilation errors. +type UnsafeCodeGenerationServiceServer interface { + mustEmbedUnimplementedCodeGenerationServiceServer() +} + +func RegisterCodeGenerationServiceServer(s grpc.ServiceRegistrar, srv CodeGenerationServiceServer) { + s.RegisterService(&CodeGenerationService_ServiceDesc, srv) +} + +func _CodeGenerationService_GenerateCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateCodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CodeGenerationServiceServer).GenerateCode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CodeGenerationService_GenerateCode_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CodeGenerationServiceServer).GenerateCode(ctx, req.(*GenerateCodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CodeGenerationService_ServiceDesc is the grpc.ServiceDesc for CodeGenerationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CodeGenerationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.CodeGenerationService", + HandlerType: (*CodeGenerationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GenerateCode", + Handler: _CodeGenerationService_GenerateCode_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/plugin_curation.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_grpc.pb.go new file mode 100644 index 000000000..f0273d4f2 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/plugin_grpc.pb.go @@ -0,0 +1,671 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// registry/v1alpha1/plugin.proto is a deprecated file. + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + PluginService_ListPlugins_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListPlugins" + PluginService_ListUserPlugins_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListUserPlugins" + PluginService_ListOrganizationPlugins_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListOrganizationPlugins" + PluginService_GetPluginVersion_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetPluginVersion" + PluginService_ListPluginVersions_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListPluginVersions" + PluginService_GetPlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetPlugin" + PluginService_DeletePlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/DeletePlugin" + PluginService_GetTemplate_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetTemplate" + PluginService_ListTemplates_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplates" + PluginService_ListTemplatesUserCanAccess_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplatesUserCanAccess" + PluginService_ListUserTemplates_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListUserTemplates" + PluginService_ListOrganizationTemplates_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListOrganizationTemplates" + PluginService_GetTemplateVersion_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/GetTemplateVersion" + PluginService_ListTemplateVersions_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/ListTemplateVersions" + PluginService_DeleteTemplate_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PluginService/DeleteTemplate" +) + +// PluginServiceClient is the client API for PluginService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PluginServiceClient interface { + // ListPlugins returns all the plugins available to the user. This includes + // public plugins, those uploaded to organizations the user is part of, + // and any plugins uploaded directly by the user. + ListPlugins(ctx context.Context, in *ListPluginsRequest, opts ...grpc.CallOption) (*ListPluginsResponse, error) + // ListUserPlugins lists all plugins belonging to a user. + ListUserPlugins(ctx context.Context, in *ListUserPluginsRequest, opts ...grpc.CallOption) (*ListUserPluginsResponse, error) + // ListOrganizationPlugins lists all plugins for an organization. + ListOrganizationPlugins(ctx context.Context, in *ListOrganizationPluginsRequest, opts ...grpc.CallOption) (*ListOrganizationPluginsResponse, error) + // GetPluginVersion returns the plugin version, if found. + GetPluginVersion(ctx context.Context, in *GetPluginVersionRequest, opts ...grpc.CallOption) (*GetPluginVersionResponse, error) + // ListPluginVersions lists all the versions available for the specified plugin. + ListPluginVersions(ctx context.Context, in *ListPluginVersionsRequest, opts ...grpc.CallOption) (*ListPluginVersionsResponse, error) + // GetPlugin returns the plugin, if found. + GetPlugin(ctx context.Context, in *GetPluginRequest, opts ...grpc.CallOption) (*GetPluginResponse, error) + // DeletePlugin deletes the plugin, if it exists. Note that deleting + // a plugin may cause breaking changes for templates using that plugin, + // and should be done with extreme care. + DeletePlugin(ctx context.Context, in *DeletePluginRequest, opts ...grpc.CallOption) (*DeletePluginResponse, error) + // GetTemplate returns the template, if found. + GetTemplate(ctx context.Context, in *GetTemplateRequest, opts ...grpc.CallOption) (*GetTemplateResponse, error) + // ListTemplates returns all the templates available to the user. This includes + // public templates, those owned by organizations the user is part of, + // and any created directly by the user. + ListTemplates(ctx context.Context, in *ListTemplatesRequest, opts ...grpc.CallOption) (*ListTemplatesResponse, error) + // ListTemplatesUserCanAccess is like ListTemplates, but does not return + // public templates. + ListTemplatesUserCanAccess(ctx context.Context, in *ListTemplatesUserCanAccessRequest, opts ...grpc.CallOption) (*ListTemplatesUserCanAccessResponse, error) + // ListUserPlugins lists all templates belonging to a user. + ListUserTemplates(ctx context.Context, in *ListUserTemplatesRequest, opts ...grpc.CallOption) (*ListUserTemplatesResponse, error) + // ListOrganizationTemplates lists all templates for an organization. + ListOrganizationTemplates(ctx context.Context, in *ListOrganizationTemplatesRequest, opts ...grpc.CallOption) (*ListOrganizationTemplatesResponse, error) + // GetTemplateVersion returns the template version, if found. + GetTemplateVersion(ctx context.Context, in *GetTemplateVersionRequest, opts ...grpc.CallOption) (*GetTemplateVersionResponse, error) + // ListTemplateVersions lists all the template versions available for the specified template. + ListTemplateVersions(ctx context.Context, in *ListTemplateVersionsRequest, opts ...grpc.CallOption) (*ListTemplateVersionsResponse, error) + // DeleteTemplate deletes the template, if it exists. + DeleteTemplate(ctx context.Context, in *DeleteTemplateRequest, opts ...grpc.CallOption) (*DeleteTemplateResponse, error) +} + +type pluginServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPluginServiceClient(cc grpc.ClientConnInterface) PluginServiceClient { + return &pluginServiceClient{cc} +} + +func (c *pluginServiceClient) ListPlugins(ctx context.Context, in *ListPluginsRequest, opts ...grpc.CallOption) (*ListPluginsResponse, error) { + out := new(ListPluginsResponse) + err := c.cc.Invoke(ctx, PluginService_ListPlugins_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) ListUserPlugins(ctx context.Context, in *ListUserPluginsRequest, opts ...grpc.CallOption) (*ListUserPluginsResponse, error) { + out := new(ListUserPluginsResponse) + err := c.cc.Invoke(ctx, PluginService_ListUserPlugins_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) ListOrganizationPlugins(ctx context.Context, in *ListOrganizationPluginsRequest, opts ...grpc.CallOption) (*ListOrganizationPluginsResponse, error) { + out := new(ListOrganizationPluginsResponse) + err := c.cc.Invoke(ctx, PluginService_ListOrganizationPlugins_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) GetPluginVersion(ctx context.Context, in *GetPluginVersionRequest, opts ...grpc.CallOption) (*GetPluginVersionResponse, error) { + out := new(GetPluginVersionResponse) + err := c.cc.Invoke(ctx, PluginService_GetPluginVersion_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) ListPluginVersions(ctx context.Context, in *ListPluginVersionsRequest, opts ...grpc.CallOption) (*ListPluginVersionsResponse, error) { + out := new(ListPluginVersionsResponse) + err := c.cc.Invoke(ctx, PluginService_ListPluginVersions_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) GetPlugin(ctx context.Context, in *GetPluginRequest, opts ...grpc.CallOption) (*GetPluginResponse, error) { + out := new(GetPluginResponse) + err := c.cc.Invoke(ctx, PluginService_GetPlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) DeletePlugin(ctx context.Context, in *DeletePluginRequest, opts ...grpc.CallOption) (*DeletePluginResponse, error) { + out := new(DeletePluginResponse) + err := c.cc.Invoke(ctx, PluginService_DeletePlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) GetTemplate(ctx context.Context, in *GetTemplateRequest, opts ...grpc.CallOption) (*GetTemplateResponse, error) { + out := new(GetTemplateResponse) + err := c.cc.Invoke(ctx, PluginService_GetTemplate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) ListTemplates(ctx context.Context, in *ListTemplatesRequest, opts ...grpc.CallOption) (*ListTemplatesResponse, error) { + out := new(ListTemplatesResponse) + err := c.cc.Invoke(ctx, PluginService_ListTemplates_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) ListTemplatesUserCanAccess(ctx context.Context, in *ListTemplatesUserCanAccessRequest, opts ...grpc.CallOption) (*ListTemplatesUserCanAccessResponse, error) { + out := new(ListTemplatesUserCanAccessResponse) + err := c.cc.Invoke(ctx, PluginService_ListTemplatesUserCanAccess_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) ListUserTemplates(ctx context.Context, in *ListUserTemplatesRequest, opts ...grpc.CallOption) (*ListUserTemplatesResponse, error) { + out := new(ListUserTemplatesResponse) + err := c.cc.Invoke(ctx, PluginService_ListUserTemplates_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) ListOrganizationTemplates(ctx context.Context, in *ListOrganizationTemplatesRequest, opts ...grpc.CallOption) (*ListOrganizationTemplatesResponse, error) { + out := new(ListOrganizationTemplatesResponse) + err := c.cc.Invoke(ctx, PluginService_ListOrganizationTemplates_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) GetTemplateVersion(ctx context.Context, in *GetTemplateVersionRequest, opts ...grpc.CallOption) (*GetTemplateVersionResponse, error) { + out := new(GetTemplateVersionResponse) + err := c.cc.Invoke(ctx, PluginService_GetTemplateVersion_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) ListTemplateVersions(ctx context.Context, in *ListTemplateVersionsRequest, opts ...grpc.CallOption) (*ListTemplateVersionsResponse, error) { + out := new(ListTemplateVersionsResponse) + err := c.cc.Invoke(ctx, PluginService_ListTemplateVersions_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginServiceClient) DeleteTemplate(ctx context.Context, in *DeleteTemplateRequest, opts ...grpc.CallOption) (*DeleteTemplateResponse, error) { + out := new(DeleteTemplateResponse) + err := c.cc.Invoke(ctx, PluginService_DeleteTemplate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PluginServiceServer is the server API for PluginService service. +// All implementations must embed UnimplementedPluginServiceServer +// for forward compatibility +type PluginServiceServer interface { + // ListPlugins returns all the plugins available to the user. This includes + // public plugins, those uploaded to organizations the user is part of, + // and any plugins uploaded directly by the user. + ListPlugins(context.Context, *ListPluginsRequest) (*ListPluginsResponse, error) + // ListUserPlugins lists all plugins belonging to a user. + ListUserPlugins(context.Context, *ListUserPluginsRequest) (*ListUserPluginsResponse, error) + // ListOrganizationPlugins lists all plugins for an organization. + ListOrganizationPlugins(context.Context, *ListOrganizationPluginsRequest) (*ListOrganizationPluginsResponse, error) + // GetPluginVersion returns the plugin version, if found. + GetPluginVersion(context.Context, *GetPluginVersionRequest) (*GetPluginVersionResponse, error) + // ListPluginVersions lists all the versions available for the specified plugin. + ListPluginVersions(context.Context, *ListPluginVersionsRequest) (*ListPluginVersionsResponse, error) + // GetPlugin returns the plugin, if found. + GetPlugin(context.Context, *GetPluginRequest) (*GetPluginResponse, error) + // DeletePlugin deletes the plugin, if it exists. Note that deleting + // a plugin may cause breaking changes for templates using that plugin, + // and should be done with extreme care. + DeletePlugin(context.Context, *DeletePluginRequest) (*DeletePluginResponse, error) + // GetTemplate returns the template, if found. + GetTemplate(context.Context, *GetTemplateRequest) (*GetTemplateResponse, error) + // ListTemplates returns all the templates available to the user. This includes + // public templates, those owned by organizations the user is part of, + // and any created directly by the user. + ListTemplates(context.Context, *ListTemplatesRequest) (*ListTemplatesResponse, error) + // ListTemplatesUserCanAccess is like ListTemplates, but does not return + // public templates. + ListTemplatesUserCanAccess(context.Context, *ListTemplatesUserCanAccessRequest) (*ListTemplatesUserCanAccessResponse, error) + // ListUserPlugins lists all templates belonging to a user. + ListUserTemplates(context.Context, *ListUserTemplatesRequest) (*ListUserTemplatesResponse, error) + // ListOrganizationTemplates lists all templates for an organization. + ListOrganizationTemplates(context.Context, *ListOrganizationTemplatesRequest) (*ListOrganizationTemplatesResponse, error) + // GetTemplateVersion returns the template version, if found. + GetTemplateVersion(context.Context, *GetTemplateVersionRequest) (*GetTemplateVersionResponse, error) + // ListTemplateVersions lists all the template versions available for the specified template. + ListTemplateVersions(context.Context, *ListTemplateVersionsRequest) (*ListTemplateVersionsResponse, error) + // DeleteTemplate deletes the template, if it exists. + DeleteTemplate(context.Context, *DeleteTemplateRequest) (*DeleteTemplateResponse, error) + mustEmbedUnimplementedPluginServiceServer() +} + +// UnimplementedPluginServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPluginServiceServer struct { +} + +func (UnimplementedPluginServiceServer) ListPlugins(context.Context, *ListPluginsRequest) (*ListPluginsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListPlugins not implemented") +} +func (UnimplementedPluginServiceServer) ListUserPlugins(context.Context, *ListUserPluginsRequest) (*ListUserPluginsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUserPlugins not implemented") +} +func (UnimplementedPluginServiceServer) ListOrganizationPlugins(context.Context, *ListOrganizationPluginsRequest) (*ListOrganizationPluginsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListOrganizationPlugins not implemented") +} +func (UnimplementedPluginServiceServer) GetPluginVersion(context.Context, *GetPluginVersionRequest) (*GetPluginVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPluginVersion not implemented") +} +func (UnimplementedPluginServiceServer) ListPluginVersions(context.Context, *ListPluginVersionsRequest) (*ListPluginVersionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListPluginVersions not implemented") +} +func (UnimplementedPluginServiceServer) GetPlugin(context.Context, *GetPluginRequest) (*GetPluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPlugin not implemented") +} +func (UnimplementedPluginServiceServer) DeletePlugin(context.Context, *DeletePluginRequest) (*DeletePluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePlugin not implemented") +} +func (UnimplementedPluginServiceServer) GetTemplate(context.Context, *GetTemplateRequest) (*GetTemplateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTemplate not implemented") +} +func (UnimplementedPluginServiceServer) ListTemplates(context.Context, *ListTemplatesRequest) (*ListTemplatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListTemplates not implemented") +} +func (UnimplementedPluginServiceServer) ListTemplatesUserCanAccess(context.Context, *ListTemplatesUserCanAccessRequest) (*ListTemplatesUserCanAccessResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListTemplatesUserCanAccess not implemented") +} +func (UnimplementedPluginServiceServer) ListUserTemplates(context.Context, *ListUserTemplatesRequest) (*ListUserTemplatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUserTemplates not implemented") +} +func (UnimplementedPluginServiceServer) ListOrganizationTemplates(context.Context, *ListOrganizationTemplatesRequest) (*ListOrganizationTemplatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListOrganizationTemplates not implemented") +} +func (UnimplementedPluginServiceServer) GetTemplateVersion(context.Context, *GetTemplateVersionRequest) (*GetTemplateVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTemplateVersion not implemented") +} +func (UnimplementedPluginServiceServer) ListTemplateVersions(context.Context, *ListTemplateVersionsRequest) (*ListTemplateVersionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListTemplateVersions not implemented") +} +func (UnimplementedPluginServiceServer) DeleteTemplate(context.Context, *DeleteTemplateRequest) (*DeleteTemplateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteTemplate not implemented") +} +func (UnimplementedPluginServiceServer) mustEmbedUnimplementedPluginServiceServer() {} + +// UnsafePluginServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PluginServiceServer will +// result in compilation errors. +type UnsafePluginServiceServer interface { + mustEmbedUnimplementedPluginServiceServer() +} + +func RegisterPluginServiceServer(s grpc.ServiceRegistrar, srv PluginServiceServer) { + s.RegisterService(&PluginService_ServiceDesc, srv) +} + +func _PluginService_ListPlugins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListPluginsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListPlugins(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListPlugins_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListPlugins(ctx, req.(*ListPluginsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_ListUserPlugins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserPluginsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListUserPlugins(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListUserPlugins_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListUserPlugins(ctx, req.(*ListUserPluginsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_ListOrganizationPlugins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListOrganizationPluginsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListOrganizationPlugins(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListOrganizationPlugins_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListOrganizationPlugins(ctx, req.(*ListOrganizationPluginsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_GetPluginVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPluginVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).GetPluginVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_GetPluginVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).GetPluginVersion(ctx, req.(*GetPluginVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_ListPluginVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListPluginVersionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListPluginVersions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListPluginVersions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListPluginVersions(ctx, req.(*ListPluginVersionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_GetPlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).GetPlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_GetPlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).GetPlugin(ctx, req.(*GetPluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_DeletePlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).DeletePlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_DeletePlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).DeletePlugin(ctx, req.(*DeletePluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_GetTemplate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTemplateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).GetTemplate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_GetTemplate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).GetTemplate(ctx, req.(*GetTemplateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_ListTemplates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListTemplatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListTemplates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListTemplates_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListTemplates(ctx, req.(*ListTemplatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_ListTemplatesUserCanAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListTemplatesUserCanAccessRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListTemplatesUserCanAccess(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListTemplatesUserCanAccess_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListTemplatesUserCanAccess(ctx, req.(*ListTemplatesUserCanAccessRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_ListUserTemplates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserTemplatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListUserTemplates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListUserTemplates_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListUserTemplates(ctx, req.(*ListUserTemplatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_ListOrganizationTemplates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListOrganizationTemplatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListOrganizationTemplates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListOrganizationTemplates_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListOrganizationTemplates(ctx, req.(*ListOrganizationTemplatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_GetTemplateVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTemplateVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).GetTemplateVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_GetTemplateVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).GetTemplateVersion(ctx, req.(*GetTemplateVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_ListTemplateVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListTemplateVersionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).ListTemplateVersions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_ListTemplateVersions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).ListTemplateVersions(ctx, req.(*ListTemplateVersionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PluginService_DeleteTemplate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteTemplateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServiceServer).DeleteTemplate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PluginService_DeleteTemplate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServiceServer).DeleteTemplate(ctx, req.(*DeleteTemplateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PluginService_ServiceDesc is the grpc.ServiceDesc for PluginService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PluginService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.PluginService", + HandlerType: (*PluginServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListPlugins", + Handler: _PluginService_ListPlugins_Handler, + }, + { + MethodName: "ListUserPlugins", + Handler: _PluginService_ListUserPlugins_Handler, + }, + { + MethodName: "ListOrganizationPlugins", + Handler: _PluginService_ListOrganizationPlugins_Handler, + }, + { + MethodName: "GetPluginVersion", + Handler: _PluginService_GetPluginVersion_Handler, + }, + { + MethodName: "ListPluginVersions", + Handler: _PluginService_ListPluginVersions_Handler, + }, + { + MethodName: "GetPlugin", + Handler: _PluginService_GetPlugin_Handler, + }, + { + MethodName: "DeletePlugin", + Handler: _PluginService_DeletePlugin_Handler, + }, + { + MethodName: "GetTemplate", + Handler: _PluginService_GetTemplate_Handler, + }, + { + MethodName: "ListTemplates", + Handler: _PluginService_ListTemplates_Handler, + }, + { + MethodName: "ListTemplatesUserCanAccess", + Handler: _PluginService_ListTemplatesUserCanAccess_Handler, + }, + { + MethodName: "ListUserTemplates", + Handler: _PluginService_ListUserTemplates_Handler, + }, + { + MethodName: "ListOrganizationTemplates", + Handler: _PluginService_ListOrganizationTemplates_Handler, + }, + { + MethodName: "GetTemplateVersion", + Handler: _PluginService_GetTemplateVersion_Handler, + }, + { + MethodName: "ListTemplateVersions", + Handler: _PluginService_ListTemplateVersions_Handler, + }, + { + MethodName: "DeleteTemplate", + Handler: _PluginService_DeleteTemplate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/plugin.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/push.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/push.pb.go new file mode 100644 index 000000000..9cd5078dd --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/push.pb.go @@ -0,0 +1,543 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/push.proto + +package registryv1alpha1 + +import ( + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// PushRequest specifies the module to push to the BSR. +type PushRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + // Deprecated: Do not use. + Branch string `protobuf:"bytes,3,opt,name=branch,proto3" json:"branch,omitempty"` + Module *v1alpha1.Module `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"` + // Optional; if provided, the provided tags + // are created for the pushed commit. + Tags []string `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"` + // Optional; if provided, the pushed commit + // will be appended to these tracks. If the + // tracks do not exist, they will be created. + // + // Deprecated: Do not use. + Tracks []string `protobuf:"bytes,6,rep,name=tracks,proto3" json:"tracks,omitempty"` + // If non-empty, the push creates a draft commit with this name. + DraftName string `protobuf:"bytes,7,opt,name=draft_name,json=draftName,proto3" json:"draft_name,omitempty"` +} + +func (x *PushRequest) Reset() { + *x = PushRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_push_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushRequest) ProtoMessage() {} + +func (x *PushRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_push_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PushRequest.ProtoReflect.Descriptor instead. +func (*PushRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_push_proto_rawDescGZIP(), []int{0} +} + +func (x *PushRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *PushRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +// Deprecated: Do not use. +func (x *PushRequest) GetBranch() string { + if x != nil { + return x.Branch + } + return "" +} + +func (x *PushRequest) GetModule() *v1alpha1.Module { + if x != nil { + return x.Module + } + return nil +} + +func (x *PushRequest) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +// Deprecated: Do not use. +func (x *PushRequest) GetTracks() []string { + if x != nil { + return x.Tracks + } + return nil +} + +func (x *PushRequest) GetDraftName() string { + if x != nil { + return x.DraftName + } + return "" +} + +// PushResponse is the pushed module pin, local to the used remote. +type PushResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LocalModulePin *LocalModulePin `protobuf:"bytes,5,opt,name=local_module_pin,json=localModulePin,proto3" json:"local_module_pin,omitempty"` +} + +func (x *PushResponse) Reset() { + *x = PushResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_push_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushResponse) ProtoMessage() {} + +func (x *PushResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_push_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PushResponse.ProtoReflect.Descriptor instead. +func (*PushResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_push_proto_rawDescGZIP(), []int{1} +} + +func (x *PushResponse) GetLocalModulePin() *LocalModulePin { + if x != nil { + return x.LocalModulePin + } + return nil +} + +// PushManifestAndBlobsRequest holds the module to push in the manifest+blobs +// encoding format. +type PushManifestAndBlobsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + // Manifest with all the module files being pushed. + Manifest *v1alpha1.Blob `protobuf:"bytes,3,opt,name=manifest,proto3" json:"manifest,omitempty"` + // Referenced blobs in the manifest. Keep in mind there is not necessarily one + // blob per file, but one blob per digest, so for files with exactly the same + // content, you can send just one blob. + Blobs []*v1alpha1.Blob `protobuf:"bytes,4,rep,name=blobs,proto3" json:"blobs,omitempty"` + // Optional; if provided, the provided tags + // are created for the pushed commit. + Tags []string `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"` + // If non-empty, the push creates a draft commit with this name. + DraftName string `protobuf:"bytes,6,opt,name=draft_name,json=draftName,proto3" json:"draft_name,omitempty"` +} + +func (x *PushManifestAndBlobsRequest) Reset() { + *x = PushManifestAndBlobsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_push_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushManifestAndBlobsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushManifestAndBlobsRequest) ProtoMessage() {} + +func (x *PushManifestAndBlobsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_push_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PushManifestAndBlobsRequest.ProtoReflect.Descriptor instead. +func (*PushManifestAndBlobsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_push_proto_rawDescGZIP(), []int{2} +} + +func (x *PushManifestAndBlobsRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *PushManifestAndBlobsRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *PushManifestAndBlobsRequest) GetManifest() *v1alpha1.Blob { + if x != nil { + return x.Manifest + } + return nil +} + +func (x *PushManifestAndBlobsRequest) GetBlobs() []*v1alpha1.Blob { + if x != nil { + return x.Blobs + } + return nil +} + +func (x *PushManifestAndBlobsRequest) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *PushManifestAndBlobsRequest) GetDraftName() string { + if x != nil { + return x.DraftName + } + return "" +} + +// PushManifestAndBlobsResponse is the pushed module pin, local to the used +// remote. +type PushManifestAndBlobsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LocalModulePin *LocalModulePin `protobuf:"bytes,1,opt,name=local_module_pin,json=localModulePin,proto3" json:"local_module_pin,omitempty"` +} + +func (x *PushManifestAndBlobsResponse) Reset() { + *x = PushManifestAndBlobsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_push_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushManifestAndBlobsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushManifestAndBlobsResponse) ProtoMessage() {} + +func (x *PushManifestAndBlobsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_push_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PushManifestAndBlobsResponse.ProtoReflect.Descriptor instead. +func (*PushManifestAndBlobsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_push_proto_rawDescGZIP(), []int{3} +} + +func (x *PushManifestAndBlobsResponse) GetLocalModulePin() *LocalModulePin { + if x != nil { + return x.LocalModulePin + } + return nil +} + +var File_registry_v1alpha1_push_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_push_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x70, 0x75, 0x73, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1c, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x01, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, + 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1a, 0x0a, + 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, + 0x01, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x47, 0x0a, 0x06, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x1a, 0x0a, 0x06, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x06, 0x74, 0x72, 0x61, 0x63, + 0x6b, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x72, 0x61, 0x66, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x72, 0x61, 0x66, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x22, 0x73, 0x0a, 0x0c, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x63, 0x0a, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x5f, 0x70, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x22, 0x96, 0x02, 0x0a, 0x1b, 0x50, 0x75, 0x73, 0x68, 0x4d, + 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x49, 0x0a, 0x08, + 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x08, 0x6d, + 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, + 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x72, 0x61, 0x66, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x72, 0x61, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, + 0x83, 0x01, 0x0a, 0x1c, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, + 0x41, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x63, 0x0a, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x5f, 0x70, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x32, 0xba, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7c, 0x0a, 0x04, 0x50, 0x75, 0x73, 0x68, 0x12, 0x36, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x02, 0x12, 0xac, 0x01, 0x0a, 0x14, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x61, 0x6e, 0x69, + 0x66, 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x12, 0x46, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x61, 0x6e, + 0x69, 0x66, 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, + 0x42, 0x6c, 0x6f, 0x62, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x02, 0x42, 0xe4, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x42, 0x09, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, + 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, + 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, + 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_registry_v1alpha1_push_proto_rawDescOnce sync.Once + file_registry_v1alpha1_push_proto_rawDescData = file_registry_v1alpha1_push_proto_rawDesc +) + +func file_registry_v1alpha1_push_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_push_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_push_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_push_proto_rawDescData) + }) + return file_registry_v1alpha1_push_proto_rawDescData +} + +var file_registry_v1alpha1_push_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_registry_v1alpha1_push_proto_goTypes = []interface{}{ + (*PushRequest)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.PushRequest + (*PushResponse)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.PushResponse + (*PushManifestAndBlobsRequest)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.PushManifestAndBlobsRequest + (*PushManifestAndBlobsResponse)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.PushManifestAndBlobsResponse + (*v1alpha1.Module)(nil), // 4: bufman.dubbo.apache.org.module.v1alpha1.Module + (*LocalModulePin)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.LocalModulePin + (*v1alpha1.Blob)(nil), // 6: bufman.dubbo.apache.org.module.v1alpha1.Blob +} +var file_registry_v1alpha1_push_proto_depIdxs = []int32{ + 4, // 0: bufman.dubbo.apache.org.registry.v1alpha1.PushRequest.module:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Module + 5, // 1: bufman.dubbo.apache.org.registry.v1alpha1.PushResponse.local_module_pin:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModulePin + 6, // 2: bufman.dubbo.apache.org.registry.v1alpha1.PushManifestAndBlobsRequest.manifest:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Blob + 6, // 3: bufman.dubbo.apache.org.registry.v1alpha1.PushManifestAndBlobsRequest.blobs:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Blob + 5, // 4: bufman.dubbo.apache.org.registry.v1alpha1.PushManifestAndBlobsResponse.local_module_pin:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModulePin + 0, // 5: bufman.dubbo.apache.org.registry.v1alpha1.PushService.Push:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.PushRequest + 2, // 6: bufman.dubbo.apache.org.registry.v1alpha1.PushService.PushManifestAndBlobs:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.PushManifestAndBlobsRequest + 1, // 7: bufman.dubbo.apache.org.registry.v1alpha1.PushService.Push:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.PushResponse + 3, // 8: bufman.dubbo.apache.org.registry.v1alpha1.PushService.PushManifestAndBlobs:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.PushManifestAndBlobsResponse + 7, // [7:9] is the sub-list for method output_type + 5, // [5:7] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_push_proto_init() } +func file_registry_v1alpha1_push_proto_init() { + if File_registry_v1alpha1_push_proto != nil { + return + } + file_registry_v1alpha1_module_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_push_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_push_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_push_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushManifestAndBlobsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_push_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushManifestAndBlobsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_push_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_push_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_push_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_push_proto_msgTypes, + }.Build() + File_registry_v1alpha1_push_proto = out.File + file_registry_v1alpha1_push_proto_rawDesc = nil + file_registry_v1alpha1_push_proto_goTypes = nil + file_registry_v1alpha1_push_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/push_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/push_grpc.pb.go new file mode 100644 index 000000000..f3a8c9d5f --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/push_grpc.pb.go @@ -0,0 +1,152 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/push.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + PushService_Push_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PushService/Push" + PushService_PushManifestAndBlobs_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.PushService/PushManifestAndBlobs" +) + +// PushServiceClient is the client API for PushService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PushServiceClient interface { + // Push pushes. + // NOTE: Newer clients should use PushManifestAndBlobs. + Push(ctx context.Context, in *PushRequest, opts ...grpc.CallOption) (*PushResponse, error) + // PushManifestAndBlobs pushes a module by encoding it in a manifest and blobs format. + PushManifestAndBlobs(ctx context.Context, in *PushManifestAndBlobsRequest, opts ...grpc.CallOption) (*PushManifestAndBlobsResponse, error) +} + +type pushServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPushServiceClient(cc grpc.ClientConnInterface) PushServiceClient { + return &pushServiceClient{cc} +} + +func (c *pushServiceClient) Push(ctx context.Context, in *PushRequest, opts ...grpc.CallOption) (*PushResponse, error) { + out := new(PushResponse) + err := c.cc.Invoke(ctx, PushService_Push_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pushServiceClient) PushManifestAndBlobs(ctx context.Context, in *PushManifestAndBlobsRequest, opts ...grpc.CallOption) (*PushManifestAndBlobsResponse, error) { + out := new(PushManifestAndBlobsResponse) + err := c.cc.Invoke(ctx, PushService_PushManifestAndBlobs_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PushServiceServer is the server API for PushService service. +// All implementations must embed UnimplementedPushServiceServer +// for forward compatibility +type PushServiceServer interface { + // Push pushes. + // NOTE: Newer clients should use PushManifestAndBlobs. + Push(context.Context, *PushRequest) (*PushResponse, error) + // PushManifestAndBlobs pushes a module by encoding it in a manifest and blobs format. + PushManifestAndBlobs(context.Context, *PushManifestAndBlobsRequest) (*PushManifestAndBlobsResponse, error) + mustEmbedUnimplementedPushServiceServer() +} + +// UnimplementedPushServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPushServiceServer struct { +} + +func (UnimplementedPushServiceServer) Push(context.Context, *PushRequest) (*PushResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Push not implemented") +} +func (UnimplementedPushServiceServer) PushManifestAndBlobs(context.Context, *PushManifestAndBlobsRequest) (*PushManifestAndBlobsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushManifestAndBlobs not implemented") +} +func (UnimplementedPushServiceServer) mustEmbedUnimplementedPushServiceServer() {} + +// UnsafePushServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PushServiceServer will +// result in compilation errors. +type UnsafePushServiceServer interface { + mustEmbedUnimplementedPushServiceServer() +} + +func RegisterPushServiceServer(s grpc.ServiceRegistrar, srv PushServiceServer) { + s.RegisterService(&PushService_ServiceDesc, srv) +} + +func _PushService_Push_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PushServiceServer).Push(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PushService_Push_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PushServiceServer).Push(ctx, req.(*PushRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PushService_PushManifestAndBlobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushManifestAndBlobsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PushServiceServer).PushManifestAndBlobs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PushService_PushManifestAndBlobs_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PushServiceServer).PushManifestAndBlobs(ctx, req.(*PushManifestAndBlobsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PushService_ServiceDesc is the grpc.ServiceDesc for PushService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PushService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.PushService", + HandlerType: (*PushServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Push", + Handler: _PushService_Push_Handler, + }, + { + MethodName: "PushManifestAndBlobs", + Handler: _PushService_PushManifestAndBlobs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/push.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/recommendation.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/recommendation.pb.go new file mode 100644 index 000000000..d6f10b65a --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/recommendation.pb.go @@ -0,0 +1,937 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/recommendation.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// RecommendedRepository is the information about a repository needed to link to +// its owner page. +type RecommendedRepository struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + RepositoryId string `protobuf:"bytes,5,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` +} + +func (x *RecommendedRepository) Reset() { + *x = RecommendedRepository{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecommendedRepository) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecommendedRepository) ProtoMessage() {} + +func (x *RecommendedRepository) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecommendedRepository.ProtoReflect.Descriptor instead. +func (*RecommendedRepository) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{0} +} + +func (x *RecommendedRepository) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *RecommendedRepository) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RecommendedRepository) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *RecommendedRepository) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *RecommendedRepository) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +// RecommendedTemplate is the information needed to recommend a template and link +// to its owner page. +// +// Deprecated: Do not use. +type RecommendedTemplate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + TemplateId string `protobuf:"bytes,4,opt,name=template_id,json=templateId,proto3" json:"template_id,omitempty"` +} + +func (x *RecommendedTemplate) Reset() { + *x = RecommendedTemplate{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecommendedTemplate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecommendedTemplate) ProtoMessage() {} + +func (x *RecommendedTemplate) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecommendedTemplate.ProtoReflect.Descriptor instead. +func (*RecommendedTemplate) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{1} +} + +func (x *RecommendedTemplate) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *RecommendedTemplate) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RecommendedTemplate) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *RecommendedTemplate) GetTemplateId() string { + if x != nil { + return x.TemplateId + } + return "" +} + +// SetRecommendedResource is the information needed to configure a resource recommendation +type SetRecommendedResource struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *SetRecommendedResource) Reset() { + *x = SetRecommendedResource{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetRecommendedResource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRecommendedResource) ProtoMessage() {} + +func (x *SetRecommendedResource) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRecommendedResource.ProtoReflect.Descriptor instead. +func (*SetRecommendedResource) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{2} +} + +func (x *SetRecommendedResource) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *SetRecommendedResource) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type RecommendedRepositoriesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RecommendedRepositoriesRequest) Reset() { + *x = RecommendedRepositoriesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecommendedRepositoriesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecommendedRepositoriesRequest) ProtoMessage() {} + +func (x *RecommendedRepositoriesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecommendedRepositoriesRequest.ProtoReflect.Descriptor instead. +func (*RecommendedRepositoriesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{3} +} + +type RecommendedRepositoriesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repositories []*RecommendedRepository `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"` +} + +func (x *RecommendedRepositoriesResponse) Reset() { + *x = RecommendedRepositoriesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecommendedRepositoriesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecommendedRepositoriesResponse) ProtoMessage() {} + +func (x *RecommendedRepositoriesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecommendedRepositoriesResponse.ProtoReflect.Descriptor instead. +func (*RecommendedRepositoriesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{4} +} + +func (x *RecommendedRepositoriesResponse) GetRepositories() []*RecommendedRepository { + if x != nil { + return x.Repositories + } + return nil +} + +// Deprecated: Do not use. +type RecommendedTemplatesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RecommendedTemplatesRequest) Reset() { + *x = RecommendedTemplatesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecommendedTemplatesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecommendedTemplatesRequest) ProtoMessage() {} + +func (x *RecommendedTemplatesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecommendedTemplatesRequest.ProtoReflect.Descriptor instead. +func (*RecommendedTemplatesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{5} +} + +// Deprecated: Do not use. +type RecommendedTemplatesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Templates []*RecommendedTemplate `protobuf:"bytes,1,rep,name=templates,proto3" json:"templates,omitempty"` +} + +func (x *RecommendedTemplatesResponse) Reset() { + *x = RecommendedTemplatesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecommendedTemplatesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecommendedTemplatesResponse) ProtoMessage() {} + +func (x *RecommendedTemplatesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecommendedTemplatesResponse.ProtoReflect.Descriptor instead. +func (*RecommendedTemplatesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{6} +} + +func (x *RecommendedTemplatesResponse) GetTemplates() []*RecommendedTemplate { + if x != nil { + return x.Templates + } + return nil +} + +type ListRecommendedResourcesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListRecommendedResourcesRequest) Reset() { + *x = ListRecommendedResourcesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRecommendedResourcesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRecommendedResourcesRequest) ProtoMessage() {} + +func (x *ListRecommendedResourcesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRecommendedResourcesRequest.ProtoReflect.Descriptor instead. +func (*ListRecommendedResourcesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{7} +} + +type ListRecommendedResourcesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resources []*Resource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` +} + +func (x *ListRecommendedResourcesResponse) Reset() { + *x = ListRecommendedResourcesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRecommendedResourcesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRecommendedResourcesResponse) ProtoMessage() {} + +func (x *ListRecommendedResourcesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRecommendedResourcesResponse.ProtoReflect.Descriptor instead. +func (*ListRecommendedResourcesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{8} +} + +func (x *ListRecommendedResourcesResponse) GetResources() []*Resource { + if x != nil { + return x.Resources + } + return nil +} + +type SetRecommendedResourcesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resources []*SetRecommendedResource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` +} + +func (x *SetRecommendedResourcesRequest) Reset() { + *x = SetRecommendedResourcesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetRecommendedResourcesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRecommendedResourcesRequest) ProtoMessage() {} + +func (x *SetRecommendedResourcesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRecommendedResourcesRequest.ProtoReflect.Descriptor instead. +func (*SetRecommendedResourcesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{9} +} + +func (x *SetRecommendedResourcesRequest) GetResources() []*SetRecommendedResource { + if x != nil { + return x.Resources + } + return nil +} + +type SetRecommendedResourcesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SetRecommendedResourcesResponse) Reset() { + *x = SetRecommendedResourcesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetRecommendedResourcesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRecommendedResourcesResponse) ProtoMessage() {} + +func (x *SetRecommendedResourcesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_recommendation_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRecommendedResourcesResponse.ProtoReflect.Descriptor instead. +func (*SetRecommendedResourcesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_recommendation_proto_rawDescGZIP(), []int{10} +} + +var File_registry_v1alpha1_recommendation_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_recommendation_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x1a, 0x20, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc5, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x22, 0x86, + 0x01, 0x0a, 0x13, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x49, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x42, 0x0a, 0x16, 0x53, 0x65, 0x74, 0x52, 0x65, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x1e, 0x52, + 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x87, 0x01, + 0x0a, 0x1f, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x64, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0x21, 0x0a, 0x1b, 0x52, 0x65, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x80, 0x01, 0x0a, 0x1c, 0x52, + 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x09, 0x74, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x09, + 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x21, 0x0a, + 0x1f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x75, 0x0a, 0x20, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x81, 0x01, 0x0a, 0x1e, 0x53, 0x65, 0x74, 0x52, + 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x5f, 0x0a, 0x09, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x21, 0x0a, 0x1f, 0x53, + 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf4, + 0x05, 0x0a, 0x15, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb5, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x69, 0x65, 0x73, 0x12, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, + 0x12, 0xaf, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, + 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, + 0x64, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0x88, 0x02, 0x01, 0x90, + 0x02, 0x01, 0x12, 0xb8, 0x01, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, + 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4b, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb5, 0x01, + 0x0a, 0x17, 0x53, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x64, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x02, 0x42, 0xee, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x13, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, + 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, + 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, + 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, + 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_recommendation_proto_rawDescOnce sync.Once + file_registry_v1alpha1_recommendation_proto_rawDescData = file_registry_v1alpha1_recommendation_proto_rawDesc +) + +func file_registry_v1alpha1_recommendation_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_recommendation_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_recommendation_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_recommendation_proto_rawDescData) + }) + return file_registry_v1alpha1_recommendation_proto_rawDescData +} + +var file_registry_v1alpha1_recommendation_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_registry_v1alpha1_recommendation_proto_goTypes = []interface{}{ + (*RecommendedRepository)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedRepository + (*RecommendedTemplate)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedTemplate + (*SetRecommendedResource)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.SetRecommendedResource + (*RecommendedRepositoriesRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedRepositoriesRequest + (*RecommendedRepositoriesResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedRepositoriesResponse + (*RecommendedTemplatesRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedTemplatesRequest + (*RecommendedTemplatesResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedTemplatesResponse + (*ListRecommendedResourcesRequest)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.ListRecommendedResourcesRequest + (*ListRecommendedResourcesResponse)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.ListRecommendedResourcesResponse + (*SetRecommendedResourcesRequest)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.SetRecommendedResourcesRequest + (*SetRecommendedResourcesResponse)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.SetRecommendedResourcesResponse + (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp + (*Resource)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.Resource +} +var file_registry_v1alpha1_recommendation_proto_depIdxs = []int32{ + 11, // 0: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedRepository.create_time:type_name -> google.protobuf.Timestamp + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedRepositoriesResponse.repositories:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RecommendedRepository + 1, // 2: bufman.dubbo.apache.org.registry.v1alpha1.RecommendedTemplatesResponse.templates:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RecommendedTemplate + 12, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListRecommendedResourcesResponse.resources:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Resource + 2, // 4: bufman.dubbo.apache.org.registry.v1alpha1.SetRecommendedResourcesRequest.resources:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.SetRecommendedResource + 3, // 5: bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedRepositories:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.RecommendedRepositoriesRequest + 5, // 6: bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedTemplates:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.RecommendedTemplatesRequest + 7, // 7: bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.ListRecommendedResources:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRecommendedResourcesRequest + 9, // 8: bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.SetRecommendedResources:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SetRecommendedResourcesRequest + 4, // 9: bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedRepositories:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.RecommendedRepositoriesResponse + 6, // 10: bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.RecommendedTemplates:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.RecommendedTemplatesResponse + 8, // 11: bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.ListRecommendedResources:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRecommendedResourcesResponse + 10, // 12: bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService.SetRecommendedResources:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SetRecommendedResourcesResponse + 9, // [9:13] is the sub-list for method output_type + 5, // [5:9] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_recommendation_proto_init() } +func file_registry_v1alpha1_recommendation_proto_init() { + if File_registry_v1alpha1_recommendation_proto != nil { + return + } + file_registry_v1alpha1_resource_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_recommendation_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecommendedRepository); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecommendedTemplate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetRecommendedResource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecommendedRepositoriesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecommendedRepositoriesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecommendedTemplatesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecommendedTemplatesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRecommendedResourcesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRecommendedResourcesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetRecommendedResourcesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_recommendation_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetRecommendedResourcesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_recommendation_proto_rawDesc, + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_recommendation_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_recommendation_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_recommendation_proto_msgTypes, + }.Build() + File_registry_v1alpha1_recommendation_proto = out.File + file_registry_v1alpha1_recommendation_proto_rawDesc = nil + file_registry_v1alpha1_recommendation_proto_goTypes = nil + file_registry_v1alpha1_recommendation_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/recommendation_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/recommendation_grpc.pb.go new file mode 100644 index 000000000..903532c6b --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/recommendation_grpc.pb.go @@ -0,0 +1,231 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/recommendation.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + RecommendationService_RecommendedRepositories_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/RecommendedRepositories" + RecommendationService_RecommendedTemplates_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/RecommendedTemplates" + RecommendationService_ListRecommendedResources_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/ListRecommendedResources" + RecommendationService_SetRecommendedResources_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService/SetRecommendedResources" +) + +// RecommendationServiceClient is the client API for RecommendationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type RecommendationServiceClient interface { + // RecommendedRepositories returns a list of recommended repositories. + RecommendedRepositories(ctx context.Context, in *RecommendedRepositoriesRequest, opts ...grpc.CallOption) (*RecommendedRepositoriesResponse, error) + // Deprecated: Do not use. + // RecommendedTemplates returns a list of recommended templates. + RecommendedTemplates(ctx context.Context, in *RecommendedTemplatesRequest, opts ...grpc.CallOption) (*RecommendedTemplatesResponse, error) + // ListRecommendedResources returns a list of recommended resources. + ListRecommendedResources(ctx context.Context, in *ListRecommendedResourcesRequest, opts ...grpc.CallOption) (*ListRecommendedResourcesResponse, error) + // SetRecommendedResources set the list of recommended resources in the server. + SetRecommendedResources(ctx context.Context, in *SetRecommendedResourcesRequest, opts ...grpc.CallOption) (*SetRecommendedResourcesResponse, error) +} + +type recommendationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRecommendationServiceClient(cc grpc.ClientConnInterface) RecommendationServiceClient { + return &recommendationServiceClient{cc} +} + +func (c *recommendationServiceClient) RecommendedRepositories(ctx context.Context, in *RecommendedRepositoriesRequest, opts ...grpc.CallOption) (*RecommendedRepositoriesResponse, error) { + out := new(RecommendedRepositoriesResponse) + err := c.cc.Invoke(ctx, RecommendationService_RecommendedRepositories_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *recommendationServiceClient) RecommendedTemplates(ctx context.Context, in *RecommendedTemplatesRequest, opts ...grpc.CallOption) (*RecommendedTemplatesResponse, error) { + out := new(RecommendedTemplatesResponse) + err := c.cc.Invoke(ctx, RecommendationService_RecommendedTemplates_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *recommendationServiceClient) ListRecommendedResources(ctx context.Context, in *ListRecommendedResourcesRequest, opts ...grpc.CallOption) (*ListRecommendedResourcesResponse, error) { + out := new(ListRecommendedResourcesResponse) + err := c.cc.Invoke(ctx, RecommendationService_ListRecommendedResources_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *recommendationServiceClient) SetRecommendedResources(ctx context.Context, in *SetRecommendedResourcesRequest, opts ...grpc.CallOption) (*SetRecommendedResourcesResponse, error) { + out := new(SetRecommendedResourcesResponse) + err := c.cc.Invoke(ctx, RecommendationService_SetRecommendedResources_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RecommendationServiceServer is the server API for RecommendationService service. +// All implementations must embed UnimplementedRecommendationServiceServer +// for forward compatibility +type RecommendationServiceServer interface { + // RecommendedRepositories returns a list of recommended repositories. + RecommendedRepositories(context.Context, *RecommendedRepositoriesRequest) (*RecommendedRepositoriesResponse, error) + // Deprecated: Do not use. + // RecommendedTemplates returns a list of recommended templates. + RecommendedTemplates(context.Context, *RecommendedTemplatesRequest) (*RecommendedTemplatesResponse, error) + // ListRecommendedResources returns a list of recommended resources. + ListRecommendedResources(context.Context, *ListRecommendedResourcesRequest) (*ListRecommendedResourcesResponse, error) + // SetRecommendedResources set the list of recommended resources in the server. + SetRecommendedResources(context.Context, *SetRecommendedResourcesRequest) (*SetRecommendedResourcesResponse, error) + mustEmbedUnimplementedRecommendationServiceServer() +} + +// UnimplementedRecommendationServiceServer must be embedded to have forward compatible implementations. +type UnimplementedRecommendationServiceServer struct { +} + +func (UnimplementedRecommendationServiceServer) RecommendedRepositories(context.Context, *RecommendedRepositoriesRequest) (*RecommendedRepositoriesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RecommendedRepositories not implemented") +} +func (UnimplementedRecommendationServiceServer) RecommendedTemplates(context.Context, *RecommendedTemplatesRequest) (*RecommendedTemplatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RecommendedTemplates not implemented") +} +func (UnimplementedRecommendationServiceServer) ListRecommendedResources(context.Context, *ListRecommendedResourcesRequest) (*ListRecommendedResourcesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRecommendedResources not implemented") +} +func (UnimplementedRecommendationServiceServer) SetRecommendedResources(context.Context, *SetRecommendedResourcesRequest) (*SetRecommendedResourcesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetRecommendedResources not implemented") +} +func (UnimplementedRecommendationServiceServer) mustEmbedUnimplementedRecommendationServiceServer() {} + +// UnsafeRecommendationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RecommendationServiceServer will +// result in compilation errors. +type UnsafeRecommendationServiceServer interface { + mustEmbedUnimplementedRecommendationServiceServer() +} + +func RegisterRecommendationServiceServer(s grpc.ServiceRegistrar, srv RecommendationServiceServer) { + s.RegisterService(&RecommendationService_ServiceDesc, srv) +} + +func _RecommendationService_RecommendedRepositories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RecommendedRepositoriesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RecommendationServiceServer).RecommendedRepositories(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RecommendationService_RecommendedRepositories_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RecommendationServiceServer).RecommendedRepositories(ctx, req.(*RecommendedRepositoriesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RecommendationService_RecommendedTemplates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RecommendedTemplatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RecommendationServiceServer).RecommendedTemplates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RecommendationService_RecommendedTemplates_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RecommendationServiceServer).RecommendedTemplates(ctx, req.(*RecommendedTemplatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RecommendationService_ListRecommendedResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRecommendedResourcesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RecommendationServiceServer).ListRecommendedResources(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RecommendationService_ListRecommendedResources_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RecommendationServiceServer).ListRecommendedResources(ctx, req.(*ListRecommendedResourcesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RecommendationService_SetRecommendedResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetRecommendedResourcesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RecommendationServiceServer).SetRecommendedResources(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RecommendationService_SetRecommendedResources_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RecommendationServiceServer).SetRecommendedResources(ctx, req.(*SetRecommendedResourcesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RecommendationService_ServiceDesc is the grpc.ServiceDesc for RecommendationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RecommendationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.RecommendationService", + HandlerType: (*RecommendationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RecommendedRepositories", + Handler: _RecommendationService_RecommendedRepositories_Handler, + }, + { + MethodName: "RecommendedTemplates", + Handler: _RecommendationService_RecommendedTemplates_Handler, + }, + { + MethodName: "ListRecommendedResources", + Handler: _RecommendationService_ListRecommendedResources_Handler, + }, + { + MethodName: "SetRecommendedResources", + Handler: _RecommendationService_SetRecommendedResources_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/recommendation.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/reference.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/reference.pb.go new file mode 100644 index 000000000..c331eba3f --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/reference.pb.go @@ -0,0 +1,791 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/reference.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Reference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Reference: + // + // *Reference_Tag + // *Reference_Commit + // *Reference_Main + // *Reference_Draft + Reference isReference_Reference `protobuf_oneof:"reference"` +} + +func (x *Reference) Reset() { + *x = Reference{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Reference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Reference) ProtoMessage() {} + +func (x *Reference) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Reference.ProtoReflect.Descriptor instead. +func (*Reference) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{0} +} + +func (m *Reference) GetReference() isReference_Reference { + if m != nil { + return m.Reference + } + return nil +} + +func (x *Reference) GetTag() *RepositoryTag { + if x, ok := x.GetReference().(*Reference_Tag); ok { + return x.Tag + } + return nil +} + +func (x *Reference) GetCommit() *RepositoryCommit { + if x, ok := x.GetReference().(*Reference_Commit); ok { + return x.Commit + } + return nil +} + +func (x *Reference) GetMain() *RepositoryMainReference { + if x, ok := x.GetReference().(*Reference_Main); ok { + return x.Main + } + return nil +} + +func (x *Reference) GetDraft() *RepositoryDraft { + if x, ok := x.GetReference().(*Reference_Draft); ok { + return x.Draft + } + return nil +} + +type isReference_Reference interface { + isReference_Reference() +} + +type Reference_Tag struct { + // The requested reference is a tag. + Tag *RepositoryTag `protobuf:"bytes,2,opt,name=tag,proto3,oneof"` +} + +type Reference_Commit struct { + // The requested reference is a commit. + Commit *RepositoryCommit `protobuf:"bytes,3,opt,name=commit,proto3,oneof"` +} + +type Reference_Main struct { + // The requested reference is the default reference. + Main *RepositoryMainReference `protobuf:"bytes,5,opt,name=main,proto3,oneof"` +} + +type Reference_Draft struct { + // The requested reference is a draft commit. + Draft *RepositoryDraft `protobuf:"bytes,6,opt,name=draft,proto3,oneof"` +} + +func (*Reference_Tag) isReference_Reference() {} + +func (*Reference_Commit) isReference_Reference() {} + +func (*Reference_Main) isReference_Reference() {} + +func (*Reference_Draft) isReference_Reference() {} + +type RepositoryMainReference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name is always 'main'. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The latest commit in this repository. If the repository has no commits, + // this will be empty. + Commit *RepositoryCommit `protobuf:"bytes,2,opt,name=commit,proto3" json:"commit,omitempty"` +} + +func (x *RepositoryMainReference) Reset() { + *x = RepositoryMainReference{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryMainReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryMainReference) ProtoMessage() {} + +func (x *RepositoryMainReference) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryMainReference.ProtoReflect.Descriptor instead. +func (*RepositoryMainReference) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{1} +} + +func (x *RepositoryMainReference) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RepositoryMainReference) GetCommit() *RepositoryCommit { + if x != nil { + return x.Commit + } + return nil +} + +type RepositoryDraft struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the draft + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The commit this draft points to. + Commit *RepositoryCommit `protobuf:"bytes,2,opt,name=commit,proto3" json:"commit,omitempty"` +} + +func (x *RepositoryDraft) Reset() { + *x = RepositoryDraft{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryDraft) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryDraft) ProtoMessage() {} + +func (x *RepositoryDraft) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryDraft.ProtoReflect.Descriptor instead. +func (*RepositoryDraft) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{2} +} + +func (x *RepositoryDraft) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RepositoryDraft) GetCommit() *RepositoryCommit { + if x != nil { + return x.Commit + } + return nil +} + +type GetReferenceByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the requested reference. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Owner of the repository the reference belongs to. + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + // Name of the repository the reference belongs to. + RepositoryName string `protobuf:"bytes,3,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` +} + +func (x *GetReferenceByNameRequest) Reset() { + *x = GetReferenceByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetReferenceByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetReferenceByNameRequest) ProtoMessage() {} + +func (x *GetReferenceByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetReferenceByNameRequest.ProtoReflect.Descriptor instead. +func (*GetReferenceByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{3} +} + +func (x *GetReferenceByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetReferenceByNameRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetReferenceByNameRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +type GetReferenceByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Reference *Reference `protobuf:"bytes,1,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *GetReferenceByNameResponse) Reset() { + *x = GetReferenceByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetReferenceByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetReferenceByNameResponse) ProtoMessage() {} + +func (x *GetReferenceByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetReferenceByNameResponse.ProtoReflect.Descriptor instead. +func (*GetReferenceByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{4} +} + +func (x *GetReferenceByNameResponse) GetReference() *Reference { + if x != nil { + return x.Reference + } + return nil +} + +type ListGitCommitMetadataForReferenceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // String that represents the name of the reference. + Reference string `protobuf:"bytes,1,opt,name=reference,proto3" json:"reference,omitempty"` + // Owner of the repository the reference belongs to. + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + // Name of the repository the reference belongs to. + RepositoryName string `protobuf:"bytes,3,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` +} + +func (x *ListGitCommitMetadataForReferenceRequest) Reset() { + *x = ListGitCommitMetadataForReferenceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListGitCommitMetadataForReferenceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListGitCommitMetadataForReferenceRequest) ProtoMessage() {} + +func (x *ListGitCommitMetadataForReferenceRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListGitCommitMetadataForReferenceRequest.ProtoReflect.Descriptor instead. +func (*ListGitCommitMetadataForReferenceRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{5} +} + +func (x *ListGitCommitMetadataForReferenceRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +func (x *ListGitCommitMetadataForReferenceRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ListGitCommitMetadataForReferenceRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +type ListGitCommitMetadataForReferenceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID of the BSR commit the reference resolved to. + CommitId string `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` + // List of git commits and metadata associated with the resolved reference. + GitCommitMetadatas []*GitCommitMetadata `protobuf:"bytes,2,rep,name=git_commit_metadatas,json=gitCommitMetadatas,proto3" json:"git_commit_metadatas,omitempty"` +} + +func (x *ListGitCommitMetadataForReferenceResponse) Reset() { + *x = ListGitCommitMetadataForReferenceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListGitCommitMetadataForReferenceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListGitCommitMetadataForReferenceResponse) ProtoMessage() {} + +func (x *ListGitCommitMetadataForReferenceResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_reference_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListGitCommitMetadataForReferenceResponse.ProtoReflect.Descriptor instead. +func (*ListGitCommitMetadataForReferenceResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{6} +} + +func (x *ListGitCommitMetadataForReferenceResponse) GetCommitId() string { + if x != nil { + return x.CommitId + } + return "" +} + +func (x *ListGitCommitMetadataForReferenceResponse) GetGitCommitMetadatas() []*GitCommitMetadata { + if x != nil { + return x.GitCommitMetadatas + } + return nil +} + +var File_registry_v1alpha1_reference_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_reference_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x24, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2f, 0x67, 0x69, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x26, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x61, + 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x86, 0x03, 0x0a, 0x09, 0x52, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x48, 0x00, 0x52, 0x03, + 0x74, 0x61, 0x67, 0x12, 0x55, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x58, 0x0a, 0x04, 0x6d, 0x61, + 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4d, + 0x61, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x04, + 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x52, 0x0a, 0x05, 0x64, 0x72, 0x61, 0x66, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, 0x48, + 0x00, 0x52, 0x05, 0x64, 0x72, 0x61, 0x66, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, + 0x05, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, + 0x22, 0x82, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4d, + 0x61, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x53, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x06, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x7a, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x53, 0x0a, 0x06, + 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x22, 0x6e, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, + 0x65, 0x22, 0x70, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x52, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x28, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x69, 0x74, 0x43, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x46, 0x6f, 0x72, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xb8, 0x01, + 0x0a, 0x29, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x46, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x12, 0x6e, 0x0a, 0x14, 0x67, 0x69, 0x74, 0x5f, + 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x52, 0x12, 0x67, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x73, 0x32, 0x91, 0x03, 0x0a, 0x10, 0x52, 0x65, 0x66, + 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa6, 0x01, + 0x0a, 0x12, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x79, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xd3, 0x01, 0x0a, 0x21, 0x4c, 0x69, 0x73, 0x74, 0x47, + 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x46, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x53, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x69, 0x74, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x46, 0x6f, + 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x54, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x46, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe9, 0x02, 0x0a, + 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0e, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, + 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, + 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, + 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, + 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_reference_proto_rawDescOnce sync.Once + file_registry_v1alpha1_reference_proto_rawDescData = file_registry_v1alpha1_reference_proto_rawDesc +) + +func file_registry_v1alpha1_reference_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_reference_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_reference_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_reference_proto_rawDescData) + }) + return file_registry_v1alpha1_reference_proto_rawDescData +} + +var file_registry_v1alpha1_reference_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_registry_v1alpha1_reference_proto_goTypes = []interface{}{ + (*Reference)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.Reference + (*RepositoryMainReference)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryMainReference + (*RepositoryDraft)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryDraft + (*GetReferenceByNameRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetReferenceByNameRequest + (*GetReferenceByNameResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.GetReferenceByNameResponse + (*ListGitCommitMetadataForReferenceRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.ListGitCommitMetadataForReferenceRequest + (*ListGitCommitMetadataForReferenceResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.ListGitCommitMetadataForReferenceResponse + (*RepositoryTag)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + (*RepositoryCommit)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + (*GitCommitMetadata)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.GitCommitMetadata +} +var file_registry_v1alpha1_reference_proto_depIdxs = []int32{ + 7, // 0: bufman.dubbo.apache.org.registry.v1alpha1.Reference.tag:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + 8, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Reference.commit:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 1, // 2: bufman.dubbo.apache.org.registry.v1alpha1.Reference.main:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryMainReference + 2, // 3: bufman.dubbo.apache.org.registry.v1alpha1.Reference.draft:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryDraft + 8, // 4: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryMainReference.commit:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 8, // 5: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryDraft.commit:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 0, // 6: bufman.dubbo.apache.org.registry.v1alpha1.GetReferenceByNameResponse.reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Reference + 9, // 7: bufman.dubbo.apache.org.registry.v1alpha1.ListGitCommitMetadataForReferenceResponse.git_commit_metadatas:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GitCommitMetadata + 3, // 8: bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.GetReferenceByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetReferenceByNameRequest + 5, // 9: bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.ListGitCommitMetadataForReference:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListGitCommitMetadataForReferenceRequest + 4, // 10: bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.GetReferenceByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetReferenceByNameResponse + 6, // 11: bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService.ListGitCommitMetadataForReference:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListGitCommitMetadataForReferenceResponse + 10, // [10:12] is the sub-list for method output_type + 8, // [8:10] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_reference_proto_init() } +func file_registry_v1alpha1_reference_proto_init() { + if File_registry_v1alpha1_reference_proto != nil { + return + } + file_registry_v1alpha1_git_metadata_proto_init() + file_registry_v1alpha1_repository_commit_proto_init() + file_registry_v1alpha1_repository_tag_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_reference_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Reference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_reference_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryMainReference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_reference_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryDraft); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_reference_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetReferenceByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_reference_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetReferenceByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_reference_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListGitCommitMetadataForReferenceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_reference_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListGitCommitMetadataForReferenceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_reference_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Reference_Tag)(nil), + (*Reference_Commit)(nil), + (*Reference_Main)(nil), + (*Reference_Draft)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_reference_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_reference_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_reference_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_reference_proto_msgTypes, + }.Build() + File_registry_v1alpha1_reference_proto = out.File + file_registry_v1alpha1_reference_proto_rawDesc = nil + file_registry_v1alpha1_reference_proto_goTypes = nil + file_registry_v1alpha1_reference_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/reference_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/reference_grpc.pb.go new file mode 100644 index 000000000..8496c68cd --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/reference_grpc.pb.go @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/reference.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + ReferenceService_GetReferenceByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService/GetReferenceByName" + ReferenceService_ListGitCommitMetadataForReference_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService/ListGitCommitMetadataForReference" +) + +// ReferenceServiceClient is the client API for ReferenceService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ReferenceServiceClient interface { + // GetReferenceByName takes a reference name and returns the + // reference either as 'main', a tag, or commit. + GetReferenceByName(ctx context.Context, in *GetReferenceByNameRequest, opts ...grpc.CallOption) (*GetReferenceByNameResponse, error) + // ListGitCommitMetadataForReference takes a string reference and returns all the git commit + // metadata associated with the resolved reference commit. + ListGitCommitMetadataForReference(ctx context.Context, in *ListGitCommitMetadataForReferenceRequest, opts ...grpc.CallOption) (*ListGitCommitMetadataForReferenceResponse, error) +} + +type referenceServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewReferenceServiceClient(cc grpc.ClientConnInterface) ReferenceServiceClient { + return &referenceServiceClient{cc} +} + +func (c *referenceServiceClient) GetReferenceByName(ctx context.Context, in *GetReferenceByNameRequest, opts ...grpc.CallOption) (*GetReferenceByNameResponse, error) { + out := new(GetReferenceByNameResponse) + err := c.cc.Invoke(ctx, ReferenceService_GetReferenceByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *referenceServiceClient) ListGitCommitMetadataForReference(ctx context.Context, in *ListGitCommitMetadataForReferenceRequest, opts ...grpc.CallOption) (*ListGitCommitMetadataForReferenceResponse, error) { + out := new(ListGitCommitMetadataForReferenceResponse) + err := c.cc.Invoke(ctx, ReferenceService_ListGitCommitMetadataForReference_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ReferenceServiceServer is the server API for ReferenceService service. +// All implementations must embed UnimplementedReferenceServiceServer +// for forward compatibility +type ReferenceServiceServer interface { + // GetReferenceByName takes a reference name and returns the + // reference either as 'main', a tag, or commit. + GetReferenceByName(context.Context, *GetReferenceByNameRequest) (*GetReferenceByNameResponse, error) + // ListGitCommitMetadataForReference takes a string reference and returns all the git commit + // metadata associated with the resolved reference commit. + ListGitCommitMetadataForReference(context.Context, *ListGitCommitMetadataForReferenceRequest) (*ListGitCommitMetadataForReferenceResponse, error) + mustEmbedUnimplementedReferenceServiceServer() +} + +// UnimplementedReferenceServiceServer must be embedded to have forward compatible implementations. +type UnimplementedReferenceServiceServer struct { +} + +func (UnimplementedReferenceServiceServer) GetReferenceByName(context.Context, *GetReferenceByNameRequest) (*GetReferenceByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetReferenceByName not implemented") +} +func (UnimplementedReferenceServiceServer) ListGitCommitMetadataForReference(context.Context, *ListGitCommitMetadataForReferenceRequest) (*ListGitCommitMetadataForReferenceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListGitCommitMetadataForReference not implemented") +} +func (UnimplementedReferenceServiceServer) mustEmbedUnimplementedReferenceServiceServer() {} + +// UnsafeReferenceServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ReferenceServiceServer will +// result in compilation errors. +type UnsafeReferenceServiceServer interface { + mustEmbedUnimplementedReferenceServiceServer() +} + +func RegisterReferenceServiceServer(s grpc.ServiceRegistrar, srv ReferenceServiceServer) { + s.RegisterService(&ReferenceService_ServiceDesc, srv) +} + +func _ReferenceService_GetReferenceByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetReferenceByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReferenceServiceServer).GetReferenceByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReferenceService_GetReferenceByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReferenceServiceServer).GetReferenceByName(ctx, req.(*GetReferenceByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ReferenceService_ListGitCommitMetadataForReference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListGitCommitMetadataForReferenceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReferenceServiceServer).ListGitCommitMetadataForReference(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ReferenceService_ListGitCommitMetadataForReference_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReferenceServiceServer).ListGitCommitMetadataForReference(ctx, req.(*ListGitCommitMetadataForReferenceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ReferenceService_ServiceDesc is the grpc.ServiceDesc for ReferenceService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ReferenceService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.ReferenceService", + HandlerType: (*ReferenceServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetReferenceByName", + Handler: _ReferenceService_GetReferenceByName_Handler, + }, + { + MethodName: "ListGitCommitMetadataForReference", + Handler: _ReferenceService_ListGitCommitMetadataForReference_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/reference.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/repository.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository.pb.go new file mode 100644 index 000000000..eb50db79e --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository.pb.go @@ -0,0 +1,3657 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/repository.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Visibility int32 + +const ( + Visibility_VISIBILITY_UNSPECIFIED Visibility = 0 + Visibility_VISIBILITY_PUBLIC Visibility = 1 + Visibility_VISIBILITY_PRIVATE Visibility = 2 +) + +// Enum value maps for Visibility. +var ( + Visibility_name = map[int32]string{ + 0: "VISIBILITY_UNSPECIFIED", + 1: "VISIBILITY_PUBLIC", + 2: "VISIBILITY_PRIVATE", + } + Visibility_value = map[string]int32{ + "VISIBILITY_UNSPECIFIED": 0, + "VISIBILITY_PUBLIC": 1, + "VISIBILITY_PRIVATE": 2, + } +) + +func (x Visibility) Enum() *Visibility { + p := new(Visibility) + *p = x + return p +} + +func (x Visibility) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Visibility) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_repository_proto_enumTypes[0].Descriptor() +} + +func (Visibility) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_repository_proto_enumTypes[0] +} + +func (x Visibility) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Visibility.Descriptor instead. +func (Visibility) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{0} +} + +type Repository struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // primary key, unique, immutable + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // immutable + CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // mutable + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + // unique, mutable + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // Types that are assignable to Owner: + // + // *Repository_UserId + // *Repository_OrganizationId + Owner isRepository_Owner `protobuf_oneof:"owner"` + Visibility Visibility `protobuf:"varint,7,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Visibility" json:"visibility,omitempty"` + // deprecated means this repository is deprecated. + Deprecated bool `protobuf:"varint,8,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + // deprecation_message is the message shown if the repository is deprecated. + DeprecationMessage string `protobuf:"bytes,9,opt,name=deprecation_message,json=deprecationMessage,proto3" json:"deprecation_message,omitempty"` + // owner_name is the name of the owner of the repository, + // either a username or organization name. + OwnerName string `protobuf:"bytes,10,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // description is the user configurable description of the repository. + Description string `protobuf:"bytes,11,opt,name=description,proto3" json:"description,omitempty"` + // url is the user configurable URL in the description of the repository, + // always included the scheme and will not have a #fragment suffix. + Url string `protobuf:"bytes,12,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *Repository) Reset() { + *x = Repository{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Repository) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Repository) ProtoMessage() {} + +func (x *Repository) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Repository.ProtoReflect.Descriptor instead. +func (*Repository) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{0} +} + +func (x *Repository) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Repository) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *Repository) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +func (x *Repository) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (m *Repository) GetOwner() isRepository_Owner { + if m != nil { + return m.Owner + } + return nil +} + +func (x *Repository) GetUserId() string { + if x, ok := x.GetOwner().(*Repository_UserId); ok { + return x.UserId + } + return "" +} + +func (x *Repository) GetOrganizationId() string { + if x, ok := x.GetOwner().(*Repository_OrganizationId); ok { + return x.OrganizationId + } + return "" +} + +func (x *Repository) GetVisibility() Visibility { + if x != nil { + return x.Visibility + } + return Visibility_VISIBILITY_UNSPECIFIED +} + +func (x *Repository) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +func (x *Repository) GetDeprecationMessage() string { + if x != nil { + return x.DeprecationMessage + } + return "" +} + +func (x *Repository) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *Repository) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Repository) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type isRepository_Owner interface { + isRepository_Owner() +} + +type Repository_UserId struct { + // foreign key, mutable + UserId string `protobuf:"bytes,5,opt,name=user_id,json=userId,proto3,oneof"` +} + +type Repository_OrganizationId struct { + // foreign key, mutable + OrganizationId string `protobuf:"bytes,6,opt,name=organization_id,json=organizationId,proto3,oneof"` +} + +func (*Repository_UserId) isRepository_Owner() {} + +func (*Repository_OrganizationId) isRepository_Owner() {} + +type RepositoryCounts struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TagsCount uint32 `protobuf:"varint,1,opt,name=tags_count,json=tagsCount,proto3" json:"tags_count,omitempty"` + DraftsCount uint32 `protobuf:"varint,3,opt,name=drafts_count,json=draftsCount,proto3" json:"drafts_count,omitempty"` +} + +func (x *RepositoryCounts) Reset() { + *x = RepositoryCounts{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryCounts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryCounts) ProtoMessage() {} + +func (x *RepositoryCounts) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryCounts.ProtoReflect.Descriptor instead. +func (*RepositoryCounts) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{1} +} + +func (x *RepositoryCounts) GetTagsCount() uint32 { + if x != nil { + return x.TagsCount + } + return 0 +} + +func (x *RepositoryCounts) GetDraftsCount() uint32 { + if x != nil { + return x.DraftsCount + } + return 0 +} + +type RepositoryContributor struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + // The ID of the for which the role belongs to. + RepositoryId string `protobuf:"bytes,2,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // The role that the user has been explicitly assigned against the repository. + ExplicitRole RepositoryRole `protobuf:"varint,3,opt,name=explicit_role,json=explicitRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"explicit_role,omitempty"` + // Optionally defines the role that the user has implicitly against the repository through the owning organization. + // If the repository does not belong to an organization or the user is not part of the owning organization, this is unset. + ImplicitRole RepositoryRole `protobuf:"varint,4,opt,name=implicit_role,json=implicitRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"implicit_role,omitempty"` +} + +func (x *RepositoryContributor) Reset() { + *x = RepositoryContributor{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryContributor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryContributor) ProtoMessage() {} + +func (x *RepositoryContributor) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryContributor.ProtoReflect.Descriptor instead. +func (*RepositoryContributor) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{2} +} + +func (x *RepositoryContributor) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +func (x *RepositoryContributor) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *RepositoryContributor) GetExplicitRole() RepositoryRole { + if x != nil { + return x.ExplicitRole + } + return RepositoryRole_REPOSITORY_ROLE_UNSPECIFIED +} + +func (x *RepositoryContributor) GetImplicitRole() RepositoryRole { + if x != nil { + return x.ImplicitRole + } + return RepositoryRole_REPOSITORY_ROLE_UNSPECIFIED +} + +type RepositoryMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the repository. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The owner name of the repository. + OwnerName string `protobuf:"bytes,3,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // The verification status of the owner of the repository. + OwnerVerificationStatus VerificationStatus `protobuf:"varint,4,opt,name=owner_verification_status,json=ownerVerificationStatus,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus" json:"owner_verification_status,omitempty"` + // The commit time of the latest main commit in the repository. + LatestCommitTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=latest_commit_time,json=latestCommitTime,proto3" json:"latest_commit_time,omitempty"` + // The SPDX license ID of the latest main commit in the repository. + LatestSpdxLicenseId string `protobuf:"bytes,6,opt,name=latest_spdx_license_id,json=latestSpdxLicenseId,proto3" json:"latest_spdx_license_id,omitempty"` +} + +func (x *RepositoryMetadata) Reset() { + *x = RepositoryMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryMetadata) ProtoMessage() {} + +func (x *RepositoryMetadata) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryMetadata.ProtoReflect.Descriptor instead. +func (*RepositoryMetadata) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{3} +} + +func (x *RepositoryMetadata) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RepositoryMetadata) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RepositoryMetadata) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *RepositoryMetadata) GetOwnerVerificationStatus() VerificationStatus { + if x != nil { + return x.OwnerVerificationStatus + } + return VerificationStatus_VERIFICATION_STATUS_UNSPECIFIED +} + +func (x *RepositoryMetadata) GetLatestCommitTime() *timestamppb.Timestamp { + if x != nil { + return x.LatestCommitTime + } + return nil +} + +func (x *RepositoryMetadata) GetLatestSpdxLicenseId() string { + if x != nil { + return x.LatestSpdxLicenseId + } + return "" +} + +type GetRepositoriesByFullNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // minimum length is 1 + // maximum length is 250 + FullNames []string `protobuf:"bytes,1,rep,name=full_names,json=fullNames,proto3" json:"full_names,omitempty"` +} + +func (x *GetRepositoriesByFullNameRequest) Reset() { + *x = GetRepositoriesByFullNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoriesByFullNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoriesByFullNameRequest) ProtoMessage() {} + +func (x *GetRepositoriesByFullNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoriesByFullNameRequest.ProtoReflect.Descriptor instead. +func (*GetRepositoriesByFullNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{4} +} + +func (x *GetRepositoriesByFullNameRequest) GetFullNames() []string { + if x != nil { + return x.FullNames + } + return nil +} + +type GetRepositoriesByFullNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repositories []*Repository `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"` +} + +func (x *GetRepositoriesByFullNameResponse) Reset() { + *x = GetRepositoriesByFullNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoriesByFullNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoriesByFullNameResponse) ProtoMessage() {} + +func (x *GetRepositoriesByFullNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoriesByFullNameResponse.ProtoReflect.Descriptor instead. +func (*GetRepositoriesByFullNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{5} +} + +func (x *GetRepositoriesByFullNameResponse) GetRepositories() []*Repository { + if x != nil { + return x.Repositories + } + return nil +} + +type GetRepositoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetRepositoryRequest) Reset() { + *x = GetRepositoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryRequest) ProtoMessage() {} + +func (x *GetRepositoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryRequest.ProtoReflect.Descriptor instead. +func (*GetRepositoryRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{6} +} + +func (x *GetRepositoryRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetRepositoryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"` + Counts *RepositoryCounts `protobuf:"bytes,2,opt,name=counts,proto3" json:"counts,omitempty"` +} + +func (x *GetRepositoryResponse) Reset() { + *x = GetRepositoryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryResponse) ProtoMessage() {} + +func (x *GetRepositoryResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryResponse.ProtoReflect.Descriptor instead. +func (*GetRepositoryResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{7} +} + +func (x *GetRepositoryResponse) GetRepository() *Repository { + if x != nil { + return x.Repository + } + return nil +} + +func (x *GetRepositoryResponse) GetCounts() *RepositoryCounts { + if x != nil { + return x.Counts + } + return nil +} + +type GetRepositoryByFullNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FullName string `protobuf:"bytes,1,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` +} + +func (x *GetRepositoryByFullNameRequest) Reset() { + *x = GetRepositoryByFullNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryByFullNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryByFullNameRequest) ProtoMessage() {} + +func (x *GetRepositoryByFullNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryByFullNameRequest.ProtoReflect.Descriptor instead. +func (*GetRepositoryByFullNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{8} +} + +func (x *GetRepositoryByFullNameRequest) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +type GetRepositoryByFullNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"` + Counts *RepositoryCounts `protobuf:"bytes,2,opt,name=counts,proto3" json:"counts,omitempty"` +} + +func (x *GetRepositoryByFullNameResponse) Reset() { + *x = GetRepositoryByFullNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryByFullNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryByFullNameResponse) ProtoMessage() {} + +func (x *GetRepositoryByFullNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryByFullNameResponse.ProtoReflect.Descriptor instead. +func (*GetRepositoryByFullNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{9} +} + +func (x *GetRepositoryByFullNameResponse) GetRepository() *Repository { + if x != nil { + return x.Repository + } + return nil +} + +func (x *GetRepositoryByFullNameResponse) GetCounts() *RepositoryCounts { + if x != nil { + return x.Counts + } + return nil +} + +type ListRepositoriesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListRepositoriesRequest) Reset() { + *x = ListRepositoriesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoriesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoriesRequest) ProtoMessage() {} + +func (x *ListRepositoriesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoriesRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoriesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{10} +} + +func (x *ListRepositoriesRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoriesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListRepositoriesRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListRepositoriesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repositories []*Repository `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoriesResponse) Reset() { + *x = ListRepositoriesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoriesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoriesResponse) ProtoMessage() {} + +func (x *ListRepositoriesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoriesResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoriesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{11} +} + +func (x *ListRepositoriesResponse) GetRepositories() []*Repository { + if x != nil { + return x.Repositories + } + return nil +} + +func (x *ListRepositoriesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListUserRepositoriesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the user whose repositories should be listed. + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListUserRepositoriesRequest) Reset() { + *x = ListUserRepositoriesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserRepositoriesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserRepositoriesRequest) ProtoMessage() {} + +func (x *ListUserRepositoriesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserRepositoriesRequest.ProtoReflect.Descriptor instead. +func (*ListUserRepositoriesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{12} +} + +func (x *ListUserRepositoriesRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ListUserRepositoriesRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUserRepositoriesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListUserRepositoriesRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListUserRepositoriesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repositories []*Repository `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListUserRepositoriesResponse) Reset() { + *x = ListUserRepositoriesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserRepositoriesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserRepositoriesResponse) ProtoMessage() {} + +func (x *ListUserRepositoriesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserRepositoriesResponse.ProtoReflect.Descriptor instead. +func (*ListUserRepositoriesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{13} +} + +func (x *ListUserRepositoriesResponse) GetRepositories() []*Repository { + if x != nil { + return x.Repositories + } + return nil +} + +func (x *ListUserRepositoriesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListRepositoriesUserCanAccessRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListRepositoriesUserCanAccessRequest) Reset() { + *x = ListRepositoriesUserCanAccessRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoriesUserCanAccessRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoriesUserCanAccessRequest) ProtoMessage() {} + +func (x *ListRepositoriesUserCanAccessRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoriesUserCanAccessRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoriesUserCanAccessRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{14} +} + +func (x *ListRepositoriesUserCanAccessRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoriesUserCanAccessRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListRepositoriesUserCanAccessRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListRepositoriesUserCanAccessResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repositories []*Repository `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoriesUserCanAccessResponse) Reset() { + *x = ListRepositoriesUserCanAccessResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoriesUserCanAccessResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoriesUserCanAccessResponse) ProtoMessage() {} + +func (x *ListRepositoriesUserCanAccessResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoriesUserCanAccessResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoriesUserCanAccessResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{15} +} + +func (x *ListRepositoriesUserCanAccessResponse) GetRepositories() []*Repository { + if x != nil { + return x.Repositories + } + return nil +} + +func (x *ListRepositoriesUserCanAccessResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListOrganizationRepositoriesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the organization whose repositories should be listed. + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListOrganizationRepositoriesRequest) Reset() { + *x = ListOrganizationRepositoriesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationRepositoriesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationRepositoriesRequest) ProtoMessage() {} + +func (x *ListOrganizationRepositoriesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationRepositoriesRequest.ProtoReflect.Descriptor instead. +func (*ListOrganizationRepositoriesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{16} +} + +func (x *ListOrganizationRepositoriesRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *ListOrganizationRepositoriesRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListOrganizationRepositoriesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListOrganizationRepositoriesRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListOrganizationRepositoriesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repositories []*Repository `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListOrganizationRepositoriesResponse) Reset() { + *x = ListOrganizationRepositoriesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationRepositoriesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationRepositoriesResponse) ProtoMessage() {} + +func (x *ListOrganizationRepositoriesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationRepositoriesResponse.ProtoReflect.Descriptor instead. +func (*ListOrganizationRepositoriesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{17} +} + +func (x *ListOrganizationRepositoriesResponse) GetRepositories() []*Repository { + if x != nil { + return x.Repositories + } + return nil +} + +func (x *ListOrganizationRepositoriesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type CreateRepositoryByFullNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Must be unique across repositories. + FullName string `protobuf:"bytes,1,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` + Visibility Visibility `protobuf:"varint,2,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Visibility" json:"visibility,omitempty"` +} + +func (x *CreateRepositoryByFullNameRequest) Reset() { + *x = CreateRepositoryByFullNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRepositoryByFullNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRepositoryByFullNameRequest) ProtoMessage() {} + +func (x *CreateRepositoryByFullNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRepositoryByFullNameRequest.ProtoReflect.Descriptor instead. +func (*CreateRepositoryByFullNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{18} +} + +func (x *CreateRepositoryByFullNameRequest) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +func (x *CreateRepositoryByFullNameRequest) GetVisibility() Visibility { + if x != nil { + return x.Visibility + } + return Visibility_VISIBILITY_UNSPECIFIED +} + +type CreateRepositoryByFullNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"` +} + +func (x *CreateRepositoryByFullNameResponse) Reset() { + *x = CreateRepositoryByFullNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRepositoryByFullNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRepositoryByFullNameResponse) ProtoMessage() {} + +func (x *CreateRepositoryByFullNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRepositoryByFullNameResponse.ProtoReflect.Descriptor instead. +func (*CreateRepositoryByFullNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{19} +} + +func (x *CreateRepositoryByFullNameResponse) GetRepository() *Repository { + if x != nil { + return x.Repository + } + return nil +} + +type DeleteRepositoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteRepositoryRequest) Reset() { + *x = DeleteRepositoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRepositoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRepositoryRequest) ProtoMessage() {} + +func (x *DeleteRepositoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRepositoryRequest.ProtoReflect.Descriptor instead. +func (*DeleteRepositoryRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{20} +} + +func (x *DeleteRepositoryRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeleteRepositoryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteRepositoryResponse) Reset() { + *x = DeleteRepositoryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRepositoryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRepositoryResponse) ProtoMessage() {} + +func (x *DeleteRepositoryResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRepositoryResponse.ProtoReflect.Descriptor instead. +func (*DeleteRepositoryResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{21} +} + +type DeleteRepositoryByFullNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FullName string `protobuf:"bytes,1,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"` +} + +func (x *DeleteRepositoryByFullNameRequest) Reset() { + *x = DeleteRepositoryByFullNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRepositoryByFullNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRepositoryByFullNameRequest) ProtoMessage() {} + +func (x *DeleteRepositoryByFullNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRepositoryByFullNameRequest.ProtoReflect.Descriptor instead. +func (*DeleteRepositoryByFullNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{22} +} + +func (x *DeleteRepositoryByFullNameRequest) GetFullName() string { + if x != nil { + return x.FullName + } + return "" +} + +type DeleteRepositoryByFullNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteRepositoryByFullNameResponse) Reset() { + *x = DeleteRepositoryByFullNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRepositoryByFullNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRepositoryByFullNameResponse) ProtoMessage() {} + +func (x *DeleteRepositoryByFullNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRepositoryByFullNameResponse.ProtoReflect.Descriptor instead. +func (*DeleteRepositoryByFullNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{23} +} + +type DeprecateRepositoryByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OwnerName string `protobuf:"bytes,1,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // A message shown along with the deprecation warning for this repository. + // It must be a utf8 encoded string containing 256 or fewer characters. + DeprecationMessage string `protobuf:"bytes,3,opt,name=deprecation_message,json=deprecationMessage,proto3" json:"deprecation_message,omitempty"` +} + +func (x *DeprecateRepositoryByNameRequest) Reset() { + *x = DeprecateRepositoryByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeprecateRepositoryByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeprecateRepositoryByNameRequest) ProtoMessage() {} + +func (x *DeprecateRepositoryByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeprecateRepositoryByNameRequest.ProtoReflect.Descriptor instead. +func (*DeprecateRepositoryByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{24} +} + +func (x *DeprecateRepositoryByNameRequest) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *DeprecateRepositoryByNameRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *DeprecateRepositoryByNameRequest) GetDeprecationMessage() string { + if x != nil { + return x.DeprecationMessage + } + return "" +} + +type DeprecateRepositoryByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"` +} + +func (x *DeprecateRepositoryByNameResponse) Reset() { + *x = DeprecateRepositoryByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeprecateRepositoryByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeprecateRepositoryByNameResponse) ProtoMessage() {} + +func (x *DeprecateRepositoryByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeprecateRepositoryByNameResponse.ProtoReflect.Descriptor instead. +func (*DeprecateRepositoryByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{25} +} + +func (x *DeprecateRepositoryByNameResponse) GetRepository() *Repository { + if x != nil { + return x.Repository + } + return nil +} + +type UndeprecateRepositoryByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OwnerName string `protobuf:"bytes,1,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` +} + +func (x *UndeprecateRepositoryByNameRequest) Reset() { + *x = UndeprecateRepositoryByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UndeprecateRepositoryByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UndeprecateRepositoryByNameRequest) ProtoMessage() {} + +func (x *UndeprecateRepositoryByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UndeprecateRepositoryByNameRequest.ProtoReflect.Descriptor instead. +func (*UndeprecateRepositoryByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{26} +} + +func (x *UndeprecateRepositoryByNameRequest) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *UndeprecateRepositoryByNameRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +type UndeprecateRepositoryByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"` +} + +func (x *UndeprecateRepositoryByNameResponse) Reset() { + *x = UndeprecateRepositoryByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UndeprecateRepositoryByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UndeprecateRepositoryByNameResponse) ProtoMessage() {} + +func (x *UndeprecateRepositoryByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UndeprecateRepositoryByNameResponse.ProtoReflect.Descriptor instead. +func (*UndeprecateRepositoryByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{27} +} + +func (x *UndeprecateRepositoryByNameResponse) GetRepository() *Repository { + if x != nil { + return x.Repository + } + return nil +} + +type SetRepositoryContributorRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which the user's role will be set. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // The ID of the user whose role will be set. + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // The role to assign to the user. + // Setting UNSPECIFIED means removing the user's role. + RepositoryRole RepositoryRole `protobuf:"varint,3,opt,name=repository_role,json=repositoryRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole" json:"repository_role,omitempty"` +} + +func (x *SetRepositoryContributorRequest) Reset() { + *x = SetRepositoryContributorRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetRepositoryContributorRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRepositoryContributorRequest) ProtoMessage() {} + +func (x *SetRepositoryContributorRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRepositoryContributorRequest.ProtoReflect.Descriptor instead. +func (*SetRepositoryContributorRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{28} +} + +func (x *SetRepositoryContributorRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *SetRepositoryContributorRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *SetRepositoryContributorRequest) GetRepositoryRole() RepositoryRole { + if x != nil { + return x.RepositoryRole + } + return RepositoryRole_REPOSITORY_ROLE_UNSPECIFIED +} + +type SetRepositoryContributorResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SetRepositoryContributorResponse) Reset() { + *x = SetRepositoryContributorResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetRepositoryContributorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRepositoryContributorResponse) ProtoMessage() {} + +func (x *SetRepositoryContributorResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRepositoryContributorResponse.ProtoReflect.Descriptor instead. +func (*SetRepositoryContributorResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{29} +} + +type ListRepositoryContributorsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListRepositoryContributorsRequest) Reset() { + *x = ListRepositoryContributorsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryContributorsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryContributorsRequest) ProtoMessage() {} + +func (x *ListRepositoryContributorsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryContributorsRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoryContributorsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{30} +} + +func (x *ListRepositoryContributorsRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *ListRepositoryContributorsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoryContributorsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListRepositoryContributorsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListRepositoryContributorsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Users []*RepositoryContributor `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoryContributorsResponse) Reset() { + *x = ListRepositoryContributorsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryContributorsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryContributorsResponse) ProtoMessage() {} + +func (x *ListRepositoryContributorsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryContributorsResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoryContributorsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{31} +} + +func (x *ListRepositoryContributorsResponse) GetUsers() []*RepositoryContributor { + if x != nil { + return x.Users + } + return nil +} + +func (x *ListRepositoryContributorsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type GetRepositoryContributorRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to get the contributor information. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // The ID of the user for which to get the contributor information. + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *GetRepositoryContributorRequest) Reset() { + *x = GetRepositoryContributorRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryContributorRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryContributorRequest) ProtoMessage() {} + +func (x *GetRepositoryContributorRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryContributorRequest.ProtoReflect.Descriptor instead. +func (*GetRepositoryContributorRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{32} +} + +func (x *GetRepositoryContributorRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *GetRepositoryContributorRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetRepositoryContributorResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The contributor information of the user in the repository. + User *RepositoryContributor `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *GetRepositoryContributorResponse) Reset() { + *x = GetRepositoryContributorResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryContributorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryContributorResponse) ProtoMessage() {} + +func (x *GetRepositoryContributorResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryContributorResponse.ProtoReflect.Descriptor instead. +func (*GetRepositoryContributorResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{33} +} + +func (x *GetRepositoryContributorResponse) GetUser() *RepositoryContributor { + if x != nil { + return x.User + } + return nil +} + +type GetRepositorySettingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository for which to get the settings. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` +} + +func (x *GetRepositorySettingsRequest) Reset() { + *x = GetRepositorySettingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositorySettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositorySettingsRequest) ProtoMessage() {} + +func (x *GetRepositorySettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositorySettingsRequest.ProtoReflect.Descriptor instead. +func (*GetRepositorySettingsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{34} +} + +func (x *GetRepositorySettingsRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +type GetRepositorySettingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The number of outside contributors in the repository, + // excluding owning-organization's members that have an explicit role. + ContributorsCount uint32 `protobuf:"varint,1,opt,name=contributors_count,json=contributorsCount,proto3" json:"contributors_count,omitempty"` +} + +func (x *GetRepositorySettingsResponse) Reset() { + *x = GetRepositorySettingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositorySettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositorySettingsResponse) ProtoMessage() {} + +func (x *GetRepositorySettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositorySettingsResponse.ProtoReflect.Descriptor instead. +func (*GetRepositorySettingsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{35} +} + +func (x *GetRepositorySettingsResponse) GetContributorsCount() uint32 { + if x != nil { + return x.ContributorsCount + } + return 0 +} + +type UpdateRepositorySettingsByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OwnerName string `protobuf:"bytes,1,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // optional, update to visibility will only be made if this is specified. + Visibility Visibility `protobuf:"varint,3,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Visibility" json:"visibility,omitempty"` + // optional, update to description will only be made when this is present + Description *string `protobuf:"bytes,4,opt,name=description,proto3,oneof" json:"description,omitempty"` + // optional, update to url will only be made when this is present + Url *string `protobuf:"bytes,5,opt,name=url,proto3,oneof" json:"url,omitempty"` +} + +func (x *UpdateRepositorySettingsByNameRequest) Reset() { + *x = UpdateRepositorySettingsByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRepositorySettingsByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRepositorySettingsByNameRequest) ProtoMessage() {} + +func (x *UpdateRepositorySettingsByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRepositorySettingsByNameRequest.ProtoReflect.Descriptor instead. +func (*UpdateRepositorySettingsByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{36} +} + +func (x *UpdateRepositorySettingsByNameRequest) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *UpdateRepositorySettingsByNameRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *UpdateRepositorySettingsByNameRequest) GetVisibility() Visibility { + if x != nil { + return x.Visibility + } + return Visibility_VISIBILITY_UNSPECIFIED +} + +func (x *UpdateRepositorySettingsByNameRequest) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *UpdateRepositorySettingsByNameRequest) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +type UpdateRepositorySettingsByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateRepositorySettingsByNameResponse) Reset() { + *x = UpdateRepositorySettingsByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRepositorySettingsByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRepositorySettingsByNameResponse) ProtoMessage() {} + +func (x *UpdateRepositorySettingsByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[37] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRepositorySettingsByNameResponse.ProtoReflect.Descriptor instead. +func (*UpdateRepositorySettingsByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{37} +} + +type GetRepositoriesMetadataRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of repository IDs to request the metadata. + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` +} + +func (x *GetRepositoriesMetadataRequest) Reset() { + *x = GetRepositoriesMetadataRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoriesMetadataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoriesMetadataRequest) ProtoMessage() {} + +func (x *GetRepositoriesMetadataRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoriesMetadataRequest.ProtoReflect.Descriptor instead. +func (*GetRepositoriesMetadataRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{38} +} + +func (x *GetRepositoriesMetadataRequest) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type GetRepositoriesMetadataResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Metadata []*RepositoryMetadata `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty"` +} + +func (x *GetRepositoriesMetadataResponse) Reset() { + *x = GetRepositoriesMetadataResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoriesMetadataResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoriesMetadataResponse) ProtoMessage() {} + +func (x *GetRepositoriesMetadataResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_proto_msgTypes[39] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoriesMetadataResponse.ProtoReflect.Descriptor instead. +func (*GetRepositoriesMetadataResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_proto_rawDescGZIP(), []int{39} +} + +func (x *GetRepositoriesMetadataResponse) GetMetadata() []*RepositoryMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +var File_registry_v1alpha1_repository_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_repository_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, + 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2b, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf4, 0x03, 0x0a, 0x0a, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x29, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x55, 0x0a, 0x0a, + 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x69, 0x73, + 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x12, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x22, 0x68, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x67, 0x73, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x74, 0x61, 0x67, 0x73, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x72, 0x61, 0x66, 0x74, 0x73, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x64, 0x72, 0x61, 0x66, 0x74, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x0c, 0x74, 0x72, + 0x61, 0x63, 0x6b, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xc1, 0x02, 0x0a, 0x15, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x6f, 0x72, 0x12, 0x43, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x5e, + 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, + 0x52, 0x0c, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x5e, + 0x0a, 0x0d, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, + 0x52, 0x0c, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0xd1, + 0x02, 0x0a, 0x12, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x79, 0x0a, 0x19, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x17, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x48, 0x0a, 0x12, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x6c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x33, 0x0a, + 0x16, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x70, 0x64, 0x78, 0x5f, 0x6c, 0x69, 0x63, + 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x6c, + 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x70, 0x64, 0x78, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, + 0x49, 0x64, 0x22, 0x41, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x75, 0x6c, 0x6c, + 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x7e, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, + 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0c, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xc3, 0x01, + 0x0a, 0x15, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x53, + 0x0a, 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x06, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x22, 0x3d, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, + 0x6d, 0x65, 0x22, 0xcd, 0x01, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x53, 0x0a, + 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x06, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x22, 0x6f, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x22, 0x9d, 0x01, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x59, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0c, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, + 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x22, 0x8c, 0x01, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, + 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x22, 0xa1, 0x01, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x26, + 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x7c, 0x0a, 0x24, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, + 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, + 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x25, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, + 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0c, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, + 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0xa4, 0x01, 0x0a, 0x23, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, + 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x24, 0x4c, 0x69, 0x73, + 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x59, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0c, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x97, 0x01, 0x0a, 0x21, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, + 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x55, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x7b, + 0x0a, 0x22, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x29, 0x0a, 0x17, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x40, 0x0a, 0x21, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, + 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x22, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, + 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x20, 0x44, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, + 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x7a, 0x0a, 0x21, 0x44, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, + 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x22, 0x6c, 0x0a, 0x22, 0x55, 0x6e, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x22, 0x7c, 0x0a, 0x23, 0x55, 0x6e, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x4e, 0x61, 0x6d, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0a, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x22, 0xc3, 0x01, 0x0a, 0x1f, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x62, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x22, 0x0a, 0x20, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x21, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xa4, 0x01, 0x0a, 0x22, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, + 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x56, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x6f, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x5f, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x22, 0x78, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x43, 0x0a, + 0x1c, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, + 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x49, 0x64, 0x22, 0x4e, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x6f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x9c, 0x02, 0x0a, 0x25, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x55, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, + 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x25, 0x0a, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x88, + 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x75, 0x72, + 0x6c, 0x22, 0x28, 0x0a, 0x26, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x1e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, + 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, + 0x7c, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, + 0x65, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x59, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2a, 0x57, 0x0a, + 0x0a, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x16, 0x56, + 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x56, 0x49, 0x53, 0x49, 0x42, + 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x01, 0x12, 0x16, + 0x0a, 0x12, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52, 0x49, + 0x56, 0x41, 0x54, 0x45, 0x10, 0x02, 0x32, 0x87, 0x1a, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x97, 0x01, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x3f, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb5, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, + 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4a, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa0, + 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x69, 0x65, 0x73, 0x12, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x01, 0x12, 0xac, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x46, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, + 0x12, 0xc7, 0x01, 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x69, 0x65, 0x73, 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x12, 0x4f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x50, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xc4, 0x01, 0x0a, 0x1c, 0x4c, + 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x4e, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4f, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x01, 0x12, 0xbe, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, + 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, + 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x02, 0x12, 0xa0, 0x01, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x43, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0xbe, 0x01, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, + 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0xb6, 0x01, 0x0a, 0x19, 0x44, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x4b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0xbc, 0x01, 0x0a, 0x1b, 0x55, 0x6e, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x6e, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4e, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x6e, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xbb, + 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, + 0x65, 0x73, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x4b, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, + 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xb3, 0x01, 0x0a, + 0x18, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, + 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x12, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0xbe, 0x01, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, + 0x73, 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x01, 0x12, 0xb8, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, + 0x12, 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4b, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xaf, + 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, + 0x12, 0xc5, 0x01, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x50, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x51, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xb5, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x4a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, + 0x42, 0xea, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x42, 0x0f, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, + 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, + 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_repository_proto_rawDescOnce sync.Once + file_registry_v1alpha1_repository_proto_rawDescData = file_registry_v1alpha1_repository_proto_rawDesc +) + +func file_registry_v1alpha1_repository_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_repository_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_repository_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_repository_proto_rawDescData) + }) + return file_registry_v1alpha1_repository_proto_rawDescData +} + +var file_registry_v1alpha1_repository_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_repository_proto_msgTypes = make([]protoimpl.MessageInfo, 40) +var file_registry_v1alpha1_repository_proto_goTypes = []interface{}{ + (Visibility)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.Visibility + (*Repository)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.Repository + (*RepositoryCounts)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCounts + (*RepositoryContributor)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryContributor + (*RepositoryMetadata)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryMetadata + (*GetRepositoriesByFullNameRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesByFullNameRequest + (*GetRepositoriesByFullNameResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesByFullNameResponse + (*GetRepositoryRequest)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryRequest + (*GetRepositoryResponse)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryResponse + (*GetRepositoryByFullNameRequest)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryByFullNameRequest + (*GetRepositoryByFullNameResponse)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryByFullNameResponse + (*ListRepositoriesRequest)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesRequest + (*ListRepositoriesResponse)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesResponse + (*ListUserRepositoriesRequest)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.ListUserRepositoriesRequest + (*ListUserRepositoriesResponse)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.ListUserRepositoriesResponse + (*ListRepositoriesUserCanAccessRequest)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesUserCanAccessRequest + (*ListRepositoriesUserCanAccessResponse)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesUserCanAccessResponse + (*ListOrganizationRepositoriesRequest)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationRepositoriesRequest + (*ListOrganizationRepositoriesResponse)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationRepositoriesResponse + (*CreateRepositoryByFullNameRequest)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryByFullNameRequest + (*CreateRepositoryByFullNameResponse)(nil), // 20: bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryByFullNameResponse + (*DeleteRepositoryRequest)(nil), // 21: bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryRequest + (*DeleteRepositoryResponse)(nil), // 22: bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryResponse + (*DeleteRepositoryByFullNameRequest)(nil), // 23: bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryByFullNameRequest + (*DeleteRepositoryByFullNameResponse)(nil), // 24: bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryByFullNameResponse + (*DeprecateRepositoryByNameRequest)(nil), // 25: bufman.dubbo.apache.org.registry.v1alpha1.DeprecateRepositoryByNameRequest + (*DeprecateRepositoryByNameResponse)(nil), // 26: bufman.dubbo.apache.org.registry.v1alpha1.DeprecateRepositoryByNameResponse + (*UndeprecateRepositoryByNameRequest)(nil), // 27: bufman.dubbo.apache.org.registry.v1alpha1.UndeprecateRepositoryByNameRequest + (*UndeprecateRepositoryByNameResponse)(nil), // 28: bufman.dubbo.apache.org.registry.v1alpha1.UndeprecateRepositoryByNameResponse + (*SetRepositoryContributorRequest)(nil), // 29: bufman.dubbo.apache.org.registry.v1alpha1.SetRepositoryContributorRequest + (*SetRepositoryContributorResponse)(nil), // 30: bufman.dubbo.apache.org.registry.v1alpha1.SetRepositoryContributorResponse + (*ListRepositoryContributorsRequest)(nil), // 31: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryContributorsRequest + (*ListRepositoryContributorsResponse)(nil), // 32: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryContributorsResponse + (*GetRepositoryContributorRequest)(nil), // 33: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryContributorRequest + (*GetRepositoryContributorResponse)(nil), // 34: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryContributorResponse + (*GetRepositorySettingsRequest)(nil), // 35: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositorySettingsRequest + (*GetRepositorySettingsResponse)(nil), // 36: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositorySettingsResponse + (*UpdateRepositorySettingsByNameRequest)(nil), // 37: bufman.dubbo.apache.org.registry.v1alpha1.UpdateRepositorySettingsByNameRequest + (*UpdateRepositorySettingsByNameResponse)(nil), // 38: bufman.dubbo.apache.org.registry.v1alpha1.UpdateRepositorySettingsByNameResponse + (*GetRepositoriesMetadataRequest)(nil), // 39: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesMetadataRequest + (*GetRepositoriesMetadataResponse)(nil), // 40: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesMetadataResponse + (*timestamppb.Timestamp)(nil), // 41: google.protobuf.Timestamp + (*User)(nil), // 42: bufman.dubbo.apache.org.registry.v1alpha1.User + (RepositoryRole)(0), // 43: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + (VerificationStatus)(0), // 44: bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus +} +var file_registry_v1alpha1_repository_proto_depIdxs = []int32{ + 41, // 0: bufman.dubbo.apache.org.registry.v1alpha1.Repository.create_time:type_name -> google.protobuf.Timestamp + 41, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Repository.update_time:type_name -> google.protobuf.Timestamp + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.Repository.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Visibility + 42, // 3: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryContributor.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 43, // 4: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryContributor.explicit_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 43, // 5: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryContributor.implicit_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 44, // 6: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryMetadata.owner_verification_status:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus + 41, // 7: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryMetadata.latest_commit_time:type_name -> google.protobuf.Timestamp + 1, // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesByFullNameResponse.repositories:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 1, // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryResponse.repository:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 2, // 10: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryResponse.counts:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCounts + 1, // 11: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryByFullNameResponse.repository:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 2, // 12: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryByFullNameResponse.counts:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCounts + 1, // 13: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesResponse.repositories:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 1, // 14: bufman.dubbo.apache.org.registry.v1alpha1.ListUserRepositoriesResponse.repositories:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 1, // 15: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesUserCanAccessResponse.repositories:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 1, // 16: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationRepositoriesResponse.repositories:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 0, // 17: bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryByFullNameRequest.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Visibility + 1, // 18: bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryByFullNameResponse.repository:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 1, // 19: bufman.dubbo.apache.org.registry.v1alpha1.DeprecateRepositoryByNameResponse.repository:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 1, // 20: bufman.dubbo.apache.org.registry.v1alpha1.UndeprecateRepositoryByNameResponse.repository:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 43, // 21: bufman.dubbo.apache.org.registry.v1alpha1.SetRepositoryContributorRequest.repository_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + 3, // 22: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryContributorsResponse.users:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryContributor + 3, // 23: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryContributorResponse.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryContributor + 0, // 24: bufman.dubbo.apache.org.registry.v1alpha1.UpdateRepositorySettingsByNameRequest.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Visibility + 4, // 25: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesMetadataResponse.metadata:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryMetadata + 7, // 26: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepository:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryRequest + 9, // 27: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryByFullName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryByFullNameRequest + 11, // 28: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositories:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesRequest + 13, // 29: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListUserRepositories:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUserRepositoriesRequest + 15, // 30: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoriesUserCanAccess:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesUserCanAccessRequest + 17, // 31: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListOrganizationRepositories:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationRepositoriesRequest + 19, // 32: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.CreateRepositoryByFullName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryByFullNameRequest + 21, // 33: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepository:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryRequest + 23, // 34: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepositoryByFullName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryByFullNameRequest + 25, // 35: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeprecateRepositoryByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeprecateRepositoryByNameRequest + 27, // 36: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UndeprecateRepositoryByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UndeprecateRepositoryByNameRequest + 5, // 37: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesByFullName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesByFullNameRequest + 29, // 38: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.SetRepositoryContributor:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SetRepositoryContributorRequest + 31, // 39: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoryContributors:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryContributorsRequest + 33, // 40: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryContributor:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryContributorRequest + 35, // 41: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositorySettings:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositorySettingsRequest + 37, // 42: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UpdateRepositorySettingsByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateRepositorySettingsByNameRequest + 39, // 43: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesMetadata:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesMetadataRequest + 8, // 44: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepository:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryResponse + 10, // 45: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryByFullName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryByFullNameResponse + 12, // 46: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositories:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesResponse + 14, // 47: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListUserRepositories:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUserRepositoriesResponse + 16, // 48: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoriesUserCanAccess:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoriesUserCanAccessResponse + 18, // 49: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListOrganizationRepositories:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationRepositoriesResponse + 20, // 50: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.CreateRepositoryByFullName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryByFullNameResponse + 22, // 51: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepository:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryResponse + 24, // 52: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeleteRepositoryByFullName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryByFullNameResponse + 26, // 53: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.DeprecateRepositoryByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeprecateRepositoryByNameResponse + 28, // 54: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UndeprecateRepositoryByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UndeprecateRepositoryByNameResponse + 6, // 55: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesByFullName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesByFullNameResponse + 30, // 56: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.SetRepositoryContributor:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SetRepositoryContributorResponse + 32, // 57: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.ListRepositoryContributors:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryContributorsResponse + 34, // 58: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoryContributor:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryContributorResponse + 36, // 59: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositorySettings:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositorySettingsResponse + 38, // 60: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.UpdateRepositorySettingsByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateRepositorySettingsByNameResponse + 40, // 61: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService.GetRepositoriesMetadata:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoriesMetadataResponse + 44, // [44:62] is the sub-list for method output_type + 26, // [26:44] is the sub-list for method input_type + 26, // [26:26] is the sub-list for extension type_name + 26, // [26:26] is the sub-list for extension extendee + 0, // [0:26] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_repository_proto_init() } +func file_registry_v1alpha1_repository_proto_init() { + if File_registry_v1alpha1_repository_proto != nil { + return + } + file_registry_v1alpha1_role_proto_init() + file_registry_v1alpha1_user_proto_init() + file_registry_v1alpha1_verification_status_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_repository_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Repository); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryCounts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryContributor); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoriesByFullNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoriesByFullNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryByFullNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryByFullNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoriesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoriesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserRepositoriesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserRepositoriesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoriesUserCanAccessRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoriesUserCanAccessResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationRepositoriesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationRepositoriesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRepositoryByFullNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRepositoryByFullNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRepositoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRepositoryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRepositoryByFullNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRepositoryByFullNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeprecateRepositoryByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeprecateRepositoryByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UndeprecateRepositoryByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UndeprecateRepositoryByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetRepositoryContributorRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetRepositoryContributorResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryContributorsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryContributorsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryContributorRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryContributorResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositorySettingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositorySettingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRepositorySettingsByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRepositorySettingsByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoriesMetadataRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoriesMetadataResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_repository_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Repository_UserId)(nil), + (*Repository_OrganizationId)(nil), + } + file_registry_v1alpha1_repository_proto_msgTypes[36].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_repository_proto_rawDesc, + NumEnums: 1, + NumMessages: 40, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_repository_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_repository_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_repository_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_repository_proto_msgTypes, + }.Build() + File_registry_v1alpha1_repository_proto = out.File + file_registry_v1alpha1_repository_proto_rawDesc = nil + file_registry_v1alpha1_repository_proto_goTypes = nil + file_registry_v1alpha1_repository_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_branch.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_branch.pb.go new file mode 100644 index 000000000..990c61526 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_branch.pb.go @@ -0,0 +1,404 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/repository_branch.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type RepositoryBranch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // primary key, unique, immutable + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the repository branch. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the latest commit on the branch. + LatestCommitName string `protobuf:"bytes,3,opt,name=latest_commit_name,json=latestCommitName,proto3" json:"latest_commit_name,omitempty"` + // is_main_branch denotes whether this branch is considered the main branch of the repository. + IsMainBranch bool `protobuf:"varint,4,opt,name=is_main_branch,json=isMainBranch,proto3" json:"is_main_branch,omitempty"` + // The last update time of the branch. + LastUpdateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_update_time,json=lastUpdateTime,proto3" json:"last_update_time,omitempty"` +} + +func (x *RepositoryBranch) Reset() { + *x = RepositoryBranch{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_branch_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryBranch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryBranch) ProtoMessage() {} + +func (x *RepositoryBranch) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_branch_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryBranch.ProtoReflect.Descriptor instead. +func (*RepositoryBranch) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_branch_proto_rawDescGZIP(), []int{0} +} + +func (x *RepositoryBranch) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RepositoryBranch) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RepositoryBranch) GetLatestCommitName() string { + if x != nil { + return x.LatestCommitName + } + return "" +} + +func (x *RepositoryBranch) GetIsMainBranch() bool { + if x != nil { + return x.IsMainBranch + } + return false +} + +func (x *RepositoryBranch) GetLastUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.LastUpdateTime + } + return nil +} + +type ListRepositoryBranchesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository whose branches should be listed. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` +} + +func (x *ListRepositoryBranchesRequest) Reset() { + *x = ListRepositoryBranchesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_branch_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryBranchesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryBranchesRequest) ProtoMessage() {} + +func (x *ListRepositoryBranchesRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_branch_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryBranchesRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoryBranchesRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_branch_proto_rawDescGZIP(), []int{1} +} + +func (x *ListRepositoryBranchesRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *ListRepositoryBranchesRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoryBranchesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type ListRepositoryBranchesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryBranches []*RepositoryBranch `protobuf:"bytes,1,rep,name=repository_branches,json=repositoryBranches,proto3" json:"repository_branches,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoryBranchesResponse) Reset() { + *x = ListRepositoryBranchesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_branch_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryBranchesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryBranchesResponse) ProtoMessage() {} + +func (x *ListRepositoryBranchesResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_branch_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryBranchesResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoryBranchesResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_branch_proto_rawDescGZIP(), []int{2} +} + +func (x *ListRepositoryBranchesResponse) GetRepositoryBranches() []*RepositoryBranch { + if x != nil { + return x.RepositoryBranches + } + return nil +} + +func (x *ListRepositoryBranchesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +var File_registry_v1alpha1_repository_branch_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_repository_branch_proto_rawDesc = []byte{ + 0x0a, 0x29, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x62, + 0x72, 0x61, 0x6e, 0x63, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd0, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x2c, 0x0a, 0x12, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6c, 0x61, + 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, + 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4d, 0x61, 0x69, 0x6e, 0x42, 0x72, + 0x61, 0x6e, 0x63, 0x68, 0x12, 0x44, 0x0a, 0x10, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x6c, 0x61, 0x73, 0x74, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x80, 0x01, 0x0a, 0x1d, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, + 0x6e, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, + 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xb6, 0x01, + 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x6c, 0x0a, 0x13, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x62, + 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x12, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x12, 0x26, + 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xce, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0xb2, 0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x12, 0x48, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x49, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xf0, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x15, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, + 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_repository_branch_proto_rawDescOnce sync.Once + file_registry_v1alpha1_repository_branch_proto_rawDescData = file_registry_v1alpha1_repository_branch_proto_rawDesc +) + +func file_registry_v1alpha1_repository_branch_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_repository_branch_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_repository_branch_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_repository_branch_proto_rawDescData) + }) + return file_registry_v1alpha1_repository_branch_proto_rawDescData +} + +var file_registry_v1alpha1_repository_branch_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_registry_v1alpha1_repository_branch_proto_goTypes = []interface{}{ + (*RepositoryBranch)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranch + (*ListRepositoryBranchesRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryBranchesRequest + (*ListRepositoryBranchesResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryBranchesResponse + (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp +} +var file_registry_v1alpha1_repository_branch_proto_depIdxs = []int32{ + 3, // 0: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranch.last_update_time:type_name -> google.protobuf.Timestamp + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryBranchesResponse.repository_branches:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranch + 1, // 2: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService.ListRepositoryBranches:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryBranchesRequest + 2, // 3: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService.ListRepositoryBranches:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryBranchesResponse + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_repository_branch_proto_init() } +func file_registry_v1alpha1_repository_branch_proto_init() { + if File_registry_v1alpha1_repository_branch_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_repository_branch_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryBranch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_branch_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryBranchesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_branch_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryBranchesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_repository_branch_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_repository_branch_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_repository_branch_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_repository_branch_proto_msgTypes, + }.Build() + File_registry_v1alpha1_repository_branch_proto = out.File + file_registry_v1alpha1_repository_branch_proto_rawDesc = nil + file_registry_v1alpha1_repository_branch_proto_goTypes = nil + file_registry_v1alpha1_repository_branch_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_branch_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_branch_grpc.pb.go new file mode 100644 index 000000000..95a59be34 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_branch_grpc.pb.go @@ -0,0 +1,112 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/repository_branch.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + RepositoryBranchService_ListRepositoryBranches_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService/ListRepositoryBranches" +) + +// RepositoryBranchServiceClient is the client API for RepositoryBranchService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type RepositoryBranchServiceClient interface { + // ListRepositoryBranchs lists the repository branches associated with a Repository. + ListRepositoryBranches(ctx context.Context, in *ListRepositoryBranchesRequest, opts ...grpc.CallOption) (*ListRepositoryBranchesResponse, error) +} + +type repositoryBranchServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRepositoryBranchServiceClient(cc grpc.ClientConnInterface) RepositoryBranchServiceClient { + return &repositoryBranchServiceClient{cc} +} + +func (c *repositoryBranchServiceClient) ListRepositoryBranches(ctx context.Context, in *ListRepositoryBranchesRequest, opts ...grpc.CallOption) (*ListRepositoryBranchesResponse, error) { + out := new(ListRepositoryBranchesResponse) + err := c.cc.Invoke(ctx, RepositoryBranchService_ListRepositoryBranches_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RepositoryBranchServiceServer is the server API for RepositoryBranchService service. +// All implementations must embed UnimplementedRepositoryBranchServiceServer +// for forward compatibility +type RepositoryBranchServiceServer interface { + // ListRepositoryBranchs lists the repository branches associated with a Repository. + ListRepositoryBranches(context.Context, *ListRepositoryBranchesRequest) (*ListRepositoryBranchesResponse, error) + mustEmbedUnimplementedRepositoryBranchServiceServer() +} + +// UnimplementedRepositoryBranchServiceServer must be embedded to have forward compatible implementations. +type UnimplementedRepositoryBranchServiceServer struct { +} + +func (UnimplementedRepositoryBranchServiceServer) ListRepositoryBranches(context.Context, *ListRepositoryBranchesRequest) (*ListRepositoryBranchesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositoryBranches not implemented") +} +func (UnimplementedRepositoryBranchServiceServer) mustEmbedUnimplementedRepositoryBranchServiceServer() { +} + +// UnsafeRepositoryBranchServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RepositoryBranchServiceServer will +// result in compilation errors. +type UnsafeRepositoryBranchServiceServer interface { + mustEmbedUnimplementedRepositoryBranchServiceServer() +} + +func RegisterRepositoryBranchServiceServer(s grpc.ServiceRegistrar, srv RepositoryBranchServiceServer) { + s.RegisterService(&RepositoryBranchService_ServiceDesc, srv) +} + +func _RepositoryBranchService_ListRepositoryBranches_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoryBranchesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryBranchServiceServer).ListRepositoryBranches(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryBranchService_ListRepositoryBranches_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryBranchServiceServer).ListRepositoryBranches(ctx, req.(*ListRepositoryBranchesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RepositoryBranchService_ServiceDesc is the grpc.ServiceDesc for RepositoryBranchService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RepositoryBranchService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryBranchService", + HandlerType: (*RepositoryBranchServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListRepositoryBranches", + Handler: _RepositoryBranchService_ListRepositoryBranches_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/repository_branch.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_commit.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_commit.pb.go new file mode 100644 index 000000000..330a1f93f --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_commit.pb.go @@ -0,0 +1,1462 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/repository_commit.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type RepositoryCommit struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // primary key, unique, immutable + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // immutable + CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // The digest of the commit. + Digest string `protobuf:"bytes,3,opt,name=digest,proto3" json:"digest,omitempty"` + // The name of the commit. + // This is what is referenced by users. + // Unique, immutable. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // The branch on which this commit was created. + // + // Deprecated: Do not use. + Branch string `protobuf:"bytes,5,opt,name=branch,proto3" json:"branch,omitempty"` + // The commit sequence ID for this commit. This + // is essentially what number commit this is on + // the branch. + CommitSequenceId int64 `protobuf:"varint,6,opt,name=commit_sequence_id,json=commitSequenceId,proto3" json:"commit_sequence_id,omitempty"` + // The username of the user who authored this commit. + Author string `protobuf:"bytes,7,opt,name=author,proto3" json:"author,omitempty"` + // The tags associated with this commit + Tags []*RepositoryTag `protobuf:"bytes,8,rep,name=tags,proto3" json:"tags,omitempty"` + // The commit's draft name, if it is a draft commit. + DraftName string `protobuf:"bytes,9,opt,name=draft_name,json=draftName,proto3" json:"draft_name,omitempty"` + // spdx_license_id is the license of the commit, based on the + // license file pushed, which should be one of the identifier defined in + // https://spdx.org/licenses, and will be not set if the license file is not + // presented or cannot be classified into a known license. + SpdxLicenseId string `protobuf:"bytes,10,opt,name=spdx_license_id,json=spdxLicenseId,proto3" json:"spdx_license_id,omitempty"` + // The manifest digest of the commit. + ManifestDigest string `protobuf:"bytes,11,opt,name=manifest_digest,json=manifestDigest,proto3" json:"manifest_digest,omitempty"` +} + +func (x *RepositoryCommit) Reset() { + *x = RepositoryCommit{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryCommit) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryCommit) ProtoMessage() {} + +func (x *RepositoryCommit) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryCommit.ProtoReflect.Descriptor instead. +func (*RepositoryCommit) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{0} +} + +func (x *RepositoryCommit) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RepositoryCommit) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *RepositoryCommit) GetDigest() string { + if x != nil { + return x.Digest + } + return "" +} + +func (x *RepositoryCommit) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Deprecated: Do not use. +func (x *RepositoryCommit) GetBranch() string { + if x != nil { + return x.Branch + } + return "" +} + +func (x *RepositoryCommit) GetCommitSequenceId() int64 { + if x != nil { + return x.CommitSequenceId + } + return 0 +} + +func (x *RepositoryCommit) GetAuthor() string { + if x != nil { + return x.Author + } + return "" +} + +func (x *RepositoryCommit) GetTags() []*RepositoryTag { + if x != nil { + return x.Tags + } + return nil +} + +func (x *RepositoryCommit) GetDraftName() string { + if x != nil { + return x.DraftName + } + return "" +} + +func (x *RepositoryCommit) GetSpdxLicenseId() string { + if x != nil { + return x.SpdxLicenseId + } + return "" +} + +func (x *RepositoryCommit) GetManifestDigest() string { + if x != nil { + return x.ManifestDigest + } + return "" +} + +type ListRepositoryCommitsByBranchRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repository which the repository branch belongs to. + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The name of the repository which the repository branch belongs to. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The name of the repository branch whose commits should be listed. + RepositoryBranchName string `protobuf:"bytes,3,opt,name=repository_branch_name,json=repositoryBranchName,proto3" json:"repository_branch_name,omitempty"` + PageSize uint32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // For now this is the id of he last commit returned in the previous page. + // This is directly set by the frontend when listing track history starting with a + // specific commit. If we page_token to be anything other than a commit id + // we need to change the frontend as well. + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,6,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListRepositoryCommitsByBranchRequest) Reset() { + *x = ListRepositoryCommitsByBranchRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryCommitsByBranchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryCommitsByBranchRequest) ProtoMessage() {} + +func (x *ListRepositoryCommitsByBranchRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryCommitsByBranchRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoryCommitsByBranchRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{1} +} + +func (x *ListRepositoryCommitsByBranchRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *ListRepositoryCommitsByBranchRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *ListRepositoryCommitsByBranchRequest) GetRepositoryBranchName() string { + if x != nil { + return x.RepositoryBranchName + } + return "" +} + +func (x *ListRepositoryCommitsByBranchRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoryCommitsByBranchRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListRepositoryCommitsByBranchRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListRepositoryCommitsByBranchResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryCommits []*RepositoryCommit `protobuf:"bytes,1,rep,name=repository_commits,json=repositoryCommits,proto3" json:"repository_commits,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoryCommitsByBranchResponse) Reset() { + *x = ListRepositoryCommitsByBranchResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryCommitsByBranchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryCommitsByBranchResponse) ProtoMessage() {} + +func (x *ListRepositoryCommitsByBranchResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryCommitsByBranchResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoryCommitsByBranchResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{2} +} + +func (x *ListRepositoryCommitsByBranchResponse) GetRepositoryCommits() []*RepositoryCommit { + if x != nil { + return x.RepositoryCommits + } + return nil +} + +func (x *ListRepositoryCommitsByBranchResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListRepositoryCommitsByReferenceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repository which the repository reference belongs to. + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The name of the repository which the repository reference belongs to. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The reference used to resolve repository commits. Can be a tag or commit. + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` + PageSize uint32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,6,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListRepositoryCommitsByReferenceRequest) Reset() { + *x = ListRepositoryCommitsByReferenceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryCommitsByReferenceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryCommitsByReferenceRequest) ProtoMessage() {} + +func (x *ListRepositoryCommitsByReferenceRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryCommitsByReferenceRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoryCommitsByReferenceRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{3} +} + +func (x *ListRepositoryCommitsByReferenceRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *ListRepositoryCommitsByReferenceRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *ListRepositoryCommitsByReferenceRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +func (x *ListRepositoryCommitsByReferenceRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoryCommitsByReferenceRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListRepositoryCommitsByReferenceRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListRepositoryCommitsByReferenceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryCommits []*RepositoryCommit `protobuf:"bytes,1,rep,name=repository_commits,json=repositoryCommits,proto3" json:"repository_commits,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoryCommitsByReferenceResponse) Reset() { + *x = ListRepositoryCommitsByReferenceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryCommitsByReferenceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryCommitsByReferenceResponse) ProtoMessage() {} + +func (x *ListRepositoryCommitsByReferenceResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryCommitsByReferenceResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoryCommitsByReferenceResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{4} +} + +func (x *ListRepositoryCommitsByReferenceResponse) GetRepositoryCommits() []*RepositoryCommit { + if x != nil { + return x.RepositoryCommits + } + return nil +} + +func (x *ListRepositoryCommitsByReferenceResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type GetRepositoryCommitByReferenceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repository which the reference belongs to. + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The name of the repository which the reference belongs to. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The reference that should be resolved to a commit. Can be a tag or commit. + Reference string `protobuf:"bytes,3,opt,name=reference,proto3" json:"reference,omitempty"` +} + +func (x *GetRepositoryCommitByReferenceRequest) Reset() { + *x = GetRepositoryCommitByReferenceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryCommitByReferenceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryCommitByReferenceRequest) ProtoMessage() {} + +func (x *GetRepositoryCommitByReferenceRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryCommitByReferenceRequest.ProtoReflect.Descriptor instead. +func (*GetRepositoryCommitByReferenceRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{5} +} + +func (x *GetRepositoryCommitByReferenceRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *GetRepositoryCommitByReferenceRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *GetRepositoryCommitByReferenceRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +type GetRepositoryCommitByReferenceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryCommit *RepositoryCommit `protobuf:"bytes,1,opt,name=repository_commit,json=repositoryCommit,proto3" json:"repository_commit,omitempty"` +} + +func (x *GetRepositoryCommitByReferenceResponse) Reset() { + *x = GetRepositoryCommitByReferenceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryCommitByReferenceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryCommitByReferenceResponse) ProtoMessage() {} + +func (x *GetRepositoryCommitByReferenceResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryCommitByReferenceResponse.ProtoReflect.Descriptor instead. +func (*GetRepositoryCommitByReferenceResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{6} +} + +func (x *GetRepositoryCommitByReferenceResponse) GetRepositoryCommit() *RepositoryCommit { + if x != nil { + return x.RepositoryCommit + } + return nil +} + +type GetRepositoryCommitBySequenceIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repository which the repository branch belongs to. + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The name of the repository which the repository branch belongs to. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The name of the repository branch which the sequence ID is relative to. + RepositoryBranchName string `protobuf:"bytes,3,opt,name=repository_branch_name,json=repositoryBranchName,proto3" json:"repository_branch_name,omitempty"` + // The sequence ID to look up. + CommitSequenceId int64 `protobuf:"varint,4,opt,name=commit_sequence_id,json=commitSequenceId,proto3" json:"commit_sequence_id,omitempty"` +} + +func (x *GetRepositoryCommitBySequenceIdRequest) Reset() { + *x = GetRepositoryCommitBySequenceIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryCommitBySequenceIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryCommitBySequenceIdRequest) ProtoMessage() {} + +func (x *GetRepositoryCommitBySequenceIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryCommitBySequenceIdRequest.ProtoReflect.Descriptor instead. +func (*GetRepositoryCommitBySequenceIdRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{7} +} + +func (x *GetRepositoryCommitBySequenceIdRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *GetRepositoryCommitBySequenceIdRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *GetRepositoryCommitBySequenceIdRequest) GetRepositoryBranchName() string { + if x != nil { + return x.RepositoryBranchName + } + return "" +} + +func (x *GetRepositoryCommitBySequenceIdRequest) GetCommitSequenceId() int64 { + if x != nil { + return x.CommitSequenceId + } + return 0 +} + +type GetRepositoryCommitBySequenceIdResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryCommit *RepositoryCommit `protobuf:"bytes,1,opt,name=repository_commit,json=repositoryCommit,proto3" json:"repository_commit,omitempty"` +} + +func (x *GetRepositoryCommitBySequenceIdResponse) Reset() { + *x = GetRepositoryCommitBySequenceIdResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRepositoryCommitBySequenceIdResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRepositoryCommitBySequenceIdResponse) ProtoMessage() {} + +func (x *GetRepositoryCommitBySequenceIdResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRepositoryCommitBySequenceIdResponse.ProtoReflect.Descriptor instead. +func (*GetRepositoryCommitBySequenceIdResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{8} +} + +func (x *GetRepositoryCommitBySequenceIdResponse) GetRepositoryCommit() *RepositoryCommit { + if x != nil { + return x.RepositoryCommit + } + return nil +} + +type ListRepositoryDraftCommitsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repository which the repository branch belongs to. + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The name of the repository which the repository branch belongs to. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + PageSize uint32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // By default, draft commits are ordered by last update time descending. + // Reverse orders them ascending. + Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListRepositoryDraftCommitsRequest) Reset() { + *x = ListRepositoryDraftCommitsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryDraftCommitsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryDraftCommitsRequest) ProtoMessage() {} + +func (x *ListRepositoryDraftCommitsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryDraftCommitsRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoryDraftCommitsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{9} +} + +func (x *ListRepositoryDraftCommitsRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *ListRepositoryDraftCommitsRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *ListRepositoryDraftCommitsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoryDraftCommitsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListRepositoryDraftCommitsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListRepositoryDraftCommitsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Each commit will have draft_name set. + RepositoryCommits []*RepositoryCommit `protobuf:"bytes,1,rep,name=repository_commits,json=repositoryCommits,proto3" json:"repository_commits,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoryDraftCommitsResponse) Reset() { + *x = ListRepositoryDraftCommitsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryDraftCommitsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryDraftCommitsResponse) ProtoMessage() {} + +func (x *ListRepositoryDraftCommitsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryDraftCommitsResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoryDraftCommitsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{10} +} + +func (x *ListRepositoryDraftCommitsResponse) GetRepositoryCommits() []*RepositoryCommit { + if x != nil { + return x.RepositoryCommits + } + return nil +} + +func (x *ListRepositoryDraftCommitsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type DeleteRepositoryDraftCommitRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repository which the repository branch belongs to. + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The name of the repository which the repository branch belongs to. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The name of the draft to delete. + DraftName string `protobuf:"bytes,3,opt,name=draft_name,json=draftName,proto3" json:"draft_name,omitempty"` +} + +func (x *DeleteRepositoryDraftCommitRequest) Reset() { + *x = DeleteRepositoryDraftCommitRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRepositoryDraftCommitRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRepositoryDraftCommitRequest) ProtoMessage() {} + +func (x *DeleteRepositoryDraftCommitRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRepositoryDraftCommitRequest.ProtoReflect.Descriptor instead. +func (*DeleteRepositoryDraftCommitRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{11} +} + +func (x *DeleteRepositoryDraftCommitRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *DeleteRepositoryDraftCommitRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *DeleteRepositoryDraftCommitRequest) GetDraftName() string { + if x != nil { + return x.DraftName + } + return "" +} + +type DeleteRepositoryDraftCommitResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteRepositoryDraftCommitResponse) Reset() { + *x = DeleteRepositoryDraftCommitResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRepositoryDraftCommitResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRepositoryDraftCommitResponse) ProtoMessage() {} + +func (x *DeleteRepositoryDraftCommitResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_commit_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRepositoryDraftCommitResponse.ProtoReflect.Descriptor instead. +func (*DeleteRepositoryDraftCommitResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_commit_proto_rawDescGZIP(), []int{12} +} + +var File_registry_v1alpha1_repository_commit_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_repository_commit_proto_rawDesc = []byte{ + 0x0a, 0x29, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x26, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xab, 0x03, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, + 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, + 0x01, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x65, 0x71, + 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, + 0x4c, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x64, 0x72, 0x61, 0x66, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x64, 0x72, 0x61, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0f, + 0x73, 0x70, 0x64, 0x78, 0x5f, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x70, 0x64, 0x78, 0x4c, 0x69, 0x63, 0x65, 0x6e, + 0x73, 0x65, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, + 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, + 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x86, 0x02, + 0x0a, 0x24, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x42, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, + 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, + 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, + 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, + 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x25, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, + 0x42, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x6a, 0x0a, 0x12, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x11, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xf1, 0x01, 0x0a, 0x27, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x42, 0x79, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, + 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xbe, 0x01, 0x0a, 0x28, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x73, 0x42, 0x79, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x12, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x11, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, + 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x42, 0x79, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, + 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x26, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x42, 0x79, 0x52, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x68, 0x0a, 0x11, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0xe0, 0x01, 0x0a, 0x26, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x42, 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x2c, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x63, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x22, 0x93, 0x01, + 0x0a, 0x27, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x42, 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x11, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x52, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x22, 0xcd, 0x01, 0x0a, 0x21, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x22, 0xb8, 0x01, 0x0a, 0x22, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x12, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x52, 0x11, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x97, + 0x01, 0x0a, 0x22, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x72, 0x61, + 0x66, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, + 0x72, 0x61, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x25, 0x0a, 0x23, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, + 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, + 0xdb, 0x09, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xca, 0x01, 0x0a, 0x1d, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x42, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x4f, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x42, + 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x50, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, + 0x42, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x06, 0x88, 0x02, 0x01, 0x90, 0x02, 0x01, 0x12, 0xd0, 0x01, 0x0a, 0x20, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x73, 0x42, 0x79, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x52, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x42, + 0x79, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x53, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x73, 0x42, 0x79, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xca, 0x01, 0x0a, 0x1e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x42, 0x79, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x50, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x42, 0x79, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x51, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x42, 0x79, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xcd, 0x01, 0x0a, 0x1f, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x42, 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x51, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x42, 0x79, 0x53, 0x65, + 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x52, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x42, + 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xbe, 0x01, 0x0a, 0x1a, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x44, 0x72, 0x61, 0x66, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xc1, 0x01, 0x0a, 0x1b, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x72, + 0x61, 0x66, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x4d, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x72, 0x61, 0x66, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x42, 0xf0, 0x02, + 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, + 0x15, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, + 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, + 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, + 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_repository_commit_proto_rawDescOnce sync.Once + file_registry_v1alpha1_repository_commit_proto_rawDescData = file_registry_v1alpha1_repository_commit_proto_rawDesc +) + +func file_registry_v1alpha1_repository_commit_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_repository_commit_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_repository_commit_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_repository_commit_proto_rawDescData) + }) + return file_registry_v1alpha1_repository_commit_proto_rawDescData +} + +var file_registry_v1alpha1_repository_commit_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_registry_v1alpha1_repository_commit_proto_goTypes = []interface{}{ + (*RepositoryCommit)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + (*ListRepositoryCommitsByBranchRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByBranchRequest + (*ListRepositoryCommitsByBranchResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByBranchResponse + (*ListRepositoryCommitsByReferenceRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByReferenceRequest + (*ListRepositoryCommitsByReferenceResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByReferenceResponse + (*GetRepositoryCommitByReferenceRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitByReferenceRequest + (*GetRepositoryCommitByReferenceResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitByReferenceResponse + (*GetRepositoryCommitBySequenceIdRequest)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitBySequenceIdRequest + (*GetRepositoryCommitBySequenceIdResponse)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitBySequenceIdResponse + (*ListRepositoryDraftCommitsRequest)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryDraftCommitsRequest + (*ListRepositoryDraftCommitsResponse)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryDraftCommitsResponse + (*DeleteRepositoryDraftCommitRequest)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryDraftCommitRequest + (*DeleteRepositoryDraftCommitResponse)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryDraftCommitResponse + (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp + (*RepositoryTag)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag +} +var file_registry_v1alpha1_repository_commit_proto_depIdxs = []int32{ + 13, // 0: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit.create_time:type_name -> google.protobuf.Timestamp + 14, // 1: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit.tags:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByBranchResponse.repository_commits:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByReferenceResponse.repository_commits:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 0, // 4: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitByReferenceResponse.repository_commit:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 0, // 5: bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitBySequenceIdResponse.repository_commit:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 0, // 6: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryDraftCommitsResponse.repository_commits:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 1, // 7: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByBranch:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByBranchRequest + 3, // 8: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByReference:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByReferenceRequest + 5, // 9: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitByReference:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitByReferenceRequest + 7, // 10: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitBySequenceId:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitBySequenceIdRequest + 9, // 11: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryDraftCommits:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryDraftCommitsRequest + 11, // 12: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.DeleteRepositoryDraftCommit:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryDraftCommitRequest + 2, // 13: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByBranch:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByBranchResponse + 4, // 14: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryCommitsByReference:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryCommitsByReferenceResponse + 6, // 15: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitByReference:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitByReferenceResponse + 8, // 16: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.GetRepositoryCommitBySequenceId:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetRepositoryCommitBySequenceIdResponse + 10, // 17: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.ListRepositoryDraftCommits:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryDraftCommitsResponse + 12, // 18: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService.DeleteRepositoryDraftCommit:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteRepositoryDraftCommitResponse + 13, // [13:19] is the sub-list for method output_type + 7, // [7:13] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_repository_commit_proto_init() } +func file_registry_v1alpha1_repository_commit_proto_init() { + if File_registry_v1alpha1_repository_commit_proto != nil { + return + } + file_registry_v1alpha1_repository_tag_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_repository_commit_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryCommit); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryCommitsByBranchRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryCommitsByBranchResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryCommitsByReferenceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryCommitsByReferenceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryCommitByReferenceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryCommitByReferenceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryCommitBySequenceIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRepositoryCommitBySequenceIdResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryDraftCommitsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryDraftCommitsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRepositoryDraftCommitRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_commit_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRepositoryDraftCommitResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_repository_commit_proto_rawDesc, + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_repository_commit_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_repository_commit_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_repository_commit_proto_msgTypes, + }.Build() + File_registry_v1alpha1_repository_commit_proto = out.File + file_registry_v1alpha1_repository_commit_proto_rawDesc = nil + file_registry_v1alpha1_repository_commit_proto_goTypes = nil + file_registry_v1alpha1_repository_commit_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_commit_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_commit_grpc.pb.go new file mode 100644 index 000000000..8d1905fa6 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_commit_grpc.pb.go @@ -0,0 +1,318 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/repository_commit.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + RepositoryCommitService_ListRepositoryCommitsByBranch_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryCommitsByBranch" + RepositoryCommitService_ListRepositoryCommitsByReference_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryCommitsByReference" + RepositoryCommitService_GetRepositoryCommitByReference_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/GetRepositoryCommitByReference" + RepositoryCommitService_GetRepositoryCommitBySequenceId_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/GetRepositoryCommitBySequenceId" + RepositoryCommitService_ListRepositoryDraftCommits_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/ListRepositoryDraftCommits" + RepositoryCommitService_DeleteRepositoryDraftCommit_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService/DeleteRepositoryDraftCommit" +) + +// RepositoryCommitServiceClient is the client API for RepositoryCommitService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type RepositoryCommitServiceClient interface { + // Deprecated: Do not use. + // ListRepositoryCommitsByBranch lists the repository commits associated + // with a repository branch on a repository, ordered by their create time. + ListRepositoryCommitsByBranch(ctx context.Context, in *ListRepositoryCommitsByBranchRequest, opts ...grpc.CallOption) (*ListRepositoryCommitsByBranchResponse, error) + // ListRepositoryCommitsByReference returns repository commits up-to and including + // the provided reference. + ListRepositoryCommitsByReference(ctx context.Context, in *ListRepositoryCommitsByReferenceRequest, opts ...grpc.CallOption) (*ListRepositoryCommitsByReferenceResponse, error) + // GetRepositoryCommitByReference returns the repository commit matching + // the provided reference, if it exists. + GetRepositoryCommitByReference(ctx context.Context, in *GetRepositoryCommitByReferenceRequest, opts ...grpc.CallOption) (*GetRepositoryCommitByReferenceResponse, error) + // GetRepositoryCommitBySequenceId returns the repository commit matching + // the provided sequence ID and branch, if it exists. + GetRepositoryCommitBySequenceId(ctx context.Context, in *GetRepositoryCommitBySequenceIdRequest, opts ...grpc.CallOption) (*GetRepositoryCommitBySequenceIdResponse, error) + // ListRepositoryDraftCommits lists draft commits in a repository. + ListRepositoryDraftCommits(ctx context.Context, in *ListRepositoryDraftCommitsRequest, opts ...grpc.CallOption) (*ListRepositoryDraftCommitsResponse, error) + // DeleteRepositoryDraftCommit deletes a draft. + DeleteRepositoryDraftCommit(ctx context.Context, in *DeleteRepositoryDraftCommitRequest, opts ...grpc.CallOption) (*DeleteRepositoryDraftCommitResponse, error) +} + +type repositoryCommitServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRepositoryCommitServiceClient(cc grpc.ClientConnInterface) RepositoryCommitServiceClient { + return &repositoryCommitServiceClient{cc} +} + +// Deprecated: Do not use. +func (c *repositoryCommitServiceClient) ListRepositoryCommitsByBranch(ctx context.Context, in *ListRepositoryCommitsByBranchRequest, opts ...grpc.CallOption) (*ListRepositoryCommitsByBranchResponse, error) { + out := new(ListRepositoryCommitsByBranchResponse) + err := c.cc.Invoke(ctx, RepositoryCommitService_ListRepositoryCommitsByBranch_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryCommitServiceClient) ListRepositoryCommitsByReference(ctx context.Context, in *ListRepositoryCommitsByReferenceRequest, opts ...grpc.CallOption) (*ListRepositoryCommitsByReferenceResponse, error) { + out := new(ListRepositoryCommitsByReferenceResponse) + err := c.cc.Invoke(ctx, RepositoryCommitService_ListRepositoryCommitsByReference_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryCommitServiceClient) GetRepositoryCommitByReference(ctx context.Context, in *GetRepositoryCommitByReferenceRequest, opts ...grpc.CallOption) (*GetRepositoryCommitByReferenceResponse, error) { + out := new(GetRepositoryCommitByReferenceResponse) + err := c.cc.Invoke(ctx, RepositoryCommitService_GetRepositoryCommitByReference_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryCommitServiceClient) GetRepositoryCommitBySequenceId(ctx context.Context, in *GetRepositoryCommitBySequenceIdRequest, opts ...grpc.CallOption) (*GetRepositoryCommitBySequenceIdResponse, error) { + out := new(GetRepositoryCommitBySequenceIdResponse) + err := c.cc.Invoke(ctx, RepositoryCommitService_GetRepositoryCommitBySequenceId_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryCommitServiceClient) ListRepositoryDraftCommits(ctx context.Context, in *ListRepositoryDraftCommitsRequest, opts ...grpc.CallOption) (*ListRepositoryDraftCommitsResponse, error) { + out := new(ListRepositoryDraftCommitsResponse) + err := c.cc.Invoke(ctx, RepositoryCommitService_ListRepositoryDraftCommits_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryCommitServiceClient) DeleteRepositoryDraftCommit(ctx context.Context, in *DeleteRepositoryDraftCommitRequest, opts ...grpc.CallOption) (*DeleteRepositoryDraftCommitResponse, error) { + out := new(DeleteRepositoryDraftCommitResponse) + err := c.cc.Invoke(ctx, RepositoryCommitService_DeleteRepositoryDraftCommit_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RepositoryCommitServiceServer is the server API for RepositoryCommitService service. +// All implementations must embed UnimplementedRepositoryCommitServiceServer +// for forward compatibility +type RepositoryCommitServiceServer interface { + // Deprecated: Do not use. + // ListRepositoryCommitsByBranch lists the repository commits associated + // with a repository branch on a repository, ordered by their create time. + ListRepositoryCommitsByBranch(context.Context, *ListRepositoryCommitsByBranchRequest) (*ListRepositoryCommitsByBranchResponse, error) + // ListRepositoryCommitsByReference returns repository commits up-to and including + // the provided reference. + ListRepositoryCommitsByReference(context.Context, *ListRepositoryCommitsByReferenceRequest) (*ListRepositoryCommitsByReferenceResponse, error) + // GetRepositoryCommitByReference returns the repository commit matching + // the provided reference, if it exists. + GetRepositoryCommitByReference(context.Context, *GetRepositoryCommitByReferenceRequest) (*GetRepositoryCommitByReferenceResponse, error) + // GetRepositoryCommitBySequenceId returns the repository commit matching + // the provided sequence ID and branch, if it exists. + GetRepositoryCommitBySequenceId(context.Context, *GetRepositoryCommitBySequenceIdRequest) (*GetRepositoryCommitBySequenceIdResponse, error) + // ListRepositoryDraftCommits lists draft commits in a repository. + ListRepositoryDraftCommits(context.Context, *ListRepositoryDraftCommitsRequest) (*ListRepositoryDraftCommitsResponse, error) + // DeleteRepositoryDraftCommit deletes a draft. + DeleteRepositoryDraftCommit(context.Context, *DeleteRepositoryDraftCommitRequest) (*DeleteRepositoryDraftCommitResponse, error) + mustEmbedUnimplementedRepositoryCommitServiceServer() +} + +// UnimplementedRepositoryCommitServiceServer must be embedded to have forward compatible implementations. +type UnimplementedRepositoryCommitServiceServer struct { +} + +func (UnimplementedRepositoryCommitServiceServer) ListRepositoryCommitsByBranch(context.Context, *ListRepositoryCommitsByBranchRequest) (*ListRepositoryCommitsByBranchResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositoryCommitsByBranch not implemented") +} +func (UnimplementedRepositoryCommitServiceServer) ListRepositoryCommitsByReference(context.Context, *ListRepositoryCommitsByReferenceRequest) (*ListRepositoryCommitsByReferenceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositoryCommitsByReference not implemented") +} +func (UnimplementedRepositoryCommitServiceServer) GetRepositoryCommitByReference(context.Context, *GetRepositoryCommitByReferenceRequest) (*GetRepositoryCommitByReferenceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepositoryCommitByReference not implemented") +} +func (UnimplementedRepositoryCommitServiceServer) GetRepositoryCommitBySequenceId(context.Context, *GetRepositoryCommitBySequenceIdRequest) (*GetRepositoryCommitBySequenceIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepositoryCommitBySequenceId not implemented") +} +func (UnimplementedRepositoryCommitServiceServer) ListRepositoryDraftCommits(context.Context, *ListRepositoryDraftCommitsRequest) (*ListRepositoryDraftCommitsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositoryDraftCommits not implemented") +} +func (UnimplementedRepositoryCommitServiceServer) DeleteRepositoryDraftCommit(context.Context, *DeleteRepositoryDraftCommitRequest) (*DeleteRepositoryDraftCommitResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRepositoryDraftCommit not implemented") +} +func (UnimplementedRepositoryCommitServiceServer) mustEmbedUnimplementedRepositoryCommitServiceServer() { +} + +// UnsafeRepositoryCommitServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RepositoryCommitServiceServer will +// result in compilation errors. +type UnsafeRepositoryCommitServiceServer interface { + mustEmbedUnimplementedRepositoryCommitServiceServer() +} + +func RegisterRepositoryCommitServiceServer(s grpc.ServiceRegistrar, srv RepositoryCommitServiceServer) { + s.RegisterService(&RepositoryCommitService_ServiceDesc, srv) +} + +func _RepositoryCommitService_ListRepositoryCommitsByBranch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoryCommitsByBranchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryCommitServiceServer).ListRepositoryCommitsByBranch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryCommitService_ListRepositoryCommitsByBranch_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryCommitServiceServer).ListRepositoryCommitsByBranch(ctx, req.(*ListRepositoryCommitsByBranchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryCommitService_ListRepositoryCommitsByReference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoryCommitsByReferenceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryCommitServiceServer).ListRepositoryCommitsByReference(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryCommitService_ListRepositoryCommitsByReference_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryCommitServiceServer).ListRepositoryCommitsByReference(ctx, req.(*ListRepositoryCommitsByReferenceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryCommitService_GetRepositoryCommitByReference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepositoryCommitByReferenceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryCommitServiceServer).GetRepositoryCommitByReference(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryCommitService_GetRepositoryCommitByReference_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryCommitServiceServer).GetRepositoryCommitByReference(ctx, req.(*GetRepositoryCommitByReferenceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryCommitService_GetRepositoryCommitBySequenceId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepositoryCommitBySequenceIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryCommitServiceServer).GetRepositoryCommitBySequenceId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryCommitService_GetRepositoryCommitBySequenceId_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryCommitServiceServer).GetRepositoryCommitBySequenceId(ctx, req.(*GetRepositoryCommitBySequenceIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryCommitService_ListRepositoryDraftCommits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoryDraftCommitsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryCommitServiceServer).ListRepositoryDraftCommits(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryCommitService_ListRepositoryDraftCommits_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryCommitServiceServer).ListRepositoryDraftCommits(ctx, req.(*ListRepositoryDraftCommitsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryCommitService_DeleteRepositoryDraftCommit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRepositoryDraftCommitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryCommitServiceServer).DeleteRepositoryDraftCommit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryCommitService_DeleteRepositoryDraftCommit_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryCommitServiceServer).DeleteRepositoryDraftCommit(ctx, req.(*DeleteRepositoryDraftCommitRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RepositoryCommitService_ServiceDesc is the grpc.ServiceDesc for RepositoryCommitService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RepositoryCommitService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommitService", + HandlerType: (*RepositoryCommitServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListRepositoryCommitsByBranch", + Handler: _RepositoryCommitService_ListRepositoryCommitsByBranch_Handler, + }, + { + MethodName: "ListRepositoryCommitsByReference", + Handler: _RepositoryCommitService_ListRepositoryCommitsByReference_Handler, + }, + { + MethodName: "GetRepositoryCommitByReference", + Handler: _RepositoryCommitService_GetRepositoryCommitByReference_Handler, + }, + { + MethodName: "GetRepositoryCommitBySequenceId", + Handler: _RepositoryCommitService_GetRepositoryCommitBySequenceId_Handler, + }, + { + MethodName: "ListRepositoryDraftCommits", + Handler: _RepositoryCommitService_ListRepositoryDraftCommits_Handler, + }, + { + MethodName: "DeleteRepositoryDraftCommit", + Handler: _RepositoryCommitService_DeleteRepositoryDraftCommit_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/repository_commit.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_grpc.pb.go new file mode 100644 index 000000000..c9fea749f --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_grpc.pb.go @@ -0,0 +1,784 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/repository.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + RepositoryService_GetRepository_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepository" + RepositoryService_GetRepositoryByFullName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoryByFullName" + RepositoryService_ListRepositories_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositories" + RepositoryService_ListUserRepositories_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListUserRepositories" + RepositoryService_ListRepositoriesUserCanAccess_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositoriesUserCanAccess" + RepositoryService_ListOrganizationRepositories_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListOrganizationRepositories" + RepositoryService_CreateRepositoryByFullName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/CreateRepositoryByFullName" + RepositoryService_DeleteRepository_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeleteRepository" + RepositoryService_DeleteRepositoryByFullName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeleteRepositoryByFullName" + RepositoryService_DeprecateRepositoryByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/DeprecateRepositoryByName" + RepositoryService_UndeprecateRepositoryByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/UndeprecateRepositoryByName" + RepositoryService_GetRepositoriesByFullName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoriesByFullName" + RepositoryService_SetRepositoryContributor_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/SetRepositoryContributor" + RepositoryService_ListRepositoryContributors_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/ListRepositoryContributors" + RepositoryService_GetRepositoryContributor_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoryContributor" + RepositoryService_GetRepositorySettings_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositorySettings" + RepositoryService_UpdateRepositorySettingsByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/UpdateRepositorySettingsByName" + RepositoryService_GetRepositoriesMetadata_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService/GetRepositoriesMetadata" +) + +// RepositoryServiceClient is the client API for RepositoryService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type RepositoryServiceClient interface { + // GetRepository gets a repository by ID. + GetRepository(ctx context.Context, in *GetRepositoryRequest, opts ...grpc.CallOption) (*GetRepositoryResponse, error) + // GetRepositoryByFullName gets a repository by full name. + GetRepositoryByFullName(ctx context.Context, in *GetRepositoryByFullNameRequest, opts ...grpc.CallOption) (*GetRepositoryByFullNameResponse, error) + // ListRepositories lists all repositories. + ListRepositories(ctx context.Context, in *ListRepositoriesRequest, opts ...grpc.CallOption) (*ListRepositoriesResponse, error) + // ListUserRepositories lists all repositories belonging to a user. + ListUserRepositories(ctx context.Context, in *ListUserRepositoriesRequest, opts ...grpc.CallOption) (*ListUserRepositoriesResponse, error) + // ListRepositoriesUserCanAccess lists all repositories a user can access. + ListRepositoriesUserCanAccess(ctx context.Context, in *ListRepositoriesUserCanAccessRequest, opts ...grpc.CallOption) (*ListRepositoriesUserCanAccessResponse, error) + // ListOrganizationRepositories lists all repositories for an organization. + ListOrganizationRepositories(ctx context.Context, in *ListOrganizationRepositoriesRequest, opts ...grpc.CallOption) (*ListOrganizationRepositoriesResponse, error) + // CreateRepositoryByFullName creates a new repository by full name. + CreateRepositoryByFullName(ctx context.Context, in *CreateRepositoryByFullNameRequest, opts ...grpc.CallOption) (*CreateRepositoryByFullNameResponse, error) + // DeleteRepository deletes a repository. + DeleteRepository(ctx context.Context, in *DeleteRepositoryRequest, opts ...grpc.CallOption) (*DeleteRepositoryResponse, error) + // DeleteRepositoryByFullName deletes a repository by full name. + DeleteRepositoryByFullName(ctx context.Context, in *DeleteRepositoryByFullNameRequest, opts ...grpc.CallOption) (*DeleteRepositoryByFullNameResponse, error) + // DeprecateRepositoryByName deprecates the repository. + DeprecateRepositoryByName(ctx context.Context, in *DeprecateRepositoryByNameRequest, opts ...grpc.CallOption) (*DeprecateRepositoryByNameResponse, error) + // UndeprecateRepositoryByName makes the repository not deprecated and removes any deprecation_message. + UndeprecateRepositoryByName(ctx context.Context, in *UndeprecateRepositoryByNameRequest, opts ...grpc.CallOption) (*UndeprecateRepositoryByNameResponse, error) + // GetRepositoriesByFullName gets repositories by full name. Response order is unspecified. + // Errors if any of the repositories don't exist or the caller does not have access to any of the repositories. + GetRepositoriesByFullName(ctx context.Context, in *GetRepositoriesByFullNameRequest, opts ...grpc.CallOption) (*GetRepositoriesByFullNameResponse, error) + // SetRepositoryContributor sets the role of a user in the repository. + SetRepositoryContributor(ctx context.Context, in *SetRepositoryContributorRequest, opts ...grpc.CallOption) (*SetRepositoryContributorResponse, error) + // ListRepositoryContributors returns the list of contributors that has an explicit role against the repository. + // This does not include users who have implicit roles against the repository, unless they have also been + // assigned a role explicitly. + ListRepositoryContributors(ctx context.Context, in *ListRepositoryContributorsRequest, opts ...grpc.CallOption) (*ListRepositoryContributorsResponse, error) + // GetRepositoryContributor returns the contributor information of a user in a repository. + GetRepositoryContributor(ctx context.Context, in *GetRepositoryContributorRequest, opts ...grpc.CallOption) (*GetRepositoryContributorResponse, error) + // GetRepositorySettings gets the settings of a repository. + GetRepositorySettings(ctx context.Context, in *GetRepositorySettingsRequest, opts ...grpc.CallOption) (*GetRepositorySettingsResponse, error) + // UpdateRepositorySettingsByName updates the settings of a repository. + UpdateRepositorySettingsByName(ctx context.Context, in *UpdateRepositorySettingsByNameRequest, opts ...grpc.CallOption) (*UpdateRepositorySettingsByNameResponse, error) + // GetRepositoriesMetadata gets the metadata of the repositories in the request, the length of repositories in the + // request should match the length of the metadata in the response, and the order of repositories in the response + // should match the order of the metadata in the request. + GetRepositoriesMetadata(ctx context.Context, in *GetRepositoriesMetadataRequest, opts ...grpc.CallOption) (*GetRepositoriesMetadataResponse, error) +} + +type repositoryServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRepositoryServiceClient(cc grpc.ClientConnInterface) RepositoryServiceClient { + return &repositoryServiceClient{cc} +} + +func (c *repositoryServiceClient) GetRepository(ctx context.Context, in *GetRepositoryRequest, opts ...grpc.CallOption) (*GetRepositoryResponse, error) { + out := new(GetRepositoryResponse) + err := c.cc.Invoke(ctx, RepositoryService_GetRepository_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) GetRepositoryByFullName(ctx context.Context, in *GetRepositoryByFullNameRequest, opts ...grpc.CallOption) (*GetRepositoryByFullNameResponse, error) { + out := new(GetRepositoryByFullNameResponse) + err := c.cc.Invoke(ctx, RepositoryService_GetRepositoryByFullName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) ListRepositories(ctx context.Context, in *ListRepositoriesRequest, opts ...grpc.CallOption) (*ListRepositoriesResponse, error) { + out := new(ListRepositoriesResponse) + err := c.cc.Invoke(ctx, RepositoryService_ListRepositories_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) ListUserRepositories(ctx context.Context, in *ListUserRepositoriesRequest, opts ...grpc.CallOption) (*ListUserRepositoriesResponse, error) { + out := new(ListUserRepositoriesResponse) + err := c.cc.Invoke(ctx, RepositoryService_ListUserRepositories_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) ListRepositoriesUserCanAccess(ctx context.Context, in *ListRepositoriesUserCanAccessRequest, opts ...grpc.CallOption) (*ListRepositoriesUserCanAccessResponse, error) { + out := new(ListRepositoriesUserCanAccessResponse) + err := c.cc.Invoke(ctx, RepositoryService_ListRepositoriesUserCanAccess_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) ListOrganizationRepositories(ctx context.Context, in *ListOrganizationRepositoriesRequest, opts ...grpc.CallOption) (*ListOrganizationRepositoriesResponse, error) { + out := new(ListOrganizationRepositoriesResponse) + err := c.cc.Invoke(ctx, RepositoryService_ListOrganizationRepositories_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) CreateRepositoryByFullName(ctx context.Context, in *CreateRepositoryByFullNameRequest, opts ...grpc.CallOption) (*CreateRepositoryByFullNameResponse, error) { + out := new(CreateRepositoryByFullNameResponse) + err := c.cc.Invoke(ctx, RepositoryService_CreateRepositoryByFullName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) DeleteRepository(ctx context.Context, in *DeleteRepositoryRequest, opts ...grpc.CallOption) (*DeleteRepositoryResponse, error) { + out := new(DeleteRepositoryResponse) + err := c.cc.Invoke(ctx, RepositoryService_DeleteRepository_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) DeleteRepositoryByFullName(ctx context.Context, in *DeleteRepositoryByFullNameRequest, opts ...grpc.CallOption) (*DeleteRepositoryByFullNameResponse, error) { + out := new(DeleteRepositoryByFullNameResponse) + err := c.cc.Invoke(ctx, RepositoryService_DeleteRepositoryByFullName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) DeprecateRepositoryByName(ctx context.Context, in *DeprecateRepositoryByNameRequest, opts ...grpc.CallOption) (*DeprecateRepositoryByNameResponse, error) { + out := new(DeprecateRepositoryByNameResponse) + err := c.cc.Invoke(ctx, RepositoryService_DeprecateRepositoryByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) UndeprecateRepositoryByName(ctx context.Context, in *UndeprecateRepositoryByNameRequest, opts ...grpc.CallOption) (*UndeprecateRepositoryByNameResponse, error) { + out := new(UndeprecateRepositoryByNameResponse) + err := c.cc.Invoke(ctx, RepositoryService_UndeprecateRepositoryByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) GetRepositoriesByFullName(ctx context.Context, in *GetRepositoriesByFullNameRequest, opts ...grpc.CallOption) (*GetRepositoriesByFullNameResponse, error) { + out := new(GetRepositoriesByFullNameResponse) + err := c.cc.Invoke(ctx, RepositoryService_GetRepositoriesByFullName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) SetRepositoryContributor(ctx context.Context, in *SetRepositoryContributorRequest, opts ...grpc.CallOption) (*SetRepositoryContributorResponse, error) { + out := new(SetRepositoryContributorResponse) + err := c.cc.Invoke(ctx, RepositoryService_SetRepositoryContributor_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) ListRepositoryContributors(ctx context.Context, in *ListRepositoryContributorsRequest, opts ...grpc.CallOption) (*ListRepositoryContributorsResponse, error) { + out := new(ListRepositoryContributorsResponse) + err := c.cc.Invoke(ctx, RepositoryService_ListRepositoryContributors_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) GetRepositoryContributor(ctx context.Context, in *GetRepositoryContributorRequest, opts ...grpc.CallOption) (*GetRepositoryContributorResponse, error) { + out := new(GetRepositoryContributorResponse) + err := c.cc.Invoke(ctx, RepositoryService_GetRepositoryContributor_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) GetRepositorySettings(ctx context.Context, in *GetRepositorySettingsRequest, opts ...grpc.CallOption) (*GetRepositorySettingsResponse, error) { + out := new(GetRepositorySettingsResponse) + err := c.cc.Invoke(ctx, RepositoryService_GetRepositorySettings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) UpdateRepositorySettingsByName(ctx context.Context, in *UpdateRepositorySettingsByNameRequest, opts ...grpc.CallOption) (*UpdateRepositorySettingsByNameResponse, error) { + out := new(UpdateRepositorySettingsByNameResponse) + err := c.cc.Invoke(ctx, RepositoryService_UpdateRepositorySettingsByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryServiceClient) GetRepositoriesMetadata(ctx context.Context, in *GetRepositoriesMetadataRequest, opts ...grpc.CallOption) (*GetRepositoriesMetadataResponse, error) { + out := new(GetRepositoriesMetadataResponse) + err := c.cc.Invoke(ctx, RepositoryService_GetRepositoriesMetadata_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RepositoryServiceServer is the server API for RepositoryService service. +// All implementations must embed UnimplementedRepositoryServiceServer +// for forward compatibility +type RepositoryServiceServer interface { + // GetRepository gets a repository by ID. + GetRepository(context.Context, *GetRepositoryRequest) (*GetRepositoryResponse, error) + // GetRepositoryByFullName gets a repository by full name. + GetRepositoryByFullName(context.Context, *GetRepositoryByFullNameRequest) (*GetRepositoryByFullNameResponse, error) + // ListRepositories lists all repositories. + ListRepositories(context.Context, *ListRepositoriesRequest) (*ListRepositoriesResponse, error) + // ListUserRepositories lists all repositories belonging to a user. + ListUserRepositories(context.Context, *ListUserRepositoriesRequest) (*ListUserRepositoriesResponse, error) + // ListRepositoriesUserCanAccess lists all repositories a user can access. + ListRepositoriesUserCanAccess(context.Context, *ListRepositoriesUserCanAccessRequest) (*ListRepositoriesUserCanAccessResponse, error) + // ListOrganizationRepositories lists all repositories for an organization. + ListOrganizationRepositories(context.Context, *ListOrganizationRepositoriesRequest) (*ListOrganizationRepositoriesResponse, error) + // CreateRepositoryByFullName creates a new repository by full name. + CreateRepositoryByFullName(context.Context, *CreateRepositoryByFullNameRequest) (*CreateRepositoryByFullNameResponse, error) + // DeleteRepository deletes a repository. + DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error) + // DeleteRepositoryByFullName deletes a repository by full name. + DeleteRepositoryByFullName(context.Context, *DeleteRepositoryByFullNameRequest) (*DeleteRepositoryByFullNameResponse, error) + // DeprecateRepositoryByName deprecates the repository. + DeprecateRepositoryByName(context.Context, *DeprecateRepositoryByNameRequest) (*DeprecateRepositoryByNameResponse, error) + // UndeprecateRepositoryByName makes the repository not deprecated and removes any deprecation_message. + UndeprecateRepositoryByName(context.Context, *UndeprecateRepositoryByNameRequest) (*UndeprecateRepositoryByNameResponse, error) + // GetRepositoriesByFullName gets repositories by full name. Response order is unspecified. + // Errors if any of the repositories don't exist or the caller does not have access to any of the repositories. + GetRepositoriesByFullName(context.Context, *GetRepositoriesByFullNameRequest) (*GetRepositoriesByFullNameResponse, error) + // SetRepositoryContributor sets the role of a user in the repository. + SetRepositoryContributor(context.Context, *SetRepositoryContributorRequest) (*SetRepositoryContributorResponse, error) + // ListRepositoryContributors returns the list of contributors that has an explicit role against the repository. + // This does not include users who have implicit roles against the repository, unless they have also been + // assigned a role explicitly. + ListRepositoryContributors(context.Context, *ListRepositoryContributorsRequest) (*ListRepositoryContributorsResponse, error) + // GetRepositoryContributor returns the contributor information of a user in a repository. + GetRepositoryContributor(context.Context, *GetRepositoryContributorRequest) (*GetRepositoryContributorResponse, error) + // GetRepositorySettings gets the settings of a repository. + GetRepositorySettings(context.Context, *GetRepositorySettingsRequest) (*GetRepositorySettingsResponse, error) + // UpdateRepositorySettingsByName updates the settings of a repository. + UpdateRepositorySettingsByName(context.Context, *UpdateRepositorySettingsByNameRequest) (*UpdateRepositorySettingsByNameResponse, error) + // GetRepositoriesMetadata gets the metadata of the repositories in the request, the length of repositories in the + // request should match the length of the metadata in the response, and the order of repositories in the response + // should match the order of the metadata in the request. + GetRepositoriesMetadata(context.Context, *GetRepositoriesMetadataRequest) (*GetRepositoriesMetadataResponse, error) + mustEmbedUnimplementedRepositoryServiceServer() +} + +// UnimplementedRepositoryServiceServer must be embedded to have forward compatible implementations. +type UnimplementedRepositoryServiceServer struct { +} + +func (UnimplementedRepositoryServiceServer) GetRepository(context.Context, *GetRepositoryRequest) (*GetRepositoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepository not implemented") +} +func (UnimplementedRepositoryServiceServer) GetRepositoryByFullName(context.Context, *GetRepositoryByFullNameRequest) (*GetRepositoryByFullNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepositoryByFullName not implemented") +} +func (UnimplementedRepositoryServiceServer) ListRepositories(context.Context, *ListRepositoriesRequest) (*ListRepositoriesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositories not implemented") +} +func (UnimplementedRepositoryServiceServer) ListUserRepositories(context.Context, *ListUserRepositoriesRequest) (*ListUserRepositoriesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUserRepositories not implemented") +} +func (UnimplementedRepositoryServiceServer) ListRepositoriesUserCanAccess(context.Context, *ListRepositoriesUserCanAccessRequest) (*ListRepositoriesUserCanAccessResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositoriesUserCanAccess not implemented") +} +func (UnimplementedRepositoryServiceServer) ListOrganizationRepositories(context.Context, *ListOrganizationRepositoriesRequest) (*ListOrganizationRepositoriesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListOrganizationRepositories not implemented") +} +func (UnimplementedRepositoryServiceServer) CreateRepositoryByFullName(context.Context, *CreateRepositoryByFullNameRequest) (*CreateRepositoryByFullNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRepositoryByFullName not implemented") +} +func (UnimplementedRepositoryServiceServer) DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRepository not implemented") +} +func (UnimplementedRepositoryServiceServer) DeleteRepositoryByFullName(context.Context, *DeleteRepositoryByFullNameRequest) (*DeleteRepositoryByFullNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRepositoryByFullName not implemented") +} +func (UnimplementedRepositoryServiceServer) DeprecateRepositoryByName(context.Context, *DeprecateRepositoryByNameRequest) (*DeprecateRepositoryByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeprecateRepositoryByName not implemented") +} +func (UnimplementedRepositoryServiceServer) UndeprecateRepositoryByName(context.Context, *UndeprecateRepositoryByNameRequest) (*UndeprecateRepositoryByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UndeprecateRepositoryByName not implemented") +} +func (UnimplementedRepositoryServiceServer) GetRepositoriesByFullName(context.Context, *GetRepositoriesByFullNameRequest) (*GetRepositoriesByFullNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepositoriesByFullName not implemented") +} +func (UnimplementedRepositoryServiceServer) SetRepositoryContributor(context.Context, *SetRepositoryContributorRequest) (*SetRepositoryContributorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetRepositoryContributor not implemented") +} +func (UnimplementedRepositoryServiceServer) ListRepositoryContributors(context.Context, *ListRepositoryContributorsRequest) (*ListRepositoryContributorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositoryContributors not implemented") +} +func (UnimplementedRepositoryServiceServer) GetRepositoryContributor(context.Context, *GetRepositoryContributorRequest) (*GetRepositoryContributorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepositoryContributor not implemented") +} +func (UnimplementedRepositoryServiceServer) GetRepositorySettings(context.Context, *GetRepositorySettingsRequest) (*GetRepositorySettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepositorySettings not implemented") +} +func (UnimplementedRepositoryServiceServer) UpdateRepositorySettingsByName(context.Context, *UpdateRepositorySettingsByNameRequest) (*UpdateRepositorySettingsByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateRepositorySettingsByName not implemented") +} +func (UnimplementedRepositoryServiceServer) GetRepositoriesMetadata(context.Context, *GetRepositoriesMetadataRequest) (*GetRepositoriesMetadataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRepositoriesMetadata not implemented") +} +func (UnimplementedRepositoryServiceServer) mustEmbedUnimplementedRepositoryServiceServer() {} + +// UnsafeRepositoryServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RepositoryServiceServer will +// result in compilation errors. +type UnsafeRepositoryServiceServer interface { + mustEmbedUnimplementedRepositoryServiceServer() +} + +func RegisterRepositoryServiceServer(s grpc.ServiceRegistrar, srv RepositoryServiceServer) { + s.RegisterService(&RepositoryService_ServiceDesc, srv) +} + +func _RepositoryService_GetRepository_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepositoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).GetRepository(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_GetRepository_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).GetRepository(ctx, req.(*GetRepositoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_GetRepositoryByFullName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepositoryByFullNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).GetRepositoryByFullName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_GetRepositoryByFullName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).GetRepositoryByFullName(ctx, req.(*GetRepositoryByFullNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_ListRepositories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoriesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).ListRepositories(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_ListRepositories_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).ListRepositories(ctx, req.(*ListRepositoriesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_ListUserRepositories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserRepositoriesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).ListUserRepositories(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_ListUserRepositories_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).ListUserRepositories(ctx, req.(*ListUserRepositoriesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_ListRepositoriesUserCanAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoriesUserCanAccessRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).ListRepositoriesUserCanAccess(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_ListRepositoriesUserCanAccess_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).ListRepositoriesUserCanAccess(ctx, req.(*ListRepositoriesUserCanAccessRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_ListOrganizationRepositories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListOrganizationRepositoriesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).ListOrganizationRepositories(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_ListOrganizationRepositories_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).ListOrganizationRepositories(ctx, req.(*ListOrganizationRepositoriesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_CreateRepositoryByFullName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRepositoryByFullNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).CreateRepositoryByFullName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_CreateRepositoryByFullName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).CreateRepositoryByFullName(ctx, req.(*CreateRepositoryByFullNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_DeleteRepository_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRepositoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).DeleteRepository(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_DeleteRepository_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).DeleteRepository(ctx, req.(*DeleteRepositoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_DeleteRepositoryByFullName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRepositoryByFullNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).DeleteRepositoryByFullName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_DeleteRepositoryByFullName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).DeleteRepositoryByFullName(ctx, req.(*DeleteRepositoryByFullNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_DeprecateRepositoryByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeprecateRepositoryByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).DeprecateRepositoryByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_DeprecateRepositoryByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).DeprecateRepositoryByName(ctx, req.(*DeprecateRepositoryByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_UndeprecateRepositoryByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UndeprecateRepositoryByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).UndeprecateRepositoryByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_UndeprecateRepositoryByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).UndeprecateRepositoryByName(ctx, req.(*UndeprecateRepositoryByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_GetRepositoriesByFullName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepositoriesByFullNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).GetRepositoriesByFullName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_GetRepositoriesByFullName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).GetRepositoriesByFullName(ctx, req.(*GetRepositoriesByFullNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_SetRepositoryContributor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetRepositoryContributorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).SetRepositoryContributor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_SetRepositoryContributor_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).SetRepositoryContributor(ctx, req.(*SetRepositoryContributorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_ListRepositoryContributors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoryContributorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).ListRepositoryContributors(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_ListRepositoryContributors_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).ListRepositoryContributors(ctx, req.(*ListRepositoryContributorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_GetRepositoryContributor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepositoryContributorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).GetRepositoryContributor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_GetRepositoryContributor_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).GetRepositoryContributor(ctx, req.(*GetRepositoryContributorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_GetRepositorySettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepositorySettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).GetRepositorySettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_GetRepositorySettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).GetRepositorySettings(ctx, req.(*GetRepositorySettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_UpdateRepositorySettingsByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRepositorySettingsByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).UpdateRepositorySettingsByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_UpdateRepositorySettingsByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).UpdateRepositorySettingsByName(ctx, req.(*UpdateRepositorySettingsByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryService_GetRepositoriesMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRepositoriesMetadataRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryServiceServer).GetRepositoriesMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryService_GetRepositoriesMetadata_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryServiceServer).GetRepositoriesMetadata(ctx, req.(*GetRepositoriesMetadataRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RepositoryService_ServiceDesc is the grpc.ServiceDesc for RepositoryService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RepositoryService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryService", + HandlerType: (*RepositoryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetRepository", + Handler: _RepositoryService_GetRepository_Handler, + }, + { + MethodName: "GetRepositoryByFullName", + Handler: _RepositoryService_GetRepositoryByFullName_Handler, + }, + { + MethodName: "ListRepositories", + Handler: _RepositoryService_ListRepositories_Handler, + }, + { + MethodName: "ListUserRepositories", + Handler: _RepositoryService_ListUserRepositories_Handler, + }, + { + MethodName: "ListRepositoriesUserCanAccess", + Handler: _RepositoryService_ListRepositoriesUserCanAccess_Handler, + }, + { + MethodName: "ListOrganizationRepositories", + Handler: _RepositoryService_ListOrganizationRepositories_Handler, + }, + { + MethodName: "CreateRepositoryByFullName", + Handler: _RepositoryService_CreateRepositoryByFullName_Handler, + }, + { + MethodName: "DeleteRepository", + Handler: _RepositoryService_DeleteRepository_Handler, + }, + { + MethodName: "DeleteRepositoryByFullName", + Handler: _RepositoryService_DeleteRepositoryByFullName_Handler, + }, + { + MethodName: "DeprecateRepositoryByName", + Handler: _RepositoryService_DeprecateRepositoryByName_Handler, + }, + { + MethodName: "UndeprecateRepositoryByName", + Handler: _RepositoryService_UndeprecateRepositoryByName_Handler, + }, + { + MethodName: "GetRepositoriesByFullName", + Handler: _RepositoryService_GetRepositoriesByFullName_Handler, + }, + { + MethodName: "SetRepositoryContributor", + Handler: _RepositoryService_SetRepositoryContributor_Handler, + }, + { + MethodName: "ListRepositoryContributors", + Handler: _RepositoryService_ListRepositoryContributors_Handler, + }, + { + MethodName: "GetRepositoryContributor", + Handler: _RepositoryService_GetRepositoryContributor_Handler, + }, + { + MethodName: "GetRepositorySettings", + Handler: _RepositoryService_GetRepositorySettings_Handler, + }, + { + MethodName: "UpdateRepositorySettingsByName", + Handler: _RepositoryService_UpdateRepositorySettingsByName_Handler, + }, + { + MethodName: "GetRepositoriesMetadata", + Handler: _RepositoryService_GetRepositoriesMetadata_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/repository.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_tag.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_tag.pb.go new file mode 100644 index 000000000..6367bb45c --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_tag.pb.go @@ -0,0 +1,782 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/repository_tag.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type RepositoryTag struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // primary key, unique, immutable + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // immutable + CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // We reserve field number '3' for the update_time. + // google.protobuf.Timestamp update_time = 3; + // The name of the repository tag, e.g. "6e2e7f24718a76caa32a80d0e2b1841ef2c61403". + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // The name of the commit this tag belongs to. + CommitName string `protobuf:"bytes,5,opt,name=commit_name,json=commitName,proto3" json:"commit_name,omitempty"` + // The username of the author of the tag. + Author string `protobuf:"bytes,6,opt,name=author,proto3" json:"author,omitempty"` +} + +func (x *RepositoryTag) Reset() { + *x = RepositoryTag{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryTag) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryTag) ProtoMessage() {} + +func (x *RepositoryTag) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryTag.ProtoReflect.Descriptor instead. +func (*RepositoryTag) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_tag_proto_rawDescGZIP(), []int{0} +} + +func (x *RepositoryTag) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RepositoryTag) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *RepositoryTag) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RepositoryTag) GetCommitName() string { + if x != nil { + return x.CommitName + } + return "" +} + +func (x *RepositoryTag) GetAuthor() string { + if x != nil { + return x.Author + } + return "" +} + +type CreateRepositoryTagRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository this tag should be created on. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // The name of the repository tag, e.g. "6e2e7f24718a76caa32a80d0e2b1841ef2c61403". + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the commit this tag should be created for. + CommitName string `protobuf:"bytes,3,opt,name=commit_name,json=commitName,proto3" json:"commit_name,omitempty"` +} + +func (x *CreateRepositoryTagRequest) Reset() { + *x = CreateRepositoryTagRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRepositoryTagRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRepositoryTagRequest) ProtoMessage() {} + +func (x *CreateRepositoryTagRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRepositoryTagRequest.ProtoReflect.Descriptor instead. +func (*CreateRepositoryTagRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_tag_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateRepositoryTagRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *CreateRepositoryTagRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateRepositoryTagRequest) GetCommitName() string { + if x != nil { + return x.CommitName + } + return "" +} + +type CreateRepositoryTagResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryTag *RepositoryTag `protobuf:"bytes,1,opt,name=repository_tag,json=repositoryTag,proto3" json:"repository_tag,omitempty"` +} + +func (x *CreateRepositoryTagResponse) Reset() { + *x = CreateRepositoryTagResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRepositoryTagResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRepositoryTagResponse) ProtoMessage() {} + +func (x *CreateRepositoryTagResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRepositoryTagResponse.ProtoReflect.Descriptor instead. +func (*CreateRepositoryTagResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_tag_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateRepositoryTagResponse) GetRepositoryTag() *RepositoryTag { + if x != nil { + return x.RepositoryTag + } + return nil +} + +type ListRepositoryTagsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository whose tags should be listed. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListRepositoryTagsRequest) Reset() { + *x = ListRepositoryTagsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryTagsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryTagsRequest) ProtoMessage() {} + +func (x *ListRepositoryTagsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryTagsRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoryTagsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_tag_proto_rawDescGZIP(), []int{3} +} + +func (x *ListRepositoryTagsRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *ListRepositoryTagsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoryTagsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListRepositoryTagsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListRepositoryTagsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryTags []*RepositoryTag `protobuf:"bytes,1,rep,name=repository_tags,json=repositoryTags,proto3" json:"repository_tags,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoryTagsResponse) Reset() { + *x = ListRepositoryTagsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryTagsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryTagsResponse) ProtoMessage() {} + +func (x *ListRepositoryTagsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryTagsResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoryTagsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_tag_proto_rawDescGZIP(), []int{4} +} + +func (x *ListRepositoryTagsResponse) GetRepositoryTags() []*RepositoryTag { + if x != nil { + return x.RepositoryTags + } + return nil +} + +func (x *ListRepositoryTagsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListRepositoryTagsForReferenceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the repository whose tags should be listed. + RepositoryId string `protobuf:"bytes,1,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // The name of the reference. + Reference string `protobuf:"bytes,2,opt,name=reference,proto3" json:"reference,omitempty"` + PageSize uint32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListRepositoryTagsForReferenceRequest) Reset() { + *x = ListRepositoryTagsForReferenceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryTagsForReferenceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryTagsForReferenceRequest) ProtoMessage() {} + +func (x *ListRepositoryTagsForReferenceRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryTagsForReferenceRequest.ProtoReflect.Descriptor instead. +func (*ListRepositoryTagsForReferenceRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_tag_proto_rawDescGZIP(), []int{5} +} + +func (x *ListRepositoryTagsForReferenceRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *ListRepositoryTagsForReferenceRequest) GetReference() string { + if x != nil { + return x.Reference + } + return "" +} + +func (x *ListRepositoryTagsForReferenceRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListRepositoryTagsForReferenceRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListRepositoryTagsForReferenceRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListRepositoryTagsForReferenceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryTags []*RepositoryTag `protobuf:"bytes,1,rep,name=repository_tags,json=repositoryTags,proto3" json:"repository_tags,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListRepositoryTagsForReferenceResponse) Reset() { + *x = ListRepositoryTagsForReferenceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRepositoryTagsForReferenceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRepositoryTagsForReferenceResponse) ProtoMessage() {} + +func (x *ListRepositoryTagsForReferenceResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_repository_tag_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRepositoryTagsForReferenceResponse.ProtoReflect.Descriptor instead. +func (*ListRepositoryTagsForReferenceResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_repository_tag_proto_rawDescGZIP(), []int{6} +} + +func (x *ListRepositoryTagsForReferenceResponse) GetRepositoryTags() []*RepositoryTag { + if x != nil { + return x.RepositoryTags + } + return nil +} + +func (x *ListRepositoryTagsForReferenceResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +var File_registry_v1alpha1_repository_tag_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_repository_tag_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x74, + 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa9, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x22, 0x76, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, + 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x7e, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x52, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x22, 0x96, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, + 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, + 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, + 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x61, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x54, 0x61, 0x67, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, + 0x61, 0x67, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, + 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xc0, 0x01, 0x0a, 0x25, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, + 0x67, 0x73, 0x46, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xb3, + 0x01, 0x0a, 0x26, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x54, 0x61, 0x67, 0x73, 0x46, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0f, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x52, 0x0e, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xb8, 0x04, 0x0a, 0x14, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa9, 0x01, + 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x54, 0x61, 0x67, 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0xa6, 0x01, 0x0a, 0x12, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, + 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0xca, 0x01, 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x46, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x50, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x54, 0x61, 0x67, 0x73, 0x46, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x51, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x46, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, + 0xed, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x42, 0x12, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, + 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, + 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_repository_tag_proto_rawDescOnce sync.Once + file_registry_v1alpha1_repository_tag_proto_rawDescData = file_registry_v1alpha1_repository_tag_proto_rawDesc +) + +func file_registry_v1alpha1_repository_tag_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_repository_tag_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_repository_tag_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_repository_tag_proto_rawDescData) + }) + return file_registry_v1alpha1_repository_tag_proto_rawDescData +} + +var file_registry_v1alpha1_repository_tag_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_registry_v1alpha1_repository_tag_proto_goTypes = []interface{}{ + (*RepositoryTag)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + (*CreateRepositoryTagRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryTagRequest + (*CreateRepositoryTagResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryTagResponse + (*ListRepositoryTagsRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsRequest + (*ListRepositoryTagsResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsResponse + (*ListRepositoryTagsForReferenceRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsForReferenceRequest + (*ListRepositoryTagsForReferenceResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsForReferenceResponse + (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp +} +var file_registry_v1alpha1_repository_tag_proto_depIdxs = []int32{ + 7, // 0: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag.create_time:type_name -> google.protobuf.Timestamp + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryTagResponse.repository_tag:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsResponse.repository_tags:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsForReferenceResponse.repository_tags:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + 1, // 4: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.CreateRepositoryTag:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryTagRequest + 3, // 5: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTags:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsRequest + 5, // 6: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTagsForReference:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsForReferenceRequest + 2, // 7: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.CreateRepositoryTag:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateRepositoryTagResponse + 4, // 8: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTags:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsResponse + 6, // 9: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService.ListRepositoryTagsForReference:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListRepositoryTagsForReferenceResponse + 7, // [7:10] is the sub-list for method output_type + 4, // [4:7] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_repository_tag_proto_init() } +func file_registry_v1alpha1_repository_tag_proto_init() { + if File_registry_v1alpha1_repository_tag_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_repository_tag_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryTag); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_tag_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRepositoryTagRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_tag_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRepositoryTagResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_tag_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryTagsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_tag_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryTagsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_tag_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryTagsForReferenceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_repository_tag_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRepositoryTagsForReferenceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_repository_tag_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_repository_tag_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_repository_tag_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_repository_tag_proto_msgTypes, + }.Build() + File_registry_v1alpha1_repository_tag_proto = out.File + file_registry_v1alpha1_repository_tag_proto_rawDesc = nil + file_registry_v1alpha1_repository_tag_proto_goTypes = nil + file_registry_v1alpha1_repository_tag_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_tag_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_tag_grpc.pb.go new file mode 100644 index 000000000..6b6d298ed --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/repository_tag_grpc.pb.go @@ -0,0 +1,191 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/repository_tag.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + RepositoryTagService_CreateRepositoryTag_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/CreateRepositoryTag" + RepositoryTagService_ListRepositoryTags_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/ListRepositoryTags" + RepositoryTagService_ListRepositoryTagsForReference_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService/ListRepositoryTagsForReference" +) + +// RepositoryTagServiceClient is the client API for RepositoryTagService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type RepositoryTagServiceClient interface { + // CreateRepositoryTag creates a new repository tag. + CreateRepositoryTag(ctx context.Context, in *CreateRepositoryTagRequest, opts ...grpc.CallOption) (*CreateRepositoryTagResponse, error) + // ListRepositoryTags lists the repository tags associated with a Repository. + ListRepositoryTags(ctx context.Context, in *ListRepositoryTagsRequest, opts ...grpc.CallOption) (*ListRepositoryTagsResponse, error) + // ListRepositoryTagsForReference lists the repository tags associated with a repository + // reference name. + ListRepositoryTagsForReference(ctx context.Context, in *ListRepositoryTagsForReferenceRequest, opts ...grpc.CallOption) (*ListRepositoryTagsForReferenceResponse, error) +} + +type repositoryTagServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRepositoryTagServiceClient(cc grpc.ClientConnInterface) RepositoryTagServiceClient { + return &repositoryTagServiceClient{cc} +} + +func (c *repositoryTagServiceClient) CreateRepositoryTag(ctx context.Context, in *CreateRepositoryTagRequest, opts ...grpc.CallOption) (*CreateRepositoryTagResponse, error) { + out := new(CreateRepositoryTagResponse) + err := c.cc.Invoke(ctx, RepositoryTagService_CreateRepositoryTag_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryTagServiceClient) ListRepositoryTags(ctx context.Context, in *ListRepositoryTagsRequest, opts ...grpc.CallOption) (*ListRepositoryTagsResponse, error) { + out := new(ListRepositoryTagsResponse) + err := c.cc.Invoke(ctx, RepositoryTagService_ListRepositoryTags_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *repositoryTagServiceClient) ListRepositoryTagsForReference(ctx context.Context, in *ListRepositoryTagsForReferenceRequest, opts ...grpc.CallOption) (*ListRepositoryTagsForReferenceResponse, error) { + out := new(ListRepositoryTagsForReferenceResponse) + err := c.cc.Invoke(ctx, RepositoryTagService_ListRepositoryTagsForReference_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RepositoryTagServiceServer is the server API for RepositoryTagService service. +// All implementations must embed UnimplementedRepositoryTagServiceServer +// for forward compatibility +type RepositoryTagServiceServer interface { + // CreateRepositoryTag creates a new repository tag. + CreateRepositoryTag(context.Context, *CreateRepositoryTagRequest) (*CreateRepositoryTagResponse, error) + // ListRepositoryTags lists the repository tags associated with a Repository. + ListRepositoryTags(context.Context, *ListRepositoryTagsRequest) (*ListRepositoryTagsResponse, error) + // ListRepositoryTagsForReference lists the repository tags associated with a repository + // reference name. + ListRepositoryTagsForReference(context.Context, *ListRepositoryTagsForReferenceRequest) (*ListRepositoryTagsForReferenceResponse, error) + mustEmbedUnimplementedRepositoryTagServiceServer() +} + +// UnimplementedRepositoryTagServiceServer must be embedded to have forward compatible implementations. +type UnimplementedRepositoryTagServiceServer struct { +} + +func (UnimplementedRepositoryTagServiceServer) CreateRepositoryTag(context.Context, *CreateRepositoryTagRequest) (*CreateRepositoryTagResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRepositoryTag not implemented") +} +func (UnimplementedRepositoryTagServiceServer) ListRepositoryTags(context.Context, *ListRepositoryTagsRequest) (*ListRepositoryTagsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositoryTags not implemented") +} +func (UnimplementedRepositoryTagServiceServer) ListRepositoryTagsForReference(context.Context, *ListRepositoryTagsForReferenceRequest) (*ListRepositoryTagsForReferenceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRepositoryTagsForReference not implemented") +} +func (UnimplementedRepositoryTagServiceServer) mustEmbedUnimplementedRepositoryTagServiceServer() {} + +// UnsafeRepositoryTagServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RepositoryTagServiceServer will +// result in compilation errors. +type UnsafeRepositoryTagServiceServer interface { + mustEmbedUnimplementedRepositoryTagServiceServer() +} + +func RegisterRepositoryTagServiceServer(s grpc.ServiceRegistrar, srv RepositoryTagServiceServer) { + s.RegisterService(&RepositoryTagService_ServiceDesc, srv) +} + +func _RepositoryTagService_CreateRepositoryTag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRepositoryTagRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryTagServiceServer).CreateRepositoryTag(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryTagService_CreateRepositoryTag_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryTagServiceServer).CreateRepositoryTag(ctx, req.(*CreateRepositoryTagRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryTagService_ListRepositoryTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoryTagsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryTagServiceServer).ListRepositoryTags(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryTagService_ListRepositoryTags_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryTagServiceServer).ListRepositoryTags(ctx, req.(*ListRepositoryTagsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RepositoryTagService_ListRepositoryTagsForReference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRepositoryTagsForReferenceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RepositoryTagServiceServer).ListRepositoryTagsForReference(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RepositoryTagService_ListRepositoryTagsForReference_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RepositoryTagServiceServer).ListRepositoryTagsForReference(ctx, req.(*ListRepositoryTagsForReferenceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RepositoryTagService_ServiceDesc is the grpc.ServiceDesc for RepositoryTagService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RepositoryTagService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTagService", + HandlerType: (*RepositoryTagServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateRepositoryTag", + Handler: _RepositoryTagService_CreateRepositoryTag_Handler, + }, + { + MethodName: "ListRepositoryTags", + Handler: _RepositoryTagService_ListRepositoryTags_Handler, + }, + { + MethodName: "ListRepositoryTagsForReference", + Handler: _RepositoryTagService_ListRepositoryTagsForReference_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/repository_tag.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/resolve.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/resolve.pb.go new file mode 100644 index 000000000..249d106e8 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/resolve.pb.go @@ -0,0 +1,1381 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/resolve.proto + +package registryv1alpha1 + +import ( + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ResolvedReferenceType int32 + +const ( + ResolvedReferenceType_RESOLVED_REFERENCE_TYPE_UNSPECIFIED ResolvedReferenceType = 0 + ResolvedReferenceType_RESOLVED_REFERENCE_TYPE_COMMIT ResolvedReferenceType = 1 + ResolvedReferenceType_RESOLVED_REFERENCE_TYPE_TAG ResolvedReferenceType = 3 + ResolvedReferenceType_RESOLVED_REFERENCE_TYPE_DRAFT ResolvedReferenceType = 5 +) + +// Enum value maps for ResolvedReferenceType. +var ( + ResolvedReferenceType_name = map[int32]string{ + 0: "RESOLVED_REFERENCE_TYPE_UNSPECIFIED", + 1: "RESOLVED_REFERENCE_TYPE_COMMIT", + 3: "RESOLVED_REFERENCE_TYPE_TAG", + 5: "RESOLVED_REFERENCE_TYPE_DRAFT", + } + ResolvedReferenceType_value = map[string]int32{ + "RESOLVED_REFERENCE_TYPE_UNSPECIFIED": 0, + "RESOLVED_REFERENCE_TYPE_COMMIT": 1, + "RESOLVED_REFERENCE_TYPE_TAG": 3, + "RESOLVED_REFERENCE_TYPE_DRAFT": 5, + } +) + +func (x ResolvedReferenceType) Enum() *ResolvedReferenceType { + p := new(ResolvedReferenceType) + *p = x + return p +} + +func (x ResolvedReferenceType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ResolvedReferenceType) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_resolve_proto_enumTypes[0].Descriptor() +} + +func (ResolvedReferenceType) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_resolve_proto_enumTypes[0] +} + +func (x ResolvedReferenceType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ResolvedReferenceType.Descriptor instead. +func (ResolvedReferenceType) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{0} +} + +type GetModulePinsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ModuleReferences []*v1alpha1.ModuleReference `protobuf:"bytes,1,rep,name=module_references,json=moduleReferences,proto3" json:"module_references,omitempty"` + // current_module_pins allows for partial dependency updates by letting clients + // send a request with the pins for their current module and only the + // identities of the dependencies they want to update in module_references. + // + // When resolving, if a client supplied module pin is: + // - in the transitive closure of pins resolved from the module_references, + // the client supplied module pin will be an extra candidate for tie + // breaking. + // - NOT in the in the transitive closure of pins resolved from the + // module_references, it will be returned as is. + CurrentModulePins []*v1alpha1.ModulePin `protobuf:"bytes,2,rep,name=current_module_pins,json=currentModulePins,proto3" json:"current_module_pins,omitempty"` +} + +func (x *GetModulePinsRequest) Reset() { + *x = GetModulePinsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetModulePinsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetModulePinsRequest) ProtoMessage() {} + +func (x *GetModulePinsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetModulePinsRequest.ProtoReflect.Descriptor instead. +func (*GetModulePinsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{0} +} + +func (x *GetModulePinsRequest) GetModuleReferences() []*v1alpha1.ModuleReference { + if x != nil { + return x.ModuleReferences + } + return nil +} + +func (x *GetModulePinsRequest) GetCurrentModulePins() []*v1alpha1.ModulePin { + if x != nil { + return x.CurrentModulePins + } + return nil +} + +type GetModulePinsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ModulePins []*v1alpha1.ModulePin `protobuf:"bytes,1,rep,name=module_pins,json=modulePins,proto3" json:"module_pins,omitempty"` +} + +func (x *GetModulePinsResponse) Reset() { + *x = GetModulePinsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetModulePinsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetModulePinsResponse) ProtoMessage() {} + +func (x *GetModulePinsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetModulePinsResponse.ProtoReflect.Descriptor instead. +func (*GetModulePinsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{1} +} + +func (x *GetModulePinsResponse) GetModulePins() []*v1alpha1.ModulePin { + if x != nil { + return x.ModulePins + } + return nil +} + +type GetLocalModulePinsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LocalModuleReferences []*LocalModuleReference `protobuf:"bytes,1,rep,name=local_module_references,json=localModuleReferences,proto3" json:"local_module_references,omitempty"` +} + +func (x *GetLocalModulePinsRequest) Reset() { + *x = GetLocalModulePinsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetLocalModulePinsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLocalModulePinsRequest) ProtoMessage() {} + +func (x *GetLocalModulePinsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLocalModulePinsRequest.ProtoReflect.Descriptor instead. +func (*GetLocalModulePinsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{2} +} + +func (x *GetLocalModulePinsRequest) GetLocalModuleReferences() []*LocalModuleReference { + if x != nil { + return x.LocalModuleReferences + } + return nil +} + +type LocalModuleResolveResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A copy of the reference that was resolved. + Reference *LocalModuleReference `protobuf:"bytes,1,opt,name=reference,proto3" json:"reference,omitempty"` + // The pin the reference resolved to. + Pin *LocalModulePin `protobuf:"bytes,2,opt,name=pin,proto3" json:"pin,omitempty"` + // The type the reference resolved as. + ResolvedReferenceType ResolvedReferenceType `protobuf:"varint,3,opt,name=resolved_reference_type,json=resolvedReferenceType,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.ResolvedReferenceType" json:"resolved_reference_type,omitempty"` +} + +func (x *LocalModuleResolveResult) Reset() { + *x = LocalModuleResolveResult{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalModuleResolveResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalModuleResolveResult) ProtoMessage() {} + +func (x *LocalModuleResolveResult) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalModuleResolveResult.ProtoReflect.Descriptor instead. +func (*LocalModuleResolveResult) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{3} +} + +func (x *LocalModuleResolveResult) GetReference() *LocalModuleReference { + if x != nil { + return x.Reference + } + return nil +} + +func (x *LocalModuleResolveResult) GetPin() *LocalModulePin { + if x != nil { + return x.Pin + } + return nil +} + +func (x *LocalModuleResolveResult) GetResolvedReferenceType() ResolvedReferenceType { + if x != nil { + return x.ResolvedReferenceType + } + return ResolvedReferenceType_RESOLVED_REFERENCE_TYPE_UNSPECIFIED +} + +type GetLocalModulePinsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LocalModuleResolveResults []*LocalModuleResolveResult `protobuf:"bytes,1,rep,name=local_module_resolve_results,json=localModuleResolveResults,proto3" json:"local_module_resolve_results,omitempty"` + // dependencies are the dependencies of the LocalModulePins. + // + // This includes the transitive deps. + Dependencies []*v1alpha1.ModulePin `protobuf:"bytes,2,rep,name=dependencies,proto3" json:"dependencies,omitempty"` +} + +func (x *GetLocalModulePinsResponse) Reset() { + *x = GetLocalModulePinsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetLocalModulePinsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLocalModulePinsResponse) ProtoMessage() {} + +func (x *GetLocalModulePinsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLocalModulePinsResponse.ProtoReflect.Descriptor instead. +func (*GetLocalModulePinsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{4} +} + +func (x *GetLocalModulePinsResponse) GetLocalModuleResolveResults() []*LocalModuleResolveResult { + if x != nil { + return x.LocalModuleResolveResults + } + return nil +} + +func (x *GetLocalModulePinsResponse) GetDependencies() []*v1alpha1.ModulePin { + if x != nil { + return x.Dependencies + } + return nil +} + +type GetGoVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The plugin reference to resolve. + PluginReference *GetRemotePackageVersionPlugin `protobuf:"bytes,1,opt,name=plugin_reference,json=pluginReference,proto3" json:"plugin_reference,omitempty"` + // The module reference to resolve. + ModuleReference *LocalModuleReference `protobuf:"bytes,2,opt,name=module_reference,json=moduleReference,proto3" json:"module_reference,omitempty"` +} + +func (x *GetGoVersionRequest) Reset() { + *x = GetGoVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGoVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGoVersionRequest) ProtoMessage() {} + +func (x *GetGoVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetGoVersionRequest.ProtoReflect.Descriptor instead. +func (*GetGoVersionRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{5} +} + +func (x *GetGoVersionRequest) GetPluginReference() *GetRemotePackageVersionPlugin { + if x != nil { + return x.PluginReference + } + return nil +} + +func (x *GetGoVersionRequest) GetModuleReference() *LocalModuleReference { + if x != nil { + return x.ModuleReference + } + return nil +} + +type GetGoVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // version is the resolved version to be used with the go module proxy. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GetGoVersionResponse) Reset() { + *x = GetGoVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGoVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGoVersionResponse) ProtoMessage() {} + +func (x *GetGoVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetGoVersionResponse.ProtoReflect.Descriptor instead. +func (*GetGoVersionResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{6} +} + +func (x *GetGoVersionResponse) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type GetMavenVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The plugin reference to resolve. + PluginReference *GetRemotePackageVersionPlugin `protobuf:"bytes,1,opt,name=plugin_reference,json=pluginReference,proto3" json:"plugin_reference,omitempty"` + // The module reference to resolve. + ModuleReference *LocalModuleReference `protobuf:"bytes,2,opt,name=module_reference,json=moduleReference,proto3" json:"module_reference,omitempty"` +} + +func (x *GetMavenVersionRequest) Reset() { + *x = GetMavenVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMavenVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMavenVersionRequest) ProtoMessage() {} + +func (x *GetMavenVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMavenVersionRequest.ProtoReflect.Descriptor instead. +func (*GetMavenVersionRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{7} +} + +func (x *GetMavenVersionRequest) GetPluginReference() *GetRemotePackageVersionPlugin { + if x != nil { + return x.PluginReference + } + return nil +} + +func (x *GetMavenVersionRequest) GetModuleReference() *LocalModuleReference { + if x != nil { + return x.ModuleReference + } + return nil +} + +type GetMavenVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // version is the resolved version to be used with the maven repository. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GetMavenVersionResponse) Reset() { + *x = GetMavenVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMavenVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMavenVersionResponse) ProtoMessage() {} + +func (x *GetMavenVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMavenVersionResponse.ProtoReflect.Descriptor instead. +func (*GetMavenVersionResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{8} +} + +func (x *GetMavenVersionResponse) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type GetNPMVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The plugin reference to resolve. + PluginReference *GetRemotePackageVersionPlugin `protobuf:"bytes,1,opt,name=plugin_reference,json=pluginReference,proto3" json:"plugin_reference,omitempty"` + // The module reference to resolve. + ModuleReference *LocalModuleReference `protobuf:"bytes,2,opt,name=module_reference,json=moduleReference,proto3" json:"module_reference,omitempty"` +} + +func (x *GetNPMVersionRequest) Reset() { + *x = GetNPMVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNPMVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNPMVersionRequest) ProtoMessage() {} + +func (x *GetNPMVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNPMVersionRequest.ProtoReflect.Descriptor instead. +func (*GetNPMVersionRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{9} +} + +func (x *GetNPMVersionRequest) GetPluginReference() *GetRemotePackageVersionPlugin { + if x != nil { + return x.PluginReference + } + return nil +} + +func (x *GetNPMVersionRequest) GetModuleReference() *LocalModuleReference { + if x != nil { + return x.ModuleReference + } + return nil +} + +type GetNPMVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // version is the resolved version to be used with the npm registryv1alpha1. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GetNPMVersionResponse) Reset() { + *x = GetNPMVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNPMVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNPMVersionResponse) ProtoMessage() {} + +func (x *GetNPMVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNPMVersionResponse.ProtoReflect.Descriptor instead. +func (*GetNPMVersionResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{10} +} + +func (x *GetNPMVersionResponse) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type GetSwiftVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The plugin reference to resolve. + PluginReference *GetRemotePackageVersionPlugin `protobuf:"bytes,1,opt,name=plugin_reference,json=pluginReference,proto3" json:"plugin_reference,omitempty"` + // The module reference to resolve. + ModuleReference *LocalModuleReference `protobuf:"bytes,2,opt,name=module_reference,json=moduleReference,proto3" json:"module_reference,omitempty"` +} + +func (x *GetSwiftVersionRequest) Reset() { + *x = GetSwiftVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSwiftVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSwiftVersionRequest) ProtoMessage() {} + +func (x *GetSwiftVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSwiftVersionRequest.ProtoReflect.Descriptor instead. +func (*GetSwiftVersionRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{11} +} + +func (x *GetSwiftVersionRequest) GetPluginReference() *GetRemotePackageVersionPlugin { + if x != nil { + return x.PluginReference + } + return nil +} + +func (x *GetSwiftVersionRequest) GetModuleReference() *LocalModuleReference { + if x != nil { + return x.ModuleReference + } + return nil +} + +type GetSwiftVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // version is the resolved version to be used with the swift registryv1alpha1. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GetSwiftVersionResponse) Reset() { + *x = GetSwiftVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSwiftVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSwiftVersionResponse) ProtoMessage() {} + +func (x *GetSwiftVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSwiftVersionResponse.ProtoReflect.Descriptor instead. +func (*GetSwiftVersionResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{12} +} + +func (x *GetSwiftVersionResponse) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +// GetRemotePackageVersionPlugin is a plugin reference. +// If the version is empty, this is a reference to the latest version. +type GetRemotePackageVersionPlugin struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the plugin. + // example: bufbuild + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the plugin. + // example: connect-go + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The version of the plugin. + // If empty, this is a reference to the latest version. + // example: v1.0.0 + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GetRemotePackageVersionPlugin) Reset() { + *x = GetRemotePackageVersionPlugin{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRemotePackageVersionPlugin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRemotePackageVersionPlugin) ProtoMessage() {} + +func (x *GetRemotePackageVersionPlugin) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resolve_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRemotePackageVersionPlugin.ProtoReflect.Descriptor instead. +func (*GetRemotePackageVersionPlugin) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resolve_proto_rawDescGZIP(), []int{13} +} + +func (x *GetRemotePackageVersionPlugin) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetRemotePackageVersionPlugin) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetRemotePackageVersionPlugin) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +var File_registry_v1alpha1_resolve_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_resolve_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1c, 0x6d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe1, 0x01, 0x0a, 0x14, 0x47, + 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x65, 0x0a, 0x11, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x10, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x62, 0x0a, 0x13, 0x63, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x70, 0x69, 0x6e, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x52, 0x11, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x22, 0x6c, + 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x5f, 0x70, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, + 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x22, 0x94, 0x01, 0x0a, + 0x19, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, + 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x77, 0x0a, 0x17, 0x6c, 0x6f, + 0x63, 0x61, 0x6c, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x15, 0x6c, 0x6f, + 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x73, 0x22, 0xc0, 0x02, 0x0a, 0x18, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x5d, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, + 0x4b, 0x0a, 0x03, 0x70, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x52, 0x03, 0x70, 0x69, 0x6e, 0x12, 0x78, 0x0a, 0x17, + 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x40, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, + 0x65, 0x64, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x15, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0xfb, 0x01, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x84, 0x01, 0x0a, 0x1c, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x5f, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x52, 0x19, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, + 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x56, 0x0a, 0x0c, + 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, + 0x63, 0x69, 0x65, 0x73, 0x22, 0xf6, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x73, 0x0a, 0x10, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x52, 0x0f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x12, 0x6a, 0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0f, 0x6d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x30, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, + 0xf9, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x73, 0x0a, 0x10, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x0f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, + 0x6a, 0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0f, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x33, 0x0a, 0x17, 0x47, + 0x65, 0x74, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x22, 0xf7, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4e, 0x50, 0x4d, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x73, 0x0a, 0x10, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x0f, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x6a, + 0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x31, 0x0a, 0x15, 0x47, 0x65, + 0x74, 0x4e, 0x50, 0x4d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf9, 0x01, + 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x77, 0x69, 0x66, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x73, 0x0a, 0x10, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x0f, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x6a, 0x0a, + 0x10, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x33, 0x0a, 0x17, 0x47, 0x65, 0x74, + 0x53, 0x77, 0x69, 0x66, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x63, + 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, + 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x2a, 0xf3, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, + 0x23, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, + 0x4e, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, + 0x45, 0x44, 0x5f, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x52, 0x45, + 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x41, 0x47, 0x10, 0x03, 0x12, 0x21, 0x0a, 0x1d, 0x52, + 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, + 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x52, 0x41, 0x46, 0x54, 0x10, 0x05, 0x22, 0x04, + 0x08, 0x02, 0x10, 0x02, 0x22, 0x04, 0x08, 0x04, 0x10, 0x04, 0x2a, 0x1e, 0x52, 0x45, 0x53, 0x4f, + 0x4c, 0x56, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48, 0x2a, 0x1d, 0x52, 0x45, 0x53, 0x4f, + 0x4c, 0x56, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x4b, 0x32, 0x9b, 0x06, 0x0a, 0x0e, 0x52, 0x65, + 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x97, 0x01, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x12, 0x3f, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x94, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x47, 0x6f, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x9d, 0x01, + 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x77, 0x69, 0x66, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x53, 0x77, 0x69, 0x66, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x53, 0x77, 0x69, 0x66, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x9d, 0x01, + 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x76, 0x65, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x97, 0x01, + 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x50, 0x4d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, + 0x50, 0x4d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x4e, 0x50, 0x4d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x32, 0xbe, 0x01, 0x0a, 0x13, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0xa6, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x50, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe7, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0c, 0x52, 0x65, 0x73, 0x6f, + 0x6c, 0x76, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, + 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, + 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_resolve_proto_rawDescOnce sync.Once + file_registry_v1alpha1_resolve_proto_rawDescData = file_registry_v1alpha1_resolve_proto_rawDesc +) + +func file_registry_v1alpha1_resolve_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_resolve_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_resolve_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_resolve_proto_rawDescData) + }) + return file_registry_v1alpha1_resolve_proto_rawDescData +} + +var file_registry_v1alpha1_resolve_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_resolve_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_registry_v1alpha1_resolve_proto_goTypes = []interface{}{ + (ResolvedReferenceType)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.ResolvedReferenceType + (*GetModulePinsRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetModulePinsRequest + (*GetModulePinsResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetModulePinsResponse + (*GetLocalModulePinsRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetLocalModulePinsRequest + (*LocalModuleResolveResult)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleResolveResult + (*GetLocalModulePinsResponse)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.GetLocalModulePinsResponse + (*GetGoVersionRequest)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.GetGoVersionRequest + (*GetGoVersionResponse)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.GetGoVersionResponse + (*GetMavenVersionRequest)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetMavenVersionRequest + (*GetMavenVersionResponse)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetMavenVersionResponse + (*GetNPMVersionRequest)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.GetNPMVersionRequest + (*GetNPMVersionResponse)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.GetNPMVersionResponse + (*GetSwiftVersionRequest)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.GetSwiftVersionRequest + (*GetSwiftVersionResponse)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.GetSwiftVersionResponse + (*GetRemotePackageVersionPlugin)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.GetRemotePackageVersionPlugin + (*v1alpha1.ModuleReference)(nil), // 15: bufman.dubbo.apache.org.module.v1alpha1.ModuleReference + (*v1alpha1.ModulePin)(nil), // 16: bufman.dubbo.apache.org.module.v1alpha1.ModulePin + (*LocalModuleReference)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference + (*LocalModulePin)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.LocalModulePin +} +var file_registry_v1alpha1_resolve_proto_depIdxs = []int32{ + 15, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetModulePinsRequest.module_references:type_name -> bufman.dubbo.apache.org.module.v1alpha1.ModuleReference + 16, // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetModulePinsRequest.current_module_pins:type_name -> bufman.dubbo.apache.org.module.v1alpha1.ModulePin + 16, // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetModulePinsResponse.module_pins:type_name -> bufman.dubbo.apache.org.module.v1alpha1.ModulePin + 17, // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetLocalModulePinsRequest.local_module_references:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference + 17, // 4: bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleResolveResult.reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference + 18, // 5: bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleResolveResult.pin:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModulePin + 0, // 6: bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleResolveResult.resolved_reference_type:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ResolvedReferenceType + 4, // 7: bufman.dubbo.apache.org.registry.v1alpha1.GetLocalModulePinsResponse.local_module_resolve_results:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleResolveResult + 16, // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetLocalModulePinsResponse.dependencies:type_name -> bufman.dubbo.apache.org.module.v1alpha1.ModulePin + 14, // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetGoVersionRequest.plugin_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GetRemotePackageVersionPlugin + 17, // 10: bufman.dubbo.apache.org.registry.v1alpha1.GetGoVersionRequest.module_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference + 14, // 11: bufman.dubbo.apache.org.registry.v1alpha1.GetMavenVersionRequest.plugin_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GetRemotePackageVersionPlugin + 17, // 12: bufman.dubbo.apache.org.registry.v1alpha1.GetMavenVersionRequest.module_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference + 14, // 13: bufman.dubbo.apache.org.registry.v1alpha1.GetNPMVersionRequest.plugin_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GetRemotePackageVersionPlugin + 17, // 14: bufman.dubbo.apache.org.registry.v1alpha1.GetNPMVersionRequest.module_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference + 14, // 15: bufman.dubbo.apache.org.registry.v1alpha1.GetSwiftVersionRequest.plugin_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GetRemotePackageVersionPlugin + 17, // 16: bufman.dubbo.apache.org.registry.v1alpha1.GetSwiftVersionRequest.module_reference:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.LocalModuleReference + 1, // 17: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetModulePins:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetModulePinsRequest + 6, // 18: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetGoVersion:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetGoVersionRequest + 12, // 19: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetSwiftVersion:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetSwiftVersionRequest + 8, // 20: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetMavenVersion:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetMavenVersionRequest + 10, // 21: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetNPMVersion:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetNPMVersionRequest + 3, // 22: bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService.GetLocalModulePins:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetLocalModulePinsRequest + 2, // 23: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetModulePins:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetModulePinsResponse + 7, // 24: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetGoVersion:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetGoVersionResponse + 13, // 25: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetSwiftVersion:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetSwiftVersionResponse + 9, // 26: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetMavenVersion:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetMavenVersionResponse + 11, // 27: bufman.dubbo.apache.org.registry.v1alpha1.ResolveService.GetNPMVersion:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetNPMVersionResponse + 5, // 28: bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService.GetLocalModulePins:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetLocalModulePinsResponse + 23, // [23:29] is the sub-list for method output_type + 17, // [17:23] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_resolve_proto_init() } +func file_registry_v1alpha1_resolve_proto_init() { + if File_registry_v1alpha1_resolve_proto != nil { + return + } + file_registry_v1alpha1_module_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_resolve_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetModulePinsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetModulePinsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetLocalModulePinsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalModuleResolveResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetLocalModulePinsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGoVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGoVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMavenVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMavenVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNPMVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNPMVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSwiftVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSwiftVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resolve_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRemotePackageVersionPlugin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_resolve_proto_rawDesc, + NumEnums: 1, + NumMessages: 14, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_registry_v1alpha1_resolve_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_resolve_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_resolve_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_resolve_proto_msgTypes, + }.Build() + File_registry_v1alpha1_resolve_proto = out.File + file_registry_v1alpha1_resolve_proto_rawDesc = nil + file_registry_v1alpha1_resolve_proto_goTypes = nil + file_registry_v1alpha1_resolve_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/resolve_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/resolve_grpc.pb.go new file mode 100644 index 000000000..b80c5557a --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/resolve_grpc.pb.go @@ -0,0 +1,393 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/resolve.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + ResolveService_GetModulePins_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetModulePins" + ResolveService_GetGoVersion_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetGoVersion" + ResolveService_GetSwiftVersion_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetSwiftVersion" + ResolveService_GetMavenVersion_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetMavenVersion" + ResolveService_GetNPMVersion_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ResolveService/GetNPMVersion" +) + +// ResolveServiceClient is the client API for ResolveService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ResolveServiceClient interface { + // GetModulePins finds all the latest digests and respective dependencies of + // the provided module references and picks a set of distinct modules pins. + // + // Note that module references with commits should still be passed to this function + // to make sure this function can do dependency resolution. + // + // This function also deals with tiebreaking what ModulePin wins for the same repository. + GetModulePins(ctx context.Context, in *GetModulePinsRequest, opts ...grpc.CallOption) (*GetModulePinsResponse, error) + // GetGoVersion resolves the given plugin and module references to a version. + GetGoVersion(ctx context.Context, in *GetGoVersionRequest, opts ...grpc.CallOption) (*GetGoVersionResponse, error) + // GetSwiftVersion resolves the given plugin and module references to a version. + GetSwiftVersion(ctx context.Context, in *GetSwiftVersionRequest, opts ...grpc.CallOption) (*GetSwiftVersionResponse, error) + // GetMavenVersion resolves the given plugin and module references to a version. + GetMavenVersion(ctx context.Context, in *GetMavenVersionRequest, opts ...grpc.CallOption) (*GetMavenVersionResponse, error) + // GetNPMVersion resolves the given plugin and module references to a version. + GetNPMVersion(ctx context.Context, in *GetNPMVersionRequest, opts ...grpc.CallOption) (*GetNPMVersionResponse, error) +} + +type resolveServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewResolveServiceClient(cc grpc.ClientConnInterface) ResolveServiceClient { + return &resolveServiceClient{cc} +} + +func (c *resolveServiceClient) GetModulePins(ctx context.Context, in *GetModulePinsRequest, opts ...grpc.CallOption) (*GetModulePinsResponse, error) { + out := new(GetModulePinsResponse) + err := c.cc.Invoke(ctx, ResolveService_GetModulePins_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *resolveServiceClient) GetGoVersion(ctx context.Context, in *GetGoVersionRequest, opts ...grpc.CallOption) (*GetGoVersionResponse, error) { + out := new(GetGoVersionResponse) + err := c.cc.Invoke(ctx, ResolveService_GetGoVersion_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *resolveServiceClient) GetSwiftVersion(ctx context.Context, in *GetSwiftVersionRequest, opts ...grpc.CallOption) (*GetSwiftVersionResponse, error) { + out := new(GetSwiftVersionResponse) + err := c.cc.Invoke(ctx, ResolveService_GetSwiftVersion_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *resolveServiceClient) GetMavenVersion(ctx context.Context, in *GetMavenVersionRequest, opts ...grpc.CallOption) (*GetMavenVersionResponse, error) { + out := new(GetMavenVersionResponse) + err := c.cc.Invoke(ctx, ResolveService_GetMavenVersion_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *resolveServiceClient) GetNPMVersion(ctx context.Context, in *GetNPMVersionRequest, opts ...grpc.CallOption) (*GetNPMVersionResponse, error) { + out := new(GetNPMVersionResponse) + err := c.cc.Invoke(ctx, ResolveService_GetNPMVersion_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ResolveServiceServer is the server API for ResolveService service. +// All implementations must embed UnimplementedResolveServiceServer +// for forward compatibility +type ResolveServiceServer interface { + // GetModulePins finds all the latest digests and respective dependencies of + // the provided module references and picks a set of distinct modules pins. + // + // Note that module references with commits should still be passed to this function + // to make sure this function can do dependency resolution. + // + // This function also deals with tiebreaking what ModulePin wins for the same repository. + GetModulePins(context.Context, *GetModulePinsRequest) (*GetModulePinsResponse, error) + // GetGoVersion resolves the given plugin and module references to a version. + GetGoVersion(context.Context, *GetGoVersionRequest) (*GetGoVersionResponse, error) + // GetSwiftVersion resolves the given plugin and module references to a version. + GetSwiftVersion(context.Context, *GetSwiftVersionRequest) (*GetSwiftVersionResponse, error) + // GetMavenVersion resolves the given plugin and module references to a version. + GetMavenVersion(context.Context, *GetMavenVersionRequest) (*GetMavenVersionResponse, error) + // GetNPMVersion resolves the given plugin and module references to a version. + GetNPMVersion(context.Context, *GetNPMVersionRequest) (*GetNPMVersionResponse, error) + mustEmbedUnimplementedResolveServiceServer() +} + +// UnimplementedResolveServiceServer must be embedded to have forward compatible implementations. +type UnimplementedResolveServiceServer struct { +} + +func (UnimplementedResolveServiceServer) GetModulePins(context.Context, *GetModulePinsRequest) (*GetModulePinsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetModulePins not implemented") +} +func (UnimplementedResolveServiceServer) GetGoVersion(context.Context, *GetGoVersionRequest) (*GetGoVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGoVersion not implemented") +} +func (UnimplementedResolveServiceServer) GetSwiftVersion(context.Context, *GetSwiftVersionRequest) (*GetSwiftVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSwiftVersion not implemented") +} +func (UnimplementedResolveServiceServer) GetMavenVersion(context.Context, *GetMavenVersionRequest) (*GetMavenVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMavenVersion not implemented") +} +func (UnimplementedResolveServiceServer) GetNPMVersion(context.Context, *GetNPMVersionRequest) (*GetNPMVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNPMVersion not implemented") +} +func (UnimplementedResolveServiceServer) mustEmbedUnimplementedResolveServiceServer() {} + +// UnsafeResolveServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ResolveServiceServer will +// result in compilation errors. +type UnsafeResolveServiceServer interface { + mustEmbedUnimplementedResolveServiceServer() +} + +func RegisterResolveServiceServer(s grpc.ServiceRegistrar, srv ResolveServiceServer) { + s.RegisterService(&ResolveService_ServiceDesc, srv) +} + +func _ResolveService_GetModulePins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetModulePinsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ResolveServiceServer).GetModulePins(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ResolveService_GetModulePins_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ResolveServiceServer).GetModulePins(ctx, req.(*GetModulePinsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ResolveService_GetGoVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGoVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ResolveServiceServer).GetGoVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ResolveService_GetGoVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ResolveServiceServer).GetGoVersion(ctx, req.(*GetGoVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ResolveService_GetSwiftVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSwiftVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ResolveServiceServer).GetSwiftVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ResolveService_GetSwiftVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ResolveServiceServer).GetSwiftVersion(ctx, req.(*GetSwiftVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ResolveService_GetMavenVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMavenVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ResolveServiceServer).GetMavenVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ResolveService_GetMavenVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ResolveServiceServer).GetMavenVersion(ctx, req.(*GetMavenVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ResolveService_GetNPMVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNPMVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ResolveServiceServer).GetNPMVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ResolveService_GetNPMVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ResolveServiceServer).GetNPMVersion(ctx, req.(*GetNPMVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ResolveService_ServiceDesc is the grpc.ServiceDesc for ResolveService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ResolveService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.ResolveService", + HandlerType: (*ResolveServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetModulePins", + Handler: _ResolveService_GetModulePins_Handler, + }, + { + MethodName: "GetGoVersion", + Handler: _ResolveService_GetGoVersion_Handler, + }, + { + MethodName: "GetSwiftVersion", + Handler: _ResolveService_GetSwiftVersion_Handler, + }, + { + MethodName: "GetMavenVersion", + Handler: _ResolveService_GetMavenVersion_Handler, + }, + { + MethodName: "GetNPMVersion", + Handler: _ResolveService_GetNPMVersion_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/resolve.proto", +} + +const ( + LocalResolveService_GetLocalModulePins_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService/GetLocalModulePins" +) + +// LocalResolveServiceClient is the client API for LocalResolveService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type LocalResolveServiceClient interface { + // GetLocalModulePins gets the latest pins for the specified local module references. + // It also includes all of the modules transitive dependencies for the specified references. + // + // We want this for two reasons: + // + // 1. It makes it easy to say "we know we're looking for owner/repo on this specific remote". + // While we could just do this in GetModulePins by being aware of what our remote is + // (something we probably still need to know, DNS problems aside, which are more + // theoretical), this helps. + // 2. Having a separate method makes us able to say "do not make decisions about what + // wins between competing pins for the same repo". This should only be done in + // GetModulePins, not in this function, i.e. only done at the top level. + GetLocalModulePins(ctx context.Context, in *GetLocalModulePinsRequest, opts ...grpc.CallOption) (*GetLocalModulePinsResponse, error) +} + +type localResolveServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewLocalResolveServiceClient(cc grpc.ClientConnInterface) LocalResolveServiceClient { + return &localResolveServiceClient{cc} +} + +func (c *localResolveServiceClient) GetLocalModulePins(ctx context.Context, in *GetLocalModulePinsRequest, opts ...grpc.CallOption) (*GetLocalModulePinsResponse, error) { + out := new(GetLocalModulePinsResponse) + err := c.cc.Invoke(ctx, LocalResolveService_GetLocalModulePins_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LocalResolveServiceServer is the server API for LocalResolveService service. +// All implementations must embed UnimplementedLocalResolveServiceServer +// for forward compatibility +type LocalResolveServiceServer interface { + // GetLocalModulePins gets the latest pins for the specified local module references. + // It also includes all of the modules transitive dependencies for the specified references. + // + // We want this for two reasons: + // + // 1. It makes it easy to say "we know we're looking for owner/repo on this specific remote". + // While we could just do this in GetModulePins by being aware of what our remote is + // (something we probably still need to know, DNS problems aside, which are more + // theoretical), this helps. + // 2. Having a separate method makes us able to say "do not make decisions about what + // wins between competing pins for the same repo". This should only be done in + // GetModulePins, not in this function, i.e. only done at the top level. + GetLocalModulePins(context.Context, *GetLocalModulePinsRequest) (*GetLocalModulePinsResponse, error) + mustEmbedUnimplementedLocalResolveServiceServer() +} + +// UnimplementedLocalResolveServiceServer must be embedded to have forward compatible implementations. +type UnimplementedLocalResolveServiceServer struct { +} + +func (UnimplementedLocalResolveServiceServer) GetLocalModulePins(context.Context, *GetLocalModulePinsRequest) (*GetLocalModulePinsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLocalModulePins not implemented") +} +func (UnimplementedLocalResolveServiceServer) mustEmbedUnimplementedLocalResolveServiceServer() {} + +// UnsafeLocalResolveServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LocalResolveServiceServer will +// result in compilation errors. +type UnsafeLocalResolveServiceServer interface { + mustEmbedUnimplementedLocalResolveServiceServer() +} + +func RegisterLocalResolveServiceServer(s grpc.ServiceRegistrar, srv LocalResolveServiceServer) { + s.RegisterService(&LocalResolveService_ServiceDesc, srv) +} + +func _LocalResolveService_GetLocalModulePins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetLocalModulePinsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LocalResolveServiceServer).GetLocalModulePins(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LocalResolveService_GetLocalModulePins_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LocalResolveServiceServer).GetLocalModulePins(ctx, req.(*GetLocalModulePinsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// LocalResolveService_ServiceDesc is the grpc.ServiceDesc for LocalResolveService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LocalResolveService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.LocalResolveService", + HandlerType: (*LocalResolveServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetLocalModulePins", + Handler: _LocalResolveService_GetLocalModulePins_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/resolve.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/resource.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/resource.pb.go new file mode 100644 index 000000000..ddff01f33 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/resource.pb.go @@ -0,0 +1,382 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/resource.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Resource struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Resource: + // + // *Resource_Repository + // *Resource_Plugin + Resource isResource_Resource `protobuf_oneof:"resource"` +} + +func (x *Resource) Reset() { + *x = Resource{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resource_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Resource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Resource) ProtoMessage() {} + +func (x *Resource) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resource_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Resource.ProtoReflect.Descriptor instead. +func (*Resource) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resource_proto_rawDescGZIP(), []int{0} +} + +func (m *Resource) GetResource() isResource_Resource { + if m != nil { + return m.Resource + } + return nil +} + +func (x *Resource) GetRepository() *Repository { + if x, ok := x.GetResource().(*Resource_Repository); ok { + return x.Repository + } + return nil +} + +func (x *Resource) GetPlugin() *CuratedPlugin { + if x, ok := x.GetResource().(*Resource_Plugin); ok { + return x.Plugin + } + return nil +} + +type isResource_Resource interface { + isResource_Resource() +} + +type Resource_Repository struct { + Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3,oneof"` +} + +type Resource_Plugin struct { + Plugin *CuratedPlugin `protobuf:"bytes,2,opt,name=plugin,proto3,oneof"` +} + +func (*Resource_Repository) isResource_Resource() {} + +func (*Resource_Plugin) isResource_Resource() {} + +type GetResourceByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Owner of the requested resource. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // Name of the requested resource. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetResourceByNameRequest) Reset() { + *x = GetResourceByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resource_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResourceByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResourceByNameRequest) ProtoMessage() {} + +func (x *GetResourceByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resource_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResourceByNameRequest.ProtoReflect.Descriptor instead. +func (*GetResourceByNameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resource_proto_rawDescGZIP(), []int{1} +} + +func (x *GetResourceByNameRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetResourceByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetResourceByNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` +} + +func (x *GetResourceByNameResponse) Reset() { + *x = GetResourceByNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_resource_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResourceByNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResourceByNameResponse) ProtoMessage() {} + +func (x *GetResourceByNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_resource_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResourceByNameResponse.ProtoReflect.Descriptor instead. +func (*GetResourceByNameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_resource_proto_rawDescGZIP(), []int{2} +} + +func (x *GetResourceByNameResponse) GetResource() *Resource { + if x != nil { + return x.Resource + } + return nil +} + +var File_registry_v1alpha1_resource_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_resource_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x27, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x63, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 0x01, 0x0a, 0x08, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x57, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x12, 0x52, 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x22, 0x44, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x6c, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x32, 0xb7, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa3, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x43, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe8, + 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x42, 0x0d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, + 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, + 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, + 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_registry_v1alpha1_resource_proto_rawDescOnce sync.Once + file_registry_v1alpha1_resource_proto_rawDescData = file_registry_v1alpha1_resource_proto_rawDesc +) + +func file_registry_v1alpha1_resource_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_resource_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_resource_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_resource_proto_rawDescData) + }) + return file_registry_v1alpha1_resource_proto_rawDescData +} + +var file_registry_v1alpha1_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_registry_v1alpha1_resource_proto_goTypes = []interface{}{ + (*Resource)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.Resource + (*GetResourceByNameRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetResourceByNameRequest + (*GetResourceByNameResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetResourceByNameResponse + (*Repository)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.Repository + (*CuratedPlugin)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin +} +var file_registry_v1alpha1_resource_proto_depIdxs = []int32{ + 3, // 0: bufman.dubbo.apache.org.registry.v1alpha1.Resource.repository:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 4, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Resource.plugin:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPlugin + 0, // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetResourceByNameResponse.resource:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Resource + 1, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ResourceService.GetResourceByName:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetResourceByNameRequest + 2, // 4: bufman.dubbo.apache.org.registry.v1alpha1.ResourceService.GetResourceByName:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetResourceByNameResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_resource_proto_init() } +func file_registry_v1alpha1_resource_proto_init() { + if File_registry_v1alpha1_resource_proto != nil { + return + } + file_registry_v1alpha1_plugin_curation_proto_init() + file_registry_v1alpha1_repository_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Resource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resource_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetResourceByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_resource_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetResourceByNameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_resource_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Resource_Repository)(nil), + (*Resource_Plugin)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_resource_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_resource_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_resource_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_resource_proto_msgTypes, + }.Build() + File_registry_v1alpha1_resource_proto = out.File + file_registry_v1alpha1_resource_proto_rawDesc = nil + file_registry_v1alpha1_resource_proto_goTypes = nil + file_registry_v1alpha1_resource_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/resource_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/resource_grpc.pb.go new file mode 100644 index 000000000..8418ce455 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/resource_grpc.pb.go @@ -0,0 +1,113 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/resource.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + ResourceService_GetResourceByName_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.ResourceService/GetResourceByName" +) + +// ResourceServiceClient is the client API for ResourceService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ResourceServiceClient interface { + // GetResourceByName takes a resource name and returns the + // resource either as a repository or a plugin. + GetResourceByName(ctx context.Context, in *GetResourceByNameRequest, opts ...grpc.CallOption) (*GetResourceByNameResponse, error) +} + +type resourceServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewResourceServiceClient(cc grpc.ClientConnInterface) ResourceServiceClient { + return &resourceServiceClient{cc} +} + +func (c *resourceServiceClient) GetResourceByName(ctx context.Context, in *GetResourceByNameRequest, opts ...grpc.CallOption) (*GetResourceByNameResponse, error) { + out := new(GetResourceByNameResponse) + err := c.cc.Invoke(ctx, ResourceService_GetResourceByName_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ResourceServiceServer is the server API for ResourceService service. +// All implementations must embed UnimplementedResourceServiceServer +// for forward compatibility +type ResourceServiceServer interface { + // GetResourceByName takes a resource name and returns the + // resource either as a repository or a plugin. + GetResourceByName(context.Context, *GetResourceByNameRequest) (*GetResourceByNameResponse, error) + mustEmbedUnimplementedResourceServiceServer() +} + +// UnimplementedResourceServiceServer must be embedded to have forward compatible implementations. +type UnimplementedResourceServiceServer struct { +} + +func (UnimplementedResourceServiceServer) GetResourceByName(context.Context, *GetResourceByNameRequest) (*GetResourceByNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetResourceByName not implemented") +} +func (UnimplementedResourceServiceServer) mustEmbedUnimplementedResourceServiceServer() {} + +// UnsafeResourceServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ResourceServiceServer will +// result in compilation errors. +type UnsafeResourceServiceServer interface { + mustEmbedUnimplementedResourceServiceServer() +} + +func RegisterResourceServiceServer(s grpc.ServiceRegistrar, srv ResourceServiceServer) { + s.RegisterService(&ResourceService_ServiceDesc, srv) +} + +func _ResourceService_GetResourceByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetResourceByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ResourceServiceServer).GetResourceByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ResourceService_GetResourceByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ResourceServiceServer).GetResourceByName(ctx, req.(*GetResourceByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ResourceService_ServiceDesc is the grpc.ServiceDesc for ResourceService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ResourceService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.ResourceService", + HandlerType: (*ResourceServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetResourceByName", + Handler: _ResourceService_GetResourceByName_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/resource.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/role.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/role.pb.go new file mode 100644 index 000000000..a518c5e41 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/role.pb.go @@ -0,0 +1,500 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/role.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The roles that users can have in a Server. +type ServerRole int32 + +const ( + ServerRole_SERVER_ROLE_UNSPECIFIED ServerRole = 0 + ServerRole_SERVER_ROLE_ADMIN ServerRole = 1 + ServerRole_SERVER_ROLE_MEMBER ServerRole = 2 +) + +// Enum value maps for ServerRole. +var ( + ServerRole_name = map[int32]string{ + 0: "SERVER_ROLE_UNSPECIFIED", + 1: "SERVER_ROLE_ADMIN", + 2: "SERVER_ROLE_MEMBER", + } + ServerRole_value = map[string]int32{ + "SERVER_ROLE_UNSPECIFIED": 0, + "SERVER_ROLE_ADMIN": 1, + "SERVER_ROLE_MEMBER": 2, + } +) + +func (x ServerRole) Enum() *ServerRole { + p := new(ServerRole) + *p = x + return p +} + +func (x ServerRole) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ServerRole) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_role_proto_enumTypes[0].Descriptor() +} + +func (ServerRole) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_role_proto_enumTypes[0] +} + +func (x ServerRole) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ServerRole.Descriptor instead. +func (ServerRole) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_role_proto_rawDescGZIP(), []int{0} +} + +// The roles that users can have in a Organization. +type OrganizationRole int32 + +const ( + OrganizationRole_ORGANIZATION_ROLE_UNSPECIFIED OrganizationRole = 0 + OrganizationRole_ORGANIZATION_ROLE_OWNER OrganizationRole = 1 + OrganizationRole_ORGANIZATION_ROLE_ADMIN OrganizationRole = 2 + OrganizationRole_ORGANIZATION_ROLE_MEMBER OrganizationRole = 3 + OrganizationRole_ORGANIZATION_ROLE_MACHINE OrganizationRole = 4 +) + +// Enum value maps for OrganizationRole. +var ( + OrganizationRole_name = map[int32]string{ + 0: "ORGANIZATION_ROLE_UNSPECIFIED", + 1: "ORGANIZATION_ROLE_OWNER", + 2: "ORGANIZATION_ROLE_ADMIN", + 3: "ORGANIZATION_ROLE_MEMBER", + 4: "ORGANIZATION_ROLE_MACHINE", + } + OrganizationRole_value = map[string]int32{ + "ORGANIZATION_ROLE_UNSPECIFIED": 0, + "ORGANIZATION_ROLE_OWNER": 1, + "ORGANIZATION_ROLE_ADMIN": 2, + "ORGANIZATION_ROLE_MEMBER": 3, + "ORGANIZATION_ROLE_MACHINE": 4, + } +) + +func (x OrganizationRole) Enum() *OrganizationRole { + p := new(OrganizationRole) + *p = x + return p +} + +func (x OrganizationRole) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OrganizationRole) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_role_proto_enumTypes[1].Descriptor() +} + +func (OrganizationRole) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_role_proto_enumTypes[1] +} + +func (x OrganizationRole) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OrganizationRole.Descriptor instead. +func (OrganizationRole) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_role_proto_rawDescGZIP(), []int{1} +} + +// The source of a user's role in an Organization. +type OrganizationRoleSource int32 + +const ( + OrganizationRoleSource_ORGANIZATION_ROLE_SOURCE_UNSPECIFIED OrganizationRoleSource = 0 + OrganizationRoleSource_ORGANIZATION_ROLE_SOURCE_DIRECT OrganizationRoleSource = 1 + OrganizationRoleSource_ORGANIZATION_ROLE_SOURCE_JIT OrganizationRoleSource = 2 + OrganizationRoleSource_ORGANIZATION_ROLE_SOURCE_IDP_GROUP OrganizationRoleSource = 3 +) + +// Enum value maps for OrganizationRoleSource. +var ( + OrganizationRoleSource_name = map[int32]string{ + 0: "ORGANIZATION_ROLE_SOURCE_UNSPECIFIED", + 1: "ORGANIZATION_ROLE_SOURCE_DIRECT", + 2: "ORGANIZATION_ROLE_SOURCE_JIT", + 3: "ORGANIZATION_ROLE_SOURCE_IDP_GROUP", + } + OrganizationRoleSource_value = map[string]int32{ + "ORGANIZATION_ROLE_SOURCE_UNSPECIFIED": 0, + "ORGANIZATION_ROLE_SOURCE_DIRECT": 1, + "ORGANIZATION_ROLE_SOURCE_JIT": 2, + "ORGANIZATION_ROLE_SOURCE_IDP_GROUP": 3, + } +) + +func (x OrganizationRoleSource) Enum() *OrganizationRoleSource { + p := new(OrganizationRoleSource) + *p = x + return p +} + +func (x OrganizationRoleSource) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OrganizationRoleSource) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_role_proto_enumTypes[2].Descriptor() +} + +func (OrganizationRoleSource) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_role_proto_enumTypes[2] +} + +func (x OrganizationRoleSource) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OrganizationRoleSource.Descriptor instead. +func (OrganizationRoleSource) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_role_proto_rawDescGZIP(), []int{2} +} + +// The roles that users can have for a Repository. +type RepositoryRole int32 + +const ( + RepositoryRole_REPOSITORY_ROLE_UNSPECIFIED RepositoryRole = 0 + RepositoryRole_REPOSITORY_ROLE_OWNER RepositoryRole = 1 + RepositoryRole_REPOSITORY_ROLE_ADMIN RepositoryRole = 2 + RepositoryRole_REPOSITORY_ROLE_WRITE RepositoryRole = 3 + RepositoryRole_REPOSITORY_ROLE_READ RepositoryRole = 4 + RepositoryRole_REPOSITORY_ROLE_LIMITED_WRITE RepositoryRole = 5 +) + +// Enum value maps for RepositoryRole. +var ( + RepositoryRole_name = map[int32]string{ + 0: "REPOSITORY_ROLE_UNSPECIFIED", + 1: "REPOSITORY_ROLE_OWNER", + 2: "REPOSITORY_ROLE_ADMIN", + 3: "REPOSITORY_ROLE_WRITE", + 4: "REPOSITORY_ROLE_READ", + 5: "REPOSITORY_ROLE_LIMITED_WRITE", + } + RepositoryRole_value = map[string]int32{ + "REPOSITORY_ROLE_UNSPECIFIED": 0, + "REPOSITORY_ROLE_OWNER": 1, + "REPOSITORY_ROLE_ADMIN": 2, + "REPOSITORY_ROLE_WRITE": 3, + "REPOSITORY_ROLE_READ": 4, + "REPOSITORY_ROLE_LIMITED_WRITE": 5, + } +) + +func (x RepositoryRole) Enum() *RepositoryRole { + p := new(RepositoryRole) + *p = x + return p +} + +func (x RepositoryRole) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RepositoryRole) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_role_proto_enumTypes[3].Descriptor() +} + +func (RepositoryRole) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_role_proto_enumTypes[3] +} + +func (x RepositoryRole) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RepositoryRole.Descriptor instead. +func (RepositoryRole) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_role_proto_rawDescGZIP(), []int{3} +} + +// The roles that users can have for a Template. +// +// Deprecated: Do not use. +type TemplateRole int32 + +const ( + TemplateRole_TEMPLATE_ROLE_UNSPECIFIED TemplateRole = 0 + TemplateRole_TEMPLATE_ROLE_OWNER TemplateRole = 1 + TemplateRole_TEMPLATE_ROLE_ADMIN TemplateRole = 2 + TemplateRole_TEMPLATE_ROLE_WRITE TemplateRole = 3 + TemplateRole_TEMPLATE_ROLE_READ TemplateRole = 4 +) + +// Enum value maps for TemplateRole. +var ( + TemplateRole_name = map[int32]string{ + 0: "TEMPLATE_ROLE_UNSPECIFIED", + 1: "TEMPLATE_ROLE_OWNER", + 2: "TEMPLATE_ROLE_ADMIN", + 3: "TEMPLATE_ROLE_WRITE", + 4: "TEMPLATE_ROLE_READ", + } + TemplateRole_value = map[string]int32{ + "TEMPLATE_ROLE_UNSPECIFIED": 0, + "TEMPLATE_ROLE_OWNER": 1, + "TEMPLATE_ROLE_ADMIN": 2, + "TEMPLATE_ROLE_WRITE": 3, + "TEMPLATE_ROLE_READ": 4, + } +) + +func (x TemplateRole) Enum() *TemplateRole { + p := new(TemplateRole) + *p = x + return p +} + +func (x TemplateRole) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TemplateRole) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_role_proto_enumTypes[4].Descriptor() +} + +func (TemplateRole) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_role_proto_enumTypes[4] +} + +func (x TemplateRole) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TemplateRole.Descriptor instead. +func (TemplateRole) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_role_proto_rawDescGZIP(), []int{4} +} + +// The roles that users can have for a Plugin. +// +// Deprecated: Do not use. +type PluginRole int32 + +const ( + PluginRole_PLUGIN_ROLE_UNSPECIFIED PluginRole = 0 + PluginRole_PLUGIN_ROLE_OWNER PluginRole = 1 + PluginRole_PLUGIN_ROLE_ADMIN PluginRole = 2 + PluginRole_PLUGIN_ROLE_WRITE PluginRole = 3 + PluginRole_PLUGIN_ROLE_READ PluginRole = 4 +) + +// Enum value maps for PluginRole. +var ( + PluginRole_name = map[int32]string{ + 0: "PLUGIN_ROLE_UNSPECIFIED", + 1: "PLUGIN_ROLE_OWNER", + 2: "PLUGIN_ROLE_ADMIN", + 3: "PLUGIN_ROLE_WRITE", + 4: "PLUGIN_ROLE_READ", + } + PluginRole_value = map[string]int32{ + "PLUGIN_ROLE_UNSPECIFIED": 0, + "PLUGIN_ROLE_OWNER": 1, + "PLUGIN_ROLE_ADMIN": 2, + "PLUGIN_ROLE_WRITE": 3, + "PLUGIN_ROLE_READ": 4, + } +) + +func (x PluginRole) Enum() *PluginRole { + p := new(PluginRole) + *p = x + return p +} + +func (x PluginRole) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PluginRole) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_role_proto_enumTypes[5].Descriptor() +} + +func (PluginRole) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_role_proto_enumTypes[5] +} + +func (x PluginRole) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PluginRole.Descriptor instead. +func (PluginRole) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_role_proto_rawDescGZIP(), []int{5} +} + +var File_registry_v1alpha1_role_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_role_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2a, 0x58, 0x0a, 0x0a, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x45, 0x52, 0x56, 0x45, + 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x52, + 0x4f, 0x4c, 0x45, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x53, + 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, + 0x52, 0x10, 0x02, 0x2a, 0xac, 0x01, 0x0a, 0x10, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x1d, 0x4f, 0x52, 0x47, 0x41, + 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x4f, + 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, + 0x5f, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x4f, 0x52, 0x47, 0x41, + 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x41, 0x44, + 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, + 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, + 0x52, 0x10, 0x03, 0x12, 0x1d, 0x0a, 0x19, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4d, 0x41, 0x43, 0x48, 0x49, 0x4e, 0x45, + 0x10, 0x04, 0x2a, 0xb1, 0x01, 0x0a, 0x16, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, + 0x24, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x4f, + 0x4c, 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x4f, 0x52, 0x47, 0x41, 0x4e, + 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x53, 0x4f, 0x55, + 0x52, 0x43, 0x45, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, + 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, + 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x4a, 0x49, 0x54, 0x10, 0x02, 0x12, 0x26, + 0x0a, 0x22, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, + 0x4f, 0x4c, 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x49, 0x44, 0x50, 0x5f, 0x47, + 0x52, 0x4f, 0x55, 0x50, 0x10, 0x03, 0x2a, 0xbf, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x52, 0x45, 0x50, + 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x52, 0x45, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x57, + 0x4e, 0x45, 0x52, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, + 0x4f, 0x52, 0x59, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, + 0x12, 0x19, 0x0a, 0x15, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x52, + 0x4f, 0x4c, 0x45, 0x5f, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, 0x52, + 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x52, + 0x45, 0x41, 0x44, 0x10, 0x04, 0x12, 0x21, 0x0a, 0x1d, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, + 0x4f, 0x52, 0x59, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, + 0x5f, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x05, 0x2a, 0x94, 0x01, 0x0a, 0x0c, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x54, 0x45, 0x4d, + 0x50, 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x45, 0x4d, 0x50, + 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, + 0x01, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x52, 0x4f, + 0x4c, 0x45, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x45, + 0x4d, 0x50, 0x4c, 0x41, 0x54, 0x45, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x57, 0x52, 0x49, 0x54, + 0x45, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x54, 0x45, 0x5f, + 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x10, 0x04, 0x1a, 0x02, 0x18, 0x01, 0x2a, + 0x88, 0x01, 0x0a, 0x0a, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x1b, + 0x0a, 0x17, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x50, + 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x57, 0x4e, 0x45, 0x52, + 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, + 0x45, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x4c, 0x55, + 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x03, + 0x12, 0x14, 0x0a, 0x10, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, + 0x52, 0x45, 0x41, 0x44, 0x10, 0x04, 0x1a, 0x02, 0x18, 0x01, 0x42, 0xe4, 0x02, 0x0a, 0x2d, 0x63, + 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x09, 0x52, 0x6f, + 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, + 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, + 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_role_proto_rawDescOnce sync.Once + file_registry_v1alpha1_role_proto_rawDescData = file_registry_v1alpha1_role_proto_rawDesc +) + +func file_registry_v1alpha1_role_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_role_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_role_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_role_proto_rawDescData) + }) + return file_registry_v1alpha1_role_proto_rawDescData +} + +var file_registry_v1alpha1_role_proto_enumTypes = make([]protoimpl.EnumInfo, 6) +var file_registry_v1alpha1_role_proto_goTypes = []interface{}{ + (ServerRole)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.ServerRole + (OrganizationRole)(0), // 1: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + (OrganizationRoleSource)(0), // 2: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource + (RepositoryRole)(0), // 3: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryRole + (TemplateRole)(0), // 4: bufman.dubbo.apache.org.registry.v1alpha1.TemplateRole + (PluginRole)(0), // 5: bufman.dubbo.apache.org.registry.v1alpha1.PluginRole +} +var file_registry_v1alpha1_role_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_role_proto_init() } +func file_registry_v1alpha1_role_proto_init() { + if File_registry_v1alpha1_role_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_role_proto_rawDesc, + NumEnums: 6, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_registry_v1alpha1_role_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_role_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_role_proto_enumTypes, + }.Build() + File_registry_v1alpha1_role_proto = out.File + file_registry_v1alpha1_role_proto_rawDesc = nil + file_registry_v1alpha1_role_proto_goTypes = nil + file_registry_v1alpha1_role_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/schema.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/schema.pb.go new file mode 100644 index 000000000..fc4afccd0 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/schema.pb.go @@ -0,0 +1,944 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/schema.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Format int32 + +const ( + Format_FORMAT_UNSPECIFIED Format = 0 + Format_FORMAT_BINARY Format = 1 + Format_FORMAT_JSON Format = 2 + Format_FORMAT_TEXT Format = 3 +) + +// Enum value maps for Format. +var ( + Format_name = map[int32]string{ + 0: "FORMAT_UNSPECIFIED", + 1: "FORMAT_BINARY", + 2: "FORMAT_JSON", + 3: "FORMAT_TEXT", + } + Format_value = map[string]int32{ + "FORMAT_UNSPECIFIED": 0, + "FORMAT_BINARY": 1, + "FORMAT_JSON": 2, + "FORMAT_TEXT": 3, + } +) + +func (x Format) Enum() *Format { + p := new(Format) + *p = x + return p +} + +func (x Format) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Format) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_schema_proto_enumTypes[0].Descriptor() +} + +func (Format) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_schema_proto_enumTypes[0] +} + +func (x Format) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Format.Descriptor instead. +func (Format) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_schema_proto_rawDescGZIP(), []int{0} +} + +type GetSchemaRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repo that contains the schema to retrieve (a user name or + // organization name). + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the repo that contains the schema to retrieve. + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + // Optional version of the repo. If unspecified, defaults to latest version on + // the repo's "main" branch. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + // Zero or more types names. The names may refer to messages, enums, services, + // methods, or extensions. All names must be fully-qualified. If any name + // is unknown, the request will fail and no schema will be returned. + // + // If no names are provided, the full schema for the module is returned. + // Otherwise, the resulting schema contains only the named elements and all of + // their dependencies. This is enough information for the caller to construct + // a dynamic message for any requested message types or to dynamically invoke + // an RPC for any requested methods or services. + Types []string `protobuf:"bytes,4,rep,name=types,proto3" json:"types,omitempty"` + // If present, this is a commit that the client already has cached. So if the + // given module version resolves to this same commit, the server should not + // send back any descriptors since the client already has them. + // + // This allows a client to efficiently poll for updates: after the initial RPC + // to get a schema, the client can cache the descriptors and the resolved + // commit. It then includes that commit in subsequent requests in this field, + // and the server will only reply with a schema (and new commit) if/when the + // resolved commit changes. + IfNotCommit string `protobuf:"bytes,5,opt,name=if_not_commit,json=ifNotCommit,proto3" json:"if_not_commit,omitempty"` + // If true, the returned schema will not include extension definitions for custom + // options that appear on schema elements. When filtering the schema based on the + // given element names, options on all encountered elements are usually examined + // as well. But that is not the case if excluding custom options. + // + // This flag is ignored if element_names is empty as the entire schema is always + // returned in that case. + ExcludeCustomOptions bool `protobuf:"varint,6,opt,name=exclude_custom_options,json=excludeCustomOptions,proto3" json:"exclude_custom_options,omitempty"` + // If true, the returned schema will not include known extensions for extendable + // messages for schema elements. If exclude_custom_options is true, such extensions + // may still be returned if the applicable descriptor options type is part of the + // requested schema. + // + // This flag is ignored if element_names is empty as the entire schema is always + // returned in that case. + ExcludeKnownExtensions bool `protobuf:"varint,7,opt,name=exclude_known_extensions,json=excludeKnownExtensions,proto3" json:"exclude_known_extensions,omitempty"` +} + +func (x *GetSchemaRequest) Reset() { + *x = GetSchemaRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSchemaRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSchemaRequest) ProtoMessage() {} + +func (x *GetSchemaRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSchemaRequest.ProtoReflect.Descriptor instead. +func (*GetSchemaRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_schema_proto_rawDescGZIP(), []int{0} +} + +func (x *GetSchemaRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetSchemaRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetSchemaRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *GetSchemaRequest) GetTypes() []string { + if x != nil { + return x.Types + } + return nil +} + +func (x *GetSchemaRequest) GetIfNotCommit() string { + if x != nil { + return x.IfNotCommit + } + return "" +} + +func (x *GetSchemaRequest) GetExcludeCustomOptions() bool { + if x != nil { + return x.ExcludeCustomOptions + } + return false +} + +func (x *GetSchemaRequest) GetExcludeKnownExtensions() bool { + if x != nil { + return x.ExcludeKnownExtensions + } + return false +} + +type GetSchemaResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The resolved version of the schema. If the requested version was a commit, + // this value is the same as that. If the requested version referred to a tag + // or branch, this is the commit for that tag or latest commit for that + // branch. If the request did not include any version, this is the latest + // version for the module's main branch. + Commit string `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"` + // The schema, which is a set of file descriptors that include the requested elements + // and their dependencies. + SchemaFiles *descriptorpb.FileDescriptorSet `protobuf:"bytes,2,opt,name=schema_files,json=schemaFiles,proto3" json:"schema_files,omitempty"` +} + +func (x *GetSchemaResponse) Reset() { + *x = GetSchemaResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSchemaResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSchemaResponse) ProtoMessage() {} + +func (x *GetSchemaResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSchemaResponse.ProtoReflect.Descriptor instead. +func (*GetSchemaResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_schema_proto_rawDescGZIP(), []int{1} +} + +func (x *GetSchemaResponse) GetCommit() string { + if x != nil { + return x.Commit + } + return "" +} + +func (x *GetSchemaResponse) GetSchemaFiles() *descriptorpb.FileDescriptorSet { + if x != nil { + return x.SchemaFiles + } + return nil +} + +type ConvertMessageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repo that contains the schema to retrieve (a user name or + // organization name). + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the repo that contains the schema to retrieve. + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + // Optional version of the repo. This can be a tag or branch name or a commit. + // If unspecified, defaults to latest version on the repo's "main" branch. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + // The fully-qualified name of the message. Required. + MessageName string `protobuf:"bytes,4,opt,name=message_name,json=messageName,proto3" json:"message_name,omitempty"` + // The format of the input data. Required. + InputFormat Format `protobuf:"varint,5,opt,name=input_format,json=inputFormat,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Format" json:"input_format,omitempty"` + // The input data that is to be converted. Required. This must be + // a valid encoding of type indicated by message_name in the format + // indicated by input_format. + InputData []byte `protobuf:"bytes,6,opt,name=input_data,json=inputData,proto3" json:"input_data,omitempty"` + // If true, any unresolvable fields in the input are discarded. For + // formats other than FORMAT_BINARY, this means that the operation + // will fail if the input contains unrecognized field names. For + // FORMAT_BINARY, unrecognized fields can be retained and possibly + // included in the reformatted output (depending on the requested + // output format). + DiscardUnknown bool `protobuf:"varint,7,opt,name=discard_unknown,json=discardUnknown,proto3" json:"discard_unknown,omitempty"` + // Types that are assignable to OutputFormat: + // + // *ConvertMessageRequest_OutputBinary + // *ConvertMessageRequest_OutputJson + // *ConvertMessageRequest_OutputText + OutputFormat isConvertMessageRequest_OutputFormat `protobuf_oneof:"output_format"` +} + +func (x *ConvertMessageRequest) Reset() { + *x = ConvertMessageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvertMessageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvertMessageRequest) ProtoMessage() {} + +func (x *ConvertMessageRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvertMessageRequest.ProtoReflect.Descriptor instead. +func (*ConvertMessageRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_schema_proto_rawDescGZIP(), []int{2} +} + +func (x *ConvertMessageRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *ConvertMessageRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *ConvertMessageRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *ConvertMessageRequest) GetMessageName() string { + if x != nil { + return x.MessageName + } + return "" +} + +func (x *ConvertMessageRequest) GetInputFormat() Format { + if x != nil { + return x.InputFormat + } + return Format_FORMAT_UNSPECIFIED +} + +func (x *ConvertMessageRequest) GetInputData() []byte { + if x != nil { + return x.InputData + } + return nil +} + +func (x *ConvertMessageRequest) GetDiscardUnknown() bool { + if x != nil { + return x.DiscardUnknown + } + return false +} + +func (m *ConvertMessageRequest) GetOutputFormat() isConvertMessageRequest_OutputFormat { + if m != nil { + return m.OutputFormat + } + return nil +} + +func (x *ConvertMessageRequest) GetOutputBinary() *BinaryOutputOptions { + if x, ok := x.GetOutputFormat().(*ConvertMessageRequest_OutputBinary); ok { + return x.OutputBinary + } + return nil +} + +func (x *ConvertMessageRequest) GetOutputJson() *JSONOutputOptions { + if x, ok := x.GetOutputFormat().(*ConvertMessageRequest_OutputJson); ok { + return x.OutputJson + } + return nil +} + +func (x *ConvertMessageRequest) GetOutputText() *TextOutputOptions { + if x, ok := x.GetOutputFormat().(*ConvertMessageRequest_OutputText); ok { + return x.OutputText + } + return nil +} + +type isConvertMessageRequest_OutputFormat interface { + isConvertMessageRequest_OutputFormat() +} + +type ConvertMessageRequest_OutputBinary struct { + OutputBinary *BinaryOutputOptions `protobuf:"bytes,8,opt,name=output_binary,json=outputBinary,proto3,oneof"` +} + +type ConvertMessageRequest_OutputJson struct { + OutputJson *JSONOutputOptions `protobuf:"bytes,9,opt,name=output_json,json=outputJson,proto3,oneof"` +} + +type ConvertMessageRequest_OutputText struct { + OutputText *TextOutputOptions `protobuf:"bytes,10,opt,name=output_text,json=outputText,proto3,oneof"` +} + +func (*ConvertMessageRequest_OutputBinary) isConvertMessageRequest_OutputFormat() {} + +func (*ConvertMessageRequest_OutputJson) isConvertMessageRequest_OutputFormat() {} + +func (*ConvertMessageRequest_OutputText) isConvertMessageRequest_OutputFormat() {} + +type BinaryOutputOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *BinaryOutputOptions) Reset() { + *x = BinaryOutputOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BinaryOutputOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BinaryOutputOptions) ProtoMessage() {} + +func (x *BinaryOutputOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BinaryOutputOptions.ProtoReflect.Descriptor instead. +func (*BinaryOutputOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_schema_proto_rawDescGZIP(), []int{3} +} + +type JSONOutputOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Enum fields will be emitted as numeric values. If false (the dafault), enum + // fields are emitted as strings that are the enum values' names. + UseEnumNumbers bool `protobuf:"varint,3,opt,name=use_enum_numbers,json=useEnumNumbers,proto3" json:"use_enum_numbers,omitempty"` + // Includes fields that have their default values. This applies only to fields + // defined in proto3 syntax that have no explicit "optional" keyword. Other + // optional fields will be included if present in the input data. + IncludeDefaults bool `protobuf:"varint,4,opt,name=include_defaults,json=includeDefaults,proto3" json:"include_defaults,omitempty"` +} + +func (x *JSONOutputOptions) Reset() { + *x = JSONOutputOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JSONOutputOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JSONOutputOptions) ProtoMessage() {} + +func (x *JSONOutputOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JSONOutputOptions.ProtoReflect.Descriptor instead. +func (*JSONOutputOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_schema_proto_rawDescGZIP(), []int{4} +} + +func (x *JSONOutputOptions) GetUseEnumNumbers() bool { + if x != nil { + return x.UseEnumNumbers + } + return false +} + +func (x *JSONOutputOptions) GetIncludeDefaults() bool { + if x != nil { + return x.IncludeDefaults + } + return false +} + +type TextOutputOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If true and the input data includes unrecognized fields, the unrecognized + // fields will be preserved in the text output (using field numbers and raw + // values). + IncludeUnrecognized bool `protobuf:"varint,2,opt,name=include_unrecognized,json=includeUnrecognized,proto3" json:"include_unrecognized,omitempty"` +} + +func (x *TextOutputOptions) Reset() { + *x = TextOutputOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TextOutputOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TextOutputOptions) ProtoMessage() {} + +func (x *TextOutputOptions) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TextOutputOptions.ProtoReflect.Descriptor instead. +func (*TextOutputOptions) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_schema_proto_rawDescGZIP(), []int{5} +} + +func (x *TextOutputOptions) GetIncludeUnrecognized() bool { + if x != nil { + return x.IncludeUnrecognized + } + return false +} + +type ConvertMessageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The resolved version of the schema. If the requested version was a commit, + // this value is the same as that. If the requested version referred to a tag + // or branch, this is the commit for that tag or latest commit for that + // branch. If the request did not include any version, this is the latest + // version for the module's main branch. + Commit string `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"` + // The reformatted data. + OutputData []byte `protobuf:"bytes,2,opt,name=output_data,json=outputData,proto3" json:"output_data,omitempty"` +} + +func (x *ConvertMessageResponse) Reset() { + *x = ConvertMessageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvertMessageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvertMessageResponse) ProtoMessage() {} + +func (x *ConvertMessageResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_schema_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvertMessageResponse.ProtoReflect.Descriptor instead. +func (*ConvertMessageResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_schema_proto_rawDescGZIP(), []int{6} +} + +func (x *ConvertMessageResponse) GetCommit() string { + if x != nil { + return x.Commit + } + return "" +} + +func (x *ConvertMessageResponse) GetOutputData() []byte { + if x != nil { + return x.OutputData + } + return nil +} + +var File_registry_v1alpha1_schema_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_schema_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x20, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x02, + 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x66, 0x5f, 0x6e, + 0x6f, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x69, 0x66, 0x4e, 0x6f, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x34, 0x0a, 0x16, + 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x65, 0x78, + 0x63, 0x6c, 0x75, 0x64, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x6b, 0x6e, + 0x6f, 0x77, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4b, 0x6e, 0x6f, + 0x77, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x72, 0x0a, 0x11, + 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x45, 0x0a, 0x0c, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x53, 0x65, 0x74, 0x52, 0x0b, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x46, 0x69, 0x6c, 0x65, 0x73, + 0x22, 0xe2, 0x04, 0x0a, 0x15, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x54, 0x0a, + 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x52, 0x0b, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x44, 0x61, + 0x74, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x5f, 0x75, 0x6e, + 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x73, + 0x63, 0x61, 0x72, 0x64, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x65, 0x0a, 0x0d, 0x6f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, + 0x69, 0x6e, 0x61, 0x72, 0x79, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0c, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x42, 0x69, 0x6e, 0x61, + 0x72, 0x79, 0x12, 0x5f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x6a, 0x73, 0x6f, + 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4a, + 0x73, 0x6f, 0x6e, 0x12, 0x5f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x65, + 0x78, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x65, 0x78, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x54, 0x65, 0x78, 0x74, 0x42, 0x0f, 0x0a, 0x0d, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x4f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x68, 0x0a, 0x11, + 0x4a, 0x53, 0x4f, 0x4e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x75, 0x73, 0x65, + 0x45, 0x6e, 0x75, 0x6d, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x69, + 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x44, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x46, 0x0a, 0x11, 0x54, 0x65, 0x78, 0x74, 0x4f, 0x75, + 0x74, 0x70, 0x75, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x69, + 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x75, 0x6e, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, + 0x7a, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x55, 0x6e, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x51, + 0x0a, 0x16, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x44, 0x61, 0x74, + 0x61, 0x2a, 0x55, 0x0a, 0x06, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x16, 0x0a, 0x12, 0x46, + 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x42, 0x49, + 0x4e, 0x41, 0x52, 0x59, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, + 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x4f, 0x52, 0x4d, 0x41, + 0x54, 0x5f, 0x54, 0x45, 0x58, 0x54, 0x10, 0x03, 0x32, 0xb5, 0x02, 0x0a, 0x0d, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x8b, 0x01, 0x0a, 0x09, 0x47, + 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x95, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x40, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0xe6, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x42, 0x0b, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, + 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, + 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, + 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_registry_v1alpha1_schema_proto_rawDescOnce sync.Once + file_registry_v1alpha1_schema_proto_rawDescData = file_registry_v1alpha1_schema_proto_rawDesc +) + +func file_registry_v1alpha1_schema_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_schema_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_schema_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_schema_proto_rawDescData) + }) + return file_registry_v1alpha1_schema_proto_rawDescData +} + +var file_registry_v1alpha1_schema_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_schema_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_registry_v1alpha1_schema_proto_goTypes = []interface{}{ + (Format)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.Format + (*GetSchemaRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetSchemaRequest + (*GetSchemaResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetSchemaResponse + (*ConvertMessageRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.ConvertMessageRequest + (*BinaryOutputOptions)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.BinaryOutputOptions + (*JSONOutputOptions)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.JSONOutputOptions + (*TextOutputOptions)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.TextOutputOptions + (*ConvertMessageResponse)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.ConvertMessageResponse + (*descriptorpb.FileDescriptorSet)(nil), // 8: google.protobuf.FileDescriptorSet +} +var file_registry_v1alpha1_schema_proto_depIdxs = []int32{ + 8, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetSchemaResponse.schema_files:type_name -> google.protobuf.FileDescriptorSet + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.ConvertMessageRequest.input_format:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Format + 4, // 2: bufman.dubbo.apache.org.registry.v1alpha1.ConvertMessageRequest.output_binary:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.BinaryOutputOptions + 5, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ConvertMessageRequest.output_json:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.JSONOutputOptions + 6, // 4: bufman.dubbo.apache.org.registry.v1alpha1.ConvertMessageRequest.output_text:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.TextOutputOptions + 1, // 5: bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.GetSchema:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetSchemaRequest + 3, // 6: bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.ConvertMessage:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ConvertMessageRequest + 2, // 7: bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.GetSchema:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetSchemaResponse + 7, // 8: bufman.dubbo.apache.org.registry.v1alpha1.SchemaService.ConvertMessage:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ConvertMessageResponse + 7, // [7:9] is the sub-list for method output_type + 5, // [5:7] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_schema_proto_init() } +func file_registry_v1alpha1_schema_proto_init() { + if File_registry_v1alpha1_schema_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_schema_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSchemaRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_schema_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSchemaResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_schema_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvertMessageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_schema_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BinaryOutputOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_schema_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JSONOutputOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_schema_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TextOutputOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_schema_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvertMessageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_schema_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*ConvertMessageRequest_OutputBinary)(nil), + (*ConvertMessageRequest_OutputJson)(nil), + (*ConvertMessageRequest_OutputText)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_schema_proto_rawDesc, + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_schema_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_schema_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_schema_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_schema_proto_msgTypes, + }.Build() + File_registry_v1alpha1_schema_proto = out.File + file_registry_v1alpha1_schema_proto_rawDesc = nil + file_registry_v1alpha1_schema_proto_goTypes = nil + file_registry_v1alpha1_schema_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/schema_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/schema_grpc.pb.go new file mode 100644 index 000000000..87d00844e --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/schema_grpc.pb.go @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/schema.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + SchemaService_GetSchema_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SchemaService/GetSchema" + SchemaService_ConvertMessage_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SchemaService/ConvertMessage" +) + +// SchemaServiceClient is the client API for SchemaService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SchemaServiceClient interface { + // GetSchema allows the caller to download a schema for one or more requested + // types, RPC services, or RPC methods. + GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (*GetSchemaResponse, error) + // ConvertMessage allows the caller to convert a given message data blob from + // one format to another by referring to a type schema for the blob. + ConvertMessage(ctx context.Context, in *ConvertMessageRequest, opts ...grpc.CallOption) (*ConvertMessageResponse, error) +} + +type schemaServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSchemaServiceClient(cc grpc.ClientConnInterface) SchemaServiceClient { + return &schemaServiceClient{cc} +} + +func (c *schemaServiceClient) GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (*GetSchemaResponse, error) { + out := new(GetSchemaResponse) + err := c.cc.Invoke(ctx, SchemaService_GetSchema_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *schemaServiceClient) ConvertMessage(ctx context.Context, in *ConvertMessageRequest, opts ...grpc.CallOption) (*ConvertMessageResponse, error) { + out := new(ConvertMessageResponse) + err := c.cc.Invoke(ctx, SchemaService_ConvertMessage_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SchemaServiceServer is the server API for SchemaService service. +// All implementations must embed UnimplementedSchemaServiceServer +// for forward compatibility +type SchemaServiceServer interface { + // GetSchema allows the caller to download a schema for one or more requested + // types, RPC services, or RPC methods. + GetSchema(context.Context, *GetSchemaRequest) (*GetSchemaResponse, error) + // ConvertMessage allows the caller to convert a given message data blob from + // one format to another by referring to a type schema for the blob. + ConvertMessage(context.Context, *ConvertMessageRequest) (*ConvertMessageResponse, error) + mustEmbedUnimplementedSchemaServiceServer() +} + +// UnimplementedSchemaServiceServer must be embedded to have forward compatible implementations. +type UnimplementedSchemaServiceServer struct { +} + +func (UnimplementedSchemaServiceServer) GetSchema(context.Context, *GetSchemaRequest) (*GetSchemaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") +} +func (UnimplementedSchemaServiceServer) ConvertMessage(context.Context, *ConvertMessageRequest) (*ConvertMessageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConvertMessage not implemented") +} +func (UnimplementedSchemaServiceServer) mustEmbedUnimplementedSchemaServiceServer() {} + +// UnsafeSchemaServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SchemaServiceServer will +// result in compilation errors. +type UnsafeSchemaServiceServer interface { + mustEmbedUnimplementedSchemaServiceServer() +} + +func RegisterSchemaServiceServer(s grpc.ServiceRegistrar, srv SchemaServiceServer) { + s.RegisterService(&SchemaService_ServiceDesc, srv) +} + +func _SchemaService_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSchemaRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SchemaServiceServer).GetSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SchemaService_GetSchema_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SchemaServiceServer).GetSchema(ctx, req.(*GetSchemaRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SchemaService_ConvertMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConvertMessageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SchemaServiceServer).ConvertMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SchemaService_ConvertMessage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SchemaServiceServer).ConvertMessage(ctx, req.(*ConvertMessageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SchemaService_ServiceDesc is the grpc.ServiceDesc for SchemaService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SchemaService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.SchemaService", + HandlerType: (*SchemaServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSchema", + Handler: _SchemaService_GetSchema_Handler, + }, + { + MethodName: "ConvertMessage", + Handler: _SchemaService_ConvertMessage_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/schema.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/scim_token.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/scim_token.pb.go new file mode 100644 index 000000000..b6502b467 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/scim_token.pb.go @@ -0,0 +1,645 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/scim_token.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SCIMToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + ExpireTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"` +} + +func (x *SCIMToken) Reset() { + *x = SCIMToken{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SCIMToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SCIMToken) ProtoMessage() {} + +func (x *SCIMToken) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SCIMToken.ProtoReflect.Descriptor instead. +func (*SCIMToken) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_scim_token_proto_rawDescGZIP(), []int{0} +} + +func (x *SCIMToken) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SCIMToken) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *SCIMToken) GetExpireTime() *timestamppb.Timestamp { + if x != nil { + return x.ExpireTime + } + return nil +} + +type CreateSCIMTokenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The time until which the token should be valid. + // Must be in the future. May be null for no expiry. + ExpireTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"` +} + +func (x *CreateSCIMTokenRequest) Reset() { + *x = CreateSCIMTokenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateSCIMTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSCIMTokenRequest) ProtoMessage() {} + +func (x *CreateSCIMTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSCIMTokenRequest.ProtoReflect.Descriptor instead. +func (*CreateSCIMTokenRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_scim_token_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateSCIMTokenRequest) GetExpireTime() *timestamppb.Timestamp { + if x != nil { + return x.ExpireTime + } + return nil +} + +type CreateSCIMTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The plaintext token to use for authentication. + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *CreateSCIMTokenResponse) Reset() { + *x = CreateSCIMTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateSCIMTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSCIMTokenResponse) ProtoMessage() {} + +func (x *CreateSCIMTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSCIMTokenResponse.ProtoReflect.Descriptor instead. +func (*CreateSCIMTokenResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_scim_token_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateSCIMTokenResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type ListSCIMTokensRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListSCIMTokensRequest) Reset() { + *x = ListSCIMTokensRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSCIMTokensRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSCIMTokensRequest) ProtoMessage() {} + +func (x *ListSCIMTokensRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSCIMTokensRequest.ProtoReflect.Descriptor instead. +func (*ListSCIMTokensRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_scim_token_proto_rawDescGZIP(), []int{3} +} + +func (x *ListSCIMTokensRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListSCIMTokensRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListSCIMTokensRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListSCIMTokensResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tokens []*SCIMToken `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListSCIMTokensResponse) Reset() { + *x = ListSCIMTokensResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSCIMTokensResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSCIMTokensResponse) ProtoMessage() {} + +func (x *ListSCIMTokensResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSCIMTokensResponse.ProtoReflect.Descriptor instead. +func (*ListSCIMTokensResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_scim_token_proto_rawDescGZIP(), []int{4} +} + +func (x *ListSCIMTokensResponse) GetTokens() []*SCIMToken { + if x != nil { + return x.Tokens + } + return nil +} + +func (x *ListSCIMTokensResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type DeleteSCIMTokenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TokenId string `protobuf:"bytes,1,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (x *DeleteSCIMTokenRequest) Reset() { + *x = DeleteSCIMTokenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteSCIMTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSCIMTokenRequest) ProtoMessage() {} + +func (x *DeleteSCIMTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSCIMTokenRequest.ProtoReflect.Descriptor instead. +func (*DeleteSCIMTokenRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_scim_token_proto_rawDescGZIP(), []int{5} +} + +func (x *DeleteSCIMTokenRequest) GetTokenId() string { + if x != nil { + return x.TokenId + } + return "" +} + +type DeleteSCIMTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteSCIMTokenResponse) Reset() { + *x = DeleteSCIMTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteSCIMTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSCIMTokenResponse) ProtoMessage() {} + +func (x *DeleteSCIMTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_scim_token_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSCIMTokenResponse.ProtoReflect.Descriptor instead. +func (*DeleteSCIMTokenResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_scim_token_proto_rawDescGZIP(), []int{6} +} + +var File_registry_v1alpha1_scim_token_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_scim_token_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x73, 0x63, 0x69, 0x6d, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, + 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x95, 0x01, 0x0a, 0x09, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, + 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x65, + 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x55, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, + 0x2f, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x6d, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, + 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, + 0x8e, 0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x06, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, + 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x33, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, + 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xea, 0x03, 0x0a, 0x10, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x43, 0x49, 0x4d, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, + 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x9a, 0x01, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x12, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x9d, 0x01, + 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x43, 0x49, 0x4d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x42, 0xe9, 0x02, + 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, + 0x0e, 0x53, 0x63, 0x69, 0x6d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, + 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, + 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, + 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_registry_v1alpha1_scim_token_proto_rawDescOnce sync.Once + file_registry_v1alpha1_scim_token_proto_rawDescData = file_registry_v1alpha1_scim_token_proto_rawDesc +) + +func file_registry_v1alpha1_scim_token_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_scim_token_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_scim_token_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_scim_token_proto_rawDescData) + }) + return file_registry_v1alpha1_scim_token_proto_rawDescData +} + +var file_registry_v1alpha1_scim_token_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_registry_v1alpha1_scim_token_proto_goTypes = []interface{}{ + (*SCIMToken)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.SCIMToken + (*CreateSCIMTokenRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateSCIMTokenRequest + (*CreateSCIMTokenResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateSCIMTokenResponse + (*ListSCIMTokensRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListSCIMTokensRequest + (*ListSCIMTokensResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.ListSCIMTokensResponse + (*DeleteSCIMTokenRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.DeleteSCIMTokenRequest + (*DeleteSCIMTokenResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.DeleteSCIMTokenResponse + (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp +} +var file_registry_v1alpha1_scim_token_proto_depIdxs = []int32{ + 7, // 0: bufman.dubbo.apache.org.registry.v1alpha1.SCIMToken.create_time:type_name -> google.protobuf.Timestamp + 7, // 1: bufman.dubbo.apache.org.registry.v1alpha1.SCIMToken.expire_time:type_name -> google.protobuf.Timestamp + 7, // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateSCIMTokenRequest.expire_time:type_name -> google.protobuf.Timestamp + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListSCIMTokensResponse.tokens:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.SCIMToken + 1, // 4: bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.CreateSCIMToken:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateSCIMTokenRequest + 3, // 5: bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.ListSCIMTokens:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListSCIMTokensRequest + 5, // 6: bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.DeleteSCIMToken:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteSCIMTokenRequest + 2, // 7: bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.CreateSCIMToken:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateSCIMTokenResponse + 4, // 8: bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.ListSCIMTokens:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListSCIMTokensResponse + 6, // 9: bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService.DeleteSCIMToken:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteSCIMTokenResponse + 7, // [7:10] is the sub-list for method output_type + 4, // [4:7] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_scim_token_proto_init() } +func file_registry_v1alpha1_scim_token_proto_init() { + if File_registry_v1alpha1_scim_token_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_scim_token_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SCIMToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_scim_token_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateSCIMTokenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_scim_token_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateSCIMTokenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_scim_token_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSCIMTokensRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_scim_token_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSCIMTokensResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_scim_token_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteSCIMTokenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_scim_token_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteSCIMTokenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_scim_token_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_scim_token_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_scim_token_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_scim_token_proto_msgTypes, + }.Build() + File_registry_v1alpha1_scim_token_proto = out.File + file_registry_v1alpha1_scim_token_proto_rawDesc = nil + file_registry_v1alpha1_scim_token_proto_goTypes = nil + file_registry_v1alpha1_scim_token_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/scim_token_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/scim_token_grpc.pb.go new file mode 100644 index 000000000..c763b7078 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/scim_token_grpc.pb.go @@ -0,0 +1,201 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/scim_token.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + SCIMTokenService_CreateSCIMToken_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/CreateSCIMToken" + SCIMTokenService_ListSCIMTokens_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/ListSCIMTokens" + SCIMTokenService_DeleteSCIMToken_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService/DeleteSCIMToken" +) + +// SCIMTokenServiceClient is the client API for SCIMTokenService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SCIMTokenServiceClient interface { + // CreateToken creates a new token suitable for authentication to the SCIM API. + // + // This method requires authentication. + CreateSCIMToken(ctx context.Context, in *CreateSCIMTokenRequest, opts ...grpc.CallOption) (*CreateSCIMTokenResponse, error) + // ListTokens lists all active SCIM tokens. + // + // This method requires authentication. + ListSCIMTokens(ctx context.Context, in *ListSCIMTokensRequest, opts ...grpc.CallOption) (*ListSCIMTokensResponse, error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteSCIMToken(ctx context.Context, in *DeleteSCIMTokenRequest, opts ...grpc.CallOption) (*DeleteSCIMTokenResponse, error) +} + +type sCIMTokenServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSCIMTokenServiceClient(cc grpc.ClientConnInterface) SCIMTokenServiceClient { + return &sCIMTokenServiceClient{cc} +} + +func (c *sCIMTokenServiceClient) CreateSCIMToken(ctx context.Context, in *CreateSCIMTokenRequest, opts ...grpc.CallOption) (*CreateSCIMTokenResponse, error) { + out := new(CreateSCIMTokenResponse) + err := c.cc.Invoke(ctx, SCIMTokenService_CreateSCIMToken_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sCIMTokenServiceClient) ListSCIMTokens(ctx context.Context, in *ListSCIMTokensRequest, opts ...grpc.CallOption) (*ListSCIMTokensResponse, error) { + out := new(ListSCIMTokensResponse) + err := c.cc.Invoke(ctx, SCIMTokenService_ListSCIMTokens_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sCIMTokenServiceClient) DeleteSCIMToken(ctx context.Context, in *DeleteSCIMTokenRequest, opts ...grpc.CallOption) (*DeleteSCIMTokenResponse, error) { + out := new(DeleteSCIMTokenResponse) + err := c.cc.Invoke(ctx, SCIMTokenService_DeleteSCIMToken_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SCIMTokenServiceServer is the server API for SCIMTokenService service. +// All implementations must embed UnimplementedSCIMTokenServiceServer +// for forward compatibility +type SCIMTokenServiceServer interface { + // CreateToken creates a new token suitable for authentication to the SCIM API. + // + // This method requires authentication. + CreateSCIMToken(context.Context, *CreateSCIMTokenRequest) (*CreateSCIMTokenResponse, error) + // ListTokens lists all active SCIM tokens. + // + // This method requires authentication. + ListSCIMTokens(context.Context, *ListSCIMTokensRequest) (*ListSCIMTokensResponse, error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteSCIMToken(context.Context, *DeleteSCIMTokenRequest) (*DeleteSCIMTokenResponse, error) + mustEmbedUnimplementedSCIMTokenServiceServer() +} + +// UnimplementedSCIMTokenServiceServer must be embedded to have forward compatible implementations. +type UnimplementedSCIMTokenServiceServer struct { +} + +func (UnimplementedSCIMTokenServiceServer) CreateSCIMToken(context.Context, *CreateSCIMTokenRequest) (*CreateSCIMTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateSCIMToken not implemented") +} +func (UnimplementedSCIMTokenServiceServer) ListSCIMTokens(context.Context, *ListSCIMTokensRequest) (*ListSCIMTokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListSCIMTokens not implemented") +} +func (UnimplementedSCIMTokenServiceServer) DeleteSCIMToken(context.Context, *DeleteSCIMTokenRequest) (*DeleteSCIMTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteSCIMToken not implemented") +} +func (UnimplementedSCIMTokenServiceServer) mustEmbedUnimplementedSCIMTokenServiceServer() {} + +// UnsafeSCIMTokenServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SCIMTokenServiceServer will +// result in compilation errors. +type UnsafeSCIMTokenServiceServer interface { + mustEmbedUnimplementedSCIMTokenServiceServer() +} + +func RegisterSCIMTokenServiceServer(s grpc.ServiceRegistrar, srv SCIMTokenServiceServer) { + s.RegisterService(&SCIMTokenService_ServiceDesc, srv) +} + +func _SCIMTokenService_CreateSCIMToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSCIMTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SCIMTokenServiceServer).CreateSCIMToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SCIMTokenService_CreateSCIMToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SCIMTokenServiceServer).CreateSCIMToken(ctx, req.(*CreateSCIMTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SCIMTokenService_ListSCIMTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListSCIMTokensRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SCIMTokenServiceServer).ListSCIMTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SCIMTokenService_ListSCIMTokens_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SCIMTokenServiceServer).ListSCIMTokens(ctx, req.(*ListSCIMTokensRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SCIMTokenService_DeleteSCIMToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteSCIMTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SCIMTokenServiceServer).DeleteSCIMToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SCIMTokenService_DeleteSCIMToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SCIMTokenServiceServer).DeleteSCIMToken(ctx, req.(*DeleteSCIMTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SCIMTokenService_ServiceDesc is the grpc.ServiceDesc for SCIMTokenService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SCIMTokenService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.SCIMTokenService", + HandlerType: (*SCIMTokenServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateSCIMToken", + Handler: _SCIMTokenService_CreateSCIMToken_Handler, + }, + { + MethodName: "ListSCIMTokens", + Handler: _SCIMTokenService_ListSCIMTokens_Handler, + }, + { + MethodName: "DeleteSCIMToken", + Handler: _SCIMTokenService_DeleteSCIMToken_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/scim_token.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/search.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/search.pb.go new file mode 100644 index 000000000..fee947da4 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/search.pb.go @@ -0,0 +1,1825 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/search.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type OrderBy int32 + +const ( + OrderBy_ORDER_BY_UNSPECIFIED OrderBy = 0 + OrderBy_ORDER_BY_CREATE_TIME OrderBy = 1 + OrderBy_ORDER_BY_UPDATE_TIME OrderBy = 2 + OrderBy_ORDER_BY_NAME OrderBy = 3 +) + +// Enum value maps for OrderBy. +var ( + OrderBy_name = map[int32]string{ + 0: "ORDER_BY_UNSPECIFIED", + 1: "ORDER_BY_CREATE_TIME", + 2: "ORDER_BY_UPDATE_TIME", + 3: "ORDER_BY_NAME", + } + OrderBy_value = map[string]int32{ + "ORDER_BY_UNSPECIFIED": 0, + "ORDER_BY_CREATE_TIME": 1, + "ORDER_BY_UPDATE_TIME": 2, + "ORDER_BY_NAME": 3, + } +) + +func (x OrderBy) Enum() *OrderBy { + p := new(OrderBy) + *p = x + return p +} + +func (x OrderBy) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OrderBy) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_search_proto_enumTypes[0].Descriptor() +} + +func (OrderBy) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_search_proto_enumTypes[0] +} + +func (x OrderBy) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OrderBy.Descriptor instead. +func (OrderBy) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{0} +} + +type RepositorySearchResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the user + // who is the owner of this repository. + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + // The visibility of the repository. + Visibility Visibility `protobuf:"varint,4,opt,name=visibility,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.Visibility" json:"visibility,omitempty"` + Deprecated bool `protobuf:"varint,5,opt,name=deprecated,proto3" json:"deprecated,omitempty"` +} + +func (x *RepositorySearchResult) Reset() { + *x = RepositorySearchResult{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositorySearchResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositorySearchResult) ProtoMessage() {} + +func (x *RepositorySearchResult) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositorySearchResult.ProtoReflect.Descriptor instead. +func (*RepositorySearchResult) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{0} +} + +func (x *RepositorySearchResult) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RepositorySearchResult) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RepositorySearchResult) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *RepositorySearchResult) GetVisibility() Visibility { + if x != nil { + return x.Visibility + } + return Visibility_VISIBILITY_UNSPECIFIED +} + +func (x *RepositorySearchResult) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +type CommitSearchResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // commit id + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // commit name + // The name of the user + // who is the owner of this repository. + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + // The name of the repository. + RepositoryName string `protobuf:"bytes,4,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` +} + +func (x *CommitSearchResult) Reset() { + *x = CommitSearchResult{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommitSearchResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommitSearchResult) ProtoMessage() {} + +func (x *CommitSearchResult) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommitSearchResult.ProtoReflect.Descriptor instead. +func (*CommitSearchResult) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{1} +} + +func (x *CommitSearchResult) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CommitSearchResult) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CommitSearchResult) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *CommitSearchResult) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +type UserSearchResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Deactivated bool `protobuf:"varint,3,opt,name=deactivated,proto3" json:"deactivated,omitempty"` +} + +func (x *UserSearchResult) Reset() { + *x = UserSearchResult{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserSearchResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserSearchResult) ProtoMessage() {} + +func (x *UserSearchResult) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserSearchResult.ProtoReflect.Descriptor instead. +func (*UserSearchResult) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{2} +} + +func (x *UserSearchResult) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UserSearchResult) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UserSearchResult) GetDeactivated() bool { + if x != nil { + return x.Deactivated + } + return false +} + +type CuratedPluginSearchResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The name of the user or organization + // who is the owner of this plugin. + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + Deprecated bool `protobuf:"varint,4,opt,name=deprecated,proto3" json:"deprecated,omitempty"` +} + +func (x *CuratedPluginSearchResult) Reset() { + *x = CuratedPluginSearchResult{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CuratedPluginSearchResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CuratedPluginSearchResult) ProtoMessage() {} + +func (x *CuratedPluginSearchResult) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CuratedPluginSearchResult.ProtoReflect.Descriptor instead. +func (*CuratedPluginSearchResult) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{3} +} + +func (x *CuratedPluginSearchResult) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CuratedPluginSearchResult) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CuratedPluginSearchResult) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *CuratedPluginSearchResult) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + +type SearchUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The search string. + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The field to order results by. + OrderBy OrderBy `protobuf:"varint,4,opt,name=order_by,json=orderBy,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrderBy" json:"order_by,omitempty"` + // Reverse orders results in descending order. + Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *SearchUserRequest) Reset() { + *x = SearchUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchUserRequest) ProtoMessage() {} + +func (x *SearchUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchUserRequest.ProtoReflect.Descriptor instead. +func (*SearchUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{4} +} + +func (x *SearchUserRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchUserRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchUserRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *SearchUserRequest) GetOrderBy() OrderBy { + if x != nil { + return x.OrderBy + } + return OrderBy_ORDER_BY_UNSPECIFIED +} + +func (x *SearchUserRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type SearchUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Users []*UserSearchResult `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *SearchUserResponse) Reset() { + *x = SearchUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchUserResponse) ProtoMessage() {} + +func (x *SearchUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchUserResponse.ProtoReflect.Descriptor instead. +func (*SearchUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{5} +} + +func (x *SearchUserResponse) GetUsers() []*UserSearchResult { + if x != nil { + return x.Users + } + return nil +} + +func (x *SearchUserResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type SearchRepositoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The search string. + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The field to order results by. + OrderBy OrderBy `protobuf:"varint,4,opt,name=order_by,json=orderBy,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrderBy" json:"order_by,omitempty"` + // Reverse orders results in descending order. + Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *SearchRepositoryRequest) Reset() { + *x = SearchRepositoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchRepositoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRepositoryRequest) ProtoMessage() {} + +func (x *SearchRepositoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRepositoryRequest.ProtoReflect.Descriptor instead. +func (*SearchRepositoryRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{6} +} + +func (x *SearchRepositoryRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchRepositoryRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchRepositoryRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *SearchRepositoryRequest) GetOrderBy() OrderBy { + if x != nil { + return x.OrderBy + } + return OrderBy_ORDER_BY_UNSPECIFIED +} + +func (x *SearchRepositoryRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type SearchRepositoryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Repositories []*RepositorySearchResult `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *SearchRepositoryResponse) Reset() { + *x = SearchRepositoryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchRepositoryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRepositoryResponse) ProtoMessage() {} + +func (x *SearchRepositoryResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRepositoryResponse.ProtoReflect.Descriptor instead. +func (*SearchRepositoryResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{7} +} + +func (x *SearchRepositoryResponse) GetRepositories() []*RepositorySearchResult { + if x != nil { + return x.Repositories + } + return nil +} + +func (x *SearchRepositoryResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type SearchLastCommitByContentRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The search string. + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The field to order results by. + OrderBy OrderBy `protobuf:"varint,4,opt,name=order_by,json=orderBy,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrderBy" json:"order_by,omitempty"` + // Reverse orders results in descending order. + Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *SearchLastCommitByContentRequest) Reset() { + *x = SearchLastCommitByContentRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchLastCommitByContentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchLastCommitByContentRequest) ProtoMessage() {} + +func (x *SearchLastCommitByContentRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchLastCommitByContentRequest.ProtoReflect.Descriptor instead. +func (*SearchLastCommitByContentRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{8} +} + +func (x *SearchLastCommitByContentRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchLastCommitByContentRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchLastCommitByContentRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *SearchLastCommitByContentRequest) GetOrderBy() OrderBy { + if x != nil { + return x.OrderBy + } + return OrderBy_ORDER_BY_UNSPECIFIED +} + +func (x *SearchLastCommitByContentRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type SearchLastCommitByContentResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Commits []*CommitSearchResult `protobuf:"bytes,1,rep,name=commits,proto3" json:"commits,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *SearchLastCommitByContentResponse) Reset() { + *x = SearchLastCommitByContentResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchLastCommitByContentResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchLastCommitByContentResponse) ProtoMessage() {} + +func (x *SearchLastCommitByContentResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchLastCommitByContentResponse.ProtoReflect.Descriptor instead. +func (*SearchLastCommitByContentResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{9} +} + +func (x *SearchLastCommitByContentResponse) GetCommits() []*CommitSearchResult { + if x != nil { + return x.Commits + } + return nil +} + +func (x *SearchLastCommitByContentResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type SearchCuratedPluginRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The search string. + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The field to order results by. + OrderBy OrderBy `protobuf:"varint,4,opt,name=order_by,json=orderBy,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrderBy" json:"order_by,omitempty"` + // Reverse orders results in descending order. + Reverse bool `protobuf:"varint,5,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *SearchCuratedPluginRequest) Reset() { + *x = SearchCuratedPluginRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchCuratedPluginRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchCuratedPluginRequest) ProtoMessage() {} + +func (x *SearchCuratedPluginRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchCuratedPluginRequest.ProtoReflect.Descriptor instead. +func (*SearchCuratedPluginRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{10} +} + +func (x *SearchCuratedPluginRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchCuratedPluginRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchCuratedPluginRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *SearchCuratedPluginRequest) GetOrderBy() OrderBy { + if x != nil { + return x.OrderBy + } + return OrderBy_ORDER_BY_UNSPECIFIED +} + +func (x *SearchCuratedPluginRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type SearchCuratedPluginResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Plugins []*CuratedPluginSearchResult `protobuf:"bytes,1,rep,name=plugins,proto3" json:"plugins,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *SearchCuratedPluginResponse) Reset() { + *x = SearchCuratedPluginResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchCuratedPluginResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchCuratedPluginResponse) ProtoMessage() {} + +func (x *SearchCuratedPluginResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchCuratedPluginResponse.ProtoReflect.Descriptor instead. +func (*SearchCuratedPluginResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{11} +} + +func (x *SearchCuratedPluginResponse) GetPlugins() []*CuratedPluginSearchResult { + if x != nil { + return x.Plugins + } + return nil +} + +func (x *SearchCuratedPluginResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type SearchTagRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repository. + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The name of the repository. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The search string. + Query string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` + PageSize uint32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The field to order results by. + OrderBy OrderBy `protobuf:"varint,6,opt,name=order_by,json=orderBy,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrderBy" json:"order_by,omitempty"` + // Reverse orders results in descending order. + Reverse bool `protobuf:"varint,7,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *SearchTagRequest) Reset() { + *x = SearchTagRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchTagRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchTagRequest) ProtoMessage() {} + +func (x *SearchTagRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchTagRequest.ProtoReflect.Descriptor instead. +func (*SearchTagRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{12} +} + +func (x *SearchTagRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *SearchTagRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *SearchTagRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchTagRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchTagRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *SearchTagRequest) GetOrderBy() OrderBy { + if x != nil { + return x.OrderBy + } + return OrderBy_ORDER_BY_UNSPECIFIED +} + +func (x *SearchTagRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type SearchTagResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryTags []*RepositoryTag `protobuf:"bytes,1,rep,name=repository_tags,json=repositoryTags,proto3" json:"repository_tags,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *SearchTagResponse) Reset() { + *x = SearchTagResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchTagResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchTagResponse) ProtoMessage() {} + +func (x *SearchTagResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchTagResponse.ProtoReflect.Descriptor instead. +func (*SearchTagResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{13} +} + +func (x *SearchTagResponse) GetRepositoryTags() []*RepositoryTag { + if x != nil { + return x.RepositoryTags + } + return nil +} + +func (x *SearchTagResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type SearchDraftRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The owner of the repository. + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The name of the repository. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The search string. + Query string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` + PageSize uint32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The field to order results by. + OrderBy OrderBy `protobuf:"varint,6,opt,name=order_by,json=orderBy,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrderBy" json:"order_by,omitempty"` + // Reverse orders results in descending order. + Reverse bool `protobuf:"varint,7,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *SearchDraftRequest) Reset() { + *x = SearchDraftRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchDraftRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchDraftRequest) ProtoMessage() {} + +func (x *SearchDraftRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchDraftRequest.ProtoReflect.Descriptor instead. +func (*SearchDraftRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{14} +} + +func (x *SearchDraftRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *SearchDraftRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *SearchDraftRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchDraftRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchDraftRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *SearchDraftRequest) GetOrderBy() OrderBy { + if x != nil { + return x.OrderBy + } + return OrderBy_ORDER_BY_UNSPECIFIED +} + +func (x *SearchDraftRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type SearchDraftResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RepositoryCommits []*RepositoryCommit `protobuf:"bytes,1,rep,name=repository_commits,json=repositoryCommits,proto3" json:"repository_commits,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *SearchDraftResponse) Reset() { + *x = SearchDraftResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_search_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchDraftResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchDraftResponse) ProtoMessage() {} + +func (x *SearchDraftResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_search_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchDraftResponse.ProtoReflect.Descriptor instead. +func (*SearchDraftResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_search_proto_rawDescGZIP(), []int{15} +} + +func (x *SearchDraftResponse) GetRepositoryCommits() []*RepositoryCommit { + if x != nil { + return x.RepositoryCommits + } + return nil +} + +func (x *SearchDraftResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +var File_registry_v1alpha1_search_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_search_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x29, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x61, 0x67, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x55, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1e, + 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0x77, + 0x0a, 0x12, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, + 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x60, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x61, 0x63, 0x74, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x64, 0x65, + 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x22, 0x75, 0x0a, 0x19, 0x43, 0x75, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x22, 0xce, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, + 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x4d, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, + 0x72, 0x5f, 0x62, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x52, 0x07, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, + 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, + 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x22, 0xd4, 0x01, 0x0a, 0x17, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x4d, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, + 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x18, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x26, + 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xdd, 0x01, 0x0a, 0x20, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x4c, 0x61, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x4d, 0x0a, + 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, + 0x72, 0x42, 0x79, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x12, 0x18, 0x0a, 0x07, + 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, + 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xa4, 0x01, 0x0a, 0x21, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x4c, 0x61, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x07, + 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xd7, 0x01, + 0x0a, 0x1a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x4d, + 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x42, 0x79, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x12, 0x18, 0x0a, + 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xa5, 0x01, 0x0a, 0x1b, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x07, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0xa1, 0x02, 0x0a, 0x10, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, + 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, + 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x4d, 0x0a, 0x08, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, + 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0f, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x52, 0x0e, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x67, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xa3, 0x02, 0x0a, 0x12, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x44, + 0x72, 0x61, 0x66, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x4d, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, + 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x13, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x44, 0x72, 0x61, 0x66, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x12, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x11, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x26, + 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0x6a, 0x0a, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x42, + 0x79, 0x12, 0x18, 0x0a, 0x14, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x5f, 0x42, 0x59, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x4f, + 0x52, 0x44, 0x45, 0x52, 0x5f, 0x42, 0x59, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x5f, 0x54, + 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x5f, 0x42, + 0x59, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x02, 0x12, + 0x11, 0x0a, 0x0d, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x5f, 0x42, 0x59, 0x5f, 0x4e, 0x41, 0x4d, 0x45, + 0x10, 0x03, 0x32, 0xd0, 0x07, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, + 0x73, 0x65, 0x72, 0x12, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa0, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x42, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x43, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xbb, 0x01, 0x0a, 0x19, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x4c, 0x61, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x42, 0x79, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4c, 0x61, 0x73, 0x74, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x4c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4c, 0x61, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x42, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xaa, 0x01, 0x0a, 0x14, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x43, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, + 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x01, 0x12, 0x8b, 0x01, 0x0a, 0x09, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, + 0x67, 0x12, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3c, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x54, 0x61, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x01, 0x12, 0x91, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x44, 0x72, 0x61, 0x66, + 0x74, 0x12, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x44, 0x72, 0x61, 0x66, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x44, 0x72, 0x61, 0x66, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xe6, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, + 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, + 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_search_proto_rawDescOnce sync.Once + file_registry_v1alpha1_search_proto_rawDescData = file_registry_v1alpha1_search_proto_rawDesc +) + +func file_registry_v1alpha1_search_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_search_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_search_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_search_proto_rawDescData) + }) + return file_registry_v1alpha1_search_proto_rawDescData +} + +var file_registry_v1alpha1_search_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_search_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_registry_v1alpha1_search_proto_goTypes = []interface{}{ + (OrderBy)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.OrderBy + (*RepositorySearchResult)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.RepositorySearchResult + (*CommitSearchResult)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.CommitSearchResult + (*UserSearchResult)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.UserSearchResult + (*CuratedPluginSearchResult)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginSearchResult + (*SearchUserRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.SearchUserRequest + (*SearchUserResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.SearchUserResponse + (*SearchRepositoryRequest)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.SearchRepositoryRequest + (*SearchRepositoryResponse)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.SearchRepositoryResponse + (*SearchLastCommitByContentRequest)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.SearchLastCommitByContentRequest + (*SearchLastCommitByContentResponse)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.SearchLastCommitByContentResponse + (*SearchCuratedPluginRequest)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.SearchCuratedPluginRequest + (*SearchCuratedPluginResponse)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.SearchCuratedPluginResponse + (*SearchTagRequest)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.SearchTagRequest + (*SearchTagResponse)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.SearchTagResponse + (*SearchDraftRequest)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.SearchDraftRequest + (*SearchDraftResponse)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.SearchDraftResponse + (Visibility)(0), // 17: bufman.dubbo.apache.org.registry.v1alpha1.Visibility + (*RepositoryTag)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + (*RepositoryCommit)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit +} +var file_registry_v1alpha1_search_proto_depIdxs = []int32{ + 17, // 0: bufman.dubbo.apache.org.registry.v1alpha1.RepositorySearchResult.visibility:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Visibility + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.SearchUserRequest.order_by:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrderBy + 3, // 2: bufman.dubbo.apache.org.registry.v1alpha1.SearchUserResponse.users:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.UserSearchResult + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.SearchRepositoryRequest.order_by:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrderBy + 1, // 4: bufman.dubbo.apache.org.registry.v1alpha1.SearchRepositoryResponse.repositories:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositorySearchResult + 0, // 5: bufman.dubbo.apache.org.registry.v1alpha1.SearchLastCommitByContentRequest.order_by:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrderBy + 2, // 6: bufman.dubbo.apache.org.registry.v1alpha1.SearchLastCommitByContentResponse.commits:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CommitSearchResult + 0, // 7: bufman.dubbo.apache.org.registry.v1alpha1.SearchCuratedPluginRequest.order_by:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrderBy + 4, // 8: bufman.dubbo.apache.org.registry.v1alpha1.SearchCuratedPluginResponse.plugins:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CuratedPluginSearchResult + 0, // 9: bufman.dubbo.apache.org.registry.v1alpha1.SearchTagRequest.order_by:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrderBy + 18, // 10: bufman.dubbo.apache.org.registry.v1alpha1.SearchTagResponse.repository_tags:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryTag + 0, // 11: bufman.dubbo.apache.org.registry.v1alpha1.SearchDraftRequest.order_by:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrderBy + 19, // 12: bufman.dubbo.apache.org.registry.v1alpha1.SearchDraftResponse.repository_commits:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 5, // 13: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchUserRequest + 7, // 14: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchRepository:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchRepositoryRequest + 9, // 15: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchLastCommitByContent:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchLastCommitByContentRequest + 11, // 16: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchCurationPlugin:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchCuratedPluginRequest + 13, // 17: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchTag:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchTagRequest + 15, // 18: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchDraft:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchDraftRequest + 6, // 19: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchUserResponse + 8, // 20: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchRepository:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchRepositoryResponse + 10, // 21: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchLastCommitByContent:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchLastCommitByContentResponse + 12, // 22: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchCurationPlugin:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchCuratedPluginResponse + 14, // 23: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchTag:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchTagResponse + 16, // 24: bufman.dubbo.apache.org.registry.v1alpha1.SearchService.SearchDraft:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SearchDraftResponse + 19, // [19:25] is the sub-list for method output_type + 13, // [13:19] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_search_proto_init() } +func file_registry_v1alpha1_search_proto_init() { + if File_registry_v1alpha1_search_proto != nil { + return + } + file_registry_v1alpha1_plugin_proto_init() + file_registry_v1alpha1_repository_proto_init() + file_registry_v1alpha1_repository_commit_proto_init() + file_registry_v1alpha1_repository_tag_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_search_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositorySearchResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommitSearchResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserSearchResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CuratedPluginSearchResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchRepositoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchRepositoryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchLastCommitByContentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchLastCommitByContentResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchCuratedPluginRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchCuratedPluginResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchTagRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchTagResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchDraftRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_search_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchDraftResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_search_proto_rawDesc, + NumEnums: 1, + NumMessages: 16, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_search_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_search_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_search_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_search_proto_msgTypes, + }.Build() + File_registry_v1alpha1_search_proto = out.File + file_registry_v1alpha1_search_proto_rawDesc = nil + file_registry_v1alpha1_search_proto_goTypes = nil + file_registry_v1alpha1_search_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/search_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/search_grpc.pb.go new file mode 100644 index 000000000..d3eba649e --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/search_grpc.pb.go @@ -0,0 +1,308 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/search.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + SearchService_SearchUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchUser" + SearchService_SearchRepository_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchRepository" + SearchService_SearchLastCommitByContent_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchLastCommitByContent" + SearchService_SearchCurationPlugin_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchCurationPlugin" + SearchService_SearchTag_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchTag" + SearchService_SearchDraft_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SearchService/SearchDraft" +) + +// SearchServiceClient is the client API for SearchService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SearchServiceClient interface { + // SearchUser searches users by username + SearchUser(ctx context.Context, in *SearchUserRequest, opts ...grpc.CallOption) (*SearchUserResponse, error) + // SearchRepository searches repositories by name or description + SearchRepository(ctx context.Context, in *SearchRepositoryRequest, opts ...grpc.CallOption) (*SearchRepositoryResponse, error) + // SearchCommitByContent searches last commit in same repo by idl content + // that means, for a repo, search results only record last matched commit + SearchLastCommitByContent(ctx context.Context, in *SearchLastCommitByContentRequest, opts ...grpc.CallOption) (*SearchLastCommitByContentResponse, error) + // SearchCurationPlugin search plugins by name or description + SearchCurationPlugin(ctx context.Context, in *SearchCuratedPluginRequest, opts ...grpc.CallOption) (*SearchCuratedPluginResponse, error) + // SearchTag searches for tags in a repository + SearchTag(ctx context.Context, in *SearchTagRequest, opts ...grpc.CallOption) (*SearchTagResponse, error) + // SearchDraft searches for drafts in a repository + SearchDraft(ctx context.Context, in *SearchDraftRequest, opts ...grpc.CallOption) (*SearchDraftResponse, error) +} + +type searchServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient { + return &searchServiceClient{cc} +} + +func (c *searchServiceClient) SearchUser(ctx context.Context, in *SearchUserRequest, opts ...grpc.CallOption) (*SearchUserResponse, error) { + out := new(SearchUserResponse) + err := c.cc.Invoke(ctx, SearchService_SearchUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchRepository(ctx context.Context, in *SearchRepositoryRequest, opts ...grpc.CallOption) (*SearchRepositoryResponse, error) { + out := new(SearchRepositoryResponse) + err := c.cc.Invoke(ctx, SearchService_SearchRepository_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchLastCommitByContent(ctx context.Context, in *SearchLastCommitByContentRequest, opts ...grpc.CallOption) (*SearchLastCommitByContentResponse, error) { + out := new(SearchLastCommitByContentResponse) + err := c.cc.Invoke(ctx, SearchService_SearchLastCommitByContent_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchCurationPlugin(ctx context.Context, in *SearchCuratedPluginRequest, opts ...grpc.CallOption) (*SearchCuratedPluginResponse, error) { + out := new(SearchCuratedPluginResponse) + err := c.cc.Invoke(ctx, SearchService_SearchCurationPlugin_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchTag(ctx context.Context, in *SearchTagRequest, opts ...grpc.CallOption) (*SearchTagResponse, error) { + out := new(SearchTagResponse) + err := c.cc.Invoke(ctx, SearchService_SearchTag_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *searchServiceClient) SearchDraft(ctx context.Context, in *SearchDraftRequest, opts ...grpc.CallOption) (*SearchDraftResponse, error) { + out := new(SearchDraftResponse) + err := c.cc.Invoke(ctx, SearchService_SearchDraft_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SearchServiceServer is the server API for SearchService service. +// All implementations must embed UnimplementedSearchServiceServer +// for forward compatibility +type SearchServiceServer interface { + // SearchUser searches users by username + SearchUser(context.Context, *SearchUserRequest) (*SearchUserResponse, error) + // SearchRepository searches repositories by name or description + SearchRepository(context.Context, *SearchRepositoryRequest) (*SearchRepositoryResponse, error) + // SearchCommitByContent searches last commit in same repo by idl content + // that means, for a repo, search results only record last matched commit + SearchLastCommitByContent(context.Context, *SearchLastCommitByContentRequest) (*SearchLastCommitByContentResponse, error) + // SearchCurationPlugin search plugins by name or description + SearchCurationPlugin(context.Context, *SearchCuratedPluginRequest) (*SearchCuratedPluginResponse, error) + // SearchTag searches for tags in a repository + SearchTag(context.Context, *SearchTagRequest) (*SearchTagResponse, error) + // SearchDraft searches for drafts in a repository + SearchDraft(context.Context, *SearchDraftRequest) (*SearchDraftResponse, error) + mustEmbedUnimplementedSearchServiceServer() +} + +// UnimplementedSearchServiceServer must be embedded to have forward compatible implementations. +type UnimplementedSearchServiceServer struct { +} + +func (UnimplementedSearchServiceServer) SearchUser(context.Context, *SearchUserRequest) (*SearchUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchUser not implemented") +} +func (UnimplementedSearchServiceServer) SearchRepository(context.Context, *SearchRepositoryRequest) (*SearchRepositoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchRepository not implemented") +} +func (UnimplementedSearchServiceServer) SearchLastCommitByContent(context.Context, *SearchLastCommitByContentRequest) (*SearchLastCommitByContentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchLastCommitByContent not implemented") +} +func (UnimplementedSearchServiceServer) SearchCurationPlugin(context.Context, *SearchCuratedPluginRequest) (*SearchCuratedPluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchCurationPlugin not implemented") +} +func (UnimplementedSearchServiceServer) SearchTag(context.Context, *SearchTagRequest) (*SearchTagResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchTag not implemented") +} +func (UnimplementedSearchServiceServer) SearchDraft(context.Context, *SearchDraftRequest) (*SearchDraftResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchDraft not implemented") +} +func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {} + +// UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SearchServiceServer will +// result in compilation errors. +type UnsafeSearchServiceServer interface { + mustEmbedUnimplementedSearchServiceServer() +} + +func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) { + s.RegisterService(&SearchService_ServiceDesc, srv) +} + +func _SearchService_SearchUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchUser(ctx, req.(*SearchUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchRepository_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchRepositoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchRepository(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchRepository_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchRepository(ctx, req.(*SearchRepositoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchLastCommitByContent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchLastCommitByContentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchLastCommitByContent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchLastCommitByContent_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchLastCommitByContent(ctx, req.(*SearchLastCommitByContentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchCurationPlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchCuratedPluginRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchCurationPlugin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchCurationPlugin_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchCurationPlugin(ctx, req.(*SearchCuratedPluginRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchTag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchTagRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchTag(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchTag_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchTag(ctx, req.(*SearchTagRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SearchService_SearchDraft_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchDraftRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SearchServiceServer).SearchDraft(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SearchService_SearchDraft_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SearchServiceServer).SearchDraft(ctx, req.(*SearchDraftRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SearchService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.SearchService", + HandlerType: (*SearchServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SearchUser", + Handler: _SearchService_SearchUser_Handler, + }, + { + MethodName: "SearchRepository", + Handler: _SearchService_SearchRepository_Handler, + }, + { + MethodName: "SearchLastCommitByContent", + Handler: _SearchService_SearchLastCommitByContent_Handler, + }, + { + MethodName: "SearchCurationPlugin", + Handler: _SearchService_SearchCurationPlugin_Handler, + }, + { + MethodName: "SearchTag", + Handler: _SearchService_SearchTag_Handler, + }, + { + MethodName: "SearchDraft", + Handler: _SearchService_SearchDraft_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/search.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/studio.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/studio.pb.go new file mode 100644 index 000000000..a0c0a6b8d --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/studio.pb.go @@ -0,0 +1,526 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/studio.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The protocols supported by Studio agent. +type StudioAgentProtocol int32 + +const ( + StudioAgentProtocol_STUDIO_AGENT_PROTOCOL_UNSPECIFIED StudioAgentProtocol = 0 + StudioAgentProtocol_STUDIO_AGENT_PROTOCOL_GRPC StudioAgentProtocol = 1 + StudioAgentProtocol_STUDIO_AGENT_PROTOCOL_CONNECT StudioAgentProtocol = 2 +) + +// Enum value maps for StudioAgentProtocol. +var ( + StudioAgentProtocol_name = map[int32]string{ + 0: "STUDIO_AGENT_PROTOCOL_UNSPECIFIED", + 1: "STUDIO_AGENT_PROTOCOL_GRPC", + 2: "STUDIO_AGENT_PROTOCOL_CONNECT", + } + StudioAgentProtocol_value = map[string]int32{ + "STUDIO_AGENT_PROTOCOL_UNSPECIFIED": 0, + "STUDIO_AGENT_PROTOCOL_GRPC": 1, + "STUDIO_AGENT_PROTOCOL_CONNECT": 2, + } +) + +func (x StudioAgentProtocol) Enum() *StudioAgentProtocol { + p := new(StudioAgentProtocol) + *p = x + return p +} + +func (x StudioAgentProtocol) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StudioAgentProtocol) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_studio_proto_enumTypes[0].Descriptor() +} + +func (StudioAgentProtocol) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_studio_proto_enumTypes[0] +} + +func (x StudioAgentProtocol) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StudioAgentProtocol.Descriptor instead. +func (StudioAgentProtocol) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_proto_rawDescGZIP(), []int{0} +} + +// StudioAgentPreset is the information about an agent preset in the Studio. +type StudioAgentPreset struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The target agent URL in the Studio. + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + // The optional alias of the agent URL. + Alias string `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"` + // The protocol the agent should use to forward requests. + Protocol StudioAgentProtocol `protobuf:"varint,3,opt,name=protocol,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.StudioAgentProtocol" json:"protocol,omitempty"` +} + +func (x *StudioAgentPreset) Reset() { + *x = StudioAgentPreset{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StudioAgentPreset) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StudioAgentPreset) ProtoMessage() {} + +func (x *StudioAgentPreset) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StudioAgentPreset.ProtoReflect.Descriptor instead. +func (*StudioAgentPreset) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_proto_rawDescGZIP(), []int{0} +} + +func (x *StudioAgentPreset) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *StudioAgentPreset) GetAlias() string { + if x != nil { + return x.Alias + } + return "" +} + +func (x *StudioAgentPreset) GetProtocol() StudioAgentProtocol { + if x != nil { + return x.Protocol + } + return StudioAgentProtocol_STUDIO_AGENT_PROTOCOL_UNSPECIFIED +} + +type ListStudioAgentPresetsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListStudioAgentPresetsRequest) Reset() { + *x = ListStudioAgentPresetsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListStudioAgentPresetsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStudioAgentPresetsRequest) ProtoMessage() {} + +func (x *ListStudioAgentPresetsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStudioAgentPresetsRequest.ProtoReflect.Descriptor instead. +func (*ListStudioAgentPresetsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_proto_rawDescGZIP(), []int{1} +} + +type ListStudioAgentPresetsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Agents []*StudioAgentPreset `protobuf:"bytes,1,rep,name=agents,proto3" json:"agents,omitempty"` +} + +func (x *ListStudioAgentPresetsResponse) Reset() { + *x = ListStudioAgentPresetsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListStudioAgentPresetsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStudioAgentPresetsResponse) ProtoMessage() {} + +func (x *ListStudioAgentPresetsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStudioAgentPresetsResponse.ProtoReflect.Descriptor instead. +func (*ListStudioAgentPresetsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_proto_rawDescGZIP(), []int{2} +} + +func (x *ListStudioAgentPresetsResponse) GetAgents() []*StudioAgentPreset { + if x != nil { + return x.Agents + } + return nil +} + +type SetStudioAgentPresetsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Agents []*StudioAgentPreset `protobuf:"bytes,1,rep,name=agents,proto3" json:"agents,omitempty"` +} + +func (x *SetStudioAgentPresetsRequest) Reset() { + *x = SetStudioAgentPresetsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetStudioAgentPresetsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetStudioAgentPresetsRequest) ProtoMessage() {} + +func (x *SetStudioAgentPresetsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetStudioAgentPresetsRequest.ProtoReflect.Descriptor instead. +func (*SetStudioAgentPresetsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_proto_rawDescGZIP(), []int{3} +} + +func (x *SetStudioAgentPresetsRequest) GetAgents() []*StudioAgentPreset { + if x != nil { + return x.Agents + } + return nil +} + +type SetStudioAgentPresetsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SetStudioAgentPresetsResponse) Reset() { + *x = SetStudioAgentPresetsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetStudioAgentPresetsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetStudioAgentPresetsResponse) ProtoMessage() {} + +func (x *SetStudioAgentPresetsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetStudioAgentPresetsResponse.ProtoReflect.Descriptor instead. +func (*SetStudioAgentPresetsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_proto_rawDescGZIP(), []int{4} +} + +var File_registry_v1alpha1_studio_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_studio_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, 0x97, 0x01, 0x0a, 0x11, + 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, 0x65, + 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x75, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x5a, 0x0a, 0x08, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, + 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x52, 0x08, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0x1f, 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x75, + 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x76, 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, + 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x06, 0x61, 0x67, 0x65, 0x6e, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, + 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x52, 0x06, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x74, + 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, + 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x54, + 0x0a, 0x06, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x75, 0x64, 0x69, + 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x52, 0x06, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x53, 0x65, 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, + 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0x7f, 0x0a, 0x13, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x25, 0x0a, 0x21, + 0x53, 0x54, 0x55, 0x44, 0x49, 0x4f, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x4f, + 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x53, 0x54, 0x55, 0x44, 0x49, 0x4f, 0x5f, 0x41, 0x47, + 0x45, 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x47, 0x52, 0x50, + 0x43, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x53, 0x54, 0x55, 0x44, 0x49, 0x4f, 0x5f, 0x41, 0x47, + 0x45, 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x43, 0x4f, 0x4e, + 0x4e, 0x45, 0x43, 0x54, 0x10, 0x02, 0x32, 0xf1, 0x02, 0x0a, 0x0d, 0x53, 0x74, 0x75, 0x64, 0x69, + 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb2, 0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, + 0x65, 0x74, 0x73, 0x12, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, + 0x72, 0x65, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x49, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, + 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xaa, 0x01, + 0x0a, 0x15, 0x53, 0x65, 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, + 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x73, 0x12, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x74, + 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x73, 0x65, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe6, 0x02, 0x0a, 0x2d, 0x63, + 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x53, 0x74, + 0x75, 0x64, 0x69, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, + 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, + 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, + 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_studio_proto_rawDescOnce sync.Once + file_registry_v1alpha1_studio_proto_rawDescData = file_registry_v1alpha1_studio_proto_rawDesc +) + +func file_registry_v1alpha1_studio_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_studio_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_studio_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_studio_proto_rawDescData) + }) + return file_registry_v1alpha1_studio_proto_rawDescData +} + +var file_registry_v1alpha1_studio_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_studio_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_registry_v1alpha1_studio_proto_goTypes = []interface{}{ + (StudioAgentProtocol)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.StudioAgentProtocol + (*StudioAgentPreset)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.StudioAgentPreset + (*ListStudioAgentPresetsRequest)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.ListStudioAgentPresetsRequest + (*ListStudioAgentPresetsResponse)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListStudioAgentPresetsResponse + (*SetStudioAgentPresetsRequest)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.SetStudioAgentPresetsRequest + (*SetStudioAgentPresetsResponse)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.SetStudioAgentPresetsResponse +} +var file_registry_v1alpha1_studio_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.registry.v1alpha1.StudioAgentPreset.protocol:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.StudioAgentProtocol + 1, // 1: bufman.dubbo.apache.org.registry.v1alpha1.ListStudioAgentPresetsResponse.agents:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.StudioAgentPreset + 1, // 2: bufman.dubbo.apache.org.registry.v1alpha1.SetStudioAgentPresetsRequest.agents:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.StudioAgentPreset + 2, // 3: bufman.dubbo.apache.org.registry.v1alpha1.StudioService.ListStudioAgentPresets:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListStudioAgentPresetsRequest + 4, // 4: bufman.dubbo.apache.org.registry.v1alpha1.StudioService.SetStudioAgentPresets:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SetStudioAgentPresetsRequest + 3, // 5: bufman.dubbo.apache.org.registry.v1alpha1.StudioService.ListStudioAgentPresets:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListStudioAgentPresetsResponse + 5, // 6: bufman.dubbo.apache.org.registry.v1alpha1.StudioService.SetStudioAgentPresets:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SetStudioAgentPresetsResponse + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_studio_proto_init() } +func file_registry_v1alpha1_studio_proto_init() { + if File_registry_v1alpha1_studio_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_studio_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StudioAgentPreset); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListStudioAgentPresetsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListStudioAgentPresetsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetStudioAgentPresetsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetStudioAgentPresetsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_studio_proto_rawDesc, + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_studio_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_studio_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_studio_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_studio_proto_msgTypes, + }.Build() + File_registry_v1alpha1_studio_proto = out.File + file_registry_v1alpha1_studio_proto_rawDesc = nil + file_registry_v1alpha1_studio_proto_goTypes = nil + file_registry_v1alpha1_studio_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_grpc.pb.go new file mode 100644 index 000000000..cb2e6f00e --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_grpc.pb.go @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/studio.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + StudioService_ListStudioAgentPresets_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioService/ListStudioAgentPresets" + StudioService_SetStudioAgentPresets_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioService/SetStudioAgentPresets" +) + +// StudioServiceClient is the client API for StudioService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type StudioServiceClient interface { + // ListStudioAgentPresets returns a list of agent presets in the server. + ListStudioAgentPresets(ctx context.Context, in *ListStudioAgentPresetsRequest, opts ...grpc.CallOption) (*ListStudioAgentPresetsResponse, error) + // SetStudioAgentPresets sets the list of agent presets in the server. + SetStudioAgentPresets(ctx context.Context, in *SetStudioAgentPresetsRequest, opts ...grpc.CallOption) (*SetStudioAgentPresetsResponse, error) +} + +type studioServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewStudioServiceClient(cc grpc.ClientConnInterface) StudioServiceClient { + return &studioServiceClient{cc} +} + +func (c *studioServiceClient) ListStudioAgentPresets(ctx context.Context, in *ListStudioAgentPresetsRequest, opts ...grpc.CallOption) (*ListStudioAgentPresetsResponse, error) { + out := new(ListStudioAgentPresetsResponse) + err := c.cc.Invoke(ctx, StudioService_ListStudioAgentPresets_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *studioServiceClient) SetStudioAgentPresets(ctx context.Context, in *SetStudioAgentPresetsRequest, opts ...grpc.CallOption) (*SetStudioAgentPresetsResponse, error) { + out := new(SetStudioAgentPresetsResponse) + err := c.cc.Invoke(ctx, StudioService_SetStudioAgentPresets_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StudioServiceServer is the server API for StudioService service. +// All implementations must embed UnimplementedStudioServiceServer +// for forward compatibility +type StudioServiceServer interface { + // ListStudioAgentPresets returns a list of agent presets in the server. + ListStudioAgentPresets(context.Context, *ListStudioAgentPresetsRequest) (*ListStudioAgentPresetsResponse, error) + // SetStudioAgentPresets sets the list of agent presets in the server. + SetStudioAgentPresets(context.Context, *SetStudioAgentPresetsRequest) (*SetStudioAgentPresetsResponse, error) + mustEmbedUnimplementedStudioServiceServer() +} + +// UnimplementedStudioServiceServer must be embedded to have forward compatible implementations. +type UnimplementedStudioServiceServer struct { +} + +func (UnimplementedStudioServiceServer) ListStudioAgentPresets(context.Context, *ListStudioAgentPresetsRequest) (*ListStudioAgentPresetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListStudioAgentPresets not implemented") +} +func (UnimplementedStudioServiceServer) SetStudioAgentPresets(context.Context, *SetStudioAgentPresetsRequest) (*SetStudioAgentPresetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetStudioAgentPresets not implemented") +} +func (UnimplementedStudioServiceServer) mustEmbedUnimplementedStudioServiceServer() {} + +// UnsafeStudioServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to StudioServiceServer will +// result in compilation errors. +type UnsafeStudioServiceServer interface { + mustEmbedUnimplementedStudioServiceServer() +} + +func RegisterStudioServiceServer(s grpc.ServiceRegistrar, srv StudioServiceServer) { + s.RegisterService(&StudioService_ServiceDesc, srv) +} + +func _StudioService_ListStudioAgentPresets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListStudioAgentPresetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StudioServiceServer).ListStudioAgentPresets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: StudioService_ListStudioAgentPresets_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StudioServiceServer).ListStudioAgentPresets(ctx, req.(*ListStudioAgentPresetsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StudioService_SetStudioAgentPresets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetStudioAgentPresetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StudioServiceServer).SetStudioAgentPresets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: StudioService_SetStudioAgentPresets_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StudioServiceServer).SetStudioAgentPresets(ctx, req.(*SetStudioAgentPresetsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// StudioService_ServiceDesc is the grpc.ServiceDesc for StudioService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var StudioService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.StudioService", + HandlerType: (*StudioServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListStudioAgentPresets", + Handler: _StudioService_ListStudioAgentPresets_Handler, + }, + { + MethodName: "SetStudioAgentPresets", + Handler: _StudioService_SetStudioAgentPresets_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/studio.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_request.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_request.pb.go new file mode 100644 index 000000000..72df567ae --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_request.pb.go @@ -0,0 +1,1168 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/studio_request.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// StudioProtocol are the supported protocols for Studio Requests. +type StudioProtocol int32 + +const ( + // STUDIO_PROTOCOL_UNSPECIFIED is a safe default for requests with no protocol + // defined. + StudioProtocol_STUDIO_PROTOCOL_UNSPECIFIED StudioProtocol = 0 + // STUDIO_PROTOCOL_CONNECT is the Connect protocol in Studio. + StudioProtocol_STUDIO_PROTOCOL_CONNECT StudioProtocol = 1 + // STUDIO_PROTOCOL_GRPC is the gRPC protocol in Studio. + StudioProtocol_STUDIO_PROTOCOL_GRPC StudioProtocol = 2 + // STUDIO_PROTOCOL_GRPC_WEB is the gRPC-web protocol in Studio. + StudioProtocol_STUDIO_PROTOCOL_GRPC_WEB StudioProtocol = 3 +) + +// Enum value maps for StudioProtocol. +var ( + StudioProtocol_name = map[int32]string{ + 0: "STUDIO_PROTOCOL_UNSPECIFIED", + 1: "STUDIO_PROTOCOL_CONNECT", + 2: "STUDIO_PROTOCOL_GRPC", + 3: "STUDIO_PROTOCOL_GRPC_WEB", + } + StudioProtocol_value = map[string]int32{ + "STUDIO_PROTOCOL_UNSPECIFIED": 0, + "STUDIO_PROTOCOL_CONNECT": 1, + "STUDIO_PROTOCOL_GRPC": 2, + "STUDIO_PROTOCOL_GRPC_WEB": 3, + } +) + +func (x StudioProtocol) Enum() *StudioProtocol { + p := new(StudioProtocol) + *p = x + return p +} + +func (x StudioProtocol) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StudioProtocol) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_studio_request_proto_enumTypes[0].Descriptor() +} + +func (StudioProtocol) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_studio_request_proto_enumTypes[0] +} + +func (x StudioProtocol) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StudioProtocol.Descriptor instead. +func (StudioProtocol) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{0} +} + +// CreateStudioRequestRequest is the proto request representation of the +// CreateStudioRequest method. +type CreateStudioRequestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The linked BSR repository owner name (user or organization). + RepositoryOwner string `protobuf:"bytes,1,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The linked BSR repository name. + RepositoryName string `protobuf:"bytes,2,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The friendly name of this request. + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + // The target base URL of this request. + TargetBaseUrl string `protobuf:"bytes,4,opt,name=target_base_url,json=targetBaseUrl,proto3" json:"target_base_url,omitempty"` + // The target service name as defined in the BSR repository. + Service string `protobuf:"bytes,5,opt,name=service,proto3" json:"service,omitempty"` + // The target RPC method name as defined in the BSR repository. + Method string `protobuf:"bytes,6,opt,name=method,proto3" json:"method,omitempty"` + // The request body as defined in Studio. + Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"` + // The request headers as defined in Studio. + Headers map[string]string `protobuf:"bytes,8,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Should this request include cookies from the Studio current session? + IncludeCookies bool `protobuf:"varint,9,opt,name=include_cookies,json=includeCookies,proto3" json:"include_cookies,omitempty"` + // The protocol that Studio uses to send this request. + Protocol StudioProtocol `protobuf:"varint,10,opt,name=protocol,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.StudioProtocol" json:"protocol,omitempty"` + // The agent url (if any) used by Studio to send the request. See + // https://docs.buf.build/bsr/studio#via-buf-studio-agent for details. + AgentUrl string `protobuf:"bytes,11,opt,name=agent_url,json=agentUrl,proto3" json:"agent_url,omitempty"` +} + +func (x *CreateStudioRequestRequest) Reset() { + *x = CreateStudioRequestRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateStudioRequestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateStudioRequestRequest) ProtoMessage() {} + +func (x *CreateStudioRequestRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateStudioRequestRequest.ProtoReflect.Descriptor instead. +func (*CreateStudioRequestRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateStudioRequestRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *CreateStudioRequestRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *CreateStudioRequestRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateStudioRequestRequest) GetTargetBaseUrl() string { + if x != nil { + return x.TargetBaseUrl + } + return "" +} + +func (x *CreateStudioRequestRequest) GetService() string { + if x != nil { + return x.Service + } + return "" +} + +func (x *CreateStudioRequestRequest) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *CreateStudioRequestRequest) GetBody() string { + if x != nil { + return x.Body + } + return "" +} + +func (x *CreateStudioRequestRequest) GetHeaders() map[string]string { + if x != nil { + return x.Headers + } + return nil +} + +func (x *CreateStudioRequestRequest) GetIncludeCookies() bool { + if x != nil { + return x.IncludeCookies + } + return false +} + +func (x *CreateStudioRequestRequest) GetProtocol() StudioProtocol { + if x != nil { + return x.Protocol + } + return StudioProtocol_STUDIO_PROTOCOL_UNSPECIFIED +} + +func (x *CreateStudioRequestRequest) GetAgentUrl() string { + if x != nil { + return x.AgentUrl + } + return "" +} + +// CreateStudioRequestResponse returns the created StudioRequest. +type CreateStudioRequestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Created Studio Request. + CreatedRequest *StudioRequest `protobuf:"bytes,1,opt,name=created_request,json=createdRequest,proto3" json:"created_request,omitempty"` +} + +func (x *CreateStudioRequestResponse) Reset() { + *x = CreateStudioRequestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateStudioRequestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateStudioRequestResponse) ProtoMessage() {} + +func (x *CreateStudioRequestResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateStudioRequestResponse.ProtoReflect.Descriptor instead. +func (*CreateStudioRequestResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateStudioRequestResponse) GetCreatedRequest() *StudioRequest { + if x != nil { + return x.CreatedRequest + } + return nil +} + +// RenameStudioRequestRequest is the proto request representation of the +// RenameStudioRequest method. +type RenameStudioRequestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The Studio Request ID that will be renamed. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The new name for the request. + NewName string `protobuf:"bytes,2,opt,name=new_name,json=newName,proto3" json:"new_name,omitempty"` +} + +func (x *RenameStudioRequestRequest) Reset() { + *x = RenameStudioRequestRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RenameStudioRequestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RenameStudioRequestRequest) ProtoMessage() {} + +func (x *RenameStudioRequestRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RenameStudioRequestRequest.ProtoReflect.Descriptor instead. +func (*RenameStudioRequestRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{2} +} + +func (x *RenameStudioRequestRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RenameStudioRequestRequest) GetNewName() string { + if x != nil { + return x.NewName + } + return "" +} + +// RenameStudioRequestResponse returns empty on successful renaming. +type RenameStudioRequestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RenameStudioRequestResponse) Reset() { + *x = RenameStudioRequestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RenameStudioRequestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RenameStudioRequestResponse) ProtoMessage() {} + +func (x *RenameStudioRequestResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RenameStudioRequestResponse.ProtoReflect.Descriptor instead. +func (*RenameStudioRequestResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{3} +} + +// DeleteStudioRequestRequest is the proto request representation of the +// DeleteStudioRequest method. +type DeleteStudioRequestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The Studio Request ID that will be deleted. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteStudioRequestRequest) Reset() { + *x = DeleteStudioRequestRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteStudioRequestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteStudioRequestRequest) ProtoMessage() {} + +func (x *DeleteStudioRequestRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteStudioRequestRequest.ProtoReflect.Descriptor instead. +func (*DeleteStudioRequestRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteStudioRequestRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +// DeleteStudioRequestResponse returns empty on successful deletions. +type DeleteStudioRequestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteStudioRequestResponse) Reset() { + *x = DeleteStudioRequestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteStudioRequestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteStudioRequestResponse) ProtoMessage() {} + +func (x *DeleteStudioRequestResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteStudioRequestResponse.ProtoReflect.Descriptor instead. +func (*DeleteStudioRequestResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{5} +} + +// ListStudioRequestsRequest is the proto request representation of the +// ListStudioRequests method. +type ListStudioRequestsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The page size for listing studio requests, values between 1-250. + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The page token for paginating. The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The listed studio requests are order by created time in ascending order. + // You can reverse that order setting this value to true. + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListStudioRequestsRequest) Reset() { + *x = ListStudioRequestsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListStudioRequestsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStudioRequestsRequest) ProtoMessage() {} + +func (x *ListStudioRequestsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStudioRequestsRequest.ProtoReflect.Descriptor instead. +func (*ListStudioRequestsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{6} +} + +func (x *ListStudioRequestsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListStudioRequestsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListStudioRequestsRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +// ListStudioRequestsResponse is the proto response representation of the +// ListStudioRequests method. +type ListStudioRequestsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of requests in the current page. + Requests []*StudioRequest `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` + // The requests' next page token. There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListStudioRequestsResponse) Reset() { + *x = ListStudioRequestsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListStudioRequestsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStudioRequestsResponse) ProtoMessage() {} + +func (x *ListStudioRequestsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStudioRequestsResponse.ProtoReflect.Descriptor instead. +func (*ListStudioRequestsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{7} +} + +func (x *ListStudioRequestsResponse) GetRequests() []*StudioRequest { + if x != nil { + return x.Requests + } + return nil +} + +func (x *ListStudioRequestsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// StudioRequest represents a saved request in Studio, that is synced to a BSR +// user's profile. +type StudioRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of this Studio Request. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The request creation timestamp. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // The request last updated timestamp. + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + // User ID who created and saved this request. + AuthorUserId string `protobuf:"bytes,4,opt,name=author_user_id,json=authorUserId,proto3" json:"author_user_id,omitempty"` + // BSR repository ID this request is linked to. + RepositoryId string `protobuf:"bytes,5,opt,name=repository_id,json=repositoryId,proto3" json:"repository_id,omitempty"` + // The friendly name of this request. + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` + // The target base URL of this request. + TargetBaseUrl string `protobuf:"bytes,7,opt,name=target_base_url,json=targetBaseUrl,proto3" json:"target_base_url,omitempty"` + // The BSR repository owner name (user or organization). + RepositoryOwner string `protobuf:"bytes,8,opt,name=repository_owner,json=repositoryOwner,proto3" json:"repository_owner,omitempty"` + // The BSR repository name. + RepositoryName string `protobuf:"bytes,9,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The target service name as defined in the BSR repository. + Service string `protobuf:"bytes,10,opt,name=service,proto3" json:"service,omitempty"` + // The target RPC method name as defined in the BSR repository. + Method string `protobuf:"bytes,11,opt,name=method,proto3" json:"method,omitempty"` + // The request body as defined in Studio. + Body string `protobuf:"bytes,12,opt,name=body,proto3" json:"body,omitempty"` + // The request headers as defined in Studio. + Headers map[string]string `protobuf:"bytes,13,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Should this request include cookies from the Studio current session? + IncludeCookies bool `protobuf:"varint,14,opt,name=include_cookies,json=includeCookies,proto3" json:"include_cookies,omitempty"` + // The protocol that Studio uses to send this request. + Protocol StudioProtocol `protobuf:"varint,15,opt,name=protocol,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.StudioProtocol" json:"protocol,omitempty"` + // The agent url (if any) used by Studio to send the request. See + // https://docs.buf.build/bsr/studio#via-buf-studio-agent for details. + AgentUrl string `protobuf:"bytes,16,opt,name=agent_url,json=agentUrl,proto3" json:"agent_url,omitempty"` +} + +func (x *StudioRequest) Reset() { + *x = StudioRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StudioRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StudioRequest) ProtoMessage() {} + +func (x *StudioRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_studio_request_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StudioRequest.ProtoReflect.Descriptor instead. +func (*StudioRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_studio_request_proto_rawDescGZIP(), []int{8} +} + +func (x *StudioRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *StudioRequest) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *StudioRequest) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +func (x *StudioRequest) GetAuthorUserId() string { + if x != nil { + return x.AuthorUserId + } + return "" +} + +func (x *StudioRequest) GetRepositoryId() string { + if x != nil { + return x.RepositoryId + } + return "" +} + +func (x *StudioRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *StudioRequest) GetTargetBaseUrl() string { + if x != nil { + return x.TargetBaseUrl + } + return "" +} + +func (x *StudioRequest) GetRepositoryOwner() string { + if x != nil { + return x.RepositoryOwner + } + return "" +} + +func (x *StudioRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *StudioRequest) GetService() string { + if x != nil { + return x.Service + } + return "" +} + +func (x *StudioRequest) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *StudioRequest) GetBody() string { + if x != nil { + return x.Body + } + return "" +} + +func (x *StudioRequest) GetHeaders() map[string]string { + if x != nil { + return x.Headers + } + return nil +} + +func (x *StudioRequest) GetIncludeCookies() bool { + if x != nil { + return x.IncludeCookies + } + return false +} + +func (x *StudioRequest) GetProtocol() StudioProtocol { + if x != nil { + return x.Protocol + } + return StudioProtocol_STUDIO_PROTOCOL_UNSPECIFIED +} + +func (x *StudioRequest) GetAgentUrl() string { + if x != nil { + return x.AgentUrl + } + return "" +} + +var File_registry_v1alpha1_studio_request_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_studio_request_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb9, 0x04, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, + 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, + 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x74, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x42, 0x61, 0x73, 0x65, + 0x55, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x6c, 0x0a, 0x07, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x52, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x75, + 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x73, + 0x12, 0x55, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, + 0x74, 0x75, 0x64, 0x69, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x67, 0x65, 0x6e, + 0x74, 0x55, 0x72, 0x6c, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0x80, 0x01, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x75, 0x64, 0x69, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x61, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x52, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x47, 0x0a, 0x1a, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x75, + 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x1d, 0x0a, 0x1b, + 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x0a, 0x1a, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1d, 0x0a, 0x1b, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x71, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x1a, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x08, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, + 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, + 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xf4, 0x05, 0x0a, 0x0d, 0x53, 0x74, 0x75, + 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x61, + 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x42, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x29, 0x0a, 0x10, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x5f, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, + 0x65, 0x5f, 0x63, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x73, 0x12, + 0x55, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x0f, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x74, + 0x75, 0x64, 0x69, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x52, 0x08, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, + 0x75, 0x72, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x55, 0x72, 0x6c, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, + 0x86, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x54, 0x55, 0x44, 0x49, 0x4f, 0x5f, 0x50, 0x52, 0x4f, + 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x54, 0x55, 0x44, 0x49, 0x4f, 0x5f, 0x50, 0x52, + 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x10, 0x01, + 0x12, 0x18, 0x0a, 0x14, 0x53, 0x54, 0x55, 0x44, 0x49, 0x4f, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, + 0x43, 0x4f, 0x4c, 0x5f, 0x47, 0x52, 0x50, 0x43, 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x54, + 0x55, 0x44, 0x49, 0x4f, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x43, 0x4f, 0x4c, 0x5f, 0x47, 0x52, + 0x50, 0x43, 0x5f, 0x57, 0x45, 0x42, 0x10, 0x03, 0x32, 0xbd, 0x05, 0x0a, 0x14, 0x53, 0x74, 0x75, + 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0xa6, 0x01, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x75, 0x64, + 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x75, 0x64, + 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0xa6, 0x01, 0x0a, 0x13, 0x52, + 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, + 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x75, 0x64, + 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0xa9, 0x01, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, + 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, + 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, + 0xa6, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x75, + 0x64, 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x42, 0xed, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x12, 0x53, 0x74, 0x75, 0x64, + 0x69, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, + 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, + 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, + 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, + 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_studio_request_proto_rawDescOnce sync.Once + file_registry_v1alpha1_studio_request_proto_rawDescData = file_registry_v1alpha1_studio_request_proto_rawDesc +) + +func file_registry_v1alpha1_studio_request_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_studio_request_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_studio_request_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_studio_request_proto_rawDescData) + }) + return file_registry_v1alpha1_studio_request_proto_rawDescData +} + +var file_registry_v1alpha1_studio_request_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_studio_request_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_registry_v1alpha1_studio_request_proto_goTypes = []interface{}{ + (StudioProtocol)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.StudioProtocol + (*CreateStudioRequestRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestRequest + (*CreateStudioRequestResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestResponse + (*RenameStudioRequestRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.RenameStudioRequestRequest + (*RenameStudioRequestResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.RenameStudioRequestResponse + (*DeleteStudioRequestRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.DeleteStudioRequestRequest + (*DeleteStudioRequestResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.DeleteStudioRequestResponse + (*ListStudioRequestsRequest)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.ListStudioRequestsRequest + (*ListStudioRequestsResponse)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.ListStudioRequestsResponse + (*StudioRequest)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest + nil, // 10: bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestRequest.HeadersEntry + nil, // 11: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest.HeadersEntry + (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp +} +var file_registry_v1alpha1_studio_request_proto_depIdxs = []int32{ + 10, // 0: bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestRequest.headers:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestRequest.HeadersEntry + 0, // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestRequest.protocol:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.StudioProtocol + 9, // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestResponse.created_request:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest + 9, // 3: bufman.dubbo.apache.org.registry.v1alpha1.ListStudioRequestsResponse.requests:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest + 12, // 4: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest.create_time:type_name -> google.protobuf.Timestamp + 12, // 5: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest.update_time:type_name -> google.protobuf.Timestamp + 11, // 6: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest.headers:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest.HeadersEntry + 0, // 7: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequest.protocol:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.StudioProtocol + 1, // 8: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.CreateStudioRequest:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestRequest + 3, // 9: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.RenameStudioRequest:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.RenameStudioRequestRequest + 5, // 10: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.DeleteStudioRequest:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteStudioRequestRequest + 7, // 11: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.ListStudioRequests:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListStudioRequestsRequest + 2, // 12: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.CreateStudioRequest:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateStudioRequestResponse + 4, // 13: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.RenameStudioRequest:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.RenameStudioRequestResponse + 6, // 14: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.DeleteStudioRequest:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteStudioRequestResponse + 8, // 15: bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService.ListStudioRequests:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListStudioRequestsResponse + 12, // [12:16] is the sub-list for method output_type + 8, // [8:12] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_studio_request_proto_init() } +func file_registry_v1alpha1_studio_request_proto_init() { + if File_registry_v1alpha1_studio_request_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_studio_request_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateStudioRequestRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_request_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateStudioRequestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_request_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RenameStudioRequestRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_request_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RenameStudioRequestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_request_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteStudioRequestRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_request_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteStudioRequestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_request_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListStudioRequestsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_request_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListStudioRequestsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_studio_request_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StudioRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_studio_request_proto_rawDesc, + NumEnums: 1, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_studio_request_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_studio_request_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_studio_request_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_studio_request_proto_msgTypes, + }.Build() + File_registry_v1alpha1_studio_request_proto = out.File + file_registry_v1alpha1_studio_request_proto_rawDesc = nil + file_registry_v1alpha1_studio_request_proto_goTypes = nil + file_registry_v1alpha1_studio_request_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_request_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_request_grpc.pb.go new file mode 100644 index 000000000..0a12b5450 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/studio_request_grpc.pb.go @@ -0,0 +1,232 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/studio_request.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + StudioRequestService_CreateStudioRequest_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/CreateStudioRequest" + StudioRequestService_RenameStudioRequest_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/RenameStudioRequest" + StudioRequestService_DeleteStudioRequest_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/DeleteStudioRequest" + StudioRequestService_ListStudioRequests_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService/ListStudioRequests" +) + +// StudioRequestServiceClient is the client API for StudioRequestService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type StudioRequestServiceClient interface { + // CreateStudioRequest registers a favorite Studio Requests to the caller's + // BSR profile. + CreateStudioRequest(ctx context.Context, in *CreateStudioRequestRequest, opts ...grpc.CallOption) (*CreateStudioRequestResponse, error) + // RenameStudioRequest renames an existing Studio Request. + RenameStudioRequest(ctx context.Context, in *RenameStudioRequestRequest, opts ...grpc.CallOption) (*RenameStudioRequestResponse, error) + // DeleteStudioRequest removes a favorite Studio Request from the caller's BSR + // profile. + DeleteStudioRequest(ctx context.Context, in *DeleteStudioRequestRequest, opts ...grpc.CallOption) (*DeleteStudioRequestResponse, error) + // ListStudioRequests shows the caller's favorited Studio Requests. + ListStudioRequests(ctx context.Context, in *ListStudioRequestsRequest, opts ...grpc.CallOption) (*ListStudioRequestsResponse, error) +} + +type studioRequestServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewStudioRequestServiceClient(cc grpc.ClientConnInterface) StudioRequestServiceClient { + return &studioRequestServiceClient{cc} +} + +func (c *studioRequestServiceClient) CreateStudioRequest(ctx context.Context, in *CreateStudioRequestRequest, opts ...grpc.CallOption) (*CreateStudioRequestResponse, error) { + out := new(CreateStudioRequestResponse) + err := c.cc.Invoke(ctx, StudioRequestService_CreateStudioRequest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *studioRequestServiceClient) RenameStudioRequest(ctx context.Context, in *RenameStudioRequestRequest, opts ...grpc.CallOption) (*RenameStudioRequestResponse, error) { + out := new(RenameStudioRequestResponse) + err := c.cc.Invoke(ctx, StudioRequestService_RenameStudioRequest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *studioRequestServiceClient) DeleteStudioRequest(ctx context.Context, in *DeleteStudioRequestRequest, opts ...grpc.CallOption) (*DeleteStudioRequestResponse, error) { + out := new(DeleteStudioRequestResponse) + err := c.cc.Invoke(ctx, StudioRequestService_DeleteStudioRequest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *studioRequestServiceClient) ListStudioRequests(ctx context.Context, in *ListStudioRequestsRequest, opts ...grpc.CallOption) (*ListStudioRequestsResponse, error) { + out := new(ListStudioRequestsResponse) + err := c.cc.Invoke(ctx, StudioRequestService_ListStudioRequests_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StudioRequestServiceServer is the server API for StudioRequestService service. +// All implementations must embed UnimplementedStudioRequestServiceServer +// for forward compatibility +type StudioRequestServiceServer interface { + // CreateStudioRequest registers a favorite Studio Requests to the caller's + // BSR profile. + CreateStudioRequest(context.Context, *CreateStudioRequestRequest) (*CreateStudioRequestResponse, error) + // RenameStudioRequest renames an existing Studio Request. + RenameStudioRequest(context.Context, *RenameStudioRequestRequest) (*RenameStudioRequestResponse, error) + // DeleteStudioRequest removes a favorite Studio Request from the caller's BSR + // profile. + DeleteStudioRequest(context.Context, *DeleteStudioRequestRequest) (*DeleteStudioRequestResponse, error) + // ListStudioRequests shows the caller's favorited Studio Requests. + ListStudioRequests(context.Context, *ListStudioRequestsRequest) (*ListStudioRequestsResponse, error) + mustEmbedUnimplementedStudioRequestServiceServer() +} + +// UnimplementedStudioRequestServiceServer must be embedded to have forward compatible implementations. +type UnimplementedStudioRequestServiceServer struct { +} + +func (UnimplementedStudioRequestServiceServer) CreateStudioRequest(context.Context, *CreateStudioRequestRequest) (*CreateStudioRequestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateStudioRequest not implemented") +} +func (UnimplementedStudioRequestServiceServer) RenameStudioRequest(context.Context, *RenameStudioRequestRequest) (*RenameStudioRequestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenameStudioRequest not implemented") +} +func (UnimplementedStudioRequestServiceServer) DeleteStudioRequest(context.Context, *DeleteStudioRequestRequest) (*DeleteStudioRequestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteStudioRequest not implemented") +} +func (UnimplementedStudioRequestServiceServer) ListStudioRequests(context.Context, *ListStudioRequestsRequest) (*ListStudioRequestsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListStudioRequests not implemented") +} +func (UnimplementedStudioRequestServiceServer) mustEmbedUnimplementedStudioRequestServiceServer() {} + +// UnsafeStudioRequestServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to StudioRequestServiceServer will +// result in compilation errors. +type UnsafeStudioRequestServiceServer interface { + mustEmbedUnimplementedStudioRequestServiceServer() +} + +func RegisterStudioRequestServiceServer(s grpc.ServiceRegistrar, srv StudioRequestServiceServer) { + s.RegisterService(&StudioRequestService_ServiceDesc, srv) +} + +func _StudioRequestService_CreateStudioRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateStudioRequestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StudioRequestServiceServer).CreateStudioRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: StudioRequestService_CreateStudioRequest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StudioRequestServiceServer).CreateStudioRequest(ctx, req.(*CreateStudioRequestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StudioRequestService_RenameStudioRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RenameStudioRequestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StudioRequestServiceServer).RenameStudioRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: StudioRequestService_RenameStudioRequest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StudioRequestServiceServer).RenameStudioRequest(ctx, req.(*RenameStudioRequestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StudioRequestService_DeleteStudioRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteStudioRequestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StudioRequestServiceServer).DeleteStudioRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: StudioRequestService_DeleteStudioRequest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StudioRequestServiceServer).DeleteStudioRequest(ctx, req.(*DeleteStudioRequestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StudioRequestService_ListStudioRequests_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListStudioRequestsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StudioRequestServiceServer).ListStudioRequests(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: StudioRequestService_ListStudioRequests_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StudioRequestServiceServer).ListStudioRequests(ctx, req.(*ListStudioRequestsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// StudioRequestService_ServiceDesc is the grpc.ServiceDesc for StudioRequestService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var StudioRequestService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.StudioRequestService", + HandlerType: (*StudioRequestServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateStudioRequest", + Handler: _StudioRequestService_CreateStudioRequest_Handler, + }, + { + MethodName: "RenameStudioRequest", + Handler: _StudioRequestService_RenameStudioRequest_Handler, + }, + { + MethodName: "DeleteStudioRequest", + Handler: _StudioRequestService_DeleteStudioRequest_Handler, + }, + { + MethodName: "ListStudioRequests", + Handler: _StudioRequestService_ListStudioRequests_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/studio_request.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/sync.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/sync.pb.go new file mode 100644 index 000000000..a5d2a2905 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/sync.pb.go @@ -0,0 +1,632 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/sync.proto + +package registryv1alpha1 + +import ( + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GitSyncPoint is the sync point for a particular module contained in a Git repository. +type GitSyncPoint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + Branch string `protobuf:"bytes,3,opt,name=branch,proto3" json:"branch,omitempty"` + GitCommitHash string `protobuf:"bytes,4,opt,name=git_commit_hash,json=gitCommitHash,proto3" json:"git_commit_hash,omitempty"` + BsrCommitName string `protobuf:"bytes,5,opt,name=bsr_commit_name,json=bsrCommitName,proto3" json:"bsr_commit_name,omitempty"` +} + +func (x *GitSyncPoint) Reset() { + *x = GitSyncPoint{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GitSyncPoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GitSyncPoint) ProtoMessage() {} + +func (x *GitSyncPoint) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GitSyncPoint.ProtoReflect.Descriptor instead. +func (*GitSyncPoint) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_sync_proto_rawDescGZIP(), []int{0} +} + +func (x *GitSyncPoint) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GitSyncPoint) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GitSyncPoint) GetBranch() string { + if x != nil { + return x.Branch + } + return "" +} + +func (x *GitSyncPoint) GetGitCommitHash() string { + if x != nil { + return x.GitCommitHash + } + return "" +} + +func (x *GitSyncPoint) GetBsrCommitName() string { + if x != nil { + return x.BsrCommitName + } + return "" +} + +type GetGitSyncPointRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Owner is the owner of the BSR repository. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // Repository is the name of the BSR repository. + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + // Branch is the Git branch for which to look up the commit. + Branch string `protobuf:"bytes,3,opt,name=branch,proto3" json:"branch,omitempty"` +} + +func (x *GetGitSyncPointRequest) Reset() { + *x = GetGitSyncPointRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGitSyncPointRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGitSyncPointRequest) ProtoMessage() {} + +func (x *GetGitSyncPointRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetGitSyncPointRequest.ProtoReflect.Descriptor instead. +func (*GetGitSyncPointRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_sync_proto_rawDescGZIP(), []int{1} +} + +func (x *GetGitSyncPointRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *GetGitSyncPointRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *GetGitSyncPointRequest) GetBranch() string { + if x != nil { + return x.Branch + } + return "" +} + +type GetGitSyncPointResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // SyncPoint is the latest syncpoint for the specified owner/repo/branch. + SyncPoint *GitSyncPoint `protobuf:"bytes,1,opt,name=sync_point,json=syncPoint,proto3" json:"sync_point,omitempty"` +} + +func (x *GetGitSyncPointResponse) Reset() { + *x = GetGitSyncPointResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGitSyncPointResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGitSyncPointResponse) ProtoMessage() {} + +func (x *GetGitSyncPointResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetGitSyncPointResponse.ProtoReflect.Descriptor instead. +func (*GetGitSyncPointResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_sync_proto_rawDescGZIP(), []int{2} +} + +func (x *GetGitSyncPointResponse) GetSyncPoint() *GitSyncPoint { + if x != nil { + return x.SyncPoint + } + return nil +} + +type SyncGitCommitRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Owner is the owner of the BSR repository. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // Repository is the name of the BSR repository. + Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` + // Branch is the Git branch that this commit belongs to. + Branch string `protobuf:"bytes,3,opt,name=branch,proto3" json:"branch,omitempty"` + // Manifest with all the module files being pushed. + Manifest *v1alpha1.Blob `protobuf:"bytes,4,opt,name=manifest,proto3" json:"manifest,omitempty"` + // Referenced blobs in the manifest. Keep in mind there is not necessarily one + // blob per file, but one blob per digest, so for files with exactly the same + // content, you can send just one blob. + Blobs []*v1alpha1.Blob `protobuf:"bytes,5,rep,name=blobs,proto3" json:"blobs,omitempty"` + // Hash is the SHA1 hash of the Git commit. + Hash string `protobuf:"bytes,6,opt,name=hash,proto3" json:"hash,omitempty"` + // Author is the author of the Git commit. This is typically an end-user. + Author *GitIdentity `protobuf:"bytes,7,opt,name=author,proto3" json:"author,omitempty"` + // Commiter is the commiter of the Git commit. This typically a CI system. + Commiter *GitIdentity `protobuf:"bytes,8,opt,name=commiter,proto3" json:"commiter,omitempty"` + // Tags are the Git tags which point to this commit. + Tags []string `protobuf:"bytes,9,rep,name=tags,proto3" json:"tags,omitempty"` +} + +func (x *SyncGitCommitRequest) Reset() { + *x = SyncGitCommitRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncGitCommitRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncGitCommitRequest) ProtoMessage() {} + +func (x *SyncGitCommitRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncGitCommitRequest.ProtoReflect.Descriptor instead. +func (*SyncGitCommitRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_sync_proto_rawDescGZIP(), []int{3} +} + +func (x *SyncGitCommitRequest) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *SyncGitCommitRequest) GetRepository() string { + if x != nil { + return x.Repository + } + return "" +} + +func (x *SyncGitCommitRequest) GetBranch() string { + if x != nil { + return x.Branch + } + return "" +} + +func (x *SyncGitCommitRequest) GetManifest() *v1alpha1.Blob { + if x != nil { + return x.Manifest + } + return nil +} + +func (x *SyncGitCommitRequest) GetBlobs() []*v1alpha1.Blob { + if x != nil { + return x.Blobs + } + return nil +} + +func (x *SyncGitCommitRequest) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + +func (x *SyncGitCommitRequest) GetAuthor() *GitIdentity { + if x != nil { + return x.Author + } + return nil +} + +func (x *SyncGitCommitRequest) GetCommiter() *GitIdentity { + if x != nil { + return x.Commiter + } + return nil +} + +func (x *SyncGitCommitRequest) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +type SyncGitCommitResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // SyncPoint is the latest syncpoint for the SyncGitCommit request. + SyncPoint *GitSyncPoint `protobuf:"bytes,1,opt,name=sync_point,json=syncPoint,proto3" json:"sync_point,omitempty"` +} + +func (x *SyncGitCommitResponse) Reset() { + *x = SyncGitCommitResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncGitCommitResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncGitCommitResponse) ProtoMessage() {} + +func (x *SyncGitCommitResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_sync_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncGitCommitResponse.ProtoReflect.Descriptor instead. +func (*SyncGitCommitResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_sync_proto_rawDescGZIP(), []int{4} +} + +func (x *SyncGitCommitResponse) GetSyncPoint() *GitSyncPoint { + if x != nil { + return x.SyncPoint + } + return nil +} + +var File_registry_v1alpha1_sync_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_sync_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1c, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x67, 0x69, 0x74, 0x5f, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xac, 0x01, + 0x0a, 0x0c, 0x47, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x0f, + 0x67, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x67, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x26, 0x0a, 0x0f, 0x62, 0x73, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x62, + 0x73, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x66, 0x0a, 0x16, + 0x47, 0x65, 0x74, 0x47, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, + 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x72, + 0x61, 0x6e, 0x63, 0x68, 0x22, 0x71, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x47, 0x69, 0x74, 0x53, 0x79, + 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x56, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x47, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x09, 0x73, 0x79, + 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x22, 0xc0, 0x03, 0x0a, 0x14, 0x53, 0x79, 0x6e, 0x63, + 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x49, + 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x62, 0x52, + 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x05, 0x62, 0x6c, 0x6f, + 0x62, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, 0x12, 0x12, + 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, + 0x73, 0x68, 0x12, 0x4e, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x69, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x12, 0x52, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x69, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x09, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x6f, 0x0a, 0x15, 0x53, 0x79, + 0x6e, 0x63, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x47, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, + 0x52, 0x09, 0x73, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x32, 0xc7, 0x02, 0x0a, 0x0b, + 0x53, 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9d, 0x01, 0x0a, 0x0f, + 0x47, 0x65, 0x74, 0x47, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, + 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x47, + 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x42, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x47, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x97, 0x01, 0x0a, 0x0d, + 0x53, 0x79, 0x6e, 0x63, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x3f, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x47, 0x69, + 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x47, + 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x02, 0x42, 0xe4, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x09, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, + 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, + 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_sync_proto_rawDescOnce sync.Once + file_registry_v1alpha1_sync_proto_rawDescData = file_registry_v1alpha1_sync_proto_rawDesc +) + +func file_registry_v1alpha1_sync_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_sync_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_sync_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_sync_proto_rawDescData) + }) + return file_registry_v1alpha1_sync_proto_rawDescData +} + +var file_registry_v1alpha1_sync_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_registry_v1alpha1_sync_proto_goTypes = []interface{}{ + (*GitSyncPoint)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.GitSyncPoint + (*GetGitSyncPointRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.GetGitSyncPointRequest + (*GetGitSyncPointResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.GetGitSyncPointResponse + (*SyncGitCommitRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitRequest + (*SyncGitCommitResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitResponse + (*v1alpha1.Blob)(nil), // 5: bufman.dubbo.apache.org.module.v1alpha1.Blob + (*GitIdentity)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.GitIdentity +} +var file_registry_v1alpha1_sync_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.registry.v1alpha1.GetGitSyncPointResponse.sync_point:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GitSyncPoint + 5, // 1: bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitRequest.manifest:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Blob + 5, // 2: bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitRequest.blobs:type_name -> bufman.dubbo.apache.org.module.v1alpha1.Blob + 6, // 3: bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitRequest.author:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GitIdentity + 6, // 4: bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitRequest.commiter:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GitIdentity + 0, // 5: bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitResponse.sync_point:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.GitSyncPoint + 1, // 6: bufman.dubbo.apache.org.registry.v1alpha1.SyncService.GetGitSyncPoint:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetGitSyncPointRequest + 3, // 7: bufman.dubbo.apache.org.registry.v1alpha1.SyncService.SyncGitCommit:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitRequest + 2, // 8: bufman.dubbo.apache.org.registry.v1alpha1.SyncService.GetGitSyncPoint:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetGitSyncPointResponse + 4, // 9: bufman.dubbo.apache.org.registry.v1alpha1.SyncService.SyncGitCommit:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.SyncGitCommitResponse + 8, // [8:10] is the sub-list for method output_type + 6, // [6:8] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_sync_proto_init() } +func file_registry_v1alpha1_sync_proto_init() { + if File_registry_v1alpha1_sync_proto != nil { + return + } + file_registry_v1alpha1_git_metadata_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_sync_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GitSyncPoint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_sync_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGitSyncPointRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_sync_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGitSyncPointResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_sync_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncGitCommitRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_sync_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncGitCommitResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_sync_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_sync_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_sync_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_sync_proto_msgTypes, + }.Build() + File_registry_v1alpha1_sync_proto = out.File + file_registry_v1alpha1_sync_proto_rawDesc = nil + file_registry_v1alpha1_sync_proto_goTypes = nil + file_registry_v1alpha1_sync_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/sync_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/sync_grpc.pb.go new file mode 100644 index 000000000..3a4eba9a3 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/sync_grpc.pb.go @@ -0,0 +1,152 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/sync.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + SyncService_GetGitSyncPoint_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SyncService/GetGitSyncPoint" + SyncService_SyncGitCommit_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.SyncService/SyncGitCommit" +) + +// SyncServiceClient is the client API for SyncService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SyncServiceClient interface { + // GetGitSyncPoint retrieves the Git sync point for the named repository + // on the specified branch. + GetGitSyncPoint(ctx context.Context, in *GetGitSyncPointRequest, opts ...grpc.CallOption) (*GetGitSyncPointResponse, error) + // SyncGitCommit syncs a Git commit containing a module to a named repository. + SyncGitCommit(ctx context.Context, in *SyncGitCommitRequest, opts ...grpc.CallOption) (*SyncGitCommitResponse, error) +} + +type syncServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSyncServiceClient(cc grpc.ClientConnInterface) SyncServiceClient { + return &syncServiceClient{cc} +} + +func (c *syncServiceClient) GetGitSyncPoint(ctx context.Context, in *GetGitSyncPointRequest, opts ...grpc.CallOption) (*GetGitSyncPointResponse, error) { + out := new(GetGitSyncPointResponse) + err := c.cc.Invoke(ctx, SyncService_GetGitSyncPoint_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *syncServiceClient) SyncGitCommit(ctx context.Context, in *SyncGitCommitRequest, opts ...grpc.CallOption) (*SyncGitCommitResponse, error) { + out := new(SyncGitCommitResponse) + err := c.cc.Invoke(ctx, SyncService_SyncGitCommit_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SyncServiceServer is the server API for SyncService service. +// All implementations must embed UnimplementedSyncServiceServer +// for forward compatibility +type SyncServiceServer interface { + // GetGitSyncPoint retrieves the Git sync point for the named repository + // on the specified branch. + GetGitSyncPoint(context.Context, *GetGitSyncPointRequest) (*GetGitSyncPointResponse, error) + // SyncGitCommit syncs a Git commit containing a module to a named repository. + SyncGitCommit(context.Context, *SyncGitCommitRequest) (*SyncGitCommitResponse, error) + mustEmbedUnimplementedSyncServiceServer() +} + +// UnimplementedSyncServiceServer must be embedded to have forward compatible implementations. +type UnimplementedSyncServiceServer struct { +} + +func (UnimplementedSyncServiceServer) GetGitSyncPoint(context.Context, *GetGitSyncPointRequest) (*GetGitSyncPointResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGitSyncPoint not implemented") +} +func (UnimplementedSyncServiceServer) SyncGitCommit(context.Context, *SyncGitCommitRequest) (*SyncGitCommitResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SyncGitCommit not implemented") +} +func (UnimplementedSyncServiceServer) mustEmbedUnimplementedSyncServiceServer() {} + +// UnsafeSyncServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SyncServiceServer will +// result in compilation errors. +type UnsafeSyncServiceServer interface { + mustEmbedUnimplementedSyncServiceServer() +} + +func RegisterSyncServiceServer(s grpc.ServiceRegistrar, srv SyncServiceServer) { + s.RegisterService(&SyncService_ServiceDesc, srv) +} + +func _SyncService_GetGitSyncPoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGitSyncPointRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SyncServiceServer).GetGitSyncPoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SyncService_GetGitSyncPoint_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SyncServiceServer).GetGitSyncPoint(ctx, req.(*GetGitSyncPointRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SyncService_SyncGitCommit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SyncGitCommitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SyncServiceServer).SyncGitCommit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SyncService_SyncGitCommit_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SyncServiceServer).SyncGitCommit(ctx, req.(*SyncGitCommitRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SyncService_ServiceDesc is the grpc.ServiceDesc for SyncService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SyncService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.SyncService", + HandlerType: (*SyncServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetGitSyncPoint", + Handler: _SyncService_GetGitSyncPoint_Handler, + }, + { + MethodName: "SyncGitCommit", + Handler: _SyncService_SyncGitCommit_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/sync.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/token.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/token.pb.go new file mode 100644 index 000000000..7c1539e2d --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/token.pb.go @@ -0,0 +1,843 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/token.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Token struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + ExpireTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"` + Note string `protobuf:"bytes,4,opt,name=note,proto3" json:"note,omitempty"` +} + +func (x *Token) Reset() { + *x = Token{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Token) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Token) ProtoMessage() {} + +func (x *Token) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Token.ProtoReflect.Descriptor instead. +func (*Token) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{0} +} + +func (x *Token) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Token) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *Token) GetExpireTime() *timestamppb.Timestamp { + if x != nil { + return x.ExpireTime + } + return nil +} + +func (x *Token) GetNote() string { + if x != nil { + return x.Note + } + return "" +} + +type CreateTokenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Note string `protobuf:"bytes,1,opt,name=note,proto3" json:"note,omitempty"` + // The time until which the token should be valid. + // Must be in the future. May be null for no expiry. + ExpireTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"` + // The ID of the user to create a new token, can only be + // the user who perform this action, or a machine user. + // Default to the user who perform this action if this is empty. + UserId string `protobuf:"bytes,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *CreateTokenRequest) Reset() { + *x = CreateTokenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTokenRequest) ProtoMessage() {} + +func (x *CreateTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateTokenRequest.ProtoReflect.Descriptor instead. +func (*CreateTokenRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateTokenRequest) GetNote() string { + if x != nil { + return x.Note + } + return "" +} + +func (x *CreateTokenRequest) GetExpireTime() *timestamppb.Timestamp { + if x != nil { + return x.ExpireTime + } + return nil +} + +func (x *CreateTokenRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CreateTokenRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *CreateTokenRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type CreateTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The plaintext token to use for authentication. + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *CreateTokenResponse) Reset() { + *x = CreateTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTokenResponse) ProtoMessage() {} + +func (x *CreateTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateTokenResponse.ProtoReflect.Descriptor instead. +func (*CreateTokenResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateTokenResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type GetTokenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TokenId string `protobuf:"bytes,1,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (x *GetTokenRequest) Reset() { + *x = GetTokenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTokenRequest) ProtoMessage() {} + +func (x *GetTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTokenRequest.ProtoReflect.Descriptor instead. +func (*GetTokenRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{3} +} + +func (x *GetTokenRequest) GetTokenId() string { + if x != nil { + return x.TokenId + } + return "" +} + +type GetTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token *Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *GetTokenResponse) Reset() { + *x = GetTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTokenResponse) ProtoMessage() {} + +func (x *GetTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTokenResponse.ProtoReflect.Descriptor instead. +func (*GetTokenResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{4} +} + +func (x *GetTokenResponse) GetToken() *Token { + if x != nil { + return x.Token + } + return nil +} + +type ListTokensRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` + // The ID of the user to list tokens, can only be + // the user who perform this action, or a machine user. + // Default to the user who perform this action if this is empty. + UserId string `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *ListTokensRequest) Reset() { + *x = ListTokensRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTokensRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTokensRequest) ProtoMessage() {} + +func (x *ListTokensRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListTokensRequest.ProtoReflect.Descriptor instead. +func (*ListTokensRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{5} +} + +func (x *ListTokensRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListTokensRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListTokensRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +func (x *ListTokensRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type ListTokensResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tokens []*Token `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListTokensResponse) Reset() { + *x = ListTokensResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTokensResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTokensResponse) ProtoMessage() {} + +func (x *ListTokensResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListTokensResponse.ProtoReflect.Descriptor instead. +func (*ListTokensResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{6} +} + +func (x *ListTokensResponse) GetTokens() []*Token { + if x != nil { + return x.Tokens + } + return nil +} + +func (x *ListTokensResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type DeleteTokenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TokenId string `protobuf:"bytes,1,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (x *DeleteTokenRequest) Reset() { + *x = DeleteTokenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTokenRequest) ProtoMessage() {} + +func (x *DeleteTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTokenRequest.ProtoReflect.Descriptor instead. +func (*DeleteTokenRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{7} +} + +func (x *DeleteTokenRequest) GetTokenId() string { + if x != nil { + return x.TokenId + } + return "" +} + +type DeleteTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteTokenResponse) Reset() { + *x = DeleteTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_token_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTokenResponse) ProtoMessage() {} + +func (x *DeleteTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_token_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTokenResponse.ProtoReflect.Descriptor instead. +func (*DeleteTokenResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_token_proto_rawDescGZIP(), []int{8} +} + +var File_registry_v1alpha1_token_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_token_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x01, 0x0a, 0x05, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x6f, 0x74, 0x65, 0x22, 0xb6, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, + 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x74, 0x65, 0x12, 0x3b, + 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, + 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x2b, 0x0a, 0x13, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x2c, 0x0a, 0x0f, 0x47, 0x65, 0x74, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x64, 0x22, 0x5a, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x05, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x22, 0x82, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, + 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, + 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x86, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, + 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x48, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x30, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, + 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0x2f, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x49, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcd, 0x04, 0x0a, 0x0c, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x8c, 0x01, 0x0a, 0x0b, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x88, 0x01, 0x0a, 0x08, 0x47, 0x65, + 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3a, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x03, 0x90, 0x02, 0x01, 0x12, 0x8e, 0x01, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x12, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x91, 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x42, 0xe5, 0x02, 0x0a, 0x2d, 0x63, 0x6f, + 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0a, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, + 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, + 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_token_proto_rawDescOnce sync.Once + file_registry_v1alpha1_token_proto_rawDescData = file_registry_v1alpha1_token_proto_rawDesc +) + +func file_registry_v1alpha1_token_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_token_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_token_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_token_proto_rawDescData) + }) + return file_registry_v1alpha1_token_proto_rawDescData +} + +var file_registry_v1alpha1_token_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_registry_v1alpha1_token_proto_goTypes = []interface{}{ + (*Token)(nil), // 0: bufman.dubbo.apache.org.registry.v1alpha1.Token + (*CreateTokenRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateTokenRequest + (*CreateTokenResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateTokenResponse + (*GetTokenRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetTokenRequest + (*GetTokenResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.GetTokenResponse + (*ListTokensRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.ListTokensRequest + (*ListTokensResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.ListTokensResponse + (*DeleteTokenRequest)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.DeleteTokenRequest + (*DeleteTokenResponse)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.DeleteTokenResponse + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp +} +var file_registry_v1alpha1_token_proto_depIdxs = []int32{ + 9, // 0: bufman.dubbo.apache.org.registry.v1alpha1.Token.create_time:type_name -> google.protobuf.Timestamp + 9, // 1: bufman.dubbo.apache.org.registry.v1alpha1.Token.expire_time:type_name -> google.protobuf.Timestamp + 9, // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateTokenRequest.expire_time:type_name -> google.protobuf.Timestamp + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.GetTokenResponse.token:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Token + 0, // 4: bufman.dubbo.apache.org.registry.v1alpha1.ListTokensResponse.tokens:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Token + 1, // 5: bufman.dubbo.apache.org.registry.v1alpha1.TokenService.CreateToken:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateTokenRequest + 3, // 6: bufman.dubbo.apache.org.registry.v1alpha1.TokenService.GetToken:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetTokenRequest + 5, // 7: bufman.dubbo.apache.org.registry.v1alpha1.TokenService.ListTokens:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListTokensRequest + 7, // 8: bufman.dubbo.apache.org.registry.v1alpha1.TokenService.DeleteToken:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteTokenRequest + 2, // 9: bufman.dubbo.apache.org.registry.v1alpha1.TokenService.CreateToken:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateTokenResponse + 4, // 10: bufman.dubbo.apache.org.registry.v1alpha1.TokenService.GetToken:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetTokenResponse + 6, // 11: bufman.dubbo.apache.org.registry.v1alpha1.TokenService.ListTokens:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListTokensResponse + 8, // 12: bufman.dubbo.apache.org.registry.v1alpha1.TokenService.DeleteToken:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteTokenResponse + 9, // [9:13] is the sub-list for method output_type + 5, // [5:9] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_token_proto_init() } +func file_registry_v1alpha1_token_proto_init() { + if File_registry_v1alpha1_token_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_token_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Token); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_token_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateTokenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_token_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateTokenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_token_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTokenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_token_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTokenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_token_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListTokensRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_token_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListTokensResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_token_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTokenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_token_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTokenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_token_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_token_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_token_proto_depIdxs, + MessageInfos: file_registry_v1alpha1_token_proto_msgTypes, + }.Build() + File_registry_v1alpha1_token_proto = out.File + file_registry_v1alpha1_token_proto_rawDesc = nil + file_registry_v1alpha1_token_proto_goTypes = nil + file_registry_v1alpha1_token_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/token_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/token_grpc.pb.go new file mode 100644 index 000000000..238196f64 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/token_grpc.pb.go @@ -0,0 +1,240 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/token.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + TokenService_CreateToken_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/CreateToken" + TokenService_GetToken_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/GetToken" + TokenService_ListTokens_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/ListTokens" + TokenService_DeleteToken_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.TokenService/DeleteToken" +) + +// TokenServiceClient is the client API for TokenService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TokenServiceClient interface { + // CreateToken creates a new token suitable for machine-to-machine authentication. + CreateToken(ctx context.Context, in *CreateTokenRequest, opts ...grpc.CallOption) (*CreateTokenResponse, error) + // GetToken gets the specific token for the user + // + // This method requires authentication. + GetToken(ctx context.Context, in *GetTokenRequest, opts ...grpc.CallOption) (*GetTokenResponse, error) + // ListTokens lists the users active tokens + // + // This method requires authentication. + ListTokens(ctx context.Context, in *ListTokensRequest, opts ...grpc.CallOption) (*ListTokensResponse, error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteToken(ctx context.Context, in *DeleteTokenRequest, opts ...grpc.CallOption) (*DeleteTokenResponse, error) +} + +type tokenServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTokenServiceClient(cc grpc.ClientConnInterface) TokenServiceClient { + return &tokenServiceClient{cc} +} + +func (c *tokenServiceClient) CreateToken(ctx context.Context, in *CreateTokenRequest, opts ...grpc.CallOption) (*CreateTokenResponse, error) { + out := new(CreateTokenResponse) + err := c.cc.Invoke(ctx, TokenService_CreateToken_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tokenServiceClient) GetToken(ctx context.Context, in *GetTokenRequest, opts ...grpc.CallOption) (*GetTokenResponse, error) { + out := new(GetTokenResponse) + err := c.cc.Invoke(ctx, TokenService_GetToken_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tokenServiceClient) ListTokens(ctx context.Context, in *ListTokensRequest, opts ...grpc.CallOption) (*ListTokensResponse, error) { + out := new(ListTokensResponse) + err := c.cc.Invoke(ctx, TokenService_ListTokens_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tokenServiceClient) DeleteToken(ctx context.Context, in *DeleteTokenRequest, opts ...grpc.CallOption) (*DeleteTokenResponse, error) { + out := new(DeleteTokenResponse) + err := c.cc.Invoke(ctx, TokenService_DeleteToken_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TokenServiceServer is the server API for TokenService service. +// All implementations must embed UnimplementedTokenServiceServer +// for forward compatibility +type TokenServiceServer interface { + // CreateToken creates a new token suitable for machine-to-machine authentication. + CreateToken(context.Context, *CreateTokenRequest) (*CreateTokenResponse, error) + // GetToken gets the specific token for the user + // + // This method requires authentication. + GetToken(context.Context, *GetTokenRequest) (*GetTokenResponse, error) + // ListTokens lists the users active tokens + // + // This method requires authentication. + ListTokens(context.Context, *ListTokensRequest) (*ListTokensResponse, error) + // DeleteToken deletes an existing token. + // + // This method requires authentication. + DeleteToken(context.Context, *DeleteTokenRequest) (*DeleteTokenResponse, error) + mustEmbedUnimplementedTokenServiceServer() +} + +// UnimplementedTokenServiceServer must be embedded to have forward compatible implementations. +type UnimplementedTokenServiceServer struct { +} + +func (UnimplementedTokenServiceServer) CreateToken(context.Context, *CreateTokenRequest) (*CreateTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateToken not implemented") +} +func (UnimplementedTokenServiceServer) GetToken(context.Context, *GetTokenRequest) (*GetTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetToken not implemented") +} +func (UnimplementedTokenServiceServer) ListTokens(context.Context, *ListTokensRequest) (*ListTokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListTokens not implemented") +} +func (UnimplementedTokenServiceServer) DeleteToken(context.Context, *DeleteTokenRequest) (*DeleteTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteToken not implemented") +} +func (UnimplementedTokenServiceServer) mustEmbedUnimplementedTokenServiceServer() {} + +// UnsafeTokenServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TokenServiceServer will +// result in compilation errors. +type UnsafeTokenServiceServer interface { + mustEmbedUnimplementedTokenServiceServer() +} + +func RegisterTokenServiceServer(s grpc.ServiceRegistrar, srv TokenServiceServer) { + s.RegisterService(&TokenService_ServiceDesc, srv) +} + +func _TokenService_CreateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TokenServiceServer).CreateToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TokenService_CreateToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TokenServiceServer).CreateToken(ctx, req.(*CreateTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TokenService_GetToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TokenServiceServer).GetToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TokenService_GetToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TokenServiceServer).GetToken(ctx, req.(*GetTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TokenService_ListTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListTokensRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TokenServiceServer).ListTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TokenService_ListTokens_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TokenServiceServer).ListTokens(ctx, req.(*ListTokensRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TokenService_DeleteToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TokenServiceServer).DeleteToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TokenService_DeleteToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TokenServiceServer).DeleteToken(ctx, req.(*DeleteTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TokenService_ServiceDesc is the grpc.ServiceDesc for TokenService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TokenService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.TokenService", + HandlerType: (*TokenServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateToken", + Handler: _TokenService_CreateToken_Handler, + }, + { + MethodName: "GetToken", + Handler: _TokenService_GetToken_Handler, + }, + { + MethodName: "ListTokens", + Handler: _TokenService_ListTokens_Handler, + }, + { + MethodName: "DeleteToken", + Handler: _TokenService_DeleteToken_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/token.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/user.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/user.pb.go new file mode 100644 index 000000000..017ae9b14 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/user.pb.go @@ -0,0 +1,2028 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/user.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type UserState int32 + +const ( + UserState_USER_STATE_UNSPECIFIED UserState = 0 + UserState_USER_STATE_ACTIVE UserState = 1 + UserState_USER_STATE_DEACTIVATED UserState = 2 +) + +// Enum value maps for UserState. +var ( + UserState_name = map[int32]string{ + 0: "USER_STATE_UNSPECIFIED", + 1: "USER_STATE_ACTIVE", + 2: "USER_STATE_DEACTIVATED", + } + UserState_value = map[string]int32{ + "USER_STATE_UNSPECIFIED": 0, + "USER_STATE_ACTIVE": 1, + "USER_STATE_DEACTIVATED": 2, + } +) + +func (x UserState) Enum() *UserState { + p := new(UserState) + *p = x + return p +} + +func (x UserState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UserState) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_user_proto_enumTypes[0].Descriptor() +} + +func (UserState) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_user_proto_enumTypes[0] +} + +func (x UserState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UserState.Descriptor instead. +func (UserState) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{0} +} + +type UserType int32 + +const ( + UserType_USER_TYPE_UNSPECIFIED UserType = 0 + UserType_USER_TYPE_PERSONAL UserType = 1 + UserType_USER_TYPE_MACHINE UserType = 2 + UserType_USER_TYPE_SYSTEM UserType = 3 +) + +// Enum value maps for UserType. +var ( + UserType_name = map[int32]string{ + 0: "USER_TYPE_UNSPECIFIED", + 1: "USER_TYPE_PERSONAL", + 2: "USER_TYPE_MACHINE", + 3: "USER_TYPE_SYSTEM", + } + UserType_value = map[string]int32{ + "USER_TYPE_UNSPECIFIED": 0, + "USER_TYPE_PERSONAL": 1, + "USER_TYPE_MACHINE": 2, + "USER_TYPE_SYSTEM": 3, + } +) + +func (x UserType) Enum() *UserType { + p := new(UserType) + *p = x + return p +} + +func (x UserType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UserType) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_user_proto_enumTypes[1].Descriptor() +} + +func (UserType) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_user_proto_enumTypes[1] +} + +func (x UserType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UserType.Descriptor instead. +func (UserType) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{1} +} + +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // primary key, unique, immutable + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // immutable + CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // mutable + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + // unique, mutable + Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` + // mutable + Deactivated bool `protobuf:"varint,5,opt,name=deactivated,proto3" json:"deactivated,omitempty"` + // description is the user configurable description of the user. + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + // url is the user configurable URL in the description of the user, + // always included the scheme and will not have a #fragment suffix. + Url string `protobuf:"bytes,7,opt,name=url,proto3" json:"url,omitempty"` + // verification status of the user, configurable by server admin. + VerificationStatus VerificationStatus `protobuf:"varint,8,opt,name=verification_status,json=verificationStatus,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus" json:"verification_status,omitempty"` + // user type of the user, depends on how the user was created. + UserType UserType `protobuf:"varint,9,opt,name=user_type,json=userType,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.UserType" json:"user_type,omitempty"` +} + +func (x *User) Reset() { + *x = User{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{0} +} + +func (x *User) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *User) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *User) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +func (x *User) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *User) GetDeactivated() bool { + if x != nil { + return x.Deactivated + } + return false +} + +func (x *User) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *User) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *User) GetVerificationStatus() VerificationStatus { + if x != nil { + return x.VerificationStatus + } + return VerificationStatus_VERIFICATION_STATUS_UNSPECIFIED +} + +func (x *User) GetUserType() UserType { + if x != nil { + return x.UserType + } + return UserType_USER_TYPE_UNSPECIFIED +} + +// TODO: #663 move this to organization service +type OrganizationUser struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + // The ID of the organization for which the role belongs to. + OrganizationId string `protobuf:"bytes,2,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + // The role that the user has in the organization above. + OrganizationRole OrganizationRole `protobuf:"varint,3,opt,name=organization_role,json=organizationRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole" json:"organization_role,omitempty"` + // The source of the user's role in the organization above. + OrganizationRoleSource OrganizationRoleSource `protobuf:"varint,4,opt,name=organization_role_source,json=organizationRoleSource,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource" json:"organization_role_source,omitempty"` +} + +func (x *OrganizationUser) Reset() { + *x = OrganizationUser{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OrganizationUser) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OrganizationUser) ProtoMessage() {} + +func (x *OrganizationUser) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OrganizationUser.ProtoReflect.Descriptor instead. +func (*OrganizationUser) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{1} +} + +func (x *OrganizationUser) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +func (x *OrganizationUser) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *OrganizationUser) GetOrganizationRole() OrganizationRole { + if x != nil { + return x.OrganizationRole + } + return OrganizationRole_ORGANIZATION_ROLE_UNSPECIFIED +} + +func (x *OrganizationUser) GetOrganizationRoleSource() OrganizationRoleSource { + if x != nil { + return x.OrganizationRoleSource + } + return OrganizationRoleSource_ORGANIZATION_ROLE_SOURCE_UNSPECIFIED +} + +type CreateUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *CreateUserRequest) Reset() { + *x = CreateUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserRequest) ProtoMessage() {} + +func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead. +func (*CreateUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateUserRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *CreateUserRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type CreateUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *CreateUserResponse) Reset() { + *x = CreateUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserResponse) ProtoMessage() {} + +func (x *CreateUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead. +func (*CreateUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type GetUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetUserRequest) Reset() { + *x = GetUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserRequest) ProtoMessage() {} + +func (x *GetUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead. +func (*GetUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{4} +} + +func (x *GetUserRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *GetUserResponse) Reset() { + *x = GetUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserResponse) ProtoMessage() {} + +func (x *GetUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserResponse.ProtoReflect.Descriptor instead. +func (*GetUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{5} +} + +func (x *GetUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type GetUserByUsernameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` +} + +func (x *GetUserByUsernameRequest) Reset() { + *x = GetUserByUsernameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserByUsernameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByUsernameRequest) ProtoMessage() {} + +func (x *GetUserByUsernameRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByUsernameRequest.ProtoReflect.Descriptor instead. +func (*GetUserByUsernameRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{6} +} + +func (x *GetUserByUsernameRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +type GetUserByUsernameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *GetUserByUsernameResponse) Reset() { + *x = GetUserByUsernameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserByUsernameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByUsernameResponse) ProtoMessage() {} + +func (x *GetUserByUsernameResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByUsernameResponse.ProtoReflect.Descriptor instead. +func (*GetUserByUsernameResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{7} +} + +func (x *GetUserByUsernameResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type ListUsersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PageSize uint32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,3,opt,name=reverse,proto3" json:"reverse,omitempty"` + // If the user_state_filter is unspecified, users of all states are included. + UserStateFilter UserState `protobuf:"varint,4,opt,name=user_state_filter,json=userStateFilter,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.UserState" json:"user_state_filter,omitempty"` + // If the user_type_filters is empty, users of all types are included. + UserTypeFilters []UserType `protobuf:"varint,5,rep,packed,name=user_type_filters,json=userTypeFilters,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.UserType" json:"user_type_filters,omitempty"` +} + +func (x *ListUsersRequest) Reset() { + *x = ListUsersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUsersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUsersRequest) ProtoMessage() {} + +func (x *ListUsersRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead. +func (*ListUsersRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{8} +} + +func (x *ListUsersRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUsersRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListUsersRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +func (x *ListUsersRequest) GetUserStateFilter() UserState { + if x != nil { + return x.UserStateFilter + } + return UserState_USER_STATE_UNSPECIFIED +} + +func (x *ListUsersRequest) GetUserTypeFilters() []UserType { + if x != nil { + return x.UserTypeFilters + } + return nil +} + +type ListUsersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListUsersResponse) Reset() { + *x = ListUsersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUsersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUsersResponse) ProtoMessage() {} + +func (x *ListUsersResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead. +func (*ListUsersResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{9} +} + +func (x *ListUsersResponse) GetUsers() []*User { + if x != nil { + return x.Users + } + return nil +} + +func (x *ListUsersResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListOrganizationUsersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // The first page is returned if this is empty. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Reverse bool `protobuf:"varint,4,opt,name=reverse,proto3" json:"reverse,omitempty"` +} + +func (x *ListOrganizationUsersRequest) Reset() { + *x = ListOrganizationUsersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationUsersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationUsersRequest) ProtoMessage() {} + +func (x *ListOrganizationUsersRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationUsersRequest.ProtoReflect.Descriptor instead. +func (*ListOrganizationUsersRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{10} +} + +func (x *ListOrganizationUsersRequest) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *ListOrganizationUsersRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListOrganizationUsersRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListOrganizationUsersRequest) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +type ListOrganizationUsersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Users []*OrganizationUser `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + // There are no more pages if this is empty. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListOrganizationUsersResponse) Reset() { + *x = ListOrganizationUsersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOrganizationUsersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOrganizationUsersResponse) ProtoMessage() {} + +func (x *ListOrganizationUsersResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListOrganizationUsersResponse.ProtoReflect.Descriptor instead. +func (*ListOrganizationUsersResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{11} +} + +func (x *ListOrganizationUsersResponse) GetUsers() []*OrganizationUser { + if x != nil { + return x.Users + } + return nil +} + +func (x *ListOrganizationUsersResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type DeleteUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteUserRequest) Reset() { + *x = DeleteUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserRequest) ProtoMessage() {} + +func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{12} +} + +type DeleteUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteUserResponse) Reset() { + *x = DeleteUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserResponse) ProtoMessage() {} + +func (x *DeleteUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserResponse.ProtoReflect.Descriptor instead. +func (*DeleteUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{13} +} + +type DeactivateUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeactivateUserRequest) Reset() { + *x = DeactivateUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeactivateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeactivateUserRequest) ProtoMessage() {} + +func (x *DeactivateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeactivateUserRequest.ProtoReflect.Descriptor instead. +func (*DeactivateUserRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{14} +} + +func (x *DeactivateUserRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeactivateUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeactivateUserResponse) Reset() { + *x = DeactivateUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeactivateUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeactivateUserResponse) ProtoMessage() {} + +func (x *DeactivateUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeactivateUserResponse.ProtoReflect.Descriptor instead. +func (*DeactivateUserResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{15} +} + +type UpdateUserServerRoleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the user for which to be updated a role. + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // The new role of the user in the server. + ServerRole ServerRole `protobuf:"varint,2,opt,name=server_role,json=serverRole,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.ServerRole" json:"server_role,omitempty"` +} + +func (x *UpdateUserServerRoleRequest) Reset() { + *x = UpdateUserServerRoleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserServerRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserServerRoleRequest) ProtoMessage() {} + +func (x *UpdateUserServerRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserServerRoleRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserServerRoleRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{16} +} + +func (x *UpdateUserServerRoleRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateUserServerRoleRequest) GetServerRole() ServerRole { + if x != nil { + return x.ServerRole + } + return ServerRole_SERVER_ROLE_UNSPECIFIED +} + +type UpdateUserServerRoleResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateUserServerRoleResponse) Reset() { + *x = UpdateUserServerRoleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserServerRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserServerRoleResponse) ProtoMessage() {} + +func (x *UpdateUserServerRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserServerRoleResponse.ProtoReflect.Descriptor instead. +func (*UpdateUserServerRoleResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{17} +} + +type CountUsersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If the user_state_filter is unspecified, all users are included. + UserStateFilter UserState `protobuf:"varint,1,opt,name=user_state_filter,json=userStateFilter,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.UserState" json:"user_state_filter,omitempty"` +} + +func (x *CountUsersRequest) Reset() { + *x = CountUsersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountUsersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountUsersRequest) ProtoMessage() {} + +func (x *CountUsersRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountUsersRequest.ProtoReflect.Descriptor instead. +func (*CountUsersRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{18} +} + +func (x *CountUsersRequest) GetUserStateFilter() UserState { + if x != nil { + return x.UserStateFilter + } + return UserState_USER_STATE_UNSPECIFIED +} + +type CountUsersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TotalCount uint32 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` +} + +func (x *CountUsersResponse) Reset() { + *x = CountUsersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountUsersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountUsersResponse) ProtoMessage() {} + +func (x *CountUsersResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountUsersResponse.ProtoReflect.Descriptor instead. +func (*CountUsersResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{19} +} + +func (x *CountUsersResponse) GetTotalCount() uint32 { + if x != nil { + return x.TotalCount + } + return 0 +} + +type UpdateUserSettingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // optional, update to description will only be made when this is present + Description *string `protobuf:"bytes,2,opt,name=description,proto3,oneof" json:"description,omitempty"` + // optional, update to url will only be made when this is present + Url *string `protobuf:"bytes,3,opt,name=url,proto3,oneof" json:"url,omitempty"` +} + +func (x *UpdateUserSettingsRequest) Reset() { + *x = UpdateUserSettingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserSettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserSettingsRequest) ProtoMessage() {} + +func (x *UpdateUserSettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserSettingsRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserSettingsRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{20} +} + +func (x *UpdateUserSettingsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateUserSettingsRequest) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *UpdateUserSettingsRequest) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +type UpdateUserSettingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateUserSettingsResponse) Reset() { + *x = UpdateUserSettingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_user_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserSettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserSettingsResponse) ProtoMessage() {} + +func (x *UpdateUserSettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_user_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserSettingsResponse.ProtoReflect.Descriptor instead. +func (*UpdateUserSettingsResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_user_proto_rawDescGZIP(), []int{21} +} + +var File_registry_v1alpha1_user_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_user_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1c, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x6f, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc4, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, + 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x64, 0x65, 0x61, 0x63, 0x74, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x6e, 0x0a, 0x13, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x12, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x50, 0x0a, 0x09, 0x75, 0x73, + 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0xe7, 0x02, 0x0a, + 0x10, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, + 0x72, 0x12, 0x43, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, + 0x68, 0x0a, 0x11, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x10, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x7b, 0x0a, 0x18, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x41, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x16, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x4b, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x22, 0x59, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x20, + 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x56, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x36, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x22, 0x60, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x55, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, + 0x65, 0x72, 0x22, 0xab, 0x02, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x60, 0x0a, + 0x11, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0f, + 0x75, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, + 0x5f, 0x0a, 0x11, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x0f, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, + 0x22, 0x82, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x26, 0x0a, + 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, + 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, + 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, + 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x0a, + 0x15, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x8e, 0x01, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x56, 0x0a, 0x0b, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x6f, 0x6c, + 0x65, 0x22, 0x1e, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x75, 0x0a, 0x11, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x60, 0x0a, 0x11, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x34, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x35, 0x0a, 0x12, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x8a, 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, + 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x03, 0x75, 0x72, + 0x6c, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x75, 0x72, 0x6c, 0x22, 0x1c, 0x0a, 0x1a, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0x5a, 0x0a, 0x09, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x55, 0x53, 0x45, 0x52, 0x5f, + 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x45, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x55, 0x53, + 0x45, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x45, 0x41, 0x43, 0x54, 0x49, 0x56, + 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x6a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, + 0x12, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x45, 0x52, 0x53, 0x4f, + 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x43, 0x48, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, + 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, + 0x10, 0x03, 0x32, 0x99, 0x0c, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x12, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x02, 0x12, 0x85, 0x01, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, + 0x39, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa3, 0x01, 0x0a, 0x11, + 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x43, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, + 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x01, 0x12, 0x8b, 0x01, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, + 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3c, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, + 0xaf, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x48, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, + 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, + 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, + 0x01, 0x12, 0x8e, 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3d, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x02, 0x12, 0x9a, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, + 0xa7, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x46, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x47, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x6f, 0x6c, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x0a, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x3c, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0xa1, 0x01, 0x0a, 0x12, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x12, 0x44, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, + 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x45, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xe4, + 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, + 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, + 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, + 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, + 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_user_proto_rawDescOnce sync.Once + file_registry_v1alpha1_user_proto_rawDescData = file_registry_v1alpha1_user_proto_rawDesc +) + +func file_registry_v1alpha1_user_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_user_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_user_proto_rawDescData) + }) + return file_registry_v1alpha1_user_proto_rawDescData +} + +var file_registry_v1alpha1_user_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_registry_v1alpha1_user_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_registry_v1alpha1_user_proto_goTypes = []interface{}{ + (UserState)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.UserState + (UserType)(0), // 1: bufman.dubbo.apache.org.registry.v1alpha1.UserType + (*User)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.User + (*OrganizationUser)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationUser + (*CreateUserRequest)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.CreateUserRequest + (*CreateUserResponse)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.CreateUserResponse + (*GetUserRequest)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.GetUserRequest + (*GetUserResponse)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.GetUserResponse + (*GetUserByUsernameRequest)(nil), // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetUserByUsernameRequest + (*GetUserByUsernameResponse)(nil), // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetUserByUsernameResponse + (*ListUsersRequest)(nil), // 10: bufman.dubbo.apache.org.registry.v1alpha1.ListUsersRequest + (*ListUsersResponse)(nil), // 11: bufman.dubbo.apache.org.registry.v1alpha1.ListUsersResponse + (*ListOrganizationUsersRequest)(nil), // 12: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationUsersRequest + (*ListOrganizationUsersResponse)(nil), // 13: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationUsersResponse + (*DeleteUserRequest)(nil), // 14: bufman.dubbo.apache.org.registry.v1alpha1.DeleteUserRequest + (*DeleteUserResponse)(nil), // 15: bufman.dubbo.apache.org.registry.v1alpha1.DeleteUserResponse + (*DeactivateUserRequest)(nil), // 16: bufman.dubbo.apache.org.registry.v1alpha1.DeactivateUserRequest + (*DeactivateUserResponse)(nil), // 17: bufman.dubbo.apache.org.registry.v1alpha1.DeactivateUserResponse + (*UpdateUserServerRoleRequest)(nil), // 18: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserServerRoleRequest + (*UpdateUserServerRoleResponse)(nil), // 19: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserServerRoleResponse + (*CountUsersRequest)(nil), // 20: bufman.dubbo.apache.org.registry.v1alpha1.CountUsersRequest + (*CountUsersResponse)(nil), // 21: bufman.dubbo.apache.org.registry.v1alpha1.CountUsersResponse + (*UpdateUserSettingsRequest)(nil), // 22: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserSettingsRequest + (*UpdateUserSettingsResponse)(nil), // 23: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserSettingsResponse + (*timestamppb.Timestamp)(nil), // 24: google.protobuf.Timestamp + (VerificationStatus)(0), // 25: bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus + (OrganizationRole)(0), // 26: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + (OrganizationRoleSource)(0), // 27: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource + (ServerRole)(0), // 28: bufman.dubbo.apache.org.registry.v1alpha1.ServerRole +} +var file_registry_v1alpha1_user_proto_depIdxs = []int32{ + 24, // 0: bufman.dubbo.apache.org.registry.v1alpha1.User.create_time:type_name -> google.protobuf.Timestamp + 24, // 1: bufman.dubbo.apache.org.registry.v1alpha1.User.update_time:type_name -> google.protobuf.Timestamp + 25, // 2: bufman.dubbo.apache.org.registry.v1alpha1.User.verification_status:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus + 1, // 3: bufman.dubbo.apache.org.registry.v1alpha1.User.user_type:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.UserType + 2, // 4: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationUser.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 26, // 5: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationUser.organization_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRole + 27, // 6: bufman.dubbo.apache.org.registry.v1alpha1.OrganizationUser.organization_role_source:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationRoleSource + 2, // 7: bufman.dubbo.apache.org.registry.v1alpha1.CreateUserResponse.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 2, // 8: bufman.dubbo.apache.org.registry.v1alpha1.GetUserResponse.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 2, // 9: bufman.dubbo.apache.org.registry.v1alpha1.GetUserByUsernameResponse.user:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 0, // 10: bufman.dubbo.apache.org.registry.v1alpha1.ListUsersRequest.user_state_filter:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.UserState + 1, // 11: bufman.dubbo.apache.org.registry.v1alpha1.ListUsersRequest.user_type_filters:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.UserType + 2, // 12: bufman.dubbo.apache.org.registry.v1alpha1.ListUsersResponse.users:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.User + 3, // 13: bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationUsersResponse.users:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.OrganizationUser + 28, // 14: bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserServerRoleRequest.server_role:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.ServerRole + 0, // 15: bufman.dubbo.apache.org.registry.v1alpha1.CountUsersRequest.user_state_filter:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.UserState + 4, // 16: bufman.dubbo.apache.org.registry.v1alpha1.UserService.CreateUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateUserRequest + 6, // 17: bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetUserRequest + 8, // 18: bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUserByUsername:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetUserByUsernameRequest + 10, // 19: bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListUsers:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUsersRequest + 12, // 20: bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListOrganizationUsers:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationUsersRequest + 14, // 21: bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeleteUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteUserRequest + 16, // 22: bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeactivateUser:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeactivateUserRequest + 18, // 23: bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserServerRole:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserServerRoleRequest + 20, // 24: bufman.dubbo.apache.org.registry.v1alpha1.UserService.CountUsers:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CountUsersRequest + 22, // 25: bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserSettings:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserSettingsRequest + 5, // 26: bufman.dubbo.apache.org.registry.v1alpha1.UserService.CreateUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateUserResponse + 7, // 27: bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetUserResponse + 9, // 28: bufman.dubbo.apache.org.registry.v1alpha1.UserService.GetUserByUsername:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.GetUserByUsernameResponse + 11, // 29: bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListUsers:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListUsersResponse + 13, // 30: bufman.dubbo.apache.org.registry.v1alpha1.UserService.ListOrganizationUsers:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListOrganizationUsersResponse + 15, // 31: bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeleteUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteUserResponse + 17, // 32: bufman.dubbo.apache.org.registry.v1alpha1.UserService.DeactivateUser:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeactivateUserResponse + 19, // 33: bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserServerRole:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserServerRoleResponse + 21, // 34: bufman.dubbo.apache.org.registry.v1alpha1.UserService.CountUsers:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CountUsersResponse + 23, // 35: bufman.dubbo.apache.org.registry.v1alpha1.UserService.UpdateUserSettings:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.UpdateUserSettingsResponse + 26, // [26:36] is the sub-list for method output_type + 16, // [16:26] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_user_proto_init() } +func file_registry_v1alpha1_user_proto_init() { + if File_registry_v1alpha1_user_proto != nil { + return + } + file_registry_v1alpha1_role_proto_init() + file_registry_v1alpha1_verification_status_proto_init() + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*User); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OrganizationUser); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserByUsernameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserByUsernameResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUsersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUsersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationUsersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOrganizationUsersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeactivateUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeactivateUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserServerRoleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserServerRoleResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountUsersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountUsersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserSettingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_user_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserSettingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_registry_v1alpha1_user_proto_msgTypes[20].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_user_proto_rawDesc, + NumEnums: 2, + NumMessages: 22, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_user_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_user_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_user_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_user_proto_msgTypes, + }.Build() + File_registry_v1alpha1_user_proto = out.File + file_registry_v1alpha1_user_proto_rawDesc = nil + file_registry_v1alpha1_user_proto_goTypes = nil + file_registry_v1alpha1_user_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/user_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/user_grpc.pb.go new file mode 100644 index 000000000..f9c55da88 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/user_grpc.pb.go @@ -0,0 +1,464 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/user.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + UserService_CreateUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/CreateUser" + UserService_GetUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/GetUser" + UserService_GetUserByUsername_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/GetUserByUsername" + UserService_ListUsers_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/ListUsers" + UserService_ListOrganizationUsers_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/ListOrganizationUsers" + UserService_DeleteUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/DeleteUser" + UserService_DeactivateUser_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/DeactivateUser" + UserService_UpdateUserServerRole_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/UpdateUserServerRole" + UserService_CountUsers_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/CountUsers" + UserService_UpdateUserSettings_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.UserService/UpdateUserSettings" +) + +// UserServiceClient is the client API for UserService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type UserServiceClient interface { + // CreateUser creates a new user with the given username. + CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) + // GetUser gets a user by ID. + GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) + // GetUserByUsername gets a user by username. + GetUserByUsername(ctx context.Context, in *GetUserByUsernameRequest, opts ...grpc.CallOption) (*GetUserByUsernameResponse, error) + // ListUsers lists all users. + ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) + // ListOrganizationUsers lists all users for an organization. + // TODO: #663 move this to organization service + ListOrganizationUsers(ctx context.Context, in *ListOrganizationUsersRequest, opts ...grpc.CallOption) (*ListOrganizationUsersResponse, error) + // DeleteUser deletes a user. + DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) + // Deactivate user deactivates a user. + DeactivateUser(ctx context.Context, in *DeactivateUserRequest, opts ...grpc.CallOption) (*DeactivateUserResponse, error) + // UpdateUserServerRole update the role of an user in the server. + UpdateUserServerRole(ctx context.Context, in *UpdateUserServerRoleRequest, opts ...grpc.CallOption) (*UpdateUserServerRoleResponse, error) + // CountUsers returns the number of users in the server by the user state provided. + CountUsers(ctx context.Context, in *CountUsersRequest, opts ...grpc.CallOption) (*CountUsersResponse, error) + // UpdateUserSettings update the user settings including description. + UpdateUserSettings(ctx context.Context, in *UpdateUserSettingsRequest, opts ...grpc.CallOption) (*UpdateUserSettingsResponse, error) +} + +type userServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { + return &userServiceClient{cc} +} + +func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) { + out := new(CreateUserResponse) + err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) { + out := new(GetUserResponse) + err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) GetUserByUsername(ctx context.Context, in *GetUserByUsernameRequest, opts ...grpc.CallOption) (*GetUserByUsernameResponse, error) { + out := new(GetUserByUsernameResponse) + err := c.cc.Invoke(ctx, UserService_GetUserByUsername_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) { + out := new(ListUsersResponse) + err := c.cc.Invoke(ctx, UserService_ListUsers_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) ListOrganizationUsers(ctx context.Context, in *ListOrganizationUsersRequest, opts ...grpc.CallOption) (*ListOrganizationUsersResponse, error) { + out := new(ListOrganizationUsersResponse) + err := c.cc.Invoke(ctx, UserService_ListOrganizationUsers_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) { + out := new(DeleteUserResponse) + err := c.cc.Invoke(ctx, UserService_DeleteUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeactivateUser(ctx context.Context, in *DeactivateUserRequest, opts ...grpc.CallOption) (*DeactivateUserResponse, error) { + out := new(DeactivateUserResponse) + err := c.cc.Invoke(ctx, UserService_DeactivateUser_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) UpdateUserServerRole(ctx context.Context, in *UpdateUserServerRoleRequest, opts ...grpc.CallOption) (*UpdateUserServerRoleResponse, error) { + out := new(UpdateUserServerRoleResponse) + err := c.cc.Invoke(ctx, UserService_UpdateUserServerRole_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) CountUsers(ctx context.Context, in *CountUsersRequest, opts ...grpc.CallOption) (*CountUsersResponse, error) { + out := new(CountUsersResponse) + err := c.cc.Invoke(ctx, UserService_CountUsers_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) UpdateUserSettings(ctx context.Context, in *UpdateUserSettingsRequest, opts ...grpc.CallOption) (*UpdateUserSettingsResponse, error) { + out := new(UpdateUserSettingsResponse) + err := c.cc.Invoke(ctx, UserService_UpdateUserSettings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserServiceServer is the server API for UserService service. +// All implementations must embed UnimplementedUserServiceServer +// for forward compatibility +type UserServiceServer interface { + // CreateUser creates a new user with the given username. + CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) + // GetUser gets a user by ID. + GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) + // GetUserByUsername gets a user by username. + GetUserByUsername(context.Context, *GetUserByUsernameRequest) (*GetUserByUsernameResponse, error) + // ListUsers lists all users. + ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) + // ListOrganizationUsers lists all users for an organization. + // TODO: #663 move this to organization service + ListOrganizationUsers(context.Context, *ListOrganizationUsersRequest) (*ListOrganizationUsersResponse, error) + // DeleteUser deletes a user. + DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) + // Deactivate user deactivates a user. + DeactivateUser(context.Context, *DeactivateUserRequest) (*DeactivateUserResponse, error) + // UpdateUserServerRole update the role of an user in the server. + UpdateUserServerRole(context.Context, *UpdateUserServerRoleRequest) (*UpdateUserServerRoleResponse, error) + // CountUsers returns the number of users in the server by the user state provided. + CountUsers(context.Context, *CountUsersRequest) (*CountUsersResponse, error) + // UpdateUserSettings update the user settings including description. + UpdateUserSettings(context.Context, *UpdateUserSettingsRequest) (*UpdateUserSettingsResponse, error) + mustEmbedUnimplementedUserServiceServer() +} + +// UnimplementedUserServiceServer must be embedded to have forward compatible implementations. +type UnimplementedUserServiceServer struct { +} + +func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") +} +func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") +} +func (UnimplementedUserServiceServer) GetUserByUsername(context.Context, *GetUserByUsernameRequest) (*GetUserByUsernameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserByUsername not implemented") +} +func (UnimplementedUserServiceServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented") +} +func (UnimplementedUserServiceServer) ListOrganizationUsers(context.Context, *ListOrganizationUsersRequest) (*ListOrganizationUsersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListOrganizationUsers not implemented") +} +func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented") +} +func (UnimplementedUserServiceServer) DeactivateUser(context.Context, *DeactivateUserRequest) (*DeactivateUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeactivateUser not implemented") +} +func (UnimplementedUserServiceServer) UpdateUserServerRole(context.Context, *UpdateUserServerRoleRequest) (*UpdateUserServerRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUserServerRole not implemented") +} +func (UnimplementedUserServiceServer) CountUsers(context.Context, *CountUsersRequest) (*CountUsersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountUsers not implemented") +} +func (UnimplementedUserServiceServer) UpdateUserSettings(context.Context, *UpdateUserSettingsRequest) (*UpdateUserSettingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUserSettings not implemented") +} +func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} + +// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserServiceServer will +// result in compilation errors. +type UnsafeUserServiceServer interface { + mustEmbedUnimplementedUserServiceServer() +} + +func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { + s.RegisterService(&UserService_ServiceDesc, srv) +} + +func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).CreateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_CreateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_GetUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_GetUserByUsername_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserByUsernameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUserByUsername(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_GetUserByUsername_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUserByUsername(ctx, req.(*GetUserByUsernameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_ListUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).ListUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_ListUsers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).ListUsers(ctx, req.(*ListUsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_ListOrganizationUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListOrganizationUsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).ListOrganizationUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_ListOrganizationUsers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).ListOrganizationUsers(ctx, req.(*ListOrganizationUsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_DeleteUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeactivateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeactivateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeactivateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_DeactivateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeactivateUser(ctx, req.(*DeactivateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_UpdateUserServerRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserServerRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).UpdateUserServerRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_UpdateUserServerRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).UpdateUserServerRole(ctx, req.(*UpdateUserServerRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_CountUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountUsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).CountUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_CountUsers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).CountUsers(ctx, req.(*CountUsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_UpdateUserSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserSettingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).UpdateUserSettings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_UpdateUserSettings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).UpdateUserSettings(ctx, req.(*UpdateUserSettingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var UserService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.UserService", + HandlerType: (*UserServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateUser", + Handler: _UserService_CreateUser_Handler, + }, + { + MethodName: "GetUser", + Handler: _UserService_GetUser_Handler, + }, + { + MethodName: "GetUserByUsername", + Handler: _UserService_GetUserByUsername_Handler, + }, + { + MethodName: "ListUsers", + Handler: _UserService_ListUsers_Handler, + }, + { + MethodName: "ListOrganizationUsers", + Handler: _UserService_ListOrganizationUsers_Handler, + }, + { + MethodName: "DeleteUser", + Handler: _UserService_DeleteUser_Handler, + }, + { + MethodName: "DeactivateUser", + Handler: _UserService_DeactivateUser_Handler, + }, + { + MethodName: "UpdateUserServerRole", + Handler: _UserService_UpdateUserServerRole_Handler, + }, + { + MethodName: "CountUsers", + Handler: _UserService_CountUsers_Handler, + }, + { + MethodName: "UpdateUserSettings", + Handler: _UserService_UpdateUserSettings_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/user.proto", +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/verification_status.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/verification_status.pb.go new file mode 100644 index 000000000..4f69b8828 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/verification_status.pb.go @@ -0,0 +1,167 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/verification_status.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// VerificationStatus is the verification status of an owner on if we recognize them, +// an owner can be either user or organization. +type VerificationStatus int32 + +const ( + VerificationStatus_VERIFICATION_STATUS_UNSPECIFIED VerificationStatus = 0 + // OFFICIAL indicates that the owner is maintained by Buf. + VerificationStatus_VERIFICATION_STATUS_OFFICIAL VerificationStatus = 1 + // VERIFIED_PUBLISHER indicates that the owner is a third-party that has been + // verified by Buf. + VerificationStatus_VERIFICATION_STATUS_VERIFIED_PUBLISHER VerificationStatus = 2 +) + +// Enum value maps for VerificationStatus. +var ( + VerificationStatus_name = map[int32]string{ + 0: "VERIFICATION_STATUS_UNSPECIFIED", + 1: "VERIFICATION_STATUS_OFFICIAL", + 2: "VERIFICATION_STATUS_VERIFIED_PUBLISHER", + } + VerificationStatus_value = map[string]int32{ + "VERIFICATION_STATUS_UNSPECIFIED": 0, + "VERIFICATION_STATUS_OFFICIAL": 1, + "VERIFICATION_STATUS_VERIFIED_PUBLISHER": 2, + } +) + +func (x VerificationStatus) Enum() *VerificationStatus { + p := new(VerificationStatus) + *p = x + return p +} + +func (x VerificationStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VerificationStatus) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_verification_status_proto_enumTypes[0].Descriptor() +} + +func (VerificationStatus) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_verification_status_proto_enumTypes[0] +} + +func (x VerificationStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VerificationStatus.Descriptor instead. +func (VerificationStatus) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_verification_status_proto_rawDescGZIP(), []int{0} +} + +var File_registry_v1alpha1_verification_status_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_verification_status_proto_rawDesc = []byte{ + 0x0a, 0x2b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2a, 0x87, 0x01, 0x0a, 0x12, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x23, 0x0a, 0x1f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1c, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x43, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x4f, 0x46, 0x46, 0x49, + 0x43, 0x49, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x2a, 0x0a, 0x26, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, + 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, 0x45, + 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x52, + 0x10, 0x02, 0x42, 0xf2, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x42, 0x17, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, + 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, + 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, + 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, + 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, + 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_verification_status_proto_rawDescOnce sync.Once + file_registry_v1alpha1_verification_status_proto_rawDescData = file_registry_v1alpha1_verification_status_proto_rawDesc +) + +func file_registry_v1alpha1_verification_status_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_verification_status_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_verification_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_verification_status_proto_rawDescData) + }) + return file_registry_v1alpha1_verification_status_proto_rawDescData +} + +var file_registry_v1alpha1_verification_status_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_verification_status_proto_goTypes = []interface{}{ + (VerificationStatus)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.VerificationStatus +} +var file_registry_v1alpha1_verification_status_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_verification_status_proto_init() } +func file_registry_v1alpha1_verification_status_proto_init() { + if File_registry_v1alpha1_verification_status_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_verification_status_proto_rawDesc, + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_registry_v1alpha1_verification_status_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_verification_status_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_verification_status_proto_enumTypes, + }.Build() + File_registry_v1alpha1_verification_status_proto = out.File + file_registry_v1alpha1_verification_status_proto_rawDesc = nil + file_registry_v1alpha1_verification_status_proto_goTypes = nil + file_registry_v1alpha1_verification_status_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/webhook.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/webhook.pb.go new file mode 100644 index 000000000..235ed3019 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/webhook.pb.go @@ -0,0 +1,816 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: registry/v1alpha1/webhook.proto + +package registryv1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// WebhookEvent contains the currently supported webhook event types. +type WebhookEvent int32 + +const ( + // WEBHOOK_EVENT_UNSPECIFIED is a safe noop default for webhook events + // subscription. It will trigger an error if trying to register a webhook with + // this event. + WebhookEvent_WEBHOOK_EVENT_UNSPECIFIED WebhookEvent = 0 + // WEBHOOK_EVENT_REPOSITORY_PUSH is emitted whenever a successful buf push is + // completed for a specific repository. + WebhookEvent_WEBHOOK_EVENT_REPOSITORY_PUSH WebhookEvent = 1 +) + +// Enum value maps for WebhookEvent. +var ( + WebhookEvent_name = map[int32]string{ + 0: "WEBHOOK_EVENT_UNSPECIFIED", + 1: "WEBHOOK_EVENT_REPOSITORY_PUSH", + } + WebhookEvent_value = map[string]int32{ + "WEBHOOK_EVENT_UNSPECIFIED": 0, + "WEBHOOK_EVENT_REPOSITORY_PUSH": 1, + } +) + +func (x WebhookEvent) Enum() *WebhookEvent { + p := new(WebhookEvent) + *p = x + return p +} + +func (x WebhookEvent) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WebhookEvent) Descriptor() protoreflect.EnumDescriptor { + return file_registry_v1alpha1_webhook_proto_enumTypes[0].Descriptor() +} + +func (WebhookEvent) Type() protoreflect.EnumType { + return &file_registry_v1alpha1_webhook_proto_enumTypes[0] +} + +func (x WebhookEvent) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use WebhookEvent.Descriptor instead. +func (WebhookEvent) EnumDescriptor() ([]byte, []int) { + return file_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{0} +} + +// CreateWebhookRequest is the proto request representation of a +// webhook request body. +type CreateWebhookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The event to subscribe to for the given repository. + WebhookEvent WebhookEvent `protobuf:"varint,1,opt,name=webhook_event,json=webhookEvent,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent" json:"webhook_event,omitempty"` + // The owner name of the repository in the corresponding subscription request. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // The repository name that the subscriber wishes create a subscription for. + RepositoryName string `protobuf:"bytes,3,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The subscriber's callback URL where notifications should be delivered. + CallbackUrl string `protobuf:"bytes,4,opt,name=callback_url,json=callbackUrl,proto3" json:"callback_url,omitempty"` +} + +func (x *CreateWebhookRequest) Reset() { + *x = CreateWebhookRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateWebhookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWebhookRequest) ProtoMessage() {} + +func (x *CreateWebhookRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWebhookRequest.ProtoReflect.Descriptor instead. +func (*CreateWebhookRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateWebhookRequest) GetWebhookEvent() WebhookEvent { + if x != nil { + return x.WebhookEvent + } + return WebhookEvent_WEBHOOK_EVENT_UNSPECIFIED +} + +func (x *CreateWebhookRequest) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *CreateWebhookRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *CreateWebhookRequest) GetCallbackUrl() string { + if x != nil { + return x.CallbackUrl + } + return "" +} + +// CreateWebhookResponse is the proto response representation +// of a webhook request. +type CreateWebhookResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Created webhook subscription. + Webhook *Webhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"` +} + +func (x *CreateWebhookResponse) Reset() { + *x = CreateWebhookResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateWebhookResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWebhookResponse) ProtoMessage() {} + +func (x *CreateWebhookResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWebhookResponse.ProtoReflect.Descriptor instead. +func (*CreateWebhookResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateWebhookResponse) GetWebhook() *Webhook { + if x != nil { + return x.Webhook + } + return nil +} + +// DeleteWebhookRequest is the request for unsubscribing to a webhook. +type DeleteWebhookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The id of the webhook subscription to delete. + WebhookId string `protobuf:"bytes,1,opt,name=webhook_id,json=webhookId,proto3" json:"webhook_id,omitempty"` +} + +func (x *DeleteWebhookRequest) Reset() { + *x = DeleteWebhookRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteWebhookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteWebhookRequest) ProtoMessage() {} + +func (x *DeleteWebhookRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteWebhookRequest.ProtoReflect.Descriptor instead. +func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{2} +} + +func (x *DeleteWebhookRequest) GetWebhookId() string { + if x != nil { + return x.WebhookId + } + return "" +} + +// DeleteWebhookResponse is the response for unsubscribing +// from a webhook. +type DeleteWebhookResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteWebhookResponse) Reset() { + *x = DeleteWebhookResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteWebhookResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteWebhookResponse) ProtoMessage() {} + +func (x *DeleteWebhookResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteWebhookResponse.ProtoReflect.Descriptor instead. +func (*DeleteWebhookResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{3} +} + +// ListWebhooksRequest is the request to get the +// list of subscribed webhooks for a given repository. +type ListWebhooksRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The repository name given in the corresponding subscription request. + RepositoryName string `protobuf:"bytes,1,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The owner associated with the repository. + OwnerName string `protobuf:"bytes,2,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // The page token for paginating. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` +} + +func (x *ListWebhooksRequest) Reset() { + *x = ListWebhooksRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListWebhooksRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListWebhooksRequest) ProtoMessage() {} + +func (x *ListWebhooksRequest) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListWebhooksRequest.ProtoReflect.Descriptor instead. +func (*ListWebhooksRequest) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{4} +} + +func (x *ListWebhooksRequest) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *ListWebhooksRequest) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *ListWebhooksRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +// ListWebhooksResponse is the response for the list of +// subscribed webhooks for a given repository. +type ListWebhooksResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of subscribed webhooks for a given repository. + Webhooks []*Webhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` + // The next page token for paginating. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListWebhooksResponse) Reset() { + *x = ListWebhooksResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListWebhooksResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListWebhooksResponse) ProtoMessage() {} + +func (x *ListWebhooksResponse) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListWebhooksResponse.ProtoReflect.Descriptor instead. +func (*ListWebhooksResponse) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{5} +} + +func (x *ListWebhooksResponse) GetWebhooks() []*Webhook { + if x != nil { + return x.Webhooks + } + return nil +} + +func (x *ListWebhooksResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Webhook is the representation of a webhook repository event subscription. +type Webhook struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The event associated with the subscription id. + Event WebhookEvent `protobuf:"varint,1,opt,name=event,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent" json:"event,omitempty"` + // The id of the associated subscription. + WebhookId string `protobuf:"bytes,2,opt,name=webhook_id,json=webhookId,proto3" json:"webhook_id,omitempty"` + // The webhook creation timestamp. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // The webhook last updated timestamp. + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + // The webhook repository name. + RepositoryName string `protobuf:"bytes,5,opt,name=repository_name,json=repositoryName,proto3" json:"repository_name,omitempty"` + // The webhook repository owner name. + OwnerName string `protobuf:"bytes,6,opt,name=owner_name,json=ownerName,proto3" json:"owner_name,omitempty"` + // The subscriber's callback URL where notifications are delivered. Currently + // we only support Connect-powered backends with application/proto as the + // content type. Make sure that your URL ends with + // "/bufman.dubbo.apache.org.webhook.v1alpha1.EventService/Event". For more information + // about Connect, see https://connect.build. + CallbackUrl string `protobuf:"bytes,7,opt,name=callback_url,json=callbackUrl,proto3" json:"callback_url,omitempty"` +} + +func (x *Webhook) Reset() { + *x = Webhook{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Webhook) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Webhook) ProtoMessage() {} + +func (x *Webhook) ProtoReflect() protoreflect.Message { + mi := &file_registry_v1alpha1_webhook_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Webhook.ProtoReflect.Descriptor instead. +func (*Webhook) Descriptor() ([]byte, []int) { + return file_registry_v1alpha1_webhook_proto_rawDescGZIP(), []int{6} +} + +func (x *Webhook) GetEvent() WebhookEvent { + if x != nil { + return x.Event + } + return WebhookEvent_WEBHOOK_EVENT_UNSPECIFIED +} + +func (x *Webhook) GetWebhookId() string { + if x != nil { + return x.WebhookId + } + return "" +} + +func (x *Webhook) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *Webhook) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +func (x *Webhook) GetRepositoryName() string { + if x != nil { + return x.RepositoryName + } + return "" +} + +func (x *Webhook) GetOwnerName() string { + if x != nil { + return x.OwnerName + } + return "" +} + +func (x *Webhook) GetCallbackUrl() string { + if x != nil { + return x.CallbackUrl + } + return "" +} + +var File_registry_v1alpha1_webhook_proto protoreflect.FileDescriptor + +var file_registry_v1alpha1_webhook_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x29, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdf, 0x01, + 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x5c, 0x0a, 0x0d, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, + 0x6b, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x37, 0x2e, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, + 0x6b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x0c, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, + 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x55, 0x72, 0x6c, 0x22, + 0x65, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x07, 0x77, 0x65, 0x62, 0x68, + 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x52, 0x07, 0x77, + 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x22, 0x35, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x49, 0x64, 0x22, 0x17, 0x0a, + 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7c, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x65, + 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, + 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, + 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x8e, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x65, 0x62, + 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, + 0x08, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x32, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x68, + 0x6f, 0x6f, 0x6b, 0x52, 0x08, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x26, 0x0a, + 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xdc, 0x02, 0x0a, 0x07, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, + 0x6b, 0x12, 0x4d, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x62, + 0x68, 0x6f, 0x6f, 0x6b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x49, 0x64, 0x12, + 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x75, 0x72, + 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, + 0x6b, 0x55, 0x72, 0x6c, 0x2a, 0x50, 0x0a, 0x0c, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x45, 0x42, 0x48, 0x4f, 0x4f, 0x4b, 0x5f, + 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x21, 0x0a, 0x1d, 0x57, 0x45, 0x42, 0x48, 0x4f, 0x4f, 0x4b, 0x5f, 0x45, + 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x4f, 0x52, 0x59, 0x5f, + 0x50, 0x55, 0x53, 0x48, 0x10, 0x01, 0x32, 0xdb, 0x03, 0x0a, 0x0e, 0x57, 0x65, 0x62, 0x68, 0x6f, + 0x6f, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x97, 0x01, 0x0a, 0x0d, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x3f, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x65, + 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 0x2e, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, + 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, + 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, + 0x90, 0x02, 0x02, 0x12, 0x97, 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x65, + 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x3f, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, + 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, + 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x02, 0x12, 0x94, 0x01, + 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x3e, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, + 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3f, + 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, + 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, + 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x03, 0x90, 0x02, 0x01, 0x42, 0xe7, 0x02, 0x0a, 0x2d, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0c, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, + 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, + 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x52, 0xaa, 0x02, 0x29, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x29, 0x42, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, + 0x4f, 0x72, 0x67, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x35, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x2e, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x3a, 0x3a, 0x41, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_registry_v1alpha1_webhook_proto_rawDescOnce sync.Once + file_registry_v1alpha1_webhook_proto_rawDescData = file_registry_v1alpha1_webhook_proto_rawDesc +) + +func file_registry_v1alpha1_webhook_proto_rawDescGZIP() []byte { + file_registry_v1alpha1_webhook_proto_rawDescOnce.Do(func() { + file_registry_v1alpha1_webhook_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_v1alpha1_webhook_proto_rawDescData) + }) + return file_registry_v1alpha1_webhook_proto_rawDescData +} + +var file_registry_v1alpha1_webhook_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_registry_v1alpha1_webhook_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_registry_v1alpha1_webhook_proto_goTypes = []interface{}{ + (WebhookEvent)(0), // 0: bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent + (*CreateWebhookRequest)(nil), // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateWebhookRequest + (*CreateWebhookResponse)(nil), // 2: bufman.dubbo.apache.org.registry.v1alpha1.CreateWebhookResponse + (*DeleteWebhookRequest)(nil), // 3: bufman.dubbo.apache.org.registry.v1alpha1.DeleteWebhookRequest + (*DeleteWebhookResponse)(nil), // 4: bufman.dubbo.apache.org.registry.v1alpha1.DeleteWebhookResponse + (*ListWebhooksRequest)(nil), // 5: bufman.dubbo.apache.org.registry.v1alpha1.ListWebhooksRequest + (*ListWebhooksResponse)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.ListWebhooksResponse + (*Webhook)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.Webhook + (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp +} +var file_registry_v1alpha1_webhook_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.registry.v1alpha1.CreateWebhookRequest.webhook_event:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent + 7, // 1: bufman.dubbo.apache.org.registry.v1alpha1.CreateWebhookResponse.webhook:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Webhook + 7, // 2: bufman.dubbo.apache.org.registry.v1alpha1.ListWebhooksResponse.webhooks:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Webhook + 0, // 3: bufman.dubbo.apache.org.registry.v1alpha1.Webhook.event:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent + 8, // 4: bufman.dubbo.apache.org.registry.v1alpha1.Webhook.create_time:type_name -> google.protobuf.Timestamp + 8, // 5: bufman.dubbo.apache.org.registry.v1alpha1.Webhook.update_time:type_name -> google.protobuf.Timestamp + 1, // 6: bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.CreateWebhook:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateWebhookRequest + 3, // 7: bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.DeleteWebhook:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteWebhookRequest + 5, // 8: bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.ListWebhooks:input_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListWebhooksRequest + 2, // 9: bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.CreateWebhook:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.CreateWebhookResponse + 4, // 10: bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.DeleteWebhook:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.DeleteWebhookResponse + 6, // 11: bufman.dubbo.apache.org.registry.v1alpha1.WebhookService.ListWebhooks:output_type -> bufman.dubbo.apache.org.registry.v1alpha1.ListWebhooksResponse + 9, // [9:12] is the sub-list for method output_type + 6, // [6:9] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_registry_v1alpha1_webhook_proto_init() } +func file_registry_v1alpha1_webhook_proto_init() { + if File_registry_v1alpha1_webhook_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_v1alpha1_webhook_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateWebhookRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_webhook_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateWebhookResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_webhook_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteWebhookRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_webhook_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteWebhookResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_webhook_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListWebhooksRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_webhook_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListWebhooksResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_v1alpha1_webhook_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Webhook); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_v1alpha1_webhook_proto_rawDesc, + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_registry_v1alpha1_webhook_proto_goTypes, + DependencyIndexes: file_registry_v1alpha1_webhook_proto_depIdxs, + EnumInfos: file_registry_v1alpha1_webhook_proto_enumTypes, + MessageInfos: file_registry_v1alpha1_webhook_proto_msgTypes, + }.Build() + File_registry_v1alpha1_webhook_proto = out.File + file_registry_v1alpha1_webhook_proto_rawDesc = nil + file_registry_v1alpha1_webhook_proto_goTypes = nil + file_registry_v1alpha1_webhook_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/registry/v1alpha1/webhook_grpc.pb.go b/pkg/bufman/gen/proto/go/registry/v1alpha1/webhook_grpc.pb.go new file mode 100644 index 000000000..76bff9cd8 --- /dev/null +++ b/pkg/bufman/gen/proto/go/registry/v1alpha1/webhook_grpc.pb.go @@ -0,0 +1,191 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: registry/v1alpha1/webhook.proto + +package registryv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + WebhookService_CreateWebhook_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/CreateWebhook" + WebhookService_DeleteWebhook_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/DeleteWebhook" + WebhookService_ListWebhooks_FullMethodName = "/bufman.dubbo.apache.org.registry.v1alpha1.WebhookService/ListWebhooks" +) + +// WebhookServiceClient is the client API for WebhookService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WebhookServiceClient interface { + // Create a webhook, subscribes to a given repository event for a callback URL + // invocation. + CreateWebhook(ctx context.Context, in *CreateWebhookRequest, opts ...grpc.CallOption) (*CreateWebhookResponse, error) + // Delete a webhook removes the event subscription. + DeleteWebhook(ctx context.Context, in *DeleteWebhookRequest, opts ...grpc.CallOption) (*DeleteWebhookResponse, error) + // Lists the webhooks subscriptions for a given repository. + ListWebhooks(ctx context.Context, in *ListWebhooksRequest, opts ...grpc.CallOption) (*ListWebhooksResponse, error) +} + +type webhookServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWebhookServiceClient(cc grpc.ClientConnInterface) WebhookServiceClient { + return &webhookServiceClient{cc} +} + +func (c *webhookServiceClient) CreateWebhook(ctx context.Context, in *CreateWebhookRequest, opts ...grpc.CallOption) (*CreateWebhookResponse, error) { + out := new(CreateWebhookResponse) + err := c.cc.Invoke(ctx, WebhookService_CreateWebhook_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *webhookServiceClient) DeleteWebhook(ctx context.Context, in *DeleteWebhookRequest, opts ...grpc.CallOption) (*DeleteWebhookResponse, error) { + out := new(DeleteWebhookResponse) + err := c.cc.Invoke(ctx, WebhookService_DeleteWebhook_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *webhookServiceClient) ListWebhooks(ctx context.Context, in *ListWebhooksRequest, opts ...grpc.CallOption) (*ListWebhooksResponse, error) { + out := new(ListWebhooksResponse) + err := c.cc.Invoke(ctx, WebhookService_ListWebhooks_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WebhookServiceServer is the server API for WebhookService service. +// All implementations must embed UnimplementedWebhookServiceServer +// for forward compatibility +type WebhookServiceServer interface { + // Create a webhook, subscribes to a given repository event for a callback URL + // invocation. + CreateWebhook(context.Context, *CreateWebhookRequest) (*CreateWebhookResponse, error) + // Delete a webhook removes the event subscription. + DeleteWebhook(context.Context, *DeleteWebhookRequest) (*DeleteWebhookResponse, error) + // Lists the webhooks subscriptions for a given repository. + ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error) + mustEmbedUnimplementedWebhookServiceServer() +} + +// UnimplementedWebhookServiceServer must be embedded to have forward compatible implementations. +type UnimplementedWebhookServiceServer struct { +} + +func (UnimplementedWebhookServiceServer) CreateWebhook(context.Context, *CreateWebhookRequest) (*CreateWebhookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateWebhook not implemented") +} +func (UnimplementedWebhookServiceServer) DeleteWebhook(context.Context, *DeleteWebhookRequest) (*DeleteWebhookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteWebhook not implemented") +} +func (UnimplementedWebhookServiceServer) ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListWebhooks not implemented") +} +func (UnimplementedWebhookServiceServer) mustEmbedUnimplementedWebhookServiceServer() {} + +// UnsafeWebhookServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WebhookServiceServer will +// result in compilation errors. +type UnsafeWebhookServiceServer interface { + mustEmbedUnimplementedWebhookServiceServer() +} + +func RegisterWebhookServiceServer(s grpc.ServiceRegistrar, srv WebhookServiceServer) { + s.RegisterService(&WebhookService_ServiceDesc, srv) +} + +func _WebhookService_CreateWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateWebhookRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WebhookServiceServer).CreateWebhook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WebhookService_CreateWebhook_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WebhookServiceServer).CreateWebhook(ctx, req.(*CreateWebhookRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WebhookService_DeleteWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteWebhookRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WebhookServiceServer).DeleteWebhook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WebhookService_DeleteWebhook_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WebhookServiceServer).DeleteWebhook(ctx, req.(*DeleteWebhookRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WebhookService_ListWebhooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListWebhooksRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WebhookServiceServer).ListWebhooks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WebhookService_ListWebhooks_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WebhookServiceServer).ListWebhooks(ctx, req.(*ListWebhooksRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WebhookService_ServiceDesc is the grpc.ServiceDesc for WebhookService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WebhookService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.registry.v1alpha1.WebhookService", + HandlerType: (*WebhookServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateWebhook", + Handler: _WebhookService_CreateWebhook_Handler, + }, + { + MethodName: "DeleteWebhook", + Handler: _WebhookService_DeleteWebhook_Handler, + }, + { + MethodName: "ListWebhooks", + Handler: _WebhookService_ListWebhooks_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "registry/v1alpha1/webhook.proto", +} diff --git a/pkg/bufman/gen/proto/go/studio/v1alpha1/invoke.pb.go b/pkg/bufman/gen/proto/go/studio/v1alpha1/invoke.pb.go new file mode 100644 index 000000000..e9a194dd8 --- /dev/null +++ b/pkg/bufman/gen/proto/go/studio/v1alpha1/invoke.pb.go @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: studio/v1alpha1/invoke.proto + +// The bufman.dubbo.apache.org.studio.v1alpha1 package contains types used by the buf studio +// agent. Because browsers are not capable of sending gRPC requests directly, +// users can run a studio agent to that receives enveloped requests from the +// browser and forwards them as gRPC requests. +// +// Ideally the agent would be simple protocol translating HTTP proxy without +// requiring any custom envelope. Unfortunately, js in the browser cannot set +// per request proxy configuration and we cannot specify that we want to open a +// connection to the request agent while specifying a different server in the +// request's Host header. The studio agent and UI could communicate this through +// a custom header instead, but reading custom headers requires a CORS-preflight +// request. +// +// To facilitate easier deployment it in environments with complicated edge +// configuration, it is a goal for the agent and UI to communicate without the +// need for a CORS-preflight requests. This limits our ability to use custom +// headers and restricts allowed values for the Content-Type header. Due to this +// we cannot simply use gRPC-Web with an additional header, but instead rely on +// enveloping the request and responses in a base64 encoded binary proto message +// sent over a POST endpoint with text/plain as Content-Type. +// +// We may explore other transports such as WebSockets or WebTransport, at which +// point we should define proper proto services and methods here as well. + +package studiov1alpha1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Headers encode HTTP headers. +type Headers struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []string `protobuf:"bytes,2,rep,name=value,proto3" json:"value,omitempty"` +} + +func (x *Headers) Reset() { + *x = Headers{} + if protoimpl.UnsafeEnabled { + mi := &file_studio_v1alpha1_invoke_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Headers) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Headers) ProtoMessage() {} + +func (x *Headers) ProtoReflect() protoreflect.Message { + mi := &file_studio_v1alpha1_invoke_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Headers.ProtoReflect.Descriptor instead. +func (*Headers) Descriptor() ([]byte, []int) { + return file_studio_v1alpha1_invoke_proto_rawDescGZIP(), []int{0} +} + +func (x *Headers) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Headers) GetValue() []string { + if x != nil { + return x.Value + } + return nil +} + +// InvokeRequest encodes an enveloped RPC request. See the package documentation +// for more information. +type InvokeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Target server the agent should forward this request to, e.g. + // "https://api.acme.corp/pkg.Service/Method". Using the "http" scheme will + // cause the request to be forwarded as h2c, whereas "https" forwards the + // request with regular h2. + Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + // Headers to send with the request. If body is set, a Content-Type header + // must be specified. + Headers []*Headers `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty"` + // The message to be sent in the request (without any protocol specific framing). + Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` +} + +func (x *InvokeRequest) Reset() { + *x = InvokeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_studio_v1alpha1_invoke_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InvokeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InvokeRequest) ProtoMessage() {} + +func (x *InvokeRequest) ProtoReflect() protoreflect.Message { + mi := &file_studio_v1alpha1_invoke_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InvokeRequest.ProtoReflect.Descriptor instead. +func (*InvokeRequest) Descriptor() ([]byte, []int) { + return file_studio_v1alpha1_invoke_proto_rawDescGZIP(), []int{1} +} + +func (x *InvokeRequest) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +func (x *InvokeRequest) GetHeaders() []*Headers { + if x != nil { + return x.Headers + } + return nil +} + +func (x *InvokeRequest) GetBody() []byte { + if x != nil { + return x.Body + } + return nil +} + +// InvokeResponse encodes an enveloped RPC response. See the package documentation +// for more information. +type InvokeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Headers received in the response. + Headers []*Headers `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` + // The encoded message received in the response (without protocol specific framing). + Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + // Trailers received in the response. + Trailers []*Headers `protobuf:"bytes,3,rep,name=trailers,proto3" json:"trailers,omitempty"` +} + +func (x *InvokeResponse) Reset() { + *x = InvokeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_studio_v1alpha1_invoke_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InvokeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InvokeResponse) ProtoMessage() {} + +func (x *InvokeResponse) ProtoReflect() protoreflect.Message { + mi := &file_studio_v1alpha1_invoke_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InvokeResponse.ProtoReflect.Descriptor instead. +func (*InvokeResponse) Descriptor() ([]byte, []int) { + return file_studio_v1alpha1_invoke_proto_rawDescGZIP(), []int{2} +} + +func (x *InvokeResponse) GetHeaders() []*Headers { + if x != nil { + return x.Headers + } + return nil +} + +func (x *InvokeResponse) GetBody() []byte { + if x != nil { + return x.Body + } + return nil +} + +func (x *InvokeResponse) GetTrailers() []*Headers { + if x != nil { + return x.Trailers + } + return nil +} + +var File_studio_v1alpha1_invoke_proto protoreflect.FileDescriptor + +var file_studio_v1alpha1_invoke_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2f, 0x69, 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, 0x31, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0d, 0x49, + 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x12, 0x4a, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x22, 0xbe, 0x01, 0x0a, 0x0e, 0x49, 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x4c, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x69, 0x6c, + 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x08, 0x74, 0x72, 0x61, + 0x69, 0x6c, 0x65, 0x72, 0x73, 0x42, 0xd8, 0x02, 0x0a, 0x2b, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x49, 0x6e, 0x76, 0x6f, 0x6b, 0x65, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x59, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, + 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x2f, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x3b, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, + 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x53, 0xaa, 0x02, 0x27, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, + 0x67, 0x2e, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0xca, 0x02, 0x27, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, + 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x53, 0x74, 0x75, 0x64, + 0x69, 0x6f, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x33, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x5c, 0x56, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x2c, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, + 0x53, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_studio_v1alpha1_invoke_proto_rawDescOnce sync.Once + file_studio_v1alpha1_invoke_proto_rawDescData = file_studio_v1alpha1_invoke_proto_rawDesc +) + +func file_studio_v1alpha1_invoke_proto_rawDescGZIP() []byte { + file_studio_v1alpha1_invoke_proto_rawDescOnce.Do(func() { + file_studio_v1alpha1_invoke_proto_rawDescData = protoimpl.X.CompressGZIP(file_studio_v1alpha1_invoke_proto_rawDescData) + }) + return file_studio_v1alpha1_invoke_proto_rawDescData +} + +var file_studio_v1alpha1_invoke_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_studio_v1alpha1_invoke_proto_goTypes = []interface{}{ + (*Headers)(nil), // 0: bufman.dubbo.apache.org.studio.v1alpha1.Headers + (*InvokeRequest)(nil), // 1: bufman.dubbo.apache.org.studio.v1alpha1.InvokeRequest + (*InvokeResponse)(nil), // 2: bufman.dubbo.apache.org.studio.v1alpha1.InvokeResponse +} +var file_studio_v1alpha1_invoke_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.studio.v1alpha1.InvokeRequest.headers:type_name -> bufman.dubbo.apache.org.studio.v1alpha1.Headers + 0, // 1: bufman.dubbo.apache.org.studio.v1alpha1.InvokeResponse.headers:type_name -> bufman.dubbo.apache.org.studio.v1alpha1.Headers + 0, // 2: bufman.dubbo.apache.org.studio.v1alpha1.InvokeResponse.trailers:type_name -> bufman.dubbo.apache.org.studio.v1alpha1.Headers + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_studio_v1alpha1_invoke_proto_init() } +func file_studio_v1alpha1_invoke_proto_init() { + if File_studio_v1alpha1_invoke_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_studio_v1alpha1_invoke_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Headers); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_studio_v1alpha1_invoke_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InvokeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_studio_v1alpha1_invoke_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InvokeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_studio_v1alpha1_invoke_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_studio_v1alpha1_invoke_proto_goTypes, + DependencyIndexes: file_studio_v1alpha1_invoke_proto_depIdxs, + MessageInfos: file_studio_v1alpha1_invoke_proto_msgTypes, + }.Build() + File_studio_v1alpha1_invoke_proto = out.File + file_studio_v1alpha1_invoke_proto_rawDesc = nil + file_studio_v1alpha1_invoke_proto_goTypes = nil + file_studio_v1alpha1_invoke_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/wasmplugin/v1/wasmplugin.pb.go b/pkg/bufman/gen/proto/go/wasmplugin/v1/wasmplugin.pb.go new file mode 100644 index 000000000..f6f012ca6 --- /dev/null +++ b/pkg/bufman/gen/proto/go/wasmplugin/v1/wasmplugin.pb.go @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: wasmplugin/v1/wasmplugin.proto + +package wasmpluginv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// WASM_ABI specifies the abi this module expects buf to provide. +type WasmABI int32 + +const ( + WasmABI_WASM_ABI_UNSPECIFIED WasmABI = 0 + // Plugins compiled against + // https://github.com/WebAssembly/WASI/releases/tag/snapshot-01. + WasmABI_WASM_ABI_WASI_SNAPSHOT_PREVIEW1 WasmABI = 1 + // Plugins compiled with `GOOS=js` and `GOARCH=wasm`. + WasmABI_WASM_ABI_GOJS WasmABI = 2 +) + +// Enum value maps for WasmABI. +var ( + WasmABI_name = map[int32]string{ + 0: "WASM_ABI_UNSPECIFIED", + 1: "WASM_ABI_WASI_SNAPSHOT_PREVIEW1", + 2: "WASM_ABI_GOJS", + } + WasmABI_value = map[string]int32{ + "WASM_ABI_UNSPECIFIED": 0, + "WASM_ABI_WASI_SNAPSHOT_PREVIEW1": 1, + "WASM_ABI_GOJS": 2, + } +) + +func (x WasmABI) Enum() *WasmABI { + p := new(WasmABI) + *p = x + return p +} + +func (x WasmABI) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WasmABI) Descriptor() protoreflect.EnumDescriptor { + return file_wasmplugin_v1_wasmplugin_proto_enumTypes[0].Descriptor() +} + +func (WasmABI) Type() protoreflect.EnumType { + return &file_wasmplugin_v1_wasmplugin_proto_enumTypes[0] +} + +func (x WasmABI) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use WasmABI.Descriptor instead. +func (WasmABI) EnumDescriptor() ([]byte, []int) { + return file_wasmplugin_v1_wasmplugin_proto_rawDescGZIP(), []int{0} +} + +// ExecConfig describes buf specific extensions for a wasm plugin. A ExecConfig may +// be encoded in a custom WASM section named ".bufplugin", see +// (https://webassembly.github.io/spec/core/binary/modules.html#binary-customsec) +// for more info. +type ExecConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // When no ABI is provided, buf will make a best effort guess based on + // the functions the wasm module exports. + WasmAbi WasmABI `protobuf:"varint,1,opt,name=wasm_abi,json=wasmAbi,proto3,enum=bufman.dubbo.apache.org.wasmplugin.v1.WasmABI" json:"wasm_abi,omitempty"` + // The arguments that should be passed when running this plugin. Useful + // for interpreted languages where the main wasm bundle is only the + // interpreter. + Args []string `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"` + // Files that should be made available to the WASI fs when running this + // plugin. Useful for interpreted languages where the main wasm bundle + // is only the interpreter. + Files []*File `protobuf:"bytes,3,rep,name=files,proto3" json:"files,omitempty"` +} + +func (x *ExecConfig) Reset() { + *x = ExecConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_wasmplugin_v1_wasmplugin_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecConfig) ProtoMessage() {} + +func (x *ExecConfig) ProtoReflect() protoreflect.Message { + mi := &file_wasmplugin_v1_wasmplugin_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecConfig.ProtoReflect.Descriptor instead. +func (*ExecConfig) Descriptor() ([]byte, []int) { + return file_wasmplugin_v1_wasmplugin_proto_rawDescGZIP(), []int{0} +} + +func (x *ExecConfig) GetWasmAbi() WasmABI { + if x != nil { + return x.WasmAbi + } + return WasmABI_WASM_ABI_UNSPECIFIED +} + +func (x *ExecConfig) GetArgs() []string { + if x != nil { + return x.Args + } + return nil +} + +func (x *ExecConfig) GetFiles() []*File { + if x != nil { + return x.Files + } + return nil +} + +// File represents a file that must be made available to the wasi plugin. +type File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Normalized path with `/` as directory separator. + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3" json:"contents,omitempty"` +} + +func (x *File) Reset() { + *x = File{} + if protoimpl.UnsafeEnabled { + mi := &file_wasmplugin_v1_wasmplugin_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *File) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*File) ProtoMessage() {} + +func (x *File) ProtoReflect() protoreflect.Message { + mi := &file_wasmplugin_v1_wasmplugin_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use File.ProtoReflect.Descriptor instead. +func (*File) Descriptor() ([]byte, []int) { + return file_wasmplugin_v1_wasmplugin_proto_rawDescGZIP(), []int{1} +} + +func (x *File) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *File) GetContents() []byte { + if x != nil { + return x.Contents + } + return nil +} + +var File_wasmplugin_v1_wasmplugin_proto protoreflect.FileDescriptor + +var file_wasmplugin_v1_wasmplugin_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x77, 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x2f, + 0x77, 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x25, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, + 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x61, 0x73, 0x6d, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x22, 0xae, 0x01, 0x0a, 0x0a, 0x45, 0x78, 0x65, 0x63, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x08, 0x77, 0x61, 0x73, 0x6d, 0x5f, 0x61, + 0x62, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x77, 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x57, 0x61, 0x73, 0x6d, 0x41, 0x42, 0x49, 0x52, 0x07, 0x77, 0x61, 0x73, 0x6d, 0x41, 0x62, + 0x69, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, + 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x77, + 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x36, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x70, 0x61, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, + 0x2a, 0x5b, 0x0a, 0x07, 0x57, 0x61, 0x73, 0x6d, 0x41, 0x42, 0x49, 0x12, 0x18, 0x0a, 0x14, 0x57, + 0x41, 0x53, 0x4d, 0x5f, 0x41, 0x42, 0x49, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x57, 0x41, 0x53, 0x4d, 0x5f, 0x41, 0x42, + 0x49, 0x5f, 0x57, 0x41, 0x53, 0x49, 0x5f, 0x53, 0x4e, 0x41, 0x50, 0x53, 0x48, 0x4f, 0x54, 0x5f, + 0x50, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x31, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x57, 0x41, + 0x53, 0x4d, 0x5f, 0x41, 0x42, 0x49, 0x5f, 0x47, 0x4f, 0x4a, 0x53, 0x10, 0x02, 0x42, 0xce, 0x02, + 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x61, + 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0f, 0x57, 0x61, 0x73, + 0x6d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x55, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, + 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, 0x67, 0x65, + 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x61, 0x73, 0x6d, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x77, 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x05, 0x42, 0x44, 0x41, 0x4f, 0x57, 0xaa, 0x02, 0x25, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, 0x57, 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x25, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, + 0x57, 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x31, + 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x57, 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x2a, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, 0x62, + 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, 0x3a, + 0x57, 0x61, 0x73, 0x6d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_wasmplugin_v1_wasmplugin_proto_rawDescOnce sync.Once + file_wasmplugin_v1_wasmplugin_proto_rawDescData = file_wasmplugin_v1_wasmplugin_proto_rawDesc +) + +func file_wasmplugin_v1_wasmplugin_proto_rawDescGZIP() []byte { + file_wasmplugin_v1_wasmplugin_proto_rawDescOnce.Do(func() { + file_wasmplugin_v1_wasmplugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_wasmplugin_v1_wasmplugin_proto_rawDescData) + }) + return file_wasmplugin_v1_wasmplugin_proto_rawDescData +} + +var file_wasmplugin_v1_wasmplugin_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_wasmplugin_v1_wasmplugin_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_wasmplugin_v1_wasmplugin_proto_goTypes = []interface{}{ + (WasmABI)(0), // 0: bufman.dubbo.apache.org.wasmplugin.v1.WasmABI + (*ExecConfig)(nil), // 1: bufman.dubbo.apache.org.wasmplugin.v1.ExecConfig + (*File)(nil), // 2: bufman.dubbo.apache.org.wasmplugin.v1.File +} +var file_wasmplugin_v1_wasmplugin_proto_depIdxs = []int32{ + 0, // 0: bufman.dubbo.apache.org.wasmplugin.v1.ExecConfig.wasm_abi:type_name -> bufman.dubbo.apache.org.wasmplugin.v1.WasmABI + 2, // 1: bufman.dubbo.apache.org.wasmplugin.v1.ExecConfig.files:type_name -> bufman.dubbo.apache.org.wasmplugin.v1.File + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_wasmplugin_v1_wasmplugin_proto_init() } +func file_wasmplugin_v1_wasmplugin_proto_init() { + if File_wasmplugin_v1_wasmplugin_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_wasmplugin_v1_wasmplugin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wasmplugin_v1_wasmplugin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*File); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_wasmplugin_v1_wasmplugin_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_wasmplugin_v1_wasmplugin_proto_goTypes, + DependencyIndexes: file_wasmplugin_v1_wasmplugin_proto_depIdxs, + EnumInfos: file_wasmplugin_v1_wasmplugin_proto_enumTypes, + MessageInfos: file_wasmplugin_v1_wasmplugin_proto_msgTypes, + }.Build() + File_wasmplugin_v1_wasmplugin_proto = out.File + file_wasmplugin_v1_wasmplugin_proto_rawDesc = nil + file_wasmplugin_v1_wasmplugin_proto_goTypes = nil + file_wasmplugin_v1_wasmplugin_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/webhook/v1alpha1/event.pb.go b/pkg/bufman/gen/proto/go/webhook/v1alpha1/event.pb.go new file mode 100644 index 000000000..c32ad342f --- /dev/null +++ b/pkg/bufman/gen/proto/go/webhook/v1alpha1/event.pb.go @@ -0,0 +1,463 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: webhook/v1alpha1/event.proto + +package webhookv1alpha1 + +import ( + v1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// EventRequest is the request payload that will be sent to the customer +// that is subscribed to webhook events in the BSR. +type EventRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The webhook event that was triggered. This event is the same one that is + // registered when creating a webhook in the BSR. + Event v1alpha1.WebhookEvent `protobuf:"varint,1,opt,name=event,proto3,enum=bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent" json:"event,omitempty"` + // The event payload of the event was triggered. + Payload *EventPayload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *EventRequest) Reset() { + *x = EventRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_webhook_v1alpha1_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventRequest) ProtoMessage() {} + +func (x *EventRequest) ProtoReflect() protoreflect.Message { + mi := &file_webhook_v1alpha1_event_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EventRequest.ProtoReflect.Descriptor instead. +func (*EventRequest) Descriptor() ([]byte, []int) { + return file_webhook_v1alpha1_event_proto_rawDescGZIP(), []int{0} +} + +func (x *EventRequest) GetEvent() v1alpha1.WebhookEvent { + if x != nil { + return x.Event + } + return v1alpha1.WebhookEvent(0) +} + +func (x *EventRequest) GetPayload() *EventPayload { + if x != nil { + return x.Payload + } + return nil +} + +// EventPayload contains the actual event payload for all possible +// webhook event types. +type EventPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Payload: + // + // *EventPayload_RepositoryPush + Payload isEventPayload_Payload `protobuf_oneof:"payload"` +} + +func (x *EventPayload) Reset() { + *x = EventPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_webhook_v1alpha1_event_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventPayload) ProtoMessage() {} + +func (x *EventPayload) ProtoReflect() protoreflect.Message { + mi := &file_webhook_v1alpha1_event_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EventPayload.ProtoReflect.Descriptor instead. +func (*EventPayload) Descriptor() ([]byte, []int) { + return file_webhook_v1alpha1_event_proto_rawDescGZIP(), []int{1} +} + +func (m *EventPayload) GetPayload() isEventPayload_Payload { + if m != nil { + return m.Payload + } + return nil +} + +func (x *EventPayload) GetRepositoryPush() *RepositoryPushEvent { + if x, ok := x.GetPayload().(*EventPayload_RepositoryPush); ok { + return x.RepositoryPush + } + return nil +} + +type isEventPayload_Payload interface { + isEventPayload_Payload() +} + +type EventPayload_RepositoryPush struct { + RepositoryPush *RepositoryPushEvent `protobuf:"bytes,1,opt,name=repository_push,json=repositoryPush,proto3,oneof"` +} + +func (*EventPayload_RepositoryPush) isEventPayload_Payload() {} + +// EventResponse is the empty response payload from the customer to Buf. +type EventResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *EventResponse) Reset() { + *x = EventResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_webhook_v1alpha1_event_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventResponse) ProtoMessage() {} + +func (x *EventResponse) ProtoReflect() protoreflect.Message { + mi := &file_webhook_v1alpha1_event_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EventResponse.ProtoReflect.Descriptor instead. +func (*EventResponse) Descriptor() ([]byte, []int) { + return file_webhook_v1alpha1_event_proto_rawDescGZIP(), []int{2} +} + +// Payload for the event WEBHOOK_EVENT_REPOSITORY_PUSH. +type RepositoryPushEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The timestamp of the commit push. + EventTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=event_time,json=eventTime,proto3" json:"event_time,omitempty"` + // The repository commit that was pushed. + RepositoryCommit *v1alpha1.RepositoryCommit `protobuf:"bytes,2,opt,name=repository_commit,json=repositoryCommit,proto3" json:"repository_commit,omitempty"` + // The repository that was pushed. + Repository *v1alpha1.Repository `protobuf:"bytes,3,opt,name=repository,proto3" json:"repository,omitempty"` +} + +func (x *RepositoryPushEvent) Reset() { + *x = RepositoryPushEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_webhook_v1alpha1_event_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepositoryPushEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepositoryPushEvent) ProtoMessage() {} + +func (x *RepositoryPushEvent) ProtoReflect() protoreflect.Message { + mi := &file_webhook_v1alpha1_event_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepositoryPushEvent.ProtoReflect.Descriptor instead. +func (*RepositoryPushEvent) Descriptor() ([]byte, []int) { + return file_webhook_v1alpha1_event_proto_rawDescGZIP(), []int{3} +} + +func (x *RepositoryPushEvent) GetEventTime() *timestamppb.Timestamp { + if x != nil { + return x.EventTime + } + return nil +} + +func (x *RepositoryPushEvent) GetRepositoryCommit() *v1alpha1.RepositoryCommit { + if x != nil { + return x.RepositoryCommit + } + return nil +} + +func (x *RepositoryPushEvent) GetRepository() *v1alpha1.Repository { + if x != nil { + return x.Repository + } + return nil +} + +var File_webhook_v1alpha1_event_proto protoreflect.FileDescriptor + +var file_webhook_v1alpha1_event_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x28, + 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x22, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x77, 0x65, 0x62, 0x68, 0x6f, + 0x6f, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x01, 0x0a, 0x0c, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4d, 0x0a, 0x05, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, + 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x50, 0x0a, 0x07, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x62, 0x75, 0x66, + 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, + 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x0c, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x68, 0x0a, 0x0f, + 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x70, 0x75, 0x73, 0x68, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, + 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x75, 0x73, 0x68, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x79, 0x50, 0x75, 0x73, 0x68, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x22, 0x0f, 0x0a, 0x0d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x91, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, + 0x79, 0x50, 0x75, 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x68, 0x0a, 0x11, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x3b, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x10, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, + 0x55, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, + 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x32, 0x88, 0x01, 0x0a, 0x0c, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x78, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x36, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, + 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x65, 0x62, 0x68, 0x6f, + 0x6f, 0x6b, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, + 0x6e, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, + 0x72, 0x67, 0x2e, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0xde, 0x02, 0x0a, 0x2c, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, + 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x5b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, + 0x63, 0x68, 0x65, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x77, 0x65, 0x62, + 0x68, 0x6f, 0x6f, 0x6b, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x77, 0x65, + 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x05, + 0x42, 0x44, 0x41, 0x4f, 0x57, 0xaa, 0x02, 0x28, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x2e, 0x44, + 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x4f, 0x72, 0x67, 0x2e, + 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xca, 0x02, 0x28, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, + 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x57, 0x65, 0x62, 0x68, 0x6f, + 0x6f, 0x6b, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x34, 0x42, 0x75, + 0x66, 0x6d, 0x61, 0x6e, 0x5c, 0x44, 0x75, 0x62, 0x62, 0x6f, 0x5c, 0x41, 0x70, 0x61, 0x63, 0x68, + 0x65, 0x5c, 0x4f, 0x72, 0x67, 0x5c, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x2d, 0x42, 0x75, 0x66, 0x6d, 0x61, 0x6e, 0x3a, 0x3a, 0x44, 0x75, 0x62, + 0x62, 0x6f, 0x3a, 0x3a, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x3a, + 0x3a, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_webhook_v1alpha1_event_proto_rawDescOnce sync.Once + file_webhook_v1alpha1_event_proto_rawDescData = file_webhook_v1alpha1_event_proto_rawDesc +) + +func file_webhook_v1alpha1_event_proto_rawDescGZIP() []byte { + file_webhook_v1alpha1_event_proto_rawDescOnce.Do(func() { + file_webhook_v1alpha1_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_webhook_v1alpha1_event_proto_rawDescData) + }) + return file_webhook_v1alpha1_event_proto_rawDescData +} + +var file_webhook_v1alpha1_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_webhook_v1alpha1_event_proto_goTypes = []interface{}{ + (*EventRequest)(nil), // 0: bufman.dubbo.apache.org.webhook.v1alpha1.EventRequest + (*EventPayload)(nil), // 1: bufman.dubbo.apache.org.webhook.v1alpha1.EventPayload + (*EventResponse)(nil), // 2: bufman.dubbo.apache.org.webhook.v1alpha1.EventResponse + (*RepositoryPushEvent)(nil), // 3: bufman.dubbo.apache.org.webhook.v1alpha1.RepositoryPushEvent + (v1alpha1.WebhookEvent)(0), // 4: bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent + (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp + (*v1alpha1.RepositoryCommit)(nil), // 6: bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + (*v1alpha1.Repository)(nil), // 7: bufman.dubbo.apache.org.registry.v1alpha1.Repository +} +var file_webhook_v1alpha1_event_proto_depIdxs = []int32{ + 4, // 0: bufman.dubbo.apache.org.webhook.v1alpha1.EventRequest.event:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.WebhookEvent + 1, // 1: bufman.dubbo.apache.org.webhook.v1alpha1.EventRequest.payload:type_name -> bufman.dubbo.apache.org.webhook.v1alpha1.EventPayload + 3, // 2: bufman.dubbo.apache.org.webhook.v1alpha1.EventPayload.repository_push:type_name -> bufman.dubbo.apache.org.webhook.v1alpha1.RepositoryPushEvent + 5, // 3: bufman.dubbo.apache.org.webhook.v1alpha1.RepositoryPushEvent.event_time:type_name -> google.protobuf.Timestamp + 6, // 4: bufman.dubbo.apache.org.webhook.v1alpha1.RepositoryPushEvent.repository_commit:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.RepositoryCommit + 7, // 5: bufman.dubbo.apache.org.webhook.v1alpha1.RepositoryPushEvent.repository:type_name -> bufman.dubbo.apache.org.registry.v1alpha1.Repository + 0, // 6: bufman.dubbo.apache.org.webhook.v1alpha1.EventService.Event:input_type -> bufman.dubbo.apache.org.webhook.v1alpha1.EventRequest + 2, // 7: bufman.dubbo.apache.org.webhook.v1alpha1.EventService.Event:output_type -> bufman.dubbo.apache.org.webhook.v1alpha1.EventResponse + 7, // [7:8] is the sub-list for method output_type + 6, // [6:7] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_webhook_v1alpha1_event_proto_init() } +func file_webhook_v1alpha1_event_proto_init() { + if File_webhook_v1alpha1_event_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_webhook_v1alpha1_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webhook_v1alpha1_event_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webhook_v1alpha1_event_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webhook_v1alpha1_event_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepositoryPushEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_webhook_v1alpha1_event_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*EventPayload_RepositoryPush)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_webhook_v1alpha1_event_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_webhook_v1alpha1_event_proto_goTypes, + DependencyIndexes: file_webhook_v1alpha1_event_proto_depIdxs, + MessageInfos: file_webhook_v1alpha1_event_proto_msgTypes, + }.Build() + File_webhook_v1alpha1_event_proto = out.File + file_webhook_v1alpha1_event_proto_rawDesc = nil + file_webhook_v1alpha1_event_proto_goTypes = nil + file_webhook_v1alpha1_event_proto_depIdxs = nil +} diff --git a/pkg/bufman/gen/proto/go/webhook/v1alpha1/event_grpc.pb.go b/pkg/bufman/gen/proto/go/webhook/v1alpha1/event_grpc.pb.go new file mode 100644 index 000000000..cfdfbc875 --- /dev/null +++ b/pkg/bufman/gen/proto/go/webhook/v1alpha1/event_grpc.pb.go @@ -0,0 +1,111 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: webhook/v1alpha1/event.proto + +package webhookv1alpha1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + EventService_Event_FullMethodName = "/bufman.dubbo.apache.org.webhook.v1alpha1.EventService/Event" +) + +// EventServiceClient is the client API for EventService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type EventServiceClient interface { + // Event is the rpc which receives webhook events. + Event(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (*EventResponse, error) +} + +type eventServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewEventServiceClient(cc grpc.ClientConnInterface) EventServiceClient { + return &eventServiceClient{cc} +} + +func (c *eventServiceClient) Event(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (*EventResponse, error) { + out := new(EventResponse) + err := c.cc.Invoke(ctx, EventService_Event_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// EventServiceServer is the server API for EventService service. +// All implementations must embed UnimplementedEventServiceServer +// for forward compatibility +type EventServiceServer interface { + // Event is the rpc which receives webhook events. + Event(context.Context, *EventRequest) (*EventResponse, error) + mustEmbedUnimplementedEventServiceServer() +} + +// UnimplementedEventServiceServer must be embedded to have forward compatible implementations. +type UnimplementedEventServiceServer struct { +} + +func (UnimplementedEventServiceServer) Event(context.Context, *EventRequest) (*EventResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Event not implemented") +} +func (UnimplementedEventServiceServer) mustEmbedUnimplementedEventServiceServer() {} + +// UnsafeEventServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to EventServiceServer will +// result in compilation errors. +type UnsafeEventServiceServer interface { + mustEmbedUnimplementedEventServiceServer() +} + +func RegisterEventServiceServer(s grpc.ServiceRegistrar, srv EventServiceServer) { + s.RegisterService(&EventService_ServiceDesc, srv) +} + +func _EventService_Event_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EventRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EventServiceServer).Event(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: EventService_Event_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EventServiceServer).Event(ctx, req.(*EventRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// EventService_ServiceDesc is the grpc.ServiceDesc for EventService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var EventService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "bufman.dubbo.apache.org.webhook.v1alpha1.EventService", + HandlerType: (*EventServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Event", + Handler: _EventService_Event_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "webhook/v1alpha1/event.proto", +} From 2ffa325992fba60a99d8b81683e15cf3573c5063 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:31:54 +0800 Subject: [PATCH 06/18] migrate buf pkg --- pkg/bufman/bufpkg/bufanalysis/bufanalysis.go | 316 +++ .../bufanalysistesting/bufanalysistesting.go | 166 ++ .../bufanalysistesting_test.go | 134 ++ .../bufpkg/bufanalysis/file_annotation.go | 108 + pkg/bufman/bufpkg/bufanalysis/print.go | 296 +++ pkg/bufman/bufpkg/bufanalysis/util.go | 23 + .../bufpkg/bufapimodule/bufapimodule.go | 62 + .../bufpkg/bufapimodule/module_reader.go | 101 + .../bufpkg/bufapimodule/module_reader_test.go | 253 ++ .../bufpkg/bufapimodule/module_resolver.go | 73 + .../bufapimodule/module_resolver_test.go | 117 + .../bufcheck/bufbreaking/bufbreaking.go | 141 ++ .../bufcheck/bufbreaking/bufbreaking_test.go | 842 +++++++ .../bufbreakingconfig/bufbreakingconfig.go | 226 ++ .../bufpkg/bufcheck/bufbreaking/handler.go | 65 + .../bufbreakingbuild/bufbreakingbuild.go | 372 +++ .../bufbreakingcheck/bufbreakingcheck.go | 1106 +++++++++ .../internal/bufbreakingcheck/util.go | 354 +++ .../internal/bufbreakingv1/bufbreakingv1.go | 38 + .../bufbreakingv1/bufbreakingv1_test.go | 27 + .../internal/bufbreakingv1/vars.go | 335 +++ .../bufbreakingv1beta1/bufbreakingv1beta1.go | 28 + .../bufbreakingv1beta1_test.go | 27 + .../internal/bufbreakingv1beta1/vars.go | 326 +++ .../testdata/breaking_enum_no_delete/1.proto | 33 + .../testdata/breaking_enum_no_delete/2.proto | 43 + .../testdata/breaking_enum_no_delete/buf.yaml | 19 + .../breaking_enum_value_no_delete/1.proto | 57 + .../breaking_enum_value_no_delete/2.proto | 67 + .../breaking_enum_value_no_delete/buf.yaml | 19 + .../1.proto | 60 + .../2.proto | 67 + .../buf.yaml | 19 + .../1.proto | 60 + .../2.proto | 67 + .../buf.yaml | 19 + .../breaking_enum_value_same_name/1.proto | 71 + .../breaking_enum_value_same_name/2.proto | 67 + .../breaking_enum_value_same_name/buf.yaml | 19 + .../1.proto | 62 + .../2.proto | 94 + .../buf.yaml | 19 + .../testdata/breaking_field_no_delete/1.proto | 48 + .../testdata/breaking_field_no_delete/2.proto | 75 + .../breaking_field_no_delete/buf.yaml | 19 + .../1.proto | 50 + .../2.proto | 76 + .../buf.yaml | 19 + .../1.proto | 57 + .../2.proto | 76 + .../buf.yaml | 19 + .../breaking_field_same_ctype/1.proto | 46 + .../breaking_field_same_ctype/2.proto | 66 + .../breaking_field_same_ctype/buf.yaml | 19 + .../breaking_field_same_json_name/1.proto | 79 + .../breaking_field_same_json_name/2.proto | 111 + .../breaking_field_same_json_name/buf.yaml | 19 + .../breaking_field_same_jstype/1.proto | 46 + .../breaking_field_same_jstype/2.proto | 66 + .../breaking_field_same_jstype/buf.yaml | 19 + .../breaking_field_same_label/1.proto | 66 + .../breaking_field_same_label/2.proto | 87 + .../breaking_field_same_label/buf.yaml | 19 + .../testdata/breaking_field_same_name/1.proto | 52 + .../testdata/breaking_field_same_name/2.proto | 78 + .../breaking_field_same_name/buf.yaml | 19 + .../breaking_field_same_oneof/1.proto | 76 + .../breaking_field_same_oneof/2.proto | 116 + .../breaking_field_same_oneof/buf.yaml | 19 + .../testdata/breaking_field_same_type/1.proto | 66 + .../testdata/breaking_field_same_type/2.proto | 87 + .../breaking_field_same_type/buf.yaml | 19 + .../2.proto | 101 + .../buf.yaml | 19 + .../2.proto | 104 + .../buf.yaml | 19 + .../breaking_file_no_delete/a/b/a_b.proto | 18 + .../testdata/breaking_file_no_delete/buf.yaml | 19 + .../sub/a/b/sub_a_b.proto | 18 + .../a/b/a_b.proto | 18 + .../breaking_file_no_delete_ignores/buf.yaml | 22 + .../sub/a/b/sub_a_b.proto | 18 + .../a/v1beta1/a.proto | 18 + .../breaking_file_no_delete_unstable/buf.yaml | 18 + .../breaking_file_same_package/a/a.proto | 18 + .../breaking_file_same_package/a/b/a_b.proto | 18 + .../breaking_file_same_package/buf.yaml | 19 + .../no_package.proto | 18 + .../sub/a/b/sub_a_b.proto | 18 + .../breaking_file_same_syntax/buf.yaml | 22 + .../breaking_file_same_syntax/root/a/a.proto | 18 + .../root/a/b/a_b.proto | 18 + .../root/no_package.proto | 16 + .../root/sub/a/b/sub_a_b.proto | 19 + .../breaking_file_same_values/1.proto | 38 + .../breaking_file_same_values/2.proto | 38 + .../breaking_file_same_values/buf.yaml | 19 + .../a/v1beta1/a.proto | 26 + .../buf.yaml | 20 + .../1.proto | 31 + .../2.proto | 41 + .../a/v1/1.proto | 33 + .../a/v1/2.proto | 43 + .../a/v1beta1/1.proto | 33 + .../a/v1beta1/2.proto | 43 + .../b/1.proto | 33 + .../b/2.proto | 43 + .../buf.yaml | 19 + .../1.proto | 31 + .../2.proto | 41 + .../a/v1/1.proto | 33 + .../a/v1/2.proto | 43 + .../a/v1beta1/1.proto | 33 + .../a/v1beta1/2.proto | 43 + .../b/1.proto | 33 + .../b/2.proto | 43 + .../buf.yaml | 20 + .../testdata/breaking_int_enum/1.proto | 19 + .../testdata/breaking_int_enum/2.proto | 23 + .../testdata/breaking_message_enum/1.proto | 22 + .../testdata/breaking_message_enum/2.proto | 19 + .../testdata/breaking_message_int/1.proto | 19 + .../testdata/breaking_message_int/2.proto | 19 + .../testdata/breaking_message_message/1.proto | 22 + .../testdata/breaking_message_message/2.proto | 19 + .../breaking_message_no_delete/1.proto | 27 + .../breaking_message_no_delete/2.proto | 31 + .../breaking_message_no_delete/buf.yaml | 19 + .../1.proto | 51 + .../2.proto | 22 + .../buf.yaml | 19 + .../breaking_message_same_values/1.proto | 43 + .../breaking_message_same_values/2.proto | 32 + .../breaking_message_same_values/buf.yaml | 20 + .../testdata/breaking_oneof_no_delete/1.proto | 58 + .../testdata/breaking_oneof_no_delete/2.proto | 94 + .../breaking_oneof_no_delete/buf.yaml | 19 + .../breaking_package_no_delete/a1.proto | 22 + .../breaking_package_no_delete/a2.proto | 37 + .../breaking_package_no_delete/b1.proto | 22 + .../breaking_package_no_delete/b2.proto | 44 + .../breaking_package_no_delete/buf.yaml | 19 + .../1.proto | 25 + .../2.proto | 29 + .../buf.yaml | 19 + .../breaking_reserved_enum_no_delete/1.proto | 66 + .../breaking_reserved_enum_no_delete/2.proto | 108 + .../breaking_reserved_enum_no_delete/buf.yaml | 19 + .../1.proto | 69 + .../2.proto | 111 + .../buf.yaml | 19 + .../testdata/breaking_rpc_no_delete/1.proto | 25 + .../testdata/breaking_rpc_no_delete/2.proto | 49 + .../testdata/breaking_rpc_no_delete/buf.yaml | 19 + .../testdata/breaking_rpc_same_values/1.proto | 28 + .../testdata/breaking_rpc_same_values/2.proto | 76 + .../breaking_rpc_same_values/buf.yaml | 19 + .../breaking_service_no_delete/1.proto | 20 + .../breaking_service_no_delete/2.proto | 22 + .../breaking_service_no_delete/buf.yaml | 19 + .../breaking_enum_no_delete/1.proto | 43 + .../breaking_enum_no_delete/2.proto | 43 + .../breaking_enum_value_no_delete/1.proto | 75 + .../breaking_enum_value_no_delete/2.proto | 55 + .../1.proto | 75 + .../2.proto | 55 + .../1.proto | 75 + .../2.proto | 55 + .../breaking_enum_value_same_name/1.proto | 82 + .../breaking_enum_value_same_name/2.proto | 55 + .../1.proto | 78 + .../2.proto | 78 + .../breaking_field_no_delete/1.proto | 64 + .../breaking_field_no_delete/2.proto | 64 + .../1.proto | 64 + .../2.proto | 64 + .../1.proto | 73 + .../2.proto | 64 + .../breaking_field_same_ctype/1.proto | 56 + .../breaking_field_same_ctype/2.proto | 56 + .../breaking_field_same_json_name/1.proto | 99 + .../breaking_field_same_json_name/2.proto | 91 + .../breaking_field_same_jstype/1.proto | 56 + .../breaking_field_same_jstype/2.proto | 56 + .../breaking_field_same_label/1.proto | 85 + .../breaking_field_same_label/2.proto | 70 + .../breaking_field_same_name/1.proto | 64 + .../breaking_field_same_name/2.proto | 64 + .../breaking_field_same_oneof/1.proto | 96 + .../breaking_field_same_oneof/2.proto | 96 + .../breaking_field_same_type/1.proto | 85 + .../breaking_field_same_type/2.proto | 70 + .../1.proto | 100 + .../1.proto | 103 + .../breaking_file_no_delete/buf.yaml | 34 + .../breaking_file_no_delete/root/a/a.proto | 18 + .../root/a/b/a_b.proto | 18 + .../root/no_package.proto | 16 + .../root/sub/a/b/sub_a_b.proto | 18 + .../breaking_file_no_delete_ignores/buf.yaml | 34 + .../root/a/a.proto | 18 + .../root/a/b/a_b.proto | 18 + .../root/a/c/c.proto | 18 + .../root/no_package.proto | 16 + .../root/sub/a/b/sub_a_b.proto | 18 + .../a/v1beta1/a.proto | 18 + .../a/v1beta1/b.proto | 18 + .../breaking_file_same_package/buf.yaml | 34 + .../breaking_file_same_package/root/a/a.proto | 18 + .../root/a/b/a_b.proto | 18 + .../root/no_package.proto | 16 + .../root/sub/a/b/sub_a_b.proto | 18 + .../breaking_file_same_syntax/buf.yaml | 34 + .../breaking_file_same_syntax/root/a/a.proto | 18 + .../root/a/b/a_b.proto | 18 + .../root/no_package.proto | 16 + .../root/sub/a/b/sub_a_b.proto | 18 + .../breaking_file_same_values/1.proto | 38 + .../breaking_file_same_values/2.proto | 18 + .../a/v1beta1/a.proto | 26 + .../a/v1beta1/b.proto | 26 + .../1.proto | 41 + .../2.proto | 41 + .../a/v1/1.proto | 43 + .../a/v1/2.proto | 43 + .../a/v1beta1/1.proto | 43 + .../a/v1beta1/2.proto | 43 + .../b/1.proto | 43 + .../b/2.proto | 43 + .../1.proto | 41 + .../2.proto | 41 + .../a/v1/1.proto | 43 + .../a/v1/2.proto | 43 + .../a/v1beta1/1.proto | 43 + .../a/v1beta1/2.proto | 43 + .../b/1.proto | 43 + .../b/2.proto | 43 + .../breaking_int_enum/1.proto | 22 + .../breaking_int_enum/2.proto | 19 + .../breaking_message_enum/1.proto | 19 + .../breaking_message_enum/2.proto | 22 + .../breaking_message_int/1.proto | 19 + .../breaking_message_int/2.proto | 19 + .../breaking_message_message/1.proto | 19 + .../breaking_message_message/2.proto | 22 + .../breaking_message_no_delete/1.proto | 31 + .../breaking_message_no_delete/2.proto | 31 + .../1.proto | 38 + .../2.proto | 26 + .../breaking_message_same_values/1.proto | 53 + .../breaking_message_same_values/2.proto | 23 + .../breaking_oneof_no_delete/1.proto | 80 + .../breaking_oneof_no_delete/2.proto | 80 + .../breaking_package_no_delete/a1.proto | 57 + .../breaking_package_no_delete/b1.proto | 57 + .../breaking_package_no_delete/buf.yaml | 34 + .../breaking_package_no_delete/c.proto | 18 + .../1.proto | 29 + .../2.proto | 29 + .../buf.yaml | 34 + .../breaking_reserved_enum_no_delete/1.proto | 89 + .../breaking_reserved_enum_no_delete/2.proto | 89 + .../1.proto | 92 + .../2.proto | 92 + .../breaking_rpc_no_delete/1.proto | 38 + .../breaking_rpc_no_delete/2.proto | 38 + .../breaking_rpc_same_values/1.proto | 51 + .../breaking_rpc_same_values/2.proto | 51 + .../breaking_service_no_delete/1.proto | 22 + .../breaking_service_no_delete/2.proto | 22 + pkg/bufman/bufpkg/bufcheck/bufcheck.go | 108 + pkg/bufman/bufpkg/bufcheck/buflint/buflint.go | 150 ++ .../bufpkg/bufcheck/buflint/buflint_test.go | 1015 ++++++++ .../buflint/buflintconfig/buflintconfig.go | 361 +++ pkg/bufman/bufpkg/bufcheck/buflint/handler.go | 64 + .../internal/buflintbuild/buflintbuild.go | 360 +++ .../internal/buflintcheck/buflintcheck.go | 966 ++++++++ .../buflint/internal/buflintcheck/util.go | 289 +++ .../buflint/internal/buflintv1/buflintv1.go | 81 + .../internal/buflintv1/buflintv1_test.go | 27 + .../buflint/internal/buflintv1/vars.go | 234 ++ .../internal/buflintv1beta1/buflintv1beta1.go | 28 + .../buflintv1beta1/buflintv1beta1_test.go | 27 + .../buflint/internal/buflintv1beta1/vars.go | 276 +++ .../buflint/testdata/comment_ignores/a.proto | 91 + .../buflint/testdata/comment_ignores/b.proto | 25 + .../buflint/testdata/comment_ignores/buf.yaml | 34 + .../testdata/comment_ignores_cascade/a.proto | 88 + .../testdata/comment_ignores_cascade/b.proto | 25 + .../testdata/comment_ignores_cascade/buf.yaml | 30 + .../buflint/testdata/comments/a.proto | 297 +++ .../buflint/testdata/comments/buf.yaml | 19 + .../testdata/directory_same_package/a.proto | 18 + .../testdata/directory_same_package/buf.yaml | 19 + .../directory_same_package/no_package.proto | 16 + .../directory_same_package/one/c.proto | 18 + .../directory_same_package/one/d.proto | 18 + .../testdata/enum_first_value_zero/a.proto | 93 + .../testdata/enum_first_value_zero/buf.yaml | 19 + .../testdata/enum_no_allow_alias/a.proto | 102 + .../testdata/enum_no_allow_alias/buf.yaml | 19 + .../buflint/testdata/enum_pascal_case/a.proto | 93 + .../testdata/enum_pascal_case/buf.yaml | 19 + .../testdata/enum_value_prefix/a.proto | 53 + .../testdata/enum_value_prefix/buf.yaml | 19 + .../enum_value_upper_snake_case/a.proto | 54 + .../enum_value_upper_snake_case/buf.yaml | 19 + .../testdata/enum_zero_value_suffix/a.proto | 86 + .../testdata/enum_zero_value_suffix/buf.yaml | 19 + .../enum_zero_value_suffix_custom/a.proto | 86 + .../enum_zero_value_suffix_custom/buf.yaml | 20 + .../testdata/field_lower_snake_case/a.proto | 56 + .../testdata/field_lower_snake_case/buf.yaml | 19 + .../testdata/field_no_descriptor/a.proto | 60 + .../testdata/field_no_descriptor/buf.yaml | 19 + .../testdata/file_lower_snake_case/1.proto | 18 + .../testdata/file_lower_snake_case/B.proto | 18 + .../testdata/file_lower_snake_case/Foo.proto | 18 + .../testdata/file_lower_snake_case/a.proto | 18 + .../testdata/file_lower_snake_case/aBc.proto | 18 + .../testdata/file_lower_snake_case/aBc.txt | 3 + .../testdata/file_lower_snake_case/ab.proto | 18 + .../testdata/file_lower_snake_case/ab_c.proto | 18 + .../file_lower_snake_case/ab_c_.proto | 18 + .../testdata/file_lower_snake_case/buf.yaml | 19 + .../file_lower_snake_case/fooBar.proto | 18 + .../buflint/testdata/ignores1/buf.yaml | 22 + .../testdata/ignores1/buf/bar/bar.proto | 30 + .../testdata/ignores1/buf/bar/bar2.proto | 30 + .../buflint/testdata/ignores1/buf/buf.proto | 30 + .../testdata/ignores1/buf/foo/bar/bar.proto | 30 + .../testdata/ignores1/buf/foo/baz/baz.proto | 30 + .../testdata/ignores1/buf/foo/buf.proto | 30 + .../buflint/testdata/ignores2/buf.yaml | 25 + .../testdata/ignores2/buf/bar/bar.proto | 30 + .../testdata/ignores2/buf/bar/bar2.proto | 30 + .../buflint/testdata/ignores2/buf/buf.proto | 30 + .../testdata/ignores2/buf/foo/bar/bar.proto | 30 + .../testdata/ignores2/buf/foo/baz/baz.proto | 30 + .../testdata/ignores2/buf/foo/buf.proto | 30 + .../buflint/testdata/ignores3/buf.yaml | 31 + .../testdata/ignores3/buf/bar/bar.proto | 30 + .../testdata/ignores3/buf/bar/bar2.proto | 30 + .../buflint/testdata/ignores3/buf/buf.proto | 30 + .../testdata/ignores3/buf/foo/bar/bar.proto | 30 + .../testdata/ignores3/buf/foo/baz/baz.proto | 30 + .../testdata/ignores3/buf/foo/buf.proto | 30 + .../buflint/testdata/ignores4/buf.yaml | 31 + .../testdata/ignores4/buf/bar/bar.proto | 30 + .../testdata/ignores4/buf/bar/bar2.proto | 30 + .../buflint/testdata/ignores4/buf/buf.proto | 30 + .../testdata/ignores4/buf/foo/bar/bar.proto | 30 + .../testdata/ignores4/buf/foo/baz/baz.proto | 30 + .../testdata/ignores4/buf/foo/buf.proto | 30 + .../buflint/testdata/import_no_public/a.proto | 22 + .../testdata/import_no_public/buf.yaml | 19 + .../testdata/import_no_public/one/one.proto | 21 + .../testdata/import_no_public/sub/sub1.proto | 18 + .../testdata/import_no_public/sub/sub2.proto | 18 + .../buflint/testdata/import_no_weak/a.proto | 22 + .../buflint/testdata/import_no_weak/buf.yaml | 19 + .../testdata/import_no_weak/one/one.proto | 21 + .../testdata/import_no_weak/sub/sub1.proto | 18 + .../testdata/import_no_weak/sub/sub2.proto | 18 + .../buflint/testdata/import_used/a.proto | 26 + .../buflint/testdata/import_used/buf.yaml | 19 + .../testdata/import_used/one/one.proto | 25 + .../testdata/import_used/sub/sub1.proto | 20 + .../testdata/import_used/sub/sub2.proto | 20 + .../testdata/message_pascal_case/a.proto | 37 + .../testdata/message_pascal_case/buf.yaml | 19 + .../testdata/oneof_lower_snake_case/a.proto | 102 + .../testdata/oneof_lower_snake_case/buf.yaml | 19 + .../package_defined/a/no_package.proto | 16 + .../buflint/testdata/package_defined/buf.yaml | 19 + .../testdata/package_defined/no_package.proto | 16 + .../package_directory_match/a/b/a_b.proto | 18 + .../package_directory_match/a/b/a_c.proto | 18 + .../testdata/package_directory_match/buf.yaml | 19 + .../package_directory_match/no_package.proto | 16 + .../package_directory_match/sub/a/b/a_b.proto | 18 + .../testdata/package_lower_snake_case/1.proto | 18 + .../testdata/package_lower_snake_case/2.proto | 18 + .../testdata/package_lower_snake_case/3.proto | 18 + .../testdata/package_lower_snake_case/4.proto | 18 + .../testdata/package_lower_snake_case/5.proto | 18 + .../testdata/package_lower_snake_case/6.proto | 18 + .../testdata/package_lower_snake_case/7.proto | 18 + .../testdata/package_lower_snake_case/8.proto | 18 + .../package_lower_snake_case/buf.yaml | 19 + .../package_lower_snake_case/no_package.proto | 16 + .../testdata/package_no_import_cycle/a1.proto | 20 + .../testdata/package_no_import_cycle/a2.proto | 18 + .../testdata/package_no_import_cycle/b1.proto | 20 + .../testdata/package_no_import_cycle/b2.proto | 18 + .../testdata/package_no_import_cycle/buf.yaml | 19 + .../testdata/package_no_import_cycle/c1.proto | 20 + .../testdata/package_no_import_cycle/c2.proto | 18 + .../testdata/package_no_import_cycle/d1.proto | 20 + .../testdata/package_no_import_cycle/d2.proto | 18 + .../package_no_import_cycle/none1.proto | 18 + .../package_no_import_cycle/none2.proto | 16 + .../testdata/package_same_directory/a.proto | 18 + .../testdata/package_same_directory/buf.yaml | 19 + .../package_same_directory/one/a.proto | 18 + .../buf.yaml | 19 + .../no_package.proto | 16 + .../one/no_package.proto | 16 + .../package_same_option_value/a.proto | 26 + .../package_same_option_value/b.proto | 26 + .../package_same_option_value/buf.yaml | 25 + .../package_same_option_value/sub/a.proto | 27 + .../package_same_option_value/sub/b.proto | 18 + .../testdata/package_version_suffix/buf.yaml | 19 + .../testdata/package_version_suffix/foo.proto | 18 + .../package_version_suffix/foo_bar.proto | 18 + .../foo_bar_v0beta1.proto | 18 + .../package_version_suffix/foo_bar_v1.proto | 18 + .../foo_bar_v1beta1.proto | 18 + .../foo_bar_v1test.proto | 18 + .../foo_bar_v1test_foo.proto | 18 + .../foo_bar_v1testfoo.proto | 18 + .../package_version_suffix/foo_bar_v2.proto | 18 + .../foo_bar_v2beta0.proto | 18 + .../foo_bar_vv1beta1.proto | 18 + .../package_version_suffix/no_package.proto | 16 + .../testdata/package_version_suffix/v1.proto | 18 + .../buflint/testdata/rpc_no_streaming/a.proto | 27 + .../testdata/rpc_no_streaming/buf.yaml | 20 + .../buflint/testdata/rpc_pascal_case/a.proto | 30 + .../buflint/testdata/rpc_pascal_case/buf.yaml | 19 + .../rpc_request_response_unique/a.proto | 46 + .../rpc_request_response_unique/b.proto | 24 + .../rpc_request_response_unique/buf.yaml | 19 + .../a.proto | 46 + .../b.proto | 24 + .../buf.yaml | 20 + .../a.proto | 46 + .../b.proto | 24 + .../buf.yaml | 21 + .../a.proto | 46 + .../b.proto | 24 + .../buf.yaml | 20 + .../a.proto | 46 + .../b.proto | 24 + .../buf.yaml | 20 + .../a.proto | 46 + .../b.proto | 24 + .../buf.yaml | 22 + .../testdata/rpc_standard_name/a.proto | 39 + .../testdata/rpc_standard_name/buf.yaml | 20 + .../rpc_standard_name_allow_empty/a.proto | 39 + .../rpc_standard_name_allow_empty/buf.yaml | 22 + .../testdata/service_pascal_case/a.proto | 26 + .../testdata/service_pascal_case/buf.yaml | 19 + .../buflint/testdata/service_suffix/a.proto | 25 + .../buflint/testdata/service_suffix/buf.yaml | 19 + .../testdata/service_suffix_custom/a.proto | 26 + .../testdata/service_suffix_custom/buf.yaml | 20 + .../testdata/syntax_specified/a/a.proto | 18 + .../testdata/syntax_specified/a/a2.proto | 20 + .../testdata/syntax_specified/a/a3.proto | 20 + .../testdata/syntax_specified/buf.yaml | 19 + pkg/bufman/bufpkg/bufcheck/internal/config.go | 324 +++ pkg/bufman/bufpkg/bufcheck/internal/helper.go | 172 ++ .../internaltesting/internaltesting.go | 58 + pkg/bufman/bufpkg/bufcheck/internal/rule.go | 104 + .../bufpkg/bufcheck/internal/rule_builder.go | 97 + pkg/bufman/bufpkg/bufcheck/internal/runner.go | 205 ++ pkg/bufman/bufpkg/bufcheck/internal/vars.go | 60 + .../bufpkg/bufcheck/internal/version_spec.go | 76 + pkg/bufman/bufpkg/bufconfig/bufconfig.go | 261 ++ pkg/bufman/bufpkg/bufconfig/config.go | 65 + pkg/bufman/bufpkg/bufconfig/get.go | 134 ++ pkg/bufman/bufpkg/bufconfig/read.go | 59 + pkg/bufman/bufpkg/bufconfig/write.go | 468 ++++ pkg/bufman/bufpkg/bufconfig/write_test.go | 104 + pkg/bufman/bufpkg/bufconnect/bufconnect.go | 34 + pkg/bufman/bufpkg/bufconnect/errors.go | 50 + pkg/bufman/bufpkg/bufconnect/errors_test.go | 60 + pkg/bufman/bufpkg/bufconnect/interceptors.go | 110 + .../bufpkg/bufconnect/interceptors_test.go | 149 ++ .../bufpkg/bufconnect/netrc_token_provider.go | 47 + .../bufconnect/static_token_provider.go | 136 ++ .../bufconnect/static_token_provider_test.go | 76 + pkg/bufman/bufpkg/bufgraph/bufgraph.go | 89 + pkg/bufman/bufpkg/bufgraph/bufgraph_test.go | 123 + pkg/bufman/bufpkg/bufgraph/builder.go | 227 ++ .../bufgraph/testdata/basic/buf.work.yaml | 24 + .../testdata/basic/test-a/a/v1/a.proto | 28 + .../testdata/basic/test-a/a2/v1/a2.proto | 24 + .../bufgraph/testdata/basic/test-a/buf.yaml | 21 + .../testdata/basic/test-b/b/v1/b.proto | 24 + .../bufgraph/testdata/basic/test-b/buf.yaml | 19 + .../bufgraph/testdata/basic/test-c/buf.yaml | 19 + .../testdata/basic/test-c/c/v1/c.proto | 24 + .../bufgraph/testdata/basic/test-d/buf.yaml | 17 + .../testdata/basic/test-d/d/v1/d.proto | 20 + .../bufgraph/testdata/basic/test-e/buf.yaml | 19 + .../testdata/basic/test-e/e/v1/e.proto | 24 + .../bufgraph/testdata/basic/test-f/buf.yaml | 17 + .../testdata/basic/test-f/f/v1/f.proto | 20 + .../bufgraph/testdata/basic/test-g/buf.yaml | 17 + .../testdata/basic/test-g/g/v1/g.proto | 20 + pkg/bufman/bufpkg/bufimage/bufimage.go | 615 +++++ .../bufimage/bufimagebuild/bufimagebuild.go | 81 + .../bufimagebuildtesting.go | 238 ++ .../bufimagebuildtesting_unix_test.go | 57 + .../corpus/alloptions.txtar | 20 + .../corpus/ccoptions.txtar | 3 + .../corpus/comment_ignores.txtar | 101 + .../corpus/comment_ignores_cascade.txtar | 89 + .../corpus/comments.txtar | 288 +++ .../corpus/csharpoptions.txtar | 12 + .../corpus/customoptions1.txtar | 12 + .../corpus/customoptionserror1.txtar | 25 + .../corpus/directory_same_package.txtar | 19 + .../bufimagebuildtesting/corpus/empty.txtar | 2 + .../corpus/emptyoptions.txtar | 1 + .../corpus/enum_first_value_zero.txtar | 84 + .../corpus/enum_pascal_case.txtar | 84 + .../corpus/enum_value_prefix.txtar | 44 + .../corpus/enum_value_upper_snake_case.txtar | 45 + .../corpus/enum_zero_value_suffix.txtar | 77 + .../enum_zero_value_suffix_custom.txtar | 78 + .../bufimagebuildtesting/corpus/ex1.txtar | 13 + .../bufimagebuildtesting/corpus/ex2.txtar | 32 + .../bufimagebuildtesting/corpus/ex3.txtar | 18 + .../corpus/field_lower_snake_case.txtar | 47 + .../corpus/field_no_descriptor.txtar | 51 + .../corpus/file_lower_snake_case.txtar | 45 + .../corpus/import_no_public.txtar | 28 + .../corpus/import_no_weak.txtar | 28 + .../corpus/import_used.txtar | 40 + .../corpus/javaoptions.txtar | 7 + .../corpus/jsoptions.txtar | 2 + .../corpus/message_pascal_case.txtar | 28 + .../corpus/objcoptions.txtar | 20 + .../corpus/oneof_lower_snake_case.txtar | 93 + .../corpus/optionpanic.txtar | 33 + .../corpus/package_defined.txtar | 9 + .../corpus/package_directory_match.txtar | 19 + .../corpus/package_lower_snake_case.txtar | 39 + .../corpus/package_same_directory.txtar | 13 + .../package_same_directory_no_package.txtar | 9 + .../corpus/package_same_option_value.txtar | 52 + .../corpus/package_version_suffix.txtar | 55 + .../corpus/packageversion.txtar | 4 + .../corpus/phpoptions.txtar | 20 + .../corpus/proto3optional1.txtar | 6 + .../corpus/rpc_no_streaming.txtar | 19 + .../corpus/rpc_pascal_case.txtar | 21 + .../corpus/rpc_standard_name.txtar | 31 + .../rpc_standard_name_allow_empty.txtar | 33 + .../corpus/rubyoptions.txtar | 12 + .../corpus/semicolons.txtar | 42 + .../corpus/service_pascal_case.txtar | 17 + .../corpus/service_suffix.txtar | 16 + .../corpus/service_suffix_custom.txtar | 18 + .../bufimagebuildtesting/corpus/simple.txtar | 2 + .../corpus/syntax_specified.txtar | 21 + .../bufimagebuildtesting/corpus/test.txtar | 58 + .../corpus/wktimport.txtar | 10 + .../bufpkg/bufimage/bufimagebuild/builder.go | 650 +++++ .../bufimage/bufimagebuild/builder_test.go | 428 ++++ .../bufimagebuild/builder_unix_test.go | 57 + .../testdata/customoptions1/a.proto | 26 + .../testdata/customoptionserror1/a.proto | 28 + .../testdata/customoptionserror1/b.proto | 25 + .../testdata/cyclicimport/a/a.proto | 20 + .../testdata/cyclicimport/b/b.proto | 20 + .../duplicatesyntheticoneofs/a1.proto | 22 + .../duplicatesyntheticoneofs/a2.proto | 22 + .../testdata/notamessagetype/a.proto | 25 + .../testdata/optionpanic/options/option.proto | 34 + .../testdata/optionpanic/proto/test.proto | 27 + .../testdata/proto3optional1/a.proto | 20 + .../bufimagebuild/testdata/semicolons/a.proto | 56 + .../testdata/spacebetweennumberandid/a.proto | 22 + .../testdata/trailingcomments/a.proto | 24 + .../bufimage/bufimagemodify/bufimagemodify.go | 350 +++ .../bufimagemodify/bufimagemodify_test.go | 113 + .../bufimagemodify/cc_enable_arenas.go | 91 + .../bufimagemodify/cc_enable_arenas_test.go | 386 +++ .../bufimagemodify/csharp_namespace.go | 152 ++ .../bufimagemodify/csharp_namespace_test.go | 628 +++++ .../bufimagemodify/file_option_sweeper.go | 116 + .../bufimage/bufimagemodify/go_package.go | 138 ++ .../bufimagemodify/go_package_test.go | 688 ++++++ .../bufimagemodify/java_multiple_files.go | 104 + .../java_multiple_files_test.go | 429 ++++ .../bufimagemodify/java_outer_classname.go | 98 + .../java_outer_classname_test.go | 410 ++++ .../bufimage/bufimagemodify/java_package.go | 154 ++ .../bufimagemodify/java_package_test.go | 633 +++++ .../bufimagemodify/java_string_check_utf8.go | 91 + .../java_string_check_utf8_test.go | 347 +++ .../bufimage/bufimagemodify/multi_modifier.go | 46 + .../bufimagemodify/objc_class_prefix.go | 152 ++ .../bufimagemodify/objc_class_prefix_test.go | 719 ++++++ .../bufimage/bufimagemodify/optimize_for.go | 131 + .../bufimagemodify/optimize_for_test.go | 665 ++++++ .../bufimagemodify/php_metadata_namespace.go | 93 + .../php_metadata_namespace_test.go | 359 +++ .../bufimage/bufimagemodify/php_namespace.go | 204 ++ .../bufimagemodify/php_namespace_test.go | 360 +++ .../bufimage/bufimagemodify/ruby_package.go | 137 ++ .../bufimagemodify/ruby_package_test.go | 588 +++++ .../testdata/alloptions/a.proto | 34 + .../bufimagemodify/testdata/ccoptions/a.proto | 17 + .../bufimagemodify/testdata/ccoptions/b.proto | 18 + .../csharpoptions/double/csharp.proto | 18 + .../csharpoptions/single/csharp.proto | 18 + .../csharpoptions/single/override.proto | 19 + .../csharpoptions/triple/csharp.proto | 18 + .../csharpoptions/underscore/csharp.proto | 18 + .../testdata/emptyoptions/a.proto | 15 + .../testdata/javaemptyoptions/a.proto | 16 + .../testdata/javaoptions/java_file.proto | 21 + .../testdata/javaoptions/override.proto | 21 + .../bufimagemodify/testdata/jsoptions/a.proto | 16 + .../testdata/objcoptions/double/objc.proto | 18 + .../testdata/objcoptions/gpb/objc.proto | 18 + .../testdata/objcoptions/single/objc.proto | 18 + .../objcoptions/single/override.proto | 18 + .../testdata/objcoptions/triple/objc.proto | 18 + .../objcoptions/unversioned/objc.proto | 18 + .../testdata/packageversion/a.proto | 18 + .../testdata/packageversion/b.proto | 18 + .../testdata/phpoptions/double/php.proto | 19 + .../testdata/phpoptions/reserved/php.proto | 19 + .../testdata/phpoptions/single/override.proto | 19 + .../testdata/phpoptions/single/php.proto | 19 + .../testdata/phpoptions/triple/php.proto | 19 + .../testdata/phpoptions/underscore/php.proto | 18 + .../testdata/rubyoptions/double/ruby.proto | 18 + .../rubyoptions/single/override.proto | 18 + .../testdata/rubyoptions/single/ruby.proto | 18 + .../testdata/rubyoptions/triple/ruby.proto | 18 + .../rubyoptions/underscore/ruby.proto | 18 + .../bufimagemodify/testdata/wktimport/a.proto | 24 + .../bufimagetesting/bufimagetesting.go | 118 + .../bufimagetesting/bufimagetesting_test.go | 709 ++++++ .../bufimage/bufimageutil/bufimageutil.go | 920 +++++++ .../bufimageutil/bufimageutil_test.go | 502 ++++ .../bufimage/bufimageutil/image_index.go | 203 ++ .../bufimage/bufimageutil/input_file.go | 35 + .../bufimageutil/source_paths_remap.go | 146 ++ .../bufimageutil/source_paths_remap_test.go | 211 ++ .../bufpkg/bufimage/bufimageutil/tags.go | 40 + .../bufimageutil/testdata/any/a.proto | 38 + .../bufimageutil/testdata/any/b.proto | 23 + .../bufimageutil/testdata/any/c1.proto | 28 + .../bufimageutil/testdata/any/c1.txtar | 69 + .../bufimageutil/testdata/any/c2.proto | 30 + .../bufimageutil/testdata/any/c2.txtar | 74 + .../bufimageutil/testdata/any/c3.proto | 33 + .../bufimageutil/testdata/any/c3.txtar | 79 + .../bufimageutil/testdata/any/c4.proto | 45 + .../bufimageutil/testdata/any/c4.txtar | 92 + .../bufimageutil/testdata/any/d.proto | 25 + .../bufimageutil/testdata/any/d.txtar | 69 + .../bufimageutil/testdata/any/e.proto | 25 + .../bufimageutil/testdata/any/e.txtar | 59 + .../bufimageutil/testdata/extensions/a.proto | 27 + .../bufimageutil/testdata/extensions/b.proto | 34 + .../extensions/extensions-excluded.txtar | 8 + .../testdata/extensions/extensions.txtar | 27 + .../bufimageutil/testdata/importmods/a.proto | 36 + .../testdata/importmods/noimports.txtar | 5 + .../testdata/importmods/public.proto | 17 + .../testdata/importmods/regular.proto | 17 + .../testdata/importmods/regular_public.txtar | 18 + .../testdata/importmods/regular_weak.txtar | 18 + .../testdata/importmods/weak.proto | 17 + .../testdata/importmods/weak_public.txtar | 18 + .../bufimageutil/testdata/nesting/a.proto | 50 + .../bufimageutil/testdata/nesting/enum.txtar | 7 + .../testdata/nesting/message.txtar | 10 + .../testdata/nesting/recursenested.txtar | 10 + .../testdata/nesting/usingother.txtar | 12 + .../bufimageutil/testdata/options/Files.txtar | 314 +++ .../bufimageutil/testdata/options/a.proto | 78 + .../options/all-exclude-options.txtar | 25 + .../testdata/options/all-with-Files.txtar | 363 +++ .../bufimageutil/testdata/options/all.txtar | 225 ++ .../testdata/options/options.proto | 71 + .../testdata/options/pkg.Foo.txtar | 156 ++ .../testdata/options/pkg.FooEnum.txtar | 100 + .../testdata/options/pkg.FooService.Do.txtar | 103 + .../testdata/options/pkg.FooService.txtar | 107 + .../bufimageutil/testdata/packages/bar.proto | 29 + .../bufimageutil/testdata/packages/baz1.proto | 39 + .../bufimageutil/testdata/packages/baz2.proto | 31 + .../testdata/packages/foo.bar.baz.txtar | 70 + .../testdata/packages/foo.bar.txtar | 11 + .../bufimageutil/testdata/packages/foo.proto | 20 + .../bufimageutil/testdata/packages/foo.txtar | 5 + .../testdata/packages/nopackage.proto | 33 + .../testdata/packages/options.proto | 30 + .../testdata/packages/other.proto | 18 + .../bufimageutil/testdata/packages/root.txtar | 99 + .../testdata/sourcecodeinfo/Bar.txtar | 798 +++++++ .../testdata/sourcecodeinfo/Baz.txtar | 137 ++ .../testdata/sourcecodeinfo/Do.txtar | 936 ++++++++ .../testdata/sourcecodeinfo/Foo+Ext.txtar | 700 ++++++ .../testdata/sourcecodeinfo/Foo.txtar | 422 ++++ .../testdata/sourcecodeinfo/NestedFoo.txtar | 570 +++++ .../testdata/sourcecodeinfo/Quz.txtar | 134 ++ .../testdata/sourcecodeinfo/Svc.txtar | 992 ++++++++ .../testdata/sourcecodeinfo/all.txtar | 2103 +++++++++++++++++ .../testdata/sourcecodeinfo/test.proto | 169 ++ pkg/bufman/bufpkg/bufimage/image.go | 126 + pkg/bufman/bufpkg/bufimage/image_file.go | 99 + .../bufimage/image_module_dependency.go | 62 + pkg/bufman/bufpkg/bufimage/image_test.go | 140 ++ pkg/bufman/bufpkg/bufimage/import_tracker.go | 227 ++ pkg/bufman/bufpkg/bufimage/util.go | 569 +++++ pkg/bufman/bufpkg/bufimage/util_test.go | 203 ++ pkg/bufman/bufpkg/bufimage/validate.go | 74 + pkg/bufman/bufpkg/buflock/buflock.go | 155 ++ pkg/bufman/bufpkg/buflock/buflock_test.go | 306 +++ pkg/bufman/bufpkg/buflock/lock_file.go | 86 + .../buflock/testdata/v1/failure/buf.lock | 3 + .../buflock/testdata/v1/success/buf.lock | 10 + .../buflock/testdata/v1beta1/failure/buf.lock | 2 + .../buflock/testdata/v1beta1/success/buf.lock | 9 + pkg/bufman/bufpkg/bufmanifest/bucket.go | 55 + pkg/bufman/bufpkg/bufmanifest/bufmanifest.go | 16 + pkg/bufman/bufpkg/bufmanifest/mapper.go | 147 ++ pkg/bufman/bufpkg/bufmanifest/mapper_test.go | 134 ++ pkg/bufman/bufpkg/bufmodule/bufmodule.go | 565 +++++ .../bufmodulebuild/bufmodulebuild.go | 171 ++ .../bufmodulebuild/module_bucket_builder.go | 170 ++ .../module_bucket_builder_test.go | 585 +++++ .../module_bucket_builder_unix_test.go | 36 + .../bufmodulebuild/module_file_set_builder.go | 177 ++ .../bufmodulebuild/module_include_builder.go | 119 + .../module_include_builder_test.go | 200 ++ .../bufmodulebuild/testdata/1/proto/a/1.proto | 15 + .../bufmodulebuild/testdata/1/proto/a/2.proto | 15 + .../bufmodulebuild/testdata/1/proto/a/3.proto | 15 + .../testdata/1/proto/a/c/1.proto | 15 + .../testdata/1/proto/a/c/2.proto | 15 + .../testdata/1/proto/a/c/3.proto | 15 + .../bufmodulebuild/testdata/1/proto/b/1.proto | 15 + .../bufmodulebuild/testdata/1/proto/b/2.proto | 15 + .../bufmodulebuild/testdata/1/proto/b/3.proto | 15 + .../bufmodulebuild/testdata/1/proto/d/1.proto | 15 + .../bufmodulebuild/testdata/1/proto/d/2.proto | 15 + .../bufmodulebuild/testdata/1/proto/d/3.proto | 15 + .../bufmodulebuild/testdata/2/a/1.proto | 15 + .../bufmodulebuild/testdata/2/a/2.proto | 15 + .../bufmodulebuild/testdata/2/a/3.proto | 15 + .../bufmodulebuild/testdata/2/b/1.proto | 15 + .../bufmodulebuild/testdata/2/b/4.proto | 15 + .../bufmodulebuild/testdata/2/b/5.proto | 15 + .../bufmodule/bufmodulebuild/testdata/3/nop | 0 .../bufmodulebuild/testdata/4/buf.md | 1 + .../bufmodulebuild/testdata/4/proto/1.proto | 15 + .../bufmodulebuild/testdata/4/proto/a/2.proto | 15 + .../bufmodulebuild/testdata/5/LICENSE | 1 + .../bufmodulebuild/testdata/5/proto/1.proto | 15 + .../bufmodulebuild/testdata/5/proto/a/2.proto | 15 + .../bufmodulebuild/testdata/6/LICENSE | 1 + .../bufmodulebuild/testdata/6/proto/1.proto | 15 + .../bufmodulebuild/testdata/6/proto/a/2.proto | 15 + .../bufpkg/bufmodule/bufmodulebuild/util.go | 122 + .../bufmodulecache/bufmodulecache.go | 50 + .../bufmodule/bufmodulecache/cache_stats.go | 49 + .../bufmodulecache/cas_module_cacher.go | 266 +++ .../bufmodulecache/cas_module_reader.go | 109 + .../bufmodulecache/cas_module_reader_test.go | 268 +++ .../bufpkg/bufmodule/bufmodulecache/util.go | 53 + .../bufmoduleconfig/bufmoduleconfig.go | 64 + .../bufmodule/bufmoduleconfig/config.go | 162 ++ .../bufmodule/bufmoduleconfig/config_test.go | 449 ++++ .../bufmoduleprotocompile.go | 127 + .../bufmoduleprotocompile/path_resolver.go | 154 ++ .../bufmodule/bufmoduleref/bufmoduleref.go | 576 +++++ .../bufmoduleref/bufmoduleref_test.go | 258 ++ .../bufmodule/bufmoduleref/file_info.go | 100 + .../bufmodule/bufmoduleref/module_identity.go | 57 + .../bufmodule/bufmoduleref/module_owner.go | 45 + .../bufmoduleref/module_owner_test.go | 66 + .../bufmodule/bufmoduleref/module_pin.go | 132 ++ .../bufmodule/bufmoduleref/module_pin_test.go | 63 + .../bufmoduleref/module_reference.go | 100 + .../bufmoduleref/module_reference_test.go | 128 + .../bufpkg/bufmodule/bufmoduleref/util.go | 144 ++ .../bufpkg/bufmodule/bufmoduleref/validate.go | 211 ++ .../bufmodule/bufmoduleref/validate_test.go | 72 + .../bufmodule/bufmodulestat/bufmodulestat.go | 32 + .../bufmodule/bufmodulestat/file_walker.go | 54 + .../bufmoduletesting/bufmoduletesting.go | 282 +++ .../bufmoduletesting/bufmoduletesting_test.go | 59 + .../bufmoduletesting/bufmoduletesting_unix.go | 49 + .../bufmoduletesting_windows.go | 47 + .../bufmoduletesting/test_module_reader.go | 42 + .../bufpkg/bufmodule/internal/internal.go | 87 + .../bufmodule/internal/internal_test.go | 309 +++ pkg/bufman/bufpkg/bufmodule/module.go | 371 +++ pkg/bufman/bufpkg/bufmodule/module_file.go | 38 + .../bufpkg/bufmodule/module_file_set.go | 125 + .../bufpkg/bufmodule/module_object_info.go | 49 + .../bufpkg/bufmodule/module_read_bucket.go | 36 + pkg/bufman/bufpkg/bufmodule/module_test.go | 137 ++ .../bufmodule/multi_module_read_bucket.go | 64 + .../bufpkg/bufmodule/nop_module_reader.go | 33 + .../bufpkg/bufmodule/nop_module_resolver.go | 33 + .../bufmodule/single_module_read_bucket.go | 60 + .../bufpkg/bufmodule/targeting_module.go | 249 ++ .../bufpkg/bufmodule/targeting_module_test.go | 236 ++ pkg/bufman/bufpkg/bufmodule/util.go | 128 + pkg/bufman/bufpkg/bufmodule/validate.go | 66 + pkg/bufman/bufpkg/bufmodule/workspace.go | 65 + pkg/bufman/bufpkg/bufplugin/bufplugin.go | 503 ++++ pkg/bufman/bufpkg/bufplugin/bufplugin_test.go | 221 ++ .../bufpluginconfig/bufpluginconfig.go | 471 ++++ .../bufpluginconfig/bufpluginconfig_test.go | 389 +++ .../bufplugin/bufpluginconfig/config.go | 376 +++ .../bufpkg/bufplugin/bufpluginconfig/get.go | 141 ++ .../failure/invalid-empty-plugin-version.yaml | 17 + .../failure/invalid-empty-version.yaml | 18 + .../failure/invalid-multiple-registries.yaml | 30 + .../failure/invalid-plugin-version.yaml | 18 + .../success/go-empty-registry/buf.plugin.yaml | 21 + .../testdata/success/go/buf.plugin.yaml | 34 + .../testdata/success/maven/buf.plugin.yaml | 49 + .../testdata/success/npm/buf.plugin.yaml | 28 + .../testdata/success/options/buf.plugin.yaml | 18 + .../testdata/success/swift/buf.plugin.yaml | 39 + .../bufplugindocker/bufplugindocker.go | 20 + .../bufplugin/bufplugindocker/docker.go | 310 +++ .../bufplugin/bufplugindocker/docker_test.go | 292 +++ .../bufplugindocker/registry_auth_config.go | 55 + .../registry_auth_config_test.go | 56 + .../testdata/success/Dockerfile | 18 + .../bufplugin/bufpluginref/bufpluginref.go | 158 ++ .../bufpluginref/bufpluginref_test.go | 80 + .../bufplugin/bufpluginref/plugin_identity.go | 89 + .../bufpluginref/plugin_reference.go | 93 + pkg/bufman/bufpkg/bufplugin/plugin.go | 97 + .../bufpkg/bufpluginexec/binary_handler.go | 134 ++ .../bufpkg/bufpluginexec/bufpluginexec.go | 244 ++ .../bufpluginexec/bufpluginexec_go18.go | 33 + .../bufpluginexec/bufpluginexec_go19.go | 38 + pkg/bufman/bufpkg/bufpluginexec/generator.go | 100 + pkg/bufman/bufpkg/bufpluginexec/normalize.go | 79 + .../bufpkg/bufpluginexec/normalize_test.go | 187 ++ .../protoc_gen_swift_stderr_write_closer.go | 74 + .../bufpluginexec/protoc_proxy_handler.go | 203 ++ pkg/bufman/bufpkg/bufpluginexec/util.go | 47 + .../bufpkg/bufpluginexec/util_darwin.go | 21 + .../bufpkg/bufpluginexec/util_undarwin.go | 21 + pkg/bufman/bufpkg/bufpluginexec/version.go | 155 ++ .../bufpkg/bufpluginexec/version_test.go | 118 + .../bufpkg/bufpluginexec/wasm_handler.go | 151 ++ .../bufpkg/bufpluginexec/wasm_handler_test.go | 47 + pkg/bufman/bufpkg/bufreflect/bufreflect.go | 61 + .../bufpkg/bufremoteplugin/bufremoteplugin.go | 60 + .../bufpkg/bufstudioagent/buffer_codec.go | 70 + .../bufpkg/bufstudioagent/bufstudioagent.go | 68 + .../bufstudioagent/bufstudioagent_test.go | 282 +++ .../bufstudioagent/plain_post_handler.go | 270 +++ .../bufpkg/bufstyle/analyzer_provider.go | 102 + pkg/bufman/bufpkg/bufstyle/analyzers.go | 97 + pkg/bufman/bufpkg/bufstyle/bufstyle.go | 52 + .../bufpkg/bufstyle/cmd/bufstyle/main.go | 99 + pkg/bufman/bufpkg/buftesting/buftesting.go | 153 ++ .../bufpkg/buftransport/buftransport.go | 31 + pkg/bufman/bufpkg/bufwasm/bufwasm.go | 290 +++ pkg/bufman/bufpkg/bufwasm/bufwasm_test.go | 160 ++ pkg/bufman/bufpkg/bufwasm/testdata/echo.wasm | Bin 0 -> 208 bytes pkg/bufman/bufpkg/bufwasm/testdata/echo.wat | 43 + .../bufpkg/bufwkt/cmd/wkt-go-data/main.go | 317 +++ pkg/bufman/pkg/app/app.go | 353 +++ pkg/bufman/pkg/app/app_error.go | 50 + pkg/bufman/pkg/app/app_test.go | 163 ++ pkg/bufman/pkg/app/app_unix.go | 122 + pkg/bufman/pkg/app/app_windows.go | 111 + pkg/bufman/pkg/app/appcmd/appcmd.go | 379 +++ pkg/bufman/pkg/app/appcmd/appcmd_test.go | 229 ++ .../app/appcmd/appcmdtesting/appcmdtesting.go | 208 ++ pkg/bufman/pkg/app/appcmd/cobra.go | 59 + pkg/bufman/pkg/app/appcmd/error.go | 30 + pkg/bufman/pkg/app/appcmd/webpages.go | 399 ++++ pkg/bufman/pkg/app/appflag/appflag.go | 67 + pkg/bufman/pkg/app/appflag/builder.go | 242 ++ pkg/bufman/pkg/app/appflag/container.go | 78 + pkg/bufman/pkg/app/applog/applog.go | 83 + pkg/bufman/pkg/app/applog/applog_test.go | 81 + pkg/bufman/pkg/app/applog/container.go | 34 + pkg/bufman/pkg/app/appname/appname.go | 142 ++ .../pkg/app/appname/appname_unix_test.go | 145 ++ pkg/bufman/pkg/app/appname/container.go | 134 ++ pkg/bufman/pkg/app/appproto/appproto.go | 299 +++ pkg/bufman/pkg/app/appproto/appproto_test.go | 213 ++ .../pkg/app/appproto/appprotoos/appprotoos.go | 69 + .../appproto/appprotoos/response_writer.go | 302 +++ pkg/bufman/pkg/app/appproto/generator.go | 73 + .../pkg/app/appproto/response_builder.go | 160 ++ .../pkg/app/appproto/response_writer.go | 155 ++ pkg/bufman/pkg/app/appverbose/appverbose.go | 40 + pkg/bufman/pkg/app/appverbose/container.go | 32 + pkg/bufman/pkg/app/arg_container.go | 36 + pkg/bufman/pkg/app/container.go | 40 + pkg/bufman/pkg/app/env_container.go | 75 + pkg/bufman/pkg/app/stderr_container.go | 39 + pkg/bufman/pkg/app/stdin_container.go | 39 + pkg/bufman/pkg/app/stdout_container.go | 39 + pkg/bufman/pkg/bandeps/bandeps.go | 76 + pkg/bufman/pkg/bandeps/checker.go | 185 ++ pkg/bufman/pkg/bandeps/cmd/bandeps/main.go | 114 + pkg/bufman/pkg/bandeps/key_rwlock.go | 58 + pkg/bufman/pkg/bandeps/state.go | 269 +++ pkg/bufman/pkg/bandeps/util.go | 70 + pkg/bufman/pkg/bandeps/violation.go | 62 + pkg/bufman/pkg/cert/certclient/certclient.go | 65 + pkg/bufman/pkg/cert/certclient/util.go | 69 + pkg/bufman/pkg/command/command.go | 214 ++ pkg/bufman/pkg/command/process.go | 70 + pkg/bufman/pkg/command/runner.go | 132 ++ pkg/bufman/pkg/command/runner_unix_test.go | 53 + pkg/bufman/pkg/connectclient/connectclient.go | 81 + pkg/bufman/pkg/dag/dag.go | 451 ++++ pkg/bufman/pkg/dag/dag_test.go | 502 ++++ pkg/bufman/pkg/diff/diff.go | 202 ++ pkg/bufman/pkg/diff/diffmyers/diffmyers.go | 275 +++ .../pkg/diff/diffmyers/diffmyers_test.go | 231 ++ pkg/bufman/pkg/diff/diffmyers/testdata/create | 2 + pkg/bufman/pkg/diff/diffmyers/testdata/delete | 3 + .../diff/diffmyers/testdata/delete-and-insert | 3 + pkg/bufman/pkg/diff/diffmyers/testdata/equal | 1 + pkg/bufman/pkg/diff/diffmyers/testdata/insert | 3 + .../pkg/diff/diffmyers/testdata/lao-tzu | 18 + pkg/bufman/pkg/diff/diffmyers/testdata/remove | 2 + pkg/bufman/pkg/encoding/encoding.go | 203 ++ pkg/bufman/pkg/encoding/encoding_test.go | 45 + pkg/bufman/pkg/filelock/filelock.go | 96 + pkg/bufman/pkg/filelock/filelock_test.go | 80 + pkg/bufman/pkg/filelock/lock.go | 94 + pkg/bufman/pkg/filelock/locker.go | 77 + pkg/bufman/pkg/filelock/nop_locker.go | 34 + pkg/bufman/pkg/filelock/nop_unlocker.go | 26 + .../pkg/filepathextended/filepathextended.go | 221 ++ .../filepathextended_unix_test.go | 143 ++ .../filepathextended/testdata/base/1.proto | 18 + .../testdata/base/a/b/1.proto | 18 + .../testdata/base/a/b/2.proto | 18 + .../filepathextended/testdata/base/a/b/2.txt | 1 + .../filepathextended/testdata/base/a/bar.yaml | 15 + .../filepathextended/testdata/base/ab/1.proto | 18 + .../filepathextended/testdata/base/ab/2.proto | 18 + .../filepathextended/testdata/base/ab/2.txt | 1 + .../pkg/filepathextended/testdata/link/b | 1 + .../filepathextended/testdata/link/bar.yaml | 16 + .../filepathextended/testdata/link/file.proto | 18 + .../testdata/symlink_loop/a/b | 1 + .../testdata/symlink_loop/b/a | 1 + .../testdata/symlink_loop/file.proto | 18 + .../testdata/symlink_success/1.proto | 16 + .../testdata/symlink_success/a | 1 + .../testdata/symlink_success/ab | 1 + .../testdata/symlink_success/file.proto | 18 + pkg/bufman/pkg/git/annotated_tag.go | 80 + pkg/bufman/pkg/git/branch.go | 46 + pkg/bufman/pkg/git/cloner.go | 399 ++++ .../pkg/git/cmd/git-ls-files-unstaged/main.go | 49 + pkg/bufman/pkg/git/commit.go | 97 + pkg/bufman/pkg/git/commit_test.go | 83 + pkg/bufman/pkg/git/git.go | 320 +++ pkg/bufman/pkg/git/git_test.go | 289 +++ pkg/bufman/pkg/git/gittest/doc.go | 17 + pkg/bufman/pkg/git/gittest/gittest.go | 161 ++ pkg/bufman/pkg/git/hash.go | 67 + pkg/bufman/pkg/git/hash_test.go | 46 + pkg/bufman/pkg/git/ident.go | 90 + pkg/bufman/pkg/git/ident_test.go | 37 + pkg/bufman/pkg/git/lister.go | 132 ++ pkg/bufman/pkg/git/object_reader.go | 173 ++ pkg/bufman/pkg/git/packed_refs.go | 107 + pkg/bufman/pkg/git/packed_refs_test.go | 53 + pkg/bufman/pkg/git/ref.go | 46 + pkg/bufman/pkg/git/ref_branch.go | 59 + pkg/bufman/pkg/git/repository.go | 327 +++ pkg/bufman/pkg/git/repository_test.go | 115 + pkg/bufman/pkg/git/testdata/packed-refs | 10 + pkg/bufman/pkg/git/tree.go | 116 + pkg/bufman/pkg/git/tree_node.go | 87 + pkg/bufman/pkg/git/tree_node_test.go | 77 + pkg/bufman/pkg/git/tree_test.go | 59 + .../github/githubtesting/archive_reader.go | 133 ++ .../pkg/github/githubtesting/githubtesting.go | 59 + pkg/bufman/pkg/httpauth/env_authenticator.go | 47 + pkg/bufman/pkg/httpauth/httpauth.go | 64 + .../pkg/httpauth/multi_authenticator.go | 52 + .../pkg/httpauth/netrc_authenticator.go | 53 + pkg/bufman/pkg/httpauth/nop_authenticator.go | 32 + pkg/bufman/pkg/httpauth/util.go | 51 + pkg/bufman/pkg/interrupt/interrupt.go | 53 + pkg/bufman/pkg/interrupt/interrupt_unix.go | 36 + pkg/bufman/pkg/interrupt/interrupt_windows.go | 29 + pkg/bufman/pkg/ioextended/ioextended.go | 127 + pkg/bufman/pkg/iotesting/iotesting.go | 40 + .../licenseheader/cmd/license-header/main.go | 221 ++ pkg/bufman/pkg/licenseheader/licenseheader.go | 248 ++ .../pkg/licenseheader/licenseheader_test.go | 119 + pkg/bufman/pkg/manifest/digest.go | 139 ++ pkg/bufman/pkg/manifest/digest_test.go | 214 ++ pkg/bufman/pkg/manifest/manifest.go | 255 ++ pkg/bufman/pkg/manifest/manifest_test.go | 280 +++ pkg/bufman/pkg/manifest/module.go | 276 +++ pkg/bufman/pkg/manifest/module_test.go | 374 +++ pkg/bufman/pkg/manifest/storage.go | 194 ++ pkg/bufman/pkg/manifest/storage_test.go | 209 ++ pkg/bufman/pkg/netextended/netextended.go | 105 + .../pkg/netextended/netextended_test.go | 116 + pkg/bufman/pkg/netrc/machine.go | 46 + pkg/bufman/pkg/netrc/netrc.go | 178 ++ pkg/bufman/pkg/netrc/netrc_unix.go | 27 + pkg/bufman/pkg/netrc/netrc_unix_test.go | 290 +++ pkg/bufman/pkg/netrc/netrc_windows.go | 25 + .../pkg/netrc/testdata/unix/home1/.netrc | 4 + .../pkg/netrc/testdata/unix/home2/.netrc | 3 + .../pkg/netrc/testdata/unix/home3/.netrcc | 3 + pkg/bufman/pkg/normalpath/normalpath.go | 374 +++ pkg/bufman/pkg/normalpath/normalpath_test.go | 200 ++ pkg/bufman/pkg/normalpath/normalpath_unix.go | 162 ++ .../pkg/normalpath/normalpath_unix_test.go | 455 ++++ .../pkg/normalpath/normalpath_windows.go | 182 ++ .../pkg/normalpath/normalpath_windows_test.go | 532 +++++ .../pkg/observabilityzap/observabilityzap.go | 46 + .../tracer_provider_closer.go | 47 + .../pkg/observabilityzap/zapexporter.go | 57 + pkg/bufman/pkg/osextended/osextended.go | 47 + .../pkg/protodescriptor/protodescriptor.go | 289 +++ .../pkg/protoencoding/json_marshaler.go | 75 + .../pkg/protoencoding/json_unmarshaler.go | 40 + pkg/bufman/pkg/protoencoding/protoencoding.go | 116 + .../pkg/protoencoding/reparse_unrecognized.go | 77 + pkg/bufman/pkg/protoencoding/resolver.go | 160 ++ .../pkg/protoencoding/wire_marshaler.go | 33 + .../pkg/protoencoding/wire_unmarshaler.go | 37 + pkg/bufman/pkg/protogenutil/named_helper.go | 177 ++ pkg/bufman/pkg/protogenutil/protogenutil.go | 561 +++++ pkg/bufman/pkg/protosource/descriptor.go | 49 + pkg/bufman/pkg/protosource/enum.go | 102 + pkg/bufman/pkg/protosource/enum_range.go | 59 + pkg/bufman/pkg/protosource/enum_value.go | 60 + pkg/bufman/pkg/protosource/field.go | 210 ++ pkg/bufman/pkg/protosource/file.go | 838 +++++++ pkg/bufman/pkg/protosource/file_import.go | 75 + pkg/bufman/pkg/protosource/files.go | 106 + pkg/bufman/pkg/protosource/location.go | 94 + .../pkg/protosource/location_descriptor.go | 36 + pkg/bufman/pkg/protosource/location_store.go | 72 + .../pkg/protosource/merge_comment_location.go | 67 + pkg/bufman/pkg/protosource/message.go | 176 ++ pkg/bufman/pkg/protosource/message_range.go | 95 + pkg/bufman/pkg/protosource/method.go | 114 + .../pkg/protosource/named_descriptor.go | 76 + pkg/bufman/pkg/protosource/oneof.go | 48 + .../option_extension_descriptor.go | 129 + .../option_extension_descriptor_test.go | 145 ++ pkg/bufman/pkg/protosource/paths.go | 310 +++ pkg/bufman/pkg/protosource/protosource.go | 1253 ++++++++++ pkg/bufman/pkg/protosource/reserved_name.go | 41 + pkg/bufman/pkg/protosource/service.go | 48 + pkg/bufman/pkg/protosource/tag_range_test.go | 104 + pkg/bufman/pkg/protostat/protostat.go | 197 ++ .../pkg/protostat/protostatos/file_walker.go | 54 + .../pkg/protostat/protostatos/protostatos.go | 25 + .../protostat/protostatstorage/file_walker.go | 54 + .../protostatstorage/protostatstorage.go | 28 + pkg/bufman/pkg/prototesting/prototesting.go | 262 ++ .../pkg/prototesting/prototesting_unix.go | 34 + .../pkg/prototesting/prototesting_windows.go | 39 + pkg/bufman/pkg/prototime/prototime.go | 32 + .../pkg/protoversion/package_version.go | 205 ++ pkg/bufman/pkg/protoversion/protoversion.go | 89 + .../pkg/protoversion/protoversion_test.go | 98 + pkg/bufman/pkg/spdx/cmd/spdx-go-data/main.go | 134 ++ pkg/bufman/pkg/spdx/cmd/spdx-ts-data/main.go | 146 ++ pkg/bufman/pkg/spdx/spdx.go | 98 + pkg/bufman/pkg/storage/bucket.go | 250 ++ pkg/bufman/pkg/storage/cmd/ddiff/main.go | 79 + .../pkg/storage/cmd/storage-go-data/main.go | 191 ++ pkg/bufman/pkg/storage/copy.go | 175 ++ pkg/bufman/pkg/storage/diff.go | 321 +++ pkg/bufman/pkg/storage/errors.go | 94 + pkg/bufman/pkg/storage/external_paths.go | 80 + pkg/bufman/pkg/storage/limit.go | 93 + pkg/bufman/pkg/storage/map.go | 254 ++ pkg/bufman/pkg/storage/mapper.go | 164 ++ pkg/bufman/pkg/storage/matcher.go | 205 ++ pkg/bufman/pkg/storage/multi.go | 145 ++ pkg/bufman/pkg/storage/storage.go | 22 + .../storage/storagearchive/storagearchive.go | 260 ++ .../storage/storagearchive/untar_options.go | 28 + pkg/bufman/pkg/storage/storagegit/bucket.go | 212 ++ pkg/bufman/pkg/storage/storagegit/doc.go | 17 + pkg/bufman/pkg/storage/storagegit/provider.go | 59 + .../pkg/storage/storagegit/storagegit.go | 61 + .../pkg/storage/storagegit/storagegit_test.go | 82 + pkg/bufman/pkg/storage/storagemem/bucket.go | 160 ++ .../storagemem/internal/immutable_object.go | 58 + .../storage/storagemem/read_object_closer.go | 53 + .../pkg/storage/storagemem/storagemem.go | 49 + .../pkg/storage/storagemem/storagemem_test.go | 73 + .../storage/storagemem/write_object_closer.go | 78 + pkg/bufman/pkg/storage/storageos/bucket.go | 439 ++++ pkg/bufman/pkg/storage/storageos/provider.go | 53 + pkg/bufman/pkg/storage/storageos/storageos.go | 66 + .../pkg/storage/storageos/storageos_test.go | 69 + .../storage/storagetesting/storagetesting.go | 1521 ++++++++++++ .../storagetesting/testdata/base/1.proto | 18 + .../storagetesting/testdata/base/a/b/1.proto | 18 + .../storagetesting/testdata/base/a/b/2.proto | 18 + .../storagetesting/testdata/base/a/b/2.txt | 1 + .../storagetesting/testdata/base/a/bar.yaml | 15 + .../storagetesting/testdata/base/ab/1.proto | 18 + .../storagetesting/testdata/base/ab/2.proto | 18 + .../storagetesting/testdata/base/ab/2.txt | 1 + .../testdata/diff/a/prefix/1.txt | 2 + .../testdata/diff/a/prefix/2.txt | 1 + .../testdata/diff/b/prefix/1.txt | 2 + .../testdata/diff/b/prefix/3.txt | 0 .../storagetesting/testdata/five/root1/foo | 3 + .../testdata/five/root2/foo/bar.proto | 18 + .../testdata/four/root/a/3.proto | 18 + .../testdata/four/root/a/b/1.proto | 18 + .../testdata/four/root/a/b/2.proto | 18 + .../storage/storagetesting/testdata/link/b | 1 + .../storagetesting/testdata/link/bar.yaml | 16 + .../storagetesting/testdata/link/file.proto | 18 + .../storagetesting/testdata/one/root/1.proto | 18 + .../testdata/one/root/a/1.proto | 18 + .../storagetesting/testdata/one/root/a/1.txt | 1 + .../testdata/one/root/a/b/1.proto | 18 + .../testdata/one/root/a/b/2.proto | 18 + .../testdata/one/root/a/b/2.txt | 1 + .../testdata/one/root/a/bar.yaml | 15 + .../testdata/one/root/ab/1.proto | 18 + .../testdata/one/root/ab/2.proto | 18 + .../storagetesting/testdata/one/root/ab/2.txt | 1 + .../testdata/one/root/c/1.proto | 18 + .../storagetesting/testdata/one/root/foo.yaml | 15 + .../storagetesting/testdata/symlink_loop/a/b | 1 + .../storagetesting/testdata/symlink_loop/b/a | 1 + .../testdata/symlink_loop/file.proto | 18 + .../testdata/symlink_success/1.proto | 16 + .../storagetesting/testdata/symlink_success/a | 1 + .../testdata/symlink_success/ab | 1 + .../testdata/symlink_success/file.proto | 18 + .../storagetesting/testdata/three/a/one.proto | 15 + .../storagetesting/testdata/three/a/one.txt | 0 .../storagetesting/testdata/three/b/one.txt | 0 .../storagetesting/testdata/three/b/two.proto | 15 + .../storagetesting/testdata/two/foo.yaml | 15 + .../storagetesting/testdata/two/root1/1.proto | 18 + .../testdata/two/root1/a/1.proto | 18 + .../storagetesting/testdata/two/root1/a/1.txt | 1 + .../testdata/two/root1/a/b/1.proto | 18 + .../testdata/two/root1/a/b/2.proto | 18 + .../testdata/two/root1/a/b/2.txt | 1 + .../testdata/two/root1/a/bar.yaml | 15 + .../testdata/two/root1/ab/1.proto | 18 + .../testdata/two/root1/ab/2.proto | 18 + .../testdata/two/root1/ab/2.txt | 1 + .../testdata/two/root1/c/1.proto | 18 + .../testdata/two/root1/foo.yaml | 15 + .../storagetesting/testdata/two/root2/2.proto | 18 + .../testdata/two/root2/a/2.proto | 18 + .../storagetesting/testdata/two/root2/a/2.txt | 1 + .../testdata/two/root2/a/b/3.proto | 18 + .../testdata/two/root2/a/b/4.proto | 18 + .../testdata/two/root2/a/b/4.txt | 1 + .../testdata/two/root2/a/bat.yaml | 15 + .../testdata/two/root2/ab/3.proto | 18 + .../testdata/two/root2/ab/4.proto | 18 + .../testdata/two/root2/ab/4.txt | 1 + .../testdata/two/root2/baz.yaml | 15 + .../testdata/two/root2/c/3.proto | 18 + .../testdata/two/rootoverlap/1.proto | 18 + .../testdata/two/rootoverlap/a/1.proto | 18 + .../testdata/two/rootoverlap/a/1.txt | 1 + .../testdata/two/rootoverlap/a/b/1.proto | 18 + .../testdata/two/rootoverlap/a/b/2.proto | 18 + .../testdata/two/rootoverlap/a/b/2.txt | 1 + .../testdata/two/rootoverlap/a/bar.yaml | 15 + .../testdata/two/rootoverlap/ab/1.proto | 18 + .../testdata/two/rootoverlap/ab/2.proto | 18 + .../testdata/two/rootoverlap/ab/2.txt | 1 + .../testdata/two/rootoverlap/c/1.proto | 18 + .../testdata/two/rootoverlap/foo.yaml | 15 + .../pkg/storage/storageutil/storageutil.go | 100 + pkg/bufman/pkg/storage/util.go | 172 ++ pkg/bufman/pkg/stringjson/stringjson.go | 65 + pkg/bufman/pkg/stringutil/stringutil.go | 333 +++ pkg/bufman/pkg/stringutil/stringutil_test.go | 377 +++ .../pkg/testingextended/testingextended.go | 36 + pkg/bufman/pkg/thread/thread.go | 148 ++ pkg/bufman/pkg/thread/thread_test.go | 63 + pkg/bufman/pkg/tmp/tmp.go | 180 ++ pkg/bufman/pkg/tmp/tmp_test.go | 51 + .../pkg/transport/http/httpclient/client.go | 30 + .../transport/http/httpclient/httpclient.go | 26 + .../transport/http/httpserver/httpserver.go | 177 ++ pkg/bufman/pkg/uuidutil/uuidutil.go | 96 + pkg/bufman/pkg/uuidutil/uuidutil_test.go | 100 + pkg/bufman/pkg/verbose/verbose.go | 74 + pkg/bufman/pkg/zaputil/vars.go | 67 + pkg/bufman/pkg/zaputil/zaputil.go | 54 + 1214 files changed, 107915 insertions(+) create mode 100644 pkg/bufman/bufpkg/bufanalysis/bufanalysis.go create mode 100644 pkg/bufman/bufpkg/bufanalysis/bufanalysistesting/bufanalysistesting.go create mode 100644 pkg/bufman/bufpkg/bufanalysis/bufanalysistesting/bufanalysistesting_test.go create mode 100644 pkg/bufman/bufpkg/bufanalysis/file_annotation.go create mode 100644 pkg/bufman/bufpkg/bufanalysis/print.go create mode 100644 pkg/bufman/bufpkg/bufanalysis/util.go create mode 100644 pkg/bufman/bufpkg/bufapimodule/bufapimodule.go create mode 100644 pkg/bufman/bufpkg/bufapimodule/module_reader.go create mode 100644 pkg/bufman/bufpkg/bufapimodule/module_reader_test.go create mode 100644 pkg/bufman/bufpkg/bufapimodule/module_resolver.go create mode 100644 pkg/bufman/bufpkg/bufapimodule/module_resolver_test.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking_test.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig/bufbreakingconfig.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/handler.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingbuild/bufbreakingbuild.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/bufbreakingcheck.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/util.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/bufbreakingv1.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/bufbreakingv1_test.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/vars.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/bufbreakingv1beta1.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/bufbreakingv1beta1_test.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/vars.go create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/sub/a/b/sub_a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/sub/a/b/sub_a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/a/v1beta1/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/sub/a/b/sub_a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_compatible_type/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_json_compatible_type/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/sub/a/b/sub_a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/c/c.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/sub/a/b/sub_a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/sub/a/b/sub_a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/a1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/b1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/c.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/bufcheck.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/buflint.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/buflint_test.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig/buflintconfig.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/handler.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintbuild/buflintbuild.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck/buflintcheck.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck/util.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/buflintv1.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/buflintv1_test.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/vars.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/buflintv1beta1.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/buflintv1beta1_test.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/vars.go create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/c.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/d.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/B.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/Foo.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.txt create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c_.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/fooBar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/buf.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/bar/bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/baz/baz.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/buf.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/buf.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/bar/bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/baz/baz.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/buf.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/buf.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/bar/bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/baz/baz.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/buf.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/buf.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/bar/bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/baz/baz.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/buf.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/one/one.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/one/one.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/one/one.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/a/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_c.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/sub/a/b/a_b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/3.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/4.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/5.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/6.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/7.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/8.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/one/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/one/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v0beta1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1beta1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test_foo.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1testfoo.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2beta0.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_vv1beta1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/no_package.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/v1.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/b.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a2.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a3.proto create mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufcheck/internal/config.go create mode 100644 pkg/bufman/bufpkg/bufcheck/internal/helper.go create mode 100644 pkg/bufman/bufpkg/bufcheck/internal/internaltesting/internaltesting.go create mode 100644 pkg/bufman/bufpkg/bufcheck/internal/rule.go create mode 100644 pkg/bufman/bufpkg/bufcheck/internal/rule_builder.go create mode 100644 pkg/bufman/bufpkg/bufcheck/internal/runner.go create mode 100644 pkg/bufman/bufpkg/bufcheck/internal/vars.go create mode 100644 pkg/bufman/bufpkg/bufcheck/internal/version_spec.go create mode 100644 pkg/bufman/bufpkg/bufconfig/bufconfig.go create mode 100644 pkg/bufman/bufpkg/bufconfig/config.go create mode 100644 pkg/bufman/bufpkg/bufconfig/get.go create mode 100644 pkg/bufman/bufpkg/bufconfig/read.go create mode 100644 pkg/bufman/bufpkg/bufconfig/write.go create mode 100644 pkg/bufman/bufpkg/bufconfig/write_test.go create mode 100644 pkg/bufman/bufpkg/bufconnect/bufconnect.go create mode 100644 pkg/bufman/bufpkg/bufconnect/errors.go create mode 100644 pkg/bufman/bufpkg/bufconnect/errors_test.go create mode 100644 pkg/bufman/bufpkg/bufconnect/interceptors.go create mode 100644 pkg/bufman/bufpkg/bufconnect/interceptors_test.go create mode 100644 pkg/bufman/bufpkg/bufconnect/netrc_token_provider.go create mode 100644 pkg/bufman/bufpkg/bufconnect/static_token_provider.go create mode 100644 pkg/bufman/bufpkg/bufconnect/static_token_provider_test.go create mode 100644 pkg/bufman/bufpkg/bufgraph/bufgraph.go create mode 100644 pkg/bufman/bufpkg/bufgraph/bufgraph_test.go create mode 100644 pkg/bufman/bufpkg/bufgraph/builder.go create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/buf.work.yaml create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a/v1/a.proto create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a2/v1/a2.proto create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/b/v1/b.proto create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/c/v1/c.proto create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/d/v1/d.proto create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/e/v1/e.proto create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/f/v1/f.proto create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/buf.yaml create mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/g/v1/g.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimage.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuild.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting_unix_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/alloptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ccoptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores_cascade.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comments.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/csharpoptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptions1.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptionserror1.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/directory_same_package.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/empty.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/emptyoptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_first_value_zero.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_pascal_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_prefix.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_upper_snake_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix_custom.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex1.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex2.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex3.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_lower_snake_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_no_descriptor.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/file_lower_snake_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_public.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_weak.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_used.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/javaoptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/jsoptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/message_pascal_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/objcoptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/oneof_lower_snake_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/optionpanic.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_defined.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_directory_match.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_lower_snake_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory_no_package.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_option_value.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_version_suffix.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/packageversion.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/phpoptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/proto3optional1.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_no_streaming.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_pascal_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name_allow_empty.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rubyoptions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/semicolons.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_pascal_case.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix_custom.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/simple.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/syntax_specified.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/test.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/wktimport.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/builder.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_unix_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptions1/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/b.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/a/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/b/b.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a1.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a2.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/notamessagetype/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/options/option.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/proto/test.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/proto3optional1/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/semicolons/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/spacebetweennumberandid/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/trailingcomments/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/file_option_sweeper.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/multi_modifier.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/alloptions/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/b.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/double/csharp.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/csharp.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/override.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/triple/csharp.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/underscore/csharp.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/emptyoptions/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaemptyoptions/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/java_file.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/override.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/jsoptions/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/double/objc.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/gpb/objc.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/objc.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/override.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/triple/objc.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/unversioned/objc.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/b.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/double/php.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/reserved/php.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/override.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/php.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/triple/php.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/underscore/php.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/double/ruby.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/override.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/ruby.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/triple/ruby.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/underscore/ruby.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/wktimport/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/image_index.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/input_file.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/tags.go create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/b.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/b.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions-excluded.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/noimports.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/public.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_public.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_weak.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak_public.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/enum.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/message.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/recursenested.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/usingother.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/Files.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/a.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-exclude-options.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-with-Files.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/options.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.Foo.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooEnum.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.Do.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/bar.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz1.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz2.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.baz.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/nopackage.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/options.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/other.proto create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/root.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Bar.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Baz.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Do.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo+Ext.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/NestedFoo.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Quz.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Svc.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/all.txtar create mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/test.proto create mode 100644 pkg/bufman/bufpkg/bufimage/image.go create mode 100644 pkg/bufman/bufpkg/bufimage/image_file.go create mode 100644 pkg/bufman/bufpkg/bufimage/image_module_dependency.go create mode 100644 pkg/bufman/bufpkg/bufimage/image_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/import_tracker.go create mode 100644 pkg/bufman/bufpkg/bufimage/util.go create mode 100644 pkg/bufman/bufpkg/bufimage/util_test.go create mode 100644 pkg/bufman/bufpkg/bufimage/validate.go create mode 100644 pkg/bufman/bufpkg/buflock/buflock.go create mode 100644 pkg/bufman/bufpkg/buflock/buflock_test.go create mode 100644 pkg/bufman/bufpkg/buflock/lock_file.go create mode 100644 pkg/bufman/bufpkg/buflock/testdata/v1/failure/buf.lock create mode 100644 pkg/bufman/bufpkg/buflock/testdata/v1/success/buf.lock create mode 100644 pkg/bufman/bufpkg/buflock/testdata/v1beta1/failure/buf.lock create mode 100644 pkg/bufman/bufpkg/buflock/testdata/v1beta1/success/buf.lock create mode 100644 pkg/bufman/bufpkg/bufmanifest/bucket.go create mode 100644 pkg/bufman/bufpkg/bufmanifest/bufmanifest.go create mode 100644 pkg/bufman/bufpkg/bufmanifest/mapper.go create mode 100644 pkg/bufman/bufpkg/bufmanifest/mapper_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodule.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/bufmodulebuild.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_unix_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_file_set_builder.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/2.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/3.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/2.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/3.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/2.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/3.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/2.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/3.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/2.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/3.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/4.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/5.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/3/nop create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/buf.md create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/a/2.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/LICENSE create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/a/2.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/LICENSE create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/1.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/a/2.proto create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/util.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulecache/bufmodulecache.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulecache/cache_stats.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_cacher.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_reader.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_reader_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/bufmoduleconfig.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/config.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/config_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile/bufmoduleprotocompile.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile/path_resolver.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/bufmoduleref.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/bufmoduleref_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/file_info.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_identity.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_owner.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_owner_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_pin.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_pin_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_reference.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_reference_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/util.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/validate.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduleref/validate_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulestat/bufmodulestat.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulestat/file_walker.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_unix.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_windows.go create mode 100644 pkg/bufman/bufpkg/bufmodule/bufmoduletesting/test_module_reader.go create mode 100644 pkg/bufman/bufpkg/bufmodule/internal/internal.go create mode 100644 pkg/bufman/bufpkg/bufmodule/internal/internal_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/module.go create mode 100644 pkg/bufman/bufpkg/bufmodule/module_file.go create mode 100644 pkg/bufman/bufpkg/bufmodule/module_file_set.go create mode 100644 pkg/bufman/bufpkg/bufmodule/module_object_info.go create mode 100644 pkg/bufman/bufpkg/bufmodule/module_read_bucket.go create mode 100644 pkg/bufman/bufpkg/bufmodule/module_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/multi_module_read_bucket.go create mode 100644 pkg/bufman/bufpkg/bufmodule/nop_module_reader.go create mode 100644 pkg/bufman/bufpkg/bufmodule/nop_module_resolver.go create mode 100644 pkg/bufman/bufpkg/bufmodule/single_module_read_bucket.go create mode 100644 pkg/bufman/bufpkg/bufmodule/targeting_module.go create mode 100644 pkg/bufman/bufpkg/bufmodule/targeting_module_test.go create mode 100644 pkg/bufman/bufpkg/bufmodule/util.go create mode 100644 pkg/bufman/bufpkg/bufmodule/validate.go create mode 100644 pkg/bufman/bufpkg/bufmodule/workspace.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugin.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugin_test.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/config.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/get.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-plugin-version.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-version.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-multiple-registries.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-plugin-version.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go-empty-registry/buf.plugin.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go/buf.plugin.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/maven/buf.plugin.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/npm/buf.plugin.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/options/buf.plugin.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/swift/buf.plugin.yaml create mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/bufplugindocker.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker_test.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config_test.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginref/bufpluginref.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginref/bufpluginref_test.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginref/plugin_identity.go create mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginref/plugin_reference.go create mode 100644 pkg/bufman/bufpkg/bufplugin/plugin.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/binary_handler.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/bufpluginexec.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/bufpluginexec_go18.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/bufpluginexec_go19.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/generator.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/normalize.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/normalize_test.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/protoc_gen_swift_stderr_write_closer.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/protoc_proxy_handler.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/util.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/util_darwin.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/util_undarwin.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/version.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/version_test.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/wasm_handler.go create mode 100644 pkg/bufman/bufpkg/bufpluginexec/wasm_handler_test.go create mode 100644 pkg/bufman/bufpkg/bufreflect/bufreflect.go create mode 100644 pkg/bufman/bufpkg/bufremoteplugin/bufremoteplugin.go create mode 100644 pkg/bufman/bufpkg/bufstudioagent/buffer_codec.go create mode 100644 pkg/bufman/bufpkg/bufstudioagent/bufstudioagent.go create mode 100644 pkg/bufman/bufpkg/bufstudioagent/bufstudioagent_test.go create mode 100644 pkg/bufman/bufpkg/bufstudioagent/plain_post_handler.go create mode 100644 pkg/bufman/bufpkg/bufstyle/analyzer_provider.go create mode 100644 pkg/bufman/bufpkg/bufstyle/analyzers.go create mode 100644 pkg/bufman/bufpkg/bufstyle/bufstyle.go create mode 100644 pkg/bufman/bufpkg/bufstyle/cmd/bufstyle/main.go create mode 100644 pkg/bufman/bufpkg/buftesting/buftesting.go create mode 100644 pkg/bufman/bufpkg/buftransport/buftransport.go create mode 100644 pkg/bufman/bufpkg/bufwasm/bufwasm.go create mode 100644 pkg/bufman/bufpkg/bufwasm/bufwasm_test.go create mode 100644 pkg/bufman/bufpkg/bufwasm/testdata/echo.wasm create mode 100644 pkg/bufman/bufpkg/bufwasm/testdata/echo.wat create mode 100644 pkg/bufman/bufpkg/bufwkt/cmd/wkt-go-data/main.go create mode 100644 pkg/bufman/pkg/app/app.go create mode 100644 pkg/bufman/pkg/app/app_error.go create mode 100644 pkg/bufman/pkg/app/app_test.go create mode 100644 pkg/bufman/pkg/app/app_unix.go create mode 100644 pkg/bufman/pkg/app/app_windows.go create mode 100644 pkg/bufman/pkg/app/appcmd/appcmd.go create mode 100644 pkg/bufman/pkg/app/appcmd/appcmd_test.go create mode 100644 pkg/bufman/pkg/app/appcmd/appcmdtesting/appcmdtesting.go create mode 100644 pkg/bufman/pkg/app/appcmd/cobra.go create mode 100644 pkg/bufman/pkg/app/appcmd/error.go create mode 100644 pkg/bufman/pkg/app/appcmd/webpages.go create mode 100644 pkg/bufman/pkg/app/appflag/appflag.go create mode 100644 pkg/bufman/pkg/app/appflag/builder.go create mode 100644 pkg/bufman/pkg/app/appflag/container.go create mode 100644 pkg/bufman/pkg/app/applog/applog.go create mode 100644 pkg/bufman/pkg/app/applog/applog_test.go create mode 100644 pkg/bufman/pkg/app/applog/container.go create mode 100644 pkg/bufman/pkg/app/appname/appname.go create mode 100644 pkg/bufman/pkg/app/appname/appname_unix_test.go create mode 100644 pkg/bufman/pkg/app/appname/container.go create mode 100644 pkg/bufman/pkg/app/appproto/appproto.go create mode 100644 pkg/bufman/pkg/app/appproto/appproto_test.go create mode 100644 pkg/bufman/pkg/app/appproto/appprotoos/appprotoos.go create mode 100644 pkg/bufman/pkg/app/appproto/appprotoos/response_writer.go create mode 100644 pkg/bufman/pkg/app/appproto/generator.go create mode 100644 pkg/bufman/pkg/app/appproto/response_builder.go create mode 100644 pkg/bufman/pkg/app/appproto/response_writer.go create mode 100644 pkg/bufman/pkg/app/appverbose/appverbose.go create mode 100644 pkg/bufman/pkg/app/appverbose/container.go create mode 100644 pkg/bufman/pkg/app/arg_container.go create mode 100644 pkg/bufman/pkg/app/container.go create mode 100644 pkg/bufman/pkg/app/env_container.go create mode 100644 pkg/bufman/pkg/app/stderr_container.go create mode 100644 pkg/bufman/pkg/app/stdin_container.go create mode 100644 pkg/bufman/pkg/app/stdout_container.go create mode 100644 pkg/bufman/pkg/bandeps/bandeps.go create mode 100644 pkg/bufman/pkg/bandeps/checker.go create mode 100644 pkg/bufman/pkg/bandeps/cmd/bandeps/main.go create mode 100644 pkg/bufman/pkg/bandeps/key_rwlock.go create mode 100644 pkg/bufman/pkg/bandeps/state.go create mode 100644 pkg/bufman/pkg/bandeps/util.go create mode 100644 pkg/bufman/pkg/bandeps/violation.go create mode 100644 pkg/bufman/pkg/cert/certclient/certclient.go create mode 100644 pkg/bufman/pkg/cert/certclient/util.go create mode 100644 pkg/bufman/pkg/command/command.go create mode 100644 pkg/bufman/pkg/command/process.go create mode 100644 pkg/bufman/pkg/command/runner.go create mode 100644 pkg/bufman/pkg/command/runner_unix_test.go create mode 100644 pkg/bufman/pkg/connectclient/connectclient.go create mode 100644 pkg/bufman/pkg/dag/dag.go create mode 100644 pkg/bufman/pkg/dag/dag_test.go create mode 100644 pkg/bufman/pkg/diff/diff.go create mode 100644 pkg/bufman/pkg/diff/diffmyers/diffmyers.go create mode 100644 pkg/bufman/pkg/diff/diffmyers/diffmyers_test.go create mode 100644 pkg/bufman/pkg/diff/diffmyers/testdata/create create mode 100644 pkg/bufman/pkg/diff/diffmyers/testdata/delete create mode 100644 pkg/bufman/pkg/diff/diffmyers/testdata/delete-and-insert create mode 100644 pkg/bufman/pkg/diff/diffmyers/testdata/equal create mode 100644 pkg/bufman/pkg/diff/diffmyers/testdata/insert create mode 100644 pkg/bufman/pkg/diff/diffmyers/testdata/lao-tzu create mode 100644 pkg/bufman/pkg/diff/diffmyers/testdata/remove create mode 100644 pkg/bufman/pkg/encoding/encoding.go create mode 100644 pkg/bufman/pkg/encoding/encoding_test.go create mode 100644 pkg/bufman/pkg/filelock/filelock.go create mode 100644 pkg/bufman/pkg/filelock/filelock_test.go create mode 100644 pkg/bufman/pkg/filelock/lock.go create mode 100644 pkg/bufman/pkg/filelock/locker.go create mode 100644 pkg/bufman/pkg/filelock/nop_locker.go create mode 100644 pkg/bufman/pkg/filelock/nop_unlocker.go create mode 100644 pkg/bufman/pkg/filepathextended/filepathextended.go create mode 100644 pkg/bufman/pkg/filepathextended/filepathextended_unix_test.go create mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/1.proto create mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/a/b/1.proto create mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.proto create mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.txt create mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/a/bar.yaml create mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/ab/1.proto create mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/ab/2.proto create mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/ab/2.txt create mode 100644 pkg/bufman/pkg/filepathextended/testdata/link/b create mode 100644 pkg/bufman/pkg/filepathextended/testdata/link/bar.yaml create mode 100644 pkg/bufman/pkg/filepathextended/testdata/link/file.proto create mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_loop/a/b create mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_loop/b/a create mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_loop/file.proto create mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_success/1.proto create mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_success/a create mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_success/ab create mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_success/file.proto create mode 100644 pkg/bufman/pkg/git/annotated_tag.go create mode 100644 pkg/bufman/pkg/git/branch.go create mode 100644 pkg/bufman/pkg/git/cloner.go create mode 100644 pkg/bufman/pkg/git/cmd/git-ls-files-unstaged/main.go create mode 100644 pkg/bufman/pkg/git/commit.go create mode 100644 pkg/bufman/pkg/git/commit_test.go create mode 100644 pkg/bufman/pkg/git/git.go create mode 100644 pkg/bufman/pkg/git/git_test.go create mode 100644 pkg/bufman/pkg/git/gittest/doc.go create mode 100644 pkg/bufman/pkg/git/gittest/gittest.go create mode 100644 pkg/bufman/pkg/git/hash.go create mode 100644 pkg/bufman/pkg/git/hash_test.go create mode 100644 pkg/bufman/pkg/git/ident.go create mode 100644 pkg/bufman/pkg/git/ident_test.go create mode 100644 pkg/bufman/pkg/git/lister.go create mode 100644 pkg/bufman/pkg/git/object_reader.go create mode 100644 pkg/bufman/pkg/git/packed_refs.go create mode 100644 pkg/bufman/pkg/git/packed_refs_test.go create mode 100644 pkg/bufman/pkg/git/ref.go create mode 100644 pkg/bufman/pkg/git/ref_branch.go create mode 100644 pkg/bufman/pkg/git/repository.go create mode 100644 pkg/bufman/pkg/git/repository_test.go create mode 100644 pkg/bufman/pkg/git/testdata/packed-refs create mode 100644 pkg/bufman/pkg/git/tree.go create mode 100644 pkg/bufman/pkg/git/tree_node.go create mode 100644 pkg/bufman/pkg/git/tree_node_test.go create mode 100644 pkg/bufman/pkg/git/tree_test.go create mode 100644 pkg/bufman/pkg/github/githubtesting/archive_reader.go create mode 100644 pkg/bufman/pkg/github/githubtesting/githubtesting.go create mode 100644 pkg/bufman/pkg/httpauth/env_authenticator.go create mode 100644 pkg/bufman/pkg/httpauth/httpauth.go create mode 100644 pkg/bufman/pkg/httpauth/multi_authenticator.go create mode 100644 pkg/bufman/pkg/httpauth/netrc_authenticator.go create mode 100644 pkg/bufman/pkg/httpauth/nop_authenticator.go create mode 100644 pkg/bufman/pkg/httpauth/util.go create mode 100644 pkg/bufman/pkg/interrupt/interrupt.go create mode 100644 pkg/bufman/pkg/interrupt/interrupt_unix.go create mode 100644 pkg/bufman/pkg/interrupt/interrupt_windows.go create mode 100644 pkg/bufman/pkg/ioextended/ioextended.go create mode 100644 pkg/bufman/pkg/iotesting/iotesting.go create mode 100644 pkg/bufman/pkg/licenseheader/cmd/license-header/main.go create mode 100644 pkg/bufman/pkg/licenseheader/licenseheader.go create mode 100644 pkg/bufman/pkg/licenseheader/licenseheader_test.go create mode 100644 pkg/bufman/pkg/manifest/digest.go create mode 100644 pkg/bufman/pkg/manifest/digest_test.go create mode 100644 pkg/bufman/pkg/manifest/manifest.go create mode 100644 pkg/bufman/pkg/manifest/manifest_test.go create mode 100644 pkg/bufman/pkg/manifest/module.go create mode 100644 pkg/bufman/pkg/manifest/module_test.go create mode 100644 pkg/bufman/pkg/manifest/storage.go create mode 100644 pkg/bufman/pkg/manifest/storage_test.go create mode 100644 pkg/bufman/pkg/netextended/netextended.go create mode 100644 pkg/bufman/pkg/netextended/netextended_test.go create mode 100644 pkg/bufman/pkg/netrc/machine.go create mode 100644 pkg/bufman/pkg/netrc/netrc.go create mode 100644 pkg/bufman/pkg/netrc/netrc_unix.go create mode 100644 pkg/bufman/pkg/netrc/netrc_unix_test.go create mode 100644 pkg/bufman/pkg/netrc/netrc_windows.go create mode 100644 pkg/bufman/pkg/netrc/testdata/unix/home1/.netrc create mode 100644 pkg/bufman/pkg/netrc/testdata/unix/home2/.netrc create mode 100644 pkg/bufman/pkg/netrc/testdata/unix/home3/.netrcc create mode 100644 pkg/bufman/pkg/normalpath/normalpath.go create mode 100644 pkg/bufman/pkg/normalpath/normalpath_test.go create mode 100644 pkg/bufman/pkg/normalpath/normalpath_unix.go create mode 100644 pkg/bufman/pkg/normalpath/normalpath_unix_test.go create mode 100644 pkg/bufman/pkg/normalpath/normalpath_windows.go create mode 100644 pkg/bufman/pkg/normalpath/normalpath_windows_test.go create mode 100644 pkg/bufman/pkg/observabilityzap/observabilityzap.go create mode 100644 pkg/bufman/pkg/observabilityzap/tracer_provider_closer.go create mode 100644 pkg/bufman/pkg/observabilityzap/zapexporter.go create mode 100644 pkg/bufman/pkg/osextended/osextended.go create mode 100644 pkg/bufman/pkg/protodescriptor/protodescriptor.go create mode 100644 pkg/bufman/pkg/protoencoding/json_marshaler.go create mode 100644 pkg/bufman/pkg/protoencoding/json_unmarshaler.go create mode 100644 pkg/bufman/pkg/protoencoding/protoencoding.go create mode 100644 pkg/bufman/pkg/protoencoding/reparse_unrecognized.go create mode 100644 pkg/bufman/pkg/protoencoding/resolver.go create mode 100644 pkg/bufman/pkg/protoencoding/wire_marshaler.go create mode 100644 pkg/bufman/pkg/protoencoding/wire_unmarshaler.go create mode 100644 pkg/bufman/pkg/protogenutil/named_helper.go create mode 100644 pkg/bufman/pkg/protogenutil/protogenutil.go create mode 100644 pkg/bufman/pkg/protosource/descriptor.go create mode 100644 pkg/bufman/pkg/protosource/enum.go create mode 100644 pkg/bufman/pkg/protosource/enum_range.go create mode 100644 pkg/bufman/pkg/protosource/enum_value.go create mode 100644 pkg/bufman/pkg/protosource/field.go create mode 100644 pkg/bufman/pkg/protosource/file.go create mode 100644 pkg/bufman/pkg/protosource/file_import.go create mode 100644 pkg/bufman/pkg/protosource/files.go create mode 100644 pkg/bufman/pkg/protosource/location.go create mode 100644 pkg/bufman/pkg/protosource/location_descriptor.go create mode 100644 pkg/bufman/pkg/protosource/location_store.go create mode 100644 pkg/bufman/pkg/protosource/merge_comment_location.go create mode 100644 pkg/bufman/pkg/protosource/message.go create mode 100644 pkg/bufman/pkg/protosource/message_range.go create mode 100644 pkg/bufman/pkg/protosource/method.go create mode 100644 pkg/bufman/pkg/protosource/named_descriptor.go create mode 100644 pkg/bufman/pkg/protosource/oneof.go create mode 100644 pkg/bufman/pkg/protosource/option_extension_descriptor.go create mode 100644 pkg/bufman/pkg/protosource/option_extension_descriptor_test.go create mode 100644 pkg/bufman/pkg/protosource/paths.go create mode 100644 pkg/bufman/pkg/protosource/protosource.go create mode 100644 pkg/bufman/pkg/protosource/reserved_name.go create mode 100644 pkg/bufman/pkg/protosource/service.go create mode 100644 pkg/bufman/pkg/protosource/tag_range_test.go create mode 100644 pkg/bufman/pkg/protostat/protostat.go create mode 100644 pkg/bufman/pkg/protostat/protostatos/file_walker.go create mode 100644 pkg/bufman/pkg/protostat/protostatos/protostatos.go create mode 100644 pkg/bufman/pkg/protostat/protostatstorage/file_walker.go create mode 100644 pkg/bufman/pkg/protostat/protostatstorage/protostatstorage.go create mode 100644 pkg/bufman/pkg/prototesting/prototesting.go create mode 100644 pkg/bufman/pkg/prototesting/prototesting_unix.go create mode 100644 pkg/bufman/pkg/prototesting/prototesting_windows.go create mode 100644 pkg/bufman/pkg/prototime/prototime.go create mode 100644 pkg/bufman/pkg/protoversion/package_version.go create mode 100644 pkg/bufman/pkg/protoversion/protoversion.go create mode 100644 pkg/bufman/pkg/protoversion/protoversion_test.go create mode 100644 pkg/bufman/pkg/spdx/cmd/spdx-go-data/main.go create mode 100644 pkg/bufman/pkg/spdx/cmd/spdx-ts-data/main.go create mode 100644 pkg/bufman/pkg/spdx/spdx.go create mode 100644 pkg/bufman/pkg/storage/bucket.go create mode 100644 pkg/bufman/pkg/storage/cmd/ddiff/main.go create mode 100644 pkg/bufman/pkg/storage/cmd/storage-go-data/main.go create mode 100644 pkg/bufman/pkg/storage/copy.go create mode 100644 pkg/bufman/pkg/storage/diff.go create mode 100644 pkg/bufman/pkg/storage/errors.go create mode 100644 pkg/bufman/pkg/storage/external_paths.go create mode 100644 pkg/bufman/pkg/storage/limit.go create mode 100644 pkg/bufman/pkg/storage/map.go create mode 100644 pkg/bufman/pkg/storage/mapper.go create mode 100644 pkg/bufman/pkg/storage/matcher.go create mode 100644 pkg/bufman/pkg/storage/multi.go create mode 100644 pkg/bufman/pkg/storage/storage.go create mode 100644 pkg/bufman/pkg/storage/storagearchive/storagearchive.go create mode 100644 pkg/bufman/pkg/storage/storagearchive/untar_options.go create mode 100644 pkg/bufman/pkg/storage/storagegit/bucket.go create mode 100644 pkg/bufman/pkg/storage/storagegit/doc.go create mode 100644 pkg/bufman/pkg/storage/storagegit/provider.go create mode 100644 pkg/bufman/pkg/storage/storagegit/storagegit.go create mode 100644 pkg/bufman/pkg/storage/storagegit/storagegit_test.go create mode 100644 pkg/bufman/pkg/storage/storagemem/bucket.go create mode 100644 pkg/bufman/pkg/storage/storagemem/internal/immutable_object.go create mode 100644 pkg/bufman/pkg/storage/storagemem/read_object_closer.go create mode 100644 pkg/bufman/pkg/storage/storagemem/storagemem.go create mode 100644 pkg/bufman/pkg/storage/storagemem/storagemem_test.go create mode 100644 pkg/bufman/pkg/storage/storagemem/write_object_closer.go create mode 100644 pkg/bufman/pkg/storage/storageos/bucket.go create mode 100644 pkg/bufman/pkg/storage/storageos/provider.go create mode 100644 pkg/bufman/pkg/storage/storageos/storageos.go create mode 100644 pkg/bufman/pkg/storage/storageos/storageos_test.go create mode 100644 pkg/bufman/pkg/storage/storagetesting/storagetesting.go create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/a/bar.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/1.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/1.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/3.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/five/root1/foo create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/five/root2/foo/bar.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/3.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/link/b create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/link/bar.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/link/file.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/bar.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/c/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/foo.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/a/b create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/b/a create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/file.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/a create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/ab create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/file.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/three/b/one.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/three/b/two.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/foo.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/bar.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/c/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/foo.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/3.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/bat.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/3.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/baz.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/c/3.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/bar.yaml create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.txt create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/c/1.proto create mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/foo.yaml create mode 100644 pkg/bufman/pkg/storage/storageutil/storageutil.go create mode 100644 pkg/bufman/pkg/storage/util.go create mode 100644 pkg/bufman/pkg/stringjson/stringjson.go create mode 100644 pkg/bufman/pkg/stringutil/stringutil.go create mode 100644 pkg/bufman/pkg/stringutil/stringutil_test.go create mode 100644 pkg/bufman/pkg/testingextended/testingextended.go create mode 100644 pkg/bufman/pkg/thread/thread.go create mode 100644 pkg/bufman/pkg/thread/thread_test.go create mode 100644 pkg/bufman/pkg/tmp/tmp.go create mode 100644 pkg/bufman/pkg/tmp/tmp_test.go create mode 100644 pkg/bufman/pkg/transport/http/httpclient/client.go create mode 100644 pkg/bufman/pkg/transport/http/httpclient/httpclient.go create mode 100644 pkg/bufman/pkg/transport/http/httpserver/httpserver.go create mode 100644 pkg/bufman/pkg/uuidutil/uuidutil.go create mode 100644 pkg/bufman/pkg/uuidutil/uuidutil_test.go create mode 100644 pkg/bufman/pkg/verbose/verbose.go create mode 100644 pkg/bufman/pkg/zaputil/vars.go create mode 100644 pkg/bufman/pkg/zaputil/zaputil.go diff --git a/pkg/bufman/bufpkg/bufanalysis/bufanalysis.go b/pkg/bufman/bufpkg/bufanalysis/bufanalysis.go new file mode 100644 index 000000000..43577e426 --- /dev/null +++ b/pkg/bufman/bufpkg/bufanalysis/bufanalysis.go @@ -0,0 +1,316 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufanalysis + +import ( + "crypto/sha256" + "fmt" + "io" + "sort" + "strconv" + "strings" +) + +const ( + // FormatText is the text format for FileAnnotations. + FormatText Format = iota + 1 + // FormatJSON is the JSON format for FileAnnotations. + FormatJSON + // FormatMSVS is the MSVS format for FileAnnotations. + FormatMSVS + // FormatJUnit is the JUnit format for FileAnnotations. + FormatJUnit + // FormatGithubActions is the Github Actions format for FileAnnotations. + // + // See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message. + FormatGithubActions +) + +var ( + // AllFormatStrings is all format strings without aliases. + // + // Sorted in the order we want to display them. + AllFormatStrings = []string{ + "text", + "json", + "msvs", + "junit", + "github-actions", + } + // AllFormatStringsWithAliases is all format strings with aliases. + // + // Sorted in the order we want to display them. + AllFormatStringsWithAliases = []string{ + "text", + "gcc", + "json", + "msvs", + "junit", + "github-actions", + } + + stringToFormat = map[string]Format{ + "text": FormatText, + // alias for text + "gcc": FormatText, + "json": FormatJSON, + "msvs": FormatMSVS, + "junit": FormatJUnit, + "github-actions": FormatGithubActions, + } + formatToString = map[Format]string{ + FormatText: "text", + FormatJSON: "json", + FormatMSVS: "msvs", + FormatJUnit: "junit", + FormatGithubActions: "github-actions", + } +) + +// Format is a FileAnnotation format. +type Format int + +// String implements fmt.Stringer. +func (f Format) String() string { + s, ok := formatToString[f] + if !ok { + return strconv.Itoa(int(f)) + } + return s +} + +// ParseFormat parses the Format. +// +// The empty strings defaults to FormatText. +func ParseFormat(s string) (Format, error) { + s = strings.ToLower(strings.TrimSpace(s)) + if s == "" { + return FormatText, nil + } + f, ok := stringToFormat[s] + if ok { + return f, nil + } + return 0, fmt.Errorf("unknown format: %q", s) +} + +// FileInfo is a minimal FileInfo interface. +type FileInfo interface { + Path() string + ExternalPath() string +} + +// FileAnnotation is a file annotation. +type FileAnnotation interface { + // Stringer returns the string representation of this annotation. + fmt.Stringer + + // FileInfo is the FileInfo for this annotation. + // + // This may be nil. + FileInfo() FileInfo + + // StartLine is the starting line. + // + // If the starting line is not known, this will be 0. + StartLine() int + // StartColumn is the starting column. + // + // If the starting column is not known, this will be 0. + StartColumn() int + // EndLine is the ending line. + // + // If the ending line is not known, this will be 0. + // If the ending line is the same as the starting line, this will be explicitly + // set to the same value as start_line. + EndLine() int + // EndColumn is the ending column. + // + // If the ending column is not known, this will be 0. + // If the ending column is the same as the starting column, this will be explicitly + // set to the same value as start_column. + EndColumn() int + // Type is the type of annotation, typically an ID representing a failure type. + Type() string + // Message is the message of the annotation. + Message() string +} + +// NewFileAnnotation returns a new FileAnnotation. +func NewFileAnnotation( + fileInfo FileInfo, + startLine int, + startColumn int, + endLine int, + endColumn int, + typeString string, + message string, +) FileAnnotation { + return newFileAnnotation( + fileInfo, + startLine, + startColumn, + endLine, + endColumn, + typeString, + message, + ) +} + +// SortFileAnnotations sorts the FileAnnotations. +// +// The order of sorting is: +// +// ExternalPath +// StartLine +// StartColumn +// Type +// Message +// EndLine +// EndColumn +func SortFileAnnotations(fileAnnotations []FileAnnotation) { + sort.Stable(sortFileAnnotations(fileAnnotations)) +} + +// DeduplicateAndSortFileAnnotations deduplicates the FileAnnotations based on their +// string representation and sorts them according to the order specified in SortFileAnnotations. +func DeduplicateAndSortFileAnnotations(fileAnnotations []FileAnnotation) []FileAnnotation { + deduplicated := make([]FileAnnotation, 0, len(fileAnnotations)) + seen := make(map[string]struct{}, len(fileAnnotations)) + for _, fileAnnotation := range fileAnnotations { + key := hash(fileAnnotation) + if _, ok := seen[key]; ok { + continue + } + seen[key] = struct{}{} + deduplicated = append(deduplicated, fileAnnotation) + } + SortFileAnnotations(deduplicated) + return deduplicated +} + +// PrintFileAnnotations prints the file annotations separated by newlines. +func PrintFileAnnotations(writer io.Writer, fileAnnotations []FileAnnotation, formatString string) error { + format, err := ParseFormat(formatString) + if err != nil { + return err + } + + switch format { + case FormatText: + return printAsText(writer, fileAnnotations) + case FormatJSON: + return printAsJSON(writer, fileAnnotations) + case FormatMSVS: + return printAsMSVS(writer, fileAnnotations) + case FormatJUnit: + return printAsJUnit(writer, fileAnnotations) + case FormatGithubActions: + return printAsGithubActions(writer, fileAnnotations) + default: + return fmt.Errorf("unknown FileAnnotation Format: %v", format) + } +} + +// hash returns a hash value that uniquely identifies the given FileAnnotation. +func hash(fileAnnotation FileAnnotation) string { + path := "" + if fileInfo := fileAnnotation.FileInfo(); fileInfo != nil { + path = fileInfo.ExternalPath() + } + hash := sha256.New() + _, _ = hash.Write([]byte(path)) + _, _ = hash.Write([]byte(strconv.Itoa(fileAnnotation.StartLine()))) + _, _ = hash.Write([]byte(strconv.Itoa(fileAnnotation.StartColumn()))) + _, _ = hash.Write([]byte(strconv.Itoa(fileAnnotation.EndLine()))) + _, _ = hash.Write([]byte(strconv.Itoa(fileAnnotation.EndColumn()))) + _, _ = hash.Write([]byte(fileAnnotation.Type())) + _, _ = hash.Write([]byte(fileAnnotation.Message())) + return string(hash.Sum(nil)) +} + +type sortFileAnnotations []FileAnnotation + +func (a sortFileAnnotations) Len() int { return len(a) } +func (a sortFileAnnotations) Swap(i int, j int) { a[i], a[j] = a[j], a[i] } +func (a sortFileAnnotations) Less(i int, j int) bool { return fileAnnotationCompareTo(a[i], a[j]) < 0 } + +// fileAnnotationCompareTo returns a value less than 0 if a < b, a value +// greater than 0 if a > b, and 0 if a == b. +func fileAnnotationCompareTo(a FileAnnotation, b FileAnnotation) int { + if a == nil && b == nil { + return 0 + } + if a == nil && b != nil { + return -1 + } + if a != nil && b == nil { + return 1 + } + aFileInfo := a.FileInfo() + bFileInfo := b.FileInfo() + if aFileInfo == nil && bFileInfo != nil { + return -1 + } + if aFileInfo != nil && bFileInfo == nil { + return 1 + } + if aFileInfo != nil && bFileInfo != nil { + if aFileInfo.ExternalPath() < bFileInfo.ExternalPath() { + return -1 + } + if aFileInfo.ExternalPath() > bFileInfo.ExternalPath() { + return 1 + } + } + if a.StartLine() < b.StartLine() { + return -1 + } + if a.StartLine() > b.StartLine() { + return 1 + } + if a.StartColumn() < b.StartColumn() { + return -1 + } + if a.StartColumn() > b.StartColumn() { + return 1 + } + if a.Type() < b.Type() { + return -1 + } + if a.Type() > b.Type() { + return 1 + } + if a.Message() < b.Message() { + return -1 + } + if a.Message() > b.Message() { + return 1 + } + if a.EndLine() < b.EndLine() { + return -1 + } + if a.EndLine() > b.EndLine() { + return 1 + } + if a.EndColumn() < b.EndColumn() { + return -1 + } + if a.EndColumn() > b.EndColumn() { + return 1 + } + return 0 +} diff --git a/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting/bufanalysistesting.go b/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting/bufanalysistesting.go new file mode 100644 index 000000000..1df23c8d9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting/bufanalysistesting.go @@ -0,0 +1,166 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufanalysistesting + +import ( + "fmt" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// NewFileAnnotationNoLocationOrPath returns a new FileAnnotation with no location or FileInfo. +func NewFileAnnotationNoLocationOrPath( + t *testing.T, + typeString string, +) bufanalysis.FileAnnotation { + return NewFileAnnotationNoLocation( + t, + "", + typeString, + ) +} + +// NewFileAnnotationNoLocation returns a new FileAnnotation with no location. +// +// fileInfo can be nil. +func NewFileAnnotationNoLocation( + t *testing.T, + path string, + typeString string, +) bufanalysis.FileAnnotation { + return NewFileAnnotation( + t, + path, + 0, + 0, + 0, + 0, + typeString, + ) +} + +// NewFileAnnotation returns a new FileAnnotation. +func NewFileAnnotation( + t *testing.T, + path string, + startLine int, + startColumn int, + endLine int, + endColumn int, + typeString string, +) bufanalysis.FileAnnotation { + return newFileAnnotation( + t, + path, + startLine, + startColumn, + endLine, + endColumn, + typeString, + "", + ) +} + +func newFileAnnotation( + t *testing.T, + path string, + startLine int, + startColumn int, + endLine int, + endColumn int, + typeString string, + message string, +) bufanalysis.FileAnnotation { + var fileInfo bufmoduleref.FileInfo + var err error + if path != "" { + fileInfo, err = bufmoduleref.NewFileInfo( + path, + "", + false, + nil, + "", + ) + require.NoError(t, err) + } + return bufanalysis.NewFileAnnotation( + fileInfo, + startLine, + startColumn, + endLine, + endColumn, + typeString, + message, + ) +} + +// AssertFileAnnotationsEqual asserts that the annotations are equal minus the message. +func AssertFileAnnotationsEqual( + t *testing.T, + expected []bufanalysis.FileAnnotation, + actual []bufanalysis.FileAnnotation, +) { + expected = normalizeFileAnnotations(t, expected) + actual = normalizeFileAnnotations(t, actual) + assert.Equal(t, len(expected), len(actual), fmt.Sprint(actual)) + if len(expected) == len(actual) { + for i, a := range actual { + e := expected[i] + expectedFileInfo := e.FileInfo() + actualFileInfo := a.FileInfo() + assert.Equal(t, expectedFileInfo, actualFileInfo) + assert.Equal(t, e, a) + } + } +} + +func normalizeFileAnnotations( + t *testing.T, + fileAnnotations []bufanalysis.FileAnnotation, +) []bufanalysis.FileAnnotation { + if fileAnnotations == nil { + return nil + } + normalizedFileAnnotations := make([]bufanalysis.FileAnnotation, len(fileAnnotations)) + for i, a := range fileAnnotations { + fileInfo := a.FileInfo() + var err error + if fileInfo != nil { + fileInfo, err = bufmoduleref.NewFileInfo( + fileInfo.Path(), + "", + false, + nil, + "", + ) + require.NoError(t, err) + } + normalizedFileAnnotations[i] = bufanalysis.NewFileAnnotation( + fileInfo, + a.StartLine(), + a.StartColumn(), + a.EndLine(), + a.EndColumn(), + a.Type(), + "", + ) + } + return normalizedFileAnnotations +} diff --git a/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting/bufanalysistesting_test.go b/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting/bufanalysistesting_test.go new file mode 100644 index 000000000..76e87d1e3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting/bufanalysistesting_test.go @@ -0,0 +1,134 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufanalysistesting + +import ( + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestBasic(t *testing.T) { + t.Parallel() + fileAnnotations := []bufanalysis.FileAnnotation{ + newFileAnnotation( + t, + "path/to/file.proto", + 1, + 0, + 1, + 0, + "FOO", + "Hello.", + ), + newFileAnnotation( + t, + "path/to/file.proto", + 2, + 1, + 2, + 1, + "FOO", + "Hello.", + ), + } + sb := &strings.Builder{} + err := bufanalysis.PrintFileAnnotations(sb, fileAnnotations, "text") + require.NoError(t, err) + assert.Equal( + t, + `path/to/file.proto:1:1:Hello. +path/to/file.proto:2:1:Hello. +`, + sb.String(), + ) + sb.Reset() + err = bufanalysis.PrintFileAnnotations(sb, fileAnnotations, "json") + require.NoError(t, err) + assert.Equal( + t, + `{"path":"path/to/file.proto","start_line":1,"start_column":1,"end_line":1,"end_column":1,"type":"FOO","message":"Hello."} +{"path":"path/to/file.proto","start_line":2,"start_column":1,"end_line":2,"end_column":1,"type":"FOO","message":"Hello."} +`, + sb.String(), + ) + sb.Reset() + err = bufanalysis.PrintFileAnnotations(sb, fileAnnotations, "msvs") + require.NoError(t, err) + assert.Equal(t, + `path/to/file.proto(1,1) : error FOO : Hello. +path/to/file.proto(2,1) : error FOO : Hello. +`, + sb.String(), + ) + sb.Reset() + err = bufanalysis.PrintFileAnnotations(sb, fileAnnotations, "junit") + require.NoError(t, err) + assert.Equal(t, + ` + + + + + + + + + +`, + sb.String(), + ) + sb.Reset() + err = bufanalysis.PrintFileAnnotations( + sb, + append( + fileAnnotations, + newFileAnnotation( + t, + "path/to/file.proto", + 0, + 0, + 0, + 0, + "FOO", + "Hello.", + ), + newFileAnnotation( + t, + "", + 0, + 0, + 0, + 0, + "FOO", + "Hello.", + ), + ), + "github-actions", + ) + require.NoError(t, err) + assert.Equal(t, + `::error file=path/to/file.proto,line=1,endLine=1::Hello. +::error file=path/to/file.proto,line=2,col=1,endLine=2,endColumn=1::Hello. +::error file=path/to/file.proto::Hello. +::error file=::Hello. +`, + sb.String(), + ) +} diff --git a/pkg/bufman/bufpkg/bufanalysis/file_annotation.go b/pkg/bufman/bufpkg/bufanalysis/file_annotation.go new file mode 100644 index 000000000..89217fec4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufanalysis/file_annotation.go @@ -0,0 +1,108 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufanalysis + +import ( + "bytes" + "strconv" +) + +type fileAnnotation struct { + fileInfo FileInfo + startLine int + startColumn int + endLine int + endColumn int + typeString string + message string +} + +func newFileAnnotation( + fileInfo FileInfo, + startLine int, + startColumn int, + endLine int, + endColumn int, + typeString string, + message string, +) *fileAnnotation { + return &fileAnnotation{ + fileInfo: fileInfo, + startLine: startLine, + startColumn: startColumn, + endLine: endLine, + endColumn: endColumn, + typeString: typeString, + message: message, + } +} + +func (f *fileAnnotation) FileInfo() FileInfo { + return f.fileInfo +} + +func (f *fileAnnotation) StartLine() int { + return f.startLine +} + +func (f *fileAnnotation) StartColumn() int { + return f.startColumn +} + +func (f *fileAnnotation) EndLine() int { + return f.endLine +} + +func (f *fileAnnotation) EndColumn() int { + return f.endColumn +} + +func (f *fileAnnotation) Type() string { + return f.typeString +} + +func (f *fileAnnotation) Message() string { + return f.message +} + +func (f *fileAnnotation) String() string { + if f == nil { + return "" + } + path := "" + line := atLeast1(f.startLine) + column := atLeast1(f.startColumn) + message := f.message + if f.fileInfo != nil { + path = f.fileInfo.ExternalPath() + } + if message == "" { + message = f.typeString + // should never happen but just in case + if message == "" { + message = "FAILURE" + } + } + buffer := bytes.NewBuffer(nil) + _, _ = buffer.WriteString(path) + _, _ = buffer.WriteRune(':') + _, _ = buffer.WriteString(strconv.Itoa(line)) + _, _ = buffer.WriteRune(':') + _, _ = buffer.WriteString(strconv.Itoa(column)) + _, _ = buffer.WriteRune(':') + _, _ = buffer.WriteString(message) + return buffer.String() +} diff --git a/pkg/bufman/bufpkg/bufanalysis/print.go b/pkg/bufman/bufpkg/bufanalysis/print.go new file mode 100644 index 000000000..f916d3e76 --- /dev/null +++ b/pkg/bufman/bufpkg/bufanalysis/print.go @@ -0,0 +1,296 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufanalysis + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "strconv" + "strings" +) + +func printAsText(writer io.Writer, fileAnnotations []FileAnnotation) error { + return printEachAnnotationOnNewLine( + writer, + fileAnnotations, + printFileAnnotationAsText, + ) +} + +func printAsMSVS(writer io.Writer, fileAnnotations []FileAnnotation) error { + return printEachAnnotationOnNewLine( + writer, + fileAnnotations, + printFileAnnotationAsMSVS, + ) +} + +func printAsJSON(writer io.Writer, fileAnnotations []FileAnnotation) error { + return printEachAnnotationOnNewLine( + writer, + fileAnnotations, + printFileAnnotationAsJSON, + ) +} + +func printAsGithubActions(writer io.Writer, fileAnnotations []FileAnnotation) error { + return printEachAnnotationOnNewLine( + writer, + fileAnnotations, + printFileAnnotationAsGithubActions, + ) +} + +func printAsJUnit(writer io.Writer, fileAnnotations []FileAnnotation) error { + encoder := xml.NewEncoder(writer) + encoder.Indent("", " ") + testsuites := xml.StartElement{Name: xml.Name{Local: "testsuites"}} + err := encoder.EncodeToken(testsuites) + if err != nil { + return err + } + annotationsByPath := groupAnnotationsByPath(fileAnnotations) + for _, annotations := range annotationsByPath { + path := "" + if fileInfo := annotations[0].FileInfo(); fileInfo != nil { + path = fileInfo.ExternalPath() + } + path = strings.TrimSuffix(path, ".proto") + testsuite := xml.StartElement{ + Name: xml.Name{Local: "testsuite"}, + Attr: []xml.Attr{ + {Name: xml.Name{Local: "name"}, Value: path}, + {Name: xml.Name{Local: "tests"}, Value: strconv.Itoa(len(annotations))}, + {Name: xml.Name{Local: "failures"}, Value: strconv.Itoa(len(annotations))}, + {Name: xml.Name{Local: "errors"}, Value: "0"}, + }, + } + if err := encoder.EncodeToken(testsuite); err != nil { + return err + } + for _, annotation := range annotations { + if err := printFileAnnotationAsJUnit(encoder, annotation); err != nil { + return err + } + } + if err := encoder.EncodeToken(xml.EndElement{Name: testsuite.Name}); err != nil { + return err + } + } + if err := encoder.EncodeToken(xml.EndElement{Name: testsuites.Name}); err != nil { + return err + } + if err := encoder.Flush(); err != nil { + return err + } + if _, err := writer.Write([]byte("\n")); err != nil { + return err + } + return nil +} + +func printFileAnnotationAsJUnit(encoder *xml.Encoder, annotation FileAnnotation) error { + testcase := xml.StartElement{Name: xml.Name{Local: "testcase"}} + name := annotation.Type() + if annotation.StartColumn() != 0 { + name += fmt.Sprintf("_%d_%d", annotation.StartLine(), annotation.StartColumn()) + } else if annotation.StartLine() != 0 { + name += fmt.Sprintf("_%d", annotation.StartLine()) + } + testcase.Attr = append(testcase.Attr, xml.Attr{Name: xml.Name{Local: "name"}, Value: name}) + if err := encoder.EncodeToken(testcase); err != nil { + return err + } + failure := xml.StartElement{ + Name: xml.Name{Local: "failure"}, + Attr: []xml.Attr{ + {Name: xml.Name{Local: "message"}, Value: annotation.String()}, + {Name: xml.Name{Local: "type"}, Value: annotation.Type()}, + }, + } + if err := encoder.EncodeToken(failure); err != nil { + return err + } + if err := encoder.EncodeToken(xml.EndElement{Name: failure.Name}); err != nil { + return err + } + if err := encoder.EncodeToken(xml.EndElement{Name: testcase.Name}); err != nil { + return err + } + return nil +} + +func groupAnnotationsByPath(annotations []FileAnnotation) [][]FileAnnotation { + pathToIndex := make(map[string]int) + annotationsByPath := make([][]FileAnnotation, 0) + for _, annotation := range annotations { + path := "" + if fileInfo := annotation.FileInfo(); fileInfo != nil { + path = fileInfo.ExternalPath() + } + index, ok := pathToIndex[path] + if !ok { + index = len(annotationsByPath) + pathToIndex[path] = index + annotationsByPath = append(annotationsByPath, nil) + } + annotationsByPath[index] = append(annotationsByPath[index], annotation) + } + return annotationsByPath +} + +func printFileAnnotationAsText(buffer *bytes.Buffer, f FileAnnotation) error { + _, _ = buffer.WriteString(f.String()) + return nil +} + +func printFileAnnotationAsMSVS(buffer *bytes.Buffer, f FileAnnotation) error { + // This will work as long as f != (*fileAnnotation)(nil) + if f == nil { + return nil + } + path := "" + line := atLeast1(f.StartLine()) + column := atLeast1(f.StartColumn()) + message := f.Message() + if f.FileInfo() != nil { + path = f.FileInfo().ExternalPath() + } + typeString := f.Type() + if typeString == "" { + // should never happen but just in case + typeString = "FAILURE" + } + if message == "" { + message = f.Type() + // should never happen but just in case + if message == "" { + message = "FAILURE" + } + } + _, _ = buffer.WriteString(path) + _, _ = buffer.WriteRune('(') + _, _ = buffer.WriteString(strconv.Itoa(line)) + if column != 0 { + _, _ = buffer.WriteRune(',') + _, _ = buffer.WriteString(strconv.Itoa(column)) + } + _, _ = buffer.WriteString(") : error ") + _, _ = buffer.WriteString(typeString) + _, _ = buffer.WriteString(" : ") + _, _ = buffer.WriteString(message) + return nil +} + +func printFileAnnotationAsJSON(buffer *bytes.Buffer, f FileAnnotation) error { + data, err := json.Marshal(newExternalFileAnnotation(f)) + if err != nil { + return err + } + _, _ = buffer.Write(data) + return nil +} + +func printFileAnnotationAsGithubActions(buffer *bytes.Buffer, f FileAnnotation) error { + if f == nil { + return nil + } + _, _ = buffer.WriteString("::error ") + + // file= is required for GitHub Actions, however it is possible to not have + // a path for a FileAnnotation. We still print something, however we need + // to test what happens in GitHub Actions if no valid path is printed out. + path := "" + if f.FileInfo() != nil { + path = f.FileInfo().ExternalPath() + } + _, _ = buffer.WriteString("file=") + _, _ = buffer.WriteString(path) + + // Everything else is optional. + if startLine := f.StartLine(); startLine > 0 { + _, _ = buffer.WriteString(",line=") + _, _ = buffer.WriteString(strconv.Itoa(startLine)) + // We only print column information if we have line information. + if startColumn := f.StartColumn(); startColumn > 0 { + _, _ = buffer.WriteString(",col=") + _, _ = buffer.WriteString(strconv.Itoa(startColumn)) + } + // We only do any ending line information if we have starting line information + if endLine := f.EndLine(); endLine > 0 { + _, _ = buffer.WriteString(",endLine=") + _, _ = buffer.WriteString(strconv.Itoa(endLine)) + // We only print column information if we have line information. + if endColumn := f.EndColumn(); endColumn > 0 { + // Yes, the spec has "col" for start and "endColumn" for end. + _, _ = buffer.WriteString(",endColumn=") + _, _ = buffer.WriteString(strconv.Itoa(endColumn)) + } + } + } + + _, _ = buffer.WriteString("::") + _, _ = buffer.WriteString(f.Message()) + return nil +} + +type externalFileAnnotation struct { + Path string `json:"path,omitempty" yaml:"path,omitempty"` + StartLine int `json:"start_line,omitempty" yaml:"start_line,omitempty"` + StartColumn int `json:"start_column,omitempty" yaml:"start_column,omitempty"` + EndLine int `json:"end_line,omitempty" yaml:"end_line,omitempty"` + EndColumn int `json:"end_column,omitempty" yaml:"end_column,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` + Message string `json:"message,omitempty" yaml:"message,omitempty"` +} + +func newExternalFileAnnotation(f FileAnnotation) externalFileAnnotation { + path := "" + if f.FileInfo() != nil { + path = f.FileInfo().ExternalPath() + } + return externalFileAnnotation{ + Path: path, + StartLine: atLeast1(f.StartLine()), + StartColumn: atLeast1(f.StartColumn()), + EndLine: atLeast1(f.EndLine()), + EndColumn: atLeast1(f.EndColumn()), + Type: f.Type(), + Message: f.Message(), + } +} + +func printEachAnnotationOnNewLine( + writer io.Writer, + fileAnnotations []FileAnnotation, + fileAnnotationPrinter func(writer *bytes.Buffer, fileAnnotation FileAnnotation) error, +) error { + buffer := bytes.NewBuffer(nil) + for _, fileAnnotation := range fileAnnotations { + buffer.Reset() + if err := fileAnnotationPrinter(buffer, fileAnnotation); err != nil { + return err + } + _, _ = buffer.WriteString("\n") + if _, err := writer.Write(buffer.Bytes()); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufanalysis/util.go b/pkg/bufman/bufpkg/bufanalysis/util.go new file mode 100644 index 000000000..851eb872b --- /dev/null +++ b/pkg/bufman/bufpkg/bufanalysis/util.go @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufanalysis + +func atLeast1(i int) int { + if i <= 0 { + return 1 + } + return i +} diff --git a/pkg/bufman/bufpkg/bufapimodule/bufapimodule.go b/pkg/bufman/bufpkg/bufapimodule/bufapimodule.go new file mode 100644 index 000000000..93c4ec36a --- /dev/null +++ b/pkg/bufman/bufpkg/bufapimodule/bufapimodule.go @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufapimodule + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/connectclient" + "go.uber.org/zap" +) + +type ( + DownloadServiceClientFactory func(address string) registryv1alpha1connect.DownloadServiceClient + RepositoryCommitServiceClientFactory func(address string) registryv1alpha1connect.RepositoryCommitServiceClient +) + +func NewDownloadServiceClientFactory(clientConfig *connectclient.Config) DownloadServiceClientFactory { + return func(address string) registryv1alpha1connect.DownloadServiceClient { + return connectclient.Make(clientConfig, address, registryv1alpha1connect.NewDownloadServiceClient) + } +} + +func NewRepositoryCommitServiceClientFactory(clientConfig *connectclient.Config) RepositoryCommitServiceClientFactory { + return func(address string) registryv1alpha1connect.RepositoryCommitServiceClient { + return connectclient.Make(clientConfig, address, registryv1alpha1connect.NewRepositoryCommitServiceClient) + } +} + +// NewModuleReader returns a new ModuleReader backed by the download service. +func NewModuleReader( + downloadClientFactory DownloadServiceClientFactory, + opts ...ModuleReaderOption, +) bufmodule.ModuleReader { + return newModuleReader( + downloadClientFactory, + opts..., + ) +} + +// ModuleReaderOption allows configuration of a module reader. +type ModuleReaderOption func(reader *moduleReader) + +// NewModuleResolver returns a new ModuleResolver backed by the resolve service. +func NewModuleResolver( + logger *zap.Logger, + repositoryCommitClientFactory RepositoryCommitServiceClientFactory, +) bufmodule.ModuleResolver { + return newModuleResolver(logger, repositoryCommitClientFactory) +} diff --git a/pkg/bufman/bufpkg/bufapimodule/module_reader.go b/pkg/bufman/bufpkg/bufapimodule/module_reader.go new file mode 100644 index 000000000..0adb2e3f3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufapimodule/module_reader.go @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufapimodule + +import ( + "context" + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmanifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/bufbuild/connect-go" +) + +type moduleReader struct { + downloadClientFactory DownloadServiceClientFactory +} + +func newModuleReader( + downloadClientFactory DownloadServiceClientFactory, + opts ...ModuleReaderOption, +) *moduleReader { + reader := &moduleReader{ + downloadClientFactory: downloadClientFactory, + } + for _, opt := range opts { + opt(reader) + } + return reader +} + +func (m *moduleReader) GetModule(ctx context.Context, modulePin bufmoduleref.ModulePin) (bufmodule.Module, error) { + moduleIdentity, err := bufmoduleref.NewModuleIdentity( + modulePin.Remote(), + modulePin.Owner(), + modulePin.Repository(), + ) + if err != nil { + // malformed pin + return nil, err + } + identityAndCommitOpt := bufmodule.ModuleWithModuleIdentityAndCommit( + moduleIdentity, + modulePin.Commit(), + ) + resp, err := m.downloadManifestAndBlobs(ctx, modulePin) + if err != nil { + return nil, err + } + if resp.Manifest == nil { + return nil, errors.New("expected non-nil manifest") + } + // use manifest and blobs + moduleManifest, err := bufmanifest.NewManifestFromProto(ctx, resp.Manifest) + if err != nil { + return nil, err + } + blobSet, err := bufmanifest.NewBlobSetFromProto(ctx, resp.Blobs) + if err != nil { + return nil, err + } + return bufmodule.NewModuleForManifestAndBlobSet(ctx, moduleManifest, blobSet, identityAndCommitOpt) +} + +func (m *moduleReader) downloadManifestAndBlobs( + ctx context.Context, + modulePin bufmoduleref.ModulePin, +) (*registryv1alpha1.DownloadManifestAndBlobsResponse, error) { + downloadService := m.downloadClientFactory(modulePin.Remote()) + resp, err := downloadService.DownloadManifestAndBlobs( + ctx, + connect.NewRequest(®istryv1alpha1.DownloadManifestAndBlobsRequest{ + Owner: modulePin.Owner(), + Repository: modulePin.Repository(), + Reference: modulePin.Commit(), + }), + ) + if err != nil { + if connect.CodeOf(err) == connect.CodeNotFound { + // Required by ModuleReader interface spec + return nil, storage.NewErrNotExist(modulePin.String()) + } + return nil, err + } + return resp.Msg, err +} diff --git a/pkg/bufman/bufpkg/bufapimodule/module_reader_test.go b/pkg/bufman/bufpkg/bufapimodule/module_reader_test.go new file mode 100644 index 000000000..d8423eab4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufapimodule/module_reader_test.go @@ -0,0 +1,253 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufapimodule + +import ( + "context" + "errors" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmanifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/bufbuild/connect-go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestDownload(t *testing.T) { + t.Parallel() + testDownload( + t, + "does-not-exist error", + newMockDownloadService( + t, + withError(connect.NewError(connect.CodeNotFound, nil)), + ), + "does not exist", + ) + testDownload( + t, + "unexpected download service error", + newMockDownloadService( + t, + withError(errors.New("internal")), + ), + "internal", + ) + testDownload( + t, + "success but response has all empty fields", + newMockDownloadService(t), + "expected non-nil manifest", + ) + testDownload( + t, + "success with empty manifest module", + newMockDownloadService( + t, + withBlobsFromMap(map[string][]byte{}), + ), + "", + ) + testDownload( + t, + "success with valid manifest module", + newMockDownloadService( + t, + withBlobsFromMap(map[string][]byte{ + "test.proto": []byte(`syntax = "proto3"; +message Test {} +`), + }), + ), + "", + ) + testDownload( + t, + "manifest module with invalid lock file", + newMockDownloadService( + t, + withBlobsFromMap(map[string][]byte{ + "buf.lock": []byte("invalid lock file"), + }), + ), + "failed to decode lock file", + ) + testDownload( + t, + "no manifest", + newMockDownloadService( + t, + withModule(&modulev1alpha1.Module{ + Files: []*modulev1alpha1.ModuleFile{ + { + Path: "foo.proto", + }, + }, + }), + ), + "expected non-nil manifest", + ) +} + +func testDownload( + t *testing.T, + desc string, + mock *mockDownloadService, + errorContains string, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + var moduleReaderOpts []ModuleReaderOption + moduleReader := newModuleReader(mock.factory, moduleReaderOpts...) + ctx := context.Background() + pin, err := bufmoduleref.NewModulePin( + "remote", + "owner", + "repository", + "branch", + "commit", + "digest", + time.Now(), + ) + require.NoError(t, err) + module, err := moduleReader.GetModule(ctx, pin) + if errorContains != "" { + assert.ErrorContains(t, err, errorContains) + } else { + assert.NotNil(t, module) + assert.NoError(t, err) + for _, path := range module.Manifest().Paths() { + moduleFile, err := module.GetModuleFile(ctx, path) + require.NoError(t, err) + assert.Equal(t, pin.Commit(), moduleFile.Commit()) + } + } + }) +} + +type mockDownloadService struct { + module *modulev1alpha1.Module + manifestBlob *modulev1alpha1.Blob + blobs []*modulev1alpha1.Blob + err error +} + +type option interface { + apply(*mockDownloadService) error +} + +type filemap map[string][]byte + +func (fm filemap) apply(m *mockDownloadService) error { + bucket, err := storagemem.NewReadBucket(fm) + if err != nil { + return err + } + ctx := context.Background() + moduleManifest, blobSet, err := manifest.NewFromBucket(ctx, bucket) + if err != nil { + return err + } + mBlob, err := moduleManifest.Blob() + if err != nil { + return err + } + m.manifestBlob, err = bufmanifest.AsProtoBlob(ctx, mBlob) + if err != nil { + return err + } + blobs := blobSet.Blobs() + m.blobs = make([]*modulev1alpha1.Blob, 0, len(blobs)) + for _, blob := range blobs { + protoBlob, err := bufmanifest.AsProtoBlob(ctx, blob) + if err != nil { + return err + } + m.blobs = append(m.blobs, protoBlob) + } + return nil +} + +func withBlobsFromMap(files map[string][]byte) option { + return filemap(files) +} + +type retErr struct{ err error } + +func (re retErr) apply(m *mockDownloadService) error { + m.err = re.err + return nil +} + +func withError(err error) option { + return retErr{err: err} +} + +type retModule struct{ module *modulev1alpha1.Module } + +func (rm retModule) apply(m *mockDownloadService) error { + m.module = rm.module + return nil +} + +func withModule(module *modulev1alpha1.Module) option { + return retModule{module: module} +} + +func newMockDownloadService( + t *testing.T, + opts ...option, +) *mockDownloadService { + m := &mockDownloadService{} + for _, opt := range opts { + if err := opt.apply(m); err != nil { + t.Error(err) + } + } + return m +} + +func (m *mockDownloadService) factory(_ string) registryv1alpha1connect.DownloadServiceClient { + return m +} + +func (m *mockDownloadService) Download( + context.Context, + *connect.Request[registryv1alpha1.DownloadRequest], +) (*connect.Response[registryv1alpha1.DownloadResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("Download RPC should not be called, use DownloadManifestAndBlobs RPC instead")) +} + +func (m *mockDownloadService) DownloadManifestAndBlobs( + context.Context, + *connect.Request[registryv1alpha1.DownloadManifestAndBlobsRequest], +) (*connect.Response[registryv1alpha1.DownloadManifestAndBlobsResponse], error) { + if m.err != nil { + return nil, m.err + } + return connect.NewResponse(®istryv1alpha1.DownloadManifestAndBlobsResponse{ + Manifest: m.manifestBlob, + Blobs: m.blobs, + }), nil +} diff --git a/pkg/bufman/bufpkg/bufapimodule/module_resolver.go b/pkg/bufman/bufpkg/bufapimodule/module_resolver.go new file mode 100644 index 000000000..f09838352 --- /dev/null +++ b/pkg/bufman/bufpkg/bufapimodule/module_resolver.go @@ -0,0 +1,73 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufapimodule + +import ( + "context" + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/bufbuild/connect-go" + "go.uber.org/zap" +) + +type moduleResolver struct { + logger *zap.Logger + repositoryCommitClientFactory RepositoryCommitServiceClientFactory +} + +func newModuleResolver( + logger *zap.Logger, + repositoryCommitClientFactory RepositoryCommitServiceClientFactory, +) *moduleResolver { + return &moduleResolver{ + logger: logger, + repositoryCommitClientFactory: repositoryCommitClientFactory, + } +} + +func (m *moduleResolver) GetModulePin(ctx context.Context, moduleReference bufmoduleref.ModuleReference) (bufmoduleref.ModulePin, error) { + repositoryCommitService := m.repositoryCommitClientFactory(moduleReference.Remote()) + resp, err := repositoryCommitService.GetRepositoryCommitByReference( + ctx, + connect.NewRequest(®istryv1alpha1.GetRepositoryCommitByReferenceRequest{ + RepositoryOwner: moduleReference.Owner(), + RepositoryName: moduleReference.Repository(), + Reference: moduleReference.Reference(), + }), + ) + if err != nil { + if connect.CodeOf(err) == connect.CodeNotFound { + // Required by ModuleResolver interface spec + return nil, storage.NewErrNotExist(moduleReference.String()) + } + return nil, err + } + if resp.Msg.RepositoryCommit == nil { + return nil, errors.New("empty response") + } + return bufmoduleref.NewModulePin( + moduleReference.Remote(), + moduleReference.Owner(), + moduleReference.Repository(), + "", // branch + resp.Msg.RepositoryCommit.Name, + resp.Msg.RepositoryCommit.ManifestDigest, + resp.Msg.RepositoryCommit.CreateTime.AsTime(), + ) +} diff --git a/pkg/bufman/bufpkg/bufapimodule/module_resolver_test.go b/pkg/bufman/bufpkg/bufapimodule/module_resolver_test.go new file mode 100644 index 000000000..056fafc48 --- /dev/null +++ b/pkg/bufman/bufpkg/bufapimodule/module_resolver_test.go @@ -0,0 +1,117 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufapimodule + +import ( + "bytes" + "context" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/bufbuild/connect-go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +type mockCommitServiceClient struct { + registryv1alpha1connect.UnimplementedRepositoryCommitServiceHandler + + t *testing.T + refResp *registryv1alpha1.GetRepositoryCommitByReferenceResponse +} + +func (m *mockCommitServiceClient) GetRepositoryCommitByReference( + _ context.Context, + _ *connect.Request[registryv1alpha1.GetRepositoryCommitByReferenceRequest], +) (*connect.Response[registryv1alpha1.GetRepositoryCommitByReferenceResponse], error) { + return connect.NewResponse(m.refResp), nil +} + +func TestGetModulePin(t *testing.T) { + t.Parallel() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + nullDigest, err := digester.Digest(&bytes.Buffer{}) + require.NoError(t, err) + testGetModulePin( + t, + "nominal", + ®istryv1alpha1.GetRepositoryCommitByReferenceResponse{ + RepositoryCommit: ®istryv1alpha1.RepositoryCommit{ + Id: "commitid", + Digest: nullDigest.String(), + Name: "commit", + Branch: "unsupported-feature", + Author: "John Doe", + }, + }, + false, + ) + testGetModulePin( + t, + "success, nil repository commit", + ®istryv1alpha1.GetRepositoryCommitByReferenceResponse{}, + true, + ) +} + +func testGetModulePin( + t *testing.T, + desc string, + resp *registryv1alpha1.GetRepositoryCommitByReferenceResponse, + isError bool, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + clientFactory := func(_ string) registryv1alpha1connect.RepositoryCommitServiceClient { + return &mockCommitServiceClient{ + t: t, + refResp: resp, + } + } + ctx := context.Background() + mr := newModuleResolver(nil, clientFactory) // logger is unused + moduleReference, err := bufmoduleref.NewModuleReference( + "remote", + "owner", + "repository", + "reference", + ) + require.NoError(t, err) + pin, err := mr.GetModulePin(ctx, moduleReference) + if isError { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, "remote", pin.Remote()) + assert.Equal(t, "owner", pin.Owner()) + assert.Equal(t, "repository", pin.Repository()) + assert.Equal(t, "", pin.Branch()) + assert.Equal(t, resp.RepositoryCommit.Name, pin.Commit()) + assert.Equal(t, resp.RepositoryCommit.ManifestDigest, pin.Digest()) + assert.Equal( + t, + time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC), + pin.CreateTime(), + ) + } + }) +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking.go new file mode 100644 index 000000000..77ec71de3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking.go @@ -0,0 +1,141 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufbreaking contains the breaking change detection functionality. +// +// The primary entry point to this package is the Handler. +package bufbreaking + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "go.uber.org/zap" +) + +// Handler handles the main breaking functionality. +type Handler interface { + // Check runs the breaking checks. + // + // The image should have source code info for this to work properly. The previousImage + // does not need to have source code info. + // + // Images should be filtered with regards to imports before passing to this function. + Check( + ctx context.Context, + config *bufbreakingconfig.Config, + previousImage bufimage.Image, + image bufimage.Image, + ) ([]bufanalysis.FileAnnotation, error) +} + +// NewHandler returns a new Handler. +func NewHandler(logger *zap.Logger) Handler { + return newHandler(logger) +} + +// RulesForConfig returns the rules for a given config. +// +// Should only be used for printing. +func RulesForConfig(config *bufbreakingconfig.Config) ([]bufcheck.Rule, error) { + internalConfig, err := internalConfigForConfig(config) + if err != nil { + return nil, err + } + return rulesForInternalRules(internalConfig.Rules), nil +} + +// GetAllRulesV1Beta1 gets all known rules. +// +// Should only be used for printing. +func GetAllRulesV1Beta1() ([]bufcheck.Rule, error) { + internalConfig, err := internalConfigForConfig( + &bufbreakingconfig.Config{ + Use: internal.AllIDsForVersionSpec(bufbreakingv1beta1.VersionSpec), + Version: bufconfig.V1Beta1Version, + }, + ) + if err != nil { + return nil, err + } + return rulesForInternalRules(internalConfig.Rules), nil +} + +// GetAllRulesV1 gets all known rules. +// +// Should only be used for printing. +func GetAllRulesV1() ([]bufcheck.Rule, error) { + internalConfig, err := internalConfigForConfig( + &bufbreakingconfig.Config{ + Use: internal.AllIDsForVersionSpec(bufbreakingv1.VersionSpec), + Version: bufconfig.V1Version, + }, + ) + if err != nil { + return nil, err + } + return rulesForInternalRules(internalConfig.Rules), nil +} + +// GetAllRulesAndCategoriesV1Beta1 returns all rules and categories for v1beta1 as a string slice. +// +// This is used for validation purposes only. +func GetAllRulesAndCategoriesV1Beta1() []string { + return internal.AllCategoriesAndIDsForVersionSpec(bufbreakingv1beta1.VersionSpec) +} + +// GetAllRulesAndCategoriesV1 returns all rules and categories for v1 as a string slice. +// +// This is used for validation purposes only. +func GetAllRulesAndCategoriesV1() []string { + return internal.AllCategoriesAndIDsForVersionSpec(bufbreakingv1.VersionSpec) +} + +func internalConfigForConfig(config *bufbreakingconfig.Config) (*internal.Config, error) { + var versionSpec *internal.VersionSpec + switch config.Version { + case bufconfig.V1Beta1Version: + versionSpec = bufbreakingv1beta1.VersionSpec + case bufconfig.V1Version: + versionSpec = bufbreakingv1.VersionSpec + } + return internal.ConfigBuilder{ + Use: config.Use, + Except: config.Except, + IgnoreRootPaths: config.IgnoreRootPaths, + IgnoreIDOrCategoryToRootPaths: config.IgnoreIDOrCategoryToRootPaths, + IgnoreUnstablePackages: config.IgnoreUnstablePackages, + }.NewConfig( + versionSpec, + ) +} + +func rulesForInternalRules(rules []*internal.Rule) []bufcheck.Rule { + if rules == nil { + return nil + } + s := make([]bufcheck.Rule, len(rules)) + for i, e := range rules { + s[i] = e + } + return s +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking_test.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking_test.go new file mode 100644 index 000000000..47b312650 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking_test.go @@ -0,0 +1,842 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufbreaking_test + +import ( + "context" + "path/filepath" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestRunBreakingEnumNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_enum_no_delete", + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), + ) +} + +func TestRunBreakingEnumValueNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_enum_value_no_delete", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 8, 2, "ENUM_VALUE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 5, 15, 6, "ENUM_VALUE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 3, 25, 4, "ENUM_VALUE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 40, 1, 42, 2, "ENUM_VALUE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 48, 1, 52, 2, "ENUM_VALUE_NO_DELETE"), + ) +} + +func TestRunBreakingEnumValueNoDeleteUnlessNameReserved(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_enum_value_no_delete_unless_name_reserved", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 3, 28, 4, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 43, 1, 45, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 48, 1, 52, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), + ) +} + +func TestRunBreakingEnumValueNoDeleteUnlessNumberReserved(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_enum_value_no_delete_unless_number_reserved", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 3, 28, 4, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 43, 1, 45, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 48, 1, 52, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), + ) +} + +func TestRunBreakingEnumValueSameName(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_enum_value_same_name", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 15, 8, 16, "ENUM_VALUE_SAME_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 20, 16, 21, "ENUM_VALUE_SAME_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 27, 19, 27, 20, "ENUM_VALUE_SAME_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 46, 16, 46, 17, "ENUM_VALUE_SAME_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 47, 18, 47, 19, "ENUM_VALUE_SAME_NAME"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 51, 16, 51, 17, "ENUM_VALUE_SAME_NAME"), + ) +} + +func TestRunBreakingExtensionMessageNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_extension_message_no_delete", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 11, 2, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 11, 2, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 11, 2, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 5, 21, 6, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 5, 21, 6, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 5, 21, 6, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 30, 3, 36, 4, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 30, 3, 36, 4, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 30, 3, 36, 4, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 73, 1, 79, 2, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 73, 1, 79, 2, "EXTENSION_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 73, 1, 79, 2, "EXTENSION_MESSAGE_NO_DELETE"), + ) +} + +func TestRunBreakingFieldNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_no_delete", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 8, 2, "FIELD_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 1, 33, 2, "FIELD_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 5, 15, 6, "FIELD_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 3, 25, 4, "FIELD_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 57, 1, 60, 2, "FIELD_NO_DELETE"), + ) +} + +func TestRunBreakingFieldNoDeleteUnlessNameReserved(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_no_delete_unless_name_reserved", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 35, 2, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 35, 2, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 3, 28, 4, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 57, 1, 61, 2, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), + ) +} + +func TestRunBreakingFieldNoDeleteUnlessNumberReserved(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_no_delete_unless_number_reserved", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 35, 2, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 35, 2, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 3, 28, 4, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 57, 1, 61, 2, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), + ) +} + +func TestRunBreakingFieldSameCType(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_same_ctype", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 19, 6, 39, "FIELD_SAME_CTYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 3, 7, 18, "FIELD_SAME_CTYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 23, 13, 43, "FIELD_SAME_CTYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 14, 7, 14, 22, "FIELD_SAME_CTYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 21, 23, 33, "FIELD_SAME_CTYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 49, 28, 49, 48, "FIELD_SAME_CTYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 50, 28, 50, 42, "FIELD_SAME_CTYPE"), + ) +} + +func TestRunBreakingFieldSameJSONName(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_same_json_name", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 3, 6, 17, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 18, 7, 35, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 20, 8, 37, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 3, 9, 27, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 28, 10, 46, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 27, 11, 45, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 3, 12, 31, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 32, 13, 50, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 14, 31, 14, 49, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 7, 20, 21, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 21, 22, 21, 39, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 24, 22, 41, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 7, 23, 31, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 32, 24, 50, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 25, 31, 25, 49, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 26, 7, 26, 35, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 27, 36, 27, 54, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 28, 35, 28, 53, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 43, 5, 43, 19, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 44, 20, 44, 37, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 45, 22, 45, 39, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 46, 5, 46, 29, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 47, 30, 47, 48, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 48, 29, 48, 47, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 49, 5, 49, 33, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 50, 34, 50, 52, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 51, 33, 51, 51, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 92, 5, 92, 19, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 93, 20, 93, 37, "FIELD_SAME_JSON_NAME"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 94, 22, 94, 39, "FIELD_SAME_JSON_NAME"), + ) +} + +func TestRunBreakingFieldSameJSType(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_same_jstype", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 18, 6, 36, "FIELD_SAME_JSTYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 3, 7, 17, "FIELD_SAME_JSTYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 22, 13, 40, "FIELD_SAME_JSTYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 14, 7, 14, 21, "FIELD_SAME_JSTYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 20, 22, 38, "FIELD_SAME_JSTYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 49, 27, 49, 45, "FIELD_SAME_JSTYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 50, 3, 50, 26, "FIELD_SAME_JSTYPE"), + ) +} + +func TestRunBreakingFieldSameLabel(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_same_label", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 8, 26, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 3, 9, 24, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 3, 10, 19, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 3, 11, 16, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 3, 12, 18, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 3, 13, 17, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 19, 7, 19, 30, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 7, 20, 28, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 21, 7, 21, 23, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 7, 22, 20, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 7, 23, 22, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 7, 24, 21, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 36, 5, 36, 28, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 37, 5, 37, 26, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 38, 5, 38, 21, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 39, 5, 39, 18, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 40, 5, 40, 20, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 41, 5, 41, 19, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 13, 3, 13, 26, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 14, 3, 14, 24, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 70, 3, 70, 26, "FIELD_SAME_LABEL"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 71, 3, 71, 26, "FIELD_SAME_LABEL"), + ) +} + +func TestRunBreakingFieldSameName(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_same_name", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 9, 7, 13, "FIELD_SAME_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 13, 15, 17, "FIELD_SAME_NAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 26, 11, 26, 15, "FIELD_SAME_NAME"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 60, 11, 60, 15, "FIELD_SAME_NAME"), + ) +} + +func TestRunBreakingFieldSameOneof(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_same_oneof", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 3, 6, 17, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 8, 17, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 3, 11, 19, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 18, 3, 18, 17, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 3, 20, 17, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 3, 23, 19, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 37, 3, 37, 17, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 39, 3, 39, 17, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 42, 3, 42, 19, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 94, 3, 94, 17, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 96, 3, 96, 17, "FIELD_SAME_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 99, 3, 99, 19, "FIELD_SAME_ONEOF"), + ) +} + +func TestRunBreakingFieldSameType(t *testing.T) { + t.Parallel() + // TODO: double check all this + testBreaking( + t, + "breaking_field_same_type", + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 12, 8, 17, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 12, 9, 15, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 3, 11, 6, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 3, 12, 6, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 19, 16, 19, 21, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 16, 20, 19, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 7, 22, 10, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 7, 23, 10, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 36, 14, 36, 19, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 37, 14, 37, 17, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 39, 5, 39, 8, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 40, 5, 40, 8, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 64, 5, 64, 10, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 65, 5, 65, 9, "FIELD_SAME_TYPE"), + ) +} + +func TestRunBreakingFieldWireCompatibleType(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_wire_compatible_type", + bufanalysistesting.NewFileAnnotation(t, "2.proto", 31, 3, 31, 11, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 32, 3, 32, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 33, 3, 33, 8, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 34, 3, 34, 8, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 35, 3, 35, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 36, 3, 36, 10, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 3, 37, 11, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 3, 38, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 39, 3, 39, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 40, 3, 40, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 41, 3, 41, 8, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 42, 3, 42, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 43, 3, 43, 8, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 44, 3, 44, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 45, 3, 45, 7, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 78, 3, 78, 6, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 79, 3, 79, 6, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 80, 3, 80, 6, "FIELD_WIRE_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 85, 3, 85, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), + ) +} + +func TestRunBreakingFieldWireJSONCompatibleType(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_field_wire_json_compatible_type", + bufanalysistesting.NewFileAnnotation(t, "2.proto", 34, 3, 34, 11, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 35, 3, 35, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 36, 3, 36, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 3, 37, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 3, 38, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 39, 3, 39, 10, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 40, 3, 40, 11, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 41, 3, 41, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 42, 3, 42, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 43, 3, 43, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 44, 3, 44, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 45, 3, 45, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 46, 3, 46, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 47, 3, 47, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 48, 3, 48, 7, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 81, 3, 81, 6, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 82, 3, 82, 6, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 83, 3, 83, 6, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 87, 3, 87, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 88, 3, 88, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), + ) +} + +func TestRunBreakingFileNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_file_no_delete", + bufanalysistesting.NewFileAnnotationNoLocationOrPath(t, "FILE_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocationOrPath(t, "FILE_NO_DELETE"), + ) +} + +func TestRunBreakingFileNoDeleteUnstable(t *testing.T) { + t.Parallel() + // https://github.com/ProtobufMan/bufman-cli/issues/211 + testBreaking( + t, + "breaking_file_no_delete_unstable", + ) +} + +func TestRunBreakingFileNoDeleteIgnores(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_file_no_delete_ignores", + // a/a.proto deleted but not ignored + bufanalysistesting.NewFileAnnotationNoLocationOrPath(t, "FILE_NO_DELETE"), + ) +} + +func TestRunBreakingFileSamePackage(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_file_same_package", + bufanalysistesting.NewFileAnnotation(t, "a/a.proto", 3, 1, 3, 11, "FILE_SAME_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "no_package.proto", 3, 1, 3, 11, "FILE_SAME_PACKAGE"), + ) +} + +func TestRunBreakingFileSameSyntax(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_file_same_syntax", + bufanalysistesting.NewFileAnnotation(t, "no_package.proto", 1, 1, 1, 19, "FILE_SAME_SYNTAX"), + bufanalysistesting.NewFileAnnotation(t, "sub/a/b/sub_a_b.proto", 2, 1, 2, 19, "FILE_SAME_SYNTAX"), + ) +} + +func TestRunBreakingFileSameValues(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_file_same_values", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 5, 29, "FILE_SAME_JAVA_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 1, 6, 37, "FILE_SAME_JAVA_OUTER_CLASSNAME"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 7, 36, "FILE_SAME_JAVA_MULTIPLE_FILES"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 1, 8, 27, "FILE_SAME_GO_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 1, 9, 34, "FILE_SAME_OBJC_CLASS_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 1, 10, 33, "FILE_SAME_CSHARP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 11, 29, "FILE_SAME_SWIFT_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 1, 12, 33, "FILE_SAME_PHP_CLASS_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 1, 13, 30, "FILE_SAME_PHP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 14, 1, 14, 39, "FILE_SAME_PHP_METADATA_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 1, 15, 29, "FILE_SAME_RUBY_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 17, 1, 17, 39, "FILE_SAME_JAVA_STRING_CHECK_UTF8"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 18, 1, 18, 29, "FILE_SAME_OPTIMIZE_FOR"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 19, 1, 19, 36, "FILE_SAME_CC_GENERIC_SERVICES"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 1, 20, 38, "FILE_SAME_JAVA_GENERIC_SERVICES"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 21, 1, 21, 36, "FILE_SAME_PY_GENERIC_SERVICES"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 1, 22, 37, "FILE_SAME_PHP_GENERIC_SERVICES"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 1, 23, 33, "FILE_SAME_CC_ENABLE_ARENAS"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 1, 3, 11, "FILE_SAME_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 5, 1, 5, 29, "FILE_SAME_JAVA_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 6, 1, 6, 37, "FILE_SAME_JAVA_OUTER_CLASSNAME"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 7, 1, 7, 35, "FILE_SAME_JAVA_MULTIPLE_FILES"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 8, 1, 8, 27, "FILE_SAME_GO_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 9, 1, 9, 34, "FILE_SAME_OBJC_CLASS_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 10, 1, 10, 33, "FILE_SAME_CSHARP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 11, 1, 11, 29, "FILE_SAME_SWIFT_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 12, 1, 12, 33, "FILE_SAME_PHP_CLASS_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 13, 1, 13, 30, "FILE_SAME_PHP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 14, 1, 14, 39, "FILE_SAME_PHP_METADATA_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 15, 1, 15, 29, "FILE_SAME_RUBY_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 17, 1, 17, 38, "FILE_SAME_JAVA_STRING_CHECK_UTF8"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 18, 1, 18, 33, "FILE_SAME_OPTIMIZE_FOR"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 19, 1, 19, 35, "FILE_SAME_CC_GENERIC_SERVICES"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 20, 1, 20, 37, "FILE_SAME_JAVA_GENERIC_SERVICES"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 21, 1, 21, 35, "FILE_SAME_PY_GENERIC_SERVICES"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 22, 1, 22, 36, "FILE_SAME_PHP_GENERIC_SERVICES"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 23, 1, 23, 33, "FILE_SAME_CC_ENABLE_ARENAS"), + ) +} + +func TestRunBreakingMessageNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_message_no_delete", + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 12, 2, "MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 10, 4, "MESSAGE_NO_DELETE"), + ) +} + +func TestRunBreakingMessageSameValues(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_message_same_values", + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 3, 6, 42, "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 3, 7, 49, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 7, 13, 53, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 7, 16, 45, "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 21, 5, 21, 44, "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 5, 24, 43, "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 27, 3, 27, 49, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "2.proto", "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "2.proto", "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 6, 3, 6, 49, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 10, 3, 10, 49, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), + ) +} + +func TestRunBreakingMessageSameRequiredFields(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_message_same_required_fields", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 7, 2, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 3, 6, 27, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 1, 11, 2, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 3, 10, 27, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 1, 30, 2, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 5, 17, 6, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 7, 16, 31, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 18, 5, 20, 6, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 3, 24, 4, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 5, 23, 29, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 27, 5, 27, 29, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 29, 3, 29, 27, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 5, 1, 7, 2, "MESSAGE_SAME_REQUIRED_FIELDS"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 6, 3, 6, 27, "MESSAGE_SAME_REQUIRED_FIELDS"), + ) +} + +func TestRunBreakingOneofNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_oneof_no_delete", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "ONEOF_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "ONEOF_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 26, 3, 30, 4, "ONEOF_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 75, 1, 79, 2, "ONEOF_NO_DELETE"), + ) +} + +func TestRunBreakingPackageNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_package_no_delete", + bufanalysistesting.NewFileAnnotationNoLocationOrPath(t, "PACKAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_SERVICE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "a2.proto", 11, 1, 16, 2, "PACKAGE_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "a2.proto", 12, 3, 14, 4, "PACKAGE_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "b1.proto", "PACKAGE_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "b1.proto", "PACKAGE_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "b1.proto", "PACKAGE_SERVICE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "b2.proto", 7, 1, 21, 2, "PACKAGE_MESSAGE_NO_DELETE"), + ) +} + +func TestRunBreakingReservedEnumNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_reserved_enum_no_delete", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), + ) +} + +func TestRunBreakingReservedMessageNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_reserved_message_no_delete", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), + ) +} + +func TestRunBreakingRPCNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_rpc_no_delete", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 10, 2, "RPC_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 31, 1, 34, 2, "RPC_NO_DELETE"), + ) +} + +func TestRunBreakingRPCSameValues(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_rpc_same_values", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 3, 9, 71, "RPC_SAME_CLIENT_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 18, 9, 37, "RPC_SAME_REQUEST_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 48, 9, 67, "RPC_SAME_RESPONSE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 3, 10, 71, "RPC_SAME_SERVER_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 11, 10, 30, "RPC_SAME_REQUEST_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 48, 10, 67, "RPC_SAME_RESPONSE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 3, 11, 68, "RPC_SAME_CLIENT_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 3, 12, 68, "RPC_SAME_SERVER_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 3, 37, 71, "RPC_SAME_CLIENT_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 18, 37, 37, "RPC_SAME_REQUEST_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 48, 37, 67, "RPC_SAME_RESPONSE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 3, 38, 71, "RPC_SAME_SERVER_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 11, 38, 30, "RPC_SAME_REQUEST_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 48, 38, 67, "RPC_SAME_RESPONSE_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 39, 3, 39, 68, "RPC_SAME_CLIENT_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 40, 3, 40, 68, "RPC_SAME_SERVER_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 45, 5, 45, 48, "RPC_SAME_IDEMPOTENCY_LEVEL"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 49, 5, 49, 43, "RPC_SAME_IDEMPOTENCY_LEVEL"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 55, 5, 55, 48, "RPC_SAME_IDEMPOTENCY_LEVEL"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 59, 5, 59, 43, "RPC_SAME_IDEMPOTENCY_LEVEL"), + ) +} + +func TestRunBreakingServiceNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_service_no_delete", + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "SERVICE_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "SERVICE_NO_DELETE"), + ) +} + +func TestRunBreakingPackageServiceNoDelete(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_package_service_no_delete", + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "PACKAGE_SERVICE_NO_DELETE"), + ) +} + +func TestRunBreakingIgnoreUnstablePackagesTrue(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_ignore_unstable_packages_true", + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 16, 2, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 12, 4, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "a/v1/1.proto", "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "a/v1/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "a/v1/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "b/1.proto", "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "b/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "b/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), + ) +} + +func TestRunBreakingIgnoreUnstablePackagesFalse(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_ignore_unstable_packages_false", + bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 16, 2, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 12, 4, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "a/v1/1.proto", "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "a/v1/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "a/v1/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "a/v1beta1/1.proto", "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "a/v1beta1/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "a/v1beta1/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "b/1.proto", "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "b/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "b/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), + ) +} + +func TestRunBreakingIgnoreUnstablePackagesDeleteFile(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_ignore_unstable_packages_delete_file", + ) +} + +func TestRunBreakingIntEnum(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_int_enum", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 0, 0, 0, 0, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "1.proto", 3, 3, 3, 8, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 3, 3, 7, "FIELD_SAME_TYPE"), + ) +} + +func TestRunBreakingMessageEnum(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_message_enum", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 3, 3, 3, 6, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 0, 0, 0, 0, "ENUM_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 3, 3, 7, "FIELD_SAME_TYPE"), + ) +} + +func TestRunBreakingMessageInt(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_message_int", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 3, 3, 3, 6, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 3, 3, 8, "FIELD_SAME_TYPE"), + ) +} + +func TestRunBreakingMessageMessage(t *testing.T) { + t.Parallel() + testBreaking( + t, + "breaking_message_message", + bufanalysistesting.NewFileAnnotation(t, "1.proto", 3, 3, 3, 8, "FIELD_SAME_TYPE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 0, 0, 0, 0, "MESSAGE_NO_DELETE"), + bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 3, 3, 7, "FIELD_SAME_TYPE"), + ) +} + +func testBreaking( + t *testing.T, + relDirPath string, + expectedFileAnnotations ...bufanalysis.FileAnnotation, +) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + logger := zap.NewNop() + + previousDirPath := filepath.Join("testdata_previous", relDirPath) + dirPath := filepath.Join("testdata", relDirPath) + + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + previousReadWriteBucket, err := storageosProvider.NewReadWriteBucket( + previousDirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + dirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + + previousConfig := testGetConfig(t, previousReadWriteBucket) + config := testGetConfig(t, readWriteBucket) + + previousModule, err := bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( + context.Background(), + previousReadWriteBucket, + previousConfig.Build, + ) + require.NoError(t, err) + previousImage, previousFileAnnotations, err := bufimagebuild.NewBuilder( + zap.NewNop(), + bufmodule.NewNopModuleReader(), + ).Build( + ctx, + previousModule, + bufimagebuild.WithExcludeSourceCodeInfo(), + ) + require.NoError(t, err) + require.Empty(t, previousFileAnnotations) + previousImage = bufimage.ImageWithoutImports(previousImage) + + module, err := bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config.Build, + ) + require.NoError(t, err) + image, fileAnnotations, err := bufimagebuild.NewBuilder( + zap.NewNop(), + bufmodule.NewNopModuleReader(), + ).Build( + ctx, + module, + ) + require.NoError(t, err) + require.Empty(t, fileAnnotations) + image = bufimage.ImageWithoutImports(image) + + handler := bufbreaking.NewHandler(logger) + fileAnnotations, err = handler.Check( + ctx, + config.Breaking, + previousImage, + image, + ) + assert.NoError(t, err) + bufanalysistesting.AssertFileAnnotationsEqual( + t, + expectedFileAnnotations, + fileAnnotations, + ) +} + +func testGetConfig( + t *testing.T, + readBucket storage.ReadBucket, +) *bufconfig.Config { + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + config, err := bufconfig.GetConfigForBucket(ctx, readBucket) + require.NoError(t, err) + return config +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig/bufbreakingconfig.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig/bufbreakingconfig.go new file mode 100644 index 000000000..47af3240d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig/bufbreakingconfig.go @@ -0,0 +1,226 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufbreakingconfig + +import ( + "encoding/json" + "sort" + + breakingv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/breaking/v1" +) + +const ( + // These versions match the versions in bufconfig. We cannot take an explicit dependency + // on bufconfig without creating a circular dependency. + v1Beta1Version = "v1beta1" + v1Version = "v1" +) + +// Config is the breaking check config. +type Config struct { + // Use is a list of the rule and/or category IDs that are included in the breaking change check. + Use []string + // Except is a list of the rule and/or category IDs that are excluded from the breaking change check. + Except []string + // IgnoreRootPaths is a list of the paths of directories and/or files that should be ignored by the breaking change check. + // All paths are relative to the root of the module. + IgnoreRootPaths []string + // IgnoreIDOrCategoryToRootPaths is a map of rule and/or category IDs to directory and/or file paths to exclude from the + // breaking change check. + IgnoreIDOrCategoryToRootPaths map[string][]string + // IgnoreUnstablePackages ignores packages with a last component that is one of the unstable forms recognised + // by the PACKAGE_VERSION_SUFFIX: + // v\d+test.* + // v\d+(alpha|beta)\d+ + // v\d+p\d+(alpha|beta)\d+ + IgnoreUnstablePackages bool + // Version represents the version of the breaking change rule and category IDs that should be used with this config. + Version string +} + +// NewConfigV1Beta1 returns a new Config. +func NewConfigV1Beta1(externalConfig ExternalConfigV1Beta1) *Config { + return &Config{ + Use: externalConfig.Use, + Except: externalConfig.Except, + IgnoreRootPaths: externalConfig.Ignore, + IgnoreIDOrCategoryToRootPaths: externalConfig.IgnoreOnly, + IgnoreUnstablePackages: externalConfig.IgnoreUnstablePackages, + Version: v1Beta1Version, + } +} + +// NewConfigV1 returns a new Config. +func NewConfigV1(externalConfig ExternalConfigV1) *Config { + return &Config{ + Use: externalConfig.Use, + Except: externalConfig.Except, + IgnoreRootPaths: externalConfig.Ignore, + IgnoreIDOrCategoryToRootPaths: externalConfig.IgnoreOnly, + IgnoreUnstablePackages: externalConfig.IgnoreUnstablePackages, + Version: v1Version, + } +} + +// ConfigForProto returns the Config given the proto. +func ConfigForProto(protoConfig *breakingv1.Config) *Config { + return &Config{ + Use: protoConfig.GetUseIds(), + Except: protoConfig.GetExceptIds(), + IgnoreRootPaths: protoConfig.GetIgnorePaths(), + IgnoreIDOrCategoryToRootPaths: ignoreIDOrCategoryToRootPathsForProto(protoConfig.GetIgnoreIdPaths()), + IgnoreUnstablePackages: protoConfig.GetIgnoreUnstablePackages(), + Version: protoConfig.GetVersion(), + } +} + +// ProtoForConfig takes a *Config and returns the proto representation. +func ProtoForConfig(config *Config) *breakingv1.Config { + return &breakingv1.Config{ + UseIds: config.Use, + ExceptIds: config.Except, + IgnorePaths: config.IgnoreRootPaths, + IgnoreIdPaths: protoForIgnoreIDOrCategoryToRootPaths(config.IgnoreIDOrCategoryToRootPaths), + IgnoreUnstablePackages: config.IgnoreUnstablePackages, + Version: config.Version, + } +} + +// ExternalConfigV1Beta1 is an external config. +type ExternalConfigV1Beta1 struct { + Use []string `json:"use,omitempty" yaml:"use,omitempty"` + Except []string `json:"except,omitempty" yaml:"except,omitempty"` + // IgnoreRootPaths + Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"` + // IgnoreIDOrCategoryToRootPaths + IgnoreOnly map[string][]string `json:"ignore_only,omitempty" yaml:"ignore_only,omitempty"` + IgnoreUnstablePackages bool `json:"ignore_unstable_packages,omitempty" yaml:"ignore_unstable_packages,omitempty"` +} + +// ExternalConfigV1 is an external config. +type ExternalConfigV1 struct { + Use []string `json:"use,omitempty" yaml:"use,omitempty"` + Except []string `json:"except,omitempty" yaml:"except,omitempty"` + // IgnoreRootPaths + Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"` + // IgnoreIDOrCategoryToRootPaths + IgnoreOnly map[string][]string `json:"ignore_only,omitempty" yaml:"ignore_only,omitempty"` + IgnoreUnstablePackages bool `json:"ignore_unstable_packages,omitempty" yaml:"ignore_unstable_packages,omitempty"` +} + +// ExternalConfigV1Beta1ForConfig takes a *Config and returns the v1beta1 external config representation. +func ExternalConfigV1Beta1ForConfig(config *Config) ExternalConfigV1Beta1 { + return ExternalConfigV1Beta1{ + Use: config.Use, + Except: config.Except, + Ignore: config.IgnoreRootPaths, + IgnoreOnly: config.IgnoreIDOrCategoryToRootPaths, + IgnoreUnstablePackages: config.IgnoreUnstablePackages, + } +} + +// ExternalConfigV1ForConfig takes a *Config and returns the v1 external config representation. +func ExternalConfigV1ForConfig(config *Config) ExternalConfigV1 { + return ExternalConfigV1{ + Use: config.Use, + Except: config.Except, + Ignore: config.IgnoreRootPaths, + IgnoreOnly: config.IgnoreIDOrCategoryToRootPaths, + IgnoreUnstablePackages: config.IgnoreUnstablePackages, + } +} + +// BytesForConfig takes a *Config and returns the deterministic []byte representation. +// We use an unexported intermediary JSON form and sort all fields to ensure that the bytes +// associated with the *Config are deterministic. +func BytesForConfig(config *Config) ([]byte, error) { + if config == nil { + return nil, nil + } + return json.Marshal(configToJSON(config)) +} + +type configJSON struct { + Use []string `json:"use,omitempty"` + Except []string `json:"except,omitempty"` + IgnoreRootPaths []string `json:"ignore_root_paths,omitempty"` + IgnoreIDOrCategoryToRootPaths []idPathsJSON `json:"ignore_id_to_root_paths,omitempty"` + IgnoreUnstablePackages bool `json:"ignore_unstable_packages,omitempty"` + Version string `json:"version,omitempty"` +} + +type idPathsJSON struct { + ID string `json:"id,omitempty"` + Paths []string `json:"paths,omitempty"` +} + +func configToJSON(config *Config) *configJSON { + ignoreIDPathsJSON := make([]idPathsJSON, 0, len(config.IgnoreIDOrCategoryToRootPaths)) + for ignoreID, rootPaths := range config.IgnoreIDOrCategoryToRootPaths { + rootPathsCopy := make([]string, len(rootPaths)) + copy(rootPathsCopy, rootPaths) + sort.Strings(rootPathsCopy) + ignoreIDPathsJSON = append(ignoreIDPathsJSON, idPathsJSON{ + ID: ignoreID, + Paths: rootPathsCopy, + }) + } + sort.Slice(ignoreIDPathsJSON, func(i, j int) bool { return ignoreIDPathsJSON[i].ID < ignoreIDPathsJSON[j].ID }) + // We should not be sorting in place for the config structure, since it will mutate the + // underlying config ordering. + use := make([]string, len(config.Use)) + copy(use, config.Use) + except := make([]string, len(config.Except)) + copy(except, config.Except) + ignoreRootPaths := make([]string, len(config.IgnoreRootPaths)) + copy(ignoreRootPaths, config.IgnoreRootPaths) + sort.Strings(use) + sort.Strings(except) + sort.Strings(ignoreRootPaths) + return &configJSON{ + Use: use, + Except: except, + IgnoreRootPaths: ignoreRootPaths, + IgnoreIDOrCategoryToRootPaths: ignoreIDPathsJSON, + IgnoreUnstablePackages: config.IgnoreUnstablePackages, + Version: config.Version, + } +} + +func ignoreIDOrCategoryToRootPathsForProto(protoIgnoreIDPaths []*breakingv1.IDPaths) map[string][]string { + if protoIgnoreIDPaths == nil { + return nil + } + ignoreIDOrCategoryToRootPaths := make(map[string][]string) + for _, protoIgnoreIDPath := range protoIgnoreIDPaths { + ignoreIDOrCategoryToRootPaths[protoIgnoreIDPath.GetId()] = protoIgnoreIDPath.GetPaths() + } + return ignoreIDOrCategoryToRootPaths +} + +func protoForIgnoreIDOrCategoryToRootPaths(ignoreIDOrCategoryToRootPaths map[string][]string) []*breakingv1.IDPaths { + if ignoreIDOrCategoryToRootPaths == nil { + return nil + } + idPathsProto := make([]*breakingv1.IDPaths, 0, len(ignoreIDOrCategoryToRootPaths)) + for id, paths := range ignoreIDOrCategoryToRootPaths { + idPathsProto = append(idPathsProto, &breakingv1.IDPaths{ + Id: id, + Paths: paths, + }) + } + return idPathsProto +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/handler.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/handler.go new file mode 100644 index 000000000..410f42e7d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/handler.go @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufbreaking + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimageutil" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "go.uber.org/zap" +) + +type handler struct { + logger *zap.Logger + runner *internal.Runner +} + +func newHandler( + logger *zap.Logger, +) *handler { + return &handler{ + logger: logger, + // comment ignores are not allowed for breaking changes + // so do not set the ignore prefix per the RunnerWithIgnorePrefix comments + runner: internal.NewRunner(logger), + } +} + +func (h *handler) Check( + ctx context.Context, + config *bufbreakingconfig.Config, + previousImage bufimage.Image, + image bufimage.Image, +) ([]bufanalysis.FileAnnotation, error) { + previousFiles, err := protosource.NewFilesUnstable(ctx, bufimageutil.NewInputFiles(previousImage.Files())...) + if err != nil { + return nil, err + } + files, err := protosource.NewFilesUnstable(ctx, bufimageutil.NewInputFiles(image.Files())...) + if err != nil { + return nil, err + } + internalConfig, err := internalConfigForConfig(config) + if err != nil { + return nil, err + } + return h.runner.Check(ctx, internalConfig, previousFiles, files) +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingbuild/bufbreakingbuild.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingbuild/bufbreakingbuild.go new file mode 100644 index 000000000..447817a96 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingbuild/bufbreakingbuild.go @@ -0,0 +1,372 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufbreakingbuild contains the RuleBuilders used by bufbreakingv*. +// +// In the future, we can have multiple versions of a RuleBuilder here, and then +// include them separately in the bufbreakingv* packages. For example, FieldSameTypeRuleBuilder +// could be split into FieldSameTypeRuleBuilder/FieldSameTypeRuleBuilderV2 which handle +// primitives differently, and we could use the former in v1beta1, and the latter in v1. +package bufbreakingbuild + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" +) + +var ( + // EnumNoDeleteRuleBuilder is a rule builder. + EnumNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_NO_DELETE", + "enums are not deleted from a given file", + bufbreakingcheck.CheckEnumNoDelete, + ) + // EnumValueNoDeleteRuleBuilder is a rule builder. + EnumValueNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_VALUE_NO_DELETE", + "enum values are not deleted from a given enum", + bufbreakingcheck.CheckEnumValueNoDelete, + ) + // EnumValueNoDeleteUnlessNameReservedRuleBuilder is a rule builder. + EnumValueNoDeleteUnlessNameReservedRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED", + "enum values are not deleted from a given enum unless the name is reserved", + bufbreakingcheck.CheckEnumValueNoDeleteUnlessNameReserved, + ) + // EnumValueNoDeleteUnlessNumberReservedRuleBuilder is a rule builder. + EnumValueNoDeleteUnlessNumberReservedRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED", + "enum values are not deleted from a given enum unless the number is reserved", + bufbreakingcheck.CheckEnumValueNoDeleteUnlessNumberReserved, + ) + // EnumValueSameNameRuleBuilder is a rule builder. + EnumValueSameNameRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_VALUE_SAME_NAME", + "enum values have the same name", + bufbreakingcheck.CheckEnumValueSameName, + ) + // ExtensionMessageNoDeleteRuleBuilder is a rule builder. + ExtensionMessageNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "EXTENSION_MESSAGE_NO_DELETE", + "extension ranges are not deleted from a given message", + bufbreakingcheck.CheckExtensionMessageNoDelete, + ) + // FieldNoDeleteRuleBuilder is a rule builder. + FieldNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_NO_DELETE", + "fields are not deleted from a given message", + bufbreakingcheck.CheckFieldNoDelete, + ) + // FieldNoDeleteUnlessNameReservedRuleBuilder is a rule builder. + FieldNoDeleteUnlessNameReservedRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_NO_DELETE_UNLESS_NAME_RESERVED", + "fields are not deleted from a given message unless the name is reserved", + bufbreakingcheck.CheckFieldNoDeleteUnlessNameReserved, + ) + // FieldNoDeleteUnlessNumberReservedRuleBuilder is a rule builder. + FieldNoDeleteUnlessNumberReservedRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED", + "fields are not deleted from a given message unless the number is reserved", + bufbreakingcheck.CheckFieldNoDeleteUnlessNumberReserved, + ) + // FieldSameCTypeRuleBuilder is a rule builder. + FieldSameCTypeRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_SAME_CTYPE", + "fields have the same value for the ctype option", + bufbreakingcheck.CheckFieldSameCType, + ) + // FieldSameJSONNameRuleBuilder is a rule builder. + FieldSameJSONNameRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_SAME_JSON_NAME", + "fields have the same value for the json_name option", + bufbreakingcheck.CheckFieldSameJSONName, + ) + // FieldSameJSTypeRuleBuilder is a rule builder. + FieldSameJSTypeRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_SAME_JSTYPE", + "fields have the same value for the jstype option", + bufbreakingcheck.CheckFieldSameJSType, + ) + // FieldSameLabelRuleBuilder is a rule builder. + FieldSameLabelRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_SAME_LABEL", + "fields have the same labels in a given message", + bufbreakingcheck.CheckFieldSameLabel, + ) + // FieldSameNameRuleBuilder is a rule builder. + FieldSameNameRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_SAME_NAME", + "fields have the same names in a given message", + bufbreakingcheck.CheckFieldSameName, + ) + // FieldSameOneofRuleBuilder is a rule builder. + FieldSameOneofRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_SAME_ONEOF", + "fields have the same oneofs in a given message", + bufbreakingcheck.CheckFieldSameOneof, + ) + // FieldSameTypeRuleBuilder is a rule builder. + FieldSameTypeRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_SAME_TYPE", + "fields have the same types in a given message", + bufbreakingcheck.CheckFieldSameType, + ) + // FieldWireCompatibleTypeRuleBuilder is a rule builder. + FieldWireCompatibleTypeRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_WIRE_COMPATIBLE_TYPE", + "fields have wire-compatible types in a given message", + bufbreakingcheck.CheckFieldWireCompatibleType, + ) + // FieldWireJSONCompatibleTypeRuleBuilder is a rule builder. + FieldWireJSONCompatibleTypeRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_WIRE_JSON_COMPATIBLE_TYPE", + "fields have wire and JSON compatible types in a given message", + bufbreakingcheck.CheckFieldWireJSONCompatibleType, + ) + // FileNoDeleteRuleBuilder is a rule builder. + FileNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "FILE_NO_DELETE", + "files are not deleted", + bufbreakingcheck.CheckFileNoDelete, + ) + // FileSameCsharpNamespaceRuleBuilder is a rule builder. + FileSameCsharpNamespaceRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_CSHARP_NAMESPACE", + "files have the same value for the csharp_namespace option", + bufbreakingcheck.CheckFileSameCsharpNamespace, + ) + // FileSameGoPackageRuleBuilder is a rule builder. + FileSameGoPackageRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_GO_PACKAGE", + "files have the same value for the go_package option", + bufbreakingcheck.CheckFileSameGoPackage, + ) + // FileSameJavaMultipleFilesRuleBuilder is a rule builder. + FileSameJavaMultipleFilesRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_JAVA_MULTIPLE_FILES", + "files have the same value for the java_multiple_files option", + bufbreakingcheck.CheckFileSameJavaMultipleFiles, + ) + // FileSameJavaOuterClassnameRuleBuilder is a rule builder. + FileSameJavaOuterClassnameRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_JAVA_OUTER_CLASSNAME", + "files have the same value for the java_outer_classname option", + bufbreakingcheck.CheckFileSameJavaOuterClassname, + ) + // FileSameJavaPackageRuleBuilder is a rule builder. + FileSameJavaPackageRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_JAVA_PACKAGE", + "files have the same value for the java_package option", + bufbreakingcheck.CheckFileSameJavaPackage, + ) + // FileSameJavaStringCheckUtf8RuleBuilder is a rule builder. + FileSameJavaStringCheckUtf8RuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_JAVA_STRING_CHECK_UTF8", + "files have the same value for the java_string_check_utf8 option", + bufbreakingcheck.CheckFileSameJavaStringCheckUtf8, + ) + // FileSameObjcClassPrefixRuleBuilder is a rule builder. + FileSameObjcClassPrefixRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_OBJC_CLASS_PREFIX", + "files have the same value for the objc_class_prefix option", + bufbreakingcheck.CheckFileSameObjcClassPrefix, + ) + // FileSamePackageRuleBuilder is a rule builder. + FileSamePackageRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_PACKAGE", + "files have the same package", + bufbreakingcheck.CheckFileSamePackage, + ) + // FileSamePhpClassPrefixRuleBuilder is a rule builder. + FileSamePhpClassPrefixRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_PHP_CLASS_PREFIX", + "files have the same value for the php_class_prefix option", + bufbreakingcheck.CheckFileSamePhpClassPrefix, + ) + // FileSamePhpMetadataNamespaceRuleBuilder is a rule builder. + FileSamePhpMetadataNamespaceRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_PHP_METADATA_NAMESPACE", + "files have the same value for the php_metadata_namespace option", + bufbreakingcheck.CheckFileSamePhpMetadataNamespace, + ) + // FileSamePhpNamespaceRuleBuilder is a rule builder. + FileSamePhpNamespaceRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_PHP_NAMESPACE", + "files have the same value for the php_namespace option", + bufbreakingcheck.CheckFileSamePhpNamespace, + ) + // FileSameRubyPackageRuleBuilder is a rule builder. + FileSameRubyPackageRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_RUBY_PACKAGE", + "files have the same value for the ruby_package option", + bufbreakingcheck.CheckFileSameRubyPackage, + ) + // FileSameSwiftPrefixRuleBuilder is a rule builder. + FileSameSwiftPrefixRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_SWIFT_PREFIX", + "files have the same value for the swift_prefix option", + bufbreakingcheck.CheckFileSameSwiftPrefix, + ) + // FileSameOptimizeForRuleBuilder is a rule builder. + FileSameOptimizeForRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_OPTIMIZE_FOR", + "files have the same value for the optimize_for option", + bufbreakingcheck.CheckFileSameOptimizeFor, + ) + // FileSameCcGenericServicesRuleBuilder is a rule builder. + FileSameCcGenericServicesRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_CC_GENERIC_SERVICES", + "files have the same value for the cc_generic_services option", + bufbreakingcheck.CheckFileSameCcGenericServices, + ) + // FileSameJavaGenericServicesRuleBuilder is a rule builder. + FileSameJavaGenericServicesRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_JAVA_GENERIC_SERVICES", + "files have the same value for the java_generic_services option", + bufbreakingcheck.CheckFileSameJavaGenericServices, + ) + // FileSamePyGenericServicesRuleBuilder is a rule builder. + FileSamePyGenericServicesRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_PY_GENERIC_SERVICES", + "files have the same value for the py_generic_services option", + bufbreakingcheck.CheckFileSamePyGenericServices, + ) + // FileSamePhpGenericServicesRuleBuilder is a rule builder. + FileSamePhpGenericServicesRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_PHP_GENERIC_SERVICES", + "files have the same value for the php_generic_services option", + bufbreakingcheck.CheckFileSamePhpGenericServices, + ) + // FileSameCcEnableArenasRuleBuilder is a rule builder. + FileSameCcEnableArenasRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_CC_ENABLE_ARENAS", + "files have the same value for the cc_enable_arenas option", + bufbreakingcheck.CheckFileSameCcEnableArenas, + ) + // FileSameSyntaxRuleBuilder is a rule builder. + FileSameSyntaxRuleBuilder = internal.NewNopRuleBuilder( + "FILE_SAME_SYNTAX", + "files have the same syntax", + bufbreakingcheck.CheckFileSameSyntax, + ) + // MessageNoDeleteRuleBuilder is a rule builder. + MessageNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "MESSAGE_NO_DELETE", + "messages are not deleted from a given file", + bufbreakingcheck.CheckMessageNoDelete, + ) + // MessageNoRemoveStandardDescriptorAccessorRuleBuilder is a rule builder. + MessageNoRemoveStandardDescriptorAccessorRuleBuilder = internal.NewNopRuleBuilder( + "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR", + "messages do not change the no_standard_descriptor_accessor option from false or unset to true", + bufbreakingcheck.CheckMessageNoRemoveStandardDescriptorAccessor, + ) + // MessageSameMessageSetWireFormatRuleBuilder is a rule builder. + MessageSameMessageSetWireFormatRuleBuilder = internal.NewNopRuleBuilder( + "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT", + "messages have the same value for the message_set_wire_format option", + bufbreakingcheck.CheckMessageSameMessageSetWireFormat, + ) + // MessageSameRequiredFieldsRuleBuilder is a rule builder. + MessageSameRequiredFieldsRuleBuilder = internal.NewNopRuleBuilder( + "MESSAGE_SAME_REQUIRED_FIELDS", + "messages have no added or deleted required fields", + bufbreakingcheck.CheckMessageSameRequiredFields, + ) + // OneofNoDeleteRuleBuilder is a rule builder. + OneofNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "ONEOF_NO_DELETE", + "oneofs are not deleted from a given message", + bufbreakingcheck.CheckOneofNoDelete, + ) + // PackageEnumNoDeleteRuleBuilder is a rule builder. + PackageEnumNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_ENUM_NO_DELETE", + "enums are not deleted from a given package", + bufbreakingcheck.CheckPackageEnumNoDelete, + ) + // PackageMessageNoDeleteRuleBuilder is a rule builder. + PackageMessageNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_MESSAGE_NO_DELETE", + "messages are not deleted from a given package", + bufbreakingcheck.CheckPackageMessageNoDelete, + ) + // PackageNoDeleteRuleBuilder is a rule builder. + PackageNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_NO_DELETE", + "packages are not deleted", + bufbreakingcheck.CheckPackageNoDelete, + ) + // PackageServiceNoDeleteRuleBuilder is a rule builder. + PackageServiceNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SERVICE_NO_DELETE", + "services are not deleted from a given package", + bufbreakingcheck.CheckPackageServiceNoDelete, + ) + // ReservedEnumNoDeleteRuleBuilder is a rule builder. + ReservedEnumNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "RESERVED_ENUM_NO_DELETE", + "reserved ranges and names are not deleted from a given enum", + bufbreakingcheck.CheckReservedEnumNoDelete, + ) + // ReservedMessageNoDeleteRuleBuilder is a rule builder. + ReservedMessageNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "RESERVED_MESSAGE_NO_DELETE", + "reserved ranges and names are not deleted from a given message", + bufbreakingcheck.CheckReservedMessageNoDelete, + ) + // RPCNoDeleteRuleBuilder is a rule builder. + RPCNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "RPC_NO_DELETE", + "rpcs are not deleted from a given service", + bufbreakingcheck.CheckRPCNoDelete, + ) + // RPCSameClientStreamingRuleBuilder is a rule builder. + RPCSameClientStreamingRuleBuilder = internal.NewNopRuleBuilder( + "RPC_SAME_CLIENT_STREAMING", + "rpcs have the same client streaming value", + bufbreakingcheck.CheckRPCSameClientStreaming, + ) + // RPCSameIdempotencyLevelRuleBuilder is a rule builder. + RPCSameIdempotencyLevelRuleBuilder = internal.NewNopRuleBuilder( + "RPC_SAME_IDEMPOTENCY_LEVEL", + "rpcs have the same value for the idempotency_level option", + bufbreakingcheck.CheckRPCSameIdempotencyLevel, + ) + // RPCSameRequestTypeRuleBuilder is a rule builder. + RPCSameRequestTypeRuleBuilder = internal.NewNopRuleBuilder( + "RPC_SAME_REQUEST_TYPE", + "rpcs are have the same request type", + bufbreakingcheck.CheckRPCSameRequestType, + ) + // RPCSameResponseTypeRuleBuilder is a rule builder. + RPCSameResponseTypeRuleBuilder = internal.NewNopRuleBuilder( + "RPC_SAME_RESPONSE_TYPE", + "rpcs are have the same response type", + bufbreakingcheck.CheckRPCSameResponseType, + ) + // RPCSameServerStreamingRuleBuilder is a rule builder. + RPCSameServerStreamingRuleBuilder = internal.NewNopRuleBuilder( + "RPC_SAME_SERVER_STREAMING", + "rpcs have the same server streaming value", + bufbreakingcheck.CheckRPCSameServerStreaming, + ) + // ServiceNoDeleteRuleBuilder is a rule builder. + ServiceNoDeleteRuleBuilder = internal.NewNopRuleBuilder( + "SERVICE_NO_DELETE", + "services are not deleted from a given file", + bufbreakingcheck.CheckServiceNoDelete, + ) +) diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/bufbreakingcheck.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/bufbreakingcheck.go new file mode 100644 index 000000000..fe1adda40 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/bufbreakingcheck.go @@ -0,0 +1,1106 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufbreakingcheck impelements the check functions. +// +// These are used by bufbreakingbuild to create RuleBuilders. +package bufbreakingcheck + +import ( + "errors" + "fmt" + "strconv" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "google.golang.org/protobuf/types/descriptorpb" +) + +// CheckEnumNoDelete is a check function. +var CheckEnumNoDelete = newFilePairCheckFunc(checkEnumNoDelete) + +func checkEnumNoDelete(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + previousNestedNameToEnum, err := protosource.NestedNameToEnum(previousFile) + if err != nil { + return err + } + nestedNameToEnum, err := protosource.NestedNameToEnum(file) + if err != nil { + return err + } + for previousNestedName := range previousNestedNameToEnum { + if _, ok := nestedNameToEnum[previousNestedName]; !ok { + // TODO: search for enum in other files and return that the enum was moved? + descriptor, location, err := getDescriptorAndLocationForDeletedEnum(file, previousNestedName) + if err != nil { + return err + } + add(descriptor, nil, location, `Previously present enum %q was deleted from file.`, previousNestedName) + } + } + return nil +} + +// CheckEnumValueNoDelete is a check function. +var CheckEnumValueNoDelete = newEnumPairCheckFunc(checkEnumValueNoDelete) + +func checkEnumValueNoDelete(add addFunc, corpus *corpus, previousEnum protosource.Enum, enum protosource.Enum) error { + return checkEnumValueNoDeleteWithRules(add, previousEnum, enum, false, false) +} + +// CheckEnumValueNoDeleteUnlessNumberReserved is a check function. +var CheckEnumValueNoDeleteUnlessNumberReserved = newEnumPairCheckFunc(checkEnumValueNoDeleteUnlessNumberReserved) + +func checkEnumValueNoDeleteUnlessNumberReserved(add addFunc, corpus *corpus, previousEnum protosource.Enum, enum protosource.Enum) error { + return checkEnumValueNoDeleteWithRules(add, previousEnum, enum, true, false) +} + +// CheckEnumValueNoDeleteUnlessNameReserved is a check function. +var CheckEnumValueNoDeleteUnlessNameReserved = newEnumPairCheckFunc(checkEnumValueNoDeleteUnlessNameReserved) + +func checkEnumValueNoDeleteUnlessNameReserved(add addFunc, corpus *corpus, previousEnum protosource.Enum, enum protosource.Enum) error { + return checkEnumValueNoDeleteWithRules(add, previousEnum, enum, false, true) +} + +func checkEnumValueNoDeleteWithRules(add addFunc, previousEnum protosource.Enum, enum protosource.Enum, allowIfNumberReserved bool, allowIfNameReserved bool) error { + previousNumberToNameToEnumValue, err := protosource.NumberToNameToEnumValue(previousEnum) + if err != nil { + return err + } + numberToNameToEnumValue, err := protosource.NumberToNameToEnumValue(enum) + if err != nil { + return err + } + for previousNumber, previousNameToEnumValue := range previousNumberToNameToEnumValue { + if _, ok := numberToNameToEnumValue[previousNumber]; !ok { + if !isDeletedEnumValueAllowedWithRules(previousNumber, previousNameToEnumValue, enum, allowIfNumberReserved, allowIfNameReserved) { + suffix := "" + if allowIfNumberReserved && allowIfNameReserved { + return errors.New("both allowIfNumberReserved and allowIfNameReserved set") + } + if allowIfNumberReserved { + suffix = fmt.Sprintf(` without reserving the number "%d"`, previousNumber) + } + if allowIfNameReserved { + nameSuffix := "" + if len(previousNameToEnumValue) > 1 { + nameSuffix = "s" + } + suffix = fmt.Sprintf(` without reserving the name%s %s`, nameSuffix, stringutil.JoinSliceQuoted(getSortedEnumValueNames(previousNameToEnumValue), ", ")) + } + add(enum, nil, enum.Location(), `Previously present enum value "%d" on enum %q was deleted%s.`, previousNumber, enum.Name(), suffix) + } + } + } + return nil +} + +func isDeletedEnumValueAllowedWithRules(previousNumber int, previousNameToEnumValue map[string]protosource.EnumValue, enum protosource.Enum, allowIfNumberReserved bool, allowIfNameReserved bool) bool { + if allowIfNumberReserved { + return protosource.NumberInReservedRanges(previousNumber, enum.ReservedTagRanges()...) + } + if allowIfNameReserved { + // if true for all names, then ok + for previousName := range previousNameToEnumValue { + if !protosource.NameInReservedNames(previousName, enum.ReservedNames()...) { + return false + } + } + return true + } + return false +} + +// CheckEnumValueSameName is a check function. +var CheckEnumValueSameName = newEnumValuePairCheckFunc(checkEnumValueSameName) + +func checkEnumValueSameName(add addFunc, corpus *corpus, previousNameToEnumValue map[string]protosource.EnumValue, nameToEnumValue map[string]protosource.EnumValue) error { + previousNames := getSortedEnumValueNames(previousNameToEnumValue) + names := getSortedEnumValueNames(nameToEnumValue) + // all current names for this number need to be in the previous set + // ie if you now have FOO=2, BAR=2, you need to have had FOO=2, BAR=2 previously + // FOO=2, BAR=2, BAZ=2 now would pass + // FOO=2, BAR=2, BAZ=2 previously would fail + if !stringutil.SliceElementsContained(names, previousNames) { + previousNamesString := stringutil.JoinSliceQuoted(previousNames, ", ") + namesString := stringutil.JoinSliceQuoted(names, ", ") + nameSuffix := "" + if len(previousNames) > 1 && len(names) > 1 { + nameSuffix = "s" + } + for _, enumValue := range nameToEnumValue { + add(enumValue, nil, enumValue.NumberLocation(), `Enum value "%d" on enum %q changed name%s from %s to %s.`, enumValue.Number(), enumValue.Enum().Name(), nameSuffix, previousNamesString, namesString) + } + } + return nil +} + +// CheckExtensionMessageNoDelete is a check function. +var CheckExtensionMessageNoDelete = newMessagePairCheckFunc(checkExtensionMessageNoDelete) + +func checkExtensionMessageNoDelete(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + previousStringToExtensionRange := protosource.StringToExtensionMessageRange(previousMessage) + stringToExtensionRange := protosource.StringToExtensionMessageRange(message) + for previousString := range previousStringToExtensionRange { + if _, ok := stringToExtensionRange[previousString]; !ok { + add(message, nil, message.Location(), `Previously present extension range %q on message %q was deleted.`, previousString, message.Name()) + } + } + return nil +} + +// CheckFieldNoDelete is a check function. +var CheckFieldNoDelete = newMessagePairCheckFunc(checkFieldNoDelete) + +func checkFieldNoDelete(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + return checkFieldNoDeleteWithRules(add, previousMessage, message, false, false) +} + +// CheckFieldNoDeleteUnlessNumberReserved is a check function. +var CheckFieldNoDeleteUnlessNumberReserved = newMessagePairCheckFunc(checkFieldNoDeleteUnlessNumberReserved) + +func checkFieldNoDeleteUnlessNumberReserved(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + return checkFieldNoDeleteWithRules(add, previousMessage, message, true, false) +} + +// CheckFieldNoDeleteUnlessNameReserved is a check function. +var CheckFieldNoDeleteUnlessNameReserved = newMessagePairCheckFunc(checkFieldNoDeleteUnlessNameReserved) + +func checkFieldNoDeleteUnlessNameReserved(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + return checkFieldNoDeleteWithRules(add, previousMessage, message, false, true) +} + +func checkFieldNoDeleteWithRules(add addFunc, previousMessage protosource.Message, message protosource.Message, allowIfNumberReserved bool, allowIfNameReserved bool) error { + previousNumberToField, err := protosource.NumberToMessageField(previousMessage) + if err != nil { + return err + } + numberToField, err := protosource.NumberToMessageField(message) + if err != nil { + return err + } + for previousNumber, previousField := range previousNumberToField { + if _, ok := numberToField[previousNumber]; !ok { + if !isDeletedFieldAllowedWithRules(previousField, message, allowIfNumberReserved, allowIfNameReserved) { + // otherwise prints as hex + previousNumberString := strconv.FormatInt(int64(previousNumber), 10) + suffix := "" + if allowIfNumberReserved && allowIfNameReserved { + return errors.New("both allowIfNumberReserved and allowIfNameReserved set") + } + if allowIfNumberReserved { + suffix = fmt.Sprintf(` without reserving the number "%d"`, previousField.Number()) + } + if allowIfNameReserved { + suffix = fmt.Sprintf(` without reserving the name %q`, previousField.Name()) + } + add(message, nil, message.Location(), `Previously present field %q with name %q on message %q was deleted%s.`, previousNumberString, previousField.Name(), message.Name(), suffix) + } + } + } + return nil +} + +func isDeletedFieldAllowedWithRules(previousField protosource.Field, message protosource.Message, allowIfNumberReserved bool, allowIfNameReserved bool) bool { + return (allowIfNumberReserved && protosource.NumberInReservedRanges(previousField.Number(), message.ReservedTagRanges()...)) || + (allowIfNameReserved && protosource.NameInReservedNames(previousField.Name(), message.ReservedNames()...)) +} + +// CheckFieldSameCType is a check function. +var CheckFieldSameCType = newFieldPairCheckFunc(checkFieldSameCType) + +func checkFieldSameCType(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + if previousField.CType() != field.CType() { + // otherwise prints as hex + numberString := strconv.FormatInt(int64(field.Number()), 10) + add(field, nil, withBackupLocation(field.CTypeLocation(), field.Location()), `Field %q with name %q on message %q changed option "ctype" from %q to %q.`, numberString, field.Name(), field.Message().Name(), previousField.CType().String(), field.CType().String()) + } + return nil +} + +// CheckFieldSameJSONName is a check function. +var CheckFieldSameJSONName = newFieldPairCheckFunc(checkFieldSameJSONName) + +func checkFieldSameJSONName(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + if previousField.JSONName() != field.JSONName() { + // otherwise prints as hex + numberString := strconv.FormatInt(int64(field.Number()), 10) + add(field, nil, withBackupLocation(field.JSONNameLocation(), field.Location()), `Field %q with name %q on message %q changed option "json_name" from %q to %q.`, numberString, field.Name(), field.Message().Name(), previousField.JSONName(), field.JSONName()) + } + return nil +} + +// CheckFieldSameJSType is a check function. +var CheckFieldSameJSType = newFieldPairCheckFunc(checkFieldSameJSType) + +func checkFieldSameJSType(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + if previousField.JSType() != field.JSType() { + // otherwise prints as hex + numberString := strconv.FormatInt(int64(field.Number()), 10) + add(field, nil, withBackupLocation(field.JSTypeLocation(), field.Location()), `Field %q with name %q on message %q changed option "jstype" from %q to %q.`, numberString, field.Name(), field.Message().Name(), previousField.JSType().String(), field.JSType().String()) + } + return nil +} + +// CheckFieldSameLabel is a check function. +var CheckFieldSameLabel = newFieldPairCheckFunc(checkFieldSameLabel) + +func checkFieldSameLabel(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + if previousField.Label() != field.Label() { + // otherwise prints as hex + numberString := strconv.FormatInt(int64(field.Number()), 10) + // TODO: specific label location + add(field, nil, field.Location(), `Field %q on message %q changed label from %q to %q.`, numberString, field.Message().Name(), protodescriptor.FieldDescriptorProtoLabelPrettyString(previousField.Label()), protodescriptor.FieldDescriptorProtoLabelPrettyString(field.Label())) + } + return nil +} + +// CheckFieldSameName is a check function. +var CheckFieldSameName = newFieldPairCheckFunc(checkFieldSameName) + +func checkFieldSameName(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + if previousField.Name() != field.Name() { + // otherwise prints as hex + numberString := strconv.FormatInt(int64(field.Number()), 10) + add(field, nil, field.NameLocation(), `Field %q on message %q changed name from %q to %q.`, numberString, field.Message().Name(), previousField.Name(), field.Name()) + } + return nil +} + +// CheckFieldSameOneof is a check function. +var CheckFieldSameOneof = newFieldPairCheckFunc(checkFieldSameOneof) + +func checkFieldSameOneof(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + previousOneof := previousField.Oneof() + oneof := field.Oneof() + previousInsideOneof := previousOneof != nil + insideOneof := oneof != nil + if !previousInsideOneof && !insideOneof { + return nil + } + if previousInsideOneof && insideOneof { + if previousOneof.Name() != oneof.Name() { + // otherwise prints as hex + numberString := strconv.FormatInt(int64(field.Number()), 10) + add(field, nil, field.Location(), `Field %q on message %q moved from oneof %q to oneof %q.`, numberString, field.Message().Name(), previousOneof.Name(), oneof.Name()) + } + return nil + } + + previous := "inside" + current := "outside" + if insideOneof { + previous = "outside" + current = "inside" + } + // otherwise prints as hex + numberString := strconv.FormatInt(int64(field.Number()), 10) + add(field, nil, field.Location(), `Field %q on message %q moved from %s to %s a oneof.`, numberString, field.Message().Name(), previous, current) + return nil +} + +// TODO: locations not working for map entries +// TODO: weird output for map entries: +// +// breaking_field_same_type/1.proto:1:1:Field "2" on message "SixEntry" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:1:1:Field "2" on message "SixEntry" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:1:1:Field "2" on message "SixEntry" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:8:3:Field "1" on message "Two" changed type from "int32" to "int64". +// breaking_field_same_type/1.proto:9:3:Field "2" on message "Two" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:11:3:Field "4" on message "Two" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:12:3:Field "5" on message "Two" changed type from ".a.Two.FiveEntry" to ".a.Two". +// breaking_field_same_type/1.proto:19:7:Field "1" on message "Five" changed type from "int32" to "int64". +// breaking_field_same_type/1.proto:20:7:Field "2" on message "Five" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:22:7:Field "4" on message "Five" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:23:7:Field "5" on message "Five" changed type from ".a.Three.Four.Five.FiveEntry" to ".a.Two". +// breaking_field_same_type/1.proto:36:5:Field "1" on message "Seven" changed type from "int32" to "int64". +// breaking_field_same_type/1.proto:37:5:Field "2" on message "Seven" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:39:5:Field "4" on message "Seven" changed type from ".a.One" to ".a.Two". +// breaking_field_same_type/1.proto:40:5:Field "5" on message "Seven" changed type from ".a.Three.Seven.FiveEntry" to ".a.Two". +// breaking_field_same_type/2.proto:64:5:Field "1" on message "Nine" changed type from "int32" to "int64". +// breaking_field_same_type/2.proto:65:5:Field "2" on message "Nine" changed type from ".a.One" to ".a.Nine". + +// CheckFieldSameType is a check function. +var CheckFieldSameType = newFieldPairCheckFunc(checkFieldSameType) + +func checkFieldSameType(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + if previousField.Type() != field.Type() { + addFieldChangedType(add, previousField, field) + return nil + } + + switch field.Type() { + case descriptorpb.FieldDescriptorProto_TYPE_ENUM, + descriptorpb.FieldDescriptorProto_TYPE_GROUP, + descriptorpb.FieldDescriptorProto_TYPE_MESSAGE: + if previousField.TypeName() != field.TypeName() { + addEnumGroupMessageFieldChangedTypeName(add, previousField, field) + } + } + return nil +} + +// CheckFieldWireCompatibleType is a check function. +var CheckFieldWireCompatibleType = newFieldPairCheckFunc(checkFieldWireCompatibleType) + +func checkFieldWireCompatibleType(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + previousWireCompatibilityGroup, ok := fieldDescriptorProtoTypeToWireCompatiblityGroup[previousField.Type()] + if !ok { + return fmt.Errorf("unknown FieldDescriptorProtoType: %v", previousField.Type()) + } + wireCompatibilityGroup, ok := fieldDescriptorProtoTypeToWireCompatiblityGroup[field.Type()] + if !ok { + return fmt.Errorf("unknown FieldDescriptorProtoType: %v", field.Type()) + } + if previousWireCompatibilityGroup != wireCompatibilityGroup { + extraMessages := []string{ + "See https://developers.google.com/protocol-buffers/docs/proto3#updating for wire compatibility rules.", + } + switch { + case previousField.Type() == descriptorpb.FieldDescriptorProto_TYPE_STRING && field.Type() == descriptorpb.FieldDescriptorProto_TYPE_BYTES: + // It is OK to evolve from string to bytes + return nil + case previousField.Type() == descriptorpb.FieldDescriptorProto_TYPE_BYTES && field.Type() == descriptorpb.FieldDescriptorProto_TYPE_STRING: + extraMessages = append( + extraMessages, + "Note that while string and bytes are compatible if the data is valid UTF-8, there is no way to enforce that a field is UTF-8, so these fields may be incompatible.", + ) + } + addFieldChangedType(add, previousField, field, extraMessages...) + return nil + } + switch field.Type() { + case descriptorpb.FieldDescriptorProto_TYPE_ENUM: + if previousField.TypeName() != field.TypeName() { + return checkEnumWireCompatibleForField(add, corpus, previousField, field) + } + case descriptorpb.FieldDescriptorProto_TYPE_GROUP, + descriptorpb.FieldDescriptorProto_TYPE_MESSAGE: + if previousField.TypeName() != field.TypeName() { + addEnumGroupMessageFieldChangedTypeName(add, previousField, field) + return nil + } + } + return nil +} + +// CheckFieldWireJSONCompatibleType is a check function. +var CheckFieldWireJSONCompatibleType = newFieldPairCheckFunc(checkFieldWireJSONCompatibleType) + +func checkFieldWireJSONCompatibleType(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + previousWireJSONCompatibilityGroup, ok := fieldDescriptorProtoTypeToWireJSONCompatiblityGroup[previousField.Type()] + if !ok { + return fmt.Errorf("unknown FieldDescriptorProtoType: %v", previousField.Type()) + } + wireJSONCompatibilityGroup, ok := fieldDescriptorProtoTypeToWireJSONCompatiblityGroup[field.Type()] + if !ok { + return fmt.Errorf("unknown FieldDescriptorProtoType: %v", field.Type()) + } + if previousWireJSONCompatibilityGroup != wireJSONCompatibilityGroup { + addFieldChangedType( + add, + previousField, + field, + "See https://developers.google.com/protocol-buffers/docs/proto3#updating for wire compatibility rules and https://developers.google.com/protocol-buffers/docs/proto3#json for JSON compatibility rules.", + ) + return nil + } + switch field.Type() { + case descriptorpb.FieldDescriptorProto_TYPE_ENUM: + if previousField.TypeName() != field.TypeName() { + return checkEnumWireCompatibleForField(add, corpus, previousField, field) + } + case descriptorpb.FieldDescriptorProto_TYPE_GROUP, + descriptorpb.FieldDescriptorProto_TYPE_MESSAGE: + if previousField.TypeName() != field.TypeName() { + addEnumGroupMessageFieldChangedTypeName(add, previousField, field) + return nil + } + } + return nil +} + +func checkEnumWireCompatibleForField(add addFunc, corpus *corpus, previousField protosource.Field, field protosource.Field) error { + previousEnum, err := getEnumByFullName( + corpus.previousFiles, + strings.TrimPrefix(previousField.TypeName(), "."), + ) + if err != nil { + return err + } + enum, err := getEnumByFullName( + corpus.files, + strings.TrimPrefix(field.TypeName(), "."), + ) + if err != nil { + return err + } + if previousEnum.Name() != enum.Name() { + // If the short names are not equal, we say that this is a different enum. + addEnumGroupMessageFieldChangedTypeName(add, previousField, field) + return nil + } + isSubset, err := protosource.EnumIsSubset(enum, previousEnum) + if err != nil { + return err + } + if !isSubset { + // If the previous enum is not a subset of the new enum, we say that + // this is a different enum. + // We allow subsets so that enum values can be added within the + // same change. + addEnumGroupMessageFieldChangedTypeName(add, previousField, field) + return nil + } + return nil +} + +func addFieldChangedType(add addFunc, previousField protosource.Field, field protosource.Field, extraMessages ...string) { + combinedExtraMessage := "" + if len(extraMessages) > 0 { + // protect against mistakenly added empty extra messages + if joined := strings.TrimSpace(strings.Join(extraMessages, " ")); joined != "" { + combinedExtraMessage = " " + joined + } + } + var fieldLocation protosource.Location + switch field.Type() { + case descriptorpb.FieldDescriptorProto_TYPE_MESSAGE, + descriptorpb.FieldDescriptorProto_TYPE_ENUM, + descriptorpb.FieldDescriptorProto_TYPE_GROUP: + fieldLocation = field.TypeNameLocation() + default: + fieldLocation = field.TypeLocation() + } + // otherwise prints as hex + previousNumberString := strconv.FormatInt(int64(previousField.Number()), 10) + add( + field, + nil, + fieldLocation, + `Field %q on message %q changed type from %q to %q.%s`, + previousNumberString, + field.Message().Name(), + protodescriptor.FieldDescriptorProtoTypePrettyString(previousField.Type()), + protodescriptor.FieldDescriptorProtoTypePrettyString(field.Type()), + combinedExtraMessage, + ) +} + +func addEnumGroupMessageFieldChangedTypeName(add addFunc, previousField protosource.Field, field protosource.Field) { + // otherwise prints as hex + numberString := strconv.FormatInt(int64(previousField.Number()), 10) + add( + field, + nil, + field.TypeNameLocation(), + `Field %q on message %q changed type from %q to %q.`, + numberString, + field.Message().Name(), + strings.TrimPrefix(previousField.TypeName(), "."), + strings.TrimPrefix(field.TypeName(), "."), + ) +} + +// CheckFileNoDelete is a check function. +var CheckFileNoDelete = newFilesCheckFunc(checkFileNoDelete) + +func checkFileNoDelete(add addFunc, corpus *corpus) error { + previousFilePathToFile, err := protosource.FilePathToFile(corpus.previousFiles...) + if err != nil { + return err + } + filePathToFile, err := protosource.FilePathToFile(corpus.files...) + if err != nil { + return err + } + for previousFilePath, previousFile := range previousFilePathToFile { + if _, ok := filePathToFile[previousFilePath]; !ok { + // Add previous descriptor to check for ignores. This will mean that if + // we have ignore_unstable_packages set, this file will cause the ignore + // to happen. + add(nil, []protosource.Descriptor{previousFile}, nil, `Previously present file %q was deleted.`, previousFilePath) + } + } + return nil +} + +// CheckFileSameCsharpNamespace is a check function. +var CheckFileSameCsharpNamespace = newFilePairCheckFunc(checkFileSameCsharpNamespace) + +func checkFileSameCsharpNamespace(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.CsharpNamespace(), file.CsharpNamespace(), file, file.CsharpNamespaceLocation(), `option "csharp_namespace"`) +} + +// CheckFileSameGoPackage is a check function. +var CheckFileSameGoPackage = newFilePairCheckFunc(checkFileSameGoPackage) + +func checkFileSameGoPackage(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.GoPackage(), file.GoPackage(), file, file.GoPackageLocation(), `option "go_package"`) +} + +// CheckFileSameJavaMultipleFiles is a check function. +var CheckFileSameJavaMultipleFiles = newFilePairCheckFunc(checkFileSameJavaMultipleFiles) + +func checkFileSameJavaMultipleFiles(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, strconv.FormatBool(previousFile.JavaMultipleFiles()), strconv.FormatBool(file.JavaMultipleFiles()), file, file.JavaMultipleFilesLocation(), `option "java_multiple_files"`) +} + +// CheckFileSameJavaOuterClassname is a check function. +var CheckFileSameJavaOuterClassname = newFilePairCheckFunc(checkFileSameJavaOuterClassname) + +func checkFileSameJavaOuterClassname(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.JavaOuterClassname(), file.JavaOuterClassname(), file, file.JavaOuterClassnameLocation(), `option "java_outer_classname"`) +} + +// CheckFileSameJavaPackage is a check function. +var CheckFileSameJavaPackage = newFilePairCheckFunc(checkFileSameJavaPackage) + +func checkFileSameJavaPackage(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.JavaPackage(), file.JavaPackage(), file, file.JavaPackageLocation(), `option "java_package"`) +} + +// CheckFileSameJavaStringCheckUtf8 is a check function. +var CheckFileSameJavaStringCheckUtf8 = newFilePairCheckFunc(checkFileSameJavaStringCheckUtf8) + +func checkFileSameJavaStringCheckUtf8(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, strconv.FormatBool(previousFile.JavaStringCheckUtf8()), strconv.FormatBool(file.JavaStringCheckUtf8()), file, file.JavaStringCheckUtf8Location(), `option "java_string_check_utf8"`) +} + +// CheckFileSameObjcClassPrefix is a check function. +var CheckFileSameObjcClassPrefix = newFilePairCheckFunc(checkFileSameObjcClassPrefix) + +func checkFileSameObjcClassPrefix(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.ObjcClassPrefix(), file.ObjcClassPrefix(), file, file.ObjcClassPrefixLocation(), `option "objc_class_prefix"`) +} + +// CheckFileSamePackage is a check function. +var CheckFileSamePackage = newFilePairCheckFunc(checkFileSamePackage) + +func checkFileSamePackage(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.Package(), file.Package(), file, file.PackageLocation(), `package`) +} + +// CheckFileSamePhpClassPrefix is a check function. +var CheckFileSamePhpClassPrefix = newFilePairCheckFunc(checkFileSamePhpClassPrefix) + +func checkFileSamePhpClassPrefix(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.PhpClassPrefix(), file.PhpClassPrefix(), file, file.PhpClassPrefixLocation(), `option "php_class_prefix"`) +} + +// CheckFileSamePhpNamespace is a check function. +var CheckFileSamePhpNamespace = newFilePairCheckFunc(checkFileSamePhpNamespace) + +func checkFileSamePhpNamespace(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.PhpNamespace(), file.PhpNamespace(), file, file.PhpNamespaceLocation(), `option "php_namespace"`) +} + +// CheckFileSamePhpMetadataNamespace is a check function. +var CheckFileSamePhpMetadataNamespace = newFilePairCheckFunc(checkFileSamePhpMetadataNamespace) + +func checkFileSamePhpMetadataNamespace(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.PhpMetadataNamespace(), file.PhpMetadataNamespace(), file, file.PhpMetadataNamespaceLocation(), `option "php_metadata_namespace"`) +} + +// CheckFileSameRubyPackage is a check function. +var CheckFileSameRubyPackage = newFilePairCheckFunc(checkFileSameRubyPackage) + +func checkFileSameRubyPackage(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.RubyPackage(), file.RubyPackage(), file, file.RubyPackageLocation(), `option "ruby_package"`) +} + +// CheckFileSameSwiftPrefix is a check function. +var CheckFileSameSwiftPrefix = newFilePairCheckFunc(checkFileSameSwiftPrefix) + +func checkFileSameSwiftPrefix(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.SwiftPrefix(), file.SwiftPrefix(), file, file.SwiftPrefixLocation(), `option "swift_prefix"`) +} + +// CheckFileSameOptimizeFor is a check function. +var CheckFileSameOptimizeFor = newFilePairCheckFunc(checkFileSameOptimizeFor) + +func checkFileSameOptimizeFor(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, previousFile.OptimizeFor().String(), file.OptimizeFor().String(), file, file.OptimizeForLocation(), `option "optimize_for"`) +} + +// CheckFileSameCcGenericServices is a check function. +var CheckFileSameCcGenericServices = newFilePairCheckFunc(checkFileSameCcGenericServices) + +func checkFileSameCcGenericServices(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, strconv.FormatBool(previousFile.CcGenericServices()), strconv.FormatBool(file.CcGenericServices()), file, file.CcGenericServicesLocation(), `option "cc_generic_services"`) +} + +// CheckFileSameJavaGenericServices is a check function. +var CheckFileSameJavaGenericServices = newFilePairCheckFunc(checkFileSameJavaGenericServices) + +func checkFileSameJavaGenericServices(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, strconv.FormatBool(previousFile.JavaGenericServices()), strconv.FormatBool(file.JavaGenericServices()), file, file.JavaGenericServicesLocation(), `option "java_generic_services"`) +} + +// CheckFileSamePyGenericServices is a check function. +var CheckFileSamePyGenericServices = newFilePairCheckFunc(checkFileSamePyGenericServices) + +func checkFileSamePyGenericServices(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, strconv.FormatBool(previousFile.PyGenericServices()), strconv.FormatBool(file.PyGenericServices()), file, file.PyGenericServicesLocation(), `option "py_generic_services"`) +} + +// CheckFileSamePhpGenericServices is a check function. +var CheckFileSamePhpGenericServices = newFilePairCheckFunc(checkFileSamePhpGenericServices) + +func checkFileSamePhpGenericServices(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, strconv.FormatBool(previousFile.PhpGenericServices()), strconv.FormatBool(file.PhpGenericServices()), file, file.PhpGenericServicesLocation(), `option "php_generic_services"`) +} + +// CheckFileSameCcEnableArenas is a check function. +var CheckFileSameCcEnableArenas = newFilePairCheckFunc(checkFileSameCcEnableArenas) + +func checkFileSameCcEnableArenas(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + return checkFileSameValue(add, strconv.FormatBool(previousFile.CcEnableArenas()), strconv.FormatBool(file.CcEnableArenas()), file, file.CcEnableArenasLocation(), `option "cc_enable_arenas"`) +} + +// CheckFileSameSyntax is a check function. +var CheckFileSameSyntax = newFilePairCheckFunc(checkFileSameSyntax) + +func checkFileSameSyntax(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + previousSyntax := previousFile.Syntax() + if previousSyntax == protosource.SyntaxUnspecified { + previousSyntax = protosource.SyntaxProto2 + } + syntax := file.Syntax() + if syntax == protosource.SyntaxUnspecified { + syntax = protosource.SyntaxProto2 + } + return checkFileSameValue(add, previousSyntax.String(), syntax.String(), file, file.SyntaxLocation(), `syntax`) +} + +func checkFileSameValue(add addFunc, previousValue interface{}, value interface{}, file protosource.File, location protosource.Location, name string) error { + if previousValue != value { + add(file, nil, location, `File %s changed from %q to %q.`, name, previousValue, value) + } + return nil +} + +// CheckMessageNoDelete is a check function. +var CheckMessageNoDelete = newFilePairCheckFunc(checkMessageNoDelete) + +func checkMessageNoDelete(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + previousNestedNameToMessage, err := protosource.NestedNameToMessage(previousFile) + if err != nil { + return err + } + nestedNameToMessage, err := protosource.NestedNameToMessage(file) + if err != nil { + return err + } + for previousNestedName := range previousNestedNameToMessage { + if _, ok := nestedNameToMessage[previousNestedName]; !ok { + descriptor, location := getDescriptorAndLocationForDeletedMessage(file, nestedNameToMessage, previousNestedName) + add(descriptor, nil, location, `Previously present message %q was deleted from file.`, previousNestedName) + } + } + return nil +} + +// CheckMessageNoRemoveStandardDescriptorAccessor is a check function. +var CheckMessageNoRemoveStandardDescriptorAccessor = newMessagePairCheckFunc(checkMessageNoRemoveStandardDescriptorAccessor) + +func checkMessageNoRemoveStandardDescriptorAccessor(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + previous := strconv.FormatBool(previousMessage.NoStandardDescriptorAccessor()) + current := strconv.FormatBool(message.NoStandardDescriptorAccessor()) + if previous == "false" && current == "true" { + add(message, nil, message.NoStandardDescriptorAccessorLocation(), `Message option "no_standard_descriptor_accessor" changed from %q to %q.`, previous, current) + } + return nil +} + +// CheckMessageSameMessageSetWireFormat is a check function. +var CheckMessageSameMessageSetWireFormat = newMessagePairCheckFunc(checkMessageSameMessageSetWireFormat) + +func checkMessageSameMessageSetWireFormat(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + previous := strconv.FormatBool(previousMessage.MessageSetWireFormat()) + current := strconv.FormatBool(message.MessageSetWireFormat()) + if previous != current { + add(message, nil, message.MessageSetWireFormatLocation(), `Message option "message_set_wire_format" changed from %q to %q.`, previous, current) + } + return nil +} + +// CheckMessageSameRequiredFields is a check function. +var CheckMessageSameRequiredFields = newMessagePairCheckFunc(checkMessageSameRequiredFields) + +func checkMessageSameRequiredFields(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + previousNumberToRequiredField, err := protosource.NumberToMessageFieldForLabel( + previousMessage, + descriptorpb.FieldDescriptorProto_LABEL_REQUIRED, + ) + if err != nil { + return err + } + numberToRequiredField, err := protosource.NumberToMessageFieldForLabel( + message, + descriptorpb.FieldDescriptorProto_LABEL_REQUIRED, + ) + if err != nil { + return err + } + for previousNumber := range previousNumberToRequiredField { + if _, ok := numberToRequiredField[previousNumber]; !ok { + // we attach the error to the message as the field no longer exists + add(message, nil, message.Location(), `Message %q had required field "%d" deleted. Required fields must always be sent, so if one side does not know about the required field, this will result in a breakage.`, previousMessage.Name(), previousNumber) + } + } + for number, requiredField := range numberToRequiredField { + if _, ok := previousNumberToRequiredField[number]; !ok { + // we attach the error to the added required field + add(message, nil, requiredField.Location(), `Message %q had required field "%d" added. Required fields must always be sent, so if one side does not know about the required field, this will result in a breakage.`, message.Name(), number) + } + } + return nil +} + +// CheckOneofNoDelete is a check function. +var CheckOneofNoDelete = newMessagePairCheckFunc(checkOneofNoDelete) + +func checkOneofNoDelete(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + previousNameToOneof, err := protosource.NameToMessageOneof(previousMessage) + if err != nil { + return err + } + nameToOneof, err := protosource.NameToMessageOneof(message) + if err != nil { + return err + } + for previousName := range previousNameToOneof { + if _, ok := nameToOneof[previousName]; !ok { + add(message, nil, message.Location(), `Previously present oneof %q on message %q was deleted.`, previousName, message.Name()) + } + } + return nil +} + +// CheckPackageEnumNoDelete is a check function. +var CheckPackageEnumNoDelete = newFilesCheckFunc(checkPackageEnumNoDelete) + +func checkPackageEnumNoDelete(add addFunc, corpus *corpus) error { + previousPackageToNestedNameToEnum, err := protosource.PackageToNestedNameToEnum(corpus.previousFiles...) + if err != nil { + return err + } + packageToNestedNameToEnum, err := protosource.PackageToNestedNameToEnum(corpus.files...) + if err != nil { + return err + } + // caching across loops + var filePathToFile map[string]protosource.File + for previousPackage, previousNestedNameToEnum := range previousPackageToNestedNameToEnum { + if nestedNameToEnum, ok := packageToNestedNameToEnum[previousPackage]; ok { + for previousNestedName, previousEnum := range previousNestedNameToEnum { + if _, ok := nestedNameToEnum[previousNestedName]; !ok { + // if cache not populated, populate it + if filePathToFile == nil { + filePathToFile, err = protosource.FilePathToFile(corpus.files...) + if err != nil { + return err + } + } + // Check if the file still exists. + file, ok := filePathToFile[previousEnum.File().Path()] + if ok { + // File exists, try to get a location to attach the error to. + descriptor, location, err := getDescriptorAndLocationForDeletedEnum(file, previousNestedName) + if err != nil { + return err + } + add(descriptor, nil, location, `Previously present enum %q was deleted from package %q.`, previousNestedName, previousPackage) + } else { + // File does not exist, we don't know where the enum was deleted from. + // Add the previous enum to check for ignores. This means that if + // ignore_unstable_packages is set, this will be triggered if the + // previous enum was in an unstable package. + add(nil, []protosource.Descriptor{previousEnum}, nil, `Previously present enum %q was deleted from package %q.`, previousNestedName, previousPackage) + } + } + } + } + } + return nil +} + +// CheckPackageMessageNoDelete is a check function. +var CheckPackageMessageNoDelete = newFilesCheckFunc(checkPackageMessageNoDelete) + +func checkPackageMessageNoDelete(add addFunc, corpus *corpus) error { + previousPackageToNestedNameToMessage, err := protosource.PackageToNestedNameToMessage(corpus.previousFiles...) + if err != nil { + return err + } + packageToNestedNameToMessage, err := protosource.PackageToNestedNameToMessage(corpus.files...) + if err != nil { + return err + } + // caching across loops + var filePathToFile map[string]protosource.File + for previousPackage, previousNestedNameToMessage := range previousPackageToNestedNameToMessage { + if nestedNameToMessage, ok := packageToNestedNameToMessage[previousPackage]; ok { + for previousNestedName, previousMessage := range previousNestedNameToMessage { + if _, ok := nestedNameToMessage[previousNestedName]; !ok { + // if cache not populated, populate it + if filePathToFile == nil { + filePathToFile, err = protosource.FilePathToFile(corpus.files...) + if err != nil { + return err + } + } + // Check if the file still exists. + file, ok := filePathToFile[previousMessage.File().Path()] + if ok { + // File exists, try to get a location to attach the error to. + descriptor, location := getDescriptorAndLocationForDeletedMessage(file, nestedNameToMessage, previousNestedName) + add(descriptor, nil, location, `Previously present message %q was deleted from package %q.`, previousNestedName, previousPackage) + } else { + // File does not exist, we don't know where the message was deleted from. + // Add the previous message to check for ignores. This means that if + // ignore_unstable_packages is set, this will be triggered if the + // previous message was in an unstable package. + add(nil, []protosource.Descriptor{previousMessage}, nil, `Previously present message %q was deleted from package %q.`, previousNestedName, previousPackage) + } + } + } + } + } + return nil +} + +// CheckPackageNoDelete is a check function. +var CheckPackageNoDelete = newFilesCheckFunc(checkPackageNoDelete) + +func checkPackageNoDelete(add addFunc, corpus *corpus) error { + previousPackageToFiles, err := protosource.PackageToFiles(corpus.previousFiles...) + if err != nil { + return err + } + packageToFiles, err := protosource.PackageToFiles(corpus.files...) + if err != nil { + return err + } + for previousPackage, previousFiles := range previousPackageToFiles { + if _, ok := packageToFiles[previousPackage]; !ok { + // Add previous descriptors in the same package as other descriptors to check + // for ignores. This will mean that if we have ignore_unstable_packages set, + // any one of these files will cause the ignore to happen. Note that we + // could probably just attach a single file, but we do this in case we + // have other ways to ignore in the future. + previousDescriptors := make([]protosource.Descriptor, len(previousFiles)) + for i, previousFile := range previousFiles { + previousDescriptors[i] = previousFile + } + add(nil, previousDescriptors, nil, `Previously present package %q was deleted.`, previousPackage) + } + } + return nil +} + +// CheckPackageServiceNoDelete is a check function. +var CheckPackageServiceNoDelete = newFilesCheckFunc(checkPackageServiceNoDelete) + +func checkPackageServiceNoDelete(add addFunc, corpus *corpus) error { + previousPackageToNameToService, err := protosource.PackageToNameToService(corpus.previousFiles...) + if err != nil { + return err + } + packageToNameToService, err := protosource.PackageToNameToService(corpus.files...) + if err != nil { + return err + } + // caching across loops + var filePathToFile map[string]protosource.File + for previousPackage, previousNameToService := range previousPackageToNameToService { + if nameToService, ok := packageToNameToService[previousPackage]; ok { + for previousName, previousService := range previousNameToService { + if _, ok := nameToService[previousName]; !ok { + // if cache not populated, populate it + if filePathToFile == nil { + filePathToFile, err = protosource.FilePathToFile(corpus.files...) + if err != nil { + return err + } + } + // Check if the file still exists. + file, ok := filePathToFile[previousService.File().Path()] + if ok { + // File exists. + add(file, nil, nil, `Previously present service %q was deleted from package %q.`, previousName, previousPackage) + } else { + // File does not exist, we don't know where the service was deleted from. + // Add the previous service to check for ignores. This means that if + // ignore_unstable_packages is set, this will be triggered if the + // previous service was in an unstable package. + // TODO: find the service and print that this moved? + add(nil, []protosource.Descriptor{previousService}, nil, `Previously present service %q was deleted from package %q.`, previousName, previousPackage) + } + } + } + } + } + return nil +} + +// CheckReservedEnumNoDelete is a check function. +var CheckReservedEnumNoDelete = newEnumPairCheckFunc(checkReservedEnumNoDelete) + +func checkReservedEnumNoDelete(add addFunc, corpus *corpus, previousEnum protosource.Enum, enum protosource.Enum) error { + previousRanges := previousEnum.ReservedTagRanges() + ranges := enum.ReservedTagRanges() + if isSubset, missing := protosource.CheckTagRangeIsSubset(ranges, previousRanges); !isSubset { + for _, tagRange := range missing { + add(enum, nil, enum.Location(), `Previously present reserved range %q on enum %q was deleted.`, protosource.TagRangeString(tagRange), enum.Name()) + } + } + previousValueToReservedName := protosource.ValueToReservedName(previousEnum) + valueToReservedName := protosource.ValueToReservedName(enum) + for previousValue := range previousValueToReservedName { + if _, ok := valueToReservedName[previousValue]; !ok { + add(enum, nil, enum.Location(), `Previously present reserved name %q on enum %q was deleted.`, previousValue, enum.Name()) + } + } + return nil +} + +// CheckReservedMessageNoDelete is a check function. +var CheckReservedMessageNoDelete = newMessagePairCheckFunc(checkReservedMessageNoDelete) + +func checkReservedMessageNoDelete(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + previousRanges := previousMessage.ReservedTagRanges() + ranges := message.ReservedTagRanges() + if isSubset, missing := protosource.CheckTagRangeIsSubset(ranges, previousRanges); !isSubset { + for _, tagRange := range missing { + add(message, nil, message.Location(), `Previously present reserved range %q on message %q was deleted.`, protosource.TagRangeString(tagRange), message.Name()) + } + } + previousValueToReservedName := protosource.ValueToReservedName(previousMessage) + valueToReservedName := protosource.ValueToReservedName(message) + for previousValue := range previousValueToReservedName { + if _, ok := valueToReservedName[previousValue]; !ok { + add(message, nil, message.Location(), `Previously present reserved name %q on message %q was deleted.`, previousValue, message.Name()) + } + } + return nil +} + +// CheckRPCNoDelete is a check function. +var CheckRPCNoDelete = newServicePairCheckFunc(checkRPCNoDelete) + +func checkRPCNoDelete(add addFunc, corpus *corpus, previousService protosource.Service, service protosource.Service) error { + previousNameToMethod, err := protosource.NameToMethod(previousService) + if err != nil { + return err + } + nameToMethod, err := protosource.NameToMethod(service) + if err != nil { + return err + } + for previousName := range previousNameToMethod { + if _, ok := nameToMethod[previousName]; !ok { + add(service, nil, service.Location(), `Previously present RPC %q on service %q was deleted.`, previousName, service.Name()) + } + } + return nil +} + +// CheckRPCSameClientStreaming is a check function. +var CheckRPCSameClientStreaming = newMethodPairCheckFunc(checkRPCSameClientStreaming) + +func checkRPCSameClientStreaming(add addFunc, corpus *corpus, previousMethod protosource.Method, method protosource.Method) error { + if previousMethod.ClientStreaming() != method.ClientStreaming() { + previous := "streaming" + current := "unary" + if method.ClientStreaming() { + previous = "unary" + current = "streaming" + } + add(method, nil, method.Location(), `RPC %q on service %q changed from client %s to client %s.`, method.Name(), method.Service().Name(), previous, current) + } + return nil +} + +// CheckRPCSameIdempotencyLevel is a check function. +var CheckRPCSameIdempotencyLevel = newMethodPairCheckFunc(checkRPCSameIdempotencyLevel) + +func checkRPCSameIdempotencyLevel(add addFunc, corpus *corpus, previousMethod protosource.Method, method protosource.Method) error { + previous := previousMethod.IdempotencyLevel() + current := method.IdempotencyLevel() + if previous != current { + add(method, nil, method.IdempotencyLevelLocation(), `RPC %q on service %q changed option "idempotency_level" from %q to %q.`, method.Name(), method.Service().Name(), previous.String(), current.String()) + } + return nil +} + +// CheckRPCSameRequestType is a check function. +var CheckRPCSameRequestType = newMethodPairCheckFunc(checkRPCSameRequestType) + +func checkRPCSameRequestType(add addFunc, corpus *corpus, previousMethod protosource.Method, method protosource.Method) error { + if previousMethod.InputTypeName() != method.InputTypeName() { + add(method, nil, method.InputTypeLocation(), `RPC %q on service %q changed request type from %q to %q.`, method.Name(), method.Service().Name(), previousMethod.InputTypeName(), method.InputTypeName()) + } + return nil +} + +// CheckRPCSameResponseType is a check function. +var CheckRPCSameResponseType = newMethodPairCheckFunc(checkRPCSameResponseType) + +func checkRPCSameResponseType(add addFunc, corpus *corpus, previousMethod protosource.Method, method protosource.Method) error { + if previousMethod.OutputTypeName() != method.OutputTypeName() { + add(method, nil, method.OutputTypeLocation(), `RPC %q on service %q changed response type from %q to %q.`, method.Name(), method.Service().Name(), previousMethod.OutputTypeName(), method.OutputTypeName()) + } + return nil +} + +// CheckRPCSameServerStreaming is a check function. +var CheckRPCSameServerStreaming = newMethodPairCheckFunc(checkRPCSameServerStreaming) + +func checkRPCSameServerStreaming(add addFunc, corpus *corpus, previousMethod protosource.Method, method protosource.Method) error { + if previousMethod.ServerStreaming() != method.ServerStreaming() { + previous := "streaming" + current := "unary" + if method.ServerStreaming() { + previous = "unary" + current = "streaming" + } + add(method, nil, method.Location(), `RPC %q on service %q changed from server %s to server %s.`, method.Name(), method.Service().Name(), previous, current) + } + return nil +} + +// CheckServiceNoDelete is a check function. +var CheckServiceNoDelete = newFilePairCheckFunc(checkServiceNoDelete) + +func checkServiceNoDelete(add addFunc, corpus *corpus, previousFile protosource.File, file protosource.File) error { + previousNameToService, err := protosource.NameToService(previousFile) + if err != nil { + return err + } + nameToService, err := protosource.NameToService(file) + if err != nil { + return err + } + for previousName := range previousNameToService { + if _, ok := nameToService[previousName]; !ok { + add(file, nil, nil, `Previously present service %q was deleted from file.`, previousName) + } + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/util.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/util.go new file mode 100644 index 000000000..d4717ee5e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/util.go @@ -0,0 +1,354 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufbreakingcheck + +import ( + "fmt" + "sort" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "google.golang.org/protobuf/types/descriptorpb" +) + +var ( + // https://developers.google.com/protocol-buffers/docs/proto3#updating + fieldDescriptorProtoTypeToWireCompatiblityGroup = map[descriptorpb.FieldDescriptorProto_Type]int{ + descriptorpb.FieldDescriptorProto_TYPE_INT32: 1, + descriptorpb.FieldDescriptorProto_TYPE_INT64: 1, + descriptorpb.FieldDescriptorProto_TYPE_UINT32: 1, + descriptorpb.FieldDescriptorProto_TYPE_UINT64: 1, + descriptorpb.FieldDescriptorProto_TYPE_BOOL: 1, + descriptorpb.FieldDescriptorProto_TYPE_SINT32: 2, + descriptorpb.FieldDescriptorProto_TYPE_SINT64: 2, + // While string and bytes are compatible if the bytes are valid UTF-8, we cannot + // determine if a field will actually be valid UTF-8, as we are concerned with the + // definitions and not individual messages, so we have these in different + // compatibility groups. We allow string to evolve to bytes, but not bytes to + // string, but we need them to be in different compatibility groups so that + // we have to manually detect this. + descriptorpb.FieldDescriptorProto_TYPE_STRING: 3, + descriptorpb.FieldDescriptorProto_TYPE_BYTES: 4, + descriptorpb.FieldDescriptorProto_TYPE_FIXED32: 5, + descriptorpb.FieldDescriptorProto_TYPE_SFIXED32: 5, + descriptorpb.FieldDescriptorProto_TYPE_FIXED64: 6, + descriptorpb.FieldDescriptorProto_TYPE_SFIXED64: 6, + descriptorpb.FieldDescriptorProto_TYPE_DOUBLE: 7, + descriptorpb.FieldDescriptorProto_TYPE_FLOAT: 8, + descriptorpb.FieldDescriptorProto_TYPE_GROUP: 9, + // Embedded messages are compatible with bytes if the bytes are serialized versions + // of the message, but we have no way of verifying this. + descriptorpb.FieldDescriptorProto_TYPE_MESSAGE: 10, + // Enum is compatible with int32, uint32, int64, uint64 if the values match + // an enum value, but we have no way of verifying this. + descriptorpb.FieldDescriptorProto_TYPE_ENUM: 11, + } + + // https://developers.google.com/protocol-buffers/docs/proto3#json + // this is not just JSON-compatible, but also wire-compatible, i.e. the intersection + fieldDescriptorProtoTypeToWireJSONCompatiblityGroup = map[descriptorpb.FieldDescriptorProto_Type]int{ + // fixed32 not compatible for wire so not included + descriptorpb.FieldDescriptorProto_TYPE_INT32: 1, + descriptorpb.FieldDescriptorProto_TYPE_UINT32: 1, + // fixed64 not compatible for wire so not included + descriptorpb.FieldDescriptorProto_TYPE_INT64: 2, + descriptorpb.FieldDescriptorProto_TYPE_UINT64: 2, + descriptorpb.FieldDescriptorProto_TYPE_FIXED32: 3, + descriptorpb.FieldDescriptorProto_TYPE_SFIXED32: 3, + descriptorpb.FieldDescriptorProto_TYPE_FIXED64: 4, + descriptorpb.FieldDescriptorProto_TYPE_SFIXED64: 4, + descriptorpb.FieldDescriptorProto_TYPE_BOOL: 5, + descriptorpb.FieldDescriptorProto_TYPE_SINT32: 6, + descriptorpb.FieldDescriptorProto_TYPE_SINT64: 7, + descriptorpb.FieldDescriptorProto_TYPE_STRING: 8, + descriptorpb.FieldDescriptorProto_TYPE_BYTES: 9, + descriptorpb.FieldDescriptorProto_TYPE_DOUBLE: 10, + descriptorpb.FieldDescriptorProto_TYPE_FLOAT: 11, + descriptorpb.FieldDescriptorProto_TYPE_GROUP: 12, + descriptorpb.FieldDescriptorProto_TYPE_MESSAGE: 14, + descriptorpb.FieldDescriptorProto_TYPE_ENUM: 15, + } +) + +// addFunc adds a FileAnnotation. +// +// Both the Descriptor and Location can be nil. +type addFunc func(protosource.Descriptor, []protosource.Descriptor, protosource.Location, string, ...interface{}) + +// corpus is a store of the previous files and files given to a check function. +// +// this is passed down so that pair functions have access to the original inputs. +type corpus struct { + previousFiles []protosource.File + files []protosource.File +} + +func newCorpus( + previousFiles []protosource.File, + files []protosource.File, +) *corpus { + return &corpus{ + previousFiles: previousFiles, + files: files, + } +} + +func newFilesCheckFunc( + f func(addFunc, *corpus) error, +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return func(id string, ignoreFunc internal.IgnoreFunc, previousFiles []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + helper := internal.NewHelper(id, ignoreFunc) + if err := f(helper.AddFileAnnotationWithExtraIgnoreDescriptorsf, newCorpus(previousFiles, files)); err != nil { + return nil, err + } + return helper.FileAnnotations(), nil + } +} + +func newFilePairCheckFunc( + f func(addFunc, *corpus, protosource.File, protosource.File) error, +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFilesCheckFunc( + func(add addFunc, corpus *corpus) error { + previousFilePathToFile, err := protosource.FilePathToFile(corpus.previousFiles...) + if err != nil { + return err + } + filePathToFile, err := protosource.FilePathToFile(corpus.files...) + if err != nil { + return err + } + for previousFilePath, previousFile := range previousFilePathToFile { + if file, ok := filePathToFile[previousFilePath]; ok { + if err := f(add, corpus, previousFile, file); err != nil { + return err + } + } + } + return nil + }, + ) +} + +func newEnumPairCheckFunc( + f func(addFunc, *corpus, protosource.Enum, protosource.Enum) error, +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFilesCheckFunc( + func(add addFunc, corpus *corpus) error { + previousFullNameToEnum, err := protosource.FullNameToEnum(corpus.previousFiles...) + if err != nil { + return err + } + fullNameToEnum, err := protosource.FullNameToEnum(corpus.files...) + if err != nil { + return err + } + for previousFullName, previousEnum := range previousFullNameToEnum { + if enum, ok := fullNameToEnum[previousFullName]; ok { + if err := f(add, corpus, previousEnum, enum); err != nil { + return err + } + } + } + return nil + }, + ) +} + +// compares all the enums that are of the same number +// map is from name to EnumValue for the given number +func newEnumValuePairCheckFunc( + f func(addFunc, *corpus, map[string]protosource.EnumValue, map[string]protosource.EnumValue) error, +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newEnumPairCheckFunc( + func(add addFunc, corpus *corpus, previousEnum protosource.Enum, enum protosource.Enum) error { + previousNumberToNameToEnumValue, err := protosource.NumberToNameToEnumValue(previousEnum) + if err != nil { + return err + } + numberToNameToEnumValue, err := protosource.NumberToNameToEnumValue(enum) + if err != nil { + return err + } + for previousNumber, previousNameToEnumValue := range previousNumberToNameToEnumValue { + if nameToEnumValue, ok := numberToNameToEnumValue[previousNumber]; ok { + if err := f(add, corpus, previousNameToEnumValue, nameToEnumValue); err != nil { + return err + } + } + } + return nil + }, + ) +} + +func newMessagePairCheckFunc( + f func(addFunc, *corpus, protosource.Message, protosource.Message) error, +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFilesCheckFunc( + func(add addFunc, corpus *corpus) error { + previousFullNameToMessage, err := protosource.FullNameToMessage(corpus.previousFiles...) + if err != nil { + return err + } + fullNameToMessage, err := protosource.FullNameToMessage(corpus.files...) + if err != nil { + return err + } + for previousFullName, previousMessage := range previousFullNameToMessage { + if message, ok := fullNameToMessage[previousFullName]; ok { + if err := f(add, corpus, previousMessage, message); err != nil { + return err + } + } + } + return nil + }, + ) +} + +func newFieldPairCheckFunc( + f func(addFunc, *corpus, protosource.Field, protosource.Field) error, +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newMessagePairCheckFunc( + func(add addFunc, corpus *corpus, previousMessage protosource.Message, message protosource.Message) error { + previousNumberToField, err := protosource.NumberToMessageField(previousMessage) + if err != nil { + return err + } + numberToField, err := protosource.NumberToMessageField(message) + if err != nil { + return err + } + for previousNumber, previousField := range previousNumberToField { + if field, ok := numberToField[previousNumber]; ok { + if err := f(add, corpus, previousField, field); err != nil { + return err + } + } + } + return nil + }, + ) +} + +func newServicePairCheckFunc( + f func(addFunc, *corpus, protosource.Service, protosource.Service) error, +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFilesCheckFunc( + func(add addFunc, corpus *corpus) error { + previousFullNameToService, err := protosource.FullNameToService(corpus.previousFiles...) + if err != nil { + return err + } + fullNameToService, err := protosource.FullNameToService(corpus.files...) + if err != nil { + return err + } + for previousFullName, previousService := range previousFullNameToService { + if service, ok := fullNameToService[previousFullName]; ok { + if err := f(add, corpus, previousService, service); err != nil { + return err + } + } + } + return nil + }, + ) +} + +func newMethodPairCheckFunc( + f func(addFunc, *corpus, protosource.Method, protosource.Method) error, +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newServicePairCheckFunc( + func(add addFunc, corpus *corpus, previousService protosource.Service, service protosource.Service) error { + previousNameToMethod, err := protosource.NameToMethod(previousService) + if err != nil { + return err + } + nameToMethod, err := protosource.NameToMethod(service) + if err != nil { + return err + } + for previousName, previousMethod := range previousNameToMethod { + if method, ok := nameToMethod[previousName]; ok { + if err := f(add, corpus, previousMethod, method); err != nil { + return err + } + } + } + return nil + }, + ) +} + +func getDescriptorAndLocationForDeletedEnum(file protosource.File, previousNestedName string) (protosource.Descriptor, protosource.Location, error) { + if strings.Contains(previousNestedName, ".") { + nestedNameToMessage, err := protosource.NestedNameToMessage(file) + if err != nil { + return nil, nil, err + } + split := strings.Split(previousNestedName, ".") + for i := len(split) - 1; i > 0; i-- { + if message, ok := nestedNameToMessage[strings.Join(split[0:i], ".")]; ok { + return message, message.Location(), nil + } + } + } + return file, nil, nil +} + +func getDescriptorAndLocationForDeletedMessage(file protosource.File, nestedNameToMessage map[string]protosource.Message, previousNestedName string) (protosource.Descriptor, protosource.Location) { + if strings.Contains(previousNestedName, ".") { + split := strings.Split(previousNestedName, ".") + for i := len(split) - 1; i > 0; i-- { + if message, ok := nestedNameToMessage[strings.Join(split[0:i], ".")]; ok { + return message, message.Location() + } + } + } + return file, nil +} + +func getSortedEnumValueNames(nameToEnumValue map[string]protosource.EnumValue) []string { + names := make([]string, 0, len(nameToEnumValue)) + for name := range nameToEnumValue { + names = append(names, name) + } + sort.Strings(names) + return names +} + +func getEnumByFullName(files []protosource.File, enumFullName string) (protosource.Enum, error) { + fullNameToEnum, err := protosource.FullNameToEnum(files...) + if err != nil { + return nil, err + } + enum, ok := fullNameToEnum[enumFullName] + if !ok { + return nil, fmt.Errorf("expected enum %q to exist but was not found", enumFullName) + } + return enum, nil +} + +func withBackupLocation(primary protosource.Location, secondary protosource.Location) protosource.Location { + if primary != nil { + return primary + } + return secondary +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/bufbreakingv1.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/bufbreakingv1.go new file mode 100644 index 000000000..eb273badf --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/bufbreakingv1.go @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufbreakingv1 contains the VersionSpec for v1. +// +// It uses bufbreakingcheck and bufbreakingbuild. +// +// There were no changes from v1beta1. +package bufbreakingv1 + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + +// VersionSpec is the version specification for v1. +// +// Changes from v1beta1: +// +// Adds FILE_SAME_PACKAGE to PACKAGE, WIRE, and WIRE_JSON. +// +// Splits FIELD_SAME_TYPE into FIELD_SAME_TYPE for FILE AND PACKAGE, +// FIRE_WIRE_JSON_COMPATIBLE_TYPE for WIRE_JSON, and +// FIELD_WIRE_COMPATIBLE_TYPE for WIRE. +var VersionSpec = &internal.VersionSpec{ + RuleBuilders: v1RuleBuilders, + DefaultCategories: v1DefaultCategories, + IDToCategories: v1IDToCategories, +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/bufbreakingv1_test.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/bufbreakingv1_test.go new file mode 100644 index 000000000..66355c8df --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/bufbreakingv1_test.go @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufbreakingv1 + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal/internaltesting" +) + +func TestVersionSpec(t *testing.T) { + t.Parallel() + internaltesting.RunTestVersionSpec(t, VersionSpec) +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/vars.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/vars.go new file mode 100644 index 000000000..560b3002b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1/vars.go @@ -0,0 +1,335 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufbreakingv1 + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingbuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" +) + +var ( + // v1RuleBuilders are the rule builders. + v1RuleBuilders = []*internal.RuleBuilder{ + bufbreakingbuild.EnumNoDeleteRuleBuilder, + bufbreakingbuild.EnumValueNoDeleteRuleBuilder, + bufbreakingbuild.EnumValueNoDeleteUnlessNameReservedRuleBuilder, + bufbreakingbuild.EnumValueNoDeleteUnlessNumberReservedRuleBuilder, + bufbreakingbuild.EnumValueSameNameRuleBuilder, + bufbreakingbuild.ExtensionMessageNoDeleteRuleBuilder, + bufbreakingbuild.FieldNoDeleteRuleBuilder, + bufbreakingbuild.FieldNoDeleteUnlessNameReservedRuleBuilder, + bufbreakingbuild.FieldNoDeleteUnlessNumberReservedRuleBuilder, + bufbreakingbuild.FieldSameCTypeRuleBuilder, + bufbreakingbuild.FieldSameJSONNameRuleBuilder, + bufbreakingbuild.FieldSameJSTypeRuleBuilder, + bufbreakingbuild.FieldSameLabelRuleBuilder, + bufbreakingbuild.FieldSameNameRuleBuilder, + bufbreakingbuild.FieldSameOneofRuleBuilder, + bufbreakingbuild.FieldSameTypeRuleBuilder, + bufbreakingbuild.FieldWireCompatibleTypeRuleBuilder, + bufbreakingbuild.FieldWireJSONCompatibleTypeRuleBuilder, + bufbreakingbuild.FileNoDeleteRuleBuilder, + bufbreakingbuild.FileSameCsharpNamespaceRuleBuilder, + bufbreakingbuild.FileSameGoPackageRuleBuilder, + bufbreakingbuild.FileSameJavaMultipleFilesRuleBuilder, + bufbreakingbuild.FileSameJavaOuterClassnameRuleBuilder, + bufbreakingbuild.FileSameJavaPackageRuleBuilder, + bufbreakingbuild.FileSameJavaStringCheckUtf8RuleBuilder, + bufbreakingbuild.FileSameObjcClassPrefixRuleBuilder, + bufbreakingbuild.FileSamePackageRuleBuilder, + bufbreakingbuild.FileSamePhpClassPrefixRuleBuilder, + bufbreakingbuild.FileSamePhpMetadataNamespaceRuleBuilder, + bufbreakingbuild.FileSamePhpNamespaceRuleBuilder, + bufbreakingbuild.FileSameRubyPackageRuleBuilder, + bufbreakingbuild.FileSameSwiftPrefixRuleBuilder, + bufbreakingbuild.FileSameOptimizeForRuleBuilder, + bufbreakingbuild.FileSameCcGenericServicesRuleBuilder, + bufbreakingbuild.FileSameJavaGenericServicesRuleBuilder, + bufbreakingbuild.FileSamePyGenericServicesRuleBuilder, + bufbreakingbuild.FileSamePhpGenericServicesRuleBuilder, + bufbreakingbuild.FileSameCcEnableArenasRuleBuilder, + bufbreakingbuild.FileSameSyntaxRuleBuilder, + bufbreakingbuild.MessageNoDeleteRuleBuilder, + bufbreakingbuild.MessageNoRemoveStandardDescriptorAccessorRuleBuilder, + bufbreakingbuild.MessageSameMessageSetWireFormatRuleBuilder, + bufbreakingbuild.MessageSameRequiredFieldsRuleBuilder, + bufbreakingbuild.OneofNoDeleteRuleBuilder, + bufbreakingbuild.PackageEnumNoDeleteRuleBuilder, + bufbreakingbuild.PackageMessageNoDeleteRuleBuilder, + bufbreakingbuild.PackageNoDeleteRuleBuilder, + bufbreakingbuild.PackageServiceNoDeleteRuleBuilder, + bufbreakingbuild.ReservedEnumNoDeleteRuleBuilder, + bufbreakingbuild.ReservedMessageNoDeleteRuleBuilder, + bufbreakingbuild.RPCNoDeleteRuleBuilder, + bufbreakingbuild.RPCSameClientStreamingRuleBuilder, + bufbreakingbuild.RPCSameIdempotencyLevelRuleBuilder, + bufbreakingbuild.RPCSameRequestTypeRuleBuilder, + bufbreakingbuild.RPCSameResponseTypeRuleBuilder, + bufbreakingbuild.RPCSameServerStreamingRuleBuilder, + bufbreakingbuild.ServiceNoDeleteRuleBuilder, + } + + // v1DefaultCategories are the default categories. + v1DefaultCategories = []string{ + "FILE", + } + // v1IDToCategories associates IDs to categories. + v1IDToCategories = map[string][]string{ + "ENUM_NO_DELETE": { + "FILE", + }, + "ENUM_VALUE_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED": { + "WIRE_JSON", + }, + "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED": { + "WIRE_JSON", + "WIRE", + }, + "ENUM_VALUE_SAME_NAME": { + "FILE", + "PACKAGE", + "WIRE_JSON", + }, + "EXTENSION_MESSAGE_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "FIELD_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "FIELD_NO_DELETE_UNLESS_NAME_RESERVED": { + "WIRE_JSON", + }, + "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED": { + "WIRE_JSON", + "WIRE", + }, + "FIELD_SAME_CTYPE": { + "FILE", + "PACKAGE", + }, + "FIELD_SAME_JSON_NAME": { + "FILE", + "PACKAGE", + "WIRE_JSON", + }, + "FIELD_SAME_JSTYPE": { + "FILE", + "PACKAGE", + }, + "FIELD_SAME_LABEL": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "FIELD_SAME_NAME": { + "FILE", + "PACKAGE", + "WIRE_JSON", + }, + "FIELD_SAME_ONEOF": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "FIELD_SAME_TYPE": { + "FILE", + "PACKAGE", + }, + "FIELD_WIRE_COMPATIBLE_TYPE": { + "WIRE", + }, + "FIELD_WIRE_JSON_COMPATIBLE_TYPE": { + "WIRE_JSON", + }, + "FILE_NO_DELETE": { + "FILE", + }, + "FILE_SAME_CSHARP_NAMESPACE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_GO_PACKAGE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_MULTIPLE_FILES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_OUTER_CLASSNAME": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_PACKAGE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_STRING_CHECK_UTF8": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_OBJC_CLASS_PREFIX": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PACKAGE": { + "FILE", + "PACKAGE", + "WIRE", + "WIRE_JSON", + }, + "FILE_SAME_PHP_CLASS_PREFIX": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PHP_METADATA_NAMESPACE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PHP_NAMESPACE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_RUBY_PACKAGE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_SWIFT_PREFIX": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_OPTIMIZE_FOR": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_CC_GENERIC_SERVICES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_GENERIC_SERVICES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PY_GENERIC_SERVICES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PHP_GENERIC_SERVICES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_CC_ENABLE_ARENAS": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_SYNTAX": { + "FILE", + "PACKAGE", + }, + "MESSAGE_NO_DELETE": { + "FILE", + }, + "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR": { + "FILE", + "PACKAGE", + }, + "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "MESSAGE_SAME_REQUIRED_FIELDS": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "ONEOF_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "PACKAGE_ENUM_NO_DELETE": { + "PACKAGE", + }, + "PACKAGE_MESSAGE_NO_DELETE": { + "PACKAGE", + }, + "PACKAGE_NO_DELETE": { + "PACKAGE", + }, + "PACKAGE_SERVICE_NO_DELETE": { + "PACKAGE", + }, + "RESERVED_ENUM_NO_DELETE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RESERVED_MESSAGE_NO_DELETE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "RPC_SAME_CLIENT_STREAMING": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_SAME_IDEMPOTENCY_LEVEL": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_SAME_REQUEST_TYPE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_SAME_RESPONSE_TYPE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_SAME_SERVER_STREAMING": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "SERVICE_NO_DELETE": { + "FILE", + }, + } +) diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/bufbreakingv1beta1.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/bufbreakingv1beta1.go new file mode 100644 index 000000000..92ba6044d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/bufbreakingv1beta1.go @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufbreakingv1beta1 contains the VersionSpec for v1beta1. +// +// It uses bufbreakingcheck and bufbreakingbuild. +package bufbreakingv1beta1 + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + +// VersionSpec is the version specification for v1beta1. +var VersionSpec = &internal.VersionSpec{ + RuleBuilders: v1beta1RuleBuilders, + DefaultCategories: v1beta1DefaultCategories, + IDToCategories: v1beta1IDToCategories, +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/bufbreakingv1beta1_test.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/bufbreakingv1beta1_test.go new file mode 100644 index 000000000..bddbf4213 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/bufbreakingv1beta1_test.go @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufbreakingv1beta1 + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal/internaltesting" +) + +func TestVersionSpec(t *testing.T) { + t.Parallel() + internaltesting.RunTestVersionSpec(t, VersionSpec) +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/vars.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/vars.go new file mode 100644 index 000000000..35a31d71b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingv1beta1/vars.go @@ -0,0 +1,326 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufbreakingv1beta1 + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/internal/bufbreakingbuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" +) + +var ( + // v1beta1RuleBuilders are the rule builders. + v1beta1RuleBuilders = []*internal.RuleBuilder{ + bufbreakingbuild.EnumNoDeleteRuleBuilder, + bufbreakingbuild.EnumValueNoDeleteRuleBuilder, + bufbreakingbuild.EnumValueNoDeleteUnlessNameReservedRuleBuilder, + bufbreakingbuild.EnumValueNoDeleteUnlessNumberReservedRuleBuilder, + bufbreakingbuild.EnumValueSameNameRuleBuilder, + bufbreakingbuild.ExtensionMessageNoDeleteRuleBuilder, + bufbreakingbuild.FieldNoDeleteRuleBuilder, + bufbreakingbuild.FieldNoDeleteUnlessNameReservedRuleBuilder, + bufbreakingbuild.FieldNoDeleteUnlessNumberReservedRuleBuilder, + bufbreakingbuild.FieldSameCTypeRuleBuilder, + bufbreakingbuild.FieldSameJSONNameRuleBuilder, + bufbreakingbuild.FieldSameJSTypeRuleBuilder, + bufbreakingbuild.FieldSameLabelRuleBuilder, + bufbreakingbuild.FieldSameNameRuleBuilder, + bufbreakingbuild.FieldSameOneofRuleBuilder, + bufbreakingbuild.FieldSameTypeRuleBuilder, + bufbreakingbuild.FileNoDeleteRuleBuilder, + bufbreakingbuild.FileSameCsharpNamespaceRuleBuilder, + bufbreakingbuild.FileSameGoPackageRuleBuilder, + bufbreakingbuild.FileSameJavaMultipleFilesRuleBuilder, + bufbreakingbuild.FileSameJavaOuterClassnameRuleBuilder, + bufbreakingbuild.FileSameJavaPackageRuleBuilder, + bufbreakingbuild.FileSameJavaStringCheckUtf8RuleBuilder, + bufbreakingbuild.FileSameObjcClassPrefixRuleBuilder, + bufbreakingbuild.FileSamePackageRuleBuilder, + bufbreakingbuild.FileSamePhpClassPrefixRuleBuilder, + bufbreakingbuild.FileSamePhpMetadataNamespaceRuleBuilder, + bufbreakingbuild.FileSamePhpNamespaceRuleBuilder, + bufbreakingbuild.FileSameRubyPackageRuleBuilder, + bufbreakingbuild.FileSameSwiftPrefixRuleBuilder, + bufbreakingbuild.FileSameOptimizeForRuleBuilder, + bufbreakingbuild.FileSameCcGenericServicesRuleBuilder, + bufbreakingbuild.FileSameJavaGenericServicesRuleBuilder, + bufbreakingbuild.FileSamePyGenericServicesRuleBuilder, + bufbreakingbuild.FileSamePhpGenericServicesRuleBuilder, + bufbreakingbuild.FileSameCcEnableArenasRuleBuilder, + bufbreakingbuild.FileSameSyntaxRuleBuilder, + bufbreakingbuild.MessageNoDeleteRuleBuilder, + bufbreakingbuild.MessageNoRemoveStandardDescriptorAccessorRuleBuilder, + bufbreakingbuild.MessageSameMessageSetWireFormatRuleBuilder, + bufbreakingbuild.MessageSameRequiredFieldsRuleBuilder, + bufbreakingbuild.OneofNoDeleteRuleBuilder, + bufbreakingbuild.PackageEnumNoDeleteRuleBuilder, + bufbreakingbuild.PackageMessageNoDeleteRuleBuilder, + bufbreakingbuild.PackageNoDeleteRuleBuilder, + bufbreakingbuild.PackageServiceNoDeleteRuleBuilder, + bufbreakingbuild.ReservedEnumNoDeleteRuleBuilder, + bufbreakingbuild.ReservedMessageNoDeleteRuleBuilder, + bufbreakingbuild.RPCNoDeleteRuleBuilder, + bufbreakingbuild.RPCSameClientStreamingRuleBuilder, + bufbreakingbuild.RPCSameIdempotencyLevelRuleBuilder, + bufbreakingbuild.RPCSameRequestTypeRuleBuilder, + bufbreakingbuild.RPCSameResponseTypeRuleBuilder, + bufbreakingbuild.RPCSameServerStreamingRuleBuilder, + bufbreakingbuild.ServiceNoDeleteRuleBuilder, + } + + // v1beta1DefaultCategories are the default categories. + v1beta1DefaultCategories = []string{ + "FILE", + } + // v1beta1IDToCategories associates IDs to categories. + v1beta1IDToCategories = map[string][]string{ + "ENUM_NO_DELETE": { + "FILE", + }, + "ENUM_VALUE_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED": { + "WIRE_JSON", + }, + "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED": { + "WIRE_JSON", + "WIRE", + }, + "ENUM_VALUE_SAME_NAME": { + "FILE", + "PACKAGE", + "WIRE_JSON", + }, + "EXTENSION_MESSAGE_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "FIELD_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "FIELD_NO_DELETE_UNLESS_NAME_RESERVED": { + "WIRE_JSON", + }, + "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED": { + "WIRE_JSON", + "WIRE", + }, + "FIELD_SAME_CTYPE": { + "FILE", + "PACKAGE", + }, + "FIELD_SAME_JSON_NAME": { + "FILE", + "PACKAGE", + "WIRE_JSON", + }, + "FIELD_SAME_JSTYPE": { + "FILE", + "PACKAGE", + }, + "FIELD_SAME_LABEL": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "FIELD_SAME_NAME": { + "FILE", + "PACKAGE", + "WIRE_JSON", + }, + "FIELD_SAME_ONEOF": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "FIELD_SAME_TYPE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "FILE_NO_DELETE": { + "FILE", + }, + "FILE_SAME_CSHARP_NAMESPACE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_GO_PACKAGE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_MULTIPLE_FILES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_OUTER_CLASSNAME": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_PACKAGE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_STRING_CHECK_UTF8": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_OBJC_CLASS_PREFIX": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PACKAGE": { + "FILE", + }, + "FILE_SAME_PHP_CLASS_PREFIX": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PHP_METADATA_NAMESPACE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PHP_NAMESPACE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_RUBY_PACKAGE": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_SWIFT_PREFIX": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_OPTIMIZE_FOR": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_CC_GENERIC_SERVICES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_JAVA_GENERIC_SERVICES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PY_GENERIC_SERVICES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_PHP_GENERIC_SERVICES": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_CC_ENABLE_ARENAS": { + "FILE", + "PACKAGE", + }, + "FILE_SAME_SYNTAX": { + "FILE", + "PACKAGE", + }, + "MESSAGE_NO_DELETE": { + "FILE", + }, + "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR": { + "FILE", + "PACKAGE", + }, + "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "MESSAGE_SAME_REQUIRED_FIELDS": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "ONEOF_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "PACKAGE_ENUM_NO_DELETE": { + "PACKAGE", + }, + "PACKAGE_MESSAGE_NO_DELETE": { + "PACKAGE", + }, + "PACKAGE_NO_DELETE": { + "PACKAGE", + }, + "PACKAGE_SERVICE_NO_DELETE": { + "PACKAGE", + }, + "RESERVED_ENUM_NO_DELETE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RESERVED_MESSAGE_NO_DELETE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_NO_DELETE": { + "FILE", + "PACKAGE", + }, + "RPC_SAME_CLIENT_STREAMING": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_SAME_IDEMPOTENCY_LEVEL": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_SAME_REQUEST_TYPE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_SAME_RESPONSE_TYPE": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "RPC_SAME_SERVER_STREAMING": { + "FILE", + "PACKAGE", + "WIRE_JSON", + "WIRE", + }, + "SERVICE_NO_DELETE": { + "FILE", + }, + } +) diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/1.proto new file mode 100644 index 000000000..82d029608 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/1.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/2.proto new file mode 100644 index 000000000..4037ecdd9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/buf.yaml new file mode 100644 index 000000000..6895c500a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - ENUM_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/1.proto new file mode 100644 index 000000000..745f22630 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/1.proto @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Two { + TWO_UNSPECIFIED = 0; + TWO_ONE = 1; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + } + enum Six { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Ten { + option allow_alias = true; + TEN_UNSPECIFIED = 0; + TEN_ONE = 1; + TEN_TWO = 1; +} + +enum Eleven { + ELEVEN_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/2.proto new file mode 100644 index 000000000..ec34021c6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/2.proto @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum One2 { + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + NINE_UNSPECIFIED = 0; + NINE_ONE = 1; + NINE_TWO = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/buf.yaml new file mode 100644 index 000000000..f07b9f216 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - ENUM_VALUE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/1.proto new file mode 100644 index 000000000..78ccfcefa --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/1.proto @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Two { + reserved "TWO_TWO"; + + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + reserved "FIVE_TWO"; + + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + reserved "SEVEN_TWO"; + + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Ten { + option allow_alias = true; + TEN_UNSPECIFIED = 0; + TEN_ONE = 1; + TEN_TWO = 1; +} + +enum Eleven { + ELEVEN_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/2.proto new file mode 100644 index 000000000..19693091d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/2.proto @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum One2 { + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + reserved "NINE_TWO"; + + NINE_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/buf.yaml new file mode 100644 index 000000000..e68ada187 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/1.proto new file mode 100644 index 000000000..abcfdc778 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/1.proto @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Two { + reserved 2 to 6; + + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + reserved 2 to 6; + + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + reserved 2 to 6; + + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Ten { + option allow_alias = true; + TEN_UNSPECIFIED = 0; + TEN_ONE = 1; + TEN_TWO = 1; +} + +enum Eleven { + ELEVEN_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/2.proto new file mode 100644 index 000000000..ea80493e9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/2.proto @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum One2 { + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + reserved 2 to 6; + + NINE_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/buf.yaml new file mode 100644 index 000000000..52313a81c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/1.proto new file mode 100644 index 000000000..1ba900176 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/1.proto @@ -0,0 +1,71 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Two { + TWO_UNSPECIFIED = 0; + TWO_ONE = 1; + TWO_THREE = 2; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_THREE = 2; + } + enum Six { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_THREE = 2; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Ten { + option allow_alias = true; + TEN_UNSPECIFIED = 0; + TEN_ONE = 1; + TEN_TWO = 1; +} + +enum Eleven { + option allow_alias = true; + ELEVEN_UNSPECIFIED = 0; + ELEVEN_ONE = 1; + ELEVEN_THREE = 1; +} + +enum Twelve { + option allow_alias = true; + TWELVE_UNSPECIFIED = 0; + TWELVE_ONE = 1; + TWELVE_TWO = 1; + TWELVE_THREE = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/2.proto new file mode 100644 index 000000000..3b9f0d45b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/2.proto @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum One2 { + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + NINE_UNSPECIFIED = 0; + NINE_ONE = 1; + NINE_THREE = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/buf.yaml new file mode 100644 index 000000000..dae02eaeb --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - ENUM_VALUE_SAME_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/1.proto new file mode 100644 index 000000000..b3666ec49 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/1.proto @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message Two { + extensions 100 to 200; + extensions 300; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Three { + message Four { + message Five { + extensions 100 to 200; + extensions 300; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + message Six { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + } + message Seven { + extensions 100 to 200; + extensions 300; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + message Eight { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/2.proto new file mode 100644 index 000000000..8ea6c2b5d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/2.proto @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message One2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Two2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + message Six2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + } + message Seven2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + message Eight2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Nine2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Nine { + extensions 100 to 200; + extensions 300; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/buf.yaml new file mode 100644 index 000000000..cd7655aaa --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - EXTENSION_MESSAGE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/1.proto new file mode 100644 index 000000000..22708328d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/1.proto @@ -0,0 +1,48 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + int32 one = 1; + int32 two = 2; +} + +message Three { + message Four { + message Five { + int32 one = 1; + int32 two = 2; + } + message Six { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + int32 one = 1; + int32 two = 2; + } + message Eight { + int32 one = 1; + int32 changed_name = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/2.proto new file mode 100644 index 000000000..f83423807 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/2.proto @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message One2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + int32 one = 1; + int32 two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/buf.yaml new file mode 100644 index 000000000..361a8b87c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/1.proto new file mode 100644 index 000000000..6c55d9745 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/1.proto @@ -0,0 +1,50 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + reserved "three"; + + int32 one = 1; +} + +message Three { + message Four { + message Five { + reserved "three"; + + int32 one = 1; + } + message Six { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + reserved "three"; + + int32 one = 1; + } + message Eight { + int32 one = 1; + int32 changed_name = 2; + int32 three = 3; + } + int32 one = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/2.proto new file mode 100644 index 000000000..821074ef2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/2.proto @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message One2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + reserved "three"; + + int32 one = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/buf.yaml new file mode 100644 index 000000000..8c6fd6a2a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_NO_DELETE_UNLESS_NAME_RESERVED diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/1.proto new file mode 100644 index 000000000..8b9ab369b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/1.proto @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + reserved 3 ; + + int32 one = 1; +} + +message Three { + message Four { + message Five { + reserved 3 ; + + int32 one = 1; + } + message Six { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + reserved 3 ; + + int32 one = 1; + } + message Eight { + int32 one = 1; + int32 changed_name = 2; + int32 three = 3; + } + int32 one = 1; +} + +message Ten { + reserved 2 to 3; + reserved 5 to max; + int32 one = 1; + int32 four = 4; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/2.proto new file mode 100644 index 000000000..54b5790bb --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/2.proto @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message One2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + reserved 3 ; + + int32 one = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/buf.yaml new file mode 100644 index 000000000..464a98ad6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/1.proto new file mode 100644 index 000000000..81052cbc9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/1.proto @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + string one = 1 [ctype = STRING_PIECE]; + string two = 2; +} + +message Three { + message Four { + message Five { + string one = 1 [ctype = STRING_PIECE]; + string two = 2; + } + message Six { + string one = 1; + string two = 2; + } + } + message Seven { + string one = 1 [ctype = STRING]; + string two = 2 [ctype = CORD]; + } + message Eight { + string one = 1; + string two = 2; + } + string one = 1; + string two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/2.proto new file mode 100644 index 000000000..f124f784a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/2.proto @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + optional string one = 1; + optional string two = 2 [ctype = CORD]; +} + +message One2 { + optional string one = 1 [ctype = STRING_PIECE]; + required string two = 2 [ctype = CORD]; +} + +message Two2 { + optional string one = 1 [ctype = STRING_PIECE]; + required string two = 2 [ctype = CORD]; +} + +message Three2 { + message Four2 { + message Five2 { + optional string one = 1 [ctype = STRING_PIECE]; + required string two = 2 [ctype = CORD]; + } + message Six2 { + optional string one = 1; + required string two = 2; + } + } + message Seven2 { + optional string one = 1; + required string two = 2; + } + message Eight2 { + optional string one = 1; + required string two = 2; + } + optional string one = 1; + required string two = 2; +} + +message Nine2 { + optional string one = 1 [ctype = STRING_PIECE]; + required string two = 2 [ctype = CORD]; +} + +message Nine { + optional string one = 1 [ctype = STRING_PIECE]; + optional string two = 2 [ctype = STRING]; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/buf.yaml new file mode 100644 index 000000000..4645a6aac --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_SAME_CTYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/1.proto new file mode 100644 index 000000000..5ad19246f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/1.proto @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + int32 one = 1; + int32 two = 2 [json_name = "bar"]; + int32 three = 3 [json_name = "baz"]; + repeated int32 four = 4; + repeated int32 five = 5 [json_name = "bar2"]; + repeated int32 six = 6 [json_name = "baz2"]; + map seven = 7; + map eight = 8 [json_name = "bar3"]; + map nine = 9 [json_name = "baz3"]; +} + +message Three { + message Four { + message Five { + int32 one = 1; + int32 two = 2 [json_name = "bar"]; + int32 three = 3 [json_name = "baz"]; + repeated int32 four = 4; + repeated int32 five = 5 [json_name = "bar2"]; + repeated int32 six = 6 [json_name = "baz2"]; + map seven = 7; + map eight = 8 [json_name = "bar3"]; + map nine = 9 [json_name = "baz3"]; + } + message Six { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + } + message Seven { + int32 one = 1; + int32 two = 2 [json_name = "bar"]; + int32 three = 3 [json_name = "baz"]; + repeated int32 four = 4; + repeated int32 five = 5 [json_name = "bar2"]; + repeated int32 six = 6 [json_name = "baz2"]; + map seven = 7; + map eight = 8 [json_name = "bar3"]; + map nine = 9 [json_name = "baz3"]; + } + message Eight { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/2.proto new file mode 100644 index 000000000..d9f8751d0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/2.proto @@ -0,0 +1,111 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; +} + +message One2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; +} + +message Two2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + message Six2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + } + message Seven2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + message Eight2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } +} + +message Nine { + oneof foo { + int32 one = 1; + int32 two = 2 [json_name = "bar" ]; + int32 three = 3 [json_name = "baz"]; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/buf.yaml new file mode 100644 index 000000000..4a734a5f0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_SAME_JSON_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/1.proto new file mode 100644 index 000000000..fd2caa28c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/1.proto @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + int64 one = 1 [jstype = JS_NUMBER]; + int64 two = 2; +} + +message Three { + message Four { + message Five { + int64 one = 1 [jstype = JS_NUMBER]; + int64 two = 2; + } + message Six { + int64 one = 1; + int64 two = 2; + } + } + message Seven { + int64 one = 1 [jstype = JS_NUMBER]; + int64 two = 2 [jstype = JS_NORMAL]; + } + message Eight { + int64 one = 1; + int64 two = 2; + } + int64 one = 1; + int64 two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/2.proto new file mode 100644 index 000000000..e78a38540 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/2.proto @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + optional int64 one = 1; + optional int64 two = 2 [jstype = JS_STRING]; +} + +message One2 { + optional int64 one = 1 [jstype = JS_NUMBER]; + required int64 two = 2 [jstype = JS_STRING]; +} + +message Two2 { + optional int64 one = 1 [jstype = JS_NUMBER]; + required int64 two = 2 [jstype = JS_STRING]; +} + +message Three2 { + message Four2 { + message Five2 { + optional int64 one = 1 [jstype = JS_NUMBER]; + required int64 two = 2 [jstype = JS_STRING]; + } + message Six2 { + optional int64 one = 1; + required int64 two = 2; + } + } + message Seven2 { + optional int64 one = 1; + required int64 two = 2; + } + message Eight2 { + optional int64 one = 1; + required int64 two = 2; + } + optional int64 one = 1; + required int64 two = 2; +} + +message Nine2 { + optional int64 one = 1 [jstype = JS_NUMBER]; + required int64 two = 2 [jstype = JS_STRING]; +} + +message Nine { + optional int64 one = 1 [jstype = JS_NUMBER]; + optional int64 two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/buf.yaml new file mode 100644 index 000000000..9d3951a1b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_SAME_JSTYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/1.proto new file mode 100644 index 000000000..d7675fe85 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/1.proto @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "2.proto"; + +message Two { + repeated int64 one = 1; + repeated Two two = 2; + int64 three = 3; + Two four = 4; + int32 five = 5; + int32 six = 6; +} + +message Three { + message Four { + message Five { + repeated int64 one = 1; + repeated Two two = 2; + int64 three = 3; + Two four = 4; + int32 five = 5; + int32 six = 6; + } + message Six { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } + } + message Seven { + repeated int64 one = 1; + repeated Two two = 2; + int64 three = 3; + Two four = 4; + int32 five = 5; + int32 six = 6; + } + message Eight { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/2.proto new file mode 100644 index 000000000..d2541e484 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/2.proto @@ -0,0 +1,87 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message One2 { + required int32 one = 1; + required One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message Two2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message Three2 { + message Four2 { + message Five2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + message Six2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + } + message Seven2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + message Eight2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } +} + +message Nine2 { + oneof foo { + int32 one = 1; + One two = 2; + } +} + +message Nine { + oneof foo { + int64 one = 1; + Nine two = 2; + } +} + +message Ten { + repeated int64 one = 1; + required int64 two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/buf.yaml new file mode 100644 index 000000000..f37713fe3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_SAME_LABEL diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/1.proto new file mode 100644 index 000000000..8468cc9fa --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/1.proto @@ -0,0 +1,52 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + int32 one = 1; + int32 four = 2; + int32 three = 3; +} + +message Three { + message Four { + message Five { + int32 one = 1; + int32 four = 2; + int32 three = 3; + } + message Six { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + int32 one = 1; + int32 four = 2; + int32 three = 3; + } + message Eight { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/2.proto new file mode 100644 index 000000000..0a0b1cc06 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/2.proto @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message One2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + oneof foo { + int32 one = 1; + int32 four = 2; + int32 three = 3; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/buf.yaml new file mode 100644 index 000000000..84e87a710 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_SAME_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/1.proto new file mode 100644 index 000000000..9daafcb83 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/1.proto @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + int32 one = 1; + oneof baz { + int32 two = 2; + } + oneof foo { + int32 three = 3; + } +} + +message Three { + message Four { + message Five { + int32 one = 1; + oneof baz { + int32 two = 2; + } + oneof foo { + int32 three = 3; + } + } + message Six { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + } + message Seven { + int32 one = 1; + oneof baz { + int32 two = 2; + } + oneof foo { + int32 three = 3; + } + } + message Eight { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/2.proto new file mode 100644 index 000000000..641f75132 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/2.proto @@ -0,0 +1,116 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message One2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Two2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + message Six2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + } + message Seven2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + message Eight2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Nine2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Nine { + int32 one = 1; + oneof baz { + int32 two = 2; + } + oneof foo { + int32 three = 3; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/buf.yaml new file mode 100644 index 000000000..bb0a54b70 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_SAME_ONEOF diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/1.proto new file mode 100644 index 000000000..e11961f14 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/1.proto @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "2.proto"; + +message Two { + repeated int64 one = 1; + repeated Two two = 2; + int32 three = 3; + Two four = 4; + Two five = 5; + map six = 6; +} + +message Three { + message Four { + message Five { + repeated int64 one = 1; + repeated Two two = 2; + int32 three = 3; + Two four = 4; + Two five = 5; + map six = 6; + } + message Six { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } + } + message Seven { + repeated int64 one = 1; + repeated Two two = 2; + int32 three = 3; + Two four = 4; + Two five = 5; + map six = 6; + } + message Eight { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/2.proto new file mode 100644 index 000000000..d2541e484 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/2.proto @@ -0,0 +1,87 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message One2 { + required int32 one = 1; + required One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message Two2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message Three2 { + message Four2 { + message Five2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + message Six2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + } + message Seven2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + message Eight2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } +} + +message Nine2 { + oneof foo { + int32 one = 1; + One two = 2; + } +} + +message Nine { + oneof foo { + int64 one = 1; + Nine two = 2; + } +} + +message Ten { + repeated int64 one = 1; + required int64 two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/buf.yaml new file mode 100644 index 000000000..96e1ec81d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_SAME_TYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/2.proto new file mode 100644 index 000000000..dbf9a27f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/2.proto @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message CompatiblePrimitives { + bool bool_field_1 = 1; + int32 int32_field_1 = 2; + uint32 uint32_field_1 = 3; + int64 int64_field_1 = 4; + uint64 uint64_field_1 = 5; + + sint64 sint64_field_1 = 6; + sint32 sint32_field_1 = 7; + + sfixed32 sfixed32_field_1 = 8; + fixed32 fixed32_field_1 = 9; + + sfixed64 sfixed64_field_1 = 10; + fixed64 fixed64_field_1 = 11; + + string string_field_1 = 12; + + bytes bytes_field_1 = 14; + + float float_field_1 = 15; + + double double_field_1 = 16; +} + +message IncompatiblePrimitives { + sfixed64 sfixed64_field_1 = 1; + string string_field_1 = 2; + bytes bytes_field_1 = 3; + float float_field_1 = 4; + double double_field_1 = 5; + fixed32 fixed32_field_1 = 6; + sfixed32 sfixed32_field_1 = 7; + sint32 sint32_field_1 = 8; + sint64 sint64_field_1 = 9; + string fixed64_field_1 = 10; + int32 int32_field_1 = 11; + uint32 uint32_field_1 = 12; + int64 int64_field_1 = 14; + uint64 uint64_field_1 = 15; + bool bool_field_1 = 16; +} + +enum Baz { + BAZ_UNSPECIFIED = 0; + BAZ_ONE = 1; + BAZ_TWO = 2; +} + +message WithCompatibleEnums { + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; + } + Foo foo = 1; + Baz baz = 2; +} + +enum Bat { + BAT_UNSPECIFIED = 0; + BAT_TWO = 1; +} + +message WithIncompatibleEnums { + enum Bar { + BAR_UNSPECIFIED = 0; + BAR_TWO = 1; + } + enum Ban { + BAN_UNSPECIFIED = 0; + BAN_ONE = 1; + } + Bar bar = 1; + Bat bat = 2; + Ban ban = 3; +} + +message StringBytes { + bytes string_field_1 = 1; + string bytes_field_1 = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/buf.yaml new file mode 100644 index 000000000..7aaa932a0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_WIRE_COMPATIBLE_TYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/2.proto new file mode 100644 index 000000000..8fabe8bc9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/2.proto @@ -0,0 +1,104 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message CompatiblePrimitives { + uint32 uint32_field_1 = 1; + int32 int32_field_1 = 2; + + uint64 uint64_field_1 = 3; + int64 int64_field_1 = 4; + + sfixed32 sfixed32_field_1 = 5; + fixed32 fixed32_field_1 = 6; + + sfixed64 sfixed64_field_1 = 7; + fixed64 fixed64_field_1 = 8; + + bool bool_field_1 = 9; + + sint32 sint32_field_1 = 10; + + sint64 sint64_field_1 = 11; + + string string_field_1 = 12; + + bytes bytes_field_1 = 14; + + float float_field_1 = 15; + + double double_field_1 = 16; +} + +message IncompatiblePrimitives { + sfixed64 sfixed64_field_1 = 1; + string string_field_1 = 2; + bytes bytes_field_1 = 3; + float float_field_1 = 4; + double double_field_1 = 5; + fixed32 fixed32_field_1 = 6; + sfixed32 sfixed32_field_1 = 7; + sint32 sint32_field_1 = 8; + sint64 sint64_field_1 = 9; + string fixed64_field_1 = 10; + int32 int32_field_1 = 11; + uint32 uint32_field_1 = 12; + int64 int64_field_1 = 14; + uint64 uint64_field_1 = 15; + bool bool_field_1 = 16; +} + +enum Baz { + BAZ_UNSPECIFIED = 0; + BAZ_ONE = 1; + BAZ_TWO = 2; +} + +message WithCompatibleEnums { + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; + } + Foo foo = 1; + Baz baz = 2; +} + +enum Bat { + BAT_UNSPECIFIED = 0; + BAT_TWO = 1; +} + +message WithIncompatibleEnums { + enum Bar { + BAR_UNSPECIFIED = 0; + BAR_TWO = 1; + } + enum Ban { + BAN_UNSPECIFIED = 0; + BAN_ONE = 1; + } + Bar bar = 1; + Bat bat = 2; + Ban ban = 3; +} + +message StringBytes { + bytes string_field_1 = 1; + string bytes_field_1 = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/buf.yaml new file mode 100644 index 000000000..1d7d0a70d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FIELD_WIRE_JSON_COMPATIBLE_TYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/buf.yaml new file mode 100644 index 000000000..f3249848d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FILE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/sub/a/b/sub_a_b.proto new file mode 100644 index 000000000..33d684be2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/sub/a/b/sub_a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/buf.yaml new file mode 100644 index 000000000..9e34e4af7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/buf.yaml @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +breaking: + use: + - FILE_NO_DELETE + ignore: + - a/c + - no_package.proto diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/sub/a/b/sub_a_b.proto new file mode 100644 index 000000000..33d684be2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/sub/a/b/sub_a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/a/v1beta1/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/a/v1beta1/a.proto new file mode 100644 index 000000000..0217e3a56 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/a/v1beta1/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/buf.yaml new file mode 100644 index 000000000..7029b018b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/buf.yaml @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + ignore_unstable_packages: true diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/a.proto new file mode 100644 index 000000000..40d94c1b4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/buf.yaml new file mode 100644 index 000000000..8b85ab3f0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FILE_SAME_PACKAGE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/no_package.proto new file mode 100644 index 000000000..6b49d48d1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/no_package.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package c; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/sub/a/b/sub_a_b.proto new file mode 100644 index 000000000..33d684be2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/sub/a/b/sub_a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/buf.yaml new file mode 100644 index 000000000..0a7910420 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/buf.yaml @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +build: + roots: + - root +breaking: + use: + - FILE_SAME_SYNTAX diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/a.proto new file mode 100644 index 000000000..5c8aff5d4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto new file mode 100644 index 000000000..e35a6e55f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +syntax = "proto2"; + +package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/1.proto new file mode 100644 index 000000000..2445aae69 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/1.proto @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +option java_package = "bar"; +option java_outer_classname = "bar"; +option java_multiple_files = false; +option go_package = "bar"; +option objc_class_prefix = "bar"; +option csharp_namespace = "bar"; +option swift_prefix = "bar"; +option php_class_prefix = "bar"; +option php_namespace = "bar"; +option php_metadata_namespace = "bar"; +option ruby_package = "bar"; + +option java_string_check_utf8 = false; +option optimize_for = SPEED; +option cc_generic_services = false; +option java_generic_services = false; +option py_generic_services = false; +option php_generic_services = false; +option cc_enable_arenas = false; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/2.proto new file mode 100644 index 000000000..4e57ba6b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/2.proto @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +option java_package = "bar"; +option java_outer_classname = "bar"; +option java_multiple_files = true; +option go_package = "bar"; +option objc_class_prefix = "bar"; +option csharp_namespace = "bar"; +option swift_prefix = "bar"; +option php_class_prefix = "bar"; +option php_namespace = "bar"; +option php_metadata_namespace = "bar"; +option ruby_package = "bar"; + +option java_string_check_utf8 = true; +option optimize_for = CODE_SIZE; +option cc_generic_services = true; +option java_generic_services = true; +option py_generic_services = true; +option php_generic_services = true; +option cc_enable_arenas = false; // the default option is true as of 3.12, so this should be changed now diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/buf.yaml new file mode 100644 index 000000000..66c5713f6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FILE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto new file mode 100644 index 000000000..0fb8fe775 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +message A {} + +enum AEnum { + A_ENUM_UNSPECIFIED = 0; +} + +service AService{} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/buf.yaml new file mode 100644 index 000000000..deb1e7a08 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +breaking: + use: + - PACKAGE + ignore_unstable_packages: true diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/1.proto new file mode 100644 index 000000000..5f1f13543 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/1.proto @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/2.proto new file mode 100644 index 000000000..c99c0a137 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/2.proto @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/1.proto new file mode 100644 index 000000000..bfebbeaa5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/1.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/2.proto new file mode 100644 index 000000000..d4fc4ec69 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto new file mode 100644 index 000000000..33a6ef73d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto new file mode 100644 index 000000000..da378038c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/1.proto new file mode 100644 index 000000000..70c17a8dd --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/1.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/2.proto new file mode 100644 index 000000000..b536fac23 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/buf.yaml new file mode 100644 index 000000000..6895c500a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - ENUM_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/1.proto new file mode 100644 index 000000000..5f1f13543 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/1.proto @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/2.proto new file mode 100644 index 000000000..c99c0a137 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/2.proto @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/1.proto new file mode 100644 index 000000000..bfebbeaa5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/1.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/2.proto new file mode 100644 index 000000000..d4fc4ec69 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto new file mode 100644 index 000000000..33a6ef73d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto new file mode 100644 index 000000000..da378038c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/1.proto new file mode 100644 index 000000000..70c17a8dd --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/1.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +enum One { + ONE_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/2.proto new file mode 100644 index 000000000..b536fac23 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/buf.yaml new file mode 100644 index 000000000..0929cab41 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - ENUM_NO_DELETE + ignore_unstable_packages: true diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/1.proto new file mode 100644 index 000000000..17bca464a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/1.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo { + int32 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/2.proto new file mode 100644 index 000000000..aebc22ed4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/2.proto @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo2 { + Bar2 foo = 1; +} +enum Bar2 { + Blah = 0; +} + diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/1.proto new file mode 100644 index 000000000..5ec04926e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/1.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo { + Bar foo = 1; +} +enum Bar { + Blah = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/2.proto new file mode 100644 index 000000000..719db3c2b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/2.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo2 { + Foo2 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/1.proto new file mode 100644 index 000000000..883854ba8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/1.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo { + Foo foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/2.proto new file mode 100644 index 000000000..9ee653d36 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/2.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo2 { + int32 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/1.proto new file mode 100644 index 000000000..a6a575e30 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/1.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo { + Foo22 foo = 1; +} +message Foo22 { + int32 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/2.proto new file mode 100644 index 000000000..719db3c2b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/2.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo2 { + Foo2 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/1.proto new file mode 100644 index 000000000..262e5e8a7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/1.proto @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One {} + +message Three { + message Four { + message Six {} + } + message Eight{} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/2.proto new file mode 100644 index 000000000..7a05834a9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/2.proto @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 {} + +message Two2 {} + +message Three2 { + message Four2 { + message Five2 {} + message Six2 {} + } + message Seven2{} + message Eight2{} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/buf.yaml new file mode 100644 index 000000000..2add8600c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - MESSAGE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/1.proto new file mode 100644 index 000000000..336a4076a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/1.proto @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + required string two = 2; +} + +message Two { + required string two = 2; +} + +message Three { + message Four { + message Five { + required string two = 2; + } + message Six { + // Six had a required field previously + } + } + message Seven { + required string two = 2; + } + message Eight { + // Eight had no previous required field + required string two = 2; + } + required string two = 2; +} + +message Nine { + // Nine is a new message so this should not end up being a breaking change. + required string one = 1; + required string two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/2.proto new file mode 100644 index 000000000..7e69d0f9c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/2.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One2 { + required string two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/buf.yaml new file mode 100644 index 000000000..fe6ec8ae2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - MESSAGE_SAME_REQUIRED_FIELDS diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/1.proto new file mode 100644 index 000000000..c648b3d78 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/1.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + option message_set_wire_format = false; + option no_standard_descriptor_accessor = true; +} + +message Three { + message Four { + message Five { + option no_standard_descriptor_accessor = true; + } + message Six { + option message_set_wire_format = true; + extensions 4 to max; + } + } + message Seven { + option message_set_wire_format = false; + } + message Eight { + option message_set_wire_format = true; + extensions 4 to max; + } + option no_standard_descriptor_accessor = true; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/2.proto new file mode 100644 index 000000000..a00cf9a42 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/2.proto @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One2 { + option no_standard_descriptor_accessor = true; +} + +message Two { + option no_standard_descriptor_accessor = true; +} + + +message Nine { + option message_set_wire_format = true; + extensions 4 to max; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/buf.yaml new file mode 100644 index 000000000..0a423e05d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR + - MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/1.proto new file mode 100644 index 000000000..6167faa34 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/1.proto @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three { + message Four { + message Five { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + } + message Seven { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/2.proto new file mode 100644 index 000000000..f0246600f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/2.proto @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message One2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Two2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Three2 { + message Four2 { + message Five2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Six2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + } + message Seven2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Eight2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Nine2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Nine { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/buf.yaml new file mode 100644 index 000000000..040e21c43 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - ONEOF_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a1.proto new file mode 100644 index 000000000..a2aa28186 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a1.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One {} + +service Foo {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a2.proto new file mode 100644 index 000000000..0ea5c8a16 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a2.proto @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } +} + +message Three { + message Four { + message Six {} + } + message Eight {} +} + +enum EnumTwo { + ENUM_TWO_UNSPECIFIED = 0; +} + +service Baz {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b1.proto new file mode 100644 index 000000000..df61d48f1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b1.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +message One {} + +service Foo {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b2.proto new file mode 100644 index 000000000..2b8a72401 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b2.proto @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +message Two {} + +message Three { + message Four { + message Five { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } + } + message Six {} + } + message Seven { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } + } +} + +message Nine {} + +enum EnumTwo { + ENUM_TWO_UNSPECIFIED = 0; +} + +service Baz {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/buf.yaml new file mode 100644 index 000000000..2d95451e6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - PACKAGE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/1.proto new file mode 100644 index 000000000..1c850adbd --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/1.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message ARequest { + string key = 1; +} + +message AResponse { +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/2.proto new file mode 100644 index 000000000..ce94d9aed --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/2.proto @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +service BService { + rpc BRPC(BRequest) returns (BResponse); +} + +message BRequest { + string key = 1; +} + +message BResponse { +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/buf.yaml new file mode 100644 index 000000000..d33cefc7f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - PACKAGE_SERVICE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/1.proto new file mode 100644 index 000000000..15e659cac --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/1.proto @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Two { + reserved 100 to 250; + reserved 300; + reserved "foo"; + TWO_UNSPECIFIED = 0; + TWO_ONE = 1; + TWO_TWO = 2; +} + +message Three { + message Four { + enum Five { + reserved 100 to 250; + reserved 300; + reserved "foo"; + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six { + reserved 3 to 5, 100 to 250; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + reserved 100 to 200; + reserved 300; + reserved "foo"; + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight { + reserved 3 to 5, 100 to 250; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/2.proto new file mode 100644 index 000000000..352843da3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/2.proto @@ -0,0 +1,108 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum One2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + NINE2_UNSPECIFIED = 0; + NINE2_ONE = 1; + NINE2_TWO = 2; +} + +enum Nine { + reserved 100 to 200; + reserved 300; + reserved "foo"; + NINE_UNSPECIFIED = 0; + NINE_ONE = 1; + NINE_TWO = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/buf.yaml new file mode 100644 index 000000000..132ec83f2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - RESERVED_ENUM_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/1.proto new file mode 100644 index 000000000..e61042c13 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/1.proto @@ -0,0 +1,69 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Two { + reserved 100 to 250; + reserved 300; + reserved "foo"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three { + message Four { + message Five { + reserved 100 to 250; + reserved 300; + reserved "foo"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six { + reserved 4 to 5, 100 to 250; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + reserved 100 to 250; + reserved 300; + reserved "foo"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight { + reserved 4 to 5, 100 to 250; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/2.proto new file mode 100644 index 000000000..964868a15 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/2.proto @@ -0,0 +1,111 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message One2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + reserved 100 to 200; + reserved 300; + reserved "foo"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/buf.yaml new file mode 100644 index 000000000..88f046f31 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - RESERVED_MESSAGE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/1.proto new file mode 100644 index 000000000..6eda3f317 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/1.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Two { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/2.proto new file mode 100644 index 000000000..3317d5b3b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/2.proto @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service One { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service One2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service Two2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service Three2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service Three { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/buf.yaml new file mode 100644 index 000000000..0891c60fb --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - RPC_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/1.proto new file mode 100644 index 000000000..47614802e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/1.proto @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; + +service Two { + rpc Foo(stream google.protobuf.Any) returns (google.protobuf.Any) {} + rpc Bar(google.protobuf.Any) returns (stream google.protobuf.Any) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/2.proto new file mode 100644 index 000000000..50721e1ad --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/2.proto @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; + +service One { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service One2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Two2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Three2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Three { + rpc Foo(stream google.protobuf.Any) returns (google.protobuf.Any) {} + rpc Bar(google.protobuf.Any) returns (stream google.protobuf.Any) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service Four { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) { + option idempotency_level = NO_SIDE_EFFECTS; + } + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) { + option idempotency_level = IDEMPOTENT; + } +} + +service Four2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) { + option idempotency_level = NO_SIDE_EFFECTS; + } + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) { + option idempotency_level = IDEMPOTENT; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/buf.yaml new file mode 100644 index 000000000..385532543 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + except: + - SERVICE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/1.proto new file mode 100644 index 000000000..402950d2d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/1.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +service One {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/2.proto new file mode 100644 index 000000000..42bd1d112 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/2.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +service One2 {} +service Two2 {} +service Three2 {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/buf.yaml new file mode 100644 index 000000000..df4ae8c39 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - SERVICE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/1.proto new file mode 100644 index 000000000..780bbd079 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/1.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/2.proto new file mode 100644 index 000000000..4037ecdd9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/1.proto new file mode 100644 index 000000000..1bdffec89 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/1.proto @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum Two { + TWO_UNSPECIFIED = 0; + TWO_ONE = 1; + TWO_TWO = 2; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + NINE_UNSPECIFIED = 0; + NINE_ONE = 1; + NINE_TWO = 2; +} + +enum Ten { + option allow_alias = true; + TEN_UNSPECIFIED = 0; + TEN_ONE = 1; + TEN_TWO = 1; +} + +enum Eleven { + option allow_alias = true; + ELEVEN_UNSPECIFIED = 0; + ELEVEN_ONE = 1; + ELEVEN_TWO = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/2.proto new file mode 100644 index 000000000..d66dd2150 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/2.proto @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One2 { + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/1.proto new file mode 100644 index 000000000..1bdffec89 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/1.proto @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum Two { + TWO_UNSPECIFIED = 0; + TWO_ONE = 1; + TWO_TWO = 2; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + NINE_UNSPECIFIED = 0; + NINE_ONE = 1; + NINE_TWO = 2; +} + +enum Ten { + option allow_alias = true; + TEN_UNSPECIFIED = 0; + TEN_ONE = 1; + TEN_TWO = 1; +} + +enum Eleven { + option allow_alias = true; + ELEVEN_UNSPECIFIED = 0; + ELEVEN_ONE = 1; + ELEVEN_TWO = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/2.proto new file mode 100644 index 000000000..d66dd2150 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/2.proto @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One2 { + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/1.proto new file mode 100644 index 000000000..1bdffec89 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/1.proto @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum Two { + TWO_UNSPECIFIED = 0; + TWO_ONE = 1; + TWO_TWO = 2; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + NINE_UNSPECIFIED = 0; + NINE_ONE = 1; + NINE_TWO = 2; +} + +enum Ten { + option allow_alias = true; + TEN_UNSPECIFIED = 0; + TEN_ONE = 1; + TEN_TWO = 1; +} + +enum Eleven { + option allow_alias = true; + ELEVEN_UNSPECIFIED = 0; + ELEVEN_ONE = 1; + ELEVEN_TWO = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/2.proto new file mode 100644 index 000000000..d66dd2150 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/2.proto @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One2 { + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/1.proto new file mode 100644 index 000000000..5b6dbe7cf --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/1.proto @@ -0,0 +1,82 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum Two { + TWO_UNSPECIFIED = 0; + TWO_ONE = 1; + TWO_TWO = 2; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + NINE_UNSPECIFIED = 0; + NINE_ONE = 1; + NINE_TWO = 2; +} + +enum Ten { + option allow_alias = true; + TEN_UNSPECIFIED = 0; + TEN_ONE = 1; + TEN_TWO = 1; +} + +enum Eleven { + option allow_alias = true; + ELEVEN_UNSPECIFIED = 0; + ELEVEN_ONE = 1; + ELEVEN_TWO = 1; +} + +enum Twelve { + option allow_alias = true; + TWELVE_UNSPECIFIED = 0; + TWELVE_ONE = 1; + TWELVE_TWO = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/2.proto new file mode 100644 index 000000000..d66dd2150 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/2.proto @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One2 { + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/1.proto new file mode 100644 index 000000000..4b8194c2a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/1.proto @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Two { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Three { + message Four { + message Five { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + message Six { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + } + message Seven { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + message Eight { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Nine { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/2.proto new file mode 100644 index 000000000..11b0b98e4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/2.proto @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Two2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + message Six2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + } + message Seven2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + message Eight2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; + } + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} + +message Nine2 { + extensions 4 to 5, 100 to 200; + extensions 300, 301, 1000 to max; + optional int32 one = 1; + optional int32 two = 2; + optional int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/1.proto new file mode 100644 index 000000000..bc03a4574 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/1.proto @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three { + message Four { + message Five { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/2.proto new file mode 100644 index 000000000..175f09490 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/2.proto @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/1.proto new file mode 100644 index 000000000..bc03a4574 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/1.proto @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three { + message Four { + message Five { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/2.proto new file mode 100644 index 000000000..175f09490 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/2.proto @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/1.proto new file mode 100644 index 000000000..10614b6ea --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/1.proto @@ -0,0 +1,73 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three { + message Four { + message Five { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Ten { + int32 one = 1; + int32 two = 2; + int32 three = 3; + int32 four = 4; + int32 five = 5; + int32 six = 6; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/2.proto new file mode 100644 index 000000000..175f09490 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/2.proto @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/1.proto new file mode 100644 index 000000000..42f95aa74 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/1.proto @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + string one = 1 [ctype = STRING]; + string two = 2 [ctype = CORD]; +} + +message Two { + string one = 1 [ctype = STRING]; + string two = 2 [ctype = CORD]; +} + +message Three { + message Four { + message Five { + string one = 1 [ctype = STRING]; + string two = 2 [ctype = CORD]; + } + message Six { + string one = 1; + string two = 2; + } + } + message Seven { + string one = 1; + string two = 2; + } + message Eight { + string one = 1; + string two = 2; + } + string one = 1; + string two = 2; +} + +message Nine { + string one = 1 [ctype = STRING]; + string two = 2 [ctype = CORD]; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/2.proto new file mode 100644 index 000000000..b87daa586 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/2.proto @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One2 { + optional string one = 1 [ctype = STRING_PIECE]; + required string two = 2 [ctype = CORD]; +} + +message Two2 { + optional string one = 1 [ctype = STRING_PIECE]; + required string two = 2 [ctype = CORD]; +} + +message Three2 { + message Four2 { + message Five2 { + optional string one = 1 [ctype = STRING_PIECE]; + required string two = 2 [ctype = CORD]; + } + message Six2 { + optional string one = 1; + required string two = 2; + } + } + message Seven2 { + optional string one = 1; + required string two = 2; + } + message Eight2 { + optional string one = 1; + required string two = 2; + } + optional string one = 1; + required string two = 2; +} + +message Nine2 { + optional string one = 1 [ctype = STRING_PIECE]; + required string two = 2 [ctype = CORD]; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/1.proto new file mode 100644 index 000000000..478a020c6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/1.proto @@ -0,0 +1,99 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; +} + +message Two { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; +} + +message Three { + message Four { + message Five { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "2" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "3" ]; + map nine = 9; + } + message Six { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + } + message Seven { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + message Eight { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } +} + +message Nine { + oneof foo { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/2.proto new file mode 100644 index 000000000..bc0dbb37e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/2.proto @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; +} + +message Two2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + message Six2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + } + message Seven2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } + message Eight2 { + int32 one = 1 [json_name = "foo"]; + int32 two = 2 [json_name = "" ]; + int32 three = 3; + repeated int32 four = 4 [json_name = "bar"]; + repeated int32 five = 5 [json_name = "1" ]; + repeated int32 six = 6; + map seven = 7 [json_name = "baz"]; + map eight = 8 [json_name = "2" ]; + map nine = 9; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/1.proto new file mode 100644 index 000000000..2ea099090 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/1.proto @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int64 one = 1 [jstype = JS_NORMAL]; + int64 two = 2 [jstype = JS_STRING]; +} + +message Two { + int64 one = 1 [jstype = JS_NORMAL]; + int64 two = 2 [jstype = JS_STRING]; +} + +message Three { + message Four { + message Five { + int64 one = 1 [jstype = JS_NORMAL]; + int64 two = 2 [jstype = JS_STRING]; + } + message Six { + int64 one = 1; + int64 two = 2; + } + } + message Seven { + int64 one = 1; + int64 two = 2; + } + message Eight { + int64 one = 1; + int64 two = 2; + } + int64 one = 1; + int64 two = 2; +} + +message Nine { + int64 one = 1 [jstype = JS_NORMAL]; + int64 two = 2 [jstype = JS_STRING]; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/2.proto new file mode 100644 index 000000000..5bdda7fd3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/2.proto @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One2 { + optional int64 one = 1 [jstype = JS_NUMBER]; + required int64 two = 2 [jstype = JS_STRING]; +} + +message Two2 { + optional int64 one = 1 [jstype = JS_NUMBER]; + required int64 two = 2 [jstype = JS_STRING]; +} + +message Three2 { + message Four2 { + message Five2 { + optional int64 one = 1 [jstype = JS_NUMBER]; + required int64 two = 2 [jstype = JS_STRING]; + } + message Six2 { + optional int64 one = 1; + required int64 two = 2; + } + } + message Seven2 { + optional int64 one = 1; + required int64 two = 2; + } + message Eight2 { + optional int64 one = 1; + required int64 two = 2; + } + optional int64 one = 1; + required int64 two = 2; +} + +message Nine2 { + optional int64 one = 1 [jstype = JS_NUMBER]; + required int64 two = 2 [jstype = JS_STRING]; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/1.proto new file mode 100644 index 000000000..06e31afdb --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/1.proto @@ -0,0 +1,85 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; +} + +message Two { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; +} + +message Three { + message Four { + message Five { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } + message Six { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } + } + message Seven { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } + message Eight { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } +} + +message Nine { + oneof foo { + int32 one = 1; + One two = 2; + } +} + +message Ten { + int64 one = 1; + int64 two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/2.proto new file mode 100644 index 000000000..ab243f751 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/2.proto @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +import "1.proto"; + +message One2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message Two2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message Three2 { + message Four2 { + message Five2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + message Six2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + } + message Seven2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + message Eight2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } +} + +message Nine2 { + oneof foo { + int32 one = 1; + One two = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/1.proto new file mode 100644 index 000000000..bc03a4574 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/1.proto @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three { + message Four { + message Five { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/2.proto new file mode 100644 index 000000000..175f09490 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/2.proto @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/1.proto new file mode 100644 index 000000000..88fe3bb3d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/1.proto @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Two { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Three { + message Four { + message Five { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + message Six { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + } + message Seven { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + message Eight { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Nine { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/2.proto new file mode 100644 index 000000000..55e5c2238 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/2.proto @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Two2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + message Six2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + } + message Seven2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + message Eight2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; + } + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} + +message Nine2 { + oneof foo { + int32 one = 1; + } + oneof bar { + int32 two = 2; + } + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/1.proto new file mode 100644 index 000000000..06e31afdb --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/1.proto @@ -0,0 +1,85 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; +} + +message Two { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; +} + +message Three { + message Four { + message Five { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } + message Six { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } + } + message Seven { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } + message Eight { + int32 one = 1; + One two = 2; + repeated int32 three = 3; + repeated One four = 4; + map five = 5; + map six = 6; + } +} + +message Nine { + oneof foo { + int32 one = 1; + One two = 2; + } +} + +message Ten { + int64 one = 1; + int64 two = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/2.proto new file mode 100644 index 000000000..ab243f751 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/2.proto @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +import "1.proto"; + +message One2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message Two2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; +} + +message Three2 { + message Four2 { + message Five2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + message Six2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + } + message Seven2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } + message Eight2 { + optional int32 one = 1; + optional One two = 2; + repeated int32 three = 3; + repeated One four = 4; + } +} + +message Nine2 { + oneof foo { + int32 one = 1; + One two = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_compatible_type/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_compatible_type/1.proto new file mode 100644 index 000000000..2065be76d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_compatible_type/1.proto @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message CompatiblePrimitives { + int32 int32_field_1 = 1; + uint32 uint32_field_1 = 2; + int64 int64_field_1 = 3; + uint64 uint64_field_1 = 4; + bool bool_field_1 = 5; + + sint32 sint32_field_1 = 6; + sint64 sint64_field_1 = 7; + + fixed32 fixed32_field_1 = 8; + sfixed32 sfixed32_field_1 = 9; + + fixed64 fixed64_field_1 = 10; + sfixed64 sfixed64_field_1 = 11; + + string string_field_1 = 12; + + bytes bytes_field_1 = 14; + + float float_field_1 = 15; + + double double_field_1 = 16; +} + +message IncompatiblePrimitives { + int32 int32_field_1 = 1; + uint32 uint32_field_1 = 2; + int64 int64_field_1 = 3; + uint64 uint64_field_1 = 4; + bool bool_field_1 = 5; + sint32 sint32_field_1 = 6; + sint64 sint64_field_1 = 7; + fixed32 fixed32_field_1 = 8; + sfixed32 sfixed32_field_1 = 9; + fixed64 fixed64_field_1 = 10; + sfixed64 sfixed64_field_1 = 11; + string string_field_1 = 12; + bytes bytes_field_1 = 14; + float float_field_1 = 15; + double double_field_1 = 16; +} + + +enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; +} + +message WithCompatibleEnums { + enum Baz { + BAZ_UNSPECIFIED = 0; + BAZ_ONE = 1; + } + Foo foo = 1; + Baz baz = 2; +} + +enum Bar { + BAR_UNSPECIFIED = 0; + BAR_ONE = 1; +} + +message WithIncompatibleEnums { + enum Bat { + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + } + enum Bam { + BAM_UNSPECIFIED = 0; + BAM_ONE = 1; + } + Bar bar = 1; + Bat bat = 2; + Bam bam = 3; +} + +message StringBytes { + string string_field_1 = 1; + bytes bytes_field_1 = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_json_compatible_type/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_json_compatible_type/1.proto new file mode 100644 index 000000000..88b595e73 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_json_compatible_type/1.proto @@ -0,0 +1,103 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message CompatiblePrimitives { + int32 int32_field_1 = 1; + uint32 uint32_field_1 = 2; + + int64 int64_field_1 = 3; + uint64 uint64_field_1 = 4; + + fixed32 fixed32_field_1 = 5; + sfixed32 sfixed32_field_1 = 6; + + fixed64 fixed64_field_1 = 7; + sfixed64 sfixed64_field_1 = 8; + + bool bool_field_1 = 9; + + sint32 sint32_field_1 = 10; + + sint64 sint64_field_1 = 11; + + string string_field_1 = 12; + + bytes bytes_field_1 = 14; + + float float_field_1 = 15; + + double double_field_1 = 16; +} + +message IncompatiblePrimitives { + int32 int32_field_1 = 1; + uint32 uint32_field_1 = 2; + int64 int64_field_1 = 3; + uint64 uint64_field_1 = 4; + bool bool_field_1 = 5; + sint32 sint32_field_1 = 6; + sint64 sint64_field_1 = 7; + fixed32 fixed32_field_1 = 8; + sfixed32 sfixed32_field_1 = 9; + fixed64 fixed64_field_1 = 10; + sfixed64 sfixed64_field_1 = 11; + string string_field_1 = 12; + bytes bytes_field_1 = 14; + float float_field_1 = 15; + double double_field_1 = 16; +} + + +enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; +} + +message WithCompatibleEnums { + enum Baz { + BAZ_UNSPECIFIED = 0; + BAZ_ONE = 1; + } + Foo foo = 1; + Baz baz = 2; +} + +enum Bar { + BAR_UNSPECIFIED = 0; + BAR_ONE = 1; +} + +message WithIncompatibleEnums { + enum Bat { + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + } + enum Bam { + BAM_UNSPECIFIED = 0; + BAM_ONE = 1; + } + Bar bar = 1; + Bat bat = 2; + Bam bam = 3; +} + +message StringBytes { + string string_field_1 = 1; + bytes bytes_field_1 = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/buf.yaml new file mode 100644 index 000000000..2c12c4d93 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/buf.yaml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +build: + roots: + - root diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/a.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/sub/a/b/sub_a_b.proto new file mode 100644 index 000000000..33d684be2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/sub/a/b/sub_a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/buf.yaml new file mode 100644 index 000000000..2c12c4d93 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/buf.yaml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +build: + roots: + - root diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/a.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/c/c.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/c/c.proto new file mode 100644 index 000000000..6b49d48d1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/c/c.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package c; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/sub/a/b/sub_a_b.proto new file mode 100644 index 000000000..33d684be2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/sub/a/b/sub_a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/a.proto new file mode 100644 index 000000000..0217e3a56 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/b.proto new file mode 100644 index 000000000..0217e3a56 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/buf.yaml new file mode 100644 index 000000000..2c12c4d93 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/buf.yaml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +build: + roots: + - root diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/a.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/sub/a/b/sub_a_b.proto new file mode 100644 index 000000000..33d684be2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/sub/a/b/sub_a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/buf.yaml new file mode 100644 index 000000000..2c12c4d93 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/buf.yaml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +build: + roots: + - root diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/a.proto new file mode 100644 index 000000000..5c8aff5d4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/no_package.proto new file mode 100644 index 000000000..ad4c1fe28 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto new file mode 100644 index 000000000..33d684be2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/1.proto new file mode 100644 index 000000000..8ee38a6d6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/1.proto @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +option java_package = "foo"; +option java_outer_classname = "foo"; +option java_multiple_files = true; +option go_package = "foo"; +option objc_class_prefix = "foo"; +option csharp_namespace = "foo"; +option swift_prefix = "foo"; +option php_class_prefix = "foo"; +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; +option ruby_package = "foo"; + +option java_string_check_utf8 = true; +option optimize_for = CODE_SIZE; +option cc_generic_services = true; +option java_generic_services = true; +option py_generic_services = true; +option php_generic_services = true; +option cc_enable_arenas = true; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/2.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto new file mode 100644 index 000000000..0fb8fe775 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +message A {} + +enum AEnum { + A_ENUM_UNSPECIFIED = 0; +} + +service AService{} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/b.proto new file mode 100644 index 000000000..be609910a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/b.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +message B {} + +enum BEnum { + B_ENUM_UNSPECIFIED = 0; +} + +service BService{} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/1.proto new file mode 100644 index 000000000..bfd860826 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/1.proto @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/2.proto new file mode 100644 index 000000000..c99c0a137 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/2.proto @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/1.proto new file mode 100644 index 000000000..2343e8e47 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/1.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/2.proto new file mode 100644 index 000000000..d4fc4ec69 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto new file mode 100644 index 000000000..67d7e3d33 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto new file mode 100644 index 000000000..da378038c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/1.proto new file mode 100644 index 000000000..2a5a09c50 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/1.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/2.proto new file mode 100644 index 000000000..b536fac23 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/1.proto new file mode 100644 index 000000000..bfd860826 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/1.proto @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/2.proto new file mode 100644 index 000000000..c99c0a137 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/2.proto @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/1.proto new file mode 100644 index 000000000..2343e8e47 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/1.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/2.proto new file mode 100644 index 000000000..d4fc4ec69 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto new file mode 100644 index 000000000..67d7e3d33 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto new file mode 100644 index 000000000..da378038c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1beta1; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/1.proto new file mode 100644 index 000000000..2a5a09c50 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/1.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +enum One { + ONE_UNSPECIFIED = 0; +} + +enum Two { + TWO_UNSPECIFIED = 0; +} + +message Three { + message Four { + enum Five { + FIVE_UNSPECIFIED = 0; + } + enum Six { + SIX_UNSPECIFIED = 0; + } + } + enum Seven { + SEVEN_UNSPECIFIED = 0; + } + enum Eight { + EIGHT_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/2.proto new file mode 100644 index 000000000..b536fac23 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/2.proto @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +enum One2 { + ONE_2_UNSPECIFIED = 0; +} + +enum Two2 { + TWO_2_UNSPECIFIED = 0; +} + +message Three2 { + message Four2 { + enum Five2 { + FIVE_2_UNSPECIFIED = 0; + } + enum Six2 { + SIX_2_UNSPECIFIED = 0; + } + } + enum Seven2 { + SEVEN_2_UNSPECIFIED = 0; + } + enum Eight2 { + EIGHT_2_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/1.proto new file mode 100644 index 000000000..5ec04926e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/1.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo { + Bar foo = 1; +} +enum Bar { + Blah = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/2.proto new file mode 100644 index 000000000..9ee653d36 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/2.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo2 { + int32 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/1.proto new file mode 100644 index 000000000..883854ba8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/1.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo { + Foo foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/2.proto new file mode 100644 index 000000000..dc4eb14d2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/2.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo2 { + Bar2 foo = 1; +} +enum Bar2 { + Blah = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/1.proto new file mode 100644 index 000000000..17bca464a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/1.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo { + int32 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/2.proto new file mode 100644 index 000000000..719db3c2b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/2.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo2 { + Foo2 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/1.proto new file mode 100644 index 000000000..883854ba8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/1.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo { + Foo foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/2.proto new file mode 100644 index 000000000..14bd25ed9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/2.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Foo2 { + Foo22 foo = 1; +} +message Foo22 { + int32 foo = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/1.proto new file mode 100644 index 000000000..eadfc026d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/1.proto @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One {} + +message Two {} + +message Three { + message Four { + message Five {} + message Six {} + } + message Seven{} + message Eight{} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/2.proto new file mode 100644 index 000000000..7a05834a9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/2.proto @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 {} + +message Two2 {} + +message Three2 { + message Four2 { + message Five2 {} + message Six2 {} + } + message Seven2{} + message Eight2{} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/1.proto new file mode 100644 index 000000000..f0b8ebefd --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/1.proto @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + required string one = 1; +} + +message Three { + message Four { + message Five { + required string one = 1; + } + message Six { + required string one = 1; + } + } + message Seven { + required string one = 1; + } + message Eight {} + required string one = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/2.proto new file mode 100644 index 000000000..14eabea78 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/2.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One2 { + required string one = 1; +} + +message Two { + required string one = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/1.proto new file mode 100644 index 000000000..ad82ac119 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/1.proto @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + option message_set_wire_format = true; + option no_standard_descriptor_accessor = false; + extensions 4 to max; +} + +message Two { + option message_set_wire_format = true; + extensions 4 to max; +} + +message Three { + message Four { + message Five { + option message_set_wire_format = true; + option no_standard_descriptor_accessor = false; + extensions 4 to max; + } + message Six {} + } + message Seven { + option message_set_wire_format = true; + option no_standard_descriptor_accessor = false; + extensions 4 to max; + } + message Eight {} + option message_set_wire_format = true; + extensions 4 to max; +} + +message Nine { + option message_set_wire_format = true; + extensions 4 to max; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/2.proto new file mode 100644 index 000000000..454df8dd9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/2.proto @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One2 { + option message_set_wire_format = true; + extensions 4 to max; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/1.proto new file mode 100644 index 000000000..3fc1e3e0a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/1.proto @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Two { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Three { + message Four { + message Five { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Six { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + } + message Seven { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Eight { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Nine { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/2.proto new file mode 100644 index 000000000..1ee57d53f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/2.proto @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Two2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Three2 { + message Four2 { + message Five2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Six2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + } + message Seven2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Eight2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} + +message Nine2 { + oneof foo { + int32 one = 1; + int32 two = 2; + int32 three = 3; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/a1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/a1.proto new file mode 100644 index 000000000..6f685a2ce --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/a1.proto @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One {} + +message Two { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } +} + +message Three { + message Four { + message Five { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } + } + message Six {} + } + message Seven { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } + } + message Eight {} +} + +message Nine {} + +enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; +} + +enum EnumTwo { + ENUM_TWO_UNSPECIFIED = 0; +} + +service Foo {} +service Bar {} +service Baz {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/b1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/b1.proto new file mode 100644 index 000000000..d6bc11894 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/b1.proto @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +message One {} + +message Two { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } +} + +message Three { + message Four { + message Five { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } + } + message Six {} + } + message Seven { + enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; + } + } + message Eight {} +} + +message Nine {} + +enum EnumOne { + ENUM_ONE_UNSPECIFIED = 0; +} + +enum EnumTwo { + ENUM_TWO_UNSPECIFIED = 0; +} + +service Foo {} +service Bar {} +service Baz {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/buf.yaml new file mode 100644 index 000000000..73c7103dc --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/buf.yaml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - FILE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/c.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/c.proto new file mode 100644 index 000000000..6b49d48d1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/c.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package c; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/1.proto new file mode 100644 index 000000000..d7c722ec8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/1.proto @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +service AService { + rpc ARPC(ARequest) returns (AResponse); +} + +message ARequest { + string key = 1; +} + +message AResponse { +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/2.proto new file mode 100644 index 000000000..ce94d9aed --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/2.proto @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +service BService { + rpc BRPC(BRequest) returns (BResponse); +} + +message BRequest { + string key = 1; +} + +message BResponse { +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/buf.yaml new file mode 100644 index 000000000..19b6c3e07 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/buf.yaml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +breaking: + use: + - PACKAGE_SERVICE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/1.proto new file mode 100644 index 000000000..8402c5ae4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/1.proto @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + ONE_UNSPECIFIED = 0; + ONE_ONE = 1; + ONE_TWO = 2; +} + +enum Two { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + TWO_UNSPECIFIED = 0; + TWO_ONE = 1; + TWO_TWO = 2; +} + +message Three { + message Four { + enum Five { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + NINE_UNSPECIFIED = 0; + NINE_ONE = 1; + NINE_TWO = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/2.proto new file mode 100644 index 000000000..5696ded4a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/2.proto @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum One2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + ONE2_UNSPECIFIED = 0; + ONE2_ONE = 1; + ONE2_TWO = 2; +} + +enum Two2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + TWO2_UNSPECIFIED = 0; + TWO2_ONE = 1; + TWO2_TWO = 2; +} + +message Three2 { + message Four2 { + enum Five2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + FIVE_UNSPECIFIED = 0; + FIVE_ONE = 1; + FIVE_TWO = 2; + } + enum Six2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + SIX_UNSPECIFIED = 0; + SIX_ONE = 1; + SIX_TWO = 2; + } + } + enum Seven2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + SEVEN_UNSPECIFIED = 0; + SEVEN_ONE = 1; + SEVEN_TWO = 2; + } + enum Eight2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + EIGHT_UNSPECIFIED = 0; + EIGHT_ONE = 1; + EIGHT_TWO = 2; + } +} + +enum Nine2 { + reserved 3 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + NINE2_UNSPECIFIED = 0; + NINE2_ONE = 1; + NINE2_TWO = 2; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/1.proto new file mode 100644 index 000000000..bd230f670 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/1.proto @@ -0,0 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three { + message Four { + message Five { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/2.proto new file mode 100644 index 000000000..333cf83ca --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/2.proto @@ -0,0 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Two2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Three2 { + message Four2 { + message Five2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Six2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + } + message Seven2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + message Eight2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; + } + int32 one = 1; + int32 two = 2; + int32 three = 3; +} + +message Nine2 { + reserved 4 to 5, 100 to 200; + reserved 300, 301, 1000 to max; + reserved "foo", "bar"; + reserved "baz"; + int32 one = 1; + int32 two = 2; + int32 three = 3; +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/1.proto new file mode 100644 index 000000000..e60e1610a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/1.proto @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service One { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service Two { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service Three { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/2.proto new file mode 100644 index 000000000..27c04e5be --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/2.proto @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service One2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service Two2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +service Three2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/1.proto new file mode 100644 index 000000000..db2aad85b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/1.proto @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service One { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Two { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Three { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Four { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) { + option idempotency_level = IDEMPOTENCY_UNKNOWN; + } + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/2.proto new file mode 100644 index 000000000..fa1cbcc7f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/2.proto @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service One2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Two2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Three2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} + +service Four2 { + rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) { + option idempotency_level = IDEMPOTENCY_UNKNOWN; + } + rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) { + option idempotency_level = NO_SIDE_EFFECTS; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/1.proto new file mode 100644 index 000000000..349b2ed6a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/1.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +service One {} +service Two {} +service Three {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/2.proto new file mode 100644 index 000000000..42bd1d112 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/2.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +service One2 {} +service Two2 {} +service Three2 {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufcheck.go b/pkg/bufman/bufpkg/bufcheck/bufcheck.go new file mode 100644 index 000000000..2c8a8f07d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/bufcheck.go @@ -0,0 +1,108 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufcheck contains the implementations of the lint and breaking change detection rules. +// +// There is a lot of shared logic between the two, and originally they were actually combined into +// one logical entity (where some checks happened to be linters, and some checks happen to be +// breaking change detectors), so some of this is historical. +package bufcheck + +import ( + "encoding/json" + "fmt" + "io" + "strings" + "text/tabwriter" + + "go.uber.org/multierr" +) + +// AllRuleFormatStrings is all rule format strings. +var AllRuleFormatStrings = []string{ + "text", + "json", +} + +// Rule is a rule. +type Rule interface { + json.Marshaler + + // ID returns the ID of the Rule. + // + // UPPER_SNAKE_CASE. + ID() string + // Categories returns the categories of the Rule. + // + // UPPER_SNAKE_CASE. + // Sorted. + // May be empty. + Categories() []string + // Purpose returns the purpose of the Rule. + // + // Full sentence. + Purpose() string +} + +// PrintRules prints the rules to the writer. +// +// The empty string defaults to text. +func PrintRules(writer io.Writer, rules []Rule, formatString string) (retErr error) { + if len(rules) == 0 { + return nil + } + var asJSON bool + switch s := strings.ToLower(strings.TrimSpace(formatString)); s { + case "", "text": + asJSON = false + case "json": + asJSON = true + default: + return fmt.Errorf("unknown format: %q", s) + } + if !asJSON { + tabWriter := tabwriter.NewWriter(writer, 0, 0, 2, ' ', 0) + defer func() { + retErr = multierr.Append(retErr, tabWriter.Flush()) + }() + writer = tabWriter + if _, err := fmt.Fprintln(writer, "ID\tCATEGORIES\tPURPOSE"); err != nil { + return err + } + } + for _, rule := range rules { + if err := printRule(writer, rule, asJSON); err != nil { + return err + } + } + return nil +} + +func printRule(writer io.Writer, rule Rule, asJSON bool) error { + if asJSON { + data, err := json.Marshal(rule) + if err != nil { + return err + } + if _, err := fmt.Fprintln(writer, string(data)); err != nil { + return err + } + return nil + } + if _, err := fmt.Fprintf(writer, "%s\t%s\t%s\n", rule.ID(), strings.Join(rule.Categories(), ", "), rule.Purpose()); err != nil { + return err + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/buflint.go b/pkg/bufman/bufpkg/bufcheck/buflint/buflint.go new file mode 100644 index 000000000..5a10a19ea --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/buflint.go @@ -0,0 +1,150 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package buflint contains the linting functionality. +// +// The primary entry point to this package is the Handler. +package buflint + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "go.uber.org/zap" +) + +// AllFormatStrings are all format strings. +var AllFormatStrings = append( + bufanalysis.AllFormatStrings, + "config-ignore-yaml", +) + +// Handler handles the main lint functionality. +type Handler interface { + // Check runs the lint checks. + // + // The image should have source code info for this to work properly. + // + // Images should be filtered with regards to imports before passing to this function. + Check( + ctx context.Context, + config *buflintconfig.Config, + image bufimage.Image, + ) ([]bufanalysis.FileAnnotation, error) +} + +// NewHandler returns a new Handler. +func NewHandler(logger *zap.Logger) Handler { + return newHandler(logger) +} + +// RulesForConfig returns the rules for a given config. +// +// Should only be used for printing. +func RulesForConfig(config *buflintconfig.Config) ([]bufcheck.Rule, error) { + internalConfig, err := internalConfigForConfig(config) + if err != nil { + return nil, err + } + return rulesForInternalRules(internalConfig.Rules), nil +} + +// GetAllRulesV1Beta1 gets all known rules. +// +// Should only be used for printing. +func GetAllRulesV1Beta1() ([]bufcheck.Rule, error) { + internalConfig, err := internalConfigForConfig( + &buflintconfig.Config{ + Use: internal.AllIDsForVersionSpec(buflintv1beta1.VersionSpec), + Version: bufconfig.V1Beta1Version, + }, + ) + if err != nil { + return nil, err + } + return rulesForInternalRules(internalConfig.Rules), nil +} + +// GetAllRulesV1 gets all known rules. +// +// Should only be used for printing. +func GetAllRulesV1() ([]bufcheck.Rule, error) { + internalConfig, err := internalConfigForConfig( + &buflintconfig.Config{ + Use: internal.AllIDsForVersionSpec(buflintv1.VersionSpec), + Version: bufconfig.V1Version, + }, + ) + if err != nil { + return nil, err + } + return rulesForInternalRules(internalConfig.Rules), nil +} + +// GetAllRulesAndCategoriesV1Beta1 returns all rules and categories for v1beta1 as a string slice. +// +// This is used for validation purposes only. +func GetAllRulesAndCategoriesV1Beta1() []string { + return internal.AllCategoriesAndIDsForVersionSpec(buflintv1beta1.VersionSpec) +} + +// GetAllRulesAndCategoriesV1 returns all rules and categories for v1 as a string slice. +// +// This is used for validation purposes only. +func GetAllRulesAndCategoriesV1() []string { + return internal.AllCategoriesAndIDsForVersionSpec(buflintv1.VersionSpec) +} + +func internalConfigForConfig(config *buflintconfig.Config) (*internal.Config, error) { + var versionSpec *internal.VersionSpec + switch config.Version { + case bufconfig.V1Beta1Version: + versionSpec = buflintv1beta1.VersionSpec + case bufconfig.V1Version: + versionSpec = buflintv1.VersionSpec + } + return internal.ConfigBuilder{ + Use: config.Use, + Except: config.Except, + IgnoreRootPaths: config.IgnoreRootPaths, + IgnoreIDOrCategoryToRootPaths: config.IgnoreIDOrCategoryToRootPaths, + AllowCommentIgnores: config.AllowCommentIgnores, + EnumZeroValueSuffix: config.EnumZeroValueSuffix, + RPCAllowSameRequestResponse: config.RPCAllowSameRequestResponse, + RPCAllowGoogleProtobufEmptyRequests: config.RPCAllowGoogleProtobufEmptyRequests, + RPCAllowGoogleProtobufEmptyResponses: config.RPCAllowGoogleProtobufEmptyResponses, + ServiceSuffix: config.ServiceSuffix, + }.NewConfig( + versionSpec, + ) +} + +func rulesForInternalRules(rules []*internal.Rule) []bufcheck.Rule { + if rules == nil { + return nil + } + s := make([]bufcheck.Rule, len(rules)) + for i, e := range rules { + s[i] = e + } + return s +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/buflint_test.go b/pkg/bufman/bufpkg/bufcheck/buflint/buflint_test.go new file mode 100644 index 000000000..3262d5efd --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/buflint_test.go @@ -0,0 +1,1015 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflint_test + +import ( + "context" + "path/filepath" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +// Hint on how to get these: +// 1. cd into the specific directory +// 2. buf lint --error-format=json | jq '[.path, .start_line, .start_column, .end_line, .end_column, .type] | @csv' --raw-output +// or +// buf lint --error-format=json | jq -r '"bufanalysistesting.NewFileAnnotation(t, \"\(.path)\", \(.start_line|tostring), \(.start_column|tostring), \(.end_line|tostring), \(.end_column|tostring), \"\(.type)\"),"' + +func TestRunComments(t *testing.T) { + t.Parallel() + testLint( + t, + "comments", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 10, 2, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 3, 8, 28, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 3, 9, 20, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 1, 37, 2, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 3, 28, 4, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 14, 5, 17, 6, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 7, 15, 27, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 7, 16, 19, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 5, 23, 6, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 7, 19, 21, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 7, 22, 8, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 9, 21, 23, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 5, 24, 19, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 5, 27, 6, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 26, 7, 26, 21, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 32, 4, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 5, 30, 25, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 31, 5, 31, 17, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 33, 3, 33, 17, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 3, 36, 4, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 5, 35, 19, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 1, 41, 2, "COMMENT_SERVICE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 3, 40, 74, "COMMENT_RPC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 104, 1, 107, 2, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 105, 3, 105, 29, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 106, 3, 106, 21, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 109, 1, 134, 2, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 110, 3, 125, 4, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 111, 5, 114, 6, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 112, 7, 112, 27, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 113, 7, 113, 19, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 115, 5, 120, 6, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 116, 7, 116, 21, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 117, 7, 119, 8, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 118, 9, 118, 23, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 121, 5, 121, 19, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 122, 5, 124, 6, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 123, 7, 123, 21, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 126, 3, 129, 4, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 127, 5, 127, 25, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 128, 5, 128, 17, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 130, 3, 130, 17, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 131, 3, 133, 4, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 132, 5, 132, 19, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 136, 1, 139, 2, "COMMENT_SERVICE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 137, 3, 137, 74, "COMMENT_RPC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 138, 3, 138, 72, "COMMENT_RPC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 142, 1, 147, 2, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 144, 3, 144, 29, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 146, 3, 146, 21, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 150, 1, 192, 2, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 152, 3, 177, 4, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 154, 5, 159, 6, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 156, 7, 156, 27, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 158, 7, 158, 19, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 161, 5, 169, 6, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 163, 7, 163, 21, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 165, 7, 168, 8, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 167, 9, 167, 23, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 171, 5, 171, 19, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 173, 5, 176, 6, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 175, 7, 175, 21, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 179, 3, 184, 4, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 181, 5, 181, 25, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 183, 5, 183, 17, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 186, 3, 186, 17, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 188, 3, 191, 4, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 190, 5, 190, 19, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 195, 1, 200, 2, "COMMENT_SERVICE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 197, 3, 197, 74, "COMMENT_RPC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 199, 3, 199, 72, "COMMENT_RPC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 203, 1, 208, 2, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 205, 3, 205, 29, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 207, 3, 207, 21, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 211, 1, 253, 2, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 213, 3, 238, 4, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 215, 5, 220, 6, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 217, 7, 217, 27, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 219, 7, 219, 19, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 222, 5, 230, 6, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 224, 7, 224, 21, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 226, 7, 229, 8, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 228, 9, 228, 23, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 232, 5, 232, 19, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 234, 5, 237, 6, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 236, 7, 236, 21, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 240, 3, 245, 4, "COMMENT_ENUM"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 242, 5, 242, 25, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 244, 5, 244, 17, "COMMENT_ENUM_VALUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 247, 3, 247, 17, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 249, 3, 252, 4, "COMMENT_ONEOF"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 251, 5, 251, 19, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 256, 1, 261, 2, "COMMENT_SERVICE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 258, 3, 258, 74, "COMMENT_RPC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 260, 3, 260, 72, "COMMENT_RPC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 263, 1, 265, 2, "COMMENT_MESSAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 264, 3, 264, 30, "COMMENT_FIELD"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 273, 3, 273, 72, "COMMENT_RPC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 277, 3, 277, 72, "COMMENT_RPC"), + ) +} + +func TestRunDirectorySamePackage(t *testing.T) { + t.Parallel() + testLint( + t, + "directory_same_package", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 3, 1, 3, 11, "DIRECTORY_SAME_PACKAGE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "no_package.proto", "DIRECTORY_SAME_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "one/c.proto", 3, 1, 3, 11, "DIRECTORY_SAME_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "one/d.proto", 3, 1, 3, 11, "DIRECTORY_SAME_PACKAGE"), + ) +} + +func TestRunImportNoPublic(t *testing.T) { + t.Parallel() + testLint( + t, + "import_no_public", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 6, 1, 6, 32, "IMPORT_NO_PUBLIC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 7, 31, "IMPORT_NO_PUBLIC"), + bufanalysistesting.NewFileAnnotation(t, "one/one.proto", 6, 1, 6, 32, "IMPORT_NO_PUBLIC"), + ) +} + +func TestRunImportNoWeak(t *testing.T) { + t.Parallel() + testLint( + t, + "import_no_weak", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 6, 1, 6, 30, "IMPORT_NO_WEAK"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 7, 29, "IMPORT_NO_WEAK"), + bufanalysistesting.NewFileAnnotation(t, "one/one.proto", 6, 1, 6, 30, "IMPORT_NO_WEAK"), + ) +} + +func TestRunImportUsed(t *testing.T) { + t.Parallel() + testLint( + t, + "import_used", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 5, 1, 5, 25, "IMPORT_USED"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 7, 24, "IMPORT_USED"), + bufanalysistesting.NewFileAnnotation(t, "one/one.proto", 6, 1, 6, 25, "IMPORT_USED"), + ) +} + +func TestRunEnumFirstValueZero(t *testing.T) { + t.Parallel() + testLint( + t, + "enum_first_value_zero", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 13, 12, 14, "ENUM_FIRST_VALUE_ZERO"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 13, 18, 14, "ENUM_FIRST_VALUE_ZERO"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 38, 17, 38, 18, "ENUM_FIRST_VALUE_ZERO"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 17, 44, 18, "ENUM_FIRST_VALUE_ZERO"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 62, 15, 62, 16, "ENUM_FIRST_VALUE_ZERO"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 68, 15, 68, 16, "ENUM_FIRST_VALUE_ZERO"), + ) +} + +func TestRunEnumNoAllowAlias(t *testing.T) { + t.Parallel() + testLint( + t, + "enum_no_allow_alias", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 3, 12, 29, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 3, 19, 29, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 7, 41, 33, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 48, 7, 48, 33, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 68, 5, 68, 31, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 5, 75, 31, "ENUM_NO_ALLOW_ALIAS"), + ) +} + +func TestRunEnumPascalCase(t *testing.T) { + t.Parallel() + testLint( + t, + "enum_pascal_case", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 6, 16, 10, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 6, 19, 13, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 6, 22, 16, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 6, 25, 15, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 42, 10, 42, 14, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 45, 10, 45, 17, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 48, 10, 48, 20, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 51, 10, 51, 19, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 66, 8, 66, 12, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 69, 8, 69, 15, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 8, 72, 18, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 8, 75, 17, "ENUM_PASCAL_CASE"), + ) +} + +func TestRunEnumValuePrefix(t *testing.T) { + t.Parallel() + testLint( + t, + "enum_value_prefix", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 3, 10, 12, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 3, 11, 14, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 3, 12, 15, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 7, 22, 17, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 7, 23, 19, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 7, 24, 20, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 7, 25, 20, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 33, 5, 33, 15, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 5, 34, 17, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 5, 35, 18, "ENUM_VALUE_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 36, 5, 36, 18, "ENUM_VALUE_PREFIX"), + ) +} + +func TestRunEnumValueUpperSnakeCase(t *testing.T) { + t.Parallel() + testLint( + t, + "enum_value_upper_snake_case", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 3, 10, 12, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 3, 11, 17, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 3, 12, 14, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 7, 23, 16, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 7, 24, 21, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 7, 25, 18, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 5, 34, 14, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 5, 35, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 36, 5, 36, 16, "ENUM_VALUE_UPPER_SNAKE_CASE"), + ) +} + +func TestRunEnumZeroValueSuffix(t *testing.T) { + t.Parallel() + testLint( + t, + "enum_zero_value_suffix", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 14, 3, 14, 18, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 3, 18, 23, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 19, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 36, 7, 36, 22, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 7, 40, 27, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 7, 44, 23, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 56, 5, 56, 20, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 60, 5, 60, 25, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 5, 64, 21, "ENUM_ZERO_VALUE_SUFFIX"), + ) +} + +func TestRunEnumZeroValueSuffixCustom(t *testing.T) { + t.Parallel() + testLint( + t, + "enum_zero_value_suffix_custom", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 3, 18, 16, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 23, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 7, 40, 20, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 7, 44, 27, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 60, 5, 60, 18, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 5, 64, 25, "ENUM_ZERO_VALUE_SUFFIX"), + ) +} + +func TestRunFieldLowerSnakeCase(t *testing.T) { + t.Parallel() + testLint( + t, + "field_lower_snake_case", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 9, 8, 13, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 9, 9, 16, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 9, 10, 18, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 9, 11, 19, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 9, 12, 19, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 13, 20, 17, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 13, 21, 20, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 13, 22, 22, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 13, 23, 23, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 13, 24, 23, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 11, 28, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 11, 29, 18, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 11, 30, 20, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 31, 11, 31, 21, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 32, 11, 32, 21, "FIELD_LOWER_SNAKE_CASE"), + ) +} + +func TestRunFieldNoDescriptor(t *testing.T) { + t.Parallel() + testLint( + t, + "field_no_descriptor", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 6, 19, 6, 29, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 19, 7, 29, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 19, 8, 29, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 19, 9, 30, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 19, 10, 31, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 19, 11, 30, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 19, 12, 31, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 19, 13, 33, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 23, 19, 33, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 23, 20, 33, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 23, 21, 33, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 23, 22, 34, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 23, 23, 35, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 23, 24, 34, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 23, 25, 35, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 26, 23, 26, 37, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 21, 28, 31, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 21, 29, 31, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 21, 30, 31, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 31, 21, 31, 32, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 32, 21, 32, 33, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 33, 21, 33, 32, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 21, 34, 33, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 21, 35, 35, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 37, 19, 37, 29, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 38, 19, 38, 29, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 19, 39, 29, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 19, 40, 30, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 19, 41, 31, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 42, 19, 42, 30, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 43, 19, 43, 31, "FIELD_NO_DESCRIPTOR"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 19, 44, 33, "FIELD_NO_DESCRIPTOR"), + ) +} + +func TestRunFileLowerSnakeCase(t *testing.T) { + t.Parallel() + testLint( + t, + "file_lower_snake_case", + bufanalysistesting.NewFileAnnotationNoLocation(t, "B.proto", "FILE_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "Foo.proto", "FILE_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "aBc.proto", "FILE_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "ab_c_.proto", "FILE_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "fooBar.proto", "FILE_LOWER_SNAKE_CASE"), + ) +} + +func TestRunMessagePascalCase(t *testing.T) { + t.Parallel() + testLint( + t, + "message_pascal_case", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 11, 8, 15, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 11, 9, 18, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 13, 10, 23, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 14, 9, 14, 13, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 9, 15, 16, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 9, 16, 19, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 17, 9, 17, 18, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 11, 18, 15, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 11, 19, 18, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 13, 20, 23, "MESSAGE_PASCAL_CASE"), + ) +} + +func TestRunOneofLowerSnakeCase(t *testing.T) { + t.Parallel() + testLint( + t, + "oneof_lower_snake_case", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 9, 12, 13, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 9, 15, 16, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 9, 18, 18, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 9, 21, 19, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 9, 24, 19, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 38, 13, 38, 17, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 13, 41, 20, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 13, 44, 22, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 47, 13, 47, 23, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 50, 13, 50, 23, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 60, 11, 60, 15, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 63, 11, 63, 18, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 66, 11, 66, 20, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 69, 11, 69, 21, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 11, 72, 21, "ONEOF_LOWER_SNAKE_CASE"), + ) +} + +func TestRunPackageDefined(t *testing.T) { + t.Parallel() + testLint( + t, + "package_defined", + bufanalysistesting.NewFileAnnotationNoLocation(t, "a/no_package.proto", "PACKAGE_DEFINED"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "no_package.proto", "PACKAGE_DEFINED"), + ) +} + +func TestRunPackageDirectoryMatch(t *testing.T) { + t.Parallel() + testLint( + t, + "package_directory_match", + bufanalysistesting.NewFileAnnotation(t, "a/b/a_c.proto", 3, 1, 3, 13, "PACKAGE_DIRECTORY_MATCH"), + bufanalysistesting.NewFileAnnotation(t, "sub/a/b/a_b.proto", 3, 1, 3, 13, "PACKAGE_DIRECTORY_MATCH"), + ) +} + +func TestRunPackageLowerSnakeCase(t *testing.T) { + t.Parallel() + testLint( + t, + "package_lower_snake_case", + bufanalysistesting.NewFileAnnotation(t, "5.proto", 3, 1, 3, 19, "PACKAGE_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "6.proto", 3, 1, 3, 19, "PACKAGE_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "7.proto", 3, 1, 3, 18, "PACKAGE_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "8.proto", 3, 1, 3, 20, "PACKAGE_LOWER_SNAKE_CASE"), + ) +} + +func TestRunPackageNoImportCycle(t *testing.T) { + t.Parallel() + testLint( + t, + "package_no_import_cycle", + bufanalysistesting.NewFileAnnotation(t, "b1.proto", 5, 1, 5, 19, "PACKAGE_NO_IMPORT_CYCLE"), + bufanalysistesting.NewFileAnnotation(t, "c1.proto", 5, 1, 5, 19, "PACKAGE_NO_IMPORT_CYCLE"), + bufanalysistesting.NewFileAnnotation(t, "d1.proto", 5, 1, 5, 19, "PACKAGE_NO_IMPORT_CYCLE"), + ) +} + +func TestRunPackageSameDirectory(t *testing.T) { + t.Parallel() + testLint( + t, + "package_same_directory", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 3, 1, 3, 11, "PACKAGE_SAME_DIRECTORY"), + bufanalysistesting.NewFileAnnotation(t, "one/a.proto", 3, 1, 3, 11, "PACKAGE_SAME_DIRECTORY"), + ) +} + +func TestRunPackageSameDirectoryNoPackage(t *testing.T) { + t.Parallel() + testLint( + t, + "package_same_directory_no_package", + bufanalysistesting.NewFileAnnotationNoLocation(t, "no_package.proto", "PACKAGE_SAME_DIRECTORY"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "one/no_package.proto", "PACKAGE_SAME_DIRECTORY"), + ) +} + +func TestRunPackageSameOptionValue(t *testing.T) { + t.Parallel() + testLint( + t, + "package_same_option_value", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 5, 1, 5, 33, "PACKAGE_SAME_CSHARP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 6, 1, 6, 35, "PACKAGE_SAME_JAVA_MULTIPLE_FILES"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 7, 29, "PACKAGE_SAME_JAVA_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 1, 8, 27, "PACKAGE_SAME_GO_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 1, 9, 30, "PACKAGE_SAME_PHP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 1, 10, 29, "PACKAGE_SAME_RUBY_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 1, 11, 29, "PACKAGE_SAME_SWIFT_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 5, 1, 5, 33, "PACKAGE_SAME_CSHARP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 6, 1, 6, 36, "PACKAGE_SAME_JAVA_MULTIPLE_FILES"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 7, 1, 7, 29, "PACKAGE_SAME_JAVA_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 1, 8, 27, "PACKAGE_SAME_GO_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 9, 1, 9, 30, "PACKAGE_SAME_PHP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 10, 1, 10, 29, "PACKAGE_SAME_RUBY_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 11, 1, 11, 29, "PACKAGE_SAME_SWIFT_PREFIX"), + bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 6, 1, 6, 33, "PACKAGE_SAME_CSHARP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 7, 1, 7, 35, "PACKAGE_SAME_JAVA_MULTIPLE_FILES"), + bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 8, 1, 8, 29, "PACKAGE_SAME_JAVA_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 9, 1, 9, 27, "PACKAGE_SAME_GO_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 10, 1, 10, 30, "PACKAGE_SAME_PHP_NAMESPACE"), + bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 11, 1, 11, 29, "PACKAGE_SAME_RUBY_PACKAGE"), + bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 12, 1, 12, 29, "PACKAGE_SAME_SWIFT_PREFIX"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_CSHARP_NAMESPACE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_GO_PACKAGE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_JAVA_MULTIPLE_FILES"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_JAVA_PACKAGE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_PHP_NAMESPACE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_RUBY_PACKAGE"), + bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_SWIFT_PREFIX"), + ) +} + +func TestRunPackageVersionSuffix(t *testing.T) { + t.Parallel() + testLint( + t, + "package_version_suffix", + bufanalysistesting.NewFileAnnotation(t, "foo.proto", 3, 1, 3, 13, "PACKAGE_VERSION_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "foo_bar.proto", 3, 1, 3, 17, "PACKAGE_VERSION_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "foo_bar_v0beta1.proto", 3, 1, 3, 25, "PACKAGE_VERSION_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "foo_bar_v1test_foo.proto", 3, 1, 3, 28, "PACKAGE_VERSION_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "foo_bar_v2beta0.proto", 3, 1, 3, 25, "PACKAGE_VERSION_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "foo_bar_vv1beta1.proto", 3, 1, 3, 26, "PACKAGE_VERSION_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "v1.proto", 3, 1, 3, 12, "PACKAGE_VERSION_SUFFIX"), + ) +} + +func TestRunRPCNoStreaming(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_no_streaming", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 3, 9, 88, "RPC_NO_CLIENT_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 3, 10, 89, "RPC_NO_SERVER_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 3, 11, 92, "RPC_NO_CLIENT_STREAMING"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 3, 11, 92, "RPC_NO_SERVER_STREAMING"), + ) +} + +func TestRunRPCPascalCase(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_pascal_case", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 7, 11, 11, "RPC_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 7, 12, 14, "RPC_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 7, 13, 17, "RPC_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 14, 7, 14, 16, "RPC_PASCAL_CASE"), + ) +} + +func TestRunRPCRequestResponseUnique(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_request_response_unique", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 27, 3, 27, 52, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 3, 28, 55, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 3, 30, 38, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + ) +} + +func TestRunRPCRequestResponseUniqueAllowEmptyRequests(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_request_response_unique_allow_empty_requests", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 3, 28, 55, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 3, 30, 38, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + ) +} + +func TestRunRPCRequestResponseUniqueAllowEmptyResponses(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_request_response_unique_allow_empty_responses", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 27, 3, 27, 52, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 3, 30, 38, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + ) +} + +func TestRunRPCRequestResponseUniqueAllowEmptyRequestsAndResponses(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_request_response_unique_allow_empty_requests_and_responses", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 3, 30, 38, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + ) +} + +func TestRunRPCRequestResponseUniqueAllowSame(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_request_response_unique_allow_same", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 27, 3, 27, 52, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 3, 28, 55, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + ) +} + +func TestRunRPCRequestResponseUniqueAllowSameAndEmptyRequestResponses(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_request_response_unique_allow_same_and_empty_request_responses", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), + ) +} + +func TestRunRPCStandardName(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_standard_name", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 19, 10, 22, "RPC_REQUEST_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 50, 11, 53, "RPC_RESPONSE_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 27, 12, 48, "RPC_REQUEST_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 66, 13, 87, "RPC_RESPONSE_STANDARD_NAME"), + ) +} + +func TestRunRPCStandardNameAllowEmpty(t *testing.T) { + t.Parallel() + testLint( + t, + "rpc_standard_name_allow_empty", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 19, 10, 22, "RPC_REQUEST_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 50, 11, 53, "RPC_RESPONSE_STANDARD_NAME"), + ) +} + +func TestRunServicePascalCase(t *testing.T) { + t.Parallel() + testLint( + t, + "service_pascal_case", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 9, 8, 13, "SERVICE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 9, 9, 16, "SERVICE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 9, 10, 19, "SERVICE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 9, 11, 18, "SERVICE_PASCAL_CASE"), + ) +} + +func TestRunServiceSuffix(t *testing.T) { + t.Parallel() + testLint( + t, + "service_suffix", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 9, 8, 13, "SERVICE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 9, 9, 16, "SERVICE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 9, 10, 21, "SERVICE_SUFFIX"), + ) +} + +func TestRunServiceSuffixCustom(t *testing.T) { + t.Parallel() + testLint( + t, + "service_suffix_custom", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 9, 8, 13, "SERVICE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 9, 9, 20, "SERVICE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 9, 10, 17, "SERVICE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 9, 11, 17, "SERVICE_SUFFIX"), + ) +} + +func TestRunSyntaxSpecified(t *testing.T) { + t.Parallel() + testLint( + t, + "syntax_specified", + bufanalysistesting.NewFileAnnotationNoLocation(t, "a/a.proto", "SYNTAX_SPECIFIED"), + ) +} + +func TestRunIgnores1(t *testing.T) { + t.Parallel() + testLint( + t, + "ignores1", + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 9, 9, 9, 13, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 13, 6, 13, 10, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/bar/bar.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/bar/bar.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + ) +} + +func TestRunIgnores2(t *testing.T) { + t.Parallel() + testLint( + t, + "ignores2", + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + ) +} + +func TestRunIgnores3(t *testing.T) { + t.Parallel() + testLint( + t, + "ignores3", + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 9, 9, 9, 13, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 13, 6, 13, 10, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + ) +} + +func TestRunIgnores4(t *testing.T) { + t.Parallel() + testLint( + t, + "ignores4", + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 9, 9, 9, 13, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 13, 6, 13, 10, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), + ) +} + +func TestCommentIgnoresOff(t *testing.T) { + t.Parallel() + testLint( + t, + "comment_ignores", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 1, 9, 11, "PACKAGE_DIRECTORY_MATCH"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 1, 9, 11, "PACKAGE_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 1, 9, 11, "PACKAGE_VERSION_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 1, 12, 45, "IMPORT_NO_PUBLIC"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 6, 15, 13, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 17, 3, 17, 29, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 3, 20, 14, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 3, 20, 14, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 13, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 13, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 9, 28, 19, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 11, 30, 21, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 32, 13, 32, 23, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 12, 34, 19, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 36, 9, 36, 35, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 9, 39, 20, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 9, 39, 20, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 9, 41, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 43, 9, 43, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 46, 13, 46, 16, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 48, 13, 48, 16, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 50, 15, 50, 18, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 54, 11, 54, 14, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 56, 11, 56, 14, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 58, 13, 58, 16, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 62, 9, 62, 12, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 9, 64, 12, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 66, 11, 66, 14, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 71, 9, 71, 19, "SERVICE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 7, 75, 16, "RPC_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 17, 75, 38, "RPC_REQUEST_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 49, 75, 70, "RPC_RESPONSE_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 5, 1, 5, 11, "PACKAGE_DIRECTORY_MATCH"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 5, 1, 5, 11, "PACKAGE_VERSION_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 9, 26, 9, 28, "ENUM_FIRST_VALUE_ZERO"), + ) +} + +func TestCommentIgnoresOn(t *testing.T) { + t.Parallel() + testLintConfigModifier( + t, + "comment_ignores", + func(config *bufconfig.Config) { + config.Lint.AllowCommentIgnores = true + }, + ) +} + +func TestCommentIgnoresCascadeOff(t *testing.T) { + t.Parallel() + testLint( + t, + "comment_ignores_cascade", + bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 6, 13, 13, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 3, 15, 29, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 3, 16, 14, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 3, 16, 14, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 17, 3, 17, 13, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 3, 18, 13, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 9, 24, 19, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 11, 28, 21, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 32, 13, 32, 23, "MESSAGE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 12, 35, 19, "ENUM_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 37, 9, 37, 35, "ENUM_NO_ALLOW_ALIAS"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 9, 39, 20, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 9, 39, 20, "ENUM_ZERO_VALUE_SUFFIX"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 9, 40, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 9, 41, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 43, 13, 43, 16, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 13, 44, 16, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 45, 15, 45, 18, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 48, 11, 48, 14, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 49, 11, 49, 14, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 50, 13, 50, 16, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 53, 9, 53, 12, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 54, 9, 54, 12, "ONEOF_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 55, 11, 55, 14, "FIELD_LOWER_SNAKE_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 63, 9, 63, 19, "SERVICE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 7, 64, 16, "RPC_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 17, 64, 38, "RPC_REQUEST_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 49, 64, 70, "RPC_RESPONSE_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 68, 9, 68, 19, "SERVICE_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 7, 72, 16, "RPC_PASCAL_CASE"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 17, 72, 38, "RPC_REQUEST_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 49, 72, 70, "RPC_RESPONSE_STANDARD_NAME"), + bufanalysistesting.NewFileAnnotation(t, "b.proto", 9, 26, 9, 28, "ENUM_FIRST_VALUE_ZERO"), + ) +} + +func TestCommentIgnoresCascadeOn(t *testing.T) { + t.Parallel() + testLintConfigModifier( + t, + "comment_ignores_cascade", + func(config *bufconfig.Config) { + config.Lint.AllowCommentIgnores = true + }, + ) +} + +func testLint( + t *testing.T, + relDirPath string, + expectedFileAnnotations ...bufanalysis.FileAnnotation, +) { + testLintConfigModifier( + t, + relDirPath, + nil, + expectedFileAnnotations..., + ) +} + +func testLintConfigModifier( + t *testing.T, + relDirPath string, + configModifier func(*bufconfig.Config), + expectedFileAnnotations ...bufanalysis.FileAnnotation, +) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + logger := zap.NewNop() + + dirPath := filepath.Join("testdata", relDirPath) + + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + dirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + + config := testGetConfig(t, readWriteBucket) + if configModifier != nil { + configModifier(config) + } + + module, err := bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config.Build, + ) + require.NoError(t, err) + image, fileAnnotations, err := bufimagebuild.NewBuilder( + zap.NewNop(), + bufmodule.NewNopModuleReader(), + ).Build( + ctx, + module, + ) + require.NoError(t, err) + require.Empty(t, fileAnnotations) + image = bufimage.ImageWithoutImports(image) + + handler := buflint.NewHandler(logger) + fileAnnotations, err = handler.Check( + ctx, + config.Lint, + image, + ) + assert.NoError(t, err) + bufanalysistesting.AssertFileAnnotationsEqual( + t, + expectedFileAnnotations, + fileAnnotations, + ) +} + +func testGetConfig( + t *testing.T, + readBucket storage.ReadBucket, +) *bufconfig.Config { + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + config, err := bufconfig.GetConfigForBucket(ctx, readBucket) + require.NoError(t, err) + return config +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig/buflintconfig.go b/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig/buflintconfig.go new file mode 100644 index 000000000..d2d9afdd5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig/buflintconfig.go @@ -0,0 +1,361 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflintconfig + +import ( + "bytes" + "encoding/json" + "io" + "sort" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + lintv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/lint/v1" +) + +const ( + // These versions match the versions in bufconfig. We cannot take an explicit dependency + // on bufconfig without creating a circular dependency. + v1Beta1Version = "v1beta1" + v1Version = "v1" +) + +// Config is the lint check config. +type Config struct { + // Use is a list of rule and/or category IDs that are included in the lint check. + Use []string + // Except is a list of the rule and/or category IDs that are excluded from the lint check. + Except []string + // IgnoreRootPaths is a list of paths of directories and/or files that should be ignored by the lint check. + // All paths are relative to the root of the module. + IgnoreRootPaths []string + // IgnoreIDOrCategoryToRootPaths is a map of rule and/or category IDs to directory and/or file paths to exclude from the + // lint check. + IgnoreIDOrCategoryToRootPaths map[string][]string + // EnumZeroValueSuffix controls the behavior of the ENUM_ZERO_VALUE lint rule ID. By default, this rule + // verifies that the zero value of all enums ends in _UNSPECIFIED. This config allows the user to override + // this value with the given string. + EnumZeroValueSuffix string + // RPCAllowSameRequestResponse allows the same message type for both the request and response of an RPC. + RPCAllowSameRequestResponse bool + // RPCAllowGoogleProtobufEmptyRequests allows the RPC requests to use the google.protobuf.Empty message. + RPCAllowGoogleProtobufEmptyRequests bool + // RPCAllowGoogleProtobufEmptyResponse allows the RPC responses to use the google.protobuf.Empty message. + RPCAllowGoogleProtobufEmptyResponses bool + // ServiceSuffix applies to the SERVICE_SUFFIX rule ID. By default, the rule verifies that all service names + // end with the suffix Service. This allows users to override the value with the given string. + ServiceSuffix string + // AllowCommentIgnores turns on comment-driven ignores. + AllowCommentIgnores bool + // Version represents the version of the lint rule and category IDs that should be used with this config. + Version string +} + +// NewConfigV1Beta1 returns a new Config. +func NewConfigV1Beta1(externalConfig ExternalConfigV1Beta1) *Config { + return &Config{ + Use: externalConfig.Use, + Except: externalConfig.Except, + IgnoreRootPaths: externalConfig.Ignore, + IgnoreIDOrCategoryToRootPaths: externalConfig.IgnoreOnly, + EnumZeroValueSuffix: externalConfig.EnumZeroValueSuffix, + RPCAllowSameRequestResponse: externalConfig.RPCAllowSameRequestResponse, + RPCAllowGoogleProtobufEmptyRequests: externalConfig.RPCAllowGoogleProtobufEmptyRequests, + RPCAllowGoogleProtobufEmptyResponses: externalConfig.RPCAllowGoogleProtobufEmptyResponses, + ServiceSuffix: externalConfig.ServiceSuffix, + AllowCommentIgnores: externalConfig.AllowCommentIgnores, + Version: v1Beta1Version, + } +} + +// NewConfigV1 returns a new Config. +func NewConfigV1(externalConfig ExternalConfigV1) *Config { + return &Config{ + Use: externalConfig.Use, + Except: externalConfig.Except, + IgnoreRootPaths: externalConfig.Ignore, + IgnoreIDOrCategoryToRootPaths: externalConfig.IgnoreOnly, + EnumZeroValueSuffix: externalConfig.EnumZeroValueSuffix, + RPCAllowSameRequestResponse: externalConfig.RPCAllowSameRequestResponse, + RPCAllowGoogleProtobufEmptyRequests: externalConfig.RPCAllowGoogleProtobufEmptyRequests, + RPCAllowGoogleProtobufEmptyResponses: externalConfig.RPCAllowGoogleProtobufEmptyResponses, + ServiceSuffix: externalConfig.ServiceSuffix, + AllowCommentIgnores: externalConfig.AllowCommentIgnores, + Version: v1Version, + } +} + +// ConfigForProto returns the Config given the proto. +func ConfigForProto(protoConfig *lintv1.Config) *Config { + return &Config{ + Use: protoConfig.GetUseIds(), + Except: protoConfig.GetExceptIds(), + IgnoreRootPaths: protoConfig.GetIgnorePaths(), + IgnoreIDOrCategoryToRootPaths: ignoreIDOrCategoryToRootPathsForProto(protoConfig.GetIgnoreIdPaths()), + EnumZeroValueSuffix: protoConfig.GetEnumZeroValueSuffix(), + RPCAllowSameRequestResponse: protoConfig.GetRpcAllowSameRequestResponse(), + RPCAllowGoogleProtobufEmptyRequests: protoConfig.GetRpcAllowGoogleProtobufEmptyRequests(), + RPCAllowGoogleProtobufEmptyResponses: protoConfig.GetRpcAllowGoogleProtobufEmptyResponses(), + ServiceSuffix: protoConfig.GetServiceSuffix(), + AllowCommentIgnores: protoConfig.GetAllowCommentIgnores(), + Version: protoConfig.GetVersion(), + } +} + +// ProtoForConfig takes a *Config and returns the proto representation. +func ProtoForConfig(config *Config) *lintv1.Config { + return &lintv1.Config{ + UseIds: config.Use, + ExceptIds: config.Except, + IgnorePaths: config.IgnoreRootPaths, + IgnoreIdPaths: protoForIgnoreIDOrCategoryToRootPaths(config.IgnoreIDOrCategoryToRootPaths), + EnumZeroValueSuffix: config.EnumZeroValueSuffix, + RpcAllowSameRequestResponse: config.RPCAllowSameRequestResponse, + RpcAllowGoogleProtobufEmptyRequests: config.RPCAllowGoogleProtobufEmptyRequests, + RpcAllowGoogleProtobufEmptyResponses: config.RPCAllowGoogleProtobufEmptyResponses, + ServiceSuffix: config.ServiceSuffix, + AllowCommentIgnores: config.AllowCommentIgnores, + Version: config.Version, + } +} + +// ExternalConfigV1Beta1 is an external config. +type ExternalConfigV1Beta1 struct { + Use []string `json:"use,omitempty" yaml:"use,omitempty"` + Except []string `json:"except,omitempty" yaml:"except,omitempty"` + // IgnoreRootPaths + Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"` + // IgnoreIDOrCategoryToRootPaths + IgnoreOnly map[string][]string `json:"ignore_only,omitempty" yaml:"ignore_only,omitempty"` + EnumZeroValueSuffix string `json:"enum_zero_value_suffix,omitempty" yaml:"enum_zero_value_suffix,omitempty"` + RPCAllowSameRequestResponse bool `json:"rpc_allow_same_request_response,omitempty" yaml:"rpc_allow_same_request_response,omitempty"` + RPCAllowGoogleProtobufEmptyRequests bool `json:"rpc_allow_google_protobuf_empty_requests,omitempty" yaml:"rpc_allow_google_protobuf_empty_requests,omitempty"` + RPCAllowGoogleProtobufEmptyResponses bool `json:"rpc_allow_google_protobuf_empty_responses,omitempty" yaml:"rpc_allow_google_protobuf_empty_responses,omitempty"` + ServiceSuffix string `json:"service_suffix,omitempty" yaml:"service_suffix,omitempty"` + AllowCommentIgnores bool `json:"allow_comment_ignores,omitempty" yaml:"allow_comment_ignores,omitempty"` +} + +// ExternalConfigV1 is an external config. +type ExternalConfigV1 struct { + Use []string `json:"use,omitempty" yaml:"use,omitempty"` + Except []string `json:"except,omitempty" yaml:"except,omitempty"` + // IgnoreRootPaths + Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"` + // IgnoreIDOrCategoryToRootPaths + IgnoreOnly map[string][]string `json:"ignore_only,omitempty" yaml:"ignore_only,omitempty"` + EnumZeroValueSuffix string `json:"enum_zero_value_suffix,omitempty" yaml:"enum_zero_value_suffix,omitempty"` + RPCAllowSameRequestResponse bool `json:"rpc_allow_same_request_response,omitempty" yaml:"rpc_allow_same_request_response,omitempty"` + RPCAllowGoogleProtobufEmptyRequests bool `json:"rpc_allow_google_protobuf_empty_requests,omitempty" yaml:"rpc_allow_google_protobuf_empty_requests,omitempty"` + RPCAllowGoogleProtobufEmptyResponses bool `json:"rpc_allow_google_protobuf_empty_responses,omitempty" yaml:"rpc_allow_google_protobuf_empty_responses,omitempty"` + ServiceSuffix string `json:"service_suffix,omitempty" yaml:"service_suffix,omitempty"` + AllowCommentIgnores bool `json:"allow_comment_ignores,omitempty" yaml:"allow_comment_ignores,omitempty"` +} + +// ExternalConfigV1Beta1ForConfig takes a *Config and returns the v1beta1 externalconfig representation. +func ExternalConfigV1Beta1ForConfig(config *Config) ExternalConfigV1Beta1 { + return ExternalConfigV1Beta1{ + Use: config.Use, + Except: config.Except, + Ignore: config.IgnoreRootPaths, + IgnoreOnly: config.IgnoreIDOrCategoryToRootPaths, + EnumZeroValueSuffix: config.EnumZeroValueSuffix, + RPCAllowSameRequestResponse: config.RPCAllowSameRequestResponse, + RPCAllowGoogleProtobufEmptyRequests: config.RPCAllowGoogleProtobufEmptyRequests, + RPCAllowGoogleProtobufEmptyResponses: config.RPCAllowGoogleProtobufEmptyResponses, + ServiceSuffix: config.ServiceSuffix, + AllowCommentIgnores: config.AllowCommentIgnores, + } +} + +// ExternalConfigV1ForConfig takes a *Config and returns the v1 externalconfig representation. +func ExternalConfigV1ForConfig(config *Config) ExternalConfigV1 { + return ExternalConfigV1{ + Use: config.Use, + Except: config.Except, + Ignore: config.IgnoreRootPaths, + IgnoreOnly: config.IgnoreIDOrCategoryToRootPaths, + EnumZeroValueSuffix: config.EnumZeroValueSuffix, + RPCAllowSameRequestResponse: config.RPCAllowSameRequestResponse, + RPCAllowGoogleProtobufEmptyRequests: config.RPCAllowGoogleProtobufEmptyRequests, + RPCAllowGoogleProtobufEmptyResponses: config.RPCAllowGoogleProtobufEmptyResponses, + ServiceSuffix: config.ServiceSuffix, + AllowCommentIgnores: config.AllowCommentIgnores, + } +} + +// BytesForConfig takes a *Config and returns the deterministic []byte representation. +// We use an unexported intermediary JSON form and sort all fields to ensure that the bytes +// associated with the *Config are deterministic. +func BytesForConfig(config *Config) ([]byte, error) { + if config == nil { + return nil, nil + } + return json.Marshal(configToJSON(config)) +} + +type configJSON struct { + Use []string `json:"use,omitempty"` + Except []string `json:"except,omitempty"` + IgnoreRootPaths []string `json:"ignore_root_paths,omitempty"` + IgnoreIDOrCategoryToRootPaths []idPathsJSON `json:"ignore_id_to_root_paths,omitempty"` + EnumZeroValueSuffix string `json:"enum_zero_value_suffix,omitempty"` + RPCAllowSameRequestResponse bool `json:"rpc_allow_same_request_response,omitempty"` + RPCAllowGoogleProtobufEmptyRequests bool `json:"rpc_allow_google_protobuf_empty_requests,omitempty"` + RPCAllowGoogleProtobufEmptyResponses bool `json:"rpc_allow_google_protobuf_empty_response,omitempty"` + ServiceSuffix string `json:"service_suffix,omitempty"` + AllowCommentIgnores bool `json:"allow_comment_ignores,omitempty"` + Version string `json:"version,omitempty"` +} + +type idPathsJSON struct { + ID string `json:"id,omitempty"` + Paths []string `json:"paths,omitempty"` +} + +func configToJSON(config *Config) *configJSON { + ignoreIDPathsJSON := make([]idPathsJSON, 0, len(config.IgnoreIDOrCategoryToRootPaths)) + for ignoreID, rootPaths := range config.IgnoreIDOrCategoryToRootPaths { + rootPathsCopy := make([]string, len(rootPaths)) + copy(rootPathsCopy, rootPaths) + sort.Strings(rootPathsCopy) + ignoreIDPathsJSON = append(ignoreIDPathsJSON, idPathsJSON{ + ID: ignoreID, + Paths: rootPathsCopy, + }) + } + sort.Slice(ignoreIDPathsJSON, func(i, j int) bool { return ignoreIDPathsJSON[i].ID < ignoreIDPathsJSON[j].ID }) + // We should not be sorting in place for the config structure, since it will mutate the + // underlying config ordering. + use := make([]string, len(config.Use)) + copy(use, config.Use) + except := make([]string, len(config.Except)) + copy(except, config.Except) + ignoreRootPaths := make([]string, len(config.IgnoreRootPaths)) + copy(ignoreRootPaths, config.IgnoreRootPaths) + sort.Strings(use) + sort.Strings(except) + sort.Strings(ignoreRootPaths) + return &configJSON{ + Use: use, + Except: except, + IgnoreRootPaths: ignoreRootPaths, + IgnoreIDOrCategoryToRootPaths: ignoreIDPathsJSON, + EnumZeroValueSuffix: config.EnumZeroValueSuffix, + RPCAllowSameRequestResponse: config.RPCAllowSameRequestResponse, + RPCAllowGoogleProtobufEmptyRequests: config.RPCAllowGoogleProtobufEmptyRequests, + RPCAllowGoogleProtobufEmptyResponses: config.RPCAllowGoogleProtobufEmptyResponses, + ServiceSuffix: config.ServiceSuffix, + AllowCommentIgnores: config.AllowCommentIgnores, + Version: config.Version, + } +} + +// PrintFileAnnotations prints the FileAnnotations to the Writer. +// +// Also accepts config-ignore-yaml. +func PrintFileAnnotations( + writer io.Writer, + fileAnnotations []bufanalysis.FileAnnotation, + formatString string, +) error { + switch s := strings.ToLower(strings.TrimSpace(formatString)); s { + case "config-ignore-yaml": + return printFileAnnotationsConfigIgnoreYAML(writer, fileAnnotations) + default: + return bufanalysis.PrintFileAnnotations(writer, fileAnnotations, s) + } +} + +func printFileAnnotationsConfigIgnoreYAML( + writer io.Writer, + fileAnnotations []bufanalysis.FileAnnotation, +) error { + if len(fileAnnotations) == 0 { + return nil + } + ignoreIDToRootPathMap := make(map[string]map[string]struct{}) + for _, fileAnnotation := range fileAnnotations { + fileInfo := fileAnnotation.FileInfo() + if fileInfo == nil || fileAnnotation.Type() == "" { + continue + } + rootPathMap, ok := ignoreIDToRootPathMap[fileAnnotation.Type()] + if !ok { + rootPathMap = make(map[string]struct{}) + ignoreIDToRootPathMap[fileAnnotation.Type()] = rootPathMap + } + rootPathMap[fileInfo.Path()] = struct{}{} + } + if len(ignoreIDToRootPathMap) == 0 { + return nil + } + + sortedIgnoreIDs := make([]string, 0, len(ignoreIDToRootPathMap)) + ignoreIDToSortedRootPaths := make(map[string][]string, len(ignoreIDToRootPathMap)) + for id, rootPathMap := range ignoreIDToRootPathMap { + sortedIgnoreIDs = append(sortedIgnoreIDs, id) + rootPaths := make([]string, 0, len(rootPathMap)) + for rootPath := range rootPathMap { + rootPaths = append(rootPaths, rootPath) + } + sort.Strings(rootPaths) + ignoreIDToSortedRootPaths[id] = rootPaths + } + sort.Strings(sortedIgnoreIDs) + + buffer := bytes.NewBuffer(nil) + _, _ = buffer.WriteString(`version: v1 +lint: + ignore_only: +`) + for _, id := range sortedIgnoreIDs { + _, _ = buffer.WriteString(" ") + _, _ = buffer.WriteString(id) + _, _ = buffer.WriteString(":\n") + for _, rootPath := range ignoreIDToSortedRootPaths[id] { + _, _ = buffer.WriteString(" - ") + _, _ = buffer.WriteString(rootPath) + _, _ = buffer.WriteString("\n") + } + } + _, err := writer.Write(buffer.Bytes()) + return err +} + +func ignoreIDOrCategoryToRootPathsForProto(protoIgnoreIDPaths []*lintv1.IDPaths) map[string][]string { + if protoIgnoreIDPaths == nil { + return nil + } + ignoreIDOrCategoryToRootPaths := make(map[string][]string) + for _, protoIgnoreIDPath := range protoIgnoreIDPaths { + ignoreIDOrCategoryToRootPaths[protoIgnoreIDPath.GetId()] = protoIgnoreIDPath.GetPaths() + } + return ignoreIDOrCategoryToRootPaths +} + +func protoForIgnoreIDOrCategoryToRootPaths(ignoreIDOrCategoryToRootPaths map[string][]string) []*lintv1.IDPaths { + if ignoreIDOrCategoryToRootPaths == nil { + return nil + } + idPathsProto := make([]*lintv1.IDPaths, 0, len(ignoreIDOrCategoryToRootPaths)) + for id, paths := range ignoreIDOrCategoryToRootPaths { + idPathsProto = append(idPathsProto, &lintv1.IDPaths{ + Id: id, + Paths: paths, + }) + } + return idPathsProto +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/handler.go b/pkg/bufman/bufpkg/bufcheck/buflint/handler.go new file mode 100644 index 000000000..96429c1c4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/handler.go @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflint + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimageutil" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "go.uber.org/zap" +) + +type handler struct { + logger *zap.Logger + runner *internal.Runner +} + +func newHandler(logger *zap.Logger) *handler { + return &handler{ + logger: logger, + // linting allows for comment ignores + // note that comment ignores still need to be enabled within the config + // for a given check, this just says that comment ignores are allowed + // in the first place + runner: internal.NewRunner( + logger, + internal.RunnerWithIgnorePrefix(buflintcheck.CommentIgnorePrefix), + ), + } +} + +func (h *handler) Check( + ctx context.Context, + config *buflintconfig.Config, + image bufimage.Image, +) ([]bufanalysis.FileAnnotation, error) { + files, err := protosource.NewFilesUnstable(ctx, bufimageutil.NewInputFiles(image.Files())...) + if err != nil { + return nil, err + } + internalConfig, err := internalConfigForConfig(config) + if err != nil { + return nil, err + } + return h.runner.Check(ctx, internalConfig, nil, files) +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintbuild/buflintbuild.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintbuild/buflintbuild.go new file mode 100644 index 000000000..33205112f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintbuild/buflintbuild.go @@ -0,0 +1,360 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package buflintbuild contains the RuleBuilders used by buflintv*. +package buflintbuild + +import ( + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" +) + +var ( + // CommentEnumRuleBuilder is a rule builder. + CommentEnumRuleBuilder = internal.NewNopRuleBuilder( + "COMMENT_ENUM", + "enums have non-empty comments", + newAdapter(buflintcheck.CheckCommentEnum), + ) + // CommentEnumValueRuleBuilder is a rule builder. + CommentEnumValueRuleBuilder = internal.NewNopRuleBuilder( + "COMMENT_ENUM_VALUE", + "enum values have non-empty comments", + newAdapter(buflintcheck.CheckCommentEnumValue), + ) + // CommentFieldRuleBuilder is a rule builder. + CommentFieldRuleBuilder = internal.NewNopRuleBuilder( + "COMMENT_FIELD", + "fields have non-empty comments", + newAdapter(buflintcheck.CheckCommentField), + ) + // CommentMessageRuleBuilder is a rule builder. + CommentMessageRuleBuilder = internal.NewNopRuleBuilder( + "COMMENT_MESSAGE", + "messages have non-empty comments", + newAdapter(buflintcheck.CheckCommentMessage), + ) + // CommentOneofRuleBuilder is a rule builder. + CommentOneofRuleBuilder = internal.NewNopRuleBuilder( + "COMMENT_ONEOF", + "oneof have non-empty comments", + newAdapter(buflintcheck.CheckCommentOneof), + ) + // CommentRPCRuleBuilder is a rule builder. + CommentRPCRuleBuilder = internal.NewNopRuleBuilder( + "COMMENT_RPC", + "RPCs have non-empty comments", + newAdapter(buflintcheck.CheckCommentRPC), + ) + // CommentServiceRuleBuilder is a rule builder. + CommentServiceRuleBuilder = internal.NewNopRuleBuilder( + "COMMENT_SERVICE", + "services have non-empty comments", + newAdapter(buflintcheck.CheckCommentService), + ) + // DirectorySamePackageRuleBuilder is a rule builder. + DirectorySamePackageRuleBuilder = internal.NewNopRuleBuilder( + "DIRECTORY_SAME_PACKAGE", + "all files in a given directory are in the same package", + newAdapter(buflintcheck.CheckDirectorySamePackage), + ) + // EnumFirstValueZeroRuleBuilder is a rule builder. + EnumFirstValueZeroRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_FIRST_VALUE_ZERO", + "all first values of enums have a numeric value of 0", + newAdapter(buflintcheck.CheckEnumFirstValueZero), + ) + // EnumNoAllowAliasRuleBuilder is a rule builder. + EnumNoAllowAliasRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_NO_ALLOW_ALIAS", + "enums do not have the allow_alias option set", + newAdapter(buflintcheck.CheckEnumNoAllowAlias), + ) + // EnumPascalCaseRuleBuilder is a rule builder. + EnumPascalCaseRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_PASCAL_CASE", + "enums are PascalCase", + newAdapter(buflintcheck.CheckEnumPascalCase), + ) + // EnumValuePrefixRuleBuilder is a rule builder. + EnumValuePrefixRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_VALUE_PREFIX", + "enum values are prefixed with ENUM_NAME_UPPER_SNAKE_CASE", + newAdapter(buflintcheck.CheckEnumValuePrefix), + ) + // EnumValueUpperSnakeCaseRuleBuilder is a rule builder. + EnumValueUpperSnakeCaseRuleBuilder = internal.NewNopRuleBuilder( + "ENUM_VALUE_UPPER_SNAKE_CASE", + "enum values are UPPER_SNAKE_CASE", + newAdapter(buflintcheck.CheckEnumValueUpperSnakeCase), + ) + // EnumZeroValueSuffixRuleBuilder is a rule builder. + EnumZeroValueSuffixRuleBuilder = internal.NewRuleBuilder( + "ENUM_ZERO_VALUE_SUFFIX", + func(configBuilder internal.ConfigBuilder) (string, error) { + if configBuilder.EnumZeroValueSuffix == "" { + return "", errors.New("enum_zero_value_suffix is empty") + } + return "enum zero values are suffixed with " + configBuilder.EnumZeroValueSuffix + " (suffix is configurable)", nil + }, + func(configBuilder internal.ConfigBuilder) (internal.CheckFunc, error) { + if configBuilder.EnumZeroValueSuffix == "" { + return nil, errors.New("enum_zero_value_suffix is empty") + } + return internal.CheckFunc(func(id string, ignoreFunc internal.IgnoreFunc, _ []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return buflintcheck.CheckEnumZeroValueSuffix(id, ignoreFunc, files, configBuilder.EnumZeroValueSuffix) + }), nil + }, + ) + // FieldLowerSnakeCaseRuleBuilder is a rule builder. + FieldLowerSnakeCaseRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_LOWER_SNAKE_CASE", + "field names are lower_snake_case", + newAdapter(buflintcheck.CheckFieldLowerSnakeCase), + ) + // FieldNoDescriptorRuleBuilder is a rule builder. + FieldNoDescriptorRuleBuilder = internal.NewNopRuleBuilder( + "FIELD_NO_DESCRIPTOR", + `field names are not name capitalization of "descriptor" with any number of prefix or suffix underscores`, + newAdapter(buflintcheck.CheckFieldNoDescriptor), + ) + // FileLowerSnakeCaseRuleBuilder is a rule builder. + FileLowerSnakeCaseRuleBuilder = internal.NewNopRuleBuilder( + "FILE_LOWER_SNAKE_CASE", + "filenames are lower_snake_case", + newAdapter(buflintcheck.CheckFileLowerSnakeCase), + ) + // ImportNoPublicRuleBuilder is a rule builder. + ImportNoPublicRuleBuilder = internal.NewNopRuleBuilder( + "IMPORT_NO_PUBLIC", + "imports are not public", + newAdapter(buflintcheck.CheckImportNoPublic), + ) + // ImportNoWeakRuleBuilder is a rule builder. + ImportNoWeakRuleBuilder = internal.NewNopRuleBuilder( + "IMPORT_NO_WEAK", + "imports are not weak", + newAdapter(buflintcheck.CheckImportNoWeak), + ) + // ImportUsedRuleBuilder is a rule builder. + ImportUsedRuleBuilder = internal.NewNopRuleBuilder( + "IMPORT_USED", + "imports are used", + newAdapter(buflintcheck.CheckImportUsed), + ) + // MessagePascalCaseRuleBuilder is a rule builder. + MessagePascalCaseRuleBuilder = internal.NewNopRuleBuilder( + "MESSAGE_PASCAL_CASE", + "messages are PascalCase", + newAdapter(buflintcheck.CheckMessagePascalCase), + ) + // OneofLowerSnakeCaseRuleBuilder is a rule builder. + OneofLowerSnakeCaseRuleBuilder = internal.NewNopRuleBuilder( + "ONEOF_LOWER_SNAKE_CASE", + "oneof names are lower_snake_case", + newAdapter(buflintcheck.CheckOneofLowerSnakeCase), + ) + // PackageDefinedRuleBuilder is a rule builder. + PackageDefinedRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_DEFINED", + "all files have a package defined", + newAdapter(buflintcheck.CheckPackageDefined), + ) + // PackageDirectoryMatchRuleBuilder is a rule builder. + PackageDirectoryMatchRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_DIRECTORY_MATCH", + "all files are in a directory that matches their package name", + newAdapter(buflintcheck.CheckPackageDirectoryMatch), + ) + // PackageLowerSnakeCaseRuleBuilder is a rule builder. + PackageLowerSnakeCaseRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_LOWER_SNAKE_CASE", + "packages are lower_snake.case", + newAdapter(buflintcheck.CheckPackageLowerSnakeCase), + ) + // PackageNoImportCycleRuleBuilder is a rule builder. + PackageNoImportCycleRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_NO_IMPORT_CYCLE", + "packages do not have import cycles", + newAdapter(buflintcheck.CheckPackageNoImportCycle), + ) + // PackageSameCsharpNamespaceRuleBuilder is a rule builder. + PackageSameCsharpNamespaceRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SAME_CSHARP_NAMESPACE", + "all files with a given package have the same value for the csharp_namespace option", + newAdapter(buflintcheck.CheckPackageSameCsharpNamespace), + ) + // PackageSameDirectoryRuleBuilder is a rule builder. + PackageSameDirectoryRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SAME_DIRECTORY", + "all files with a given package are in the same directory", + newAdapter(buflintcheck.CheckPackageSameDirectory), + ) + // PackageSameGoPackageRuleBuilder is a rule builder. + PackageSameGoPackageRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SAME_GO_PACKAGE", + "all files with a given package have the same value for the go_package option", + newAdapter(buflintcheck.CheckPackageSameGoPackage), + ) + // PackageSameJavaMultipleFilesRuleBuilder is a rule builder. + PackageSameJavaMultipleFilesRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SAME_JAVA_MULTIPLE_FILES", + "all files with a given package have the same value for the java_multiple_files option", + newAdapter(buflintcheck.CheckPackageSameJavaMultipleFiles), + ) + // PackageSameJavaPackageRuleBuilder is a rule builder. + PackageSameJavaPackageRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SAME_JAVA_PACKAGE", + "all files with a given package have the same value for the java_package option", + newAdapter(buflintcheck.CheckPackageSameJavaPackage), + ) + // PackageSamePhpNamespaceRuleBuilder is a rule builder. + PackageSamePhpNamespaceRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SAME_PHP_NAMESPACE", + "all files with a given package have the same value for the php_namespace option", + newAdapter(buflintcheck.CheckPackageSamePhpNamespace), + ) + // PackageSameRubyPackageRuleBuilder is a rule builder. + PackageSameRubyPackageRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SAME_RUBY_PACKAGE", + "all files with a given package have the same value for the ruby_package option", + newAdapter(buflintcheck.CheckPackageSameRubyPackage), + ) + // PackageSameSwiftPrefixRuleBuilder is a rule builder. + PackageSameSwiftPrefixRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_SAME_SWIFT_PREFIX", + "all files with a given package have the same value for the swift_prefix option", + newAdapter(buflintcheck.CheckPackageSameSwiftPrefix), + ) + // PackageVersionSuffixRuleBuilder is a rule builder. + PackageVersionSuffixRuleBuilder = internal.NewNopRuleBuilder( + "PACKAGE_VERSION_SUFFIX", + `the last component of all packages is a version of the form v\d+, v\d+test.*, v\d+(alpha|beta)\d+, or v\d+p\d+(alpha|beta)\d+, where numbers are >=1`, + newAdapter(buflintcheck.CheckPackageVersionSuffix), + ) + // RPCNoClientStreamingRuleBuilder is a rule builder. + RPCNoClientStreamingRuleBuilder = internal.NewNopRuleBuilder( + "RPC_NO_CLIENT_STREAMING", + "RPCs are not client streaming", + newAdapter(buflintcheck.CheckRPCNoClientStreaming), + ) + // RPCNoServerStreamingRuleBuilder is a rule builder. + RPCNoServerStreamingRuleBuilder = internal.NewNopRuleBuilder( + "RPC_NO_SERVER_STREAMING", + "RPCs are not server streaming", + newAdapter(buflintcheck.CheckRPCNoServerStreaming), + ) + // RPCPascalCaseRuleBuilder is a rule builder. + RPCPascalCaseRuleBuilder = internal.NewNopRuleBuilder( + "RPC_PASCAL_CASE", + "RPCs are PascalCase", + newAdapter(buflintcheck.CheckRPCPascalCase), + ) + // RPCRequestResponseUniqueRuleBuilder is a rule builder. + RPCRequestResponseUniqueRuleBuilder = internal.NewRuleBuilder( + "RPC_REQUEST_RESPONSE_UNIQUE", + func(configBuilder internal.ConfigBuilder) (string, error) { + return "RPC request and response types are only used in one RPC (configurable)", nil + }, + func(configBuilder internal.ConfigBuilder) (internal.CheckFunc, error) { + return internal.CheckFunc(func(id string, ignoreFunc internal.IgnoreFunc, _ []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return buflintcheck.CheckRPCRequestResponseUnique( + id, + ignoreFunc, + files, + configBuilder.RPCAllowSameRequestResponse, + configBuilder.RPCAllowGoogleProtobufEmptyRequests, + configBuilder.RPCAllowGoogleProtobufEmptyResponses, + ) + }), nil + }, + ) + // RPCRequestStandardNameRuleBuilder is a rule builder. + RPCRequestStandardNameRuleBuilder = internal.NewRuleBuilder( + "RPC_REQUEST_STANDARD_NAME", + func(configBuilder internal.ConfigBuilder) (string, error) { + return "RPC request type names are RPCNameRequest or ServiceNameRPCNameRequest (configurable)", nil + }, + func(configBuilder internal.ConfigBuilder) (internal.CheckFunc, error) { + return internal.CheckFunc(func(id string, ignoreFunc internal.IgnoreFunc, _ []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return buflintcheck.CheckRPCRequestStandardName( + id, + ignoreFunc, + files, + configBuilder.RPCAllowGoogleProtobufEmptyRequests, + ) + }), nil + }, + ) + // RPCResponseStandardNameRuleBuilder is a rule builder. + RPCResponseStandardNameRuleBuilder = internal.NewRuleBuilder( + "RPC_RESPONSE_STANDARD_NAME", + func(configBuilder internal.ConfigBuilder) (string, error) { + return "RPC response type names are RPCNameResponse or ServiceNameRPCNameResponse (configurable)", nil + }, + func(configBuilder internal.ConfigBuilder) (internal.CheckFunc, error) { + return internal.CheckFunc(func(id string, ignoreFunc internal.IgnoreFunc, _ []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return buflintcheck.CheckRPCResponseStandardName( + id, + ignoreFunc, + files, + configBuilder.RPCAllowGoogleProtobufEmptyResponses, + ) + }), nil + }, + ) + // ServicePascalCaseRuleBuilder is a rule builder. + ServicePascalCaseRuleBuilder = internal.NewNopRuleBuilder( + "SERVICE_PASCAL_CASE", + "services are PascalCase", + newAdapter(buflintcheck.CheckServicePascalCase), + ) + // ServiceSuffixRuleBuilder is a rule builder. + ServiceSuffixRuleBuilder = internal.NewRuleBuilder( + "SERVICE_SUFFIX", + func(configBuilder internal.ConfigBuilder) (string, error) { + if configBuilder.ServiceSuffix == "" { + return "", errors.New("service_suffix is empty") + } + return "services are suffixed with " + configBuilder.ServiceSuffix + " (suffix is configurable)", nil + }, + func(configBuilder internal.ConfigBuilder) (internal.CheckFunc, error) { + if configBuilder.ServiceSuffix == "" { + return nil, errors.New("service_suffix is empty") + } + return internal.CheckFunc(func(id string, ignoreFunc internal.IgnoreFunc, _ []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return buflintcheck.CheckServiceSuffix(id, ignoreFunc, files, configBuilder.ServiceSuffix) + }), nil + }, + ) + // SyntaxSpecifiedRuleBuilder is a rule builder. + SyntaxSpecifiedRuleBuilder = internal.NewNopRuleBuilder( + "SYNTAX_SPECIFIED", + "all files have a syntax specified", + newAdapter(buflintcheck.CheckSyntaxSpecified), + ) +) + +func newAdapter( + f func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error), +) func(string, internal.IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return func(id string, ignoreFunc internal.IgnoreFunc, _ []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return f(id, ignoreFunc, files) + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck/buflintcheck.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck/buflintcheck.go new file mode 100644 index 000000000..dbfddb9bc --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck/buflintcheck.go @@ -0,0 +1,966 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package buflintcheck impelements the check functions. +// +// These are used by buflintbuild to create RuleBuilders. +package buflintcheck + +import ( + "errors" + "fmt" + "strconv" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoversion" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +const ( + // CommentIgnorePrefix is the comment ignore prefix. + // + // Comments with this prefix do not count towards valid comments in the comment checkers. + // This is also used in buflint when constructing a new Runner, and is passed to the + // RunnerWithIgnorePrefix option. + CommentIgnorePrefix = "buf:lint:ignore" +) + +var ( + // CheckCommentEnum is a check function. + CheckCommentEnum = newEnumCheckFunc(checkCommentEnum) + // CheckCommentEnumValue is a check function. + CheckCommentEnumValue = newEnumValueCheckFunc(checkCommentEnumValue) + // CheckCommentField is a check function. + CheckCommentField = newFieldCheckFunc(checkCommentField) + // CheckCommentMessage is a check function. + CheckCommentMessage = newMessageCheckFunc(checkCommentMessage) + // CheckCommentOneof is a check function. + CheckCommentOneof = newOneofCheckFunc(checkCommentOneof) + // CheckCommentService is a check function. + CheckCommentService = newServiceCheckFunc(checkCommentService) + // CheckCommentRPC is a check function. + CheckCommentRPC = newMethodCheckFunc(checkCommentRPC) +) + +func checkCommentEnum(add addFunc, value protosource.Enum) error { + return checkCommentNamedDescriptor(add, value, "Enum") +} + +func checkCommentEnumValue(add addFunc, value protosource.EnumValue) error { + return checkCommentNamedDescriptor(add, value, "Enum value") +} + +func checkCommentField(add addFunc, value protosource.Field) error { + return checkCommentNamedDescriptor(add, value, "Field") +} + +func checkCommentMessage(add addFunc, value protosource.Message) error { + return checkCommentNamedDescriptor(add, value, "Message") +} + +func checkCommentOneof(add addFunc, value protosource.Oneof) error { + return checkCommentNamedDescriptor(add, value, "Oneof") +} + +func checkCommentRPC(add addFunc, value protosource.Method) error { + return checkCommentNamedDescriptor(add, value, "RPC") +} + +func checkCommentService(add addFunc, value protosource.Service) error { + return checkCommentNamedDescriptor(add, value, "Service") +} + +func checkCommentNamedDescriptor( + add addFunc, + namedDescriptor protosource.NamedDescriptor, + typeName string, +) error { + location := namedDescriptor.Location() + if location == nil { + // this will magically skip map entry fields as well as a side-effect, although originally unintended + return nil + } + if !validLeadingComment(location.LeadingComments()) { + add(namedDescriptor, location, nil, "%s %q should have a non-empty comment for documentation.", typeName, namedDescriptor.Name()) + } + return nil +} + +// CheckDirectorySamePackage is a check function. +var CheckDirectorySamePackage = newDirToFilesCheckFunc(checkDirectorySamePackage) + +func checkDirectorySamePackage(add addFunc, dirPath string, files []protosource.File) error { + pkgMap := make(map[string]struct{}) + for _, file := range files { + // works for no package set as this will result in "" which is a valid map key + pkgMap[file.Package()] = struct{}{} + } + if len(pkgMap) > 1 { + var messagePrefix string + if _, ok := pkgMap[""]; ok { + delete(pkgMap, "") + if len(pkgMap) > 1 { + messagePrefix = fmt.Sprintf("Multiple packages %q and file with no package", strings.Join(stringutil.MapToSortedSlice(pkgMap), ",")) + } else { + // Join works with only one element as well by adding no comma + messagePrefix = fmt.Sprintf("Package %q and file with no package", strings.Join(stringutil.MapToSortedSlice(pkgMap), ",")) + } + } else { + messagePrefix = fmt.Sprintf("Multiple packages %q", strings.Join(stringutil.MapToSortedSlice(pkgMap), ",")) + } + for _, file := range files { + add(file, file.PackageLocation(), nil, "%s detected within directory %q.", messagePrefix, dirPath) + } + } + return nil +} + +// CheckEnumNoAllowAlias is a check function. +var CheckEnumNoAllowAlias = newEnumCheckFunc(checkEnumNoAllowAlias) + +func checkEnumNoAllowAlias(add addFunc, enum protosource.Enum) error { + if enum.AllowAlias() { + add(enum, enum.AllowAliasLocation(), nil, `Enum option "allow_alias" on enum %q must be false.`, enum.Name()) + } + return nil +} + +// CheckEnumPascalCase is a check function. +var CheckEnumPascalCase = newEnumCheckFunc(checkEnumPascalCase) + +func checkEnumPascalCase(add addFunc, enum protosource.Enum) error { + name := enum.Name() + expectedName := stringutil.ToPascalCase(name) + if name != expectedName { + add(enum, enum.NameLocation(), nil, "Enum name %q should be PascalCase, such as %q.", name, expectedName) + } + return nil +} + +// CheckEnumFirstValueZero is a check function. +var CheckEnumFirstValueZero = newEnumCheckFunc(checkEnumFirstValueZero) + +func checkEnumFirstValueZero(add addFunc, enum protosource.Enum) error { + if values := enum.Values(); len(values) > 0 { + if firstEnumValue := values[0]; firstEnumValue.Number() != 0 { + // proto3 compilation references the number + add( + firstEnumValue, + firstEnumValue.NumberLocation(), + // also check the name location for this comment ignore, as the number location might not have the comment + // see https://github.com/ProtobufMan/bufman-cli/issues/1186 + // also check the enum for this comment ignore + // this allows users to set this "globally" for an enum + // see https://github.com/ProtobufMan/bufman-cli/issues/161 + []protosource.Location{ + firstEnumValue.NameLocation(), + firstEnumValue.Enum().Location(), + }, + "First enum value %q should have a numeric value of 0", + firstEnumValue.Name(), + ) + } + } + return nil +} + +// CheckEnumValuePrefix is a check function. +var CheckEnumValuePrefix = newEnumValueCheckFunc(checkEnumValuePrefix) + +func checkEnumValuePrefix(add addFunc, enumValue protosource.EnumValue) error { + name := enumValue.Name() + expectedPrefix := fieldToUpperSnakeCase(enumValue.Enum().Name()) + "_" + if !strings.HasPrefix(name, expectedPrefix) { + add( + enumValue, + enumValue.NameLocation(), + // also check the enum for this comment ignore + // this allows users to set this "globally" for an enum + // this came up in https://github.com/ProtobufMan/bufman-cli/issues/161 + []protosource.Location{ + enumValue.Enum().Location(), + }, + "Enum value name %q should be prefixed with %q.", + name, + expectedPrefix, + ) + } + return nil +} + +// CheckEnumValueUpperSnakeCase is a check function. +var CheckEnumValueUpperSnakeCase = newEnumValueCheckFunc(checkEnumValueUpperSnakeCase) + +func checkEnumValueUpperSnakeCase(add addFunc, enumValue protosource.EnumValue) error { + name := enumValue.Name() + expectedName := fieldToUpperSnakeCase(name) + if name != expectedName { + add( + enumValue, + enumValue.NameLocation(), + // also check the enum for this comment ignore + // this allows users to set this "globally" for an enum + []protosource.Location{ + enumValue.Enum().Location(), + }, + "Enum value name %q should be UPPER_SNAKE_CASE, such as %q.", + name, + expectedName, + ) + } + return nil +} + +// CheckEnumZeroValueSuffix is a check function. +var CheckEnumZeroValueSuffix = func( + id string, + ignoreFunc internal.IgnoreFunc, + files []protosource.File, + suffix string, +) ([]bufanalysis.FileAnnotation, error) { + return newEnumValueCheckFunc( + func(add addFunc, enumValue protosource.EnumValue) error { + return checkEnumZeroValueSuffix(add, enumValue, suffix) + }, + )(id, ignoreFunc, files) +} + +func checkEnumZeroValueSuffix(add addFunc, enumValue protosource.EnumValue, suffix string) error { + if enumValue.Number() != 0 { + return nil + } + name := enumValue.Name() + if !strings.HasSuffix(name, suffix) { + add( + enumValue, + enumValue.NameLocation(), + // also check the enum for this comment ignore + // this allows users to set this "globally" for an enum + []protosource.Location{ + enumValue.Enum().Location(), + }, + "Enum zero value name %q should be suffixed with %q.", + name, + suffix, + ) + } + return nil +} + +// CheckFieldLowerSnakeCase is a check function. +var CheckFieldLowerSnakeCase = newFieldCheckFunc(checkFieldLowerSnakeCase) + +func checkFieldLowerSnakeCase(add addFunc, field protosource.Field) error { + message := field.Message() + if message == nil { + // just a sanity check + return errors.New("field.Message() was nil") + } + if message.IsMapEntry() { + // this check should always pass anyways but just in case + return nil + } + name := field.Name() + expectedName := fieldToLowerSnakeCase(name) + if name != expectedName { + add( + field, + field.NameLocation(), + // also check the message for this comment ignore + // this allows users to set this "globally" for a message + []protosource.Location{ + field.Message().Location(), + }, + "Field name %q should be lower_snake_case, such as %q.", + name, + expectedName, + ) + } + return nil +} + +// CheckFieldNoDescriptor is a check function. +var CheckFieldNoDescriptor = newFieldCheckFunc(checkFieldNoDescriptor) + +func checkFieldNoDescriptor(add addFunc, field protosource.Field) error { + name := field.Name() + if strings.ToLower(strings.Trim(name, "_")) == "descriptor" { + add( + field, + field.NameLocation(), + // also check the message for this comment ignore + // this allows users to set this "globally" for a message + []protosource.Location{ + field.Message().Location(), + }, + `Field name %q cannot be any capitalization of "descriptor" with any number of prefix or suffix underscores.`, + name, + ) + } + return nil +} + +// CheckFileLowerSnakeCase is a check function. +var CheckFileLowerSnakeCase = newFileCheckFunc(checkFileLowerSnakeCase) + +func checkFileLowerSnakeCase(add addFunc, file protosource.File) error { + filename := file.Path() + base := normalpath.Base(filename) + ext := normalpath.Ext(filename) + baseWithoutExt := strings.TrimSuffix(base, ext) + expectedBaseWithoutExt := stringutil.ToLowerSnakeCase(baseWithoutExt) + if baseWithoutExt != expectedBaseWithoutExt { + add(file, nil, nil, `Filename %q should be lower_snake_case%s, such as "%s%s".`, base, ext, expectedBaseWithoutExt, ext) + } + return nil +} + +var ( + // CheckImportNoPublic is a check function. + CheckImportNoPublic = newFileImportCheckFunc(checkImportNoPublic) + // CheckImportNoWeak is a check function. + CheckImportNoWeak = newFileImportCheckFunc(checkImportNoWeak) + // CheckImportUsed is a check function. + CheckImportUsed = newFileImportCheckFunc(checkImportUsed) +) + +func checkImportNoPublic(add addFunc, fileImport protosource.FileImport) error { + return checkImportNoPublicWeak(add, fileImport, fileImport.IsPublic(), "public") +} + +func checkImportNoWeak(add addFunc, fileImport protosource.FileImport) error { + return checkImportNoPublicWeak(add, fileImport, fileImport.IsWeak(), "weak") +} + +func checkImportNoPublicWeak(add addFunc, fileImport protosource.FileImport, value bool, name string) error { + if value { + add(fileImport, fileImport.Location(), nil, `Import %q must not be %s.`, fileImport.Import(), name) + } + return nil +} + +func checkImportUsed(add addFunc, fileImport protosource.FileImport) error { + if fileImport.IsUnused() { + add(fileImport, fileImport.Location(), nil, `Import %q is unused.`, fileImport.Import()) + } + return nil +} + +// CheckMessagePascalCase is a check function. +var CheckMessagePascalCase = newMessageCheckFunc(checkMessagePascalCase) + +func checkMessagePascalCase(add addFunc, message protosource.Message) error { + if message.IsMapEntry() { + // map entries should always be pascal case but we don't want to check them anyways + return nil + } + name := message.Name() + expectedName := stringutil.ToPascalCase(name) + if name != expectedName { + add(message, message.NameLocation(), nil, "Message name %q should be PascalCase, such as %q.", name, expectedName) + } + return nil +} + +// CheckOneofLowerSnakeCase is a check function. +var CheckOneofLowerSnakeCase = newOneofCheckFunc(checkOneofLowerSnakeCase) + +func checkOneofLowerSnakeCase(add addFunc, oneof protosource.Oneof) error { + name := oneof.Name() + expectedName := fieldToLowerSnakeCase(name) + if name != expectedName { + // if this is an implicit oneof for a proto3 optional field, do not error + // https://github.com/protocolbuffers/protobuf/blob/master/docs/implementing_proto3_presence.md + if fields := oneof.Fields(); len(fields) == 1 { + if fields[0].Proto3Optional() { + return nil + } + } + add( + oneof, + oneof.NameLocation(), + // also check the message for this comment ignore + // this allows users to set this "globally" for a message + []protosource.Location{ + oneof.Message().Location(), + }, + "Oneof name %q should be lower_snake_case, such as %q.", + name, + expectedName, + ) + } + return nil +} + +// CheckPackageDefined is a check function. +var CheckPackageDefined = newFileCheckFunc(checkPackageDefined) + +func checkPackageDefined(add addFunc, file protosource.File) error { + if file.Package() == "" { + add(file, nil, nil, "Files must have a package defined.") + } + return nil +} + +// CheckPackageDirectoryMatch is a check function. +var CheckPackageDirectoryMatch = newFileCheckFunc(checkPackageDirectoryMatch) + +func checkPackageDirectoryMatch(add addFunc, file protosource.File) error { + pkg := file.Package() + if pkg == "" { + return nil + } + expectedDirPath := strings.ReplaceAll(pkg, ".", "/") + dirPath := normalpath.Dir(file.Path()) + // need to check case where in root relative directory and no package defined + // this should be valid although if SENSIBLE is turned on this will be invalid + if dirPath != expectedDirPath { + add(file, file.PackageLocation(), nil, `Files with package %q must be within a directory "%s" relative to root but were in directory "%s".`, pkg, normalpath.Unnormalize(expectedDirPath), normalpath.Unnormalize(dirPath)) + } + return nil +} + +// CheckPackageLowerSnakeCase is a check function. +var CheckPackageLowerSnakeCase = newFileCheckFunc(checkPackageLowerSnakeCase) + +func checkPackageLowerSnakeCase(add addFunc, file protosource.File) error { + pkg := file.Package() + if pkg == "" { + return nil + } + split := strings.Split(pkg, ".") + for i, elem := range split { + split[i] = stringutil.ToLowerSnakeCase(elem) + } + expectedPkg := strings.Join(split, ".") + if pkg != expectedPkg { + add(file, file.PackageLocation(), nil, "Package name %q should be lower_snake.case, such as %q.", pkg, expectedPkg) + } + return nil +} + +// CheckPackageNoImportCycle is a check function. +var CheckPackageNoImportCycle = newFilesCheckFunc(checkPackageNoImportCycle) + +func checkPackageNoImportCycle(add addFunc, files []protosource.File) error { + packageToDirectlyImportedPackageToFileImports, err := protosource.PackageToDirectlyImportedPackageToFileImports(files...) + if err != nil { + return err + } + // This is way more algorithmically complex than it needs to be. + // + // We're doing a DFS starting at each package. What we should do is start from any package, + // do the DFS and keep track of the packages hit, and then don't ever do DFS from a given + // package twice. The problem is is that with the current janky package -> direct -> file imports + // setup, we would then end up with error messages like "import cycle: a -> b -> c -> b", and + // attach the error message to a file with package a, and we want to just print "b -> c -> b". + // So to get this to market, we just do a DFS from each package. + // + // This may prove to be too expensive but early testing say it is not so far. + for pkg := range packageToDirectlyImportedPackageToFileImports { + // Can equal "" per the function signature of PackageToDirectlyImportedPackageToFileImports + if pkg == "" { + continue + } + // Go one deep in the potential import cycle so that we can get the file imports + // we want to potentially attach errors to. + // + // We know that pkg is never equal to directlyImportedPackage due to the signature + // of PackageToDirectlyImportedPackageToFileImports. + for directlyImportedPackage, fileImports := range packageToDirectlyImportedPackageToFileImports[pkg] { + // Can equal "" per the function signature of PackageToDirectlyImportedPackageToFileImports + if directlyImportedPackage == "" { + continue + } + if importCycle := getImportCycleIfExists( + directlyImportedPackage, + packageToDirectlyImportedPackageToFileImports, + map[string]struct{}{ + pkg: {}, + }, + []string{ + pkg, + }, + ); len(importCycle) > 0 { + for _, fileImport := range fileImports { + add(fileImport, fileImport.Location(), nil, `Package import cycle: %s`, strings.Join(importCycle, ` -> `)) + } + } + } + } + return nil +} + +// CheckPackageSameDirectory is a check function. +var CheckPackageSameDirectory = newPackageToFilesCheckFunc(checkPackageSameDirectory) + +func checkPackageSameDirectory(add addFunc, pkg string, files []protosource.File) error { + dirMap := make(map[string]struct{}) + for _, file := range files { + dirMap[normalpath.Dir(file.Path())] = struct{}{} + } + if len(dirMap) > 1 { + dirs := stringutil.MapToSortedSlice(dirMap) + for _, file := range files { + add(file, file.PackageLocation(), nil, "Multiple directories %q contain files with package %q.", strings.Join(dirs, ","), pkg) + } + } + return nil +} + +var ( + // CheckPackageSameCsharpNamespace is a check function. + CheckPackageSameCsharpNamespace = newPackageToFilesCheckFunc(checkPackageSameCsharpNamespace) + // CheckPackageSameGoPackage is a check function. + CheckPackageSameGoPackage = newPackageToFilesCheckFunc(checkPackageSameGoPackage) + // CheckPackageSameJavaMultipleFiles is a check function. + CheckPackageSameJavaMultipleFiles = newPackageToFilesCheckFunc(checkPackageSameJavaMultipleFiles) + // CheckPackageSameJavaPackage is a check function. + CheckPackageSameJavaPackage = newPackageToFilesCheckFunc(checkPackageSameJavaPackage) + // CheckPackageSamePhpNamespace is a check function. + CheckPackageSamePhpNamespace = newPackageToFilesCheckFunc(checkPackageSamePhpNamespace) + // CheckPackageSameRubyPackage is a check function. + CheckPackageSameRubyPackage = newPackageToFilesCheckFunc(checkPackageSameRubyPackage) + // CheckPackageSameSwiftPrefix is a check function. + CheckPackageSameSwiftPrefix = newPackageToFilesCheckFunc(checkPackageSameSwiftPrefix) +) + +func checkPackageSameCsharpNamespace(add addFunc, pkg string, files []protosource.File) error { + return checkPackageSameOptionValue(add, pkg, files, protosource.File.CsharpNamespace, protosource.File.CsharpNamespaceLocation, "csharp_namespace") +} + +func checkPackageSameGoPackage(add addFunc, pkg string, files []protosource.File) error { + return checkPackageSameOptionValue(add, pkg, files, protosource.File.GoPackage, protosource.File.GoPackageLocation, "go_package") +} + +func checkPackageSameJavaMultipleFiles(add addFunc, pkg string, files []protosource.File) error { + return checkPackageSameOptionValue( + add, + pkg, + files, + func(file protosource.File) string { + return strconv.FormatBool(file.JavaMultipleFiles()) + }, + protosource.File.JavaMultipleFilesLocation, + "java_multiple_files", + ) +} + +func checkPackageSameJavaPackage(add addFunc, pkg string, files []protosource.File) error { + return checkPackageSameOptionValue(add, pkg, files, protosource.File.JavaPackage, protosource.File.JavaPackageLocation, "java_package") +} + +func checkPackageSamePhpNamespace(add addFunc, pkg string, files []protosource.File) error { + return checkPackageSameOptionValue(add, pkg, files, protosource.File.PhpNamespace, protosource.File.PhpNamespaceLocation, "php_namespace") +} + +func checkPackageSameRubyPackage(add addFunc, pkg string, files []protosource.File) error { + return checkPackageSameOptionValue(add, pkg, files, protosource.File.RubyPackage, protosource.File.RubyPackageLocation, "ruby_package") +} + +func checkPackageSameSwiftPrefix(add addFunc, pkg string, files []protosource.File) error { + return checkPackageSameOptionValue(add, pkg, files, protosource.File.SwiftPrefix, protosource.File.SwiftPrefixLocation, "swift_prefix") +} + +func checkPackageSameOptionValue( + add addFunc, + pkg string, + files []protosource.File, + getOptionValue func(protosource.File) string, + getOptionLocation func(protosource.File) protosource.Location, + name string, +) error { + optionValueMap := make(map[string]struct{}) + for _, file := range files { + optionValueMap[getOptionValue(file)] = struct{}{} + } + if len(optionValueMap) > 1 { + _, noOptionValue := optionValueMap[""] + delete(optionValueMap, "") + optionValues := stringutil.MapToSortedSlice(optionValueMap) + for _, file := range files { + if noOptionValue { + add(file, getOptionLocation(file), nil, "Files in package %q have both values %q and no value for option %q and all values must be equal.", pkg, strings.Join(optionValues, ","), name) + } else { + add(file, getOptionLocation(file), nil, "Files in package %q have multiple values %q for option %q and all values must be equal.", pkg, strings.Join(optionValues, ","), name) + } + } + } + return nil +} + +// CheckPackageVersionSuffix is a check function. +var CheckPackageVersionSuffix = newFileCheckFunc(checkPackageVersionSuffix) + +func checkPackageVersionSuffix(add addFunc, file protosource.File) error { + pkg := file.Package() + if pkg == "" { + return nil + } + if _, ok := protoversion.NewPackageVersionForPackage(pkg); !ok { + add(file, file.PackageLocation(), nil, `Package name %q should be suffixed with a correctly formed version, such as %q.`, pkg, pkg+".v1") + } + return nil +} + +// CheckRPCNoClientStreaming is a check function. +var CheckRPCNoClientStreaming = newMethodCheckFunc(checkRPCNoClientStreaming) + +func checkRPCNoClientStreaming(add addFunc, method protosource.Method) error { + if method.ClientStreaming() { + add( + method, + method.Location(), + // also check the service for this comment ignore + // this allows users to set this "globally" for a service + []protosource.Location{ + method.Service().Location(), + }, + "RPC %q is client streaming.", + method.Name(), + ) + } + return nil +} + +// CheckRPCNoServerStreaming is a check function. +var CheckRPCNoServerStreaming = newMethodCheckFunc(checkRPCNoServerStreaming) + +func checkRPCNoServerStreaming(add addFunc, method protosource.Method) error { + if method.ServerStreaming() { + add( + method, + method.Location(), + // also check the service for this comment ignore + // this allows users to set this "globally" for a service + []protosource.Location{ + method.Service().Location(), + }, + "RPC %q is server streaming.", + method.Name(), + ) + } + return nil +} + +// CheckRPCPascalCase is a check function. +var CheckRPCPascalCase = newMethodCheckFunc(checkRPCPascalCase) + +func checkRPCPascalCase(add addFunc, method protosource.Method) error { + name := method.Name() + expectedName := stringutil.ToPascalCase(name) + if name != expectedName { + add( + method, + method.NameLocation(), + // also check the service for this comment ignore + // this allows users to set this "globally" for a service + []protosource.Location{ + method.Service().Location(), + }, + "RPC name %q should be PascalCase, such as %q.", + name, + expectedName, + ) + } + return nil +} + +// CheckRPCRequestResponseUnique is a check function. +var CheckRPCRequestResponseUnique = func( + id string, + ignoreFunc internal.IgnoreFunc, + files []protosource.File, + allowSameRequestResponse bool, + allowGoogleProtobufEmptyRequests bool, + allowGoogleProtobufEmptyResponses bool, +) ([]bufanalysis.FileAnnotation, error) { + return newFilesCheckFunc( + func(add addFunc, files []protosource.File) error { + return checkRPCRequestResponseUnique( + add, + files, + allowSameRequestResponse, + allowGoogleProtobufEmptyRequests, + allowGoogleProtobufEmptyResponses, + ) + }, + )(id, ignoreFunc, files) +} + +func checkRPCRequestResponseUnique( + add addFunc, + files []protosource.File, + allowSameRequestResponse bool, + allowGoogleProtobufEmptyRequests bool, + allowGoogleProtobufEmptyResponses bool, +) error { + allFullNameToMethod, err := protosource.FullNameToMethod(files...) + if err != nil { + return err + } + // first check if any requests or responses are the same + // if not, we can treat requests and responses equally for checking if more than + // one method uses a type + if !allowSameRequestResponse { + for _, method := range allFullNameToMethod { + if method.InputTypeName() == method.OutputTypeName() { + // if we allow both empty requests and responses, we do not want to add a FileAnnotation + if !(method.InputTypeName() == "google.protobuf.Empty" && allowGoogleProtobufEmptyRequests && allowGoogleProtobufEmptyResponses) { + add( + method, + method.Location(), + // also check the service for this comment ignore + // this allows users to set this "globally" for a service + []protosource.Location{ + method.Service().Location(), + }, + "RPC %q has the same type %q for the request and response.", + method.Name(), + method.InputTypeName(), + ) + } + } + } + } + // we have now added errors for the same request and response type if applicable + // we can now check methods for unique usage of a given type + requestResponseTypeToFullNameToMethod := make(map[string]map[string]protosource.Method) + for fullName, method := range allFullNameToMethod { + for _, requestResponseType := range []string{method.InputTypeName(), method.OutputTypeName()} { + fullNameToMethod, ok := requestResponseTypeToFullNameToMethod[requestResponseType] + if !ok { + fullNameToMethod = make(map[string]protosource.Method) + requestResponseTypeToFullNameToMethod[requestResponseType] = fullNameToMethod + } + fullNameToMethod[fullName] = method + } + } + for requestResponseType, fullNameToMethod := range requestResponseTypeToFullNameToMethod { + // only this method uses this request or response type, no issue + if len(fullNameToMethod) == 1 { + continue + } + // if the request or response type is google.protobuf.Empty and we allow this for requests or responses, + // we have to do a harder check + if requestResponseType == "google.protobuf.Empty" && (allowGoogleProtobufEmptyRequests || allowGoogleProtobufEmptyResponses) { + // if both requests and responses can be google.protobuf.Empty, then do not add any error + // else, we check + if !(allowGoogleProtobufEmptyRequests && allowGoogleProtobufEmptyResponses) { + // inside this if statement, one of allowGoogleProtobufEmptyRequests or allowGoogleProtobufEmptyResponses is true + var requestMethods []protosource.Method + var responseMethods []protosource.Method + for _, method := range fullNameToMethod { + if method.InputTypeName() == "google.protobuf.Empty" { + requestMethods = append(requestMethods, method) + } + if method.OutputTypeName() == "google.protobuf.Empty" { + responseMethods = append(responseMethods, method) + } + } + if !allowGoogleProtobufEmptyRequests && len(requestMethods) > 1 { + for _, method := range requestMethods { + add( + method, + method.Location(), + // also check the service for this comment ignore + // this allows users to set this "globally" for a service + []protosource.Location{ + method.Service().Location(), + }, + "%q is used as the request for multiple RPCs.", + requestResponseType, + ) + } + } + if !allowGoogleProtobufEmptyResponses && len(responseMethods) > 1 { + for _, method := range responseMethods { + add( + method, + method.Location(), + // also check the service for this comment ignore + // this allows users to set this "globally" for a service + []protosource.Location{ + method.Service().Location(), + }, + "%q is used as the response for multiple RPCs.", + requestResponseType, + ) + } + } + } + } else { + // else, we have a duplicate usage of requestResponseType, add an FileAnnotation to each method + for _, method := range fullNameToMethod { + add( + method, + method.Location(), + // also check the service for this comment ignore + // this allows users to set this "globally" for a service + []protosource.Location{ + method.Service().Location(), + }, + "%q is used as the request or response type for multiple RPCs.", + requestResponseType, + ) + } + } + } + return nil +} + +// CheckRPCRequestStandardName is a check function. +var CheckRPCRequestStandardName = func( + id string, + ignoreFunc internal.IgnoreFunc, + files []protosource.File, + allowGoogleProtobufEmptyRequests bool, +) ([]bufanalysis.FileAnnotation, error) { + return newMethodCheckFunc( + func(add addFunc, method protosource.Method) error { + return checkRPCRequestStandardName(add, method, allowGoogleProtobufEmptyRequests) + }, + )(id, ignoreFunc, files) +} + +func checkRPCRequestStandardName(add addFunc, method protosource.Method, allowGoogleProtobufEmptyRequests bool) error { + service := method.Service() + if service == nil { + return errors.New("method.Service() is nil") + } + name := method.InputTypeName() + if allowGoogleProtobufEmptyRequests && name == "google.protobuf.Empty" { + return nil + } + if strings.Contains(name, ".") { + split := strings.Split(name, ".") + name = split[len(split)-1] + } + expectedName1 := stringutil.ToPascalCase(method.Name()) + "Request" + expectedName2 := stringutil.ToPascalCase(service.Name()) + expectedName1 + if name != expectedName1 && name != expectedName2 { + add( + method, + method.InputTypeLocation(), + // also check the method and service for this comment ignore + // this came up in https://github.com/ProtobufMan/bufman-cli/issues/242 + []protosource.Location{ + method.Location(), + method.Service().Location(), + }, + "RPC request type %q should be named %q or %q.", + name, + expectedName1, + expectedName2, + ) + } + return nil +} + +// CheckRPCResponseStandardName is a check function. +var CheckRPCResponseStandardName = func( + id string, + ignoreFunc internal.IgnoreFunc, + files []protosource.File, + allowGoogleProtobufEmptyResponses bool, +) ([]bufanalysis.FileAnnotation, error) { + return newMethodCheckFunc( + func(add addFunc, method protosource.Method) error { + return checkRPCResponseStandardName(add, method, allowGoogleProtobufEmptyResponses) + }, + )(id, ignoreFunc, files) +} + +func checkRPCResponseStandardName(add addFunc, method protosource.Method, allowGoogleProtobufEmptyResponses bool) error { + service := method.Service() + if service == nil { + return errors.New("method.Service() is nil") + } + name := method.OutputTypeName() + if allowGoogleProtobufEmptyResponses && name == "google.protobuf.Empty" { + return nil + } + if strings.Contains(name, ".") { + split := strings.Split(name, ".") + name = split[len(split)-1] + } + expectedName1 := stringutil.ToPascalCase(method.Name()) + "Response" + expectedName2 := stringutil.ToPascalCase(service.Name()) + expectedName1 + if name != expectedName1 && name != expectedName2 { + add( + method, + method.OutputTypeLocation(), + // also check the method and service for this comment ignore + // this came up in https://github.com/ProtobufMan/bufman-cli/issues/242 + []protosource.Location{ + method.Location(), + method.Service().Location(), + }, + "RPC response type %q should be named %q or %q.", + name, + expectedName1, + expectedName2, + ) + } + return nil +} + +// CheckServicePascalCase is a check function. +var CheckServicePascalCase = newServiceCheckFunc(checkServicePascalCase) + +func checkServicePascalCase(add addFunc, service protosource.Service) error { + name := service.Name() + expectedName := stringutil.ToPascalCase(name) + if name != expectedName { + add(service, service.NameLocation(), nil, "Service name %q should be PascalCase, such as %q.", name, expectedName) + } + return nil +} + +// CheckServiceSuffix is a check function. +var CheckServiceSuffix = func( + id string, + ignoreFunc internal.IgnoreFunc, + files []protosource.File, + suffix string, +) ([]bufanalysis.FileAnnotation, error) { + return newServiceCheckFunc( + func(add addFunc, service protosource.Service) error { + return checkServiceSuffix(add, service, suffix) + }, + )(id, ignoreFunc, files) +} + +func checkServiceSuffix(add addFunc, service protosource.Service, suffix string) error { + name := service.Name() + if !strings.HasSuffix(name, suffix) { + add(service, service.NameLocation(), nil, "Service name %q should be suffixed with %q.", name, suffix) + } + return nil +} + +// CheckSyntaxSpecified is a check function. +var CheckSyntaxSpecified = newFileCheckFunc(checkSyntaxSpecified) + +func checkSyntaxSpecified(add addFunc, file protosource.File) error { + if file.Syntax() == protosource.SyntaxUnspecified { + add(file, file.SyntaxLocation(), nil, `Files must have a syntax explicitly specified. If no syntax is specified, the file defaults to "proto2".`) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck/util.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck/util.go new file mode 100644 index 000000000..090aa999e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintcheck/util.go @@ -0,0 +1,289 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflintcheck + +import ( + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +// addFunc adds a FileAnnotation. +// +// Both the Descriptor and Locations can be nil. +type addFunc func(protosource.Descriptor, protosource.Location, []protosource.Location, string, ...interface{}) + +func fieldToLowerSnakeCase(s string) string { + // Try running this on googleapis and watch + // We allow both effectively by not passing the option + // return stringutil.ToLowerSnakeCase(s, stringutil.SnakeCaseWithNewWordOnDigits()) + return stringutil.ToLowerSnakeCase(s) +} + +func fieldToUpperSnakeCase(s string) string { + // Try running this on googleapis and watch + // We allow both effectively by not passing the option + // return stringutil.ToUpperSnakeCase(s, stringutil.SnakeCaseWithNewWordOnDigits()) + return stringutil.ToUpperSnakeCase(s) +} + +// validLeadingComment returns true if comment has at least one line that isn't empty +// and doesn't start with CommentIgnorePrefix. +func validLeadingComment(comment string) bool { + for _, line := range strings.Split(comment, "\n") { + line = strings.TrimSpace(line) + if line != "" && !strings.HasPrefix(line, CommentIgnorePrefix) { + return true + } + } + return false +} + +// Returns the usedPackageList if there is an import cycle. +// +// Note this stops on the first import cycle detected, it doesn't attempt to get all of them - not perfect. +func getImportCycleIfExists( + // Should never be "" + pkg string, + packageToDirectlyImportedPackageToFileImports map[string]map[string][]protosource.FileImport, + usedPackageMap map[string]struct{}, + usedPackageList []string, +) []string { + // Append before checking so that the returned import cycle is actually a cycle + usedPackageList = append(usedPackageList, pkg) + if _, ok := usedPackageMap[pkg]; ok { + // We have an import cycle, but if the first package in the list does not + // equal the last, do not return as an import cycle unless the first + // element equals the last - we do DFS from each package so this will + // be picked up separately + if usedPackageList[0] == usedPackageList[len(usedPackageList)-1] { + return usedPackageList + } + return nil + } + usedPackageMap[pkg] = struct{}{} + // Will never equal pkg + for directlyImportedPackage := range packageToDirectlyImportedPackageToFileImports[pkg] { + // Can equal "" per the function signature of PackageToDirectlyImportedPackageToFileImports + if directlyImportedPackage == "" { + continue + } + if importCycle := getImportCycleIfExists( + directlyImportedPackage, + packageToDirectlyImportedPackageToFileImports, + usedPackageMap, + usedPackageList, + ); len(importCycle) != 0 { + return importCycle + } + } + delete(usedPackageMap, pkg) + return nil +} + +func newFilesCheckFunc( + f func(addFunc, []protosource.File) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return func(id string, ignoreFunc internal.IgnoreFunc, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + helper := internal.NewHelper(id, ignoreFunc) + if err := f(helper.AddFileAnnotationWithExtraIgnoreLocationsf, files); err != nil { + return nil, err + } + return helper.FileAnnotations(), nil + } +} + +func newPackageToFilesCheckFunc( + f func(add addFunc, pkg string, files []protosource.File) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFilesCheckFunc( + func(add addFunc, files []protosource.File) error { + packageToFiles, err := protosource.PackageToFiles(files...) + if err != nil { + return err + } + for pkg, files := range packageToFiles { + if err := f(add, pkg, files); err != nil { + return err + } + } + return nil + }, + ) +} + +func newDirToFilesCheckFunc( + f func(add addFunc, dirPath string, files []protosource.File) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFilesCheckFunc( + func(add addFunc, files []protosource.File) error { + dirPathToFiles, err := protosource.DirPathToFiles(files...) + if err != nil { + return err + } + for dirPath, files := range dirPathToFiles { + if err := f(add, dirPath, files); err != nil { + return err + } + } + return nil + }, + ) +} + +func newFileCheckFunc( + f func(addFunc, protosource.File) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFilesCheckFunc( + func(add addFunc, files []protosource.File) error { + for _, file := range files { + if err := f(add, file); err != nil { + return err + } + } + return nil + }, + ) +} + +func newFileImportCheckFunc( + f func(addFunc, protosource.FileImport) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFileCheckFunc( + func(add addFunc, file protosource.File) error { + for _, fileImport := range file.FileImports() { + if err := f(add, fileImport); err != nil { + return err + } + } + return nil + }, + ) +} + +func newEnumCheckFunc( + f func(addFunc, protosource.Enum) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFileCheckFunc( + func(add addFunc, file protosource.File) error { + return protosource.ForEachEnum( + func(enum protosource.Enum) error { + return f(add, enum) + }, + file, + ) + }, + ) +} + +func newEnumValueCheckFunc( + f func(addFunc, protosource.EnumValue) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newEnumCheckFunc( + func(add addFunc, enum protosource.Enum) error { + for _, enumValue := range enum.Values() { + if err := f(add, enumValue); err != nil { + return err + } + } + return nil + }, + ) +} + +func newMessageCheckFunc( + f func(addFunc, protosource.Message) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFileCheckFunc( + func(add addFunc, file protosource.File) error { + return protosource.ForEachMessage( + func(message protosource.Message) error { + return f(add, message) + }, + file, + ) + }, + ) +} + +func newFieldCheckFunc( + f func(addFunc, protosource.Field) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newMessageCheckFunc( + func(add addFunc, message protosource.Message) error { + for _, field := range message.Fields() { + if err := f(add, field); err != nil { + return err + } + } + // TODO: is this right? + for _, field := range message.Extensions() { + if err := f(add, field); err != nil { + return err + } + } + return nil + }, + ) +} + +func newOneofCheckFunc( + f func(addFunc, protosource.Oneof) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newMessageCheckFunc( + func(add addFunc, message protosource.Message) error { + for _, oneof := range message.Oneofs() { + if err := f(add, oneof); err != nil { + return err + } + } + return nil + }, + ) +} + +func newServiceCheckFunc( + f func(addFunc, protosource.Service) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newFileCheckFunc( + func(add addFunc, file protosource.File) error { + for _, service := range file.Services() { + if err := f(add, service); err != nil { + return err + } + } + return nil + }, + ) +} + +func newMethodCheckFunc( + f func(addFunc, protosource.Method) error, +) func(string, internal.IgnoreFunc, []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return newServiceCheckFunc( + func(add addFunc, service protosource.Service) error { + for _, method := range service.Methods() { + if err := f(add, method); err != nil { + return err + } + } + return nil + }, + ) +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/buflintv1.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/buflintv1.go new file mode 100644 index 000000000..94b4615f6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/buflintv1.go @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package buflintv1 contains the VersionSpec for v1. +// +// It uses buflintcheck and buflintbuild. +// +// The only changes from v1beta1 to v1 were that ENUM_FIRST_VALUE_ZERO was moved +// from OTHER to MINIMAL, and the OTHER category was deleted. +package buflintv1 + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + +// VersionSpec is the version specification for v1. +// +// The SYNTAX_SPECIFIED rule was added to BASIC, DEFAULT. +// The IMPORT_USED rule was added to BASIC, DEFAULT. +// ENUM_FIRST_VALUE_ZERO was added to BASIC, DEFAULT. +// PACKAGE_NO_IMPORT_CYCLE was added as an uncategorized lint rule. +// The FIELD_NO_DESCRIPTOR rule was removed altogether. +// +// A number of categories were removed between v1beta1 and v1. The difference +// is shown below: +// +// Removed: +// - FILE_LAYOUT +// - PACKAGE_AFFINITY +// - SENSIBLE +// - STYLE_BASIC +// - STYLE_DEFAULT +// - OTHER +// +// Thus, the only remaining categories are: +// +// Categories: +// - MINIMAL +// - BASIC +// - DEFAULT +// - COMMENTS +// - UNARY_RPC +// +// The rules included in the MINIMAL lint category have also been adjusted. +// The difference is shown below: +// +// Removed: +// - ENUM_NO_ALLOW_ALIAS +// - FIELD_NO_DESCRIPTOR +// - IMPORT_NO_PUBLIC +// - IMPORT_NO_WEAK +// - PACKAGE_SAME_CSHARP_NAMESPACE +// - PACKAGE_SAME_GO_PACKAGE +// - PACKAGE_SAME_JAVA_MULTIPLE_FILES +// - PACKAGE_SAME_JAVA_PACKAGE +// - PACKAGE_SAME_PHP_NAMESPACE +// - PACKAGE_SAME_RUBY_PACKAGE +// - PACKAGE_SAME_SWIFT_PREFIX +// +// With these changes applied, the final result of MINIMAL is: +// +// MINIMAL: +// - DIRECTORY_SAME_PACKAGE +// - PACKAGE_DEFINED +// - PACKAGE_DIRECTORY_MATCH +// - PACKAGE_SAME_DIRECTORY +var VersionSpec = &internal.VersionSpec{ + RuleBuilders: v1RuleBuilders, + DefaultCategories: v1DefaultCategories, + IDToCategories: v1IDToCategories, +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/buflintv1_test.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/buflintv1_test.go new file mode 100644 index 000000000..0964580c5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/buflintv1_test.go @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflintv1 + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal/internaltesting" +) + +func TestVersionSpec(t *testing.T) { + t.Parallel() + internaltesting.RunTestVersionSpec(t, VersionSpec) +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/vars.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/vars.go new file mode 100644 index 000000000..82741f30e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1/vars.go @@ -0,0 +1,234 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflintv1 + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintbuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" +) + +var ( + // v1RuleBuilders are the rule builders. + v1RuleBuilders = []*internal.RuleBuilder{ + buflintbuild.CommentEnumRuleBuilder, + buflintbuild.CommentEnumValueRuleBuilder, + buflintbuild.CommentFieldRuleBuilder, + buflintbuild.CommentMessageRuleBuilder, + buflintbuild.CommentOneofRuleBuilder, + buflintbuild.CommentRPCRuleBuilder, + buflintbuild.CommentServiceRuleBuilder, + buflintbuild.DirectorySamePackageRuleBuilder, + buflintbuild.EnumFirstValueZeroRuleBuilder, + buflintbuild.EnumNoAllowAliasRuleBuilder, + buflintbuild.EnumPascalCaseRuleBuilder, + buflintbuild.EnumValuePrefixRuleBuilder, + buflintbuild.EnumValueUpperSnakeCaseRuleBuilder, + buflintbuild.EnumZeroValueSuffixRuleBuilder, + buflintbuild.FieldLowerSnakeCaseRuleBuilder, + buflintbuild.FileLowerSnakeCaseRuleBuilder, + buflintbuild.ImportNoPublicRuleBuilder, + buflintbuild.ImportNoWeakRuleBuilder, + buflintbuild.ImportUsedRuleBuilder, + buflintbuild.MessagePascalCaseRuleBuilder, + buflintbuild.OneofLowerSnakeCaseRuleBuilder, + buflintbuild.PackageDefinedRuleBuilder, + buflintbuild.PackageDirectoryMatchRuleBuilder, + buflintbuild.PackageLowerSnakeCaseRuleBuilder, + buflintbuild.PackageNoImportCycleRuleBuilder, + buflintbuild.PackageSameCsharpNamespaceRuleBuilder, + buflintbuild.PackageSameDirectoryRuleBuilder, + buflintbuild.PackageSameGoPackageRuleBuilder, + buflintbuild.PackageSameJavaMultipleFilesRuleBuilder, + buflintbuild.PackageSameJavaPackageRuleBuilder, + buflintbuild.PackageSamePhpNamespaceRuleBuilder, + buflintbuild.PackageSameRubyPackageRuleBuilder, + buflintbuild.PackageSameSwiftPrefixRuleBuilder, + buflintbuild.PackageVersionSuffixRuleBuilder, + buflintbuild.RPCNoClientStreamingRuleBuilder, + buflintbuild.RPCNoServerStreamingRuleBuilder, + buflintbuild.RPCPascalCaseRuleBuilder, + buflintbuild.RPCRequestResponseUniqueRuleBuilder, + buflintbuild.RPCRequestStandardNameRuleBuilder, + buflintbuild.RPCResponseStandardNameRuleBuilder, + buflintbuild.ServicePascalCaseRuleBuilder, + buflintbuild.ServiceSuffixRuleBuilder, + buflintbuild.SyntaxSpecifiedRuleBuilder, + } + + // v1DefaultCategories are the default categories. + v1DefaultCategories = []string{ + "DEFAULT", + } + // v1IDToCategories associates IDs to categories. + v1IDToCategories = map[string][]string{ + "COMMENT_ENUM": { + "COMMENTS", + }, + "COMMENT_ENUM_VALUE": { + "COMMENTS", + }, + "COMMENT_FIELD": { + "COMMENTS", + }, + "COMMENT_MESSAGE": { + "COMMENTS", + }, + "COMMENT_ONEOF": { + "COMMENTS", + }, + "COMMENT_RPC": { + "COMMENTS", + }, + "COMMENT_SERVICE": { + "COMMENTS", + }, + "DIRECTORY_SAME_PACKAGE": { + "MINIMAL", + "BASIC", + "DEFAULT", + }, + "ENUM_FIRST_VALUE_ZERO": { + "BASIC", + "DEFAULT", + }, + "ENUM_NO_ALLOW_ALIAS": { + "BASIC", + "DEFAULT", + }, + "ENUM_PASCAL_CASE": { + "BASIC", + "DEFAULT", + }, + "ENUM_VALUE_PREFIX": { + "DEFAULT", + }, + "ENUM_VALUE_UPPER_SNAKE_CASE": { + "BASIC", + "DEFAULT", + }, + "ENUM_ZERO_VALUE_SUFFIX": { + "DEFAULT", + }, + "FIELD_LOWER_SNAKE_CASE": { + "BASIC", + "DEFAULT", + }, + "FILE_LOWER_SNAKE_CASE": { + "DEFAULT", + }, + "IMPORT_NO_PUBLIC": { + "BASIC", + "DEFAULT", + }, + "IMPORT_NO_WEAK": { + "BASIC", + "DEFAULT", + }, + "IMPORT_USED": { + "BASIC", + "DEFAULT", + }, + "MESSAGE_PASCAL_CASE": { + "BASIC", + "DEFAULT", + }, + "ONEOF_LOWER_SNAKE_CASE": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_DEFINED": { + "MINIMAL", + "BASIC", + "DEFAULT", + }, + "PACKAGE_DIRECTORY_MATCH": { + "MINIMAL", + "BASIC", + "DEFAULT", + }, + "PACKAGE_LOWER_SNAKE_CASE": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_NO_IMPORT_CYCLE": {}, + "PACKAGE_SAME_CSHARP_NAMESPACE": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_SAME_DIRECTORY": { + "MINIMAL", + "BASIC", + "DEFAULT", + }, + "PACKAGE_SAME_GO_PACKAGE": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_SAME_JAVA_MULTIPLE_FILES": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_SAME_JAVA_PACKAGE": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_SAME_PHP_NAMESPACE": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_SAME_RUBY_PACKAGE": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_SAME_SWIFT_PREFIX": { + "BASIC", + "DEFAULT", + }, + "PACKAGE_VERSION_SUFFIX": { + "DEFAULT", + }, + "RPC_NO_CLIENT_STREAMING": { + "UNARY_RPC", + }, + "RPC_NO_SERVER_STREAMING": { + "UNARY_RPC", + }, + "RPC_PASCAL_CASE": { + "BASIC", + "DEFAULT", + }, + "RPC_REQUEST_RESPONSE_UNIQUE": { + "DEFAULT", + }, + "RPC_REQUEST_STANDARD_NAME": { + "DEFAULT", + }, + "RPC_RESPONSE_STANDARD_NAME": { + "DEFAULT", + }, + "SERVICE_PASCAL_CASE": { + "BASIC", + "DEFAULT", + }, + "SERVICE_SUFFIX": { + "DEFAULT", + }, + "SYNTAX_SPECIFIED": { + "BASIC", + "DEFAULT", + }, + } +) diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/buflintv1beta1.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/buflintv1beta1.go new file mode 100644 index 000000000..205efb73e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/buflintv1beta1.go @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package buflintv1beta1 contains the VersionSpec for v1beta1. +// +// It uses buflintcheck and buflintbuild. +package buflintv1beta1 + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + +// VersionSpec is the version specification for v1beta1. +var VersionSpec = &internal.VersionSpec{ + RuleBuilders: v1beta1RuleBuilders, + DefaultCategories: v1beta1DefaultCategories, + IDToCategories: v1beta1IDToCategories, +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/buflintv1beta1_test.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/buflintv1beta1_test.go new file mode 100644 index 000000000..f66168b7a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/buflintv1beta1_test.go @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflintv1beta1 + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal/internaltesting" +) + +func TestVersionSpec(t *testing.T) { + t.Parallel() + internaltesting.RunTestVersionSpec(t, VersionSpec) +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/vars.go b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/vars.go new file mode 100644 index 000000000..8fe10037a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintv1beta1/vars.go @@ -0,0 +1,276 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflintv1beta1 + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/internal/buflintbuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" +) + +var ( + // v1beta1RuleBuilders are the rule builders. + v1beta1RuleBuilders = []*internal.RuleBuilder{ + buflintbuild.CommentEnumRuleBuilder, + buflintbuild.CommentEnumValueRuleBuilder, + buflintbuild.CommentFieldRuleBuilder, + buflintbuild.CommentMessageRuleBuilder, + buflintbuild.CommentOneofRuleBuilder, + buflintbuild.CommentRPCRuleBuilder, + buflintbuild.CommentServiceRuleBuilder, + buflintbuild.DirectorySamePackageRuleBuilder, + buflintbuild.EnumFirstValueZeroRuleBuilder, + buflintbuild.EnumNoAllowAliasRuleBuilder, + buflintbuild.EnumPascalCaseRuleBuilder, + buflintbuild.EnumValuePrefixRuleBuilder, + buflintbuild.EnumValueUpperSnakeCaseRuleBuilder, + buflintbuild.EnumZeroValueSuffixRuleBuilder, + buflintbuild.FieldLowerSnakeCaseRuleBuilder, + buflintbuild.FieldNoDescriptorRuleBuilder, + buflintbuild.FileLowerSnakeCaseRuleBuilder, + buflintbuild.ImportNoPublicRuleBuilder, + buflintbuild.ImportNoWeakRuleBuilder, + buflintbuild.MessagePascalCaseRuleBuilder, + buflintbuild.OneofLowerSnakeCaseRuleBuilder, + buflintbuild.PackageDefinedRuleBuilder, + buflintbuild.PackageDirectoryMatchRuleBuilder, + buflintbuild.PackageLowerSnakeCaseRuleBuilder, + buflintbuild.PackageSameCsharpNamespaceRuleBuilder, + buflintbuild.PackageSameDirectoryRuleBuilder, + buflintbuild.PackageSameGoPackageRuleBuilder, + buflintbuild.PackageSameJavaMultipleFilesRuleBuilder, + buflintbuild.PackageSameJavaPackageRuleBuilder, + buflintbuild.PackageSamePhpNamespaceRuleBuilder, + buflintbuild.PackageSameRubyPackageRuleBuilder, + buflintbuild.PackageSameSwiftPrefixRuleBuilder, + buflintbuild.PackageVersionSuffixRuleBuilder, + buflintbuild.RPCNoClientStreamingRuleBuilder, + buflintbuild.RPCNoServerStreamingRuleBuilder, + buflintbuild.RPCPascalCaseRuleBuilder, + buflintbuild.RPCRequestResponseUniqueRuleBuilder, + buflintbuild.RPCRequestStandardNameRuleBuilder, + buflintbuild.RPCResponseStandardNameRuleBuilder, + buflintbuild.ServicePascalCaseRuleBuilder, + buflintbuild.ServiceSuffixRuleBuilder, + } + + // v1beta1DefaultCategories are the default categories. + v1beta1DefaultCategories = []string{ + "DEFAULT", + } + // v1beta1IDToCategories associates IDs to categories. + v1beta1IDToCategories = map[string][]string{ + "COMMENT_ENUM": { + "COMMENTS", + }, + "COMMENT_ENUM_VALUE": { + "COMMENTS", + }, + "COMMENT_FIELD": { + "COMMENTS", + }, + "COMMENT_MESSAGE": { + "COMMENTS", + }, + "COMMENT_ONEOF": { + "COMMENTS", + }, + "COMMENT_RPC": { + "COMMENTS", + }, + "COMMENT_SERVICE": { + "COMMENTS", + }, + "DIRECTORY_SAME_PACKAGE": { + "MINIMAL", + "BASIC", + "DEFAULT", + "FILE_LAYOUT", + }, + "ENUM_FIRST_VALUE_ZERO": { + "OTHER", + }, + "ENUM_NO_ALLOW_ALIAS": { + "MINIMAL", + "BASIC", + "DEFAULT", + "SENSIBLE", + }, + "ENUM_PASCAL_CASE": { + "BASIC", + "DEFAULT", + "STYLE_BASIC", + "STYLE_DEFAULT", + }, + "ENUM_VALUE_PREFIX": { + "DEFAULT", + "STYLE_DEFAULT", + }, + "ENUM_VALUE_UPPER_SNAKE_CASE": { + "BASIC", + "DEFAULT", + "STYLE_BASIC", + "STYLE_DEFAULT", + }, + "ENUM_ZERO_VALUE_SUFFIX": { + "DEFAULT", + "STYLE_DEFAULT", + }, + "FIELD_LOWER_SNAKE_CASE": { + "BASIC", + "DEFAULT", + "STYLE_BASIC", + "STYLE_DEFAULT", + }, + "FIELD_NO_DESCRIPTOR": { + "MINIMAL", + "BASIC", + "DEFAULT", + "SENSIBLE", + }, + "FILE_LOWER_SNAKE_CASE": { + "DEFAULT", + "STYLE_DEFAULT", + }, + "IMPORT_NO_PUBLIC": { + "MINIMAL", + "BASIC", + "DEFAULT", + "SENSIBLE", + }, + "IMPORT_NO_WEAK": { + "MINIMAL", + "BASIC", + "DEFAULT", + "SENSIBLE", + }, + "MESSAGE_PASCAL_CASE": { + "BASIC", + "DEFAULT", + "STYLE_BASIC", + "STYLE_DEFAULT", + }, + "ONEOF_LOWER_SNAKE_CASE": { + "BASIC", + "DEFAULT", + "STYLE_BASIC", + "STYLE_DEFAULT", + }, + "PACKAGE_DEFINED": { + "MINIMAL", + "BASIC", + "DEFAULT", + "SENSIBLE", + }, + "PACKAGE_DIRECTORY_MATCH": { + "MINIMAL", + "BASIC", + "DEFAULT", + "FILE_LAYOUT", + }, + "PACKAGE_LOWER_SNAKE_CASE": { + "BASIC", + "DEFAULT", + "STYLE_BASIC", + "STYLE_DEFAULT", + }, + "PACKAGE_SAME_CSHARP_NAMESPACE": { + "MINIMAL", + "BASIC", + "DEFAULT", + "PACKAGE_AFFINITY", + }, + "PACKAGE_SAME_DIRECTORY": { + "MINIMAL", + "BASIC", + "DEFAULT", + "FILE_LAYOUT", + }, + "PACKAGE_SAME_GO_PACKAGE": { + "MINIMAL", + "BASIC", + "DEFAULT", + "PACKAGE_AFFINITY", + }, + "PACKAGE_SAME_JAVA_MULTIPLE_FILES": { + "MINIMAL", + "BASIC", + "DEFAULT", + "PACKAGE_AFFINITY", + }, + "PACKAGE_SAME_JAVA_PACKAGE": { + "MINIMAL", + "BASIC", + "DEFAULT", + "PACKAGE_AFFINITY", + }, + "PACKAGE_SAME_PHP_NAMESPACE": { + "MINIMAL", + "BASIC", + "DEFAULT", + "PACKAGE_AFFINITY", + }, + "PACKAGE_SAME_RUBY_PACKAGE": { + "MINIMAL", + "BASIC", + "DEFAULT", + "PACKAGE_AFFINITY", + }, + "PACKAGE_SAME_SWIFT_PREFIX": { + "MINIMAL", + "BASIC", + "DEFAULT", + "PACKAGE_AFFINITY", + }, + "PACKAGE_VERSION_SUFFIX": { + "DEFAULT", + "STYLE_DEFAULT", + }, + "RPC_NO_CLIENT_STREAMING": { + "UNARY_RPC", + }, + "RPC_NO_SERVER_STREAMING": { + "UNARY_RPC", + }, + "RPC_PASCAL_CASE": { + "BASIC", + "DEFAULT", + "STYLE_BASIC", + "STYLE_DEFAULT", + }, + "RPC_REQUEST_RESPONSE_UNIQUE": { + "DEFAULT", + "STYLE_DEFAULT", + }, + "RPC_REQUEST_STANDARD_NAME": { + "DEFAULT", + "STYLE_DEFAULT", + }, + "RPC_RESPONSE_STANDARD_NAME": { + "DEFAULT", + "STYLE_DEFAULT", + }, + "SERVICE_PASCAL_CASE": { + "BASIC", + "DEFAULT", + "STYLE_BASIC", + "STYLE_DEFAULT", + }, + "SERVICE_SUFFIX": { + "DEFAULT", + "STYLE_DEFAULT", + }, + } +) diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/a.proto new file mode 100644 index 000000000..c2ead84fe --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/a.proto @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +// To team members: I am sorry you have to read such a bad file. +// To others: Do the opposite of whatever this file does. + +// buf:lint:ignore PACKAGE_DIRECTORY_MATCH +// buf:lint:ignore PACKAGE_LOWER_SNAKE_CASE +// buf:lint:ignore PACKAGE_VERSION_SUFFIX +package A; + +// buf:lint:ignore IMPORT_NO_PUBLIC +import public "google/protobuf/empty.proto"; + +// buf:lint:ignore ENUM_PASCAL_CASE +enum enumFoo { + // buf:lint:ignore ENUM_NO_ALLOW_ALIAS + option allow_alias = true; + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooNone = 0; + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooOne = 1; + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooTwo = 1; +} + +// buf:lint:ignore MESSAGE_PASCAL_CASE +message messageFoo { + // buf:lint:ignore MESSAGE_PASCAL_CASE + message messageBar { + // buf:lint:ignore MESSAGE_PASCAL_CASE + message messageBaz { + // buf:lint:ignore ENUM_PASCAL_CASE + enum enumFoo { + // buf:lint:ignore ENUM_NO_ALLOW_ALIAS + option allow_alias = true; + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooNone = 0; + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooOne = 1; + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooTwo = 1; + } + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Foo = 1; + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + oneof Bar { + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Baz = 2; + } + } + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Foo = 1; + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + oneof Bar { + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Baz = 2; + } + } + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Foo = 1; + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + oneof Bar { + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Baz = 2; + } +} + +// buf:lint:ignore SERVICE_PASCAL_CASE +service serviceFoo { + // buf:lint:ignore RPC_PASCAL_CASE + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + rpc methodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/b.proto new file mode 100644 index 000000000..c0ec832e0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/b.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +// buf:lint:ignore PACKAGE_DIRECTORY_MATCH +// buf:lint:ignore PACKAGE_VERSION_SUFFIX +package a; + +enum EnumFoo { + // buf:lint:ignore ENUM_FIRST_VALUE_ZERO + ENUM_FOO_UNSPECIFIED = 10; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/buf.yaml new file mode 100644 index 000000000..694bacc44 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/buf.yaml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_DIRECTORY_MATCH + - PACKAGE_LOWER_SNAKE_CASE + - PACKAGE_VERSION_SUFFIX + - IMPORT_NO_PUBLIC + - ENUM_FIRST_VALUE_ZERO + - ENUM_PASCAL_CASE + - ENUM_NO_ALLOW_ALIAS + - ENUM_ZERO_VALUE_SUFFIX + - ENUM_VALUE_UPPER_SNAKE_CASE + - MESSAGE_PASCAL_CASE + - FIELD_LOWER_SNAKE_CASE + - ONEOF_LOWER_SNAKE_CASE + - SERVICE_PASCAL_CASE + - RPC_PASCAL_CASE + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/a.proto new file mode 100644 index 000000000..870222538 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/a.proto @@ -0,0 +1,88 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +// To team members: I am sorry you have to read such a bad file. +// To others: Do the opposite of whatever this file does. + +package a; + +import "google/protobuf/empty.proto"; + +// buf:lint:ignore ENUM_PASCAL_CASE +// buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE +// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX +enum enumFoo { + // buf:lint:ignore ENUM_NO_ALLOW_ALIAS + option allow_alias = true; + enumFooNone = 0; + enumFooOne = 1; + enumFooTwo = 1; +} + +// buf:lint:ignore MESSAGE_PASCAL_CASE +// buf:lint:ignore FIELD_LOWER_SNAKE_CASE +// buf:lint:ignore ONEOF_LOWER_SNAKE_CASE +message messageFoo { + // buf:lint:ignore MESSAGE_PASCAL_CASE + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + message messageBar { + // buf:lint:ignore MESSAGE_PASCAL_CASE + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + message messageBaz { + // buf:lint:ignore ENUM_PASCAL_CASE + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enum enumFoo { + // buf:lint:ignore ENUM_NO_ALLOW_ALIAS + option allow_alias = true; + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + enumFooNone = 0; + enumFooOne = 1; + enumFooTwo = 1; + } + int64 Foo = 1; + oneof Bar { + int64 Baz = 2; + } + } + int64 Foo = 1; + oneof Bar { + int64 Baz = 2; + } + } + int64 Foo = 1; + oneof Bar { + int64 Baz = 2; + } +} + +// buf:lint:ignore SERVICE_PASCAL_CASE +// buf:lint:ignore RPC_PASCAL_CASE +// buf:lint:ignore RPC_REQUEST_STANDARD_NAME +// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME +service serviceFoo { + rpc methodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +// buf:lint:ignore SERVICE_PASCAL_CASE +service serviceBar { + // buf:lint:ignore RPC_PASCAL_CASE + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + rpc methodBar(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/b.proto new file mode 100644 index 000000000..610f74f4e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/b.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +// buf:lint:ignore PACKAGE_DIRECTORY_MATCH +// buf:lint:ignore PACKAGE_VERSION_SUFFIX +package a; + +// buf:lint:ignore ENUM_FIRST_VALUE_ZERO +enum EnumFoo { + ENUM_FOO_UNSPECIFIED = 10; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/buf.yaml new file mode 100644 index 000000000..834b2c9ac --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/buf.yaml @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ENUM_FIRST_VALUE_ZERO + - ENUM_PASCAL_CASE + - ENUM_NO_ALLOW_ALIAS + - ENUM_ZERO_VALUE_SUFFIX + - ENUM_VALUE_UPPER_SNAKE_CASE + - MESSAGE_PASCAL_CASE + - FIELD_LOWER_SNAKE_CASE + - ONEOF_LOWER_SNAKE_CASE + - SERVICE_PASCAL_CASE + - RPC_PASCAL_CASE + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/a.proto new file mode 100644 index 000000000..63a9ef92b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/a.proto @@ -0,0 +1,297 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +enum EnumFoo { + ENUM_FOO_UNSPECIFIED = 0; + ENUM_FOO_ONE = 1; +} + +message MessageFoo { + message MessageBar { + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + } + message MessageBaz { + int64 foo = 1; + oneof bar { + int64 baz = 2; + } + } + int64 foo = 1; + oneof bar { + int64 baz = 2; + } + } + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + } + int64 foo = 1; + oneof bar { + int64 baz = 2; + } +} + +service ServiceFoo { + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +// comment +enum EnumFoo2 { + // comment + ENUM_FOO2_UNSPECIFIED = 0; + // comment + ENUM_FOO2_ONE = 1; +} + +// comment +message MessageFoo2 { + // comment + message MessageBar { + // comment + enum Foo { + // comment + FOO_UNSPECIFIED = 0; + // comment + FOO_ONE = 1; + } + // comment + message MessageBaz { + // comment + int64 foo = 1; + // comment + oneof bar { + // comment + int64 baz = 2; + } + } + // comment + int64 foo = 1; + // comment + oneof bar { + // comment + int64 baz = 2; + } + } + // comment + enum Foo { + // comment + FOO_UNSPECIFIED = 0; + // comment + FOO_ONE = 1; + } + // comment + int64 foo = 1; + // comment + oneof bar { + // comment + int64 baz = 2; + } +} + +// comment +service ServiceFoo2 { + // comment + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + // comment + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); +} + +enum EnumFoo3 { + ENUM_FOO3_UNSPECIFIED = 0; // bad comment + ENUM_FOO3_ONE = 1; // bad comment +} // bad comment + +message MessageFoo3 { + message MessageBar { + enum Foo { + FOO_UNSPECIFIED = 0; // bad comment + FOO_ONE = 1; // bad comment + } // bad comment + message MessageBaz { + int64 foo = 1; // bad comment + oneof bar { // bad comment + int64 baz = 2; // bad comment + } // bad comment + } + int64 foo = 1; // bad comment + oneof bar { // bad comment + int64 baz = 2; // bad comment + } // bad comment + } // bad comment + enum Foo { // bad comment + FOO_UNSPECIFIED = 0; // bad comment + FOO_ONE = 1; // bad comment + } // bad comment + int64 foo = 1; // bad comment + oneof bar { // bad comment + int64 baz = 2; // bad comment + } // bad comment +} + +service ServiceFoo3 { + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} // bad comment + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); // bad comment +} + +// +enum EnumFoo4 { + // + ENUM_FOO4_UNSPECIFIED = 0; + // + ENUM_FOO4_ONE = 1; +} + +// +message MessageFoo4 { + // + message MessageBar { + // + enum Foo { + // + FOO_UNSPECIFIED = 0; + // + FOO_ONE = 1; + } + // + message MessageBaz { + // + int64 foo = 1; + // + oneof bar { + // + int64 baz = 2; + } + } + // + int64 foo = 1; + // + oneof bar { + // + int64 baz = 2; + } + } + // + enum Foo { + // + FOO_UNSPECIFIED = 0; + // + FOO_ONE = 1; + } + // + int64 foo = 1; + // + oneof bar { + // + int64 baz = 2; + } +} + +// +service ServiceFoo4 { + // + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + // + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); +} + +/* */ +enum EnumFoo5 { + /* */ + ENUM_FOO5_UNSPECIFIED = 0; + /* */ + ENUM_FOO5_ONE = 1; +} + +/* */ +message MessageFoo5 { + /* */ + message MessageBar { + /* */ + enum Foo { + /* */ + FOO_UNSPECIFIED = 0; + /* */ + FOO_ONE = 1; + } + /* */ + message MessageBaz { + /* */ + int64 foo = 1; + /* */ + oneof bar { + /* */ + int64 baz = 2; + } + } + /* */ + int64 foo = 1; + /* */ + oneof bar { + /* */ + int64 baz = 2; + } + } + /* */ + enum Foo { + /* */ + FOO_UNSPECIFIED = 0; + /* */ + FOO_ONE = 1; + } + /* */ + int64 foo = 1; + /* */ + oneof bar { + /* */ + int64 baz = 2; + } +} + +/* */ +service ServiceFoo5 { + /* */ + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + /* */ + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); +} + +message Baz { + map one = 1; +} + +// comment +service ServiceFoo6 { + // this method should pass lint + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE this method should fail lint + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); + //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE this method should also fail lint + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + // + rpc MethodBaz(google.protobuf.Empty) returns (google.protobuf.Empty); + //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + // this method should pass lint + rpc MethodBat(google.protobuf.Empty) returns (google.protobuf.Empty); +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/buf.yaml new file mode 100644 index 000000000..78a27778d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - COMMENTS diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/a.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/buf.yaml new file mode 100644 index 000000000..d5d4b0ca9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - DIRECTORY_SAME_PACKAGE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/c.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/c.proto new file mode 100644 index 000000000..6b49d48d1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/c.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package c; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/d.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/d.proto new file mode 100644 index 000000000..a7c098fe2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/d.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package d; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/a.proto new file mode 100644 index 000000000..c5f079809 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/a.proto @@ -0,0 +1,93 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; +} + +enum Bar { + BAR_ONE = 1; + BAR_UNSPECIFIED = 0; + BAR_TWO = 2; +} + +enum Baz { + BAZ_ONE = 1; + BAZ_UNSPECIFIED = 0; + BAZ_TWO = 2; +} + +enum Bat { + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; +} + +message One { + message Two { + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; + } + + enum Bar { + BAR_ONE = 1; + BAR_UNSPECIFIED = 0; + BAR_TWO = 2; + } + + enum Baz { + BAZ_ONE = 1; + BAZ_UNSPECIFIED = 0; + BAZ_TWO = 2; + } + + enum Bat { + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; + } + } + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; + } + + enum Bar { + BAR_ONE = 1; + BAR_UNSPECIFIED = 0; + BAR_TWO = 2; + } + + enum Baz { + BAZ_ONE = 1; + BAZ_UNSPECIFIED = 0; + BAZ_TWO = 2; + } + + enum Bat { + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/buf.yaml new file mode 100644 index 000000000..e106d8026 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ENUM_FIRST_VALUE_ZERO diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/a.proto new file mode 100644 index 000000000..ea4cf1754 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/a.proto @@ -0,0 +1,102 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; +} + +enum Bar { + option allow_alias = true; + BAR_UNSPECIFIED = 0; + BAR_ONE = 1; + BAR_TWO = 1; +} + +enum Baz { + option allow_alias = true; + BAZ_UNSPECIFIED = 0; + BAZ_ONE = 1; + BAZ_TWO = 1; +} + +enum Bat { + option allow_alias = false; + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; +} + +message One { + message Two { + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; + } + + enum Bar { + option allow_alias = true; + BAR_UNSPECIFIED = 0; + BAR_ONE = 1; + BAR_TWO = 1; + } + + enum Baz { + option allow_alias = true; + BAZ_UNSPECIFIED = 0; + BAZ_ONE = 1; + BAZ_TWO = 1; + } + + enum Bat { + option allow_alias = false; + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; + } + } + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; + } + + enum Bar { + option allow_alias = true; + BAR_UNSPECIFIED = 0; + BAR_ONE = 1; + BAR_TWO = 1; + } + + enum Baz { + option allow_alias = true; + BAZ_UNSPECIFIED = 0; + BAZ_ONE = 1; + BAZ_TWO = 1; + } + + enum Bat { + option allow_alias = false; + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/buf.yaml new file mode 100644 index 000000000..fc3248ab7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ENUM_NO_ALLOW_ALIAS diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/a.proto new file mode 100644 index 000000000..05325afe3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/a.proto @@ -0,0 +1,93 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Success { + SUCCESS_UNSPECIFIED = 0; +} + +enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; +} + +enum SuccessFOOThree { + SUCCESS_FOO_THREE_UNSPECIFIED = 0; +} +enum fail { + FAIL_UNSPECIFIED = 0; +} +enum failTwo { + FAIL_TWO_UNSPECIFIED = 0; +} +enum fail_three { + FAIL_THREE_UNSPECIFIED = 0; +} +enum Fail_four { + FAIL_FOUR_UNSPECIFIED = 0; +} + +message Foo { + message Bar { + enum Success { + SUCCESS_UNSPECIFIED = 0; + } + + enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; + } + + enum SuccessFOOThree { + SUCCESS_FOO_THREE_UNSPECIFIED = 0; + } + enum fail { + FAIL_UNSPECIFIED = 0; + } + enum failTwo { + FAIL_TWO_UNSPECIFIED = 0; + } + enum fail_three { + FAIL_THREE_UNSPECIFIED = 0; + } + enum Fail_four { + FAIL_FOUR_UNSPECIFIED = 0; + } + } + enum Success { + SUCCESS_UNSPECIFIED = 0; + } + + enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; + } + + enum SuccessFOOThree { + SUCCESS_FOO_THREE_UNSPECIFIED = 0; + } + enum fail { + FAIL_UNSPECIFIED = 0; + } + enum failTwo { + FAIL_TWO_UNSPECIFIED = 0; + } + enum fail_three { + FAIL_THREE_UNSPECIFIED = 0; + } + enum Fail_four { + FAIL_FOUR_UNSPECIFIED = 0; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/buf.yaml new file mode 100644 index 000000000..ddb71b802 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ENUM_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/a.proto new file mode 100644 index 000000000..891193ab5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/a.proto @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Test { + TEST_UNSPECIFIED = 0; + TEST_SUCCESS = 1; + TEST_SUCCESS_TWO = 2; + TEST_SUCCESS_THREE_3 = 3; + TESt_FAIL = 4; + test_FAIL_5 = 5; + test__FAIL_6 = 6; +} + +message Foo { + message Bar { + enum Test1 { + TEST1_UNSPECIFIED = 0; + TEST1_SUCCESS = 1; + TEST1_SUCCESS_TWO = 2; + TEST1_SUCCESS_THREE_3 = 3; + TESt1_FAIL = 4; + test1_FAIL_5 = 5; + test1__FAIL_6 = 6; + TEST_1_FAIL_7 = 7; + } + } + enum Test1 { + TEST1_UNSPECIFIED = 0; + TEST1_SUCCESS = 1; + TEST1_SUCCESS_TWO = 2; + TEST1_SUCCESS_THREE_3 = 3; + TESt1_FAIL = 4; + test1_FAIL_5 = 5; + test1__FAIL_6 = 6; + TEST_1_FAIL_7 = 7; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/buf.yaml new file mode 100644 index 000000000..98c0ff54e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ENUM_VALUE_PREFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/a.proto new file mode 100644 index 000000000..c03d6e1c8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/a.proto @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Test { + TEST_UNSPECIFIED = 0; + TEST_SUCCESS = 1; + TEST_SUCCESS_TWO = 2; + TEST_SUCCESS_THREE3 = 3; + TEST_FAIl = 4; + test_fail_five = 5; + testFailSix = 6; + TEST_SUCCESS_7 = 7; +} + +message Foo { + message Bar { + enum Test { + TEST_UNSPECIFIED = 0; + TEST_SUCCESS = 1; + TEST_SUCCESS_TWO = 2; + TEST_SUCCESS_THREE3 = 3; + TEST_FAIl = 4; + test_fail_five = 5; + testFailSix = 6; + TEST_SUCCESS_7 = 7; + } + } + enum Test { + TEST_UNSPECIFIED = 0; + TEST_SUCCESS = 1; + TEST_SUCCESS_TWO = 2; + TEST_SUCCESS_THREE3 = 3; + TEST_FAIl = 4; + test_fail_five = 5; + testFailSix = 6; + TEST_SUCCESS_7 = 7; + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/buf.yaml new file mode 100644 index 000000000..809f06f0a --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ENUM_VALUE_UPPER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/a.proto new file mode 100644 index 000000000..5d93433dd --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/a.proto @@ -0,0 +1,86 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Success { + SUCCESS_UNSPECIFIED = 0; +} + +enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; +} + +enum Fail { + FAILUNSPECIFIED = 0; +} + +enum FailTwo { + FAIL_TWO_UNSPECIFIEd = 0; +} + +enum FailThree { + FAIL_THREE_OTHER = 0; +} + +message Foo { + message Bar { + enum Success { + SUCCESS_UNSPECIFIED = 0; + } + + enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; + } + + enum Fail { + FAILUNSPECIFIED = 0; + } + + enum FailTwo { + FAIL_TWO_UNSPECIFIEd = 0; + } + + enum FailThree { + FAIL_THREE_OTHER = 0; + } + } + enum Success { + SUCCESS_UNSPECIFIED = 0; + } + + enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; + } + + enum Fail { + FAILUNSPECIFIED = 0; + } + + enum FailTwo { + FAIL_TWO_UNSPECIFIEd = 0; + } + + enum FailThree { + FAIL_THREE_OTHER = 0; + } +} + +enum SuccessThree { + SUCCESS_THREE_UNSPECIFIED = 0; + SUCCESS_THREE_ONE = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/buf.yaml new file mode 100644 index 000000000..e0b838967 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ENUM_ZERO_VALUE_SUFFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/a.proto new file mode 100644 index 000000000..ac0df9c05 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/a.proto @@ -0,0 +1,86 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +enum Success { + SUCCESSOTHER = 0; +} + +enum SuccessTwo { + SUCCESS_TWOOTHER = 0; +} + +enum SuccessThree { + SUCCESS_THREE_OTHER = 0; +} + +enum FailTwo { + FAIL_TWOOTHEr = 0; +} + +enum FailThree { + FAIL_TWO_UNSPECIFIED = 0; +} + +message Foo { + message Bar { + enum Success { + SUCCESSOTHER = 0; + } + + enum SuccessTwo { + SUCCESS_TWOOTHER = 0; + } + + enum SuccessThree { + SUCCESS_THREE_OTHER = 0; + } + + enum FailTwo { + FAIL_TWOOTHEr = 0; + } + + enum FailThree { + FAIL_TWO_UNSPECIFIED = 0; + } + } + enum Success { + SUCCESSOTHER = 0; + } + + enum SuccessTwo { + SUCCESS_TWOOTHER = 0; + } + + enum SuccessThree { + SUCCESS_THREE_OTHER = 0; + } + + enum FailTwo { + FAIL_TWOOTHEr = 0; + } + + enum FailThree { + FAIL_TWO_UNSPECIFIED = 0; + } +} + +enum SuccessFour { + SUCCESS_FOUROTHER = 0; + SUCCESS_FOUR_ONE = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/buf.yaml new file mode 100644 index 000000000..12527dbe1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ENUM_ZERO_VALUE_SUFFIX + enum_zero_value_suffix: OTHER diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/a.proto new file mode 100644 index 000000000..e8e416144 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/a.proto @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + int32 success = 1; + int32 success_two = 2; + int32 Fail = 3; + int32 FailTwo = 4; + int32 failThree = 5; + int32 fail_four_ = 6; + int32 _fail_five = 7; +} + +message Two { + message Three { + message Four { + int32 success = 1; + int32 success_two = 2; + int32 Fail = 3; + int32 FailTwo = 4; + int32 failThree = 5; + int32 fail_four_ = 6; + int32 _fail_five = 7; + } + int32 success = 1; + int32 success_two = 2; + int32 Fail = 3; + int32 FailTwo = 4; + int32 failThree = 5; + int32 fail_four_ = 6; + int32 _fail_five = 7; + } +} + +message Five { + int32 success1 = 1; + int32 success_2 = 2; + int32 success3_1 = 3; + int32 success_4_1 = 4; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/buf.yaml new file mode 100644 index 000000000..a54c003e7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - FIELD_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/a.proto new file mode 100644 index 000000000..a5e830d17 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/a.proto @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package a; + +message One { + optional string descriptor = 1; + optional string Descriptor = 2; + optional string descRiptor = 3; + optional string _descriptor = 4; + optional string __descriptor = 5; + optional string descriptor_ = 6; + optional string descriptor__ = 7; + optional string __descriptor__ = 8; +} + +message Two { + message Three { + message Four { + optional string descriptor = 1; + optional string Descriptor = 2; + optional string descRiptor = 3; + optional string _descriptor = 4; + optional string __descriptor = 5; + optional string descriptor_ = 6; + optional string descriptor__ = 7; + optional string __descriptor__ = 8; + } + optional string descriptor = 1; + optional string Descriptor = 2; + optional string descRiptor = 3; + optional string _descriptor = 4; + optional string __descriptor = 5; + optional string descriptor_ = 6; + optional string descriptor__ = 7; + optional string __descriptor__ = 8; + } + optional string descriptor = 1; + optional string Descriptor = 2; + optional string descRiptor = 3; + optional string _descriptor = 4; + optional string __descriptor = 5; + optional string descriptor_ = 6; + optional string descriptor__ = 7; + optional string __descriptor__ = 8; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/buf.yaml new file mode 100644 index 000000000..848f323bd --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +lint: + use: + - FIELD_NO_DESCRIPTOR diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/1.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/B.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/B.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/B.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/Foo.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/Foo.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/Foo.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/a.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.txt b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.txt new file mode 100644 index 000000000..2b5e4fb7f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.txt @@ -0,0 +1,3 @@ +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c_.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c_.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c_.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/buf.yaml new file mode 100644 index 000000000..3443ceb17 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - FILE_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/fooBar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/fooBar.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/fooBar.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf.yaml new file mode 100644 index 000000000..1bd23349d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf.yaml @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_DIRECTORY_MATCH + - ENUM_PASCAL_CASE + - FIELD_LOWER_SNAKE_CASE + - MESSAGE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar.proto new file mode 100644 index 000000000..d7da730d3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.bar; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar2.proto new file mode 100644 index 000000000..908b2c2ee --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar2.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.bar; + +message Foo2 { + int64 oneTwo = 1; +} + +message bar2 { + int64 three = 3; +} + +enum baz2 { + BAZ2_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/buf.proto new file mode 100644 index 000000000..662d5a3d6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/buf.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf; + +message Foo { + int64 oneTwo = 1; +} + +message biz { + int64 three = 3; +} + +enum buz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/bar/bar.proto new file mode 100644 index 000000000..253f120d0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/bar/bar.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo.bar; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/baz/baz.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/baz/baz.proto new file mode 100644 index 000000000..5940f22e8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/baz/baz.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo.baz; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/buf.proto new file mode 100644 index 000000000..c3995ff14 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/buf.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo; + +message Foo { + int64 oneTwo = 1; +} + +message biz { + int64 three = 3; +} + +enum buz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf.yaml new file mode 100644 index 000000000..a570f164d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf.yaml @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_DIRECTORY_MATCH + - ENUM_PASCAL_CASE + - FIELD_LOWER_SNAKE_CASE + - MESSAGE_PASCAL_CASE + ignore: + - buf/bar/bar2.proto + - buf/foo diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar.proto new file mode 100644 index 000000000..d7da730d3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.bar; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar2.proto new file mode 100644 index 000000000..908b2c2ee --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar2.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.bar; + +message Foo2 { + int64 oneTwo = 1; +} + +message bar2 { + int64 three = 3; +} + +enum baz2 { + BAZ2_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/buf.proto new file mode 100644 index 000000000..662d5a3d6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/buf.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf; + +message Foo { + int64 oneTwo = 1; +} + +message biz { + int64 three = 3; +} + +enum buz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/bar/bar.proto new file mode 100644 index 000000000..253f120d0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/bar/bar.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo.bar; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/baz/baz.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/baz/baz.proto new file mode 100644 index 000000000..5940f22e8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/baz/baz.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo.baz; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/buf.proto new file mode 100644 index 000000000..c3995ff14 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/buf.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo; + +message Foo { + int64 oneTwo = 1; +} + +message biz { + int64 three = 3; +} + +enum buz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf.yaml new file mode 100644 index 000000000..61daa4066 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf.yaml @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1beta1 +lint: + use: + - PACKAGE_DIRECTORY_MATCH + - ENUM_PASCAL_CASE + - FIELD_LOWER_SNAKE_CASE + - MESSAGE_PASCAL_CASE + ignore_only: + ENUM_PASCAL_CASE: + - buf/bar/bar.proto + - buf/foo/bar + - buf/foo/bar + MESSAGE_PASCAL_CASE: + - buf/bar/bar.proto + STYLE_BASIC: + - buf/foo/bar diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar.proto new file mode 100644 index 000000000..d7da730d3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.bar; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar2.proto new file mode 100644 index 000000000..908b2c2ee --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar2.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.bar; + +message Foo2 { + int64 oneTwo = 1; +} + +message bar2 { + int64 three = 3; +} + +enum baz2 { + BAZ2_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/buf.proto new file mode 100644 index 000000000..662d5a3d6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/buf.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf; + +message Foo { + int64 oneTwo = 1; +} + +message biz { + int64 three = 3; +} + +enum buz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/bar/bar.proto new file mode 100644 index 000000000..253f120d0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/bar/bar.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo.bar; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/baz/baz.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/baz/baz.proto new file mode 100644 index 000000000..5940f22e8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/baz/baz.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo.baz; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/buf.proto new file mode 100644 index 000000000..c3995ff14 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/buf.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo; + +message Foo { + int64 oneTwo = 1; +} + +message biz { + int64 three = 3; +} + +enum buz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf.yaml new file mode 100644 index 000000000..9e5a05da1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf.yaml @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_DIRECTORY_MATCH + - ENUM_PASCAL_CASE + - FIELD_LOWER_SNAKE_CASE + - MESSAGE_PASCAL_CASE + ignore_only: + ENUM_PASCAL_CASE: + - buf/bar/bar.proto + - buf/foo/bar + - buf/foo/bar + MESSAGE_PASCAL_CASE: + - buf/bar/bar.proto + BASIC: + - buf/foo/bar diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar.proto new file mode 100644 index 000000000..d7da730d3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.bar; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar2.proto new file mode 100644 index 000000000..908b2c2ee --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar2.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.bar; + +message Foo2 { + int64 oneTwo = 1; +} + +message bar2 { + int64 three = 3; +} + +enum baz2 { + BAZ2_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/buf.proto new file mode 100644 index 000000000..662d5a3d6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/buf.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf; + +message Foo { + int64 oneTwo = 1; +} + +message biz { + int64 three = 3; +} + +enum buz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/bar/bar.proto new file mode 100644 index 000000000..253f120d0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/bar/bar.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo.bar; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/baz/baz.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/baz/baz.proto new file mode 100644 index 000000000..5940f22e8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/baz/baz.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo.baz; + +message Foo { + int64 oneTwo = 1; +} + +message bar { + int64 three = 3; +} + +enum baz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/buf.proto new file mode 100644 index 000000000..c3995ff14 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/buf.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.foo; + +message Foo { + int64 oneTwo = 1; +} + +message biz { + int64 three = 3; +} + +enum buz { + BAZ_UNSPECIFIED = 0; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/a.proto new file mode 100644 index 000000000..bfd0c3b66 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/a.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "sub/sub1.proto"; +import public "sub/sub2.proto"; +import public "one/one.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/buf.yaml new file mode 100644 index 000000000..f5f706a74 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - IMPORT_NO_PUBLIC diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/one/one.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/one/one.proto new file mode 100644 index 000000000..25b96caa4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/one/one.proto @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package one; + +import "sub/sub1.proto"; +import public "sub/sub2.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub1.proto new file mode 100644 index 000000000..52821327f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub2.proto new file mode 100644 index 000000000..52821327f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/a.proto new file mode 100644 index 000000000..5938f9d88 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/a.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "sub/sub1.proto"; +import weak "sub/sub2.proto"; +import weak "one/one.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/buf.yaml new file mode 100644 index 000000000..d220104ab --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - IMPORT_NO_WEAK diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/one/one.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/one/one.proto new file mode 100644 index 000000000..f0694ab7e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/one/one.proto @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package one; + +import "sub/sub1.proto"; +import weak "sub/sub2.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub1.proto new file mode 100644 index 000000000..52821327f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub2.proto new file mode 100644 index 000000000..52821327f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/a.proto new file mode 100644 index 000000000..75e0340d7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/a.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "sub/sub1.proto"; +import "sub/sub2.proto"; +import "one/one.proto"; + +message A { + sub.Sub2 sub2 = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/buf.yaml new file mode 100644 index 000000000..567f1fe12 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - IMPORT_USED diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/one/one.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/one/one.proto new file mode 100644 index 000000000..cd01c5af2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/one/one.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package one; + +import "sub/sub1.proto"; +import "sub/sub2.proto"; + +message One { + sub.Sub1 sub1 = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub1.proto new file mode 100644 index 000000000..2088fd0ce --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub1.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub; + +message Sub1 {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub2.proto new file mode 100644 index 000000000..9bb433af5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub2.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package sub; + +message Sub2 {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/a.proto new file mode 100644 index 000000000..1726cbe71 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/a.proto @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Success {} +message SuccessTwo {} +message SuccessFOOThree { + message fail {} + message failTwo { + message fail_three {} + } +} + +message fail {} +message failTwo {} +message fail_three {} +message Fail_four { + message fail {} + message failTwo { + message fail_three {} + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/buf.yaml new file mode 100644 index 000000000..3f5d52cfd --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - MESSAGE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/a.proto new file mode 100644 index 000000000..f930c3db2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/a.proto @@ -0,0 +1,102 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message One { + oneof success { + int32 one = 1; + } + oneof success_two { + int32 two = 2; + } + oneof Fail { + int32 three = 3; + } + oneof FailTwo { + int32 four = 4; + } + oneof failThree { + int32 five = 5; + } + oneof fail_four_ { + int32 six = 6; + } + oneof _fail_five { + int32 seven = 7; + } +} + +message Two { + message Three { + message Four { + oneof success { + int32 one = 1; + } + oneof success_two { + int32 two = 2; + } + oneof Fail { + int32 three = 3; + } + oneof FailTwo { + int32 four = 4; + } + oneof failThree { + int32 five = 5; + } + oneof fail_four_ { + int32 six = 6; + } + oneof _fail_five { + int32 seven = 7; + } + } + oneof success { + int32 one = 1; + } + oneof success_two { + int32 two = 2; + } + oneof Fail { + int32 three = 3; + } + oneof FailTwo { + int32 four = 4; + } + oneof failThree { + int32 five = 5; + } + oneof fail_four_ { + int32 six = 6; + } + oneof _fail_five { + int32 seven = 7; + } + } +} + +// checking to see if the implicit oneof triggers the linter, which it should not +message Three { + message Four { + message Five { + optional string one = 1; + } + optional string one = 1; + } + optional string one = 1; +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/buf.yaml new file mode 100644 index 000000000..f180bee43 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - ONEOF_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/a/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/a/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/a/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/buf.yaml new file mode 100644 index 000000000..2c040708b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_DEFINED diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_c.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_c.proto new file mode 100644 index 000000000..ba26086c4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_c.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.c; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/buf.yaml new file mode 100644 index 000000000..fe8954512 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_DIRECTORY_MATCH diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/sub/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/sub/a/b/a_b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/sub/a/b/a_b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/1.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/2.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/3.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/3.proto new file mode 100644 index 000000000..7bbc98f84 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/3.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b_cde; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/4.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/4.proto new file mode 100644 index 000000000..6252e6967 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/4.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b_cde.f; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/5.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/5.proto new file mode 100644 index 000000000..2690584b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/5.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b_cdE.f; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/6.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/6.proto new file mode 100644 index 000000000..4618bbc7e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/6.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b_cde.F; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/7.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/7.proto new file mode 100644 index 000000000..bbe0e6030 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/7.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.bcde.F; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/8.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/8.proto new file mode 100644 index 000000000..7de7c3621 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/8.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b_cde.f_; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/buf.yaml new file mode 100644 index 000000000..5092f2bb7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a1.proto new file mode 100644 index 000000000..6a6b42761 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a1.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "d1.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a2.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b1.proto new file mode 100644 index 000000000..8a81a6228 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b1.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +import "c1.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b2.proto new file mode 100644 index 000000000..40d94c1b4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/buf.yaml new file mode 100644 index 000000000..1122f1c07 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_NO_IMPORT_CYCLE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c1.proto new file mode 100644 index 000000000..3b036ee60 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c1.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package c; + +import "d1.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c2.proto new file mode 100644 index 000000000..6b49d48d1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package c; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d1.proto new file mode 100644 index 000000000..15e1cdea5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d1.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package d; + +import "b2.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d2.proto new file mode 100644 index 000000000..a7c098fe2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package d; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none1.proto new file mode 100644 index 000000000..5c3453117 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "b1.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none2.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none2.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/a.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/buf.yaml new file mode 100644 index 000000000..767a9755d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_SAME_DIRECTORY diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/one/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/one/a.proto new file mode 100644 index 000000000..8184ab04f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/one/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/buf.yaml new file mode 100644 index 000000000..767a9755d --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_SAME_DIRECTORY diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/one/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/one/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/one/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/a.proto new file mode 100644 index 000000000..1e0c328a2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/a.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +option csharp_namespace = "foo"; +option java_multiple_files = true; +option java_package = "foo"; +option go_package = "foo"; +option php_namespace = "foo"; +option ruby_package = "foo"; +option swift_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/b.proto new file mode 100644 index 000000000..ce71db056 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/b.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +option csharp_namespace = "bar"; +option java_multiple_files = false; +option java_package = "bar"; +option go_package = "bar"; +option php_namespace = "bar"; +option ruby_package = "bar"; +option swift_prefix = "bar"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/buf.yaml new file mode 100644 index 000000000..ffe76f356 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/buf.yaml @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_SAME_CSHARP_NAMESPACE + - PACKAGE_SAME_GO_PACKAGE + - PACKAGE_SAME_JAVA_MULTIPLE_FILES + - PACKAGE_SAME_JAVA_PACKAGE + - PACKAGE_SAME_PHP_NAMESPACE + - PACKAGE_SAME_RUBY_PACKAGE + - PACKAGE_SAME_SWIFT_PREFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/a.proto new file mode 100644 index 000000000..f096acec4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/a.proto @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; + +// comment +option csharp_namespace = "foo"; +option java_multiple_files = true; +option java_package = "foo"; +option go_package = "foo"; +option php_namespace = "foo"; +option ruby_package = "foo"; +option swift_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/b.proto new file mode 100644 index 000000000..942b930f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/buf.yaml new file mode 100644 index 000000000..e4dbb65ee --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - PACKAGE_VERSION_SUFFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar.proto new file mode 100644 index 000000000..f6e89ffaf --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v0beta1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v0beta1.proto new file mode 100644 index 000000000..05ce82f9e --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v0beta1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.v0beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1.proto new file mode 100644 index 000000000..14d022824 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.v1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1beta1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1beta1.proto new file mode 100644 index 000000000..135f84a03 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1beta1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.v1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test.proto new file mode 100644 index 000000000..a9035a49c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.v1test; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test_foo.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test_foo.proto new file mode 100644 index 000000000..a08215c87 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test_foo.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.v1test.foo; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1testfoo.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1testfoo.proto new file mode 100644 index 000000000..530b80332 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1testfoo.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.v1testfoo; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2.proto new file mode 100644 index 000000000..3ca1eeeb4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.v2; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2beta0.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2beta0.proto new file mode 100644 index 000000000..75a357d31 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2beta0.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.v2beta0; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_vv1beta1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_vv1beta1.proto new file mode 100644 index 000000000..951928da9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_vv1beta1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.vv1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/no_package.proto new file mode 100644 index 000000000..d044523b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/no_package.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/v1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/v1.proto new file mode 100644 index 000000000..97601de87 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/v1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package v1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/a.proto new file mode 100644 index 000000000..c7ed67462 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/a.proto @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Foo { + rpc NoStreaming(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc RequestStreaming(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc ResponseStreaming(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} + rpc BothStreaming(stream google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/buf.yaml new file mode 100644 index 000000000..bafdf4aae --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_NO_CLIENT_STREAMING + - RPC_NO_SERVER_STREAMING diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/a.proto new file mode 100644 index 000000000..22fe1a42f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/a.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Foo { + rpc Success(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc SuccessTwo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc SuccessFOOThree(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc fail(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc failTwo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc fail_three(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Fail_four(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/buf.yaml new file mode 100644 index 000000000..829035ae3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/a.proto new file mode 100644 index 000000000..9403e0d4b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/a.proto @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +message One {} +message Two {} +message Three {} +message Four {} +message Five {} +message Six {} +message Seven {} +message Eight {} +message Nine {} +message Ten {} +message Eleven {} +message Twelve {} + +service Foo { + rpc On1(One) returns (Two) {} + rpc Tw2(Three) returns (Three) {} + rpc Thre3(Four) returns (One) {} + rpc Fou4(Five) returns (Six) {} + rpc Fiv5(Three) returns (Seven) {} + rpc Si6(Eight) returns (Nine) {} + rpc Seve7(google.protobuf.Empty) returns (Ten) {} + rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} + rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Te1(Twelve) returns (Twelve) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/b.proto new file mode 100644 index 000000000..295ad9ef0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/b.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +import "a.proto"; + +service Foo { + rpc Baz(a.Six) returns (a.Five) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/buf.yaml new file mode 100644 index 000000000..a0fb66039 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_REQUEST_RESPONSE_UNIQUE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/a.proto new file mode 100644 index 000000000..9403e0d4b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/a.proto @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +message One {} +message Two {} +message Three {} +message Four {} +message Five {} +message Six {} +message Seven {} +message Eight {} +message Nine {} +message Ten {} +message Eleven {} +message Twelve {} + +service Foo { + rpc On1(One) returns (Two) {} + rpc Tw2(Three) returns (Three) {} + rpc Thre3(Four) returns (One) {} + rpc Fou4(Five) returns (Six) {} + rpc Fiv5(Three) returns (Seven) {} + rpc Si6(Eight) returns (Nine) {} + rpc Seve7(google.protobuf.Empty) returns (Ten) {} + rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} + rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Te1(Twelve) returns (Twelve) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/b.proto new file mode 100644 index 000000000..295ad9ef0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/b.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +import "a.proto"; + +service Foo { + rpc Baz(a.Six) returns (a.Five) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/buf.yaml new file mode 100644 index 000000000..9f4160ecf --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_REQUEST_RESPONSE_UNIQUE + rpc_allow_google_protobuf_empty_requests: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/a.proto new file mode 100644 index 000000000..9403e0d4b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/a.proto @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +message One {} +message Two {} +message Three {} +message Four {} +message Five {} +message Six {} +message Seven {} +message Eight {} +message Nine {} +message Ten {} +message Eleven {} +message Twelve {} + +service Foo { + rpc On1(One) returns (Two) {} + rpc Tw2(Three) returns (Three) {} + rpc Thre3(Four) returns (One) {} + rpc Fou4(Five) returns (Six) {} + rpc Fiv5(Three) returns (Seven) {} + rpc Si6(Eight) returns (Nine) {} + rpc Seve7(google.protobuf.Empty) returns (Ten) {} + rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} + rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Te1(Twelve) returns (Twelve) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/b.proto new file mode 100644 index 000000000..295ad9ef0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/b.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +import "a.proto"; + +service Foo { + rpc Baz(a.Six) returns (a.Five) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/buf.yaml new file mode 100644 index 000000000..e6c28b879 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/buf.yaml @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_REQUEST_RESPONSE_UNIQUE + rpc_allow_google_protobuf_empty_requests: true + rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/a.proto new file mode 100644 index 000000000..9403e0d4b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/a.proto @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +message One {} +message Two {} +message Three {} +message Four {} +message Five {} +message Six {} +message Seven {} +message Eight {} +message Nine {} +message Ten {} +message Eleven {} +message Twelve {} + +service Foo { + rpc On1(One) returns (Two) {} + rpc Tw2(Three) returns (Three) {} + rpc Thre3(Four) returns (One) {} + rpc Fou4(Five) returns (Six) {} + rpc Fiv5(Three) returns (Seven) {} + rpc Si6(Eight) returns (Nine) {} + rpc Seve7(google.protobuf.Empty) returns (Ten) {} + rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} + rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Te1(Twelve) returns (Twelve) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/b.proto new file mode 100644 index 000000000..295ad9ef0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/b.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +import "a.proto"; + +service Foo { + rpc Baz(a.Six) returns (a.Five) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/buf.yaml new file mode 100644 index 000000000..2fdfef1f5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_REQUEST_RESPONSE_UNIQUE + rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/a.proto new file mode 100644 index 000000000..9403e0d4b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/a.proto @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +message One {} +message Two {} +message Three {} +message Four {} +message Five {} +message Six {} +message Seven {} +message Eight {} +message Nine {} +message Ten {} +message Eleven {} +message Twelve {} + +service Foo { + rpc On1(One) returns (Two) {} + rpc Tw2(Three) returns (Three) {} + rpc Thre3(Four) returns (One) {} + rpc Fou4(Five) returns (Six) {} + rpc Fiv5(Three) returns (Seven) {} + rpc Si6(Eight) returns (Nine) {} + rpc Seve7(google.protobuf.Empty) returns (Ten) {} + rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} + rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Te1(Twelve) returns (Twelve) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/b.proto new file mode 100644 index 000000000..295ad9ef0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/b.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +import "a.proto"; + +service Foo { + rpc Baz(a.Six) returns (a.Five) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/buf.yaml new file mode 100644 index 000000000..982e82275 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_REQUEST_RESPONSE_UNIQUE + rpc_allow_same_request_response: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/a.proto new file mode 100644 index 000000000..9403e0d4b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/a.proto @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +message One {} +message Two {} +message Three {} +message Four {} +message Five {} +message Six {} +message Seven {} +message Eight {} +message Nine {} +message Ten {} +message Eleven {} +message Twelve {} + +service Foo { + rpc On1(One) returns (Two) {} + rpc Tw2(Three) returns (Three) {} + rpc Thre3(Four) returns (One) {} + rpc Fou4(Five) returns (Six) {} + rpc Fiv5(Three) returns (Seven) {} + rpc Si6(Eight) returns (Nine) {} + rpc Seve7(google.protobuf.Empty) returns (Ten) {} + rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} + rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Te1(Twelve) returns (Twelve) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/b.proto new file mode 100644 index 000000000..295ad9ef0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/b.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +import "a.proto"; + +service Foo { + rpc Baz(a.Six) returns (a.Five) {} +} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/buf.yaml new file mode 100644 index 000000000..ae25b4357 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/buf.yaml @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_REQUEST_RESPONSE_UNIQUE + rpc_allow_same_request_response: true + rpc_allow_google_protobuf_empty_requests: true + rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/a.proto new file mode 100644 index 000000000..ec94fec46 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/a.proto @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Foo { + rpc Success(SuccessRequest) returns (SuccessResponse) {} + rpc AnotherSuccess(FooAnotherSuccessRequest) returns (FooAnotherSuccessResponse) {} + rpc FailRequest(Bar) returns (FailRequestResponse) {} + rpc FailResponse(FailResponseRequest) returns (Bar) {} + rpc NoAllowEmptyRequest(google.protobuf.Empty) returns (NoAllowEmptyRequestResponse) {} + rpc NoAllowEmptyResponse(NoAllowEmptyResponseRequest) returns (google.protobuf.Empty) {} +} + +message SuccessRequest {} +message SuccessResponse {} +message FooAnotherSuccessRequest {} +message FooAnotherSuccessResponse {} +message FailRequestResponse {} +message FailResponseRequest {} +message NoAllowEmptyRequestResponse {} +message NoAllowEmptyResponseRequest {} +message Bar {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/buf.yaml new file mode 100644 index 000000000..0e02b39ad --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/a.proto new file mode 100644 index 000000000..f015662a8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/a.proto @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Foo { + rpc Success(SuccessRequest) returns (SuccessResponse) {} + rpc AnotherSuccess(FooAnotherSuccessRequest) returns (FooAnotherSuccessResponse) {} + rpc FailRequest(Bar) returns (FailRequestResponse) {} + rpc FailResponse(FailResponseRequest) returns (Bar) {} + rpc AllowEmptyRequest(google.protobuf.Empty) returns (AllowEmptyRequestResponse) {} + rpc AllowEmptyResponse(AllowEmptyResponseRequest) returns (google.protobuf.Empty) {} +} + +message SuccessRequest {} +message SuccessResponse {} +message FooAnotherSuccessRequest {} +message FooAnotherSuccessResponse {} +message FailRequestResponse {} +message FailResponseRequest {} +message AllowEmptyRequestResponse {} +message AllowEmptyResponseRequest {} +message Bar {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/buf.yaml new file mode 100644 index 000000000..62cdb21ed --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/buf.yaml @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME + rpc_allow_google_protobuf_empty_requests: true + rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/a.proto new file mode 100644 index 000000000..067612dd7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/a.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +service Success {} +service SuccessTwo {} +service SuccessFOOThree {} +service fail {} +service failTwo {} +service fail_three {} +service Fail_four {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/buf.yaml new file mode 100644 index 000000000..65b46e133 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - SERVICE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/a.proto new file mode 100644 index 000000000..1f6ff4f09 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/a.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +service SuccessService {} +service SuccessTwoService {} +service SuccessThree_Service {} +service Fail {} +service FailAPI {} +service FailService_ {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/buf.yaml new file mode 100644 index 000000000..8efd01bf2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - SERVICE_SUFFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/a.proto new file mode 100644 index 000000000..79757ca87 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/a.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +service SuccessAPI {} +service SuccessTwoAPI {} +service SuccessThree_API {} +service Fail {} +service FailService {} +service FailAPI_ {} +service FailApi_ {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/buf.yaml new file mode 100644 index 000000000..f346805c0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/buf.yaml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - SERVICE_SUFFIX + service_suffix: API diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a.proto new file mode 100644 index 000000000..3fda14778 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// comment + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a2.proto new file mode 100644 index 000000000..1327f3ff9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a2.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// comment + +syntax = "proto2"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a3.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a3.proto new file mode 100644 index 000000000..d7127f36c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a3.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// comment + +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/buf.yaml new file mode 100644 index 000000000..40e596cca --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +lint: + use: + - SYNTAX_SPECIFIED diff --git a/pkg/bufman/bufpkg/bufcheck/internal/config.go b/pkg/bufman/bufpkg/bufcheck/internal/config.go new file mode 100644 index 000000000..47f7f8650 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/internal/config.go @@ -0,0 +1,324 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "fmt" + "sort" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +const ( + defaultEnumZeroValueSuffix = "_UNSPECIFIED" + defaultServiceSuffix = "Service" +) + +// Config is the check config. +type Config struct { + // Rules are the rules to run. + // + // Rules will be sorted by first categories, then id when Configs are + // created from this package, i.e. created wth ConfigBuilder.NewConfig. + Rules []*Rule + + IgnoreRootPaths map[string]struct{} + IgnoreIDToRootPaths map[string]map[string]struct{} + + AllowCommentIgnores bool + IgnoreUnstablePackages bool +} + +// ConfigBuilder is a config builder. +type ConfigBuilder struct { + Use []string + Except []string + + IgnoreRootPaths []string + IgnoreIDOrCategoryToRootPaths map[string][]string + + AllowCommentIgnores bool + IgnoreUnstablePackages bool + + EnumZeroValueSuffix string + RPCAllowSameRequestResponse bool + RPCAllowGoogleProtobufEmptyRequests bool + RPCAllowGoogleProtobufEmptyResponses bool + ServiceSuffix string +} + +// NewConfig returns a new Config. +func (b ConfigBuilder) NewConfig(versionSpec *VersionSpec) (*Config, error) { + return newConfig(b, versionSpec) +} + +func newConfig(configBuilder ConfigBuilder, versionSpec *VersionSpec) (*Config, error) { + configBuilder.Use = stringutil.SliceToUniqueSortedSliceFilterEmptyStrings(configBuilder.Use) + configBuilder.Except = stringutil.SliceToUniqueSortedSliceFilterEmptyStrings(configBuilder.Except) + if len(configBuilder.Use) == 0 { + // default behavior + configBuilder.Use = versionSpec.DefaultCategories + } + if configBuilder.EnumZeroValueSuffix == "" { + configBuilder.EnumZeroValueSuffix = defaultEnumZeroValueSuffix + } + if configBuilder.ServiceSuffix == "" { + configBuilder.ServiceSuffix = defaultServiceSuffix + } + return newConfigForRuleBuilders( + configBuilder, + versionSpec.RuleBuilders, + versionSpec.IDToCategories, + ) +} + +func newConfigForRuleBuilders( + configBuilder ConfigBuilder, + ruleBuilders []*RuleBuilder, + idToCategories map[string][]string, +) (*Config, error) { + // this checks that there are not duplicate IDs for a given revision + // which would be a system error + idToRuleBuilder, err := getIDToRuleBuilder(ruleBuilders) + if err != nil { + return nil, err + } + categoryToIDs := getCategoryToIDs(idToCategories) + useIDMap, err := transformToIDMap(configBuilder.Use, idToCategories, categoryToIDs) + if err != nil { + return nil, err + } + exceptIDMap, err := transformToIDMap(configBuilder.Except, idToCategories, categoryToIDs) + if err != nil { + return nil, err + } + + // this removes duplicates + // we already know that a given rule with the same ID is equivalent + resultIDToRuleBuilder := make(map[string]*RuleBuilder) + + for id := range useIDMap { + ruleBuilder, ok := idToRuleBuilder[id] + if !ok { + return nil, fmt.Errorf("%q is not a known id after verification", id) + } + resultIDToRuleBuilder[ruleBuilder.id] = ruleBuilder + } + for id := range exceptIDMap { + if _, ok := idToRuleBuilder[id]; !ok { + return nil, fmt.Errorf("%q is not a known id after verification", id) + } + delete(resultIDToRuleBuilder, id) + } + + resultRuleBuilders := make([]*RuleBuilder, 0, len(resultIDToRuleBuilder)) + for _, ruleBuilder := range resultIDToRuleBuilder { + resultRuleBuilders = append(resultRuleBuilders, ruleBuilder) + } + resultRules := make([]*Rule, 0, len(resultRuleBuilders)) + for _, ruleBuilder := range resultRuleBuilders { + categories, err := getRuleBuilderCategories(ruleBuilder, idToCategories) + if err != nil { + return nil, err + } + rule, err := ruleBuilder.NewRule(configBuilder, categories) + if err != nil { + return nil, err + } + resultRules = append(resultRules, rule) + } + sortRules(resultRules) + + ignoreIDToRootPathsUnnormalized, err := transformToIDToListMap(configBuilder.IgnoreIDOrCategoryToRootPaths, idToCategories, categoryToIDs) + if err != nil { + return nil, err + } + ignoreIDToRootPaths := make(map[string]map[string]struct{}) + for id, rootPaths := range ignoreIDToRootPathsUnnormalized { + for rootPath := range rootPaths { + if rootPath == "" { + continue + } + rootPath, err := normalpath.NormalizeAndValidate(rootPath) + if err != nil { + return nil, err + } + if rootPath == "." { + return nil, fmt.Errorf("cannot specify %q as an ignore path", rootPath) + } + resultRootPathMap, ok := ignoreIDToRootPaths[id] + if !ok { + resultRootPathMap = make(map[string]struct{}) + ignoreIDToRootPaths[id] = resultRootPathMap + } + resultRootPathMap[rootPath] = struct{}{} + } + } + + ignoreRootPaths := make(map[string]struct{}, len(configBuilder.IgnoreRootPaths)) + for _, rootPath := range configBuilder.IgnoreRootPaths { + if rootPath == "" { + continue + } + rootPath, err := normalpath.NormalizeAndValidate(rootPath) + if err != nil { + return nil, err + } + if rootPath == "." { + return nil, fmt.Errorf("cannot specify %q as an ignore path", rootPath) + } + ignoreRootPaths[rootPath] = struct{}{} + } + + return &Config{ + Rules: resultRules, + IgnoreIDToRootPaths: ignoreIDToRootPaths, + IgnoreRootPaths: ignoreRootPaths, + AllowCommentIgnores: configBuilder.AllowCommentIgnores, + IgnoreUnstablePackages: configBuilder.IgnoreUnstablePackages, + }, nil +} + +func transformToIDMap(idsOrCategories []string, idToCategories map[string][]string, categoryToIDs map[string][]string) (map[string]struct{}, error) { + if len(idsOrCategories) == 0 { + return nil, nil + } + idMap := make(map[string]struct{}, len(idsOrCategories)) + for _, idOrCategory := range idsOrCategories { + if idOrCategory == "" { + continue + } + if _, ok := idToCategories[idOrCategory]; ok { + id := idOrCategory + idMap[id] = struct{}{} + } else if ids, ok := categoryToIDs[idOrCategory]; ok { + for _, id := range ids { + idMap[id] = struct{}{} + } + } else { + return nil, fmt.Errorf("%q is not a known id or category", idOrCategory) + } + } + return idMap, nil +} + +func transformToIDToListMap(idOrCategoryToList map[string][]string, idToCategories map[string][]string, categoryToIDs map[string][]string) (map[string]map[string]struct{}, error) { + if len(idOrCategoryToList) == 0 { + return nil, nil + } + idToListMap := make(map[string]map[string]struct{}, len(idOrCategoryToList)) + for idOrCategory, list := range idOrCategoryToList { + if idOrCategory == "" { + continue + } + if _, ok := idToCategories[idOrCategory]; ok { + id := idOrCategory + if _, ok := idToListMap[id]; !ok { + idToListMap[id] = make(map[string]struct{}) + } + for _, elem := range list { + idToListMap[id][elem] = struct{}{} + } + } else if ids, ok := categoryToIDs[idOrCategory]; ok { + for _, id := range ids { + if _, ok := idToListMap[id]; !ok { + idToListMap[id] = make(map[string]struct{}) + } + for _, elem := range list { + idToListMap[id][elem] = struct{}{} + } + } + } else { + return nil, fmt.Errorf("%q is not a known id or category", idOrCategory) + } + } + return idToListMap, nil +} + +func getCategoryToIDs(idToCategories map[string][]string) map[string][]string { + categoryToIDs := make(map[string][]string) + for id, categories := range idToCategories { + for _, category := range categories { + // handles empty category as well + categoryToIDs[category] = append(categoryToIDs[category], id) + } + } + return categoryToIDs +} + +func getIDToRuleBuilder(ruleBuilders []*RuleBuilder) (map[string]*RuleBuilder, error) { + m := make(map[string]*RuleBuilder) + for _, ruleBuilder := range ruleBuilders { + if _, ok := m[ruleBuilder.id]; ok { + return nil, fmt.Errorf("duplicate rule ID: %q", ruleBuilder.id) + } + m[ruleBuilder.id] = ruleBuilder + } + return m, nil +} + +func getRuleBuilderCategories( + ruleBuilder *RuleBuilder, + idToCategories map[string][]string, +) ([]string, error) { + categories, ok := idToCategories[ruleBuilder.id] + if !ok { + return nil, fmt.Errorf("%q is not configured for categories", ruleBuilder.id) + } + // it is ok for categories to be empty, however the map must contain an entry + // or otherwise this is a system error + return categories, nil +} + +func sortRules(rules []*Rule) { + sort.Slice( + rules, + func(i int, j int) bool { + // categories are sorted at this point + // so we know the first category is a top-level category if present + one := rules[i] + two := rules[j] + oneCategories := one.Categories() + twoCategories := two.Categories() + if len(oneCategories) == 0 && len(twoCategories) > 0 { + return false + } + if len(oneCategories) > 0 && len(twoCategories) == 0 { + return true + } + if len(oneCategories) > 0 && len(twoCategories) > 0 { + compare := categoryCompare(oneCategories[0], twoCategories[0]) + if compare < 0 { + return true + } + if compare > 0 { + return false + } + } + oneCategoriesString := strings.Join(oneCategories, ",") + twoCategoriesString := strings.Join(twoCategories, ",") + if oneCategoriesString < twoCategoriesString { + return true + } + if oneCategoriesString > twoCategoriesString { + return false + } + return one.ID() < two.ID() + }, + ) +} diff --git a/pkg/bufman/bufpkg/bufcheck/internal/helper.go b/pkg/bufman/bufpkg/bufcheck/internal/helper.go new file mode 100644 index 000000000..81c3d8682 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/internal/helper.go @@ -0,0 +1,172 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" +) + +// Helper is a helper for rules. +type Helper struct { + id string + ignoreFunc IgnoreFunc + fileAnnotations []bufanalysis.FileAnnotation +} + +// NewHelper returns a new Helper for the given id. +func NewHelper(id string, ignoreFunc IgnoreFunc) *Helper { + return &Helper{ + id: id, + ignoreFunc: ignoreFunc, + } +} + +// AddFileAnnotationf adds a FileAnnotation with the id as the Type. +// +// If descriptor is nil, no filename information is added. +// If location is nil, no line or column information will be added. +func (h *Helper) AddFileAnnotationf( + descriptor protosource.Descriptor, + location protosource.Location, + format string, + args ...interface{}, +) { + h.addFileAnnotationf( + descriptor, + nil, + location, + nil, + format, + args..., + ) +} + +// AddFileAnnotationWithExtraIgnoreDescriptorsf adds a FileAnnotation with the id as the Type. +// +// extraIgnoreDescriptors are extra desciptors to check for ignores. +// +// If descriptor is nil, no filename information is added. +// If location is nil, no line or column information will be added. +func (h *Helper) AddFileAnnotationWithExtraIgnoreDescriptorsf( + descriptor protosource.Descriptor, + extraIgnoreDescriptors []protosource.Descriptor, + location protosource.Location, + format string, + args ...interface{}, +) { + h.addFileAnnotationf( + descriptor, + extraIgnoreDescriptors, + location, + nil, + format, + args..., + ) +} + +// AddFileAnnotationWithExtraIgnoreLocationsf adds a FileAnnotation with the id as the Type. +// +// extraIgnoreLocations are extra locations to check for comment ignores. +// +// If descriptor is nil, no filename information is added. +// If location is nil, no line or column information will be added. +func (h *Helper) AddFileAnnotationWithExtraIgnoreLocationsf( + descriptor protosource.Descriptor, + location protosource.Location, + extraIgnoreLocations []protosource.Location, + format string, + args ...interface{}, +) { + h.addFileAnnotationf( + descriptor, + nil, + location, + extraIgnoreLocations, + format, + args..., + ) +} + +func (h *Helper) addFileAnnotationf( + descriptor protosource.Descriptor, + extraIgnoreDescriptors []protosource.Descriptor, + location protosource.Location, + extraIgnoreLocations []protosource.Location, + format string, + args ...interface{}, +) { + if h.ignoreFunc != nil && h.ignoreFunc( + h.id, + append([]protosource.Descriptor{descriptor}, extraIgnoreDescriptors...), + append([]protosource.Location{location}, extraIgnoreLocations...), + ) { + return + } + h.fileAnnotations = append( + h.fileAnnotations, + newFileAnnotationf( + h.id, + descriptor, + location, + format, + args..., + ), + ) +} + +// FileAnnotations returns the added FileAnnotations. +func (h *Helper) FileAnnotations() []bufanalysis.FileAnnotation { + return h.fileAnnotations +} + +// newFileAnnotationf adds a FileAnnotation with the id as the Type. +// +// If descriptor is nil, no filename information is added. +// If location is nil, no line or column information will be added. +func newFileAnnotationf( + id string, + descriptor protosource.Descriptor, + location protosource.Location, + format string, + args ...interface{}, +) bufanalysis.FileAnnotation { + startLine := 0 + startColumn := 0 + endLine := 0 + endColumn := 0 + if location != nil { + startLine = location.StartLine() + startColumn = location.StartColumn() + endLine = location.EndLine() + endColumn = location.EndColumn() + } + var fileInfo bufanalysis.FileInfo + if descriptor != nil { + fileInfo = descriptor.File() + } + return bufanalysis.NewFileAnnotation( + fileInfo, + startLine, + startColumn, + endLine, + endColumn, + id, + fmt.Sprintf(format, args...), + ) +} diff --git a/pkg/bufman/bufpkg/bufcheck/internal/internaltesting/internaltesting.go b/pkg/bufman/bufpkg/bufcheck/internal/internaltesting/internaltesting.go new file mode 100644 index 000000000..463e79989 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/internal/internaltesting/internaltesting.go @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltesting + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "github.com/stretchr/testify/assert" +) + +// RunTestVersionSpec tests the VersionSpec. +func RunTestVersionSpec(t *testing.T, versionSpec *internal.VersionSpec) { + runTestDefaultConfigBuilder(t, versionSpec) + runTestRuleBuilders(t, versionSpec) +} + +func runTestDefaultConfigBuilder(t *testing.T, versionSpec *internal.VersionSpec) { + _, err := internal.ConfigBuilder{}.NewConfig(versionSpec) + assert.NoError(t, err) +} + +func runTestRuleBuilders(t *testing.T, versionSpec *internal.VersionSpec) { + idsMap := make(map[string]struct{}, len(versionSpec.RuleBuilders)) + for _, ruleBuilder := range versionSpec.RuleBuilders { + _, ok := idsMap[ruleBuilder.ID()] + assert.False(t, ok, "duplicated id %q", ruleBuilder.ID()) + idsMap[ruleBuilder.ID()] = struct{}{} + } + for id := range idsMap { + expectedID := stringutil.ToUpperSnakeCase(id) + assert.Equal(t, expectedID, id) + categories, ok := versionSpec.IDToCategories[id] + assert.True(t, ok, "id %q categories are not configured", id) + for _, category := range categories { + expectedCategory := stringutil.ToUpperSnakeCase(category) + assert.Equal(t, expectedCategory, category) + } + } + for id := range versionSpec.IDToCategories { + _, ok := idsMap[id] + assert.True(t, ok, "id %q configured in categories is not added to ruleBuilders", id) + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/internal/rule.go b/pkg/bufman/bufpkg/bufcheck/internal/rule.go new file mode 100644 index 000000000..16697360c --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/internal/rule.go @@ -0,0 +1,104 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "encoding/json" + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" +) + +// IgnoreFunc is an ignore function. +// +// Descriptors are the descriptors to check for ignores. +// Sometimes we have multiple descriptors, such as when we want to check previous +// file descriptors, or if an entire package is deleted. +// +// Locations are the locations to check for comment ignores. +// Sometimes, we have multiple locations to check, for example with RPC_REQUEST_STANDARD_NAME +// and RPC_RESPONSE_STANDARD_NAME, we want to check both the input/output type, and the method. +// +// Any descriptor or location may be nil. +type IgnoreFunc func(id string, descriptors []protosource.Descriptor, locations []protosource.Location) bool + +// CheckFunc is a check function. +type CheckFunc func(id string, ignoreFunc IgnoreFunc, previousFiles []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) + +// Rule provides a base embeddable rule. +type Rule struct { + id string + categories []string + purpose string + checkFunc CheckFunc +} + +// newRule returns a new Rule. +// +// Categories will be sorted and purpose will have "Checks that " +// prepended and "." appended. +func newRule( + id string, + categories []string, + purpose string, + checkFunc CheckFunc, +) *Rule { + c := make([]string, len(categories)) + copy(c, categories) + sort.Slice( + c, + func(i int, j int) bool { + return categoryLess(c[i], c[j]) + }, + ) + return &Rule{ + id: id, + categories: c, + purpose: "Checks that " + purpose + ".", + checkFunc: checkFunc, + } +} + +// ID implements Rule. +func (c *Rule) ID() string { + return c.id +} + +// Categories implements Rule. +func (c *Rule) Categories() []string { + return c.categories +} + +// Purpose implements Rule. +func (c *Rule) Purpose() string { + return c.purpose +} + +// MarshalJSON implements Rule. +func (c *Rule) MarshalJSON() ([]byte, error) { + return json.Marshal(ruleJSON{ID: c.id, Categories: c.categories, Purpose: c.purpose}) +} + +func (c *Rule) check(ignoreFunc IgnoreFunc, previousFiles []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + return c.checkFunc(c.ID(), ignoreFunc, previousFiles, files) +} + +type ruleJSON struct { + ID string `json:"id" yaml:"id"` + Categories []string `json:"categories" yaml:"categories"` + Purpose string `json:"purpose" yaml:"purpose"` +} diff --git a/pkg/bufman/bufpkg/bufcheck/internal/rule_builder.go b/pkg/bufman/bufpkg/bufcheck/internal/rule_builder.go new file mode 100644 index 000000000..f9c2f4667 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/internal/rule_builder.go @@ -0,0 +1,97 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" +) + +// RuleBuilder is a rule builder. +type RuleBuilder struct { + id string + newPurpose func(ConfigBuilder) (string, error) + newCheck func(ConfigBuilder) (CheckFunc, error) +} + +// NewRuleBuilder returns a new RuleBuilder. +func NewRuleBuilder( + id string, + newPurpose func(ConfigBuilder) (string, error), + newCheck func(ConfigBuilder) (CheckFunc, error), +) *RuleBuilder { + return &RuleBuilder{ + id: id, + newPurpose: newPurpose, + newCheck: newCheck, + } +} + +// NewNopRuleBuilder returns a new RuleBuilder for the direct +// purpose and CheckFunc. +func NewNopRuleBuilder( + id string, + purpose string, + checkFunc CheckFunc, +) *RuleBuilder { + return NewRuleBuilder( + id, + newNopPurpose(purpose), + newNopCheckFunc(checkFunc), + ) +} + +// NewRule returns a new Rule. +// +// Categories will be sorted and Purpose will be prepended with "Checks that " +// and appended with ".". +// +// Categories is an actual copy from the ruleBuilder. +func (c *RuleBuilder) NewRule(configBuilder ConfigBuilder, categories []string) (*Rule, error) { + purpose, err := c.newPurpose(configBuilder) + if err != nil { + return nil, err + } + check, err := c.newCheck(configBuilder) + if err != nil { + return nil, err + } + return newRule( + c.id, + categories, + purpose, + check, + ), nil +} + +// ID returns the id. +func (c *RuleBuilder) ID() string { + return c.id +} + +func newNopPurpose(purpose string) func(ConfigBuilder) (string, error) { + return func(ConfigBuilder) (string, error) { + return purpose, nil + } +} + +func newNopCheckFunc( + f func(string, IgnoreFunc, []protosource.File, []protosource.File) ([]bufanalysis.FileAnnotation, error), +) func(ConfigBuilder) (CheckFunc, error) { + return func(ConfigBuilder) (CheckFunc, error) { + return f, nil + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/internal/runner.go b/pkg/bufman/bufpkg/bufcheck/internal/runner.go new file mode 100644 index 000000000..c3421412b --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/internal/runner.go @@ -0,0 +1,205 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "context" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoversion" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.uber.org/multierr" + "go.uber.org/zap" +) + +const ( + tracerName = "bufbuild/buf" +) + +// Runner is a runner. +type Runner struct { + logger *zap.Logger + ignorePrefix string + tracer trace.Tracer +} + +// NewRunner returns a new Runner. +func NewRunner(logger *zap.Logger, options ...RunnerOption) *Runner { + runner := &Runner{ + logger: logger, + tracer: otel.GetTracerProvider().Tracer(tracerName), + } + for _, option := range options { + option(runner) + } + return runner +} + +// RunnerOption is an option for a new Runner. +type RunnerOption func(*Runner) + +// RunnerWithIgnorePrefix returns a new RunnerOption that sets the comment ignore prefix. +// +// This will result in failures where the location has "ignore_prefix id" in the leading +// comment being ignored. +// +// The default is to not enable comment ignores. +func RunnerWithIgnorePrefix(ignorePrefix string) RunnerOption { + return func(runner *Runner) { + runner.ignorePrefix = ignorePrefix + } +} + +// Check runs the Rules. +func (r *Runner) Check(ctx context.Context, config *Config, previousFiles []protosource.File, files []protosource.File) ([]bufanalysis.FileAnnotation, error) { + rules := config.Rules + if len(rules) == 0 { + return nil, nil + } + ctx, span := r.tracer.Start(ctx, "check", trace.WithAttributes( + attribute.Key("num_files").Int(len(files)), + attribute.Key("num_rules").Int(len(rules)), + )) + defer span.End() + + ignoreFunc := r.newIgnoreFunc(config) + var fileAnnotations []bufanalysis.FileAnnotation + resultC := make(chan *result, len(rules)) + for _, rule := range rules { + rule := rule + go func() { + iFileAnnotations, iErr := rule.check(ignoreFunc, previousFiles, files) + resultC <- newResult(iFileAnnotations, iErr) + }() + } + var err error + for i := 0; i < len(rules); i++ { + select { + case <-ctx.Done(): + return nil, ctx.Err() + case result := <-resultC: + fileAnnotations = append(fileAnnotations, result.FileAnnotations...) + err = multierr.Append(err, result.Err) + } + } + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return nil, err + } + bufanalysis.SortFileAnnotations(fileAnnotations) + return fileAnnotations, nil +} + +func (r *Runner) newIgnoreFunc(config *Config) IgnoreFunc { + return func(id string, descriptors []protosource.Descriptor, locations []protosource.Location) bool { + if idIsIgnored(id, descriptors, config) { + return true + } + // if ignorePrefix is empty, comment ignores are not enabled for the runner + // this is the case with breaking changes + if r.ignorePrefix != "" && config.AllowCommentIgnores && + locationsAreIgnored(id, r.ignorePrefix, locations, config) { + return true + } + if config.IgnoreUnstablePackages { + for _, descriptor := range descriptors { + if descriptorPackageIsUnstable(descriptor) { + return true + } + } + } + return false + } +} + +func idIsIgnored(id string, descriptors []protosource.Descriptor, config *Config) bool { + for _, descriptor := range descriptors { + // OR of descriptors + if idIsIgnoredForDescriptor(id, descriptor, config) { + return true + } + } + return false +} + +func idIsIgnoredForDescriptor(id string, descriptor protosource.Descriptor, config *Config) bool { + if descriptor == nil { + return false + } + path := descriptor.File().Path() + if normalpath.MapHasEqualOrContainingPath(config.IgnoreRootPaths, path, normalpath.Relative) { + return true + } + if id == "" { + return false + } + ignoreRootPaths, ok := config.IgnoreIDToRootPaths[id] + if !ok { + return false + } + return normalpath.MapHasEqualOrContainingPath(ignoreRootPaths, path, normalpath.Relative) +} + +func locationsAreIgnored(id string, ignorePrefix string, locations []protosource.Location, config *Config) bool { + // we already check that ignorePrefix is non-empty, but just doing here for safety + if id == "" || ignorePrefix == "" { + return false + } + fullIgnorePrefix := ignorePrefix + " " + id + for _, location := range locations { + if location != nil { + if leadingComments := location.LeadingComments(); leadingComments != "" { + for _, line := range stringutil.SplitTrimLinesNoEmpty(leadingComments) { + if strings.HasPrefix(line, fullIgnorePrefix) { + return true + } + } + } + } + } + return false +} + +func descriptorPackageIsUnstable(descriptor protosource.Descriptor) bool { + if descriptor == nil { + return false + } + packageVersion, ok := protoversion.NewPackageVersionForPackage(descriptor.File().Package()) + if !ok { + return false + } + return packageVersion.StabilityLevel() != protoversion.StabilityLevelStable +} + +type result struct { + FileAnnotations []bufanalysis.FileAnnotation + Err error +} + +func newResult(fileAnnotations []bufanalysis.FileAnnotation, err error) *result { + return &result{ + FileAnnotations: fileAnnotations, + Err: err, + } +} diff --git a/pkg/bufman/bufpkg/bufcheck/internal/vars.go b/pkg/bufman/bufpkg/bufcheck/internal/vars.go new file mode 100644 index 000000000..49354617f --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/internal/vars.go @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// priority 1 is higher than priority two +var topLevelCategoryToPriority = map[string]int{ + "MINIMAL": 1, + "BASIC": 2, + "DEFAULT": 3, + "COMMENTS": 4, + "UNARY_RPC": 5, + "OTHER": 6, + "FILE": 1, + "PACKAGE": 2, + "WIRE_JSON": 3, + "WIRE": 4, +} + +func categoryLess(one string, two string) bool { + return categoryCompare(one, two) < 0 +} + +func categoryCompare(one string, two string) int { + onePriority, oneIsTopLevel := topLevelCategoryToPriority[one] + twoPriority, twoIsTopLevel := topLevelCategoryToPriority[two] + if oneIsTopLevel && !twoIsTopLevel { + return -1 + } + if !oneIsTopLevel && twoIsTopLevel { + return 1 + } + if oneIsTopLevel && twoIsTopLevel { + if onePriority < twoPriority { + return -1 + } + if onePriority > twoPriority { + return 1 + } + } + if one < two { + return -1 + } + if one > two { + return 1 + } + return 0 +} diff --git a/pkg/bufman/bufpkg/bufcheck/internal/version_spec.go b/pkg/bufman/bufpkg/bufcheck/internal/version_spec.go new file mode 100644 index 000000000..58a9373f9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufcheck/internal/version_spec.go @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +// VersionSpec specifies the rules, ids, and categories for a given version. +type VersionSpec struct { + RuleBuilders []*RuleBuilder + DefaultCategories []string + // May include IDs without any categories. + // To get all categories, use AllCategoriesForVersionSpec. + IDToCategories map[string][]string +} + +// AllCategoriesForVersionSpec returns all categories for the VersionSpec. +// +// Sorted by category priority. +func AllCategoriesForVersionSpec(versionSpec *VersionSpec) []string { + categoriesMap := make(map[string]struct{}) + for _, categories := range versionSpec.IDToCategories { + for _, category := range categories { + categoriesMap[category] = struct{}{} + } + } + categories := stringutil.MapToSlice(categoriesMap) + sort.Slice( + categories, + func(i int, j int) bool { + return categoryLess(categories[i], categories[j]) + }, + ) + return categories +} + +// AllIDsForVersionSpec returns all ids for the VersionSpec. +// +// Sorted lexographically. +func AllIDsForVersionSpec(versionSpec *VersionSpec) []string { + m := make(map[string]struct{}) + for id := range versionSpec.IDToCategories { + m[id] = struct{}{} + } + return stringutil.MapToSortedSlice(m) +} + +// AllCategoriesAndIDsForVersionSpec returns all categories and rules for the VersionSpec. +// +// Sorted lexographically. +func AllCategoriesAndIDsForVersionSpec(versionSpec *VersionSpec) []string { + m := make(map[string]struct{}) + for id, categories := range versionSpec.IDToCategories { + m[id] = struct{}{} + for _, category := range categories { + m[category] = struct{}{} + } + } + return stringutil.MapToSortedSlice(m) +} diff --git a/pkg/bufman/bufpkg/bufconfig/bufconfig.go b/pkg/bufman/bufpkg/bufconfig/bufconfig.go new file mode 100644 index 000000000..91d54e467 --- /dev/null +++ b/pkg/bufman/bufpkg/bufconfig/bufconfig.go @@ -0,0 +1,261 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufconfig contains the configuration functionality. +package bufconfig + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +const ( + // ExternalConfigV1FilePath is the default configuration file path. + ExternalConfigV1FilePath = "buf.yaml" + + // ExternalConfigV1Beta1FilePath is the v1beta1 file path. + ExternalConfigV1Beta1FilePath = "buf.yaml" + + // V1Version is the v1 version. + V1Version = "v1" + + // V1Beta1Version is the v1beta1 version. + V1Beta1Version = "v1beta1" + + // backupExternalConfigV1FilePath is another acceptable configuration file path for v1. + // + // Originally we thought we were going to move to buf.mod, and had this around for + // a while, but then reverted back to buf.yaml. We still need to support buf.mod as + // we released with it, however. + backupExternalConfigV1FilePath = "buf.mod" +) + +var ( + // All versions are all the versions in order. + AllVersions = []string{ + V1Beta1Version, + V1Version, + } + + // AllConfigFilePaths are all acceptable config file paths without overrides. + // + // These are in the order we should check. + AllConfigFilePaths = []string{ + ExternalConfigV1FilePath, + backupExternalConfigV1FilePath, + } +) + +// Config is the user config. +type Config struct { + Version string + ModuleIdentity bufmoduleref.ModuleIdentity + Build *bufmoduleconfig.Config + Breaking *bufbreakingconfig.Config + Lint *buflintconfig.Config +} + +// GetConfigForBucket gets the Config for the YAML data at ConfigFilePath. +// +// If the data is of length 0, returns the default config. +func GetConfigForBucket(ctx context.Context, readBucket storage.ReadBucket) (*Config, error) { + return getConfigForBucket(ctx, readBucket) +} + +// GetConfigForData gets the Config for the given JSON or YAML data. +// +// If the data is of length 0, returns the default config. +func GetConfigForData(ctx context.Context, data []byte) (*Config, error) { + return getConfigForData(ctx, data) +} + +// WriteConfig writes an initial configuration file into the bucket. +func WriteConfig( + ctx context.Context, + writeBucket storage.WriteBucket, + options ...WriteConfigOption, +) error { + return writeConfig( + ctx, + writeBucket, + options..., + ) +} + +// WriteConfigOption is an option for WriteConfig. +type WriteConfigOption func(*writeConfigOptions) + +// WriteConfigWithDocumentationComments returns a new WriteConfigOption that documents the resulting configuration file. +func WriteConfigWithDocumentationComments() WriteConfigOption { + return func(writeConfigOptions *writeConfigOptions) { + writeConfigOptions.documentationComments = true + } +} + +// WriteConfigWithUncomment returns a new WriteConfigOption that uncomments the resulting configuration file +// options that are commented out by default. +// +// If this option is used, WriteConfigWithDocumentationComments must also be used. +func WriteConfigWithUncomment() WriteConfigOption { + return func(writeConfigOptions *writeConfigOptions) { + writeConfigOptions.uncomment = true + } +} + +// WriteConfigWithModuleIdentity returns a new WriteConfigOption that sets the name of the +// module to the given ModuleIdentity. +// +// The default is to not set the name. +// +// Only use in tests. +func WriteConfigWithModuleIdentity(moduleIdentity bufmoduleref.ModuleIdentity) WriteConfigOption { + return func(writeConfigOptions *writeConfigOptions) { + writeConfigOptions.moduleIdentity = moduleIdentity + } +} + +// WriteConfigWithDependencyModuleReferences returns a new WriteConfigOption that sets the +// dependencies of the module. +// +// The default is to not have any dependencies. +// If this option is used, WriteConfigWithModuleIdentity must also be used. +// +// Only use in tests. +func WriteConfigWithDependencyModuleReferences(dependencyModuleReferences ...bufmoduleref.ModuleReference) WriteConfigOption { + return func(writeConfigOptions *writeConfigOptions) { + writeConfigOptions.dependencyModuleReferences = dependencyModuleReferences + } +} + +// WriteConfigWithBreakingConfig returns a new WriteConfigOption that sets the breaking change +// config for the module. +// +// If this option is used then the version used must be consistent with the rest of the config. +func WriteConfigWithBreakingConfig(breakingConfig *bufbreakingconfig.Config) WriteConfigOption { + return func(writeConfigOptions *writeConfigOptions) { + writeConfigOptions.breakingConfig = breakingConfig + } +} + +// WriteConfigWithLintConfig returns a new WriteConfigOption that sets the lint config for the module. +// +// If this option is used then the version used must be consistent with the rest of the config. +func WriteConfigWithLintConfig(lintConfig *buflintconfig.Config) WriteConfigOption { + return func(writeConfigOptions *writeConfigOptions) { + writeConfigOptions.lintConfig = lintConfig + } +} + +// WriteConfigWithVersion returns a new WriteConfigOption that sets the version of the config +// being written. +// +// If this is not set, the default is v1beta1. +func WriteConfigWithVersion(version string) WriteConfigOption { + return func(writeConfigOptions *writeConfigOptions) { + writeConfigOptions.version = version + } +} + +// ReadConfigOS reads the configuration from the OS or an override, if any. +// +// ONLY USE IN CLI TOOLS. +func ReadConfigOS( + ctx context.Context, + readBucket storage.ReadBucket, + options ...ReadConfigOSOption, +) (*Config, error) { + return readConfigOS( + ctx, + readBucket, + options..., + ) +} + +// ReadConfigOSOption is an option for ReadConfig. +type ReadConfigOSOption func(*readConfigOSOptions) + +// ReadConfigOSWithOverride sets the override. +// +// If override is set, this will first check if the override ends in .json or .yaml, if so, +// this reads the file at this path and uses it. Otherwise, this assumes this is configuration +// data in either JSON or YAML format, and unmarshals it. +// +// If no override is set, this reads ExternalConfigFilePath in the bucket. +func ReadConfigOSWithOverride(override string) ReadConfigOSOption { + return func(readConfigOSOptions *readConfigOSOptions) { + readConfigOSOptions.override = override + } +} + +// ExistingConfigFilePath checks if a configuration file exists, and if so, returns the path +// within the ReadBucket of this configuration file. +// +// Returns empty string and no error if no configuration file exists. +func ExistingConfigFilePath(ctx context.Context, readBucket storage.ReadBucket) (string, error) { + for _, configFilePath := range AllConfigFilePaths { + exists, err := storage.Exists(ctx, readBucket, configFilePath) + if err != nil { + return "", err + } + if exists { + return configFilePath, nil + } + } + return "", nil +} + +// ValidateVersion checks that a given version string is valid. +func ValidateVersion(version string) error { + switch version { + case V1Version, V1Beta1Version: + return nil + default: + return fmt.Errorf("invalid config version %q provided", version) + } +} + +// ExternalConfigV1Beta1 represents the on-disk representation of the Config +// at version v1beta1. +type ExternalConfigV1Beta1 struct { + Version string `json:"version,omitempty" yaml:"version,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Deps []string `json:"deps,omitempty" yaml:"deps,omitempty"` + Build bufmoduleconfig.ExternalConfigV1Beta1 `json:"build,omitempty" yaml:"build,omitempty"` + Breaking bufbreakingconfig.ExternalConfigV1Beta1 `json:"breaking,omitempty" yaml:"breaking,omitempty"` + Lint buflintconfig.ExternalConfigV1Beta1 `json:"lint,omitempty" yaml:"lint,omitempty"` +} + +// ExternalConfigV1 represents the on-disk representation of the Config +// at version v1. +type ExternalConfigV1 struct { + Version string `json:"version,omitempty" yaml:"version,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Deps []string `json:"deps,omitempty" yaml:"deps,omitempty"` + Build bufmoduleconfig.ExternalConfigV1 `json:"build,omitempty" yaml:"build,omitempty"` + Breaking bufbreakingconfig.ExternalConfigV1 `json:"breaking,omitempty" yaml:"breaking,omitempty"` + Lint buflintconfig.ExternalConfigV1 `json:"lint,omitempty" yaml:"lint,omitempty"` +} + +// ExternalConfigVersion defines the subset of all config +// file versions that is used to determine the configuration version. +type ExternalConfigVersion struct { + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} diff --git a/pkg/bufman/bufpkg/bufconfig/config.go b/pkg/bufman/bufpkg/bufconfig/config.go new file mode 100644 index 000000000..aba4a0ade --- /dev/null +++ b/pkg/bufman/bufpkg/bufconfig/config.go @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconfig + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" +) + +func newConfigV1Beta1(externalConfig ExternalConfigV1Beta1) (*Config, error) { + buildConfig, err := bufmoduleconfig.NewConfigV1Beta1(externalConfig.Build, externalConfig.Deps...) + if err != nil { + return nil, err + } + var moduleIdentity bufmoduleref.ModuleIdentity + if externalConfig.Name != "" { + moduleIdentity, err = bufmoduleref.ModuleIdentityForString(externalConfig.Name) + if err != nil { + return nil, err + } + } + return &Config{ + Version: V1Beta1Version, + ModuleIdentity: moduleIdentity, + Build: buildConfig, + Breaking: bufbreakingconfig.NewConfigV1Beta1(externalConfig.Breaking), + Lint: buflintconfig.NewConfigV1Beta1(externalConfig.Lint), + }, nil +} + +func newConfigV1(externalConfig ExternalConfigV1) (*Config, error) { + buildConfig, err := bufmoduleconfig.NewConfigV1(externalConfig.Build, externalConfig.Deps...) + if err != nil { + return nil, err + } + var moduleIdentity bufmoduleref.ModuleIdentity + if externalConfig.Name != "" { + moduleIdentity, err = bufmoduleref.ModuleIdentityForString(externalConfig.Name) + if err != nil { + return nil, err + } + } + return &Config{ + Version: V1Version, + ModuleIdentity: moduleIdentity, + Build: buildConfig, + Breaking: bufbreakingconfig.NewConfigV1(externalConfig.Breaking), + Lint: buflintconfig.NewConfigV1(externalConfig.Lint), + }, nil +} diff --git a/pkg/bufman/bufpkg/bufconfig/get.go b/pkg/bufman/bufpkg/bufconfig/get.go new file mode 100644 index 000000000..8bb454faa --- /dev/null +++ b/pkg/bufman/bufpkg/bufconfig/get.go @@ -0,0 +1,134 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconfig + +import ( + "context" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" + "go.uber.org/multierr" +) + +func getConfigForBucket(ctx context.Context, readBucket storage.ReadBucket) (_ *Config, retErr error) { + ctx, span := otel.GetTracerProvider().Tracer("bufbuild/buf").Start(ctx, "get_config") + defer span.End() + defer func() { + if retErr != nil { + span.RecordError(retErr) + span.SetStatus(codes.Error, retErr.Error()) + } + }() + + // This will be in the order of precedence. + var foundConfigFilePaths []string + // Go through all valid config file paths and see which ones are present. + // If none are present, return the default config. + // If multiple are present, error. + for _, configFilePath := range AllConfigFilePaths { + exists, err := storage.Exists(ctx, readBucket, configFilePath) + if err != nil { + return nil, err + } + if exists { + foundConfigFilePaths = append(foundConfigFilePaths, configFilePath) + } + } + switch len(foundConfigFilePaths) { + case 0: + // Did not find anything, return the default. + return newConfigV1(ExternalConfigV1{}) + case 1: + readObjectCloser, err := readBucket.Get(ctx, foundConfigFilePaths[0]) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, readObjectCloser.Close()) + }() + data, err := io.ReadAll(readObjectCloser) + if err != nil { + return nil, err + } + return getConfigForDataInternal( + ctx, + encoding.UnmarshalYAMLNonStrict, + encoding.UnmarshalYAMLStrict, + data, + readObjectCloser.ExternalPath(), + ) + default: + return nil, fmt.Errorf("only one configuration file can exist but found multiple configuration files: %s", stringutil.SliceToString(foundConfigFilePaths)) + } +} + +func getConfigForData(ctx context.Context, data []byte) (*Config, error) { + _, span := otel.GetTracerProvider().Tracer("bufbuild/buf").Start(ctx, "get_config_for_data") + defer span.End() + config, err := getConfigForDataInternal( + ctx, + encoding.UnmarshalJSONOrYAMLNonStrict, + encoding.UnmarshalJSONOrYAMLStrict, + data, + "Configuration data", + ) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + } + return config, err +} + +func getConfigForDataInternal( + ctx context.Context, + unmarshalNonStrict func([]byte, interface{}) error, + unmarshalStrict func([]byte, interface{}) error, + data []byte, + id string, +) (*Config, error) { + var externalConfigVersion ExternalConfigVersion + if err := unmarshalNonStrict(data, &externalConfigVersion); err != nil { + return nil, err + } + switch externalConfigVersion.Version { + case "": + return nil, fmt.Errorf(`%s has no version set. Please add "version: %s". See https://docs.buf.build/faq for more details`, id, V1Version) + case V1Beta1Version: + var externalConfigV1Beta1 ExternalConfigV1Beta1 + if err := unmarshalStrict(data, &externalConfigV1Beta1); err != nil { + return nil, err + } + return newConfigV1Beta1(externalConfigV1Beta1) + case V1Version: + var externalConfigV1 ExternalConfigV1 + if err := unmarshalStrict(data, &externalConfigV1); err != nil { + return nil, err + } + return newConfigV1(externalConfigV1) + default: + return nil, fmt.Errorf( + `%s has an invalid "version: %s" set. Please add "version: %s". See https://docs.buf.build/faq for more details`, + id, + externalConfigVersion.Version, + V1Version, + ) + } +} diff --git a/pkg/bufman/bufpkg/bufconfig/read.go b/pkg/bufman/bufpkg/bufconfig/read.go new file mode 100644 index 000000000..dfe28855f --- /dev/null +++ b/pkg/bufman/bufpkg/bufconfig/read.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconfig + +import ( + "context" + "fmt" + "os" + "path/filepath" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +func readConfigOS( + ctx context.Context, + readBucket storage.ReadBucket, + options ...ReadConfigOSOption, +) (*Config, error) { + readConfigOSOptions := newReadConfigOSOptions() + for _, option := range options { + option(readConfigOSOptions) + } + if readConfigOSOptions.override != "" { + var data []byte + var err error + switch filepath.Ext(readConfigOSOptions.override) { + case ".json", ".yaml", ".yml": + data, err = os.ReadFile(readConfigOSOptions.override) + if err != nil { + return nil, fmt.Errorf("could not read file: %v", err) + } + default: + data = []byte(readConfigOSOptions.override) + } + return GetConfigForData(ctx, data) + } + return GetConfigForBucket(ctx, readBucket) +} + +type readConfigOSOptions struct { + override string +} + +func newReadConfigOSOptions() *readConfigOSOptions { + return &readConfigOSOptions{} +} diff --git a/pkg/bufman/bufpkg/bufconfig/write.go b/pkg/bufman/bufpkg/bufconfig/write.go new file mode 100644 index 000000000..d294890fb --- /dev/null +++ b/pkg/bufman/bufpkg/bufconfig/write.go @@ -0,0 +1,468 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconfig + +import ( + "bytes" + "context" + "errors" + "fmt" + "text/template" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "gopkg.in/yaml.v3" +) + +// If this is updated, make sure to update docs.buf.build TODO automate this + +const ( + exampleName = "buf.build/acme/weather" + // This is only used for `buf mod init`. + tmplDocumentationCommentsData = `{{$top := .}}# This specifies the configuration file version. +# +# This controls the configuration file layout, defaults, and lint/breaking +# rules and rule categories. Buf takes breaking changes seriously in +# all aspects, and none of these will ever change for a given version. +# +# The only valid versions are "v1beta1", "v1". +# This key is required. +version: {{.Version}} + +# name is the module name. +{{if .NameUnset}}#{{end}}name: {{.Name}} + +# deps are the module dependencies +{{if .DepsUnset}}#{{end}}deps: +{{range $dep := .Deps}}{{if $top.DepsUnset}}#{{end}} - {{$dep}} +{{end}} +# build contains the options for builds. +# +# This affects the behavior of buf build, as well as the build behavior +# for source lint and breaking change rules. +# +# If you want to build all files in your repository, this section can be +# omitted. +build: + + # excludes is the list of directories to exclude. + # + # These directories will not be built or checked. If a directory is excluded, + # buf treats the directory as if it does not exist. + # + # All directory paths in exclude must be relative to the directory of + # your buf.yaml. Only directories can be specified, and all specified + # directories must within the root directory. + {{if not .Uncomment}}#{{end}}excludes: + {{if not .Uncomment}}#{{end}} - foo + {{if not .Uncomment}}#{{end}} - bar/baz + +# lint contains the options for lint rules. +lint: + + # use is the list of rule categories and ids to use for buf lint. + # + # Categories are sets of rule ids. + # Run buf config ls-lint-rules --all to get a list of all rules. + # + # The union of the categories and ids will be used. + # + # The default is [DEFAULT]. + use: +{{range $lint_id := .LintConfig.Use}} - {{$lint_id}} +{{end}} + # except is the list of rule ids or categories to remove from the use + # list. + # + # This allows removal of specific rules from the union of rules derived + # from the use list of categories and ids. + {{if not .Uncomment}}#{{end}}except: + {{if not .Uncomment}}#{{end}} - ENUM_VALUE_UPPER_SNAKE_CASE + + # ignore is the list of directories or files to ignore for all rules. + # + # All directories and file paths are specified relative to the root directory. + # The directory "." is not allowed - this is equivalent to ignoring + # everything. + {{if not .Uncomment}}#{{end}}ignore: + {{if not .Uncomment}}#{{end}} - bat + {{if not .Uncomment}}#{{end}} - ban/ban.proto + + # ignore_only is the map from rule id or category to file or directory to + # ignore. + # + # All directories and file paths are specified relative to the root directory. + # The directory "." is not allowed - this is equivalent to using the "except" + # option. + # + # Note you can generate this section using + # "buf lint --error-format=config-ignore-yaml". The result of this command + # can be copy/pasted here. + {{if not .Uncomment}}#{{end}}ignore_only: + {{if not .Uncomment}}#{{end}} ENUM_PASCAL_CASE: + {{if not .Uncomment}}#{{end}} - foo/foo.proto + {{if not .Uncomment}}#{{end}} - bar + {{if not .Uncomment}}#{{end}} FIELD_LOWER_SNAKE_CASE: + {{if not .Uncomment}}#{{end}} - foo + + # enum_zero_value_suffix affects the behavior of the ENUM_ZERO_VALUE_SUFFIX + # rule. + # + # This will result in this suffix being used instead of the default + # "_UNSPECIFIED" suffix. + {{if not .Uncomment}}#{{end}}enum_zero_value_suffix: _UNSPECIFIED + + # rpc_allow_same_request_response affects the behavior of the + # RPC_REQUEST_RESPONSE_UNIQUE rule. + # + # This will result in requests and responses being allowed to be the same + # type for a single RPC. + {{if not .Uncomment}}#{{end}}rpc_allow_same_request_response: false + + # rpc_allow_google_protobuf_empty_requests affects the behavior of the + # RPC_REQUEST_STANDARD_NAME and RPC_REQUEST_RESPONSE_UNIQUE rules. + # + # This will result in google.protobuf.Empty requests being ignored for + # RPC_REQUEST_STANDARD_NAME, and google.protobuf.Empty requests being allowed + # in multiple RPCs. + {{if not .Uncomment}}#{{end}}rpc_allow_google_protobuf_empty_requests: false + + # rpc_allow_google_protobuf_empty_responses affects the behavior of the + # RPC_RESPONSE_STANDARD_NAME and the RPC_REQUEST_RESPONSE_UNIQUE rules. + # + # This will result in google.protobuf.Empty responses being ignored for + # RPC_RESPONSE_STANDARD_NAME, and google.protobuf.Empty responses being + # allowed in multiple RPCs. + {{if not .Uncomment}}#{{end}}rpc_allow_google_protobuf_empty_responses: false + + # service_suffix affects the behavior of the SERVICE_SUFFIX rule. + # + # This will result in this suffix being used instead of the default "Service" + # suffix. + {{if not .Uncomment}}#{{end}}service_suffix: Service + + # allow_comment_ignores allows comment-driven ignores. + # + # If this option is set, leading comments can be added within Protobuf files + # to ignore lint errors for certain components. If any line in a leading + # comment starts with "buf:lint:ignore ID", then Buf will ignore lint errors + # for this id. For example: + # + # syntax = "proto3"; + # + # // buf:lint:ignore PACKAGE_LOWER_SNAKE_CASE + # // buf:lint:ignore PACKAGE_VERSION_SUFFIX + # package A; + # + # We do not recommend using this, as it allows individual engineers in a + # large organization to decide on their own lint rule exceptions. However, + # there are cases where this is necessarily, and we want users to be able to + # make informed decisions, so we provide this as an opt-in. + {{if not .Uncomment}}#{{end}}allow_comment_ignores: false + +# breaking contains the options for breaking rules. +breaking: + + # use is the list of rule categories and ids to use for + # buf breaking. + # + # Categories are sets of rule ids. + # Run buf config ls-breaking-rules --all to get a list of all rules. + # + # The union of the categories and ids will be used. + # + # As opposed to lint, where you may want to do more customization, with + # breaking is is generally better to only choose one of the following + # options: + # + # - [FILE] + # - [PACKAGE] + # - [WIRE] + # - [WIRE_JSON] + # + # The default is [FILE], as done below. + use: +{{range $breaking_id := .BreakingConfig.Use}} - {{$breaking_id}} +{{end}} + # except is the list of rule ids or categories to remove from the use + # list. + # + # This allows removal of specific rules from the union of rules derived + # from the use list of categories and ids. + # + # As opposed to lint, we generally recommend using one of the preconfigured + # options. Removing specific rules from breaking change detection is an + # advanced option. + {{if not .Uncomment}}#{{end}}except: + {{if not .Uncomment}}#{{end}} - FIELD_SAME_NAME + + # ignore is the list of directories or files to ignore for all rules. + # + # All directories and file paths are specified relative to the root directory. + # The directory "." is not allowed - this is equivalent to ignoring + # everything. + {{if not .Uncomment}}#{{end}}ignore: + {{if not .Uncomment}}#{{end}} - bat + {{if not .Uncomment}}#{{end}} - ban/ban.proto + + # ignore_only is the map from rule id or category to file or directory to + # ignore. + # + # All directories and file paths are specified relative to a root directory. + # The directory "." is not allowed - this is equivalent to using the "except" + # option. + {{if not .Uncomment}}#{{end}}ignore_only: + {{if not .Uncomment}}#{{end}} FIELD_NO_DELETE: + {{if not .Uncomment}}#{{end}} - foo/foo.proto + {{if not .Uncomment}}#{{end}} - bar + {{if not .Uncomment}}#{{end}} WIRE_JSON: + {{if not .Uncomment}}#{{end}} - foo + + # ignore_unstable_packages results in ignoring packages with a last component + # that is one of the unstable forms recognized by the "PACKAGE_VERSION_SUFFIX" + # lint rule. The following forms will be ignored: + # + # - v\d+test.* + # - v\d+(alpha|beta)\d+ + # - v\d+p\d+(alpha|beta)\d+ + # + # For example, if this option is set, the following packages will be ignored: + # + # - foo.bar.v1alpha1 + # - foo.bar.v1beta1 + # - foo.bar.v1test + {{if not .Uncomment}}#{{end}}ignore_unstable_packages: false` +) + +func writeConfig( + ctx context.Context, + writeBucket storage.WriteBucket, + options ...WriteConfigOption, +) error { + writeConfigOptions := newWriteConfigOptions() + for _, option := range options { + option(writeConfigOptions) + } + if err := validateWriteConfigOptions(writeConfigOptions); err != nil { + return err + } + // This is the same default as the bufconfig getters. + version := V1Version + if writeConfigOptions.version != "" { + if err := ValidateVersion(writeConfigOptions.version); err != nil { + return err + } + version = writeConfigOptions.version + } + config := &Config{ + Version: version, + ModuleIdentity: writeConfigOptions.moduleIdentity, + } + var breakingConfigVersion string + breakingConfig := writeConfigOptions.breakingConfig + if breakingConfig != nil { + breakingConfigVersion = breakingConfig.Version + if breakingConfigVersion != version { + return fmt.Errorf("version %q found for breaking config, does not match top level config version: %q", breakingConfigVersion, version) + } + config.Breaking = breakingConfig + } + var lintConfigVersion string + lintConfig := writeConfigOptions.lintConfig + if lintConfig != nil { + lintConfigVersion = lintConfig.Version + if lintConfigVersion != version { + return fmt.Errorf("version %q found for lint config, does not match top level config version: %q", lintConfigVersion, version) + } + config.Lint = lintConfig + } + // We should never hit this condition since we are already validating against `version`. + if breakingConfigVersion != lintConfigVersion { + return fmt.Errorf("breaking config version %q does not match lint config version %q", breakingConfigVersion, lintConfigVersion) + } + var dependencies []string + if len(writeConfigOptions.dependencyModuleReferences) > 0 { + dependencies = make([]string, len(writeConfigOptions.dependencyModuleReferences)) + for i, dependencyModuleReference := range writeConfigOptions.dependencyModuleReferences { + dependencies[i] = dependencyModuleReference.String() + } + } + if writeConfigOptions.documentationComments { + // Write out config using template with document comments. + return writeCommentedConfig(ctx, writeBucket, config, dependencies, writeConfigOptions.uncomment) + } + // Write out raw default config without comments using externalConfig{V1, V1Beta1} + return writeExternalConfig(ctx, writeBucket, version, config, dependencies) +} + +func writeExternalConfig( + ctx context.Context, + writeBucket storage.WriteBucket, + version string, + config *Config, + dependencies []string, +) error { + var name string + if config.ModuleIdentity != nil { + name = config.ModuleIdentity.IdentityString() + } + breakingConfig := config.Breaking + lintConfig := config.Lint + switch version { + case V1Beta1Version: + var externalBreakingConfig bufbreakingconfig.ExternalConfigV1Beta1 + if breakingConfig != nil { + externalBreakingConfig = bufbreakingconfig.ExternalConfigV1Beta1ForConfig(breakingConfig) + } + var externalLintConfig buflintconfig.ExternalConfigV1Beta1 + if lintConfig != nil { + externalLintConfig = buflintconfig.ExternalConfigV1Beta1ForConfig(lintConfig) + } + externalConfig := ExternalConfigV1Beta1{ + Name: name, + Version: config.Version, + Deps: dependencies, + Breaking: externalBreakingConfig, + Lint: externalLintConfig, + } + buffer := bytes.NewBuffer(nil) + encoder := yaml.NewEncoder(buffer) + encoder.SetIndent(2) + if err := encoder.Encode(externalConfig); err != nil { + return err + } + return storage.PutPath(ctx, writeBucket, ExternalConfigV1Beta1FilePath, buffer.Bytes()) + case V1Version: + var externalBreakingConfig bufbreakingconfig.ExternalConfigV1 + if breakingConfig != nil { + externalBreakingConfig = bufbreakingconfig.ExternalConfigV1ForConfig(breakingConfig) + } + var externalLintConfig buflintconfig.ExternalConfigV1 + if lintConfig != nil { + externalLintConfig = buflintconfig.ExternalConfigV1ForConfig(lintConfig) + } + externalConfig := ExternalConfigV1{ + Name: name, + Version: config.Version, + Deps: dependencies, + Breaking: externalBreakingConfig, + Lint: externalLintConfig, + } + buffer := bytes.NewBuffer(nil) + encoder := yaml.NewEncoder(buffer) + encoder.SetIndent(2) + if err := encoder.Encode(externalConfig); err != nil { + return err + } + return storage.PutPath(ctx, writeBucket, ExternalConfigV1FilePath, buffer.Bytes()) + default: + return fmt.Errorf(`%s has an invalid "version %s"`, name, version) + } +} + +type tmplParam struct { + Uncomment bool + Version string + Name string + NameUnset bool + Deps []string + DepsUnset bool + LintConfig *buflintconfig.Config + BreakingConfig *bufbreakingconfig.Config +} + +func newTmplParam(config *Config, dependencies []string, uncomment bool) *tmplParam { + var name string + var nameUnset bool + if config.ModuleIdentity != nil { + name = config.ModuleIdentity.IdentityString() + } + if name == "" { + name = exampleName + nameUnset = true + } + var dependenciesUnset bool + if len(dependencies) == 0 { + dependencies = []string{ + "buf.build/acme/petapis", + "buf.build/acme/pkg:alpha", + "buf.build/acme/paymentapis:7e8b594e68324329a7aefc6e750d18b9", + } + dependenciesUnset = true + } + return &tmplParam{ + Uncomment: uncomment, + Version: config.Version, + Name: name, + NameUnset: nameUnset, + Deps: dependencies, + DepsUnset: dependenciesUnset, + LintConfig: config.Lint, + BreakingConfig: config.Breaking, + } +} + +func writeCommentedConfig( + ctx context.Context, + writeBucket storage.WriteBucket, + config *Config, + dependencies []string, + uncomment bool, +) error { + tmplData := tmplDocumentationCommentsData + tmpl, err := template.New("tmpl").Parse(tmplData) + if err != nil { + return err + } + buffer := bytes.NewBuffer(nil) + if err := tmpl.Execute( + buffer, + newTmplParam( + config, + dependencies, + uncomment, + ), + ); err != nil { + return err + } + return storage.PutPath(ctx, writeBucket, ExternalConfigV1FilePath, buffer.Bytes()) +} + +type writeConfigOptions struct { + documentationComments bool + uncomment bool + moduleIdentity bufmoduleref.ModuleIdentity + dependencyModuleReferences []bufmoduleref.ModuleReference + breakingConfig *bufbreakingconfig.Config + lintConfig *buflintconfig.Config + version string +} + +func newWriteConfigOptions() *writeConfigOptions { + return &writeConfigOptions{} +} + +func validateWriteConfigOptions(writeConfigOptions *writeConfigOptions) error { + if !writeConfigOptions.documentationComments && writeConfigOptions.uncomment { + return errors.New("cannot set uncomment without documentationComments for WriteConfig") + } + if writeConfigOptions.moduleIdentity == nil && len(writeConfigOptions.dependencyModuleReferences) > 0 { + return errors.New("cannot set deps without a name for WriteConfig") + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufconfig/write_test.go b/pkg/bufman/bufpkg/bufconfig/write_test.go new file mode 100644 index 000000000..845131073 --- /dev/null +++ b/pkg/bufman/bufpkg/bufconfig/write_test.go @@ -0,0 +1,104 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconfig + +import ( + "context" + "io" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/require" +) + +func TestWriteConfigSuccess(t *testing.T) { + t.Parallel() + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket(t.TempDir()) + require.NoError(t, err) + writeConfigOptions := []WriteConfigOption{ + WriteConfigWithVersion(V1Version), + WriteConfigWithBreakingConfig( + &bufbreakingconfig.Config{ + Version: V1Version, + Use: []string{"FILE"}, + }, + ), + WriteConfigWithLintConfig( + &buflintconfig.Config{ + Version: V1Version, + Use: []string{"DEFAULT"}, + }, + ), + } + err = WriteConfig(context.Background(), readWriteBucket, writeConfigOptions...) + require.NoError(t, err) + configReadObjectCloser, err := readWriteBucket.Get(context.Background(), ExternalConfigV1FilePath) + require.NoError(t, err) + configBytes, err := io.ReadAll(configReadObjectCloser) + require.NoError(t, err) + require.Equal( + t, + string(configBytes), + `version: v1 +breaking: + use: + - FILE +lint: + use: + - DEFAULT +`, + ) + require.NoError(t, configReadObjectCloser.Close()) +} + +func TestWriteConfigMismatchedConfigVersions(t *testing.T) { + t.Parallel() + t.Run("invalid breaking config", func(t *testing.T) { + t.Parallel() + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket(t.TempDir()) + require.NoError(t, err) + writeConfigOptions := []WriteConfigOption{ + WriteConfigWithVersion(V1Beta1Version), + WriteConfigWithBreakingConfig(&bufbreakingconfig.Config{ + Version: V1Version, + Use: []string{"FILE"}, + }), + } + err = WriteConfig(context.Background(), readWriteBucket, writeConfigOptions...) + require.Error(t, err) + require.Equal(t, err.Error(), `version "v1" found for breaking config, does not match top level config version: "v1beta1"`) + }) + t.Run("invalid lint config", func(t *testing.T) { + t.Parallel() + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket(t.TempDir()) + require.NoError(t, err) + writeConfigOptions := []WriteConfigOption{ + WriteConfigWithVersion(V1Beta1Version), + WriteConfigWithLintConfig(&buflintconfig.Config{ + Version: V1Version, + Use: []string{"DEFAULT"}, + }), + } + err = WriteConfig(context.Background(), readWriteBucket, writeConfigOptions...) + require.Error(t, err) + require.Equal(t, err.Error(), `version "v1" found for lint config, does not match top level config version: "v1beta1"`) + }) +} diff --git a/pkg/bufman/bufpkg/bufconnect/bufconnect.go b/pkg/bufman/bufpkg/bufconnect/bufconnect.go new file mode 100644 index 000000000..70dfed98d --- /dev/null +++ b/pkg/bufman/bufpkg/bufconnect/bufconnect.go @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufconnect provides buf-specific Connect functionality. +package bufconnect + +const ( + // AuthenticationHeader is the standard OAuth header used for authenticating + // a user. Ignore the misnomer. + AuthenticationHeader = "Authorization" + // AuthenticationTokenPrefix is the standard OAuth token prefix. + // We use it for familiarity. + AuthenticationTokenPrefix = "Bearer " + // CliVersionHeaderName is the name of the header carrying the buf CLI version. + CliVersionHeaderName = "buf-version" + // CLIWarningHeaderName is the name of the header carrying a base64-encoded warning message + // from the server to the CLI. + CLIWarningHeaderName = "buf-warning-bin" +) + +// DefaultRemote is the default remote if none can be inferred from a module name. +var DefaultRemote = "bufman.io" diff --git a/pkg/bufman/bufpkg/bufconnect/errors.go b/pkg/bufman/bufpkg/bufconnect/errors.go new file mode 100644 index 000000000..dc3441b86 --- /dev/null +++ b/pkg/bufman/bufpkg/bufconnect/errors.go @@ -0,0 +1,50 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconnect + +import "errors" + +// AuthError wraps the error returned in the auth provider to add additional context. +type AuthError struct { + cause error + + tokenEnvKey string +} + +// Unwrap returns the underlying error. +func (e *AuthError) Unwrap() error { + return e.cause +} + +// Error implements the error interface and returns the error message. +func (e *AuthError) Error() string { + if e.cause == nil { + return "unknown error" + } + return e.cause.Error() +} + +// TokenEnvKey returns the environment variable used, if any, for authentication. +func (e *AuthError) TokenEnvKey() string { + return e.tokenEnvKey +} + +// AsAuthError uses errors.As to unwrap any error and look for an *AuthError. +func AsAuthError(err error) (*AuthError, bool) { + var authErr *AuthError + ok := errors.As(err, &authErr) + return authErr, ok +} diff --git a/pkg/bufman/bufpkg/bufconnect/errors_test.go b/pkg/bufman/bufpkg/bufconnect/errors_test.go new file mode 100644 index 000000000..d64f2a196 --- /dev/null +++ b/pkg/bufman/bufpkg/bufconnect/errors_test.go @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconnect + +import ( + "errors" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestAuthErrorUnwrap(t *testing.T) { + t.Parallel() + cause := errors.New("underlying cause") + err := &AuthError{cause: cause} + assert.Equal(t, cause, err.Unwrap()) +} + +func TestAuthErrorError(t *testing.T) { + t.Parallel() + cause := errors.New("underlying cause") + err := &AuthError{cause: cause} + assert.Equal(t, "underlying cause", err.Error()) +} + +func TestAuthErrorTokenEnvKey(t *testing.T) { + t.Parallel() + cause := errors.New("underlying cause") + err := &AuthError{cause: cause, tokenEnvKey: "abcd"} + assert.Equal(t, "abcd", err.TokenEnvKey()) +} + +func TestAsAuthError(t *testing.T) { + t.Parallel() + cause := errors.New("underlying cause") + authErr := &AuthError{cause: cause} + err := fmt.Errorf("wrapped error: %w", authErr) + + unwrapped, ok := AsAuthError(err) + assert.True(t, ok) + assert.Equal(t, authErr, unwrapped) + + unwrapped, ok = AsAuthError(cause) + assert.False(t, ok) + assert.Nil(t, unwrapped) +} diff --git a/pkg/bufman/bufpkg/bufconnect/interceptors.go b/pkg/bufman/bufpkg/bufconnect/interceptors.go new file mode 100644 index 000000000..734487c4a --- /dev/null +++ b/pkg/bufman/bufpkg/bufconnect/interceptors.go @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconnect + +import ( + "context" + "errors" + "fmt" + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/applog" + "github.com/bufbuild/connect-go" +) + +const ( + // tokenEnvKey is the environment variable key for the auth token + tokenEnvKey = "BUF_TOKEN" +) + +// NewSetCLIVersionInterceptor returns a new Connect Interceptor that sets the Buf CLI version into all request headers +func NewSetCLIVersionInterceptor(version string) connect.UnaryInterceptorFunc { + interceptor := func(next connect.UnaryFunc) connect.UnaryFunc { + return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + req.Header().Set(CliVersionHeaderName, version) + return next(ctx, req) + } + } + return interceptor +} + +// NewCLIWarningInterceptor returns a new Connect Interceptor that logs CLI warnings returned by server responses. +func NewCLIWarningInterceptor(container applog.Container) connect.UnaryInterceptorFunc { + interceptor := func(next connect.UnaryFunc) connect.UnaryFunc { + return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + resp, err := next(ctx, req) + if resp != nil { + logWarningFromHeader(container, resp.Header()) + } else if err != nil { + if connectErr := new(connect.Error); errors.As(err, &connectErr) { + logWarningFromHeader(container, connectErr.Meta()) + } + } + return resp, err + } + } + return interceptor +} + +func logWarningFromHeader(container applog.Container, header http.Header) { + encoded := header.Get(CLIWarningHeaderName) + if encoded != "" { + warning, err := connect.DecodeBinaryHeader(encoded) + if err != nil { + container.Logger().Debug(fmt.Errorf("failed to decode warning header: %w", err).Error()) + return + } + if len(warning) > 0 { + container.Logger().Warn(string(warning)) + } + } +} + +// TokenProvider finds the token for NewAuthorizationInterceptorProvider. +type TokenProvider interface { + // RemoteToken returns the remote token from the remote address. + RemoteToken(address string) string + // IsFromEnvVar returns true if the TokenProvider is generated from an environment variable. + IsFromEnvVar() bool +} + +// NewAuthorizationInterceptorProvider returns a new provider function which, when invoked, returns an interceptor +// which will set the auth token into the request header by the provided option. +// +// Note that the interceptor returned from this provider is always applied LAST in the series of interceptors added to +// a client. +func NewAuthorizationInterceptorProvider(tokenProviders ...TokenProvider) func(string) connect.UnaryInterceptorFunc { + return func(address string) connect.UnaryInterceptorFunc { + interceptor := func(next connect.UnaryFunc) connect.UnaryFunc { + return connect.UnaryFunc(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + usingTokenEnvKey := false + for _, tf := range tokenProviders { + if token := tf.RemoteToken(address); token != "" { + req.Header().Set(AuthenticationHeader, AuthenticationTokenPrefix+token) + usingTokenEnvKey = tf.IsFromEnvVar() + break + } + } + response, err := next(ctx, req) + if err != nil && usingTokenEnvKey { + err = &AuthError{cause: err, tokenEnvKey: tokenEnvKey} + } + return response, err + }) + } + return interceptor + } +} diff --git a/pkg/bufman/bufpkg/bufconnect/interceptors_test.go b/pkg/bufman/bufpkg/bufconnect/interceptors_test.go new file mode 100644 index 000000000..ebfdec7ce --- /dev/null +++ b/pkg/bufman/bufpkg/bufconnect/interceptors_test.go @@ -0,0 +1,149 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconnect + +import ( + "bytes" + "context" + "encoding/base64" + "errors" + "fmt" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/applog" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/netrc" + "github.com/bufbuild/connect-go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +type testMachine struct{} + +func (testMachine) Name() string { + return "name" +} + +func (testMachine) Login() string { + return "login" +} + +func (testMachine) Password() string { + return "password" +} + +func TestNewAuthorizationInterceptorProvider(t *testing.T) { + t.Parallel() + tokenSet, err := NewTokenProviderFromString("token1@host1,token2@host2") + assert.NoError(t, err) + _, err = NewAuthorizationInterceptorProvider(tokenSet)("host1")(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + if req.Header().Get(AuthenticationHeader) != AuthenticationTokenPrefix+"token1" { + return nil, errors.New("error auth token") + } + return nil, nil + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + assert.NoError(t, err) + + getMachineForName := func(app.EnvContainer, string) (netrc.Machine, error) { + return testMachine{}, nil + } + netrcTokens := &netrcTokenProvider{getMachineForName: getMachineForName} + assert.NoError(t, err) + _, err = NewAuthorizationInterceptorProvider(netrcTokens)("default")(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + if req.Header().Get(AuthenticationHeader) != AuthenticationTokenPrefix+"password" { + return nil, errors.New("error auth token") + } + return nil, nil + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + assert.NoError(t, err) + + // testing using tokenSet over netrc tokenToAuthKey + _, err = NewAuthorizationInterceptorProvider(tokenSet, netrcTokens)("host2")(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + if req.Header().Get(AuthenticationHeader) != AuthenticationTokenPrefix+"token2" { + return nil, errors.New("error auth token") + } + return nil, nil + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + assert.NoError(t, err) + + // testing using netrc tokenToAuthKey over tokenSet + _, err = NewAuthorizationInterceptorProvider(netrcTokens, tokenSet)("default")(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + if req.Header().Get(AuthenticationHeader) != AuthenticationTokenPrefix+"password" { + return nil, errors.New("error auth token") + } + return nil, nil + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + assert.NoError(t, err) + + _, err = NewAuthorizationInterceptorProvider()("default")(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + if req.Header().Get(AuthenticationHeader) != "" { + return nil, errors.New("error auth token") + } + return nil, nil + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + assert.NoError(t, err) + + tokenSet, err = NewTokenProviderFromContainer(app.NewEnvContainer(map[string]string{ + tokenEnvKey: "default", + })) + assert.NoError(t, err) + _, err = NewAuthorizationInterceptorProvider(tokenSet)("default")(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + return nil, errors.New("underlying cause") + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + authErr, ok := AsAuthError(err) + assert.True(t, ok) + assert.Equal(t, tokenEnvKey, authErr.tokenEnvKey) +} + +func TestCLIWarningInterceptor(t *testing.T) { + t.Parallel() + warningMessage := "This is a warning message from the BSR" + var buf bytes.Buffer + logger, err := applog.NewLogger(&buf, "warn", "text") + require.NoError(t, err) + // testing valid warning message + _, err = NewCLIWarningInterceptor(applog.NewContainer(logger))(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + resp := connect.NewResponse(&bytes.Buffer{}) + resp.Header().Set(CLIWarningHeaderName, base64.StdEncoding.EncodeToString([]byte(warningMessage))) + return resp, nil + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + assert.NoError(t, err) + assert.Equal(t, fmt.Sprintf("WARN\t%s\n", warningMessage), buf.String()) + + // testing no warning message in valid response with no header + buf.Reset() + _, err = NewCLIWarningInterceptor(applog.NewContainer(logger))(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + return connect.NewResponse(&bytes.Buffer{}), nil + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + assert.NoError(t, err) + assert.Equal(t, "", buf.String()) +} + +func TestCLIWarningInterceptorFromError(t *testing.T) { + t.Parallel() + warningMessage := "This is a warning message from the BSR" + var buf bytes.Buffer + logger, err := applog.NewLogger(&buf, "warn", "text") + require.NoError(t, err) + // testing valid warning message from error + _, err = NewCLIWarningInterceptor(applog.NewContainer(logger))(func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) { + err := connect.NewError(connect.CodeInternal, errors.New("error")) + err.Meta().Set(CLIWarningHeaderName, base64.StdEncoding.EncodeToString([]byte(warningMessage))) + return nil, err + })(context.Background(), connect.NewRequest(&bytes.Buffer{})) + assert.Error(t, err) + assert.Equal(t, fmt.Sprintf("WARN\t%s\n", warningMessage), buf.String()) +} diff --git a/pkg/bufman/bufpkg/bufconnect/netrc_token_provider.go b/pkg/bufman/bufpkg/bufconnect/netrc_token_provider.go new file mode 100644 index 000000000..c76c07b0e --- /dev/null +++ b/pkg/bufman/bufpkg/bufconnect/netrc_token_provider.go @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconnect + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/netrc" +) + +// netrcTokenProvider is used to provide remote tokenToAuthKey from .netrc. +type netrcTokenProvider struct { + container app.EnvContainer + getMachineForName func(app.EnvContainer, string) (netrc.Machine, error) +} + +// NewNetrcTokenProvider returns a TokenProvider for a .netrc in a container. +func NewNetrcTokenProvider(container app.EnvContainer, getMachineForName func(app.EnvContainer, string) (netrc.Machine, error)) TokenProvider { + return &netrcTokenProvider{container: container, getMachineForName: getMachineForName} +} + +func (nt *netrcTokenProvider) RemoteToken(address string) string { + machine, err := nt.getMachineForName(nt.container, address) + if err != nil { + return "" + } + if machine != nil { + return machine.Password() + } + return "" +} + +func (nt *netrcTokenProvider) IsFromEnvVar() bool { + return false +} diff --git a/pkg/bufman/bufpkg/bufconnect/static_token_provider.go b/pkg/bufman/bufpkg/bufconnect/static_token_provider.go new file mode 100644 index 000000000..f4873f64d --- /dev/null +++ b/pkg/bufman/bufpkg/bufconnect/static_token_provider.go @@ -0,0 +1,136 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconnect + +import ( + "errors" + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" +) + +// NewTokenProviderFromContainer creates a singleTokenProvider from the BUF_TOKEN environment variable +func NewTokenProviderFromContainer(container app.EnvContainer) (TokenProvider, error) { + return newTokenProviderFromString(container.Env(tokenEnvKey), true) +} + +// NewTokenProviderFromString creates a singleTokenProvider by the token provided +func NewTokenProviderFromString(token string) (TokenProvider, error) { + return newTokenProviderFromString(token, false) +} + +// newTokenProviderFromString returns a TokenProvider with auth keys from the provided token. The +// remote token is in the format: token1@remote1,token2@remote2. +// The special characters `@` and `,` are used as the splitters. The tokens and remote addresses +// do not contain these characters since they are enforced by the rules in BSR. +func newTokenProviderFromString(token string, isFromEnvVar bool) (TokenProvider, error) { + if token == "" { + return nopTokenProvider{}, nil + } + // Tokens for different remotes are separated by `,`. Using strings.Split to separate the string into remote tokens. + tokens := strings.Split(token, ",") + if len(tokens) == 1 { + if strings.Contains(tokens[0], "@") { + return newMultipleTokenProvider(tokens, isFromEnvVar) + } + return newSingleTokenProvider(tokens[0], isFromEnvVar) + } + return newMultipleTokenProvider(tokens, isFromEnvVar) +} + +// singleTokenProvider is used to provide set of authentication tokenToAuthKey. +type singleTokenProvider struct { + // true: the tokenSet is generated from environment variable tokenEnvKey + // false: otherwise + setBufTokenEnvVar bool + token string +} + +func newSingleTokenProvider(token string, isFromEnvVar bool) (*singleTokenProvider, error) { + if strings.Contains(token, "@") { + return nil, errors.New("token cannot contain special character `@`") + } + if strings.Contains(token, ",") { + return nil, errors.New("token cannot contain special character `,`") + } + if token == "" { + return nil, errors.New("single token cannot be empty") + } + return &singleTokenProvider{ + setBufTokenEnvVar: isFromEnvVar, + token: token, + }, nil +} + +// RemoteToken finds the token by the remote address +func (t *singleTokenProvider) RemoteToken(address string) string { + return t.token +} + +func (t *singleTokenProvider) IsFromEnvVar() bool { + return t.setBufTokenEnvVar +} + +type multipleTokenProvider struct { + addressToToken map[string]string + isFromEnvVar bool +} + +func newMultipleTokenProvider(tokens []string, isFromEnvVar bool) (*multipleTokenProvider, error) { + addressToToken := make(map[string]string) + for _, token := range tokens { + split := strings.Split(token, "@") + if len(split) != 2 { + return nil, fmt.Errorf("invalid token: %s", token) + } + if split[0] == "" || split[1] == "" { + return nil, fmt.Errorf("invalid token: %s", token) + } + if strings.Contains(split[0], ":") { + return nil, fmt.Errorf("invalid token: %s, token cannot contain special character `:`", token) + } + if strings.Contains(split[0], ",") { + return nil, fmt.Errorf("invalid token: %s, token cannot contain special character `,`", token) + } + if _, ok := addressToToken[split[1]]; ok { + return nil, fmt.Errorf("invalid token: %s, repeated remote adddress: %s", token, split[1]) + } + addressToToken[split[1]] = split[0] + } + return &multipleTokenProvider{ + addressToToken: addressToToken, + isFromEnvVar: isFromEnvVar, + }, nil +} + +func (m *multipleTokenProvider) RemoteToken(address string) string { + return m.addressToToken[address] +} + +func (m *multipleTokenProvider) IsFromEnvVar() bool { + return m.isFromEnvVar +} + +type nopTokenProvider struct{} + +func (nopTokenProvider) RemoteToken(string) string { + return "" +} + +func (nopTokenProvider) IsFromEnvVar() bool { + return false +} diff --git a/pkg/bufman/bufpkg/bufconnect/static_token_provider_test.go b/pkg/bufman/bufpkg/bufconnect/static_token_provider_test.go new file mode 100644 index 000000000..b29e5a08b --- /dev/null +++ b/pkg/bufman/bufpkg/bufconnect/static_token_provider_test.go @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufconnect + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/stretchr/testify/assert" +) + +func TestNewTokenProviderFromContainer(t *testing.T) { + t.Parallel() + tokenSet, err := NewTokenProviderFromContainer(app.NewEnvContainer(map[string]string{ + tokenEnvKey: "default", + })) + assert.NoError(t, err) + token := tokenSet.RemoteToken("fake") + assert.True(t, tokenSet.IsFromEnvVar()) + assert.Equal(t, "default", token) +} + +func TestNewTokenProviderFromString(t *testing.T) { + t.Parallel() + tokenProvider, err := NewTokenProviderFromString("default") + assert.NoError(t, err) + assert.Equal(t, "default", tokenProvider.RemoteToken("host")) + tokenProvider, err = NewTokenProviderFromString("token1@host1") + assert.NoError(t, err) + assert.Equal(t, "token1", tokenProvider.RemoteToken("host1")) + tokenProvider, err = NewTokenProviderFromString("token1@remote1,token2@remote2") + assert.NoError(t, err) + assert.Equal(t, "token1", tokenProvider.RemoteToken("remote1")) + assert.Equal(t, "token2", tokenProvider.RemoteToken("remote2")) + _, err = NewTokenProviderFromString("") + assert.NoError(t, err) +} + +func TestInvalidTokens(t *testing.T) { + t.Parallel() + invalidTokens := []string{ + "user1@remote1,user2@remote1", + "user1@remote1,user2@remote2,", + ",token1@host1", + "token1@host1,", + "token1@", + "token1@host1@", + "@token1", + "token1@host1,token2", + ",", + "token,", + ",token", + } + + for _, token := range invalidTokens { + _, err := NewTokenProviderFromString(token) + assert.Error(t, err, "expected %s to be an invalid token, but it wasn't", token) + _, err = NewTokenProviderFromContainer(app.NewEnvContainer(map[string]string{ + tokenEnvKey: token, + })) + assert.Error(t, err, "expected %s to be an invalid token, but it wasn't", token) + } +} diff --git a/pkg/bufman/bufpkg/bufgraph/bufgraph.go b/pkg/bufman/bufpkg/bufgraph/bufgraph.go new file mode 100644 index 000000000..e3308e692 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/bufgraph.go @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufgraph + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/dag" + "go.uber.org/zap" +) + +// Node is a node in a dependency graph. +// +// This is a struct because this needs to be comparable for the *dag.Graph. +// +// TODO: Don't have the duplication across Node and ImageModuleDependency. +type Node struct { + // Required, + Remote string + // Required. + Owner string + // Required. + Repository string + // Optional. Will not bet set for modules read from workspaces. + Commit string +} + +// IdentityString prints remote/owner/repository. +func (n *Node) IdentityString() string { + return n.Remote + "/" + n.Owner + "/" + n.Repository +} + +// String prints remote/owner/repository[:commit]. +func (n *Node) String() string { + s := n.IdentityString() + if n.Commit != "" { + return s + ":" + n.Commit + } + return s +} + +// Builder builds dependency graphs. +type Builder interface { + // Build builds the dependency graph. + Build( + ctx context.Context, + modules []bufmodule.Module, + options ...BuildOption, + ) (*dag.Graph[Node], []bufanalysis.FileAnnotation, error) +} + +// NewBuilder returns a new Builder. +func NewBuilder( + logger *zap.Logger, + moduleResolver bufmodule.ModuleResolver, + moduleReader bufmodule.ModuleReader, +) Builder { + return newBuilder( + logger, + moduleResolver, + moduleReader, + ) +} + +// BuildOption is an option for Build. +type BuildOption func(*buildOptions) + +// BuildWithWorkspace returns a new BuildOption that specifies a workspace +// that is being operated on. +func BuildWithWorkspace(workspace bufmodule.Workspace) BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.workspace = workspace + } +} diff --git a/pkg/bufman/bufpkg/bufgraph/bufgraph_test.go b/pkg/bufman/bufpkg/bufgraph/bufgraph_test.go new file mode 100644 index 000000000..3f412906d --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/bufgraph_test.go @@ -0,0 +1,123 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufgraph + +import ( + "context" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/buf/bufwork" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestBasic(t *testing.T) { + t.Parallel() + + ctx := context.Background() + workspace, err := testBuildWorkspace(ctx, filepath.Join("testdata", "basic")) + require.NoError(t, err) + builder := NewBuilder( + zap.NewNop(), + bufmodule.NewNopModuleResolver(), + bufmodule.NewNopModuleReader(), + ) + graph, fileAnnotations, err := builder.Build( + ctx, + workspace.GetModules(), + BuildWithWorkspace(workspace), + ) + require.NoError(t, err) + require.Empty(t, fileAnnotations) + dotString, err := graph.DOTString(func(key Node) string { return key.String() }) + require.NoError(t, err) + require.Equal( + t, + `digraph { + + 1 [label="bsr.internal/foo/test-a"] + 2 [label="bsr.internal/foo/test-b"] + 3 [label="bsr.internal/foo/test-c"] + 4 [label="bsr.internal/foo/test-d"] + 5 [label="bsr.internal/foo/test-e"] + 6 [label="bsr.internal/foo/test-f"] + 7 [label="bsr.internal/foo/test-g"] + + 1 -> 2 + 2 -> 3 + 3 -> 4 + 1 -> 4 + 1 -> 5 + 5 -> 6 + 7 + +}`, + dotString, + ) +} + +// TODO: This entire function is all you should need to do to build workspaces, and even +// this is overly complicated because of the wonkiness of bufmodulebuild and NewWorkspace. +// We should have this in a common place for at least testing. +func testBuildWorkspace(ctx context.Context, workspacePath string) (bufmodule.Workspace, error) { + workspaceBucket, err := storageos.NewProvider().NewReadWriteBucket(workspacePath) + if err != nil { + return nil, err + } + workspaceConfig, err := bufwork.GetConfigForBucket(ctx, workspaceBucket, ".") + if err != nil { + return nil, err + } + moduleBucketBuilder := bufmodulebuild.NewModuleBucketBuilder() + namedModules := make(map[string]bufmodule.Module, len(workspaceConfig.Directories)) + allModules := make([]bufmodule.Module, 0, len(workspaceConfig.Directories)) + for _, directory := range workspaceConfig.Directories { + moduleBucket := storage.MapReadBucket( + workspaceBucket, + storage.MapOnPrefix(directory), + ) + moduleConfig, err := bufconfig.GetConfigForBucket(ctx, moduleBucket) + if err != nil { + return nil, err + } + module, err := moduleBucketBuilder.BuildForBucket( + ctx, + moduleBucket, + moduleConfig.Build, + bufmodulebuild.WithModuleIdentity( + moduleConfig.ModuleIdentity, + ), + ) + if err != nil { + return nil, err + } + if moduleConfig.ModuleIdentity != nil { + namedModules[moduleConfig.ModuleIdentity.IdentityString()] = module + } + allModules = append(allModules, module) + } + return bufmodule.NewWorkspace( + ctx, + namedModules, + allModules, + ) +} diff --git a/pkg/bufman/bufpkg/bufgraph/builder.go b/pkg/bufman/bufpkg/bufgraph/builder.go new file mode 100644 index 000000000..d473ab074 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/builder.go @@ -0,0 +1,227 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufgraph + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/dag" + "go.uber.org/zap" +) + +type builder struct { + logger *zap.Logger + moduleResolver bufmodule.ModuleResolver + moduleReader bufmodule.ModuleReader + imageBuilder bufimagebuild.Builder +} + +func newBuilder( + logger *zap.Logger, + moduleResolver bufmodule.ModuleResolver, + moduleReader bufmodule.ModuleReader, +) *builder { + return &builder{ + logger: logger, + moduleResolver: moduleResolver, + moduleReader: moduleReader, + imageBuilder: bufimagebuild.NewBuilder( + logger, + moduleReader, + ), + } +} + +func (b *builder) Build( + ctx context.Context, + modules []bufmodule.Module, + options ...BuildOption, +) (*dag.Graph[Node], []bufanalysis.FileAnnotation, error) { + buildOptions := newBuildOptions() + for _, option := range options { + option(buildOptions) + } + return b.build( + ctx, + modules, + buildOptions.workspace, + ) +} + +func (b *builder) build( + ctx context.Context, + modules []bufmodule.Module, + workspace bufmodule.Workspace, +) (*dag.Graph[Node], []bufanalysis.FileAnnotation, error) { + graph := dag.NewGraph[Node]() + alreadyProcessedNodes := make(map[Node]struct{}) + for _, module := range modules { + fileAnnotations, err := b.buildForModule( + ctx, + module, + newNodeForModule(module), + workspace, + graph, + alreadyProcessedNodes, + ) + if err != nil { + return nil, nil, err + } + if len(fileAnnotations) > 0 { + return nil, fileAnnotations, nil + } + } + return graph, nil, nil +} + +func (b *builder) buildForModule( + ctx context.Context, + module bufmodule.Module, + node Node, + workspace bufmodule.Workspace, + graph *dag.Graph[Node], + alreadyProcessedNodes map[Node]struct{}, +) ([]bufanalysis.FileAnnotation, error) { + // We can't rely on the existence of a node in the graph for this, as when we add an edge + // to the graph, the node is added, and we still need to process the node as a potential + // source node. + if _, ok := alreadyProcessedNodes[node]; ok { + return nil, nil + } + alreadyProcessedNodes[node] = struct{}{} + graph.AddNode(node) + image, fileAnnotations, err := b.imageBuilder.Build( + ctx, + module, + bufimagebuild.WithWorkspace(workspace), + bufimagebuild.WithExpectedDirectDependencies(module.DeclaredDirectDependencies()), + ) + if err != nil { + return nil, err + } + if len(fileAnnotations) > 0 { + return fileAnnotations, nil + } + for _, imageModuleDependency := range bufimage.ImageModuleDependencies(image) { + dependencyNode := newNodeForImageModuleDependency(imageModuleDependency) + if imageModuleDependency.IsDirect() { + graph.AddEdge(node, dependencyNode) + } + dependencyModule, err := b.getModuleForImageModuleDependency( + ctx, + imageModuleDependency, + workspace, + ) + if err != nil { + return nil, err + } + // TODO: deal with the case where there are differing commits for a given ModuleIdentity. + fileAnnotations, err := b.buildForModule( + ctx, + dependencyModule, + dependencyNode, + workspace, + graph, + alreadyProcessedNodes, + ) + if err != nil { + return nil, err + } + if len(fileAnnotations) > 0 { + return fileAnnotations, nil + } + } + return nil, nil +} + +func (b *builder) getModuleForImageModuleDependency( + ctx context.Context, + imageModuleDependency bufimage.ImageModuleDependency, + workspace bufmodule.Workspace, +) (bufmodule.Module, error) { + moduleIdentity := imageModuleDependency.ModuleIdentity() + commit := imageModuleDependency.Commit() + if workspace != nil { + module, ok := workspace.GetModule(moduleIdentity) + if ok { + return module, nil + } + } + if commit == "" { + // TODO: can we error here? The only + // case we should likely not have a commit is when we are using a workspace. + // There's no enforcement of this property, so erroring here is a bit weird, + // but it might be better to check our assumptions and figure out if there + // are exceptions after the fact, as opposed to resolving a ModulePin for + // main when we don't know if main is what we want. + return nil, fmt.Errorf("had ModuleIdentity %v with no associated commit, but did not have the module in a workspace", moduleIdentity) + } + moduleReference, err := bufmoduleref.NewModuleReference( + moduleIdentity.Remote(), + moduleIdentity.Owner(), + moduleIdentity.Repository(), + commit, + ) + if err != nil { + return nil, err + } + modulePin, err := b.moduleResolver.GetModulePin( + ctx, + moduleReference, + ) + if err != nil { + return nil, err + } + return b.moduleReader.GetModule( + ctx, + modulePin, + ) +} + +func newNodeForImageModuleDependency(imageModuleDependency bufimage.ImageModuleDependency) Node { + return Node{ + Remote: imageModuleDependency.ModuleIdentity().Remote(), + Owner: imageModuleDependency.ModuleIdentity().Owner(), + Repository: imageModuleDependency.ModuleIdentity().Repository(), + Commit: imageModuleDependency.Commit(), + } +} + +func newNodeForModule(module bufmodule.Module) Node { + // TODO: deal with unnamed Modules + var node Node + if moduleIdentity := module.ModuleIdentity(); moduleIdentity != nil { + node.Remote = moduleIdentity.Remote() + node.Owner = moduleIdentity.Owner() + node.Repository = moduleIdentity.Repository() + node.Commit = module.Commit() + } + return node +} + +type buildOptions struct { + workspace bufmodule.Workspace +} + +func newBuildOptions() *buildOptions { + return &buildOptions{} +} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/buf.work.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/buf.work.yaml new file mode 100644 index 000000000..b3b101101 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/buf.work.yaml @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +directories: + - test-a + - test-b + - test-c + - test-d + - test-e + - test-f + - test-g diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a/v1/a.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a/v1/a.proto new file mode 100644 index 000000000..9c5282de0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a/v1/a.proto @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a.v1; + +import "b/v1/b.proto"; +import "d/v1/d.proto"; +import "e/v1/e.proto"; + +message A { + b.v1.B b = 1; + d.v1.D d = 2; + e.v1.E e = 3; +} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a2/v1/a2.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a2/v1/a2.proto new file mode 100644 index 000000000..b561c965f --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a2/v1/a2.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a2.v1; + +import "e/v1/e.proto"; + +message A2 { + e.v1.E e = 3; +} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/buf.yaml new file mode 100644 index 000000000..a7f1bd17c --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/buf.yaml @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: bsr.internal/foo/test-a +deps: + - bsr.internal/foo/test-b + - bsr.internal/foo/test-d + - bsr.internal/foo/test-e diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/b/v1/b.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/b/v1/b.proto new file mode 100644 index 000000000..a929237fa --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/b/v1/b.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b.v1; + +import "c/v1/c.proto"; + +message B { + c.v1.C c = 1; +} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/buf.yaml new file mode 100644 index 000000000..d90207697 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: bsr.internal/foo/test-b +deps: + - bsr.internal/foo/test-c diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/buf.yaml new file mode 100644 index 000000000..b9285158c --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: bsr.internal/foo/test-c +deps: + - bsr.internal/foo/test-d diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/c/v1/c.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/c/v1/c.proto new file mode 100644 index 000000000..9bfc9a301 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/c/v1/c.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package c.v1; + +import "d/v1/d.proto"; + +message C { + d.v1.D d = 1; +} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/buf.yaml new file mode 100644 index 000000000..96069e725 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/buf.yaml @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: bsr.internal/foo/test-d diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/d/v1/d.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/d/v1/d.proto new file mode 100644 index 000000000..95c4b33fe --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/d/v1/d.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package d.v1; + +message D {} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/buf.yaml new file mode 100644 index 000000000..22e0cc18d --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/buf.yaml @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: bsr.internal/foo/test-e +deps: + - bsr.internal/foo/test-f diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/e/v1/e.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/e/v1/e.proto new file mode 100644 index 000000000..49f02ef14 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/e/v1/e.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package e.v1; + +import "f/v1/f.proto"; + +message E { + f.v1.F f = 1; +} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/buf.yaml new file mode 100644 index 000000000..e56c05319 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/buf.yaml @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: bsr.internal/foo/test-f diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/f/v1/f.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/f/v1/f.proto new file mode 100644 index 000000000..8859fb553 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/f/v1/f.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package f.v1; + +message F {} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/buf.yaml new file mode 100644 index 000000000..ec553f005 --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/buf.yaml @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: bsr.internal/foo/test-g diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/g/v1/g.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/g/v1/g.proto new file mode 100644 index 000000000..47c3894fa --- /dev/null +++ b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/g/v1/g.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package g.v1; + +message G {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimage.go b/pkg/bufman/bufpkg/bufimage/bufimage.go new file mode 100644 index 000000000..dc3c6886e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimage.go @@ -0,0 +1,615 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "fmt" + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +// ImageFile is a Protobuf file within an image. +type ImageFile interface { + bufmoduleref.FileInfo + // Proto is the backing *descriptorpb.FileDescriptorProto for this File. + // + // FileDescriptor should be preferred to Proto. We keep this method around + // because we have code that does modification to the ImageFile via this. + // + // This will never be nil. + // The value Path() is equal to Proto.GetName() . + Proto() *descriptorpb.FileDescriptorProto + // FileDescriptor is the backing FileDescriptor for this File. + // + // This will never be nil. + // The value Path() is equal to FileDescriptor.GetName() . + FileDescriptor() protodescriptor.FileDescriptor + // IsSyntaxUnspecified will be true if the syntax was not explicitly specified. + IsSyntaxUnspecified() bool + // UnusedDependencyIndexes returns the indexes of the unused dependencies within + // FileDescriptor.GetDependency(). + // + // All indexes will be valid. + // Will return nil if empty. + UnusedDependencyIndexes() []int32 + + withIsImport(isImport bool) ImageFile + isImageFile() +} + +// NewImageFile returns a new ImageFile. +// +// If externalPath is empty, path is used. +// +// TODO: moduleIdentity and commit should be options since they are optional. +func NewImageFile( + fileDescriptor protodescriptor.FileDescriptor, + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, + externalPath string, + isImport bool, + isSyntaxUnspecified bool, + unusedDependencyIndexes []int32, +) (ImageFile, error) { + return newImageFile( + fileDescriptor, + moduleIdentity, + commit, + externalPath, + isImport, + isSyntaxUnspecified, + unusedDependencyIndexes, + ) +} + +// Image is a buf image. +type Image interface { + // Files are the files that comprise the image. + // + // This contains all files, including imports if available. + // The returned files are in correct DAG order. + // + // All files that have the same ModuleIdentity will also have the same commit, or no commit. + // This is enforced at construction time. + Files() []ImageFile + // GetFile gets the file for the root relative file path. + // + // If the file does not exist, nil is returned. + // The path is expected to be normalized and validated. + // Note that all values of GetDependency() can be used here. + GetFile(path string) ImageFile + isImage() +} + +// NewImage returns a new Image for the given ImageFiles. +// +// The input ImageFiles are expected to be in correct DAG order! +// TODO: Consider checking the above, and if not, reordering the Files. +// If imageFiles is empty, returns error +func NewImage(imageFiles []ImageFile) (Image, error) { + return newImage(imageFiles, false) +} + +// MergeImages returns a new Image for the given Images. ImageFiles +// treated as non-imports in at least one of the given Images will +// be treated as non-imports in the returned Image. The first non-import +// version of a file will be used in the result. +// +// Reorders the ImageFiles to be in DAG order. +// Duplicates can exist across the Images, but only if duplicates are non-imports. +func MergeImages(images ...Image) (Image, error) { + switch len(images) { + case 0: + return nil, nil + case 1: + return images[0], nil + default: + var paths []string + imageFileSet := make(map[string]ImageFile) + for _, image := range images { + for _, currentImageFile := range image.Files() { + storedImageFile, ok := imageFileSet[currentImageFile.Path()] + if !ok { + imageFileSet[currentImageFile.Path()] = currentImageFile + paths = append(paths, currentImageFile.Path()) + continue + } + if !storedImageFile.IsImport() && !currentImageFile.IsImport() { + return nil, fmt.Errorf("%s is a non-import in multiple images", currentImageFile.Path()) + } + if storedImageFile.IsImport() && !currentImageFile.IsImport() { + imageFileSet[currentImageFile.Path()] = currentImageFile + } + } + } + // We need to preserve order for deterministic results, so we add + // the files in the order they're given, but base our selection + // on the imageFileSet. + imageFiles := make([]ImageFile, 0, len(imageFileSet)) + for _, path := range paths { + imageFiles = append(imageFiles, imageFileSet[path] /* Guaranteed to exist */) + } + return newImage(imageFiles, true) + } +} + +// NewImageForProto returns a new Image for the given proto Image. +// +// The input Files are expected to be in correct DAG order! +// TODO: Consider checking the above, and if not, reordering the Files. +// +// TODO: do we want to add the ability to do external path resolution here? +func NewImageForProto(protoImage *imagev1.Image, options ...NewImageForProtoOption) (Image, error) { + var newImageOptions newImageForProtoOptions + for _, option := range options { + option(&newImageOptions) + } + if newImageOptions.noReparse && newImageOptions.computeUnusedImports { + return nil, fmt.Errorf("cannot use both WithNoReparse and WithComputeUnusedImports options; they are mutually exclusive") + } + if !newImageOptions.noReparse { + if err := reparseImageProto(protoImage, newImageOptions.computeUnusedImports); err != nil { + return nil, err + } + } + if err := validateProtoImage(protoImage); err != nil { + return nil, err + } + imageFiles := make([]ImageFile, len(protoImage.File)) + for i, protoImageFile := range protoImage.File { + var isImport bool + var isSyntaxUnspecified bool + var unusedDependencyIndexes []int32 + var moduleIdentity bufmoduleref.ModuleIdentity + var commit string + var err error + if protoImageFileExtension := protoImageFile.GetBufExtension(); protoImageFileExtension != nil { + isImport = protoImageFileExtension.GetIsImport() + isSyntaxUnspecified = protoImageFileExtension.GetIsSyntaxUnspecified() + unusedDependencyIndexes = protoImageFileExtension.GetUnusedDependency() + if protoModuleInfo := protoImageFileExtension.GetModuleInfo(); protoModuleInfo != nil { + if protoModuleName := protoModuleInfo.GetName(); protoModuleName != nil { + moduleIdentity, err = bufmoduleref.NewModuleIdentity( + protoModuleName.GetRemote(), + protoModuleName.GetOwner(), + protoModuleName.GetRepository(), + ) + if err != nil { + return nil, err + } + // we only want to set this if there is a module name + commit = protoModuleInfo.GetCommit() + } + } + } + imageFile, err := NewImageFile( + protoImageFile, + moduleIdentity, + commit, + protoImageFile.GetName(), + isImport, + isSyntaxUnspecified, + unusedDependencyIndexes, + ) + if err != nil { + return nil, err + } + imageFiles[i] = imageFile + } + return NewImage(imageFiles) +} + +// NewImageForCodeGeneratorRequest returns a new Image from a given CodeGeneratorRequest. +// +// The input Files are expected to be in correct DAG order! +// TODO: Consider checking the above, and if not, reordering the Files. +func NewImageForCodeGeneratorRequest(request *pluginpb.CodeGeneratorRequest, options ...NewImageForProtoOption) (Image, error) { + if err := protodescriptor.ValidateCodeGeneratorRequestExceptFileDescriptorProtos(request); err != nil { + return nil, err + } + protoImageFiles := make([]*imagev1.ImageFile, len(request.GetProtoFile())) + for i, fileDescriptorProto := range request.GetProtoFile() { + // we filter whether something is an import or not in ImageWithOnlyPaths + // we cannot determine if the syntax was unset + protoImageFiles[i] = fileDescriptorProtoToProtoImageFile(fileDescriptorProto, false, false, nil, nil, "") + } + image, err := NewImageForProto( + &imagev1.Image{ + File: protoImageFiles, + }, + options..., + ) + if err != nil { + return nil, err + } + return ImageWithOnlyPaths( + image, + request.GetFileToGenerate(), + nil, + ) +} + +// NewImageForProtoOption is an option for use with NewImageForProto. +type NewImageForProtoOption func(*newImageForProtoOptions) + +// WithNoReparse instructs NewImageForProto to skip the reparse step. The reparse +// step is usually needed when unmarshalling the image from bytes. It reconstitutes +// custom options, from unrecognized bytes to known extension fields. +func WithNoReparse() NewImageForProtoOption { + return func(options *newImageForProtoOptions) { + options.noReparse = true + } +} + +// WithUnusedImportsComputation instructs NewImageForProto to compute unused imports +// for the files. These are usually computed by the compiler and stored in the image. +// But some sources of images may not include this information, so this option can be +// used to ensure that information is present in the image and accurate. +// +// This option is NOT compatible with WithNoReparse: the image must be re-parsed for +// there to be adequate information for computing unused imports. +func WithUnusedImportsComputation() NewImageForProtoOption { + return func(options *newImageForProtoOptions) { + options.computeUnusedImports = true + } +} + +// ImageWithoutImports returns a copy of the Image without imports. +// +// The backing Files are not copied. +func ImageWithoutImports(image Image) Image { + imageFiles := image.Files() + newImageFiles := make([]ImageFile, 0, len(imageFiles)) + for _, imageFile := range imageFiles { + if !imageFile.IsImport() { + newImageFiles = append(newImageFiles, imageFile) + } + } + return newImageNoValidate(newImageFiles) +} + +// ImageWithOnlyPaths returns a copy of the Image that only includes the files +// with the given root relative file paths or directories. +// +// Note that paths can be either files or directories - whether or not a path +// is included is a result of normalpath.EqualsOrContainsPath. +// +// If a root relative file path does not exist, this errors. +func ImageWithOnlyPaths( + image Image, + paths []string, + excludePaths []string, +) (Image, error) { + return imageWithOnlyPaths(image, paths, excludePaths, false) +} + +// ImageWithOnlyPathsAllowNotExist returns a copy of the Image that only includes the files +// with the given root relative file paths. +// +// Note that paths can be either files or directories - whether or not a path +// is included is a result of normalpath.EqualsOrContainsPath. +// +// If a root relative file path does not exist, this skips this path. +func ImageWithOnlyPathsAllowNotExist( + image Image, + paths []string, + excludePaths []string, +) (Image, error) { + return imageWithOnlyPaths(image, paths, excludePaths, true) +} + +// ImageByDir returns multiple images that have non-imports split +// by directory. +// +// That is, each Image will only contain a single directory's files +// as it's non-imports, along with all required imports for the +// files in that directory. +func ImageByDir(image Image) ([]Image, error) { + imageFiles := image.Files() + paths := make([]string, 0, len(imageFiles)) + for _, imageFile := range imageFiles { + if !imageFile.IsImport() { + paths = append(paths, imageFile.Path()) + } + } + dirToPaths := normalpath.ByDir(paths...) + // we need this to produce a deterministic order of the returned Images + dirs := make([]string, 0, len(dirToPaths)) + for dir := range dirToPaths { + dirs = append(dirs, dir) + } + sort.Strings(dirs) + newImages := make([]Image, 0, len(dirToPaths)) + for _, dir := range dirs { + paths, ok := dirToPaths[dir] + if !ok { + // this should never happen + return nil, fmt.Errorf("no dir for %q in dirToPaths", dir) + } + newImage, err := ImageWithOnlyPaths(image, paths, nil) + if err != nil { + return nil, err + } + newImages = append(newImages, newImage) + } + return newImages, nil +} + +// ImageToProtoImage returns a new ProtoImage for the Image. +func ImageToProtoImage(image Image) *imagev1.Image { + imageFiles := image.Files() + protoImage := &imagev1.Image{ + File: make([]*imagev1.ImageFile, len(imageFiles)), + } + for i, imageFile := range imageFiles { + protoImage.File[i] = imageFileToProtoImageFile(imageFile) + } + return protoImage +} + +// ImageToFileDescriptorSet returns a new FileDescriptorSet for the Image. +func ImageToFileDescriptorSet(image Image) *descriptorpb.FileDescriptorSet { + return protodescriptor.FileDescriptorSetForFileDescriptors(ImageToFileDescriptors(image)...) +} + +// ImageToFileDescriptors returns the FileDescriptors for the Image. +func ImageToFileDescriptors(image Image) []protodescriptor.FileDescriptor { + return imageFilesToFileDescriptors(image.Files()) +} + +// ImageToFileDescriptorProtos returns the FileDescriptorProtos for the Image. +func ImageToFileDescriptorProtos(image Image) []*descriptorpb.FileDescriptorProto { + return imageFilesToFileDescriptorProtos(image.Files()) +} + +// ImageToCodeGeneratorRequest returns a new CodeGeneratorRequest for the Image. +// +// All non-imports are added as files to generate. +// If includeImports is set, all non-well-known-type imports are also added as files to generate. +// If includeWellKnownTypes is set, well-known-type imports are also added as files to generate. +// includeWellKnownTypes has no effect if includeImports is not set. +func ImageToCodeGeneratorRequest( + image Image, + parameter string, + compilerVersion *pluginpb.Version, + includeImports bool, + includeWellKnownTypes bool, +) *pluginpb.CodeGeneratorRequest { + return imageToCodeGeneratorRequest( + image, + parameter, + compilerVersion, + includeImports, + includeWellKnownTypes, + nil, + nil, + ) +} + +// ImagesToCodeGeneratorRequests converts the Images to CodeGeneratorRequests. +// +// All non-imports are added as files to generate. +// If includeImports is set, all non-well-known-type imports are also added as files to generate. +// If includeImports is set, only one CodeGeneratorRequest will contain any given file as a FileToGenerate. +// If includeWellKnownTypes is set, well-known-type imports are also added as files to generate. +// includeWellKnownTypes has no effect if includeImports is not set. +func ImagesToCodeGeneratorRequests( + images []Image, + parameter string, + compilerVersion *pluginpb.Version, + includeImports bool, + includeWellKnownTypes bool, +) []*pluginpb.CodeGeneratorRequest { + requests := make([]*pluginpb.CodeGeneratorRequest, len(images)) + // alreadyUsedPaths is a map of paths that have already been added to an image. + // + // We track this if includeImports is set, so that when we find an import, we can + // see if the import was already added to a CodeGeneratorRequest via another Image + // in the Image slice. If the import was already added, we do not add duplicates + // across CodeGeneratorRequests. + var alreadyUsedPaths map[string]struct{} + // nonImportPaths is a map of non-import paths. + // + // We track this if includeImports is set. If we find a non-import file in Image A + // and this file is an import in Image B, the file will have already been added to + // a CodeGeneratorRequest via Image A, so do not add the duplicate to any other + // CodeGeneratorRequest. + var nonImportPaths map[string]struct{} + if includeImports { + // We don't need to track these if includeImports is false, so we only populate + // the maps if includeImports is true. If includeImports is false, only non-imports + // will be added to each CodeGeneratorRequest, so figuring out whether or not + // we should add a given import to a given CodeGeneratorRequest is unnecessary. + // + // imageToCodeGeneratorRequest checks if these maps are nil before every access. + alreadyUsedPaths = make(map[string]struct{}) + nonImportPaths = make(map[string]struct{}) + for _, image := range images { + for _, imageFile := range image.Files() { + if !imageFile.IsImport() { + nonImportPaths[imageFile.Path()] = struct{}{} + } + } + } + } + for i, image := range images { + requests[i] = imageToCodeGeneratorRequest( + image, + parameter, + compilerVersion, + includeImports, + includeWellKnownTypes, + alreadyUsedPaths, + nonImportPaths, + ) + } + return requests +} + +// ProtoImageToFileDescriptors returns the FileDescriptors for the proto Image. +func ProtoImageToFileDescriptors(protoImage *imagev1.Image) []protodescriptor.FileDescriptor { + return protoImageFilesToFileDescriptors(protoImage.File) +} + +// ImageDependency is a dependency of an image. +// +// This could conceivably be part of ImageFile or bufmoduleref.FileInfo. +// For ImageFile, this would be a field that is ignored when translated to proto, +// and is calculated on creation from proto. IsImport would become ImportType. +// You could go a step further and make this optionally part of the proto definition. +// +// You could even go down to bufmoduleref.FileInfo if you used the AST, but this +// could be error prone. +// +// However, for simplicity now (and to not rewrite the whole codebase), we make +// this a separate type that is calculated off of an Image after the fact. +// +// If this became part of ImageFile or bufmoduleref.FileInfo, you would get +// all the ImageDependencies from the ImageFiles, and then sort | uniq them +// to get the ImageDependencies for an Image. This would remove the requirement +// of this associated type to have a ModuleIdentity and commit, so in +// the IsDirect example below, d.proto would not be "ignored" - it would +// be an ImageFile like any other, with ImportType DIRECT. +// +// Note that if we ever do this, there is validation in newImage that enforces +// that all ImageFiles with the same ModuleIdentity have the same commit. This +// validation will likely have to be moved around. +type ImageModuleDependency interface { + // String() returns remote/owner/repository[:commit]. + fmt.Stringer + + // Required. Will never be nil. + ModuleIdentity() bufmoduleref.ModuleIdentity + // Optional. May be empty. + Commit() string + + // IsDirect returns true if the dependency is a direct dependency. + // + // A dependency is direct if it is only an import of non-imports in the image. + // + // Example: + // + // a.proto, module buf.build/foo/a, is non-import, imports b.proto + // b.proto, module buf.build/foo/b, is import, imports c.proto + // c.proto, module buf.build/foo/c, is import + // + // In this case, the list would contain only buf.build/foo/b, as buf.build/foo/a + // for a.proto is a non-import, and buf.build/foo/c for c.proto is only imported + // by an import + IsDirect() bool + + isImageModuleDependency() +} + +// ImageModuleDependency returns all ImageModuleDependencies for the Image. +// +// Does not return any ImageModuleDependencies for non-imports, that is the +// ModuleIdentities and commits represented by non-imports are not represented +// in this list. +func ImageModuleDependencies(image Image) []ImageModuleDependency { + importsOfNonImports := make(map[string]struct{}) + for _, imageFile := range image.Files() { + if !imageFile.IsImport() { + for _, dependency := range imageFile.FileDescriptor().GetDependency() { + importsOfNonImports[dependency] = struct{}{} + } + } + } + // We know that all ImageFiles with the same ModuleIdentity + // have the same commit or no commit, so using String() will properly identify + // unique dependencies. + stringToImageModuleDependency := make(map[string]ImageModuleDependency) + for _, imageFile := range image.Files() { + if imageFile.IsImport() { + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + _, isDirect := importsOfNonImports[imageFile.Path()] + imageModuleDependency := newImageModuleDependency( + moduleIdentity, + imageFile.Commit(), + isDirect, + ) + stringToImageModuleDependency[imageModuleDependency.String()] = imageModuleDependency + } + } + } + imageModuleDependencies := make([]ImageModuleDependency, 0, len(stringToImageModuleDependency)) + for _, imageModuleDependency := range stringToImageModuleDependency { + imageModuleDependencies = append( + imageModuleDependencies, + imageModuleDependency, + ) + } + sortImageModuleDependencies(imageModuleDependencies) + return imageModuleDependencies +} + +type newImageForProtoOptions struct { + noReparse bool + computeUnusedImports bool +} + +func reparseImageProto(protoImage *imagev1.Image, computeUnusedImports bool) error { + // TODO right now, NewResolver sets AllowUnresolvable to true all the time + // we want to make this into a check, and we verify if we need this for the individual command + resolver := protoencoding.NewLazyResolver( + ProtoImageToFileDescriptors( + protoImage, + )..., + ) + if err := protoencoding.ReparseUnrecognized(resolver, protoImage.ProtoReflect()); err != nil { + return fmt.Errorf("could not reparse image: %v", err) + } + if computeUnusedImports { + tracker := &importTracker{ + resolver: resolver, + used: map[string]map[string]struct{}{}, + } + tracker.findUsedImports(protoImage) + // Now we can populated list of unused dependencies + for _, file := range protoImage.File { + bufExt := file.BufExtension + if bufExt == nil { + bufExt = &imagev1.ImageFileExtension{} + file.BufExtension = bufExt + } + bufExt.UnusedDependency = nil // reset + usedImports := tracker.used[file.GetName()] + for i, dep := range file.Dependency { + if _, ok := usedImports[dep]; !ok { + // it's fine if it's public + isPublic := false + for _, publicDepIndex := range file.PublicDependency { + if i == int(publicDepIndex) { + isPublic = true + break + } + } + if !isPublic { + bufExt.UnusedDependency = append(bufExt.UnusedDependency, int32(i)) + } + } + } + } + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuild.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuild.go new file mode 100644 index 000000000..63af5f61d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuild.go @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagebuild + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "go.uber.org/zap" +) + +// Builder builds Protobuf files into Images. +type Builder interface { + // Build runs compilation. + // + // The FileRefs are assumed to have been created by a FileRefProvider, that is + // they are unique relative to the roots. + // + // If an error is returned, it is a system error. + // Only one of Image and FileAnnotations will be returned. + // + // FileAnnotations will use external file paths. + Build( + ctx context.Context, + module bufmodule.Module, + options ...BuildOption, + ) (bufimage.Image, []bufanalysis.FileAnnotation, error) +} + +// NewBuilder returns a new Builder. +func NewBuilder(logger *zap.Logger, moduleReader bufmodule.ModuleReader) Builder { + return newBuilder(logger, moduleReader) +} + +// BuildOption is an option for Build. +type BuildOption func(*buildOptions) + +// WithExcludeSourceCodeInfo returns a BuildOption that excludes sourceCodeInfo. +func WithExcludeSourceCodeInfo() BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.excludeSourceCodeInfo = true + } +} + +// WithExpectedDirectDependencies sets the module dependencies that are expected, usually because +// they are in a configuration file (buf.yaml). If the build detects that there are direct dependencies +// outside of this list, a warning will be printed. +func WithExpectedDirectDependencies(expectedDirectDependencies []bufmoduleref.ModuleReference) BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.expectedDirectDependencies = expectedDirectDependencies + } +} + +// WithWorkspace sets the workspace to be read from instead of ModuleReader, and to not warn imports for. +// +// TODO: this can probably be dealt with by finding out if an ImageFile has a commit +// or not, although that is hacky, that's an implementation detail in practice, but perhaps +// we could justify it - transitive dependencies without commits don't make sense? +// +// TODO: shouldn't buf.yamls in workspaces have deps properly declared in them anyways? Why not warn? +func WithWorkspace(workspace bufmodule.Workspace) BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.workspace = workspace + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting.go new file mode 100644 index 000000000..84bfba3fd --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting.go @@ -0,0 +1,238 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagebuildtesting + +import ( + "context" + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buftesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/prototesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/tmp" + "go.uber.org/multierr" + "go.uber.org/zap" + "golang.org/x/tools/txtar" + "google.golang.org/protobuf/types/descriptorpb" +) + +// Fuzz is the entrypoint for the fuzzer. +// We use https://github.com/dvyukov/go-fuzz for fuzzing. +// Please follow the instructions +// in their README for help with running the fuzz targets. +func Fuzz(data []byte) int { + ctx := context.Background() + runner := command.NewRunner() + result, err := fuzz(ctx, runner, data) + if err != nil { + // data was invalid in some way + return -1 + } + return result.panicOrN(ctx) +} + +func fuzz(ctx context.Context, runner command.Runner, data []byte) (_ *fuzzResult, retErr error) { + dir, err := tmp.NewDir() + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, dir.Close()) + }() + if err := untxtar(data, dir.AbsPath()); err != nil { + return nil, err + } + + filePaths, err := buftesting.GetProtocFilePathsErr(ctx, dir.AbsPath(), 0) + if err != nil { + return nil, err + } + + actualProtocFileDescriptorSet, protocErr := prototesting.GetProtocFileDescriptorSet( + ctx, + runner, + []string{dir.AbsPath()}, + filePaths, + false, + false, + ) + + image, bufAnnotations, bufErr := fuzzBuild(ctx, dir.AbsPath()) + return newFuzzResult( + runner, + bufAnnotations, + bufErr, + protocErr, + actualProtocFileDescriptorSet, + image, + ), nil +} + +// fuzzBuild does a builder.Build for a fuzz test. +func fuzzBuild(ctx context.Context, dirPath string) (bufimage.Image, []bufanalysis.FileAnnotation, error) { + module, err := fuzzGetModule(ctx, dirPath) + if err != nil { + return nil, nil, err + } + builder := bufimagebuild.NewBuilder(zap.NewNop(), bufmodule.NewNopModuleReader()) + opt := bufimagebuild.WithExcludeSourceCodeInfo() + return builder.Build(ctx, module, opt) +} + +// fuzzGetModule gets the bufmodule.Module for a fuzz test. +func fuzzGetModule(ctx context.Context, dirPath string) (bufmodule.Module, error) { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + dirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + if err != nil { + return nil, err + } + config, err := bufmoduleconfig.NewConfigV1(bufmoduleconfig.ExternalConfigV1{}) + if err != nil { + return nil, err + } + return bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( + ctx, + readWriteBucket, + config, + ) +} + +// txtarParse is a wrapper around txtar.Parse that will turn panics into errors. +// This is necessary because of an issue where txtar.Parse can panic on invalid data. Because data is generated by the +// fuzzer, it will occasionally generate data that causes this panic. +// See https://github.com/golang/go/issues/47193 +func txtarParse(data []byte) (_ *txtar.Archive, retErr error) { + defer func() { + if p := recover(); p != nil { + retErr = fmt.Errorf("panic from txtar.Parse: %v", p) + } + }() + return txtar.Parse(data), nil +} + +// untxtar extracts txtar data to destDirPath. +func untxtar(data []byte, destDirPath string) error { + archive, err := txtarParse(data) + if err != nil { + return err + } + if len(archive.Files) == 0 { + return fmt.Errorf("txtar contains no files") + } + for _, file := range archive.Files { + dirPath := filepath.Dir(file.Name) + if dirPath != "" { + if err := os.MkdirAll(filepath.Join(destDirPath, dirPath), 0o700); err != nil { + return err + } + } + if err := os.WriteFile( + filepath.Join(destDirPath, file.Name), + file.Data, + 0o600, + ); err != nil { + return err + } + } + return nil +} + +type fuzzResult struct { + runner command.Runner + bufAnnotations []bufanalysis.FileAnnotation + bufErr error + protocErr error + actualProtocFileDescriptorSet *descriptorpb.FileDescriptorSet + image bufimage.Image +} + +func newFuzzResult( + runner command.Runner, + bufAnnotations []bufanalysis.FileAnnotation, + bufErr error, + protocErr error, + actualProtocFileDescriptorSet *descriptorpb.FileDescriptorSet, + image bufimage.Image, +) *fuzzResult { + return &fuzzResult{ + runner: runner, + bufAnnotations: bufAnnotations, + bufErr: bufErr, + protocErr: protocErr, + actualProtocFileDescriptorSet: actualProtocFileDescriptorSet, + image: image, + } +} + +// panicOrN panics if there is an error or returns the appropriate value for Fuzz to return. +func (f *fuzzResult) panicOrN(ctx context.Context) int { + if err := f.error(ctx); err != nil { + panic(err.Error()) + } + // This will return 1 for valid protobufs and 0 for invalid in order to encourage the fuzzer to generate more + // realistic looking data. + if f.protocErr == nil { + return 1 + } + return 0 +} + +// error returns an error that should cause Fuzz to panic. +func (f *fuzzResult) error(ctx context.Context) error { + if f.protocErr != nil { + if f.bufErr == nil && len(f.bufAnnotations) == 0 { + return fmt.Errorf("protoc has error but buf does not: %v", f.protocErr) + } + return nil + } + if f.bufErr != nil { + return fmt.Errorf("buf has error but protoc does not: %v", f.bufErr) + } + if len(f.bufAnnotations) > 0 { + return fmt.Errorf("buf has file annotations but protoc has no error: %v", f.bufAnnotations) + } + image := bufimage.ImageWithoutImports(f.image) + fileDescriptorSet := bufimage.ImageToFileDescriptorSet(image) + + diff, err := prototesting.DiffFileDescriptorSetsJSON( + ctx, + f.runner, + fileDescriptorSet, + f.actualProtocFileDescriptorSet, + "buf", + "protoc", + ) + if err != nil { + return fmt.Errorf("error diffing results: %v", err) + } + if strings.TrimSpace(diff) != "" { + return fmt.Errorf("protoc and buf have different results: %v", diff) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting_unix_test.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting_unix_test.go new file mode 100644 index 000000000..44453fa20 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting_unix_test.go @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package bufimagebuildtesting + +import ( + "context" + "io/fs" + "os" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/stretchr/testify/require" +) + +func TestCorpus(t *testing.T) { + t.Parallel() + // To focus on just one test in the corpus, put its file name here. Don't forget to revert before committing. + focus := "" + ctx := context.Background() + runner := command.NewRunner() + require.NoError(t, filepath.Walk("corpus", func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + if focus != "" && info.Name() != focus { + return nil + } + t.Run(info.Name(), func(t *testing.T) { + data, err := os.ReadFile(filepath.Join("corpus", info.Name())) + require.NoError(t, err) + result, err := fuzz(ctx, runner, data) + require.NoError(t, err) + require.NoError(t, result.error(ctx)) + }) + return nil + })) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/alloptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/alloptions.txtar new file mode 100644 index 000000000..b03fa8a0b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/alloptions.txtar @@ -0,0 +1,20 @@ +-- a.proto -- +option csharp_namespace = "foo"; +option go_package = "foo"; +option java_package = "foo"; +option java_outer_classname = "foo"; +option objc_class_prefix = "foo"; +option php_class_prefix = "foo"; +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; +option ruby_package = "foo"; +option swift_prefix = "foo"; + +option optimize_for = SPEED; +option cc_enable_arenas = false; +option cc_generic_services = false; +option java_generic_services = false; +option java_multiple_files = false; +option java_string_check_utf8 = false; +option php_generic_services = false; +option py_generic_services = false; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ccoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ccoptions.txtar new file mode 100644 index 000000000..a78b272be --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ccoptions.txtar @@ -0,0 +1,3 @@ +-- a.proto -- +option cc_enable_arenas = false; +option optimize_for = LITE_RUNTIME; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores.txtar new file mode 100644 index 000000000..4cd3847cb --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores.txtar @@ -0,0 +1,101 @@ +-- a.proto -- +syntax = "proto3"; + +// To team members: I am sorry you have to read such a bad file. +// To others: Do the opposite of whatever this file does. + +// buf:lint:ignore PACKAGE_DIRECTORY_MATCH +// buf:lint:ignore PACKAGE_LOWER_SNAKE_CASE +// buf:lint:ignore PACKAGE_VERSION_SUFFIX +package A; + +// buf:lint:ignore IMPORT_NO_PUBLIC +import public "google/protobuf/empty.proto"; + +// buf:lint:ignore ENUM_PASCAL_CASE +enum enumFoo { + // buf:lint:ignore ENUM_NO_ALLOW_ALIAS + option allow_alias = true; + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooNone = 0; + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooOne = 1; + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooTwo = 1; +} + +// buf:lint:ignore MESSAGE_PASCAL_CASE +message messageFoo { + // buf:lint:ignore MESSAGE_PASCAL_CASE + message messageBar { + // buf:lint:ignore MESSAGE_PASCAL_CASE + message messageBaz { + // buf:lint:ignore ENUM_PASCAL_CASE + enum enumFoo { + // buf:lint:ignore ENUM_NO_ALLOW_ALIAS + option allow_alias = true; + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooNone = 0; + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooOne = 1; + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enumFooTwo = 1; + } + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Foo = 1; + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + oneof Bar { + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Baz = 2; + } + } + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Foo = 1; + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + oneof Bar { + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Baz = 2; + } + } + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Foo = 1; + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + oneof Bar { + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + int64 Baz = 2; + } +} + +// buf:lint:ignore SERVICE_PASCAL_CASE +service serviceFoo { + // buf:lint:ignore RPC_PASCAL_CASE + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + rpc methodFoo( + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + google.protobuf.Empty + ) returns ( + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + google.protobuf.Empty + ) {} +} +-- buf.yaml -- +version: v1 +lint: + use: + - PACKAGE_DIRECTORY_MATCH + - PACKAGE_LOWER_SNAKE_CASE + - PACKAGE_VERSION_SUFFIX + - IMPORT_NO_PUBLIC + - ENUM_PASCAL_CASE + - ENUM_NO_ALLOW_ALIAS + - ENUM_ZERO_VALUE_SUFFIX + - ENUM_VALUE_UPPER_SNAKE_CASE + - MESSAGE_PASCAL_CASE + - FIELD_LOWER_SNAKE_CASE + - ONEOF_LOWER_SNAKE_CASE + - SERVICE_PASCAL_CASE + - RPC_PASCAL_CASE + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores_cascade.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores_cascade.txtar new file mode 100644 index 000000000..862c7c8ee --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores_cascade.txtar @@ -0,0 +1,89 @@ +-- a.proto -- +syntax = "proto3"; + +// To team members: I am sorry you have to read such a bad file. +// To others: Do the opposite of whatever this file does. + +package a; + +import "google/protobuf/empty.proto"; + +// buf:lint:ignore ENUM_PASCAL_CASE +// buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE +enum enumFoo { + // buf:lint:ignore ENUM_NO_ALLOW_ALIAS + option allow_alias = true; + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + enumFooNone = 0; + enumFooOne = 1; + enumFooTwo = 1; +} + +// buf:lint:ignore MESSAGE_PASCAL_CASE +// buf:lint:ignore FIELD_LOWER_SNAKE_CASE +// buf:lint:ignore ONEOF_LOWER_SNAKE_CASE +message messageFoo { + // buf:lint:ignore MESSAGE_PASCAL_CASE + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + message messageBar { + // buf:lint:ignore MESSAGE_PASCAL_CASE + // buf:lint:ignore FIELD_LOWER_SNAKE_CASE + // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE + message messageBaz { + // buf:lint:ignore ENUM_PASCAL_CASE + // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enum enumFoo { + // buf:lint:ignore ENUM_NO_ALLOW_ALIAS + option allow_alias = true; + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + enumFooNone = 0; + enumFooOne = 1; + enumFooTwo = 1; + } + int64 Foo = 1; + oneof Bar { + int64 Baz = 2; + } + } + int64 Foo = 1; + oneof Bar { + int64 Baz = 2; + } + } + int64 Foo = 1; + oneof Bar { + int64 Baz = 2; + } +} + +// buf:lint:ignore SERVICE_PASCAL_CASE +// buf:lint:ignore RPC_PASCAL_CASE +// buf:lint:ignore RPC_REQUEST_STANDARD_NAME +// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME +service serviceFoo { + rpc methodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +// buf:lint:ignore SERVICE_PASCAL_CASE +service serviceBar { + // buf:lint:ignore RPC_PASCAL_CASE + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + rpc methodBar(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} +-- buf.yaml -- +version: v1 +lint: + use: + - ENUM_PASCAL_CASE + - ENUM_NO_ALLOW_ALIAS + - ENUM_ZERO_VALUE_SUFFIX + - ENUM_VALUE_UPPER_SNAKE_CASE + - MESSAGE_PASCAL_CASE + - FIELD_LOWER_SNAKE_CASE + - ONEOF_LOWER_SNAKE_CASE + - SERVICE_PASCAL_CASE + - RPC_PASCAL_CASE + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comments.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comments.txtar new file mode 100644 index 000000000..b856a6529 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comments.txtar @@ -0,0 +1,288 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +enum EnumFoo { + ENUM_FOO_UNSPECIFIED = 0; + ENUM_FOO_ONE = 1; +} + +message MessageFoo { + message MessageBar { + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + } + message MessageBaz { + int64 foo = 1; + oneof bar { + int64 baz = 2; + } + } + int64 foo = 1; + oneof bar { + int64 baz = 2; + } + } + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + } + int64 foo = 1; + oneof bar { + int64 baz = 2; + } +} + +service ServiceFoo { + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} + +// comment +enum EnumFoo2 { + // comment + ENUM_FOO2_UNSPECIFIED = 0; + // comment + ENUM_FOO2_ONE = 1; +} + +// comment +message MessageFoo2 { + // comment + message MessageBar { + // comment + enum Foo { + // comment + FOO_UNSPECIFIED = 0; + // comment + FOO_ONE = 1; + } + // comment + message MessageBaz { + // comment + int64 foo = 1; + // comment + oneof bar { + // comment + int64 baz = 2; + } + } + // comment + int64 foo = 1; + // comment + oneof bar { + // comment + int64 baz = 2; + } + } + // comment + enum Foo { + // comment + FOO_UNSPECIFIED = 0; + // comment + FOO_ONE = 1; + } + // comment + int64 foo = 1; + // comment + oneof bar { + // comment + int64 baz = 2; + } +} + +// comment +service ServiceFoo2 { + // comment + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + // comment + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); +} + +enum EnumFoo3 { + ENUM_FOO3_UNSPECIFIED = 0; // bad comment + ENUM_FOO3_ONE = 1; // bad comment +} // bad comment + +message MessageFoo3 { + message MessageBar { + enum Foo { + FOO_UNSPECIFIED = 0; // bad comment + FOO_ONE = 1; // bad comment + } // bad comment + message MessageBaz { + int64 foo = 1; // bad comment + oneof bar { // bad comment + int64 baz = 2; // bad comment + } // bad comment + } + int64 foo = 1; // bad comment + oneof bar { // bad comment + int64 baz = 2; // bad comment + } // bad comment + } // bad comment + enum Foo { // bad comment + FOO_UNSPECIFIED = 0; // bad comment + FOO_ONE = 1; // bad comment + } // bad comment + int64 foo = 1; // bad comment + oneof bar { // bad comment + int64 baz = 2; // bad comment + } // bad comment +} + +service ServiceFoo3 { + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} // bad comment + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); // bad comment +} + +// +enum EnumFoo4 { + // + ENUM_FOO4_UNSPECIFIED = 0; + // + ENUM_FOO4_ONE = 1; +} + +// +message MessageFoo4 { + // + message MessageBar { + // + enum Foo { + // + FOO_UNSPECIFIED = 0; + // + FOO_ONE = 1; + } + // + message MessageBaz { + // + int64 foo = 1; + // + oneof bar { + // + int64 baz = 2; + } + } + // + int64 foo = 1; + // + oneof bar { + // + int64 baz = 2; + } + } + // + enum Foo { + // + FOO_UNSPECIFIED = 0; + // + FOO_ONE = 1; + } + // + int64 foo = 1; + // + oneof bar { + // + int64 baz = 2; + } +} + +// +service ServiceFoo4 { + // + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + // + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); +} + +/* */ +enum EnumFoo5 { + /* */ + ENUM_FOO5_UNSPECIFIED = 0; + /* */ + ENUM_FOO5_ONE = 1; +} + +/* */ +message MessageFoo5 { + /* */ + message MessageBar { + /* */ + enum Foo { + /* */ + FOO_UNSPECIFIED = 0; + /* */ + FOO_ONE = 1; + } + /* */ + message MessageBaz { + /* */ + int64 foo = 1; + /* */ + oneof bar { + /* */ + int64 baz = 2; + } + } + /* */ + int64 foo = 1; + /* */ + oneof bar { + /* */ + int64 baz = 2; + } + } + /* */ + enum Foo { + /* */ + FOO_UNSPECIFIED = 0; + /* */ + FOO_ONE = 1; + } + /* */ + int64 foo = 1; + /* */ + oneof bar { + /* */ + int64 baz = 2; + } +} + +/* */ +service ServiceFoo5 { + /* */ + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + /* */ + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); +} + +message Baz { + map one = 1; +} + +// comment +service ServiceFoo6 { + // this method should pass lint + rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE this method should fail lint + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); + //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE this method should also fail lint + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + // + rpc MethodBaz(google.protobuf.Empty) returns (google.protobuf.Empty); + //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_REQUEST_STANDARD_NAME + // this method should pass lint + rpc MethodBat(google.protobuf.Empty) returns (google.protobuf.Empty); +} +-- buf.yaml -- +version: v1 +lint: + use: + - COMMENTS diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/csharpoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/csharpoptions.txtar new file mode 100644 index 000000000..47b56582f --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/csharpoptions.txtar @@ -0,0 +1,12 @@ +-- double/csharp.proto -- +package acme.weather.v1; + +option csharp_namespace = "foo"; +-- single/csharp.proto -- +package acme.v1; + +option csharp_namespace = "foo"; +-- triple/csharp.proto -- +package acme.weather.data.v1; + +option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptions1.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptions1.txtar new file mode 100644 index 000000000..d94fdd3af --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptions1.txtar @@ -0,0 +1,12 @@ +-- a.proto -- +syntax = "proto3"; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FieldOptions { + int32 baz = 50007; +} + +message Foo { + string bar = 1 [(baz) = 42]; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptionserror1.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptionserror1.txtar new file mode 100644 index 000000000..fb76398d5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptionserror1.txtar @@ -0,0 +1,25 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FieldOptions { + Foo foo = 50007; +} + +message Foo { + string bar = 1; +} +-- b.proto -- +syntax = "proto3"; + +package a; + +import "a.proto"; + +message Baz { + // the name is actually (a.foo).bar + string bat = 1 [(a.foo).bat = 1]; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/directory_same_package.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/directory_same_package.txtar new file mode 100644 index 000000000..d9c3ea8df --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/directory_same_package.txtar @@ -0,0 +1,19 @@ +-- a.proto -- +syntax = "proto3"; + +package a; +-- buf.yaml -- +version: v1 +lint: + use: + - DIRECTORY_SAME_PACKAGE +-- no_package.proto -- +syntax = "proto3"; +-- one/c.proto -- +syntax = "proto3"; + +package c; +-- one/d.proto -- +syntax = "proto3"; + +package d; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/empty.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/empty.txtar new file mode 100644 index 000000000..ae352de7d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/empty.txtar @@ -0,0 +1,2 @@ +-- 0.proto -- +syntax = "proto2"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/emptyoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/emptyoptions.txtar new file mode 100644 index 000000000..79dc29f49 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/emptyoptions.txtar @@ -0,0 +1 @@ +-- a.proto -- diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_first_value_zero.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_first_value_zero.txtar new file mode 100644 index 000000000..6f2520ad5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_first_value_zero.txtar @@ -0,0 +1,84 @@ +-- a.proto -- +syntax = "proto2"; + +package a; + +enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; +} + +enum Bar { + BAR_ONE = 1; + BAR_UNSPECIFIED = 0; + BAR_TWO = 2; +} + +enum Baz { + BAZ_ONE = 1; + BAZ_UNSPECIFIED = 0; + BAZ_TWO = 2; +} + +enum Bat { + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; +} + +message One { + message Two { + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; + } + + enum Bar { + BAR_ONE = 1; + BAR_UNSPECIFIED = 0; + BAR_TWO = 2; + } + + enum Baz { + BAZ_ONE = 1; + BAZ_UNSPECIFIED = 0; + BAZ_TWO = 2; + } + + enum Bat { + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; + } + } + enum Foo { + FOO_UNSPECIFIED = 0; + FOO_ONE = 1; + FOO_TWO = 2; + } + + enum Bar { + BAR_ONE = 1; + BAR_UNSPECIFIED = 0; + BAR_TWO = 2; + } + + enum Baz { + BAZ_ONE = 1; + BAZ_UNSPECIFIED = 0; + BAZ_TWO = 2; + } + + enum Bat { + BAT_UNSPECIFIED = 0; + BAT_ONE = 1; + BAT_TWO = 2; + } +} +-- buf.yaml -- +version: v1 +lint: + use: + - ENUM_FIRST_VALUE_ZERO diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_pascal_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_pascal_case.txtar new file mode 100644 index 000000000..9e34e3c75 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_pascal_case.txtar @@ -0,0 +1,84 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +enum Success { + SUCCESS_UNSPECIFIED = 0; +} + +enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; +} + +enum SuccessFOOThree { + SUCCESS_FOO_THREE_UNSPECIFIED = 0; +} +enum fail { + FAIL_UNSPECIFIED = 0; +} +enum failTwo { + FAIL_TWO_UNSPECIFIED = 0; +} +enum fail_three { + FAIL_THREE_UNSPECIFIED = 0; +} +enum Fail_four { + FAIL_FOUR_UNSPECIFIED = 0; +} + +message Foo { + message Bar { + enum Success { + SUCCESS_UNSPECIFIED = 0; + } + + enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; + } + + enum SuccessFOOThree { + SUCCESS_FOO_THREE_UNSPECIFIED = 0; + } + enum fail { + FAIL_UNSPECIFIED = 0; + } + enum failTwo { + FAIL_TWO_UNSPECIFIED = 0; + } + enum fail_three { + FAIL_THREE_UNSPECIFIED = 0; + } + enum Fail_four { + FAIL_FOUR_UNSPECIFIED = 0; + } + } + enum Success { + SUCCESS_UNSPECIFIED = 0; + } + + enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; + } + + enum SuccessFOOThree { + SUCCESS_FOO_THREE_UNSPECIFIED = 0; + } + enum fail { + FAIL_UNSPECIFIED = 0; + } + enum failTwo { + FAIL_TWO_UNSPECIFIED = 0; + } + enum fail_three { + FAIL_THREE_UNSPECIFIED = 0; + } + enum Fail_four { + FAIL_FOUR_UNSPECIFIED = 0; + } +} +-- buf.yaml -- +version: v1 +lint: + use: + - ENUM_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_prefix.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_prefix.txtar new file mode 100644 index 000000000..46d9f5fa4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_prefix.txtar @@ -0,0 +1,44 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +enum Test { + TEST_UNSPECIFIED = 0; + TEST_SUCCESS = 1; + TEST_SUCCESS_TWO = 2; + TEST_SUCCESS_THREE_3 = 3; + TESt_FAIL = 4; + test_FAIL_5 = 5; + test__FAIL_6 = 6; +} + +message Foo { + message Bar { + enum Test1 { + TEST1_UNSPECIFIED = 0; + TEST1_SUCCESS = 1; + TEST1_SUCCESS_TWO = 2; + TEST1_SUCCESS_THREE_3 = 3; + TESt1_FAIL = 4; + test1_FAIL_5 = 5; + test1__FAIL_6 = 6; + TEST_1_FAIL_7 = 7; + } + } + enum Test1 { + TEST1_UNSPECIFIED = 0; + TEST1_SUCCESS = 1; + TEST1_SUCCESS_TWO = 2; + TEST1_SUCCESS_THREE_3 = 3; + TESt1_FAIL = 4; + test1_FAIL_5 = 5; + test1__FAIL_6 = 6; + TEST_1_FAIL_7 = 7; + } +} +-- buf.yaml -- +version: v1 +lint: + use: + - ENUM_VALUE_PREFIX diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_upper_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_upper_snake_case.txtar new file mode 100644 index 000000000..fbe4e8c80 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_upper_snake_case.txtar @@ -0,0 +1,45 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +enum Test { + TEST_UNSPECIFIED = 0; + TEST_SUCCESS = 1; + TEST_SUCCESS_TWO = 2; + TEST_SUCCESS_THREE3 = 3; + TEST_FAIl = 4; + test_fail_five = 5; + testFailSix = 6; + TEST_SUCCESS_7 = 7; +} + +message Foo { + message Bar { + enum Test { + TEST_UNSPECIFIED = 0; + TEST_SUCCESS = 1; + TEST_SUCCESS_TWO = 2; + TEST_SUCCESS_THREE3 = 3; + TEST_FAIl = 4; + test_fail_five = 5; + testFailSix = 6; + TEST_SUCCESS_7 = 7; + } + } + enum Test { + TEST_UNSPECIFIED = 0; + TEST_SUCCESS = 1; + TEST_SUCCESS_TWO = 2; + TEST_SUCCESS_THREE3 = 3; + TEST_FAIl = 4; + test_fail_five = 5; + testFailSix = 6; + TEST_SUCCESS_7 = 7; + } +} +-- buf.yaml -- +version: v1 +lint: + use: + - ENUM_VALUE_UPPER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix.txtar new file mode 100644 index 000000000..8eb1ab717 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix.txtar @@ -0,0 +1,77 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +enum Success { + SUCCESS_UNSPECIFIED = 0; +} + +enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; +} + +enum Fail { + FAILUNSPECIFIED = 0; +} + +enum FailTwo { + FAIL_TWO_UNSPECIFIEd = 0; +} + +enum FailThree { + FAIL_THREE_OTHER = 0; +} + +message Foo { + message Bar { + enum Success { + SUCCESS_UNSPECIFIED = 0; + } + + enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; + } + + enum Fail { + FAILUNSPECIFIED = 0; + } + + enum FailTwo { + FAIL_TWO_UNSPECIFIEd = 0; + } + + enum FailThree { + FAIL_THREE_OTHER = 0; + } + } + enum Success { + SUCCESS_UNSPECIFIED = 0; + } + + enum SuccessTwo { + SUCCESS_TWO_UNSPECIFIED = 0; + } + + enum Fail { + FAILUNSPECIFIED = 0; + } + + enum FailTwo { + FAIL_TWO_UNSPECIFIEd = 0; + } + + enum FailThree { + FAIL_THREE_OTHER = 0; + } +} + +enum SuccessThree { + SUCCESS_THREE_UNSPECIFIED = 0; + SUCCESS_THREE_ONE = 1; +} +-- buf.yaml -- +version: v1 +lint: + use: + - ENUM_ZERO_VALUE_SUFFIX diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix_custom.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix_custom.txtar new file mode 100644 index 000000000..be3038333 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix_custom.txtar @@ -0,0 +1,78 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +enum Success { + SUCCESSOTHER = 0; +} + +enum SuccessTwo { + SUCCESS_TWOOTHER = 0; +} + +enum SuccessThree { + SUCCESS_THREE_OTHER = 0; +} + +enum FailTwo { + FAIL_TWOOTHEr = 0; +} + +enum FailThree { + FAIL_TWO_UNSPECIFIED = 0; +} + +message Foo { + message Bar { + enum Success { + SUCCESSOTHER = 0; + } + + enum SuccessTwo { + SUCCESS_TWOOTHER = 0; + } + + enum SuccessThree { + SUCCESS_THREE_OTHER = 0; + } + + enum FailTwo { + FAIL_TWOOTHEr = 0; + } + + enum FailThree { + FAIL_TWO_UNSPECIFIED = 0; + } + } + enum Success { + SUCCESSOTHER = 0; + } + + enum SuccessTwo { + SUCCESS_TWOOTHER = 0; + } + + enum SuccessThree { + SUCCESS_THREE_OTHER = 0; + } + + enum FailTwo { + FAIL_TWOOTHEr = 0; + } + + enum FailThree { + FAIL_TWO_UNSPECIFIED = 0; + } +} + +enum SuccessFour { + SUCCESS_FOUROTHER = 0; + SUCCESS_FOUR_ONE = 1; +} +-- buf.yaml -- +version: v1 +lint: + use: + - ENUM_ZERO_VALUE_SUFFIX + enum_zero_value_suffix: OTHER diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex1.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex1.txtar new file mode 100644 index 000000000..d44da6f1e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex1.txtar @@ -0,0 +1,13 @@ +-- 0.proto -- +syntax = "proto2"; +message Sensor { + required string name = 1; + required double temperature = 2; + required int32 humidity = 3; + + enum SwitchLevel { + CLOSED = 0; + OPEN = 1; + } + required SwitchLevel door = 5; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex2.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex2.txtar new file mode 100644 index 000000000..733b87d9b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex2.txtar @@ -0,0 +1,32 @@ +-- 0.proto -- +syntax = "proto2"; + +enum MyEnum +{ + Default = 0; + Variant1 = 1; + Variant100 = 100; +} + +message Test { + required string f1 = 1; + required int64 f2 = 2; + repeated uint64 fa = 3; + repeated int32 fb = 4; + repeated int32 fc = 5 [packed = true]; + repeated Pair pairs = 6; + optional bytes bbbb = 7; + + extensions 100 to max; +} + +message Pair { + required string key = 1; + optional string value = 2; +} + +extend Test { + optional bool gtt = 100; + optional double gtg = 101; + repeated MyEnum someEnum = 102; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex3.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex3.txtar new file mode 100644 index 000000000..3716116e1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex3.txtar @@ -0,0 +1,18 @@ +-- 0.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +message Input { + string name = 1; + int32 id = 2; // Unique ID number for this person. + Address add = 3; + repeated PhoneNumber phones = 4; //List + + message PhoneNumber { + string number = 1; + } + + message Address { + string zip = 1; + string street = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_lower_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_lower_snake_case.txtar new file mode 100644 index 000000000..c8d042739 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_lower_snake_case.txtar @@ -0,0 +1,47 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +message One { + int32 success = 1; + int32 success_two = 2; + int32 Fail = 3; + int32 FailTwo = 4; + int32 failThree = 5; + int32 fail_four_ = 6; + int32 _fail_five = 7; +} + +message Two { + message Three { + message Four { + int32 success = 1; + int32 success_two = 2; + int32 Fail = 3; + int32 FailTwo = 4; + int32 failThree = 5; + int32 fail_four_ = 6; + int32 _fail_five = 7; + } + int32 success = 1; + int32 success_two = 2; + int32 Fail = 3; + int32 FailTwo = 4; + int32 failThree = 5; + int32 fail_four_ = 6; + int32 _fail_five = 7; + } +} + +message Five { + int32 success1 = 1; + int32 success_2 = 2; + int32 success3_1 = 3; + int32 success_4_1 = 4; +} +-- buf.yaml -- +version: v1 +lint: + use: + - FIELD_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_no_descriptor.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_no_descriptor.txtar new file mode 100644 index 000000000..45cdd95ec --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_no_descriptor.txtar @@ -0,0 +1,51 @@ +-- a.proto -- +syntax = "proto2"; + +package a; + +message One { + optional string descriptor = 1; + optional string Descriptor = 2; + optional string descRiptor = 3; + optional string _descriptor = 4; + optional string __descriptor = 5; + optional string descriptor_ = 6; + optional string descriptor__ = 7; + optional string __descriptor__ = 8; +} + +message Two { + message Three { + message Four { + optional string descriptor = 1; + optional string Descriptor = 2; + optional string descRiptor = 3; + optional string _descriptor = 4; + optional string __descriptor = 5; + optional string descriptor_ = 6; + optional string descriptor__ = 7; + optional string __descriptor__ = 8; + } + optional string descriptor = 1; + optional string Descriptor = 2; + optional string descRiptor = 3; + optional string _descriptor = 4; + optional string __descriptor = 5; + optional string descriptor_ = 6; + optional string descriptor__ = 7; + optional string __descriptor__ = 8; + } + optional string descriptor = 1; + optional string Descriptor = 2; + optional string descRiptor = 3; + optional string _descriptor = 4; + optional string __descriptor = 5; + optional string descriptor_ = 6; + optional string descriptor__ = 7; + optional string __descriptor__ = 8; +} +-- buf.yaml -- +version: v1beta1 +lint: + use: + - FIELD_NO_DESCRIPTOR diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/file_lower_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/file_lower_snake_case.txtar new file mode 100644 index 000000000..38a840f61 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/file_lower_snake_case.txtar @@ -0,0 +1,45 @@ +-- 1.proto -- +syntax = "proto3"; + +package a; +-- B.proto -- +syntax = "proto3"; + +package a.b; +-- Foo.proto -- +syntax = "proto3"; + +package a.b; +-- a.proto -- +syntax = "proto3"; + +package a.b; +-- aBc.proto -- +syntax = "proto3"; + +package a.b; +-- aBc.txt -- +syntax = "proto3"; + +package a.b; +-- ab.proto -- +syntax = "proto3"; + +package a.b; +-- ab_c.proto -- +syntax = "proto3"; + +package a.b; +-- ab_c_.proto -- +syntax = "proto3"; + +package a.b; +-- buf.yaml -- +version: v1 +lint: + use: + - FILE_LOWER_SNAKE_CASE +-- fooBar.proto -- +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_public.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_public.txtar new file mode 100644 index 000000000..7030cba97 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_public.txtar @@ -0,0 +1,28 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "sub/sub1.proto"; +import public "sub/sub2.proto"; +import public "one/one.proto"; +-- buf.yaml -- +version: v1 +lint: + use: + - IMPORT_NO_PUBLIC +-- one/one.proto -- +syntax = "proto3"; + +package one; + +import "sub/sub1.proto"; +import public "sub/sub2.proto"; +-- sub/sub1.proto -- +syntax = "proto3"; + +package sub; +-- sub/sub2.proto -- +syntax = "proto3"; + +package sub; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_weak.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_weak.txtar new file mode 100644 index 000000000..ea4f636d9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_weak.txtar @@ -0,0 +1,28 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "sub/sub1.proto"; +import weak "sub/sub2.proto"; +import weak "one/one.proto"; +-- buf.yaml -- +version: v1 +lint: + use: + - IMPORT_NO_WEAK +-- one/one.proto -- +syntax = "proto3"; + +package one; + +import "sub/sub1.proto"; +import weak "sub/sub2.proto"; +-- sub/sub1.proto -- +syntax = "proto3"; + +package sub; +-- sub/sub2.proto -- +syntax = "proto3"; + +package sub; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_used.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_used.txtar new file mode 100644 index 000000000..27c175217 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_used.txtar @@ -0,0 +1,40 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "sub/sub1.proto"; +import "sub/sub2.proto"; +import "one/one.proto"; + +message A { + sub.Sub2 sub2 = 1; +} +-- buf.yaml -- +version: v1 +lint: + use: + - IMPORT_USED +-- one/one.proto -- +syntax = "proto3"; + +package one; + +import "sub/sub1.proto"; +import "sub/sub2.proto"; + +message One { + sub.Sub1 sub1 = 1; +} +-- sub/sub1.proto -- +syntax = "proto3"; + +package sub; + +message Sub1 {} +-- sub/sub2.proto -- +syntax = "proto3"; + +package sub; + +message Sub2 {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/javaoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/javaoptions.txtar new file mode 100644 index 000000000..868d0da7b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/javaoptions.txtar @@ -0,0 +1,7 @@ +-- java_file.proto -- +package acme.weather; + +option java_multiple_files = true; +option java_string_check_utf8 = false; +option java_package = "foo"; +option java_outer_classname = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/jsoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/jsoptions.txtar new file mode 100644 index 000000000..d12d7f2a8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/jsoptions.txtar @@ -0,0 +1,2 @@ +-- a.proto -- +option optimize_for = CODE_SIZE; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/message_pascal_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/message_pascal_case.txtar new file mode 100644 index 000000000..93401ca76 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/message_pascal_case.txtar @@ -0,0 +1,28 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +message Success {} +message SuccessTwo {} +message SuccessFOOThree { + message fail {} + message failTwo { + message fail_three {} + } +} + +message fail {} +message failTwo {} +message fail_three {} +message Fail_four { + message fail {} + message failTwo { + message fail_three {} + } +} +-- buf.yaml -- +version: v1 +lint: + use: + - MESSAGE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/objcoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/objcoptions.txtar new file mode 100644 index 000000000..e3ee5b27b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/objcoptions.txtar @@ -0,0 +1,20 @@ +-- double/objc.proto -- +package acme.weather.v1; + +option objc_class_prefix = "foo"; +-- gpb/objc.proto -- +package google.protobuf.bla.v1; + +option objc_class_prefix = "foo"; +-- single/objc.proto -- +package acme.v1; + +option objc_class_prefix = "foo"; +-- triple/objc.proto -- +package acme.weather.data.v1; + +option objc_class_prefix = "foo"; +-- unversioned/objc.proto -- +package acme.weather.data; + +option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/oneof_lower_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/oneof_lower_snake_case.txtar new file mode 100644 index 000000000..c2567fcd3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/oneof_lower_snake_case.txtar @@ -0,0 +1,93 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +message One { + oneof success { + int32 one = 1; + } + oneof success_two { + int32 two = 2; + } + oneof Fail { + int32 three = 3; + } + oneof FailTwo { + int32 four = 4; + } + oneof failThree { + int32 five = 5; + } + oneof fail_four_ { + int32 six = 6; + } + oneof _fail_five { + int32 seven = 7; + } +} + +message Two { + message Three { + message Four { + oneof success { + int32 one = 1; + } + oneof success_two { + int32 two = 2; + } + oneof Fail { + int32 three = 3; + } + oneof FailTwo { + int32 four = 4; + } + oneof failThree { + int32 five = 5; + } + oneof fail_four_ { + int32 six = 6; + } + oneof _fail_five { + int32 seven = 7; + } + } + oneof success { + int32 one = 1; + } + oneof success_two { + int32 two = 2; + } + oneof Fail { + int32 three = 3; + } + oneof FailTwo { + int32 four = 4; + } + oneof failThree { + int32 five = 5; + } + oneof fail_four_ { + int32 six = 6; + } + oneof _fail_five { + int32 seven = 7; + } + } +} + +// checking to see if the implicit oneof triggers the linter, which it should not +message Three { + message Four { + message Five { + optional string one = 1; + } + optional string one = 1; + } + optional string one = 1; +} +-- buf.yaml -- +version: v1 +lint: + use: + - ONEOF_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/optionpanic.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/optionpanic.txtar new file mode 100644 index 000000000..8ee42f8cc --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/optionpanic.txtar @@ -0,0 +1,33 @@ +-- options/option.proto -- +syntax = "proto3"; + +package options; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FileOptions { + MyOption my_option = 9999; +} + +message MyOption { + repeated MyArray my_array = 1; +} + +message MyArray { + message TestMessage { + } + map my_map = 1; +} +-- proto/test.proto -- +syntax = "proto3"; + +package proto; + +import "options/option.proto"; + +option (options.my_option) = { + my_array: { + my_map: { + } + } +}; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_defined.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_defined.txtar new file mode 100644 index 000000000..1bbb399bd --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_defined.txtar @@ -0,0 +1,9 @@ +-- a/no_package.proto -- +syntax = "proto3"; +-- buf.yaml -- +version: v1 +lint: + use: + - PACKAGE_DEFINED +-- no_package.proto -- +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_directory_match.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_directory_match.txtar new file mode 100644 index 000000000..ae5452a18 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_directory_match.txtar @@ -0,0 +1,19 @@ +-- a/b/a_b.proto -- +syntax = "proto3"; + +package a.b; +-- a/b/a_c.proto -- +syntax = "proto3"; + +package a.c; +-- buf.yaml -- +version: v1 +lint: + use: + - PACKAGE_DIRECTORY_MATCH +-- no_package.proto -- +syntax = "proto3"; +-- sub/a/b/a_b.proto -- +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_lower_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_lower_snake_case.txtar new file mode 100644 index 000000000..456e28672 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_lower_snake_case.txtar @@ -0,0 +1,39 @@ +-- 1.proto -- +syntax = "proto3"; + +package a; +-- 2.proto -- +syntax = "proto3"; + +package a.b; +-- 3.proto -- +syntax = "proto3"; + +package a.b_cde; +-- 4.proto -- +syntax = "proto3"; + +package a.b_cde.f; +-- 5.proto -- +syntax = "proto3"; + +package a.b_cdE.f; +-- 6.proto -- +syntax = "proto3"; + +package a.b_cde.F; +-- 7.proto -- +syntax = "proto3"; + +package a.bcde.F; +-- 8.proto -- +syntax = "proto3"; + +package a.b_cde.f_; +-- buf.yaml -- +version: v1 +lint: + use: + - PACKAGE_LOWER_SNAKE_CASE +-- no_package.proto -- +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory.txtar new file mode 100644 index 000000000..8950fca4b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory.txtar @@ -0,0 +1,13 @@ +-- a.proto -- +syntax = "proto3"; + +package a; +-- buf.yaml -- +version: v1 +lint: + use: + - PACKAGE_SAME_DIRECTORY +-- one/a.proto -- +syntax = "proto3"; + +package a; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory_no_package.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory_no_package.txtar new file mode 100644 index 000000000..f0b626361 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory_no_package.txtar @@ -0,0 +1,9 @@ +-- buf.yaml -- +version: v1 +lint: + use: + - PACKAGE_SAME_DIRECTORY +-- no_package.proto -- +syntax = "proto3"; +-- one/no_package.proto -- +syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_option_value.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_option_value.txtar new file mode 100644 index 000000000..3e5243813 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_option_value.txtar @@ -0,0 +1,52 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +option csharp_namespace = "foo"; +option java_multiple_files = true; +option java_package = "foo"; +option go_package = "foo"; +option php_namespace = "foo"; +option ruby_package = "foo"; +option swift_prefix = "foo"; +-- b.proto -- +syntax = "proto3"; + +package a; + +option csharp_namespace = "bar"; +option java_multiple_files = false; +option java_package = "bar"; +option go_package = "bar"; +option php_namespace = "bar"; +option ruby_package = "bar"; +option swift_prefix = "bar"; +-- buf.yaml -- +version: v1 +lint: + use: + - PACKAGE_SAME_CSHARP_NAMESPACE + - PACKAGE_SAME_GO_PACKAGE + - PACKAGE_SAME_JAVA_MULTIPLE_FILES + - PACKAGE_SAME_JAVA_PACKAGE + - PACKAGE_SAME_PHP_NAMESPACE + - PACKAGE_SAME_RUBY_PACKAGE + - PACKAGE_SAME_SWIFT_PREFIX +-- sub/a.proto -- +syntax = "proto3"; + +package a.b; + +// comment +option csharp_namespace = "foo"; +option java_multiple_files = true; +option java_package = "foo"; +option go_package = "foo"; +option php_namespace = "foo"; +option ruby_package = "foo"; +option swift_prefix = "foo"; +-- sub/b.proto -- +syntax = "proto3"; + +package a.b; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_version_suffix.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_version_suffix.txtar new file mode 100644 index 000000000..16937721e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_version_suffix.txtar @@ -0,0 +1,55 @@ +-- buf.yaml -- +version: v1 +lint: + use: + - PACKAGE_VERSION_SUFFIX +-- foo.proto -- +syntax = "proto3"; + +package foo; +-- foo_bar.proto -- +syntax = "proto3"; + +package foo.bar; +-- foo_bar_v0beta1.proto -- +syntax = "proto3"; + +package foo.bar.v0beta1; +-- foo_bar_v1.proto -- +syntax = "proto3"; + +package foo.bar.v1; +-- foo_bar_v1beta1.proto -- +syntax = "proto3"; + +package foo.bar.v1beta1; +-- foo_bar_v1test.proto -- +syntax = "proto3"; + +package foo.bar.v1test; +-- foo_bar_v1test_foo.proto -- +syntax = "proto3"; + +package foo.bar.v1test.foo; +-- foo_bar_v1testfoo.proto -- +syntax = "proto3"; + +package foo.bar.v1testfoo; +-- foo_bar_v2.proto -- +syntax = "proto3"; + +package foo.bar.v2; +-- foo_bar_v2beta0.proto -- +syntax = "proto3"; + +package foo.bar.v2beta0; +-- foo_bar_vv1beta1.proto -- +syntax = "proto3"; + +package foo.bar.vv1beta1; +-- no_package.proto -- +syntax = "proto3"; +-- v1.proto -- +syntax = "proto3"; + +package v1; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/packageversion.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/packageversion.txtar new file mode 100644 index 000000000..b9c02557e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/packageversion.txtar @@ -0,0 +1,4 @@ +-- a.proto -- +package weather.v1alpha1; + +option go_package = "weather"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/phpoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/phpoptions.txtar new file mode 100644 index 000000000..a3d4f3bb7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/phpoptions.txtar @@ -0,0 +1,20 @@ +-- double/php.proto -- +package acme.weather.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; +-- reserved/php.proto -- +package acme.error.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; +-- single/php.proto -- +package acme.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; +-- triple/php.proto -- +package acme.weather.data.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/proto3optional1.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/proto3optional1.txtar new file mode 100644 index 000000000..05561edf8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/proto3optional1.txtar @@ -0,0 +1,6 @@ +-- a.proto -- +syntax = "proto3"; + +message Foo { + optional string bar = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_no_streaming.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_no_streaming.txtar new file mode 100644 index 000000000..9ed82f320 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_no_streaming.txtar @@ -0,0 +1,19 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Foo { + rpc NoStreaming(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc RequestStreaming(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc ResponseStreaming(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} + rpc BothStreaming(stream google.protobuf.Empty) returns (stream google.protobuf.Empty) {} +} +-- buf.yaml -- +version: v1 +lint: + use: + - RPC_NO_CLIENT_STREAMING + - RPC_NO_SERVER_STREAMING diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_pascal_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_pascal_case.txtar new file mode 100644 index 000000000..208e29d24 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_pascal_case.txtar @@ -0,0 +1,21 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Foo { + rpc Success(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc SuccessTwo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc SuccessFOOThree(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc fail(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc failTwo(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc fail_three(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Fail_four(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} +-- buf.yaml -- +version: v1 +lint: + use: + - RPC_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name.txtar new file mode 100644 index 000000000..11a51647c --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name.txtar @@ -0,0 +1,31 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Foo { + rpc Success(SuccessRequest) returns (SuccessResponse) {} + rpc AnotherSuccess(FooAnotherSuccessRequest) returns (FooAnotherSuccessResponse) {} + rpc FailRequest(Bar) returns (FailRequestResponse) {} + rpc FailResponse(FailResponseRequest) returns (Bar) {} + rpc NoAllowEmptyRequest(google.protobuf.Empty) returns (NoAllowEmptyRequestResponse) {} + rpc NoAllowEmptyResponse(NoAllowEmptyResponseRequest) returns (google.protobuf.Empty) {} +} + +message SuccessRequest {} +message SuccessResponse {} +message FooAnotherSuccessRequest {} +message FooAnotherSuccessResponse {} +message FailRequestResponse {} +message FailResponseRequest {} +message NoAllowEmptyRequestResponse {} +message NoAllowEmptyResponseRequest {} +message Bar {} +-- buf.yaml -- +version: v1 +lint: + use: + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name_allow_empty.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name_allow_empty.txtar new file mode 100644 index 000000000..f5f18a8c5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name_allow_empty.txtar @@ -0,0 +1,33 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +import "google/protobuf/empty.proto"; + +service Foo { + rpc Success(SuccessRequest) returns (SuccessResponse) {} + rpc AnotherSuccess(FooAnotherSuccessRequest) returns (FooAnotherSuccessResponse) {} + rpc FailRequest(Bar) returns (FailRequestResponse) {} + rpc FailResponse(FailResponseRequest) returns (Bar) {} + rpc AllowEmptyRequest(google.protobuf.Empty) returns (AllowEmptyRequestResponse) {} + rpc AllowEmptyResponse(AllowEmptyResponseRequest) returns (google.protobuf.Empty) {} +} + +message SuccessRequest {} +message SuccessResponse {} +message FooAnotherSuccessRequest {} +message FooAnotherSuccessResponse {} +message FailRequestResponse {} +message FailResponseRequest {} +message AllowEmptyRequestResponse {} +message AllowEmptyResponseRequest {} +message Bar {} +-- buf.yaml -- +version: v1 +lint: + use: + - RPC_REQUEST_STANDARD_NAME + - RPC_RESPONSE_STANDARD_NAME + rpc_allow_google_protobuf_empty_requests: true + rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rubyoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rubyoptions.txtar new file mode 100644 index 000000000..ddeb0c03c --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rubyoptions.txtar @@ -0,0 +1,12 @@ +-- double/ruby.proto -- +package acme.weather.v1; + +option ruby_package = "foo"; +-- single/ruby.proto -- +package acme.v1; + +option ruby_package = "foo"; +-- triple/ruby.proto -- +package acme.weather.data.v1; + +option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/semicolons.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/semicolons.txtar new file mode 100644 index 000000000..55a9c6e2b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/semicolons.txtar @@ -0,0 +1,42 @@ +-- a.proto -- +syntax="proto3";;;; +;;; +;package a;;;;; +; +;;;;import "google/protobuf/descriptor.proto"; +;; +; +;;extend google.protobuf.FileOptions { + bool foo = 9999999; +} +; +;message Bar { + ;;;option deprecated = true;;;; + ;;;; + int32 one = 1;;;; + ;repeated bool two = 2 [deprecated = true];; + map three = 3 [ + deprecated = false + ];;;; +};;;; +;; +;enum Baz { + ;;;;option deprecated = true;;;; + + ;DEFAULT = 0;;;; + ONE = 1;;; + TWO = 2;;;; +};;; +;; +;service BatService { +; ;option deprecated = true;;;; +; + ;rpc Bam(Bar) returns (Other);;; +; + rpc Ban(Other) returns (Bar) { + ; ;option deprecated = true;;;; + };;;; +};;;; +; +; +;;;;message Other{;;;};;;;; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_pascal_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_pascal_case.txtar new file mode 100644 index 000000000..e6ee433ed --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_pascal_case.txtar @@ -0,0 +1,17 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +service Success {} +service SuccessTwo {} +service SuccessFOOThree {} +service fail {} +service failTwo {} +service fail_three {} +service Fail_four {} +-- buf.yaml -- +version: v1 +lint: + use: + - SERVICE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix.txtar new file mode 100644 index 000000000..36195e060 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix.txtar @@ -0,0 +1,16 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +service SuccessService {} +service SuccessTwoService {} +service SuccessThree_Service {} +service Fail {} +service FailAPI {} +service FailService_ {} +-- buf.yaml -- +version: v1 +lint: + use: + - SERVICE_SUFFIX diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix_custom.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix_custom.txtar new file mode 100644 index 000000000..287662ae8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix_custom.txtar @@ -0,0 +1,18 @@ +-- a.proto -- +syntax = "proto3"; + +package a; + +service SuccessAPI {} +service SuccessTwoAPI {} +service SuccessThree_API {} +service Fail {} +service FailService {} +service FailAPI_ {} +service FailApi_ {} +-- buf.yaml -- +version: v1 +lint: + use: + - SERVICE_SUFFIX + service_suffix: API diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/simple.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/simple.txtar new file mode 100644 index 000000000..12338f991 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/simple.txtar @@ -0,0 +1,2 @@ +-- .proto -- +message A{} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/syntax_specified.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/syntax_specified.txtar new file mode 100644 index 000000000..cbbeb83a1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/syntax_specified.txtar @@ -0,0 +1,21 @@ +-- a/a.proto -- +// comment + +package a; +-- a/a2.proto -- +// comment + +syntax = "proto2"; + +package a; +-- a/a3.proto -- +// comment + +syntax = "proto3"; + +package a; +-- buf.yaml -- +version: v1 +lint: + use: + - SYNTAX_SPECIFIED diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/test.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/test.txtar new file mode 100644 index 000000000..3fd493ae0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/test.txtar @@ -0,0 +1,58 @@ +-- 0.proto -- +syntax = "proto3"; + +package a.v1; + +option go_package = "av1"; + +// ServiceDefinition is a service definition. +service ServiceDefinition { + // Method does a thing. + rpc Method(MethodRequest) returns (MethodResponse) {} + rpc OtherMethod(MethodRequest) returns (MethodResponse); +} + +message MethodRequest { + // field is a protobuf message field + string field = 1 [ + json_name = "foo" + ]; +} + +message MethodResponse { + // field is a protobuf message field + string field = 1; +} +-- 1.proto -- +syntax = "proto3"; + +package b.v1; + +import "google/protobuf/timestamp.proto"; +import "2.proto"; + +option go_package = "bv1"; + +message OtherMessage { + bytes other_field = 1 [ + (c.v1.foo) = "bar" + ]; + google.protobuf.Timestamp time_field = 2 [ + (c.v1.foo) = "baz" + ]; +} + +enum EnumType { + ENUM_TYPE_UNSPECIFIED = 0; + ENUM_TYPE_ONE = 1; +} +-- 2.proto -- +syntax = "proto2"; + +package c.v1; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FieldOptions { + optional string foo = 50001; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/wktimport.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/wktimport.txtar new file mode 100644 index 000000000..b8bad5ede --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/wktimport.txtar @@ -0,0 +1,10 @@ +-- a.proto -- +syntax = "proto3"; + +package acme.weather.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +message Container { + google.protobuf.Timestamp timestamp = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder.go new file mode 100644 index 000000000..ca46ca791 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder.go @@ -0,0 +1,650 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagebuild + +import ( + "context" + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/data/datawkt" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" + "github.com/bufbuild/protocompile" + "github.com/bufbuild/protocompile/linker" + "github.com/bufbuild/protocompile/parser" + "github.com/bufbuild/protocompile/protoutil" + "github.com/bufbuild/protocompile/reporter" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.uber.org/zap" + "google.golang.org/protobuf/reflect/protoreflect" +) + +const ( + loggerName = "bufimagebuild" + tracerName = "bufbuild/buf" +) + +type builder struct { + logger *zap.Logger + moduleFileSetBuilder bufmodulebuild.ModuleFileSetBuilder + tracer trace.Tracer +} + +func newBuilder(logger *zap.Logger, moduleReader bufmodule.ModuleReader) *builder { + return &builder{ + logger: logger.Named(loggerName), + moduleFileSetBuilder: bufmodulebuild.NewModuleFileSetBuilder( + logger, + moduleReader, + ), + tracer: otel.GetTracerProvider().Tracer(tracerName), + } +} + +func (b *builder) Build( + ctx context.Context, + module bufmodule.Module, + options ...BuildOption, +) (bufimage.Image, []bufanalysis.FileAnnotation, error) { + buildOptions := newBuildOptions() + for _, option := range options { + option(buildOptions) + } + return b.build( + ctx, + module, + buildOptions.excludeSourceCodeInfo, + buildOptions.expectedDirectDependencies, + buildOptions.workspace, + ) +} + +func (b *builder) build( + ctx context.Context, + module bufmodule.Module, + excludeSourceCodeInfo bool, + expectedDirectDeps []bufmoduleref.ModuleReference, + workspace bufmodule.Workspace, +) (_ bufimage.Image, _ []bufanalysis.FileAnnotation, retErr error) { + ctx, span := b.tracer.Start(ctx, "build") + defer span.End() + defer func() { + if retErr != nil { + span.RecordError(retErr) + span.SetStatus(codes.Error, retErr.Error()) + } + }() + + // TODO: remove this once bufmodule.ModuleFileSet is deleted or no longer inherits from Module + // We still need to handle the ModuleFileSet case for buf export, as we actually need the + // ModuleFileSet there. + moduleFileSet, ok := module.(bufmodule.ModuleFileSet) + if !ok { + // If we just had a Module, convert it to a ModuleFileSet. + var err error + moduleFileSet, err = b.moduleFileSetBuilder.Build( + ctx, + module, + bufmodulebuild.WithWorkspace(workspace), + ) + if err != nil { + return nil, nil, err + } + } + + parserAccessorHandler := bufmoduleprotocompile.NewParserAccessorHandler(ctx, moduleFileSet) + targetFileInfos, err := moduleFileSet.TargetFileInfos(ctx) + if err != nil { + return nil, nil, err + } + if len(targetFileInfos) == 0 { + return nil, nil, errors.New("no input files specified") + } + paths := make([]string, len(targetFileInfos)) + for i, targetFileInfo := range targetFileInfos { + paths[i] = targetFileInfo.Path() + } + + buildResult := getBuildResult( + ctx, + parserAccessorHandler, + paths, + excludeSourceCodeInfo, + ) + if buildResult.Err != nil { + return nil, nil, buildResult.Err + } + if len(buildResult.FileAnnotations) > 0 { + return nil, bufanalysis.DeduplicateAndSortFileAnnotations(buildResult.FileAnnotations), nil + } + + fileDescriptors, err := checkAndSortFileDescriptors(buildResult.FileDescriptors, paths) + if err != nil { + return nil, nil, err + } + image, err := getImage( + ctx, + excludeSourceCodeInfo, + fileDescriptors, + parserAccessorHandler, + buildResult.SyntaxUnspecifiedFilenames, + buildResult.FilenameToUnusedDependencyFilenames, + b.tracer, + ) + if err != nil { + return nil, nil, err + } + if err := b.warnInvalidImports(ctx, image, expectedDirectDeps, workspace); err != nil { + b.logger.Sugar().Error("warn_invalid_imports", zap.Error(err)) + } + return image, nil, nil +} + +// warnInvalidImports checks that all the target image files have valid imports statements that +// point to files in the local module, in a direct dependency, or in a workspace local unnamed +// module. It outputs WARN messages otherwise, one per invalid import statement. +// +// TODO: Understand this code before doing anything +// TODO: switch to use bufimage.ImageModuleDependencies +func (b *builder) warnInvalidImports( + ctx context.Context, + builtImage bufimage.Image, + expectedDirectDeps []bufmoduleref.ModuleReference, + localWorkspace bufmodule.Workspace, +) error { + if expectedDirectDeps == nil && localWorkspace == nil { + // Bail out early in case the caller didn't send explicitly send direct module dependencies nor + // workspace. TODO: We should always send direct deps, so this imports warning can always + // happen. + return nil + } + expectedDirectDepsIdentities := make(map[string]struct{}, len(expectedDirectDeps)) + for _, expectedDirectDep := range expectedDirectDeps { + expectedDirectDepsIdentities[expectedDirectDep.IdentityString()] = struct{}{} + } + workspaceIdentities := make(map[string]struct{}) + if localWorkspace != nil { + wsModules := localWorkspace.GetModules() + for _, mod := range wsModules { + if mod == nil { + b.logger.Sugar().Debug("nil_module_in_workspace") + continue + } + targetFiles, err := mod.TargetFileInfos(ctx) + if err != nil { + return fmt.Errorf("workspace module target file infos: %w", err) + } + for _, file := range targetFiles { + if file.ModuleIdentity() != nil { + workspaceIdentities[file.ModuleIdentity().IdentityString()] = struct{}{} + break + } + } + } + } + b.logger.Sugar().Debug( + "module_identities", + zap.Any("from_direct_dependencies", expectedDirectDepsIdentities), + zap.Any("from_workspace", workspaceIdentities), + ) + + // categorize image files into direct vs transitive dependencies + allImgFiles := make(map[string]map[string][]string) // for logging purposes only, modIdentity:filepath:imports + targetFiles := make(map[string]struct{}) // filepath + expectedDirectDepsFilesToModule := make(map[string]string) // filepath:modIdentity + workspaceFilesToModule := make(map[string]string) // filepath:modIdentity + transitiveDepsFilesToModule := make(map[string]string) // filepath:modIdentity + for _, file := range builtImage.Files() { + { // populate allImgFiles + modIdentity := "local" + if file.ModuleIdentity() != nil { + modIdentity = file.ModuleIdentity().IdentityString() + } + if _, ok := allImgFiles[modIdentity]; !ok { + allImgFiles[modIdentity] = make(map[string][]string) + } + allImgFiles[modIdentity][file.Path()] = file.FileDescriptor().GetDependency() + } + if !file.IsImport() { + targetFiles[file.Path()] = struct{}{} + continue + } + if file.ModuleIdentity() == nil { + workspaceFilesToModule[file.Path()] = "" // local workspace unnamed module + continue + } + // file is import and comes from a named module. It's either a direct dep, a workspace module, + // or a transitive dep. + modIdentity := file.ModuleIdentity().IdentityString() + if _, ok := expectedDirectDepsIdentities[modIdentity]; ok { + expectedDirectDepsFilesToModule[file.Path()] = modIdentity + } else if _, ok := workspaceIdentities[modIdentity]; ok { + workspaceFilesToModule[file.Path()] = modIdentity + } else { + transitiveDepsFilesToModule[file.Path()] = modIdentity + } + } + b.logger.Sugar().Debug( + "image_files", + zap.Any("all_with_imports", allImgFiles), + zap.Any("local_target", targetFiles), + zap.Any("from_workspace", workspaceFilesToModule), + zap.Any("from_expected_direct_dependencies", expectedDirectDepsFilesToModule), + zap.Any("from_transitive_dependencies", transitiveDepsFilesToModule), + ) + + // validate import statements of target files against dependencies categorization above + for _, file := range builtImage.Files() { + if file.IsImport() { + continue // only check import statements in local files + } + // .GetDependency() returns an array of file path imports in the file descriptor + for _, importFilePath := range file.FileDescriptor().GetDependency() { + if _, ok := targetFiles[importFilePath]; ok { + continue // import comes from local + } + if _, ok := expectedDirectDepsFilesToModule[importFilePath]; ok { + continue // import comes from direct dep + } + if datawkt.Exists(importFilePath) { + continue // wkt files are shipped with protoc, and we ship them in datawkt, so it's always safe to import them + } + warnMsg := fmt.Sprintf( + "File %q imports %q, which is not found in your local files or direct dependencies", + file.Path(), importFilePath, + ) + if workspaceModule, ok := workspaceFilesToModule[importFilePath]; ok { + if workspaceModule == "" { + // If dependency comes from an unnamed module, that is probably a local dependency, and + // that module won't be pushed to the BSR. We can skip this warning. + continue + } + // If dependency comes from a named module, we _could_ skip this warning as it _might_ + // fail when pushing trying to build, but we better keep it in case it is a transitive + // dependency too, and both direct and transitive dependencies live in the same workspace. + warnMsg += fmt.Sprintf( + ", but is found in local workspace module %q. Declare dependency %q in the deps key in buf.yaml.", + workspaceModule, + workspaceModule, + ) + } else if transitiveDepModule, ok := transitiveDepsFilesToModule[importFilePath]; ok { + warnMsg += fmt.Sprintf( + ", but is found in the transitive dependency %q. Declare dependency %q in the deps key in buf.yaml.", + transitiveDepModule, + transitiveDepModule, + ) + } else { + warnMsg += ", or any of your workspace modules or transitive dependencies. Check that external imports are declared as dependencies in the deps key in buf.yaml." + } + b.logger.Sugar().Warn(warnMsg) + } + } + return nil +} + +func getBuildResult( + ctx context.Context, + parserAccessorHandler bufmoduleprotocompile.ParserAccessorHandler, + paths []string, + excludeSourceCodeInfo bool, +) *buildResult { + var errorsWithPos []reporter.ErrorWithPos + var warningErrorsWithPos []reporter.ErrorWithPos + sourceInfoMode := protocompile.SourceInfoStandard + if excludeSourceCodeInfo { + sourceInfoMode = protocompile.SourceInfoNone + } + compiler := protocompile.Compiler{ + MaxParallelism: thread.Parallelism(), + SourceInfoMode: sourceInfoMode, + Resolver: &protocompile.SourceResolver{Accessor: parserAccessorHandler.Open}, + Reporter: reporter.NewReporter( + func(errorWithPos reporter.ErrorWithPos) error { + errorsWithPos = append(errorsWithPos, errorWithPos) + return nil + }, + func(errorWithPos reporter.ErrorWithPos) { + warningErrorsWithPos = append(warningErrorsWithPos, errorWithPos) + }, + ), + } + // fileDescriptors are in the same order as paths per the documentation + compiledFiles, err := compiler.Compile(ctx, paths...) + if err != nil { + if err == reporter.ErrInvalidSource { + if len(errorsWithPos) == 0 { + return newBuildResult( + nil, + nil, + nil, + nil, + errors.New("got invalid source error from parse but no errors reported"), + ) + } + fileAnnotations, err := bufmoduleprotocompile.GetFileAnnotations( + ctx, + parserAccessorHandler, + errorsWithPos, + ) + if err != nil { + return newBuildResult(nil, nil, nil, nil, err) + } + return newBuildResult(nil, nil, nil, fileAnnotations, nil) + } + if errorWithPos, ok := err.(reporter.ErrorWithPos); ok { + fileAnnotations, err := bufmoduleprotocompile.GetFileAnnotations( + ctx, + parserAccessorHandler, + []reporter.ErrorWithPos{errorWithPos}, + ) + if err != nil { + return newBuildResult(nil, nil, nil, nil, err) + } + return newBuildResult(nil, nil, nil, fileAnnotations, nil) + } + return newBuildResult(nil, nil, nil, nil, err) + } else if len(errorsWithPos) > 0 { + // https://github.com/jhump/protoreflect/pull/331 + return newBuildResult( + nil, + nil, + nil, + nil, + errors.New("got no error from parse but errors reported"), + ) + } + if len(compiledFiles) != len(paths) { + return newBuildResult( + nil, + nil, + nil, + nil, + fmt.Errorf("expected FileDescriptors to be of length %d but was %d", len(paths), len(compiledFiles)), + ) + } + for i, fileDescriptor := range compiledFiles { + path := paths[i] + filename := fileDescriptor.Path() + // doing another rough verification + // NO LONGER NEED TO DO SUFFIX SINCE WE KNOW THE ROOT FILE NAME + if path != filename { + return newBuildResult( + nil, + nil, + nil, + nil, + fmt.Errorf("expected fileDescriptor name %s to be a equal to %s", filename, path), + ) + } + } + syntaxUnspecifiedFilenames := make(map[string]struct{}) + filenameToUnusedDependencyFilenames := make(map[string]map[string]struct{}) + for _, warningErrorWithPos := range warningErrorsWithPos { + maybeAddSyntaxUnspecified(syntaxUnspecifiedFilenames, warningErrorWithPos) + maybeAddUnusedImport(filenameToUnusedDependencyFilenames, warningErrorWithPos) + } + fileDescriptors := make([]protoreflect.FileDescriptor, len(compiledFiles)) + for i := range compiledFiles { + fileDescriptors[i] = compiledFiles[i] + } + return newBuildResult( + fileDescriptors, + syntaxUnspecifiedFilenames, + filenameToUnusedDependencyFilenames, + nil, + nil, + ) +} + +// We need to sort the FileDescriptors as they may/probably are out of order +// relative to input order after concurrent builds. This mimics the output +// order of protoc. +func checkAndSortFileDescriptors( + fileDescriptors []protoreflect.FileDescriptor, + rootRelFilePaths []string, +) ([]protoreflect.FileDescriptor, error) { + if len(fileDescriptors) != len(rootRelFilePaths) { + return nil, fmt.Errorf("rootRelFilePath length was %d but FileDescriptor length was %d", len(rootRelFilePaths), len(fileDescriptors)) + } + nameToFileDescriptor := make(map[string]protoreflect.FileDescriptor, len(fileDescriptors)) + for _, fileDescriptor := range fileDescriptors { + name := fileDescriptor.Path() + if name == "" { + return nil, errors.New("no name on FileDescriptor") + } + if _, ok := nameToFileDescriptor[name]; ok { + return nil, fmt.Errorf("duplicate FileDescriptor: %s", name) + } + nameToFileDescriptor[name] = fileDescriptor + } + // We now know that all FileDescriptors had unique names and the number of FileDescriptors + // is equal to the number of rootRelFilePaths. We also verified earlier that rootRelFilePaths + // has only unique values. Now we can put them in order. + sortedFileDescriptors := make([]protoreflect.FileDescriptor, 0, len(fileDescriptors)) + for _, rootRelFilePath := range rootRelFilePaths { + fileDescriptor, ok := nameToFileDescriptor[rootRelFilePath] + if !ok { + return nil, fmt.Errorf("no FileDescriptor for rootRelFilePath: %q", rootRelFilePath) + } + sortedFileDescriptors = append(sortedFileDescriptors, fileDescriptor) + } + return sortedFileDescriptors, nil +} + +// getImage gets the Image for the protoreflect.FileDescriptors. +// +// This mimics protoc's output order. +// This assumes checkAndSortFileDescriptors was called. +func getImage( + ctx context.Context, + excludeSourceCodeInfo bool, + sortedFileDescriptors []protoreflect.FileDescriptor, + parserAccessorHandler bufmoduleprotocompile.ParserAccessorHandler, + syntaxUnspecifiedFilenames map[string]struct{}, + filenameToUnusedDependencyFilenames map[string]map[string]struct{}, + tracer trace.Tracer, +) (bufimage.Image, error) { + ctx, span := tracer.Start(ctx, "get_image") + defer span.End() + + // if we aren't including imports, then we need a set of file names that + // are included so we can create a topologically sorted list w/out + // including imports that should not be present. + // + // if we are including imports, then we need to know what filenames + // are imports are what filenames are not + // all input protoreflect.FileDescriptors are not imports, we derive the imports + // from GetDependencies. + nonImportFilenames := map[string]struct{}{} + for _, fileDescriptor := range sortedFileDescriptors { + nonImportFilenames[fileDescriptor.Path()] = struct{}{} + } + + var imageFiles []bufimage.ImageFile + var err error + alreadySeen := map[string]struct{}{} + for _, fileDescriptor := range sortedFileDescriptors { + imageFiles, err = getImageFilesRec( + ctx, + excludeSourceCodeInfo, + fileDescriptor, + parserAccessorHandler, + syntaxUnspecifiedFilenames, + filenameToUnusedDependencyFilenames, + alreadySeen, + nonImportFilenames, + imageFiles, + ) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return nil, err + } + } + image, err := bufimage.NewImage(imageFiles) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + } + return image, err +} + +func getImageFilesRec( + ctx context.Context, + excludeSourceCodeInfo bool, + fileDescriptor protoreflect.FileDescriptor, + parserAccessorHandler bufmoduleprotocompile.ParserAccessorHandler, + syntaxUnspecifiedFilenames map[string]struct{}, + filenameToUnusedDependencyFilenames map[string]map[string]struct{}, + alreadySeen map[string]struct{}, + nonImportFilenames map[string]struct{}, + imageFiles []bufimage.ImageFile, +) ([]bufimage.ImageFile, error) { + if fileDescriptor == nil { + return nil, errors.New("nil FileDescriptor") + } + path := fileDescriptor.Path() + if _, ok := alreadySeen[path]; ok { + return imageFiles, nil + } + alreadySeen[path] = struct{}{} + + unusedDependencyFilenames, ok := filenameToUnusedDependencyFilenames[path] + var unusedDependencyIndexes []int32 + if ok { + unusedDependencyIndexes = make([]int32, 0, len(unusedDependencyFilenames)) + } + var err error + for i := 0; i < fileDescriptor.Imports().Len(); i++ { + dependency := fileDescriptor.Imports().Get(i).FileDescriptor + if unusedDependencyFilenames != nil { + if _, ok := unusedDependencyFilenames[dependency.Path()]; ok { + unusedDependencyIndexes = append( + unusedDependencyIndexes, + int32(i), + ) + } + } + imageFiles, err = getImageFilesRec( + ctx, + excludeSourceCodeInfo, + dependency, + parserAccessorHandler, + syntaxUnspecifiedFilenames, + filenameToUnusedDependencyFilenames, + alreadySeen, + nonImportFilenames, + imageFiles, + ) + if err != nil { + return nil, err + } + } + + fileDescriptorProto := protoutil.ProtoFromFileDescriptor(fileDescriptor) + if fileDescriptorProto == nil { + return nil, errors.New("nil FileDescriptorProto") + } + if excludeSourceCodeInfo { + // need to do this anyways as Parser does not respect this for FileDescriptorProtos + fileDescriptorProto.SourceCodeInfo = nil + } + _, isNotImport := nonImportFilenames[path] + _, syntaxUnspecified := syntaxUnspecifiedFilenames[path] + imageFile, err := bufimage.NewImageFile( + fileDescriptorProto, + parserAccessorHandler.ModuleIdentity(path), + parserAccessorHandler.Commit(path), + // if empty, defaults to path + parserAccessorHandler.ExternalPath(path), + !isNotImport, + syntaxUnspecified, + unusedDependencyIndexes, + ) + if err != nil { + return nil, err + } + return append(imageFiles, imageFile), nil +} + +func maybeAddSyntaxUnspecified( + syntaxUnspecifiedFilenames map[string]struct{}, + errorWithPos reporter.ErrorWithPos, +) { + if errorWithPos.Unwrap() != parser.ErrNoSyntax { + return + } + syntaxUnspecifiedFilenames[errorWithPos.GetPosition().Filename] = struct{}{} +} + +func maybeAddUnusedImport( + filenameToUnusedImportFilenames map[string]map[string]struct{}, + errorWithPos reporter.ErrorWithPos, +) { + errorUnusedImport, ok := errorWithPos.Unwrap().(linker.ErrorUnusedImport) + if !ok { + return + } + pos := errorWithPos.GetPosition() + unusedImportFilenames, ok := filenameToUnusedImportFilenames[pos.Filename] + if !ok { + unusedImportFilenames = make(map[string]struct{}) + filenameToUnusedImportFilenames[pos.Filename] = unusedImportFilenames + } + unusedImportFilenames[errorUnusedImport.UnusedImport()] = struct{}{} +} + +type buildResult struct { + FileDescriptors []protoreflect.FileDescriptor + SyntaxUnspecifiedFilenames map[string]struct{} + FilenameToUnusedDependencyFilenames map[string]map[string]struct{} + FileAnnotations []bufanalysis.FileAnnotation + Err error +} + +func newBuildResult( + fileDescriptors []protoreflect.FileDescriptor, + syntaxUnspecifiedFilenames map[string]struct{}, + filenameToUnusedDependencyFilenames map[string]map[string]struct{}, + fileAnnotations []bufanalysis.FileAnnotation, + err error, +) *buildResult { + return &buildResult{ + FileDescriptors: fileDescriptors, + SyntaxUnspecifiedFilenames: syntaxUnspecifiedFilenames, + FilenameToUnusedDependencyFilenames: filenameToUnusedDependencyFilenames, + FileAnnotations: fileAnnotations, + Err: err, + } +} + +type buildOptions struct { + excludeSourceCodeInfo bool + expectedDirectDependencies []bufmoduleref.ModuleReference + workspace bufmodule.Workspace +} + +func newBuildOptions() *buildOptions { + return &buildOptions{} +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_test.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_test.go new file mode 100644 index 000000000..7cf4316a8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_test.go @@ -0,0 +1,428 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagebuild + +import ( + "context" + "errors" + "fmt" + "path/filepath" + "sort" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimageutil" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buftesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/prototesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/testingextended" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +var buftestingDirPath = filepath.Join( + "..", + "..", + "buftesting", +) + +func TestGoogleapis(t *testing.T) { + testingextended.SkipIfShort(t) + t.Parallel() + image := testBuildGoogleapis(t, true) + assert.Equal(t, buftesting.NumGoogleapisFilesWithImports, len(image.Files())) + assert.Equal( + t, + []string{ + "google/protobuf/any.proto", + "google/protobuf/api.proto", + "google/protobuf/descriptor.proto", + "google/protobuf/duration.proto", + "google/protobuf/empty.proto", + "google/protobuf/field_mask.proto", + "google/protobuf/source_context.proto", + "google/protobuf/struct.proto", + "google/protobuf/timestamp.proto", + "google/protobuf/type.proto", + "google/protobuf/wrappers.proto", + }, + testGetImageImportPaths(image), + ) + + imageWithoutImports := bufimage.ImageWithoutImports(image) + assert.Equal(t, buftesting.NumGoogleapisFiles, len(imageWithoutImports.Files())) + imageWithoutImports = bufimage.ImageWithoutImports(imageWithoutImports) + assert.Equal(t, buftesting.NumGoogleapisFiles, len(imageWithoutImports.Files())) + + imageWithSpecificNames, err := bufimage.ImageWithOnlyPathsAllowNotExist( + image, + []string{ + "google/protobuf/descriptor.proto", + "google/protobuf/api.proto", + "google/type/date.proto", + "google/foo/nonsense.proto", + }, + nil, + ) + assert.NoError(t, err) + assert.Equal( + t, + []string{ + "google/protobuf/any.proto", + "google/protobuf/api.proto", + "google/protobuf/descriptor.proto", + "google/protobuf/source_context.proto", + "google/protobuf/type.proto", + "google/type/date.proto", + }, + testGetImageFilePaths(imageWithSpecificNames), + ) + imageWithSpecificNames, err = bufimage.ImageWithOnlyPathsAllowNotExist( + image, + []string{ + "google/protobuf/descriptor.proto", + "google/protobuf/api.proto", + "google/type", + "google/foo", + }, + nil, + ) + assert.NoError(t, err) + assert.Equal( + t, + []string{ + "google/protobuf/any.proto", + "google/protobuf/api.proto", + "google/protobuf/descriptor.proto", + "google/protobuf/source_context.proto", + "google/protobuf/type.proto", + "google/protobuf/wrappers.proto", + "google/type/calendar_period.proto", + "google/type/color.proto", + "google/type/date.proto", + "google/type/dayofweek.proto", + "google/type/expr.proto", + "google/type/fraction.proto", + "google/type/latlng.proto", + "google/type/money.proto", + "google/type/postal_address.proto", + "google/type/quaternion.proto", + "google/type/timeofday.proto", + }, + testGetImageFilePaths(imageWithSpecificNames), + ) + imageWithoutImports = bufimage.ImageWithoutImports(imageWithSpecificNames) + assert.Equal( + t, + []string{ + "google/protobuf/api.proto", + "google/protobuf/descriptor.proto", + "google/type/calendar_period.proto", + "google/type/color.proto", + "google/type/date.proto", + "google/type/dayofweek.proto", + "google/type/expr.proto", + "google/type/fraction.proto", + "google/type/latlng.proto", + "google/type/money.proto", + "google/type/postal_address.proto", + "google/type/quaternion.proto", + "google/type/timeofday.proto", + }, + testGetImageFilePaths(imageWithoutImports), + ) + _, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "google/protobuf/descriptor.proto", + "google/protobuf/api.proto", + "google/type/date.proto", + "google/foo/nonsense.proto", + }, + nil, + ) + assert.Equal(t, errors.New(`path "google/foo/nonsense.proto" has no matching file in the image`), err) + _, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "google/protobuf/descriptor.proto", + "google/protobuf/api.proto", + "google/type/date.proto", + "google/foo", + }, + nil, + ) + assert.Equal(t, errors.New(`path "google/foo" has no matching file in the image`), err) + + imageWithPathsAndExcludes, err := bufimage.ImageWithOnlyPaths( + image, + []string{ + "google/type", + }, + []string{ + "google/type/calendar_period.proto", + "google/type/date.proto", + }, + ) + assert.NoError(t, err) + assert.Equal(t, + []string{ + "google/protobuf/wrappers.proto", + "google/type/color.proto", + "google/type/dayofweek.proto", + "google/type/expr.proto", + "google/type/fraction.proto", + "google/type/latlng.proto", + "google/type/money.proto", + "google/type/postal_address.proto", + "google/type/quaternion.proto", + "google/type/timeofday.proto", + }, + testGetImageFilePaths(imageWithPathsAndExcludes), + ) + + excludePaths := []string{ + "google/type/calendar_period.proto", + "google/type/quaternion.proto", + "google/type/money.proto", + "google/type/color.proto", + "google/type/date.proto", + } + imageWithExcludes, err := bufimage.ImageWithOnlyPaths(image, []string{}, excludePaths) + assert.NoError(t, err) + testImageWithExcludedFilePaths(t, imageWithExcludes, excludePaths) + + assert.Equal(t, buftesting.NumGoogleapisFilesWithImports, len(image.Files())) + // basic check to make sure there is no error at this scale + _, err = protosource.NewFilesUnstable(context.Background(), bufimageutil.NewInputFiles(image.Files())...) + assert.NoError(t, err) +} + +func TestCompareCustomOptions1(t *testing.T) { + t.Parallel() + runner := command.NewRunner() + testCompare(t, runner, "customoptions1") +} + +func TestCompareProto3Optional1(t *testing.T) { + t.Parallel() + runner := command.NewRunner() + testCompare(t, runner, "proto3optional1") +} + +func TestCompareTrailingComments(t *testing.T) { + t.Parallel() + runner := command.NewRunner() + testCompare(t, runner, "trailingcomments") +} + +func TestCustomOptionsError1(t *testing.T) { + t.Parallel() + testFileAnnotations( + t, + "customoptionserror1", + filepath.FromSlash("testdata/customoptionserror1/b.proto:9:27:field a.Baz.bat: option (a.foo).bat: field bat of a.Foo does not exist"), + ) +} + +func TestNotAMessageType(t *testing.T) { + t.Parallel() + testFileAnnotations( + t, + "notamessagetype", + filepath.FromSlash("testdata/notamessagetype/a.proto:9:11:method a.MyService.Foo: invalid request type: a.MyService.Foo is a method, not a message"), + ) +} + +func TestSpaceBetweenNumberAndID(t *testing.T) { + t.Parallel() + testFileAnnotations( + t, + "spacebetweennumberandid", + filepath.FromSlash("testdata/spacebetweennumberandid/a.proto:6:14:invalid syntax in integer value: 10to"), + filepath.FromSlash("testdata/spacebetweennumberandid/a.proto:6:14:syntax error: unexpected error, expecting int literal"), + ) +} + +func TestCyclicImport(t *testing.T) { + t.Parallel() + testFileAnnotations( + t, + "cyclicimport", + // Since the compiler is multi-threaded, order of file compilation can happen one of two ways + fmt.Sprintf(`%s:5:8:cycle found in imports: "a/a.proto" -> "b/b.proto" -> "a/a.proto" + || %s:5:8:cycle found in imports: "b/b.proto" -> "a/a.proto" -> "b/b.proto"`, + filepath.FromSlash("testdata/cyclicimport/a/a.proto"), + filepath.FromSlash("testdata/cyclicimport/b/b.proto"), + ), + ) +} + +func TestDuplicateSyntheticOneofs(t *testing.T) { + // https://github.com/ProtobufMan/bufman-cli/issues/1071 + t.Parallel() + testFileAnnotations( + t, + "duplicatesyntheticoneofs", + // Since the compiler is multi-threaded, order of file compilation can happen one of two ways + filepath.FromSlash(`testdata/duplicatesyntheticoneofs/a1.proto:5:9:symbol "a.Foo" already defined at a2.proto:5:9 + || testdata/duplicatesyntheticoneofs/a2.proto:5:9:symbol "a.Foo" already defined at a1.proto:5:9`), + filepath.FromSlash(`testdata/duplicatesyntheticoneofs/a1.proto:6:19:symbol "a.Foo._bar" already defined at a2.proto:6:19 + || testdata/duplicatesyntheticoneofs/a2.proto:6:19:symbol "a.Foo._bar" already defined at a1.proto:6:19`), + filepath.FromSlash(`testdata/duplicatesyntheticoneofs/a1.proto:6:19:symbol "a.Foo.bar" already defined at a2.proto:6:19 + || testdata/duplicatesyntheticoneofs/a2.proto:6:19:symbol "a.Foo.bar" already defined at a1.proto:6:19`), + ) +} + +func TestOptionPanic(t *testing.T) { + t.Parallel() + require.NotPanics(t, func() { + module := testGetModule(t, filepath.Join("testdata", "optionpanic")) + _, _, err := NewBuilder(zap.NewNop(), bufmodule.NewNopModuleReader()).Build( + context.Background(), + module, + ) + require.NoError(t, err) + }) +} + +func TestCompareSemicolons(t *testing.T) { + t.Parallel() + runner := command.NewRunner() + testCompare(t, runner, "semicolons") +} + +func testCompare(t *testing.T, runner command.Runner, relDirPath string) { + dirPath := filepath.Join("testdata", relDirPath) + image, fileAnnotations := testBuild(t, false, dirPath) + require.Equal(t, 0, len(fileAnnotations), fileAnnotations) + image = bufimage.ImageWithoutImports(image) + fileDescriptorSet := bufimage.ImageToFileDescriptorSet(image) + filePaths := buftesting.GetProtocFilePaths(t, dirPath, 0) + actualProtocFileDescriptorSet := buftesting.GetActualProtocFileDescriptorSet(t, runner, false, false, dirPath, filePaths) + prototesting.AssertFileDescriptorSetsEqual(t, runner, fileDescriptorSet, actualProtocFileDescriptorSet) +} + +func testBuildGoogleapis(t *testing.T, includeSourceInfo bool) bufimage.Image { + googleapisDirPath := buftesting.GetGoogleapisDirPath(t, buftestingDirPath) + image, fileAnnotations := testBuild(t, includeSourceInfo, googleapisDirPath) + require.Equal(t, 0, len(fileAnnotations), fileAnnotations) + return image +} + +func testBuild(t *testing.T, includeSourceInfo bool, dirPath string) (bufimage.Image, []bufanalysis.FileAnnotation) { + module := testGetModule(t, dirPath) + var options []BuildOption + if !includeSourceInfo { + options = append(options, WithExcludeSourceCodeInfo()) + } + image, fileAnnotations, err := NewBuilder(zap.NewNop(), bufmodule.NewNopModuleReader()).Build( + context.Background(), + module, + options..., + ) + require.NoError(t, err) + return image, fileAnnotations +} + +func testGetModule(t *testing.T, dirPath string) bufmodule.Module { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + dirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + config, err := bufmoduleconfig.NewConfigV1(bufmoduleconfig.ExternalConfigV1{}) + require.NoError(t, err) + module, err := bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config, + ) + require.NoError(t, err) + return module +} + +func testGetImageFilePaths(image bufimage.Image) []string { + var fileNames []string + for _, file := range image.Files() { + fileNames = append(fileNames, file.Path()) + } + sort.Strings(fileNames) + return fileNames +} + +func testGetImageImportPaths(image bufimage.Image) []string { + var importNames []string + for _, file := range image.Files() { + if file.IsImport() { + importNames = append(importNames, file.Path()) + } + } + sort.Strings(importNames) + return importNames +} + +func testFileAnnotations(t *testing.T, relDirPath string, want ...string) { + t.Helper() + + // Allowing real parallelism makes some test expectations too complicated to express and assert + previousParallelism := thread.Parallelism() + thread.SetParallelism(1) + defer func() { + thread.SetParallelism(previousParallelism) + }() + + _, fileAnnotations := testBuild(t, false, filepath.Join("testdata", filepath.FromSlash(relDirPath))) + got := make([]string, len(fileAnnotations)) + for i, annotation := range fileAnnotations { + got[i] = annotation.String() + } + require.Equal(t, len(want), len(got)) + for i := range want { + options := strings.Split(want[i], "||") + matched := false + for _, option := range options { + option = strings.TrimSpace(option) + if got[i] == option { + matched = true + break + } + } + require.True(t, matched, "annotation at index %d: wanted %q ; got %q", i, want[i], got[i]) + } +} + +func testImageWithExcludedFilePaths(t *testing.T, image bufimage.Image, excludePaths []string) { + t.Helper() + for _, imageFile := range image.Files() { + if !imageFile.IsImport() { + for _, excludePath := range excludePaths { + assert.False(t, normalpath.EqualsOrContainsPath(excludePath, imageFile.Path(), normalpath.Relative), "paths: %s, %s", imageFile.Path(), excludePath) + } + } + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_unix_test.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_unix_test.go new file mode 100644 index 000000000..1d7f8e9ff --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_unix_test.go @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package bufimagebuild + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buftesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/prototesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/testingextended" + "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/descriptorpb" +) + +func TestCompareGoogleapis(t *testing.T) { + testingextended.SkipIfShort(t) + // Don't run in parallel as it allocates a lot of memory + // cannot directly compare with source code info as buf alpha protoc creates additional source + // code infos that protoc does not + image := testBuildGoogleapis(t, false) + fileDescriptorSet := bufimage.ImageToFileDescriptorSet(image) + runner := command.NewRunner() + actualProtocFileDescriptorSet := testBuildActualProtocGoogleapis(t, runner, false) + prototesting.AssertFileDescriptorSetsEqual( + t, + runner, + fileDescriptorSet, + actualProtocFileDescriptorSet, + ) +} + +func testBuildActualProtocGoogleapis(t *testing.T, runner command.Runner, includeSourceInfo bool) *descriptorpb.FileDescriptorSet { + googleapisDirPath := buftesting.GetGoogleapisDirPath(t, buftestingDirPath) + filePaths := buftesting.GetProtocFilePaths(t, googleapisDirPath, 0) + fileDescriptorSet := buftesting.GetActualProtocFileDescriptorSet(t, runner, true, includeSourceInfo, googleapisDirPath, filePaths) + assert.Equal(t, buftesting.NumGoogleapisFilesWithImports, len(fileDescriptorSet.GetFile())) + + return fileDescriptorSet +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptions1/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptions1/a.proto new file mode 100644 index 000000000..23ea761b4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptions1/a.proto @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FieldOptions { + int32 baz = 50007; +} + +message Foo { + string bar = 1 [(baz) = 42]; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/a.proto new file mode 100644 index 000000000..c5ff9a66e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/a.proto @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FieldOptions { + Foo foo = 50007; +} + +message Foo { + string bar = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/b.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/b.proto new file mode 100644 index 000000000..f54ff9b5d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/b.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "a.proto"; + +message Baz { + // the name is actually (a.foo).bar + string bat = 1 [(a.foo).bat = 1]; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/a/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/a/a.proto new file mode 100644 index 000000000..59f7ddb55 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/a/a.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +import "b/b.proto"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/b/b.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/b/b.proto new file mode 100644 index 000000000..f044d7ef0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/b/b.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package b; + +import "a/a.proto"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a1.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a1.proto new file mode 100644 index 000000000..325429faf --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a1.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Foo { + optional string bar = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a2.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a2.proto new file mode 100644 index 000000000..325429faf --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a2.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +message Foo { + optional string bar = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/notamessagetype/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/notamessagetype/a.proto new file mode 100644 index 000000000..10177589b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/notamessagetype/a.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax="proto3"; + +package a; + +message Foo{} +message Bar{} + +service MyService{ + rpc Foo(Foo) returns (Bar); +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/options/option.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/options/option.proto new file mode 100644 index 000000000..57df78a69 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/options/option.proto @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package options; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FileOptions { + MyOption my_option = 9999; +} + +message MyOption { + repeated MyArray my_array = 1; +} + +message MyArray { + message TestMessage { + } + map my_map = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/proto/test.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/proto/test.proto new file mode 100644 index 000000000..1dbf66e3a --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/proto/test.proto @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package proto; + +import "options/option.proto"; + +option (options.my_option) = { + my_array: { + my_map: { + } + } +}; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/proto3optional1/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/proto3optional1/a.proto new file mode 100644 index 000000000..1ea297ce4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/proto3optional1/a.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +message Foo { + optional string bar = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/semicolons/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/semicolons/a.proto new file mode 100644 index 000000000..e0f8cd74d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/semicolons/a.proto @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax="proto3";;;; +;;; +;package a;;;;; +; +;;;;import "google/protobuf/descriptor.proto"; +;; +; +;;extend google.protobuf.FileOptions { + bool foo = 9999999; +} +; +;message Bar { + ;;;option deprecated = true;;;; + ;;;; + int32 one = 1;;;; + ;repeated bool two = 2 [deprecated = true];; + map three = 3 [ + deprecated = false + ];;;; +};;;; +;; +;enum Baz { + ;;;;option deprecated = true;;;; + + ;DEFAULT = 0;;;; + ONE = 1;;; + TWO = 2;;;; +};;; +;; +;service BatService { +; ;option deprecated = true;;;; +; + ;rpc Bam(Bar) returns (Other);;; +; + rpc Ban(Other) returns (Bar) { + ; ;option deprecated = true;;;; + };;;; +};;;; +; +; +;;;;message Other{;;;};;;;; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/spacebetweennumberandid/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/spacebetweennumberandid/a.proto new file mode 100644 index 000000000..d56a9a2a3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/spacebetweennumberandid/a.proto @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax="proto2"; + +package a; + +message Test{ + extensions 10to max; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/trailingcomments/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/trailingcomments/a.proto new file mode 100644 index 000000000..461639170 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/trailingcomments/a.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package a; + +// https://github.com/ProtobufMan/bufman-cli/issues/798 + +enum Foo { // first comment + FOO_UNSPECIFIED = 0; +} // second comment diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify.go new file mode 100644 index 000000000..dbda7c65a --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify.go @@ -0,0 +1,350 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "fmt" + "path" + "strconv" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/data/datawkt" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoversion" + "go.uber.org/zap" + "google.golang.org/protobuf/types/descriptorpb" +) + +// Modifier modifies Images. +type Modifier interface { + // Modify modifies the Image. + Modify(context.Context, bufimage.Image) error +} + +// NewMultiModifier returns a new Modifier for the given Modifiers. +func NewMultiModifier(modifiers ...Modifier) Modifier { + switch len(modifiers) { + case 0: + return nil + case 1: + return modifiers[0] + default: + return newMultiModifier(modifiers) + } +} + +// ModifierFunc is a convenience type that implements the Modifier interface. +type ModifierFunc func(context.Context, bufimage.Image) error + +// Modify invokes the ModifierFunc with the given context and image. +func (m ModifierFunc) Modify(ctx context.Context, image bufimage.Image) error { + return m(ctx, image) +} + +// Sweeper is used to mark-and-sweep SourceCodeInfo_Locations from images. +type Sweeper interface { + // Sweep implements the ModifierFunc signature so that the Sweeper + // can be used as a Modifier. + Sweep(context.Context, bufimage.Image) error + + // mark is un-exported so that the Sweeper cannot be implemented + // outside of this package. + mark(string, []int32) +} + +// NewFileOptionSweeper constructs a new file option Sweeper that removes +// the SourceCodeInfo_Locations associated with the marks. +func NewFileOptionSweeper() Sweeper { + return newFileOptionSweeper() +} + +// Merge merges the given modifiers together so that they are run in the order +// they are provided. This is particularly useful for constructing a modifier +// from its initial 'nil' value. +// +// var modifier Modifier +// if config.JavaMultipleFiles { +// modifier = Merge(modifier, JavaMultipleFiles) +// } +func Merge(left Modifier, right Modifier) Modifier { + if left == nil { + return right + } + if right == nil { + return left + } + return NewMultiModifier(left, right) +} + +// CcEnableArenas returns a Modifier that sets the cc_enable_arenas +// file option to the given value in all of the files contained in +// the Image. +func CcEnableArenas( + logger *zap.Logger, + sweeper Sweeper, + value bool, + overrides map[string]string, +) (Modifier, error) { + validatedOverrides, err := stringOverridesToBoolOverrides(overrides) + if err != nil { + return nil, fmt.Errorf("invalid override for %s: %w", CcEnableArenasID, err) + } + return ccEnableArenas(logger, sweeper, value, validatedOverrides), nil +} + +// GoPackage returns a Modifier that sets the go_package file option +// according to the given defaultImportPathPrefix, exceptions, and +// overrides. +func GoPackage( + logger *zap.Logger, + sweeper Sweeper, + defaultImportPathPrefix string, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) (Modifier, error) { + return goPackage( + logger, + sweeper, + defaultImportPathPrefix, + except, + moduleOverrides, + overrides, + ) +} + +// JavaMultipleFiles returns a Modifier that sets the java_multiple_files +// file option to the given value in all of the files contained in +// the Image. If the preserveExistingValue is set to true, then the +// java_multiple_files option will be preserved if set. +func JavaMultipleFiles( + logger *zap.Logger, + sweeper Sweeper, + value bool, + overrides map[string]string, + preserveExistingValue bool, +) (Modifier, error) { + validatedOverrides, err := stringOverridesToBoolOverrides(overrides) + if err != nil { + return nil, fmt.Errorf("invalid override for %s: %w", JavaMultipleFilesID, err) + } + return javaMultipleFiles(logger, sweeper, value, validatedOverrides, preserveExistingValue), nil +} + +// JavaOuterClassname returns a Modifier that sets the java_outer_classname file option +// in all of the files contained in the Image based on the PascalCase of their filename. +// If the preserveExistingValue is set to true, then the java_outer_classname option will +// be preserved if set. +func JavaOuterClassname( + logger *zap.Logger, + sweeper Sweeper, + overrides map[string]string, + preserveExistingValue bool, +) Modifier { + return javaOuterClassname(logger, sweeper, overrides, preserveExistingValue) +} + +// JavaPackage returns a Modifier that sets the java_package file option +// according to the given packagePrefix. +func JavaPackage( + logger *zap.Logger, + sweeper Sweeper, + defaultPrefix string, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) (Modifier, error) { + return javaPackage( + logger, + sweeper, + defaultPrefix, + except, + moduleOverrides, + overrides, + ) +} + +// JavaStringCheckUtf8 returns a Modifier that sets the java_string_check_utf8 file option according +// to the given value. +func JavaStringCheckUtf8( + logger *zap.Logger, + sweeper Sweeper, + value bool, + overrides map[string]string, +) (Modifier, error) { + validatedOverrides, err := stringOverridesToBoolOverrides(overrides) + if err != nil { + return nil, fmt.Errorf("invalid override for %s: %w", JavaStringCheckUtf8ID, err) + } + return javaStringCheckUtf8(logger, sweeper, value, validatedOverrides), nil +} + +// OptimizeFor returns a Modifier that sets the optimize_for file +// option to the given value in all of the files contained in +// the Image. +func OptimizeFor( + logger *zap.Logger, + sweeper Sweeper, + defaultOptimizeFor descriptorpb.FileOptions_OptimizeMode, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode, + overrides map[string]string, +) (Modifier, error) { + validatedOverrides, err := stringOverridesToOptimizeModeOverrides(overrides) + if err != nil { + return nil, fmt.Errorf("invalid override for %s: %w", OptimizeForID, err) + } + return optimizeFor(logger, sweeper, defaultOptimizeFor, except, moduleOverrides, validatedOverrides), nil +} + +// GoPackageImportPathForFile returns the go_package import path for the given +// ImageFile. If the package contains a version suffix, and if there are more +// than two components, concatenate the final two components. Otherwise, we +// exclude the ';' separator and adopt the default behavior from the import path. +// +// For example, an ImageFile with `package acme.weather.v1;` will include `;weatherv1` +// in the `go_package` declaration so that the generated package is named as such. +func GoPackageImportPathForFile(imageFile bufimage.ImageFile, importPathPrefix string) string { + goPackageImportPath := path.Join(importPathPrefix, path.Dir(imageFile.Path())) + packageName := imageFile.FileDescriptor().GetPackage() + if _, ok := protoversion.NewPackageVersionForPackage(packageName); ok { + parts := strings.Split(packageName, ".") + if len(parts) >= 2 { + goPackageImportPath += ";" + parts[len(parts)-2] + parts[len(parts)-1] + } + } + return goPackageImportPath +} + +// ObjcClassPrefix returns a Modifier that sets the objc_class_prefix file option +// according to the package name. It is set to the uppercase first letter of each package sub-name, +// not including the package version, with the following rules: +// - If the resulting abbreviation is 2 characters, add "X". +// - If the resulting abbreviation is 1 character, add "XX". +// - If the resulting abbreviation is "GPB", change it to "GPX". +// "GPB" is reserved by Google for the Protocol Buffers implementation. +func ObjcClassPrefix( + logger *zap.Logger, + sweeper Sweeper, + defaultPrefix string, + except []bufmoduleref.ModuleIdentity, + moduleOverride map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) Modifier { + return objcClassPrefix(logger, sweeper, defaultPrefix, except, moduleOverride, overrides) +} + +// CsharpNamespace returns a Modifier that sets the csharp_namespace file option +// according to the package name. It is set to the package name with each package sub-name capitalized. +func CsharpNamespace( + logger *zap.Logger, + sweeper Sweeper, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) Modifier { + return csharpNamespace( + logger, + sweeper, + except, + moduleOverrides, + overrides, + ) +} + +// PhpNamespace returns a Modifier that sets the php_namespace file option +// according to the package name. It is set to the package name with each package sub-name capitalized +// and each "." replaced with "\\". +func PhpNamespace( + logger *zap.Logger, + sweeper Sweeper, + overrides map[string]string, +) Modifier { + return phpNamespace(logger, sweeper, overrides) +} + +// PhpMetadataNamespace returns a Modifier that sets the php_metadata_namespace file option +// according to the package name. It appends "\\GPBMetadata" to the heuristic used by PhpNamespace. +func PhpMetadataNamespace( + logger *zap.Logger, + sweeper Sweeper, + overrides map[string]string, +) Modifier { + return phpMetadataNamespace(logger, sweeper, overrides) +} + +// RubyPackage returns a Modifier that sets the ruby_package file option +// according to the given packagePrefix. It is set to the package name with each package sub-name capitalized +// and each "." replaced with "::". +func RubyPackage( + logger *zap.Logger, + sweeper Sweeper, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) Modifier { + return rubyPackage( + logger, + sweeper, + except, + moduleOverrides, + overrides, + ) +} + +// isWellKnownType returns true if the given path is one of the well-known types. +func isWellKnownType(ctx context.Context, imageFile bufimage.ImageFile) bool { + return datawkt.Exists(imageFile.Path()) +} + +// int32SliceIsEqual returns true if x and y contain the same elements. +func int32SliceIsEqual(x []int32, y []int32) bool { + if len(x) != len(y) { + return false + } + for i, elem := range x { + if elem != y[i] { + return false + } + } + return true +} + +func stringOverridesToBoolOverrides(stringOverrides map[string]string) (map[string]bool, error) { + validatedOverrides := make(map[string]bool, len(stringOverrides)) + for fileImportPath, overrideString := range stringOverrides { + overrideBool, err := strconv.ParseBool(overrideString) + if err != nil { + return nil, fmt.Errorf("non-boolean override %s set for file %s", overrideString, fileImportPath) + } + validatedOverrides[fileImportPath] = overrideBool + } + return validatedOverrides, nil +} + +func stringOverridesToOptimizeModeOverrides(stringOverrides map[string]string) (map[string]descriptorpb.FileOptions_OptimizeMode, error) { + validatedOverrides := make(map[string]descriptorpb.FileOptions_OptimizeMode, len(stringOverrides)) + for fileImportPath, stringOverride := range stringOverrides { + optimizeMode, ok := descriptorpb.FileOptions_OptimizeMode_value[stringOverride] + if !ok { + return nil, fmt.Errorf("invalid optimize mode %s set for file %s", stringOverride, fileImportPath) + } + validatedOverrides[fileImportPath] = descriptorpb.FileOptions_OptimizeMode(optimizeMode) + } + return validatedOverrides, nil +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go new file mode 100644 index 000000000..8e0c5f13a --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go @@ -0,0 +1,113 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +const ( + testImportPathPrefix = "github.com/foo/bar/private/gen/proto/go" + testRemote = "modulerepo.internal" + testRepositoryOwner = "testowner" + testRepositoryName = "testrepository" +) + +func assertFileOptionSourceCodeInfoEmpty(t *testing.T, image bufimage.Image, fileOptionPath []int32, includeSourceInfo bool) { + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + + if !includeSourceInfo { + assert.Empty(t, descriptor.SourceCodeInfo) + continue + } + + var hasFileOption bool + for _, location := range descriptor.SourceCodeInfo.Location { + if len(location.Path) > 0 && int32SliceIsEqual(location.Path, fileOptionPath) { + hasFileOption = true + break + } + } + assert.False(t, hasFileOption) + } +} + +func assertFileOptionSourceCodeInfoNotEmpty(t *testing.T, image bufimage.Image, fileOptionPath []int32) { + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + + var hasFileOption bool + for _, location := range descriptor.SourceCodeInfo.Location { + if len(location.Path) > 0 && int32SliceIsEqual(location.Path, fileOptionPath) { + hasFileOption = true + break + } + } + assert.True(t, hasFileOption) + } +} + +func testGetImage(t *testing.T, dirPath string, includeSourceInfo bool) bufimage.Image { + module := testGetModule(t, dirPath) + var options []bufimagebuild.BuildOption + if !includeSourceInfo { + options = []bufimagebuild.BuildOption{bufimagebuild.WithExcludeSourceCodeInfo()} + } + image, annotations, err := bufimagebuild.NewBuilder( + zap.NewNop(), + bufmodule.NewNopModuleReader(), + ).Build( + context.Background(), + module, + options..., + ) + require.NoError(t, err) + require.Empty(t, annotations) + return image +} + +func testGetModule(t *testing.T, dirPath string) bufmodule.Module { + storageosProvider := storageos.NewProvider() + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + dirPath, + ) + require.NoError(t, err) + moduleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + module, err := bufmodule.NewModuleForBucket( + context.Background(), + readWriteBucket, + bufmodule.ModuleWithModuleIdentityAndCommit(moduleIdentity, bufmoduletesting.TestCommit), + ) + require.NoError(t, err) + return module +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas.go new file mode 100644 index 000000000..ee16b91e1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas.go @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// CcEnableArenasID is the ID of the cc_enable_arenas modifier. +const CcEnableArenasID = "CC_ENABLE_ARENAS" + +// ccEnableArenas is the SourceCodeInfo path for the cc_enable_arenas option. +// https://github.com/protocolbuffers/protobuf/blob/29152fbc064921ca982d64a3a9eae1daa8f979bb/src/google/protobuf/descriptor.proto#L420 +var ccEnableArenasPath = []int32{8, 31} + +func ccEnableArenas( + logger *zap.Logger, + sweeper Sweeper, + value bool, + overrides map[string]bool, +) Modifier { + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + modifierValue := value + if overrideValue, ok := overrides[imageFile.Path()]; ok { + modifierValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := ccEnableArenasForFile(ctx, sweeper, imageFile, modifierValue); err != nil { + return err + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", CcEnableArenasID, overrideFile) + } + } + return nil + }, + ) +} + +func ccEnableArenasForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + value bool, +) error { + descriptor := imageFile.Proto() + options := descriptor.GetOptions() + switch { + case isWellKnownType(ctx, imageFile): + // The file is a well-known type, don't do anything. + return nil + case options != nil && options.GetCcEnableArenas() == value: + // The option is already set to the same value, don't do anything. + return nil + case options == nil && descriptorpb.Default_FileOptions_CcEnableArenas == value: + // The option is not set, but the value we want to set is the + // same as the default, don't do anything. + return nil + } + if options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.CcEnableArenas = proto.Bool(value) + if sweeper != nil { + sweeper.mark(imageFile.Path(), ccEnableArenasPath) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas_test.go new file mode 100644 index 000000000..ca4804035 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas_test.go @@ -0,0 +1,386 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestCcEnableArenasEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, false, nil) + require.NoError(t, err) + modifier := NewMultiModifier( + ccEnableArenasModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, false, nil) + require.NoError(t, err) + err = ccEnableArenasModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) + require.NoError(t, err) + modifier := NewMultiModifier( + ccEnableArenasModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + continue + } + assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) + require.NoError(t, err) + err = ccEnableArenasModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + continue + } + assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + }) +} + +func TestCcEnableArenasAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + modifier := NewMultiModifier( + ccEnableArenasModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + err = ccEnableArenasModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}) + require.NoError(t, err) + modifier := NewMultiModifier( + ccEnableArenasModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) + continue + } + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}) + require.NoError(t, err) + err = ccEnableArenasModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) + continue + } + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + }) +} + +func TestCcEnableArenasCcOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "ccoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + modifier := NewMultiModifier( + ccEnableArenasModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + err = ccEnableArenasModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}) + require.NoError(t, err) + modifier := NewMultiModifier( + ccEnableArenasModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) + continue + } + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + } + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}) + require.NoError(t, err) + err = ccEnableArenasModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) + continue + } + assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) + }) +} + +func TestCcEnableArenasWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + modifier := NewMultiModifier( + ccEnableArenasModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + assert.True(t, imageFile.Proto().GetOptions().GetCcEnableArenas()) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + err = ccEnableArenasModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + assert.True(t, imageFile.Proto().GetOptions().GetCcEnableArenas()) + } + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace.go new file mode 100644 index 000000000..23293c745 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace.go @@ -0,0 +1,152 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// CsharpNamespaceID is the ID of the csharp_namespace modifier. +const CsharpNamespaceID = "CSHARP_NAMESPACE" + +// csharpNamespacePath is the SourceCodeInfo path for the csharp_namespace option. +// https://github.com/protocolbuffers/protobuf/blob/61689226c0e3ec88287eaed66164614d9c4f2bf7/src/google/protobuf/descriptor.proto#L428 +var csharpNamespacePath = []int32{8, 37} + +func csharpNamespace( + logger *zap.Logger, + sweeper Sweeper, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) Modifier { + // Convert the bufmoduleref.ModuleIdentity types into + // strings so that they're comparable. + exceptModuleIdentityStrings := make(map[string]struct{}, len(except)) + for _, moduleIdentity := range except { + exceptModuleIdentityStrings[moduleIdentity.IdentityString()] = struct{}{} + } + overrideModuleIdentityStrings := make(map[string]string, len(moduleOverrides)) + for moduleIdentity, csharpNamespace := range moduleOverrides { + overrideModuleIdentityStrings[moduleIdentity.IdentityString()] = csharpNamespace + } + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenModuleIdentityStrings := make(map[string]struct{}, len(overrideModuleIdentityStrings)) + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + csharpNamespaceValue := csharpNamespaceValue(imageFile) + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + moduleIdentityString := moduleIdentity.IdentityString() + if moduleNamespaceOverride, ok := overrideModuleIdentityStrings[moduleIdentityString]; ok { + seenModuleIdentityStrings[moduleIdentityString] = struct{}{} + csharpNamespaceValue = moduleNamespaceOverride + } + } + if overrideValue, ok := overrides[imageFile.Path()]; ok { + csharpNamespaceValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := csharpNamespaceForFile( + ctx, + sweeper, + imageFile, + csharpNamespaceValue, + exceptModuleIdentityStrings, + ); err != nil { + return err + } + } + for moduleIdentityString := range overrideModuleIdentityStrings { + if _, ok := seenModuleIdentityStrings[moduleIdentityString]; !ok { + logger.Sugar().Warnf("csharp_namespace_prefix override for %q was unused", moduleIdentityString) + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", CsharpNamespaceID, overrideFile) + } + } + return nil + }, + ) +} + +func csharpNamespaceForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + csharpNamespaceValue string, + exceptModuleIdentityStrings map[string]struct{}, +) error { + if shouldSkipCsharpNamespaceForFile(ctx, imageFile, csharpNamespaceValue, exceptModuleIdentityStrings) { + // This is a well-known type or we could not resolve a non-empty csharp_namespace + // value, so this is a no-op. + return nil + } + descriptor := imageFile.Proto() + if descriptor.Options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.CsharpNamespace = proto.String(csharpNamespaceValue) + if sweeper != nil { + sweeper.mark(imageFile.Path(), csharpNamespacePath) + } + return nil +} + +func shouldSkipCsharpNamespaceForFile( + ctx context.Context, + imageFile bufimage.ImageFile, + csharpNamespaceValue string, + exceptModuleIdentityStrings map[string]struct{}, +) bool { + if isWellKnownType(ctx, imageFile) || csharpNamespaceValue == "" { + // This is a well-known type or we could not resolve a non-empty csharp_namespace + // value, so this is a no-op. + return true + } + + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + if _, ok := exceptModuleIdentityStrings[moduleIdentity.IdentityString()]; ok { + return true + } + } + return false +} + +// csharpNamespaceValue returns the csharp_namespace for the given ImageFile based on its +// package declaration. If the image file doesn't have a package declaration, an +// empty string is returned. +func csharpNamespaceValue(imageFile bufimage.ImageFile) string { + pkg := imageFile.Proto().GetPackage() + if pkg == "" { + return "" + } + packageParts := strings.Split(pkg, ".") + for i, part := range packageParts { + packageParts[i] = stringutil.ToPascalCase(part) + } + return strings.Join(packageParts, ".") +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace_test.go new file mode 100644 index 000000000..69ecf5b8c --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace_test.go @@ -0,0 +1,628 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestCsharpNamespaceEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "foo"}) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + // Overwritten with "foo" in the namespace + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetCsharpNamespace()) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "foo"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + // Overwritten with "foo" in the namespace + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetCsharpNamespace()) + }) +} + +func TestCsharpNamespaceAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "bar"}) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + // Overwritten with "bar" in the namespace + assert.Equal(t, "bar", descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "bar"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + // Overwritten with "bar" in the namespace + assert.Equal(t, "bar", descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + }) +} + +func TestCsharpNamespaceOptions(t *testing.T) { + t.Parallel() + testCsharpNamespaceOptions(t, filepath.Join("testdata", "csharpoptions", "single"), "Acme.V1") + testCsharpNamespaceOptions(t, filepath.Join("testdata", "csharpoptions", "double"), "Acme.Weather.V1") + testCsharpNamespaceOptions(t, filepath.Join("testdata", "csharpoptions", "triple"), "Acme.Weather.Data.V1") + testCsharpNamespaceOptions(t, filepath.Join("testdata", "csharpoptions", "underscore"), "Acme.Weather.FooBar.V1") +} + +func testCsharpNamespaceOptions(t *testing.T, dirPath string, classPrefix string) { + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + }) + + t.Run("with SourceCodeInfo and per-file options", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"override.proto": "Acme.Override.V1"}) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "Acme.Override.V1", descriptor.GetOptions().GetCsharpNamespace()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"override.proto": "Acme.Override.V1"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "Acme.Override.V1", descriptor.GetOptions().GetCsharpNamespace()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + }) +} + +func TestCsharpNamespaceWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + modifiedCsharpNamespace := "Acme.Weather.V1alpha1" + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.NotEmpty(t, descriptor.GetOptions().GetCsharpNamespace()) + assert.NotEqual(t, modifiedCsharpNamespace, descriptor.GetOptions().GetCsharpNamespace()) + continue + } + assert.Equal(t, + modifiedCsharpNamespace, + descriptor.GetOptions().GetCsharpNamespace(), + ) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.NotEmpty(t, descriptor.GetOptions().GetCsharpNamespace()) + assert.NotEqual(t, modifiedCsharpNamespace, descriptor.GetOptions().GetCsharpNamespace()) + continue + } + assert.Equal(t, + modifiedCsharpNamespace, + descriptor.GetOptions().GetCsharpNamespace(), + ) + } + }) +} + +func TestCsharpNamespaceWithExcept(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace( + zap.NewNop(), + sweeper, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace( + zap.NewNop(), + sweeper, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace( + zap.NewNop(), + sweeper, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"a.proto": "override"}, + ) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "", descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace( + zap.NewNop(), + sweeper, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"a.proto": "override"}, + ) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "", descriptor.GetOptions().GetCsharpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} + +func TestCsharpNamespaceWithOverride(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + overrideCsharpNamespacePrefix := "x.y.z" + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace( + zap.NewNop(), + sweeper, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideCsharpNamespacePrefix, + }, + nil, + ) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + strings.ReplaceAll(normalpath.Dir(overrideCsharpNamespacePrefix+"/"+imageFile.Path()), "/", "."), + descriptor.GetOptions().GetCsharpNamespace(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace( + zap.NewNop(), + sweeper, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideCsharpNamespacePrefix, + }, + nil, + ) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + strings.ReplaceAll(normalpath.Dir(overrideCsharpNamespacePrefix+"/"+imageFile.Path()), "/", "."), + descriptor.GetOptions().GetCsharpNamespace(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace( + zap.NewNop(), + sweeper, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideCsharpNamespacePrefix, + }, + map[string]string{"a.proto": "override"}, + ) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Proto().Name != nil && *imageFile.Proto().Name == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetCsharpNamespace()) + continue + } + assert.Equal(t, + strings.ReplaceAll(normalpath.Dir(imageFile.Path()), "/", "."), + descriptor.GetOptions().GetCsharpNamespace(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + csharpNamespaceModifier := CsharpNamespace( + zap.NewNop(), + sweeper, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideCsharpNamespacePrefix, + }, + map[string]string{"a.proto": "override"}, + ) + + modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Proto().Name != nil && *imageFile.Proto().Name == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetCsharpNamespace()) + continue + } + assert.Equal(t, + strings.ReplaceAll(normalpath.Dir(imageFile.Path()), "/", "."), + descriptor.GetOptions().GetCsharpNamespace(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/file_option_sweeper.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/file_option_sweeper.go new file mode 100644 index 000000000..e150b9e09 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/file_option_sweeper.go @@ -0,0 +1,116 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "google.golang.org/protobuf/types/descriptorpb" +) + +// fileOptionPath is the path prefix used for FileOptions. +// All file option locations are preceded by a location +// with a path set to the fileOptionPath. +// https://github.com/protocolbuffers/protobuf/blob/053966b4959bdd21e4a24e657bcb97cb9de9e8a4/src/google/protobuf/descriptor.proto#L80 +var fileOptionPath = []int32{8} + +type fileOptionSweeper struct { + // Filepath -> SourceCodeInfo_Location.Path keys. + sourceCodeInfoPaths map[string]map[string]struct{} +} + +func newFileOptionSweeper() *fileOptionSweeper { + return &fileOptionSweeper{ + sourceCodeInfoPaths: make(map[string]map[string]struct{}), + } +} + +// mark is used to mark the given SourceCodeInfo_Location indices for +// deletion. This method should be called in each of the file option +// modifiers. +func (s *fileOptionSweeper) mark(imageFilePath string, path []int32) { + paths, ok := s.sourceCodeInfoPaths[imageFilePath] + if !ok { + paths = make(map[string]struct{}) + s.sourceCodeInfoPaths[imageFilePath] = paths + } + paths[getPathKey(path)] = struct{}{} +} + +// Sweep applies all of the marks and sweeps the file option SourceCodeInfo_Locations. +func (s *fileOptionSweeper) Sweep(ctx context.Context, image bufimage.Image) error { + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if descriptor.SourceCodeInfo == nil { + continue + } + paths, ok := s.sourceCodeInfoPaths[imageFile.Path()] + if !ok { + continue + } + // We can't just match on an exact path match because the target + // file option's parent path elements would remain (i.e [8]). + // Instead, we perform an initial pass to validate that the paths + // are structured as expect, and collect all of the indices that + // we need to delete. + indices := make(map[int]struct{}, len(paths)*2) + for i, location := range descriptor.SourceCodeInfo.Location { + if _, ok := paths[getPathKey(location.Path)]; !ok { + continue + } + if i == 0 { + return fmt.Errorf("path %v must have a preceding parent path", location.Path) + } + if !int32SliceIsEqual(descriptor.SourceCodeInfo.Location[i-1].Path, fileOptionPath) { + return fmt.Errorf("path %v must have a preceding parent path equal to %v", location.Path, fileOptionPath) + } + // Add the target path and its parent. + indices[i-1] = struct{}{} + indices[i] = struct{}{} + } + // Now that we know exactly which indices to exclude, we can + // filter the SourceCodeInfo_Locations as needed. + locations := make( + []*descriptorpb.SourceCodeInfo_Location, + 0, + len(descriptor.SourceCodeInfo.Location)-len(indices), + ) + for i, location := range descriptor.SourceCodeInfo.Location { + if _, ok := indices[i]; ok { + continue + } + locations = append(locations, location) + } + descriptor.SourceCodeInfo.Location = locations + } + return nil +} + +// getPathKey returns a unique key for the given path. +func getPathKey(path []int32) string { + key := make([]byte, len(path)*4) + j := 0 + for _, elem := range path { + key[j] = byte(elem) + key[j+1] = byte(elem >> 8) + key[j+2] = byte(elem >> 16) + key[j+3] = byte(elem >> 24) + j += 4 + } + return string(key) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package.go new file mode 100644 index 000000000..91ebadbeb --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package.go @@ -0,0 +1,138 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// GoPackageID is the ID of the go_package modifier. +const GoPackageID = "GO_PACKAGE" + +// goPackagePath is the SourceCodeInfo path for the go_package option. +// https://github.com/protocolbuffers/protobuf/blob/ee04809540c098718121e092107fbc0abc231725/src/google/protobuf/descriptor.proto#L392 +var goPackagePath = []int32{8, 11} + +func goPackage( + logger *zap.Logger, + sweeper Sweeper, + defaultImportPathPrefix string, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) (Modifier, error) { + if defaultImportPathPrefix == "" { + return nil, fmt.Errorf("a non-empty import path prefix is required") + } + // Convert the bufmoduleref.ModuleIdentity types into + // strings so that they're comparable. + exceptModuleIdentityStrings := make(map[string]struct{}, len(except)) + for _, moduleIdentity := range except { + exceptModuleIdentityStrings[moduleIdentity.IdentityString()] = struct{}{} + } + overrideModuleIdentityStrings := make(map[string]string, len(moduleOverrides)) + for moduleIdentity, goPackagePrefix := range moduleOverrides { + overrideModuleIdentityStrings[moduleIdentity.IdentityString()] = goPackagePrefix + } + seenModuleIdentityStrings := make(map[string]struct{}, len(overrideModuleIdentityStrings)) + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + for _, imageFile := range image.Files() { + importPathPrefix := defaultImportPathPrefix + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + moduleIdentityString := moduleIdentity.IdentityString() + if modulePrefixOverride, ok := overrideModuleIdentityStrings[moduleIdentityString]; ok { + importPathPrefix = modulePrefixOverride + seenModuleIdentityStrings[moduleIdentityString] = struct{}{} + } + } + goPackageValue := GoPackageImportPathForFile(imageFile, importPathPrefix) + if overrideValue, ok := overrides[imageFile.Path()]; ok { + goPackageValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := goPackageForFile( + ctx, + sweeper, + imageFile, + goPackageValue, + exceptModuleIdentityStrings, + ); err != nil { + return err + } + } + for moduleIdentityString := range overrideModuleIdentityStrings { + if _, ok := seenModuleIdentityStrings[moduleIdentityString]; !ok { + logger.Sugar().Warnf("go_package_prefix override for %q was unused", moduleIdentityString) + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", GoPackageID, overrideFile) + } + } + return nil + }, + ), nil +} + +func goPackageForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + goPackageValue string, + exceptModuleIdentityStrings map[string]struct{}, +) error { + if shouldSkipGoPackageForFile(ctx, imageFile, exceptModuleIdentityStrings) { + return nil + } + descriptor := imageFile.Proto() + if descriptor.Options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.GoPackage = proto.String(goPackageValue) + if sweeper != nil { + sweeper.mark(imageFile.Path(), goPackagePath) + } + return nil +} + +func shouldSkipGoPackageForFile( + ctx context.Context, + imageFile bufimage.ImageFile, + exceptModuleIdentityStrings map[string]struct{}, +) bool { + if isWellKnownType(ctx, imageFile) && imageFile.Proto().GetOptions().GetGoPackage() != "" { + // The well-known type defines the go_package option, so this is a no-op. + // If a well-known type ever omits the go_package option, we make sure + // to include it. + return true + } + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + if _, ok := exceptModuleIdentityStrings[moduleIdentity.IdentityString()]; ok { + return true + } + } + return false +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package_test.go new file mode 100644 index 000000000..49574593a --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package_test.go @@ -0,0 +1,688 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "fmt" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestGoPackageError(t *testing.T) { + t.Parallel() + _, err := GoPackage(zap.NewNop(), NewFileOptionSweeper(), "", nil, nil, nil) + require.Error(t, err) +} + +func TestGoPackageEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} + +func TestGoPackageAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, goPackagePath) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{}) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, goPackagePath) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} + +func TestGoPackagePackageVersion(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "packageversion") + packageSuffix := "weatherv1alpha1" + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, goPackagePath) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + fmt.Sprintf("%s;%s", + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + packageSuffix, + ), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + fmt.Sprintf("%s;%s", + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + packageSuffix, + ), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, goPackagePath) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) + continue + } + assert.Equal(t, + fmt.Sprintf("%s;%s", + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + packageSuffix, + ), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) + continue + } + assert.Equal(t, + fmt.Sprintf("%s;%s", + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + packageSuffix, + ), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} + +func TestGoPackageWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + packageSuffix := "weatherv1alpha1" + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + modifiedGoPackage := fmt.Sprintf("%s;%s", + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + packageSuffix, + ) + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.NotEmpty(t, descriptor.GetOptions().GetGoPackage()) + assert.NotEqual(t, modifiedGoPackage, descriptor.GetOptions().GetGoPackage()) + continue + } + assert.Equal(t, + modifiedGoPackage, + descriptor.GetOptions().GetGoPackage(), + ) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + modifiedGoPackage := fmt.Sprintf("%s;%s", + normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), + packageSuffix, + ) + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.NotEmpty(t, descriptor.GetOptions().GetGoPackage()) + assert.NotEqual(t, modifiedGoPackage, descriptor.GetOptions().GetGoPackage()) + continue + } + assert.Equal(t, + modifiedGoPackage, + descriptor.GetOptions().GetGoPackage(), + ) + } + }) +} + +func TestGoPackageWithExcept(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage( + zap.NewNop(), + sweeper, + testImportPathPrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage( + zap.NewNop(), + sweeper, + testImportPathPrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage( + zap.NewNop(), + sweeper, + testImportPathPrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"a.proto": "override"}, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage( + zap.NewNop(), + sweeper, + testImportPathPrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"a.proto": "override"}, + ) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} + +func TestGoPackageWithOverride(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + overrideGoPackagePrefix := "github.com/foo/bar/private/private/gen/proto/go" + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage( + zap.NewNop(), + sweeper, + testImportPathPrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideGoPackagePrefix, + }, + nil, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + normalpath.Dir(overrideGoPackagePrefix+"/"+imageFile.Path()), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage( + zap.NewNop(), + sweeper, + testImportPathPrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideGoPackagePrefix, + }, + nil, + ) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + normalpath.Dir(overrideGoPackagePrefix+"/"+imageFile.Path()), + descriptor.GetOptions().GetGoPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + goPackageModifier, err := GoPackage( + zap.NewNop(), + sweeper, + testImportPathPrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideGoPackagePrefix, + }, + map[string]string{"a.proto": "override"}, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := GoPackage( + zap.NewNop(), + sweeper, + testImportPathPrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideGoPackagePrefix, + }, + map[string]string{"a.proto": "override"}, + ) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files.go new file mode 100644 index 000000000..33f65b9db --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files.go @@ -0,0 +1,104 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + // DefaultJavaMultipleFilesValue is the default value for the java_multiple_files modifier. + DefaultJavaMultipleFilesValue = true + + // JavaMultipleFilesID is the ID of the java_multiple_files modifier. + JavaMultipleFilesID = "JAVA_MULTIPLE_FILES" +) + +// javaMultipleFilesPath is the SourceCodeInfo path for the java_multiple_files option. +// https://github.com/protocolbuffers/protobuf/blob/ee04809540c098718121e092107fbc0abc231725/src/google/protobuf/descriptor.proto#L364 +var javaMultipleFilesPath = []int32{8, 10} + +func javaMultipleFiles( + logger *zap.Logger, + sweeper Sweeper, + value bool, + overrides map[string]bool, + preserveExistingValue bool, +) Modifier { + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + modifierValue := value + if overrideValue, ok := overrides[imageFile.Path()]; ok { + modifierValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := javaMultipleFilesForFile(ctx, sweeper, imageFile, modifierValue, preserveExistingValue); err != nil { + return err + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", JavaMultipleFilesID, overrideFile) + } + } + return nil + }, + ) +} + +func javaMultipleFilesForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + value bool, + preserveExistingValue bool, +) error { + descriptor := imageFile.Proto() + options := descriptor.GetOptions() + switch { + case isWellKnownType(ctx, imageFile): + // The file is a well-known type, don't do anything. + return nil + case options != nil: + if preserveExistingValue && options.JavaMultipleFiles != nil { + // This option is explicitly set to a value - preserve existing value. + return nil + } + if options.GetJavaMultipleFiles() == value { + // The option is already set to the same value, don't do anything. + return nil + } + case options == nil && descriptorpb.Default_FileOptions_JavaMultipleFiles == value: + // The option is not set, but the value we want to set is the + // same as the default, don't do anything. + return nil + } + if options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.JavaMultipleFiles = proto.Bool(value) + if sweeper != nil { + sweeper.mark(imageFile.Path(), javaMultipleFilesPath) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files_test.go new file mode 100644 index 000000000..3c5011726 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files_test.go @@ -0,0 +1,429 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestJavaMultipleFilesEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) + require.NoError(t, err) + modifier := NewMultiModifier( + javaMultipleFilesModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}, false) + require.NoError(t, err) + modifier := NewMultiModifier( + javaMultipleFilesModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}, false) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + }) +} + +func TestJavaMultipleFilesAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) + require.NoError(t, err) + modifier := NewMultiModifier( + javaMultipleFilesModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}, false) + require.NoError(t, err) + modifier := NewMultiModifier( + javaMultipleFilesModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + continue + } + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}, false) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + continue + } + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + }) + + t.Run("with preserveExistingValue", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, true) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + continue + } + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + }) +} + +func TestJavaMultipleFilesJavaOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "javaoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, nil, false) + require.NoError(t, err) + modifier := NewMultiModifier( + javaMultipleFilesModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, nil, false) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + continue + } + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, map[string]string{"override.proto": "true"}, false) + require.NoError(t, err) + modifier := NewMultiModifier( + javaMultipleFilesModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + continue + } + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, map[string]string{"override.proto": "true"}, false) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + continue + } + assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + }) + + t.Run("with preserveExistingValue", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, nil, true) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) + }) +} + +func TestJavaMultipleFilesWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) + require.NoError(t, err) + modifier := NewMultiModifier( + javaMultipleFilesModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + assert.True(t, imageFile.Proto().GetOptions().GetJavaMultipleFiles()) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) + require.NoError(t, err) + err = javaMultipleFilesModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + assert.True(t, imageFile.Proto().GetOptions().GetJavaMultipleFiles()) + } + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname.go new file mode 100644 index 000000000..fe6a7a693 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname.go @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// JavaOuterClassNameID is the ID for the java_outer_classname modifier. +const JavaOuterClassNameID = "JAVA_OUTER_CLASSNAME" + +// javaOuterClassnamePath is the SourceCodeInfo path for the java_outer_classname option. +// https://github.com/protocolbuffers/protobuf/blob/87d140f851131fb8a6e8a80449cf08e73e568259/src/google/protobuf/descriptor.proto#L356 +var javaOuterClassnamePath = []int32{8, 8} + +func javaOuterClassname( + logger *zap.Logger, + sweeper Sweeper, + overrides map[string]string, + preserveExistingValue bool, +) Modifier { + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + javaOuterClassnameValue := javaOuterClassnameValue(imageFile) + if overrideValue, ok := overrides[imageFile.Path()]; ok { + javaOuterClassnameValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := javaOuterClassnameForFile(ctx, sweeper, imageFile, javaOuterClassnameValue, preserveExistingValue); err != nil { + return err + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", JavaOuterClassNameID, overrideFile) + } + } + return nil + }, + ) +} + +func javaOuterClassnameForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + javaOuterClassnameValue string, + preserveExistingValue bool, +) error { + if isWellKnownType(ctx, imageFile) { + // The file is a well-known type - don't override the value. + return nil + } + descriptor := imageFile.Proto() + options := descriptor.GetOptions() + if options != nil && options.JavaOuterClassname != nil && preserveExistingValue { + // The option is explicitly set in the file - don't override it if we want to preserve the existing value. + return nil + } + if options.GetJavaOuterClassname() == javaOuterClassnameValue { + // The file already defines the java_outer_classname option with the given value, so this is a no-op. + return nil + } + if descriptor.Options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.JavaOuterClassname = proto.String(javaOuterClassnameValue) + if sweeper != nil { + sweeper.mark(imageFile.Path(), javaOuterClassnamePath) + } + return nil +} + +func javaOuterClassnameValue(imageFile bufimage.ImageFile) string { + return stringutil.ToPascalCase(normalpath.Base(imageFile.Path())) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname_test.go new file mode 100644 index 000000000..64c2698da --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname_test.go @@ -0,0 +1,410 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestJavaOuterClassnameEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, nil, false), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + + sweeper := NewFileOptionSweeper() + err := JavaOuterClassname(zap.NewNop(), sweeper, nil, false).Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}, false), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + + sweeper := NewFileOptionSweeper() + err := JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}, false).Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + }) + + t.Run("with preserveExistingValue", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, nil, true), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + }) +} + +func TestJavaOuterClassnameAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, nil, false), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + + sweeper := NewFileOptionSweeper() + err := JavaOuterClassname(zap.NewNop(), sweeper, nil, false).Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}, false), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + + sweeper := NewFileOptionSweeper() + err := JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}, false).Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + }) + + t.Run("with preserveExistingValue", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, nil, true), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) + }) +} + +func TestJavaOuterClassnameJavaOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "javaoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, nil, false), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, stringutil.ToPascalCase(normalpath.Base(imageFile.Path())), descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + + sweeper := NewFileOptionSweeper() + err := JavaOuterClassname(zap.NewNop(), sweeper, nil, false).Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, stringutil.ToPascalCase(normalpath.Base(imageFile.Path())), descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}, false), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) + continue + } + assert.Equal(t, "JavaFileProto", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + + sweeper := NewFileOptionSweeper() + err := JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}, false).Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) + continue + } + assert.Equal(t, "JavaFileProto", descriptor.GetOptions().GetJavaOuterClassname()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) + }) +} + +func TestJavaOuterClassnameWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + modifier := NewMultiModifier( + JavaOuterClassname(zap.NewNop(), sweeper, nil, false), + ModifierFunc(sweeper.Sweep), + ) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.Equal(t, javaOuterClassnameValue(imageFile), descriptor.GetOptions().GetJavaOuterClassname()) + continue + } + assert.Equal(t, + "AProto", + descriptor.GetOptions().GetJavaOuterClassname(), + ) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + err := JavaOuterClassname(zap.NewNop(), sweeper, nil, false).Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.Equal(t, javaOuterClassnameValue(imageFile), descriptor.GetOptions().GetJavaOuterClassname()) + continue + } + assert.Equal(t, + "AProto", + descriptor.GetOptions().GetJavaOuterClassname(), + ) + } + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package.go new file mode 100644 index 000000000..c7928f29e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package.go @@ -0,0 +1,154 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + // DefaultJavaPackagePrefix is the default java_package prefix used in the java_package modifier. + DefaultJavaPackagePrefix = "com" + + // JavaPackageID is the ID of the java_package modifier. + JavaPackageID = "JAVA_PACKAGE" +) + +// javaPackagePath is the SourceCodeInfo path for the java_package option. +// https://github.com/protocolbuffers/protobuf/blob/61689226c0e3ec88287eaed66164614d9c4f2bf7/src/google/protobuf/descriptor.proto#L348 +var javaPackagePath = []int32{8, 1} + +func javaPackage( + logger *zap.Logger, + sweeper Sweeper, + defaultPackagePrefix string, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) (Modifier, error) { + if defaultPackagePrefix == "" { + return nil, fmt.Errorf("a non-empty package prefix is required") + } + // Convert the bufmoduleref.ModuleIdentity types into + // strings so that they're comparable. + exceptModuleIdentityStrings := make(map[string]struct{}, len(except)) + for _, moduleIdentity := range except { + exceptModuleIdentityStrings[moduleIdentity.IdentityString()] = struct{}{} + } + overrideModuleIdentityStrings := make(map[string]string, len(moduleOverrides)) + for moduleIdentity, javaPackagePrefix := range moduleOverrides { + overrideModuleIdentityStrings[moduleIdentity.IdentityString()] = javaPackagePrefix + } + seenModuleIdentityStrings := make(map[string]struct{}, len(overrideModuleIdentityStrings)) + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + for _, imageFile := range image.Files() { + packagePrefix := defaultPackagePrefix + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + moduleIdentityString := moduleIdentity.IdentityString() + if modulePrefixOverride, ok := overrideModuleIdentityStrings[moduleIdentityString]; ok { + packagePrefix = modulePrefixOverride + seenModuleIdentityStrings[moduleIdentityString] = struct{}{} + } + } + javaPackageValue := javaPackageValue(imageFile, packagePrefix) + if overridePackagePrefix, ok := overrides[imageFile.Path()]; ok { + javaPackageValue = overridePackagePrefix + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := javaPackageForFile( + ctx, + sweeper, + imageFile, + javaPackageValue, + exceptModuleIdentityStrings, + ); err != nil { + return err + } + } + for moduleIdentityString := range overrideModuleIdentityStrings { + if _, ok := seenModuleIdentityStrings[moduleIdentityString]; !ok { + logger.Sugar().Warnf("java_package_prefix override for %q was unused", moduleIdentityString) + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", JavaPackageID, overrideFile) + } + } + return nil + }, + ), nil +} + +func javaPackageForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + javaPackageValue string, + exceptModuleIdentityStrings map[string]struct{}, +) error { + if shouldSkipJavaPackageForFile(ctx, imageFile, javaPackageValue, exceptModuleIdentityStrings) { + return nil + } + descriptor := imageFile.Proto() + if descriptor.Options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.JavaPackage = proto.String(javaPackageValue) + if sweeper != nil { + sweeper.mark(imageFile.Path(), javaPackagePath) + } + return nil +} + +func shouldSkipJavaPackageForFile( + ctx context.Context, + imageFile bufimage.ImageFile, + javaPackageValue string, + exceptModuleIdentityStrings map[string]struct{}, +) bool { + if isWellKnownType(ctx, imageFile) || javaPackageValue == "" { + // This is a well-known type or we could not resolve a non-empty java_package + // value, so this is a no-op. + return true + } + + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + if _, ok := exceptModuleIdentityStrings[moduleIdentity.IdentityString()]; ok { + return true + } + } + return false +} + +// javaPackageValue returns the java_package for the given ImageFile based on its +// package declaration. If the image file doesn't have a package declaration, an +// empty string is returned. +func javaPackageValue(imageFile bufimage.ImageFile, packagePrefix string) string { + if pkg := imageFile.Proto().GetPackage(); pkg != "" { + return packagePrefix + "." + pkg + } + return "" +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package_test.go new file mode 100644 index 000000000..7046c5378 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package_test.go @@ -0,0 +1,633 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +const testJavaPackagePrefix = "com" + +func TestJavaPackageError(t *testing.T) { + t.Parallel() + _, err := JavaPackage(zap.NewNop(), NewFileOptionSweeper(), "", nil, nil, nil) + require.Error(t, err) +} + +func TestJavaPackageEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) + }) +} + +func TestJavaPackageAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"a.proto": "override"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + }) +} + +func TestJavaPackageJavaOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "javaoptions") + modifiedJavaPackage := "com.acme.weather" + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"override.proto": "override"}) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) + continue + } + assert.Equal(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"override.proto": "override"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) + continue + } + assert.Equal(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + }) +} + +func TestJavaPackageWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + javaPackagePrefix := "org" + modifiedJavaPackage := "org.acme.weather.v1alpha1" + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, javaPackagePrefix, nil, nil, nil) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.NotEmpty(t, descriptor.GetOptions().GetJavaPackage()) + assert.NotEqual(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) + continue + } + assert.Equal(t, + modifiedJavaPackage, + descriptor.GetOptions().GetJavaPackage(), + ) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage(zap.NewNop(), sweeper, javaPackagePrefix, nil, nil, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.NotEmpty(t, descriptor.GetOptions().GetJavaPackage()) + assert.NotEqual(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) + continue + } + assert.Equal(t, + modifiedJavaPackage, + descriptor.GetOptions().GetJavaPackage(), + ) + } + }) +} + +func TestJavaPackageWithExcept(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "javaemptyoptions") + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage( + zap.NewNop(), + sweeper, + testJavaPackagePrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage( + zap.NewNop(), + sweeper, + testJavaPackagePrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage( + zap.NewNop(), + sweeper, + testJavaPackagePrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"a.proto": "override"}, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage( + zap.NewNop(), + sweeper, + testJavaPackagePrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"a.proto": "override"}, + ) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + }) +} + +func TestJavaPackageWithOverride(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "javaemptyoptions") + overrideJavaPackagePrefix := "foo.bar" + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage( + zap.NewNop(), + sweeper, + testJavaPackagePrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideJavaPackagePrefix, + }, + nil, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + overrideJavaPackagePrefix+"."+descriptor.GetPackage(), + descriptor.GetOptions().GetJavaPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage( + zap.NewNop(), + sweeper, + testJavaPackagePrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideJavaPackagePrefix, + }, + nil, + ) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + overrideJavaPackagePrefix+"."+descriptor.GetPackage(), + descriptor.GetOptions().GetJavaPackage(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + + sweeper := NewFileOptionSweeper() + javaPackageModifier, err := JavaPackage( + zap.NewNop(), + sweeper, + testJavaPackagePrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideJavaPackagePrefix, + }, + map[string]string{"a.proto": "override"}, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaPackage( + zap.NewNop(), + sweeper, + testJavaPackagePrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{ + testModuleIdentity: overrideJavaPackagePrefix, + }, + map[string]string{"a.proto": "override"}, + ) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8.go new file mode 100644 index 000000000..d61b6240f --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8.go @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// JavaStringCheckUtf8ID is the ID of the java_string_check_utf8 modifier. +const JavaStringCheckUtf8ID = "JAVA_STRING_CHECK_UTF8" + +// javaStringCheckUtf8Path is the SourceCodeInfo path for the java_string_check_utf8 option. +// https://github.com/protocolbuffers/protobuf/blob/61689226c0e3ec88287eaed66164614d9c4f2bf7/src/google/protobuf/descriptor.proto#L375 +var javaStringCheckUtf8Path = []int32{8, 27} + +func javaStringCheckUtf8( + logger *zap.Logger, + sweeper Sweeper, + value bool, + overrides map[string]bool, +) Modifier { + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + modifierValue := value + if overrideValue, ok := overrides[imageFile.Path()]; ok { + modifierValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := javaStringCheckUtf8ForFile(ctx, sweeper, imageFile, modifierValue); err != nil { + return err + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", JavaStringCheckUtf8ID, overrideFile) + } + } + return nil + }, + ) +} + +func javaStringCheckUtf8ForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + value bool, +) error { + descriptor := imageFile.Proto() + options := descriptor.GetOptions() + switch { + case isWellKnownType(ctx, imageFile): + // The file is a well-known type, don't do anything. + return nil + case options != nil && options.GetJavaStringCheckUtf8() == value: + // The option is already set to the same value, don't do anything. + return nil + case options == nil && descriptorpb.Default_FileOptions_JavaStringCheckUtf8 == value: + // The option is not set, but the value we want to set is the + // same as the default, don't do anything. + return nil + } + if options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.JavaStringCheckUtf8 = proto.Bool(value) + if sweeper != nil { + sweeper.mark(imageFile.Path(), javaStringCheckUtf8Path) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8_test.go new file mode 100644 index 000000000..705c6e179 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8_test.go @@ -0,0 +1,347 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestJavaStringCheckUtf8EmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, true) + + sweeper := NewFileOptionSweeper() + JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, nil) + require.NoError(t, err) + modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, true) + + sweeper := NewFileOptionSweeper() + JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) + require.NoError(t, err) + modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + }) +} + +func TestJavaStringCheckUtf8AllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) + + sweeper := NewFileOptionSweeper() + JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, nil) + require.NoError(t, err) + modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) + + sweeper := NewFileOptionSweeper() + JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) + require.NoError(t, err) + modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + continue + } + assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + continue + } + assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + }) +} + +func TestJavaStringCheckUtf8JavaOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "javaoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) + + sweeper := NewFileOptionSweeper() + JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) + + sweeper := NewFileOptionSweeper() + JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, map[string]string{"override.proto": "false"}) + require.NoError(t, err) + modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + continue + } + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, map[string]string{"override.proto": "false"}) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + continue + } + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + }) +} + +func TestJavaStringCheckUtf8WellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + continue + } + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, nil) + require.NoError(t, err) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + continue + } + assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) + } + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/multi_modifier.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/multi_modifier.go new file mode 100644 index 000000000..9f9c5c4f3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/multi_modifier.go @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" +) + +type multiModifier struct { + delegates []Modifier +} + +func newMultiModifier( + delegates []Modifier, +) *multiModifier { + return &multiModifier{ + delegates: delegates, + } +} + +func (m *multiModifier) Modify( + ctx context.Context, + image bufimage.Image, +) error { + for _, delegate := range m.delegates { + if err := delegate.Modify(ctx, image); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix.go new file mode 100644 index 000000000..7eca13945 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix.go @@ -0,0 +1,152 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "strings" + "unicode" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoversion" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// ObjcClassPrefixID is the ID of the objc_class_prefix modifier. +const ObjcClassPrefixID = "OBJC_CLASS_PREFIX" + +// objcClassPrefixPath is the SourceCodeInfo path for the objc_class_prefix option. +// https://github.com/protocolbuffers/protobuf/blob/61689226c0e3ec88287eaed66164614d9c4f2bf7/src/google/protobuf/descriptor.proto#L425 +var objcClassPrefixPath = []int32{8, 36} + +func objcClassPrefix( + logger *zap.Logger, + sweeper Sweeper, + defaultPrefix string, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) Modifier { + // Convert the bufmoduleref.ModuleIdentity types into + // strings so that they're comparable. + exceptModuleIdentityStrings := make(map[string]struct{}, len(except)) + for _, moduleIdentity := range except { + exceptModuleIdentityStrings[moduleIdentity.IdentityString()] = struct{}{} + } + overrideModuleIdentityStrings := make(map[string]string, len(moduleOverrides)) + for moduleIdentity, goPackagePrefix := range moduleOverrides { + overrideModuleIdentityStrings[moduleIdentity.IdentityString()] = goPackagePrefix + } + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenModuleIdentityStrings := make(map[string]struct{}, len(overrideModuleIdentityStrings)) + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + objcClassPrefixValue := objcClassPrefixValue(imageFile) + if defaultPrefix != "" { + objcClassPrefixValue = defaultPrefix + } + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + moduleIdentityString := moduleIdentity.IdentityString() + if modulePrefixOverride, ok := overrideModuleIdentityStrings[moduleIdentityString]; ok { + objcClassPrefixValue = modulePrefixOverride + seenModuleIdentityStrings[moduleIdentityString] = struct{}{} + } + } + if overrideValue, ok := overrides[imageFile.Path()]; ok { + objcClassPrefixValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := objcClassPrefixForFile(ctx, sweeper, imageFile, objcClassPrefixValue, exceptModuleIdentityStrings); err != nil { + return err + } + } + for moduleIdentityString := range overrideModuleIdentityStrings { + if _, ok := seenModuleIdentityStrings[moduleIdentityString]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", ObjcClassPrefixID, moduleIdentityString) + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", ObjcClassPrefixID, overrideFile) + } + } + return nil + }, + ) +} + +func objcClassPrefixForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + objcClassPrefixValue string, + exceptModuleIdentityStrings map[string]struct{}, +) error { + descriptor := imageFile.Proto() + if isWellKnownType(ctx, imageFile) || objcClassPrefixValue == "" { + // This is a well-known type or we could not resolve a non-empty objc_class_prefix + // value, so this is a no-op. + return nil + } + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + if _, ok := exceptModuleIdentityStrings[moduleIdentity.IdentityString()]; ok { + return nil + } + } + if descriptor.Options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.ObjcClassPrefix = proto.String(objcClassPrefixValue) + if sweeper != nil { + sweeper.mark(imageFile.Path(), objcClassPrefixPath) + } + return nil +} + +// objcClassPrefixValue returns the objc_class_prefix for the given ImageFile based on its +// package declaration. If the image file doesn't have a package declaration, an +// empty string is returned. +func objcClassPrefixValue(imageFile bufimage.ImageFile) string { + pkg := imageFile.Proto().GetPackage() + if pkg == "" { + return "" + } + _, hasPackageVersion := protoversion.NewPackageVersionForPackage(pkg) + packageParts := strings.Split(pkg, ".") + var prefixParts []rune + for i, part := range packageParts { + // Check if last part is a version before appending. + if i == len(packageParts)-1 && hasPackageVersion { + continue + } + // Probably should never be a non-ASCII character, + // but why not support it just in case? + runeSlice := []rune(part) + prefixParts = append(prefixParts, unicode.ToUpper(runeSlice[0])) + } + for len(prefixParts) < 3 { + prefixParts = append(prefixParts, 'X') + } + prefix := string(prefixParts) + if prefix == "GPB" { + prefix = "GPX" + } + return prefix +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix_test.go new file mode 100644 index 000000000..b8a6cb47e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix_test.go @@ -0,0 +1,719 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestObjcClassPrefixEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) + + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"a.proto": "override"}) + + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + require.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + require.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + }) +} + +func TestObjcClassPrefixAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) + + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"a.proto": "override"}) + + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) +} + +func TestObjcClassPrefixObjcOptions(t *testing.T) { + t.Parallel() + testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "single"), "AXX") + testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "double"), "AWX") + testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "triple"), "AWD") + testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "unversioned"), "AWD") + testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "gpb"), "GPX") +} + +func testObjcClassPrefixOptions(t *testing.T, dirPath string, classPrefix string) { + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) + + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"override.proto": "override"}) + + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"override.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) +} + +func TestObjcClassPrefixWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + modifiedObjcClassPrefix := "AWX" + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) + + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.NotEmpty(t, descriptor.GetOptions().GetObjcClassPrefix()) + assert.NotEqual(t, modifiedObjcClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, + modifiedObjcClassPrefix, + descriptor.GetOptions().GetObjcClassPrefix(), + ) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + assert.NotEmpty(t, descriptor.GetOptions().GetObjcClassPrefix()) + assert.NotEqual(t, modifiedObjcClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, + modifiedObjcClassPrefix, + descriptor.GetOptions().GetObjcClassPrefix(), + ) + } + }) +} + +func TestObjcClassPrefixWithDefault(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "objcoptions", "single") + defaultClassPrefix := "DEFAULT" + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + nil, + nil, + nil, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, defaultClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + nil, + nil, + nil, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, defaultClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + nil, + nil, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, defaultClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + nil, + nil, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, defaultClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) +} + +func TestObjcClassPrefixWithExcept(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "objcoptions", "single") + defaultClassPrefix := "DEFAULT" + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + // Should still be non-empty because the module is skipped. + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + // Should still be non-empty because the module is skipped. + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) +} + +func TestObjcClassPrefixWithOverride(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "objcoptions", "single") + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + defaultClassPrefix := "DEFAULT" + overrideClassPrefix := "MODULE_OVERRIDE" + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideClassPrefix}, + nil, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, overrideClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideClassPrefix}, + nil, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, overrideClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideClassPrefix}, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, overrideClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + + sweeper := NewFileOptionSweeper() + objcClassPrefixModifier := ObjcClassPrefix( + zap.NewNop(), + sweeper, + defaultClassPrefix, + nil, + map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideClassPrefix}, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) + continue + } + assert.Equal(t, overrideClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for.go new file mode 100644 index 000000000..fe34ada90 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for.go @@ -0,0 +1,131 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "go.uber.org/zap" + "google.golang.org/protobuf/types/descriptorpb" +) + +// OptimizeForID is the ID for the optimize_for modifier. +const OptimizeForID = "OPTIMIZE_FOR" + +// optimizeFor is the SourceCodeInfo path for the optimize_for option. +// https://github.com/protocolbuffers/protobuf/blob/61689226c0e3ec88287eaed66164614d9c4f2bf7/src/google/protobuf/descriptor.proto#L385 +var optimizeForPath = []int32{8, 9} + +func optimizeFor( + logger *zap.Logger, + sweeper Sweeper, + defaultOptimizeFor descriptorpb.FileOptions_OptimizeMode, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode, + overrides map[string]descriptorpb.FileOptions_OptimizeMode, +) Modifier { + // Convert the bufmoduleref.ModuleIdentity types into + // strings so that they're comparable. + exceptModuleIdentityStrings := make(map[string]struct{}, len(except)) + for _, moduleIdentity := range except { + exceptModuleIdentityStrings[moduleIdentity.IdentityString()] = struct{}{} + } + overrideModuleIdentityStrings := make( + map[string]descriptorpb.FileOptions_OptimizeMode, + len(moduleOverrides), + ) + for moduleIdentity, optimizeFor := range moduleOverrides { + overrideModuleIdentityStrings[moduleIdentity.IdentityString()] = optimizeFor + } + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenModuleIdentityStrings := make(map[string]struct{}, len(overrideModuleIdentityStrings)) + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + modifierValue := defaultOptimizeFor + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + moduleIdentityString := moduleIdentity.IdentityString() + if optimizeForOverrdie, ok := overrideModuleIdentityStrings[moduleIdentityString]; ok { + modifierValue = optimizeForOverrdie + seenModuleIdentityStrings[moduleIdentityString] = struct{}{} + } + } + if overrideValue, ok := overrides[imageFile.Path()]; ok { + modifierValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := optimizeForForFile( + ctx, + sweeper, + imageFile, + modifierValue, + exceptModuleIdentityStrings, + ); err != nil { + return err + } + } + for moduleIdentityString := range overrideModuleIdentityStrings { + if _, ok := seenModuleIdentityStrings[moduleIdentityString]; !ok { + logger.Sugar().Warnf("optimize_for override for %q was unused", moduleIdentityString) + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", OptimizeForID, overrideFile) + } + } + return nil + }, + ) +} + +func optimizeForForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + value descriptorpb.FileOptions_OptimizeMode, + exceptModuleIdentityStrings map[string]struct{}, +) error { + descriptor := imageFile.Proto() + options := descriptor.GetOptions() + switch { + case isWellKnownType(ctx, imageFile): + // The file is a well-known type, don't do anything. + return nil + case options != nil && options.GetOptimizeFor() == value: + // The option is already set to the same value, don't do anything. + return nil + case options == nil && descriptorpb.Default_FileOptions_OptimizeFor == value: + // The option is not set, but the value we want to set is the + // same as the default, don't do anything. + return nil + } + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + if _, ok := exceptModuleIdentityStrings[moduleIdentity.IdentityString()]; ok { + return nil + } + } + if options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.OptimizeFor = &value + if sweeper != nil { + sweeper.mark(imageFile.Path(), optimizeForPath) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for_test.go new file mode 100644 index 000000000..a218e83b9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for_test.go @@ -0,0 +1,665 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "google.golang.org/protobuf/types/descriptorpb" +) + +func TestOptimizeForEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, nil) + require.NoError(t, err) + modifier := NewMultiModifier( + optimizeForModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, nil) + require.NoError(t, err) + err = optimizeForModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, map[string]string{"a.proto": "SPEED"}) + require.NoError(t, err) + modifier := NewMultiModifier( + optimizeForModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + continue + } + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, map[string]string{"a.proto": "SPEED"}) + require.NoError(t, err) + err = optimizeForModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + continue + } + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + }) +} + +func TestOptimizeForAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, nil) + require.NoError(t, err) + modifier := NewMultiModifier( + optimizeForModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, nil) + require.NoError(t, err) + err = optimizeForModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, map[string]string{"a.proto": "SPEED"}) + require.NoError(t, err) + modifier := NewMultiModifier( + optimizeForModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + continue + } + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, map[string]string{"a.proto": "SPEED"}) + require.NoError(t, err) + err = optimizeForModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + continue + } + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + }) +} + +func TestOptimizeForCcOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "ccoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, nil) + require.NoError(t, err) + modifier := NewMultiModifier( + optimizeForModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, nil) + require.NoError(t, err) + err = optimizeForModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, map[string]string{"a.proto": "LITE_RUNTIME"}) + require.NoError(t, err) + modifier := NewMultiModifier( + optimizeForModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + continue + } + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + } + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, map[string]string{"a.proto": "LITE_RUNTIME"}) + require.NoError(t, err) + err = optimizeForModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) + continue + } + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) + }) +} + +func TestOptimizeForWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, nil) + require.NoError(t, err) + modifier := NewMultiModifier( + optimizeForModifier, + ModifierFunc(sweeper.Sweep), + ) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, nil) + require.NoError(t, err) + err = optimizeForModifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) + } + }) +} + +func TestOptimizeForWithExcept(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor( + zap.NewNop(), + sweeper, + descriptorpb.FileOptions_CODE_SIZE, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor( + zap.NewNop(), + sweeper, + descriptorpb.FileOptions_CODE_SIZE, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor( + zap.NewNop(), + sweeper, + descriptorpb.FileOptions_CODE_SIZE, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{ + "a.proto": "LITE_RUNTIME", + }, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor( + zap.NewNop(), + sweeper, + descriptorpb.FileOptions_CODE_SIZE, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{ + "a.proto": "SPEED", + }, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} + +func TestOptimizeForWithOverride(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + overrideOptimizeFor := descriptorpb.FileOptions_LITE_RUNTIME + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor( + zap.NewNop(), + sweeper, + descriptorpb.FileOptions_CODE_SIZE, + nil, + map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode{ + testModuleIdentity: overrideOptimizeFor, + }, + nil, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + overrideOptimizeFor, + descriptor.GetOptions().GetOptimizeFor(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor( + zap.NewNop(), + sweeper, + descriptorpb.FileOptions_CODE_SIZE, + nil, + map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode{ + testModuleIdentity: overrideOptimizeFor, + }, + nil, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + overrideOptimizeFor, + descriptor.GetOptions().GetOptimizeFor(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor( + zap.NewNop(), + sweeper, + descriptorpb.FileOptions_CODE_SIZE, + nil, + map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode{ + testModuleIdentity: overrideOptimizeFor, + }, + map[string]string{ + "a.proto": "CODE_SIZE", + }, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + descriptorpb.FileOptions_CODE_SIZE, + descriptor.GetOptions().GetOptimizeFor(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + + sweeper := NewFileOptionSweeper() + optimizeForModifier, err := OptimizeFor( + zap.NewNop(), + sweeper, + descriptorpb.FileOptions_CODE_SIZE, + nil, + map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode{ + testModuleIdentity: overrideOptimizeFor, + }, + map[string]string{ + "a.proto": "CODE_SIZE", + }, + ) + require.NoError(t, err) + + modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) + err = modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, + descriptorpb.FileOptions_CODE_SIZE, + descriptor.GetOptions().GetOptimizeFor(), + ) + } + assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace.go new file mode 100644 index 000000000..44ea19d33 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace.go @@ -0,0 +1,93 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// PhpMetadataNamespaceID is the ID of the php_metadata_namespace modifier. +const PhpMetadataNamespaceID = "PHP_METADATA_NAMESPACE" + +// phpMetadataNamespacePath is the SourceCodeInfo path for the php_metadata_namespace option. +// Ref: https://github.com/protocolbuffers/protobuf/blob/61689226c0e3ec88287eaed66164614d9c4f2bf7/src/google/protobuf/descriptor.proto#L448 +var phpMetadataNamespacePath = []int32{8, 44} + +func phpMetadataNamespace( + logger *zap.Logger, + sweeper Sweeper, + overrides map[string]string, +) Modifier { + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + phpMetadataNamespaceValue := phpMetadataNamespaceValue(imageFile) + if overrideValue, ok := overrides[imageFile.Path()]; ok { + phpMetadataNamespaceValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := phpMetadataNamespaceForFile(ctx, sweeper, imageFile, phpMetadataNamespaceValue); err != nil { + return err + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", PhpMetadataNamespaceID, overrideFile) + } + } + return nil + }, + ) +} + +func phpMetadataNamespaceForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + phpMetadataNamespaceValue string, +) error { + descriptor := imageFile.Proto() + if isWellKnownType(ctx, imageFile) || phpMetadataNamespaceValue == "" { + // This is a well-known type or we could not resolve a non-empty php_metadata_namespace + // value, so this is a no-op. + return nil + } + if descriptor.Options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.PhpMetadataNamespace = proto.String(phpMetadataNamespaceValue) + if sweeper != nil { + sweeper.mark(imageFile.Path(), phpMetadataNamespacePath) + } + return nil +} + +// phpMetadataNamespaceValue returns the php_metadata_namespace for the given ImageFile based on its +// package declaration. If the image file doesn't have a package declaration, an +// empty string is returned. +func phpMetadataNamespaceValue(imageFile bufimage.ImageFile) string { + phpNamespace := phpNamespaceValue(imageFile) + if phpNamespace == "" { + return "" + } + return phpNamespace + `\GPBMetadata` +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace_test.go new file mode 100644 index 000000000..c24a75d4e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace_test.go @@ -0,0 +1,359 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestPhpMetadataNamespaceEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, true) + + sweeper := NewFileOptionSweeper() + phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, true) + + sweeper := NewFileOptionSweeper() + phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) + + modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + require.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + require.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) + }) +} + +func TestPhpMetadataNamespaceAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) + + sweeper := NewFileOptionSweeper() + phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetPhpMetadataNamespace()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetPhpMetadataNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) + + sweeper := NewFileOptionSweeper() + phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetPhpMetadataNamespace()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetPhpMetadataNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + }) +} + +func TestPhpMetadataNamespaceOptions(t *testing.T) { + t.Parallel() + testPhpMetadataNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "single"), `Acme\V1\GPBMetadata`) + testPhpMetadataNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "double"), `Acme\Weather\V1\GPBMetadata`) + testPhpMetadataNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "triple"), `Acme\Weather\Data\V1\GPBMetadata`) + testPhpMetadataNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "reserved"), `Acme\Error_\V1\GPBMetadata`) +} + +func testPhpMetadataNamespaceOptions(t *testing.T, dirPath string, classPrefix string) { + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) + + sweeper := NewFileOptionSweeper() + phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpMetadataNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpMetadataNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) + + sweeper := NewFileOptionSweeper() + phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}) + + modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpMetadataNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpMetadataNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) + }) +} + +func TestPhpMetadataNamespaceWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + modifiedPhpMetadataNamespace := `Acme\Weather\V1alpha1\GPBMetadata` + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + // php_namespace is unset for the well-known types + assert.Empty(t, descriptor.GetOptions().GetPhpMetadataNamespace()) + continue + } + assert.Equal(t, + modifiedPhpMetadataNamespace, + descriptor.GetOptions().GetPhpMetadataNamespace(), + ) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + // php_namespace is unset for the well-known types + assert.Empty(t, descriptor.GetOptions().GetPhpMetadataNamespace()) + continue + } + assert.Equal(t, + modifiedPhpMetadataNamespace, + descriptor.GetOptions().GetPhpMetadataNamespace(), + ) + } + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace.go new file mode 100644 index 000000000..ee40f31da --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace.go @@ -0,0 +1,204 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// PhpNamespaceID is the ID of the php_namespace modifier. +const PhpNamespaceID = "PHP_NAMESPACE" + +var ( + // phpNamespacePath is the SourceCodeInfo path for the php_namespace option. + // Ref: https://github.com/protocolbuffers/protobuf/blob/61689226c0e3ec88287eaed66164614d9c4f2bf7/src/google/protobuf/descriptor.proto#L443 + phpNamespacePath = []int32{8, 41} + + // Keywords and classes that could be produced by our heuristic. + // They must not be used in a php_namespace. + // Ref: https://www.php.net/manual/en/reserved.php + phpReservedKeywords = map[string]struct{}{ + // Reserved classes as per above. + "directory": {}, + "exception": {}, + "errorexception": {}, + "closure": {}, + "generator": {}, + "arithmeticerror": {}, + "assertionerror": {}, + "divisionbyzeroerror": {}, + "error": {}, + "throwable": {}, + "parseerror": {}, + "typeerror": {}, + // Keywords avoided by protoc. + // Ref: https://github.com/protocolbuffers/protobuf/blob/66d749188ff2a2e30e932110222d58da7c6a8d49/src/google/protobuf/compiler/php/php_generator.cc#L50-L66 + "abstract": {}, + "and": {}, + "array": {}, + "as": {}, + "break": {}, + "callable": {}, + "case": {}, + "catch": {}, + "class": {}, + "clone": {}, + "const": {}, + "continue": {}, + "declare": {}, + "default": {}, + "die": {}, + "do": {}, + "echo": {}, + "else": {}, + "elseif": {}, + "empty": {}, + "enddeclare": {}, + "endfor": {}, + "endforeach": {}, + "endif": {}, + "endswitch": {}, + "endwhile": {}, + "eval": {}, + "exit": {}, + "extends": {}, + "final": {}, + "finally": {}, + "fn": {}, + "for": {}, + "foreach": {}, + "function": {}, + "global": {}, + "goto": {}, + "if": {}, + "implements": {}, + "include": {}, + "include_once": {}, + "instanceof": {}, + "insteadof": {}, + "interface": {}, + "isset": {}, + "list": {}, + "match": {}, + "namespace": {}, + "new": {}, + "or": {}, + "print": {}, + "private": {}, + "protected": {}, + "public": {}, + "require": {}, + "require_once": {}, + "return": {}, + "static": {}, + "switch": {}, + "throw": {}, + "trait": {}, + "try": {}, + "unset": {}, + "use": {}, + "var": {}, + "while": {}, + "xor": {}, + "yield": {}, + "int": {}, + "float": {}, + "bool": {}, + "string": {}, + "true": {}, + "false": {}, + "null": {}, + "void": {}, + "iterable": {}, + } +) + +func phpNamespace( + logger *zap.Logger, + sweeper Sweeper, + overrides map[string]string, +) Modifier { + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + phpNamespaceValue := phpNamespaceValue(imageFile) + if overrideValue, ok := overrides[imageFile.Path()]; ok { + phpNamespaceValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := phpNamespaceForFile(ctx, sweeper, imageFile, phpNamespaceValue); err != nil { + return err + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", PhpNamespaceID, overrideFile) + } + } + return nil + }, + ) +} + +func phpNamespaceForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + phpNamespaceValue string, +) error { + descriptor := imageFile.Proto() + if isWellKnownType(ctx, imageFile) || phpNamespaceValue == "" { + // This is a well-known type or we could not resolve a non-empty php_namespace + // value, so this is a no-op. + return nil + } + if descriptor.Options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.PhpNamespace = proto.String(phpNamespaceValue) + if sweeper != nil { + sweeper.mark(imageFile.Path(), phpNamespacePath) + } + return nil +} + +// phpNamespaceValue returns the php_namespace for the given ImageFile based on its +// package declaration. If the image file doesn't have a package declaration, an +// empty string is returned. +func phpNamespaceValue(imageFile bufimage.ImageFile) string { + pkg := imageFile.Proto().GetPackage() + if pkg == "" { + return "" + } + packageParts := strings.Split(pkg, ".") + for i, part := range packageParts { + packagePart := stringutil.ToPascalCase(part) + if _, ok := phpReservedKeywords[strings.ToLower(part)]; ok { + // Append _ to the package part if it is a reserved keyword. + packagePart += "_" + } + packageParts[i] = packagePart + } + return strings.Join(packageParts, `\`) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace_test.go new file mode 100644 index 000000000..27c7a6389 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace_test.go @@ -0,0 +1,360 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestPhpNamespaceEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) + + sweeper := NewFileOptionSweeper() + phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpNamespace(zap.NewNop(), sweeper, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) + + sweeper := NewFileOptionSweeper() + phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) + + modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) + }) +} + +func TestPhpNamespaceAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) + + sweeper := NewFileOptionSweeper() + phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetPhpNamespace()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpNamespace(zap.NewNop(), sweeper, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetPhpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) + + sweeper := NewFileOptionSweeper() + phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) + + modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetPhpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetPhpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + }) +} + +func TestPhpNamespaceOptions(t *testing.T) { + t.Parallel() + testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "single"), `Acme\V1`) + testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "double"), `Acme\Weather\V1`) + testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "triple"), `Acme\Weather\Data\V1`) + testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "reserved"), `Acme\Error_\V1`) + testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "underscore"), `Acme\Weather\FooBar\V1`) +} + +func testPhpNamespaceOptions(t *testing.T, dirPath string, classPrefix string) { + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) + + sweeper := NewFileOptionSweeper() + phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpNamespace(zap.NewNop(), sweeper, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) + + sweeper := NewFileOptionSweeper() + phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}) + + modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpNamespace()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) + }) +} + +func TestPhpNamespaceWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + modifiedPhpNamespace := `Acme\Weather\V1alpha1` + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, nil) + + modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + // php_namespace is unset for the well-known types + assert.Empty(t, descriptor.GetOptions().GetPhpNamespace()) + continue + } + assert.Equal(t, + modifiedPhpNamespace, + descriptor.GetOptions().GetPhpNamespace(), + ) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + modifier := PhpNamespace(zap.NewNop(), sweeper, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + // php_namespace is unset for the well-known types + assert.Empty(t, descriptor.GetOptions().GetPhpNamespace()) + continue + } + assert.Equal(t, + modifiedPhpNamespace, + descriptor.GetOptions().GetPhpNamespace(), + ) + } + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package.go new file mode 100644 index 000000000..5ec20c275 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package.go @@ -0,0 +1,137 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" +) + +// RubyPackageID is the ID of the ruby_package modifier. +const RubyPackageID = "RUBY_PACKAGE" + +// rubyPackagePath is the SourceCodeInfo path for the ruby_package option. +// https://github.com/protocolbuffers/protobuf/blob/61689226c0e3ec88287eaed66164614d9c4f2bf7/src/google/protobuf/descriptor.proto#L453 +var rubyPackagePath = []int32{8, 45} + +func rubyPackage( + logger *zap.Logger, + sweeper Sweeper, + except []bufmoduleref.ModuleIdentity, + moduleOverrides map[bufmoduleref.ModuleIdentity]string, + overrides map[string]string, +) Modifier { + // Convert the bufmoduleref.ModuleIdentity types into + // strings so that they're comparable. + exceptModuleIdentityStrings := make(map[string]struct{}, len(except)) + for _, moduleIdentity := range except { + exceptModuleIdentityStrings[moduleIdentity.IdentityString()] = struct{}{} + } + overrideModuleIdentityStrings := make(map[string]string, len(moduleOverrides)) + for moduleIdentity, rubyPackage := range moduleOverrides { + overrideModuleIdentityStrings[moduleIdentity.IdentityString()] = rubyPackage + } + return ModifierFunc( + func(ctx context.Context, image bufimage.Image) error { + seenModuleIdentityStrings := make(map[string]struct{}, len(overrideModuleIdentityStrings)) + seenOverrideFiles := make(map[string]struct{}, len(overrides)) + for _, imageFile := range image.Files() { + rubyPackageValue := rubyPackageValue(imageFile) + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + moduleIdentityString := moduleIdentity.IdentityString() + if moduleNamespaceOverride, ok := overrideModuleIdentityStrings[moduleIdentityString]; ok { + seenModuleIdentityStrings[moduleIdentityString] = struct{}{} + rubyPackageValue = moduleNamespaceOverride + } + } + if overrideValue, ok := overrides[imageFile.Path()]; ok { + rubyPackageValue = overrideValue + seenOverrideFiles[imageFile.Path()] = struct{}{} + } + if err := rubyPackageForFile( + ctx, + sweeper, + imageFile, + rubyPackageValue, + exceptModuleIdentityStrings, + ); err != nil { + return err + } + } + for moduleIdentityString := range overrideModuleIdentityStrings { + if _, ok := seenModuleIdentityStrings[moduleIdentityString]; !ok { + logger.Sugar().Warnf("ruby_package override for %q was unused", moduleIdentityString) + } + } + for overrideFile := range overrides { + if _, ok := seenOverrideFiles[overrideFile]; !ok { + logger.Sugar().Warnf("%s override for %q was unused", RubyPackageID, overrideFile) + } + } + return nil + }, + ) +} + +func rubyPackageForFile( + ctx context.Context, + sweeper Sweeper, + imageFile bufimage.ImageFile, + rubyPackageValue string, + exceptModuleIdentityStrings map[string]struct{}, +) error { + descriptor := imageFile.Proto() + if isWellKnownType(ctx, imageFile) || rubyPackageValue == "" { + // This is a well-known type or we could not resolve a non-empty ruby_package + // value, so this is a no-op. + return nil + } + if moduleIdentity := imageFile.ModuleIdentity(); moduleIdentity != nil { + if _, ok := exceptModuleIdentityStrings[moduleIdentity.IdentityString()]; ok { + return nil + } + } + if descriptor.Options == nil { + descriptor.Options = &descriptorpb.FileOptions{} + } + descriptor.Options.RubyPackage = proto.String(rubyPackageValue) + if sweeper != nil { + sweeper.mark(imageFile.Path(), rubyPackagePath) + } + return nil +} + +// rubyPackageValue returns the ruby_package for the given ImageFile based on its +// package declaration. If the image file doesn't have a package declaration, an +// empty string is returned. +func rubyPackageValue(imageFile bufimage.ImageFile) string { + pkg := imageFile.Proto().GetPackage() + if pkg == "" { + return "" + } + packageParts := strings.Split(pkg, ".") + for i, part := range packageParts { + packageParts[i] = stringutil.ToPascalCase(part) + } + return strings.Join(packageParts, "::") +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package_test.go new file mode 100644 index 000000000..dbc51a6a1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package_test.go @@ -0,0 +1,588 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagemodify + +import ( + "context" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestRubyPackageEmptyOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "emptyoptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) + + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "override"}) + + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + require.Equal(t, 1, len(image.Files())) + descriptor := image.Files()[0].Proto() + assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) + }) +} + +func TestRubyPackageAllOptions(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "alloptions") + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) + + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, "foo", descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "override"}) + + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) + }) + + t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "a.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) + continue + } + assert.Equal(t, "foo", descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + }) +} + +func TestRubyPackageOptions(t *testing.T) { + t.Parallel() + testRubyPackageOptions(t, filepath.Join("testdata", "rubyoptions", "single"), `Acme::V1`) + testRubyPackageOptions(t, filepath.Join("testdata", "rubyoptions", "double"), `Acme::Weather::V1`) + testRubyPackageOptions(t, filepath.Join("testdata", "rubyoptions", "triple"), `Acme::Weather::Data::V1`) + testRubyPackageOptions(t, filepath.Join("testdata", "rubyoptions", "underscore"), `Acme::Weather::FooBar::V1`) +} + +func testRubyPackageOptions(t *testing.T, dirPath string, classPrefix string) { + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) + + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, classPrefix, descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + }) + + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"override.proto": "override"}) + + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"override.proto": "override"}) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) + continue + } + assert.Equal(t, classPrefix, descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + }) +} + +func TestRubyPackageWellKnownTypes(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "wktimport") + modifiedRubyPackage := `Acme::Weather::V1alpha1` + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) + + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + // php_namespace is unset for the well-known types + assert.Empty(t, descriptor.GetOptions().GetRubyPackage()) + continue + } + assert.Equal(t, + modifiedRubyPackage, + descriptor.GetOptions().GetRubyPackage(), + ) + } + }) + + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + + sweeper := NewFileOptionSweeper() + modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if isWellKnownType(context.Background(), imageFile) { + // php_namespace is unset for the well-known types + assert.Empty(t, descriptor.GetOptions().GetRubyPackage()) + continue + } + assert.Equal(t, + modifiedRubyPackage, + descriptor.GetOptions().GetRubyPackage(), + ) + } + }) +} + +func TestRubyPackageExcept(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "rubyoptions", "single") + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage( + zap.NewNop(), + sweeper, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, true), image) + // Still not empty, because the module is in except + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + }) + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage( + zap.NewNop(), + sweeper, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + nil, + ) + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + }) + t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage( + zap.NewNop(), + sweeper, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + // not modified even though a file has override, because the module is in except + assert.Equal(t, testGetImage(t, dirPath, true), image) + // Still not empty, because the module is in except + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + }) + t.Run("without SourceCodeInfo and per-file overrides", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage( + zap.NewNop(), + sweeper, + []bufmoduleref.ModuleIdentity{testModuleIdentity}, + nil, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.Equal(t, testGetImage(t, dirPath, false), image) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + }) +} + +func TestRubyPackageOverride(t *testing.T) { + t.Parallel() + dirPath := filepath.Join("testdata", "rubyoptions", "single") + overrideRubyPackage := "MODULE" + testModuleIdentity, err := bufmoduleref.NewModuleIdentity( + testRemote, + testRepositoryOwner, + testRepositoryName, + ) + require.NoError(t, err) + t.Run("with SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage( + zap.NewNop(), + sweeper, + nil, + map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideRubyPackage}, + nil, + ) + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, overrideRubyPackage, descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) + }) + t.Run("without SourceCodeInfo", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage( + zap.NewNop(), + sweeper, + nil, + map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideRubyPackage}, + nil, + ) + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + assert.Equal(t, overrideRubyPackage, descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + }) + t.Run("with SourceCodeInfo with per-file override", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, true) + assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage( + zap.NewNop(), + sweeper, + nil, + map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideRubyPackage}, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, true), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) + continue + } + assert.Equal(t, overrideRubyPackage, descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) + }) + t.Run("without SourceCodeInfo and per-file override", func(t *testing.T) { + t.Parallel() + image := testGetImage(t, dirPath, false) + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + + sweeper := NewFileOptionSweeper() + rubyPackageModifier := RubyPackage( + zap.NewNop(), + sweeper, + nil, + map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideRubyPackage}, + map[string]string{"override.proto": "override"}, + ) + modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) + err := modifier.Modify( + context.Background(), + image, + ) + require.NoError(t, err) + assert.NotEqual(t, testGetImage(t, dirPath, false), image) + + for _, imageFile := range image.Files() { + descriptor := imageFile.Proto() + if imageFile.Path() == "override.proto" { + assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) + continue + } + assert.Equal(t, overrideRubyPackage, descriptor.GetOptions().GetRubyPackage()) + } + assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/alloptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/alloptions/a.proto new file mode 100644 index 000000000..ee529a1a1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/alloptions/a.proto @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +option csharp_namespace = "foo"; +option go_package = "foo"; +option java_package = "foo"; +option java_outer_classname = "foo"; +option objc_class_prefix = "foo"; +option php_class_prefix = "foo"; +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; +option ruby_package = "foo"; +option swift_prefix = "foo"; + +option optimize_for = SPEED; +option cc_enable_arenas = false; +option cc_generic_services = false; +option java_generic_services = false; +option java_multiple_files = false; +option java_string_check_utf8 = false; +option php_generic_services = false; +option py_generic_services = false; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/a.proto new file mode 100644 index 000000000..ce742f655 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/a.proto @@ -0,0 +1,17 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +option cc_enable_arenas = false; +option optimize_for = LITE_RUNTIME; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/b.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/b.proto new file mode 100644 index 000000000..f10536080 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +option cc_enable_arenas = false; +option optimize_for = LITE_RUNTIME; + diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/double/csharp.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/double/csharp.proto new file mode 100644 index 000000000..95ccc3ca0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/double/csharp.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.v1; + +option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/csharp.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/csharp.proto new file mode 100644 index 000000000..9f24e197b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/csharp.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.v1; + +option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/override.proto new file mode 100644 index 000000000..97c467161 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/override.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.v1; + +option csharp_namespace = "foo"; + diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/triple/csharp.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/triple/csharp.proto new file mode 100644 index 000000000..a33f0c6af --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/triple/csharp.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.data.v1; + +option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/underscore/csharp.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/underscore/csharp.proto new file mode 100644 index 000000000..04af2dcdb --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/underscore/csharp.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.foo_bar.v1; + +option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/emptyoptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/emptyoptions/a.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/emptyoptions/a.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaemptyoptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaemptyoptions/a.proto new file mode 100644 index 000000000..5e08634a0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaemptyoptions/a.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package foo; \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/java_file.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/java_file.proto new file mode 100644 index 000000000..7ff66d17b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/java_file.proto @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather; + +option java_multiple_files = true; +option java_string_check_utf8 = false; +option java_package = "foo"; +option java_outer_classname = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/override.proto new file mode 100644 index 000000000..7ff66d17b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/override.proto @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather; + +option java_multiple_files = true; +option java_string_check_utf8 = false; +option java_package = "foo"; +option java_outer_classname = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/jsoptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/jsoptions/a.proto new file mode 100644 index 000000000..164a62215 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/jsoptions/a.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +option optimize_for = CODE_SIZE; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/double/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/double/objc.proto new file mode 100644 index 000000000..b36da56d8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/double/objc.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.v1; + +option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/gpb/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/gpb/objc.proto new file mode 100644 index 000000000..d652eb8db --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/gpb/objc.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package google.protobuf.bla.v1; + +option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/objc.proto new file mode 100644 index 000000000..a06d424b5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/objc.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.v1; + +option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/override.proto new file mode 100644 index 000000000..a06d424b5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/override.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.v1; + +option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/triple/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/triple/objc.proto new file mode 100644 index 000000000..68d1ca9ed --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/triple/objc.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.data.v1; + +option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/unversioned/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/unversioned/objc.proto new file mode 100644 index 000000000..210a09d4a --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/unversioned/objc.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.data; + +option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/a.proto new file mode 100644 index 000000000..40591e773 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/a.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package weather.v1alpha1; + +option go_package = "weather"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/b.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/b.proto new file mode 100644 index 000000000..40591e773 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/b.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package weather.v1alpha1; + +option go_package = "weather"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/double/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/double/php.proto new file mode 100644 index 000000000..e1b0bbca4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/double/php.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/reserved/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/reserved/php.proto new file mode 100644 index 000000000..97fd823c7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/reserved/php.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.error.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/override.proto new file mode 100644 index 000000000..7e72bd6da --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/override.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/php.proto new file mode 100644 index 000000000..7e72bd6da --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/php.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/triple/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/triple/php.proto new file mode 100644 index 000000000..4aad53502 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/triple/php.proto @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.data.v1; + +option php_namespace = "foo"; +option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/underscore/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/underscore/php.proto new file mode 100644 index 000000000..b66f5a59e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/underscore/php.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.foo_bar.v1; + +option php_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/double/ruby.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/double/ruby.proto new file mode 100644 index 000000000..841d0d81b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/double/ruby.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.v1; + +option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/override.proto new file mode 100644 index 000000000..f4882660f --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/override.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.v1; + +option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/ruby.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/ruby.proto new file mode 100644 index 000000000..f4882660f --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/ruby.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.v1; + +option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/triple/ruby.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/triple/ruby.proto new file mode 100644 index 000000000..fa49eb673 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/triple/ruby.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.data.v1; + +option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/underscore/ruby.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/underscore/ruby.proto new file mode 100644 index 000000000..49d522919 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/underscore/ruby.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme.weather.foo_bar.v1; + +option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/wktimport/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/wktimport/a.proto new file mode 100644 index 000000000..672a4edd2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/wktimport/a.proto @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package acme.weather.v1alpha1; + +import "google/protobuf/timestamp.proto"; + +message Container { + google.protobuf.Timestamp timestamp = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting.go b/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting.go new file mode 100644 index 000000000..b100420e0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting.go @@ -0,0 +1,118 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagetesting + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" +) + +// NewImageFile returns a new ImageFile for testing. +// +// TODO: moduleIdentity and commit should be options. +func NewImageFile( + t testing.TB, + fileDescriptor protodescriptor.FileDescriptor, + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, + externalPath string, + isImport bool, + isSyntaxUnspecified bool, + unusedDependencyIndexes []int32, +) bufimage.ImageFile { + imageFile, err := bufimage.NewImageFile( + fileDescriptor, + moduleIdentity, + commit, + externalPath, + isImport, + isSyntaxUnspecified, + unusedDependencyIndexes, + ) + require.NoError(t, err) + return imageFile +} + +// NewProtoImageFile returns a new *imagev1.ImageFile for testing. +// +// This is also a protodescriptor.FileDescriptor. +func NewProtoImageFile( + t testing.TB, + path string, + importPaths ...string, +) *imagev1.ImageFile { + return &imagev1.ImageFile{ + Name: proto.String(path), + Dependency: importPaths, + BufExtension: &imagev1.ImageFileExtension{ + IsImport: proto.Bool(false), + IsSyntaxUnspecified: proto.Bool(false), + }, + } +} + +// NewProtoImageFileIsImport returns a new *imagev1.ImageFile for testing that is an import. +// +// This is also a protodescriptor.FileDescriptor. +func NewProtoImageFileIsImport( + t testing.TB, + path string, + importPaths ...string, +) *imagev1.ImageFile { + return &imagev1.ImageFile{ + Name: proto.String(path), + Dependency: importPaths, + BufExtension: &imagev1.ImageFileExtension{ + IsImport: proto.Bool(true), + IsSyntaxUnspecified: proto.Bool(false), + }, + } +} + +// AssertImageFilesEqual asserts the expected ImageFiles equal the actual ImageFiles. +func AssertImageFilesEqual(t testing.TB, expected []bufimage.ImageFile, actual []bufimage.ImageFile) { + expectedNormalizedImageFiles := normalizeImageFiles(t, expected) + actualNormalizedImageFiles := normalizeImageFiles(t, actual) + assert.Equal(t, expectedNormalizedImageFiles, actualNormalizedImageFiles) +} + +func normalizeImageFiles(t testing.TB, imageFiles []bufimage.ImageFile) []bufimage.ImageFile { + normalizedImageFiles := make([]bufimage.ImageFile, len(imageFiles)) + for i, imageFile := range imageFiles { + normalizedImageFiles[i] = NewImageFile( + t, + NewProtoImageFile( + t, + imageFile.FileDescriptor().GetName(), + imageFile.FileDescriptor().GetDependency()..., + ), + imageFile.ModuleIdentity(), + imageFile.Commit(), + imageFile.ExternalPath(), + imageFile.IsImport(), + imageFile.IsSyntaxUnspecified(), + imageFile.UnusedDependencyIndexes(), + ) + } + return normalizedImageFiles +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go b/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go new file mode 100644 index 000000000..e632818ba --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go @@ -0,0 +1,709 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimagetesting + +import ( + "fmt" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +func BenchmarkNewImageWithOnlyPathsAllowNotExistFileOnly(b *testing.B) { + var imageFiles []bufimage.ImageFile + for i := 0; i < 3000; i++ { + imageFiles = append( + imageFiles, + NewImageFile( + b, + NewProtoImageFile( + b, + fmt.Sprintf("a%d.proto/a%d.proto", i, i), + ), + nil, + "", + fmt.Sprintf("foo/two/a%d.proto/a%d.proto", i, i), + false, + false, + nil, + ), + ) + } + image, err := bufimage.NewImage(imageFiles) + require.NoError(b, err) + b.ResetTimer() + for n := 0; n < b.N; n++ { + newImage, err := bufimage.ImageWithOnlyPathsAllowNotExist(image, []string{"a1.proto/a1.proto"}, nil) + // this does increase the time but we're just looking for order of magnitude + // between this and the below benchmark function + require.NoError(b, err) + require.Equal(b, 1, len(newImage.Files())) + } +} + +func BenchmarkNewImageWithOnlyPathsAllowNotExistDirOnly(b *testing.B) { + var imageFiles []bufimage.ImageFile + for i := 0; i < 3000; i++ { + imageFiles = append( + imageFiles, + NewImageFile( + b, + NewProtoImageFile( + b, + fmt.Sprintf("a%d.proto/a%d.proto", i, i), + ), + nil, + "", + fmt.Sprintf("foo/two/a%d.proto/a%d.proto", i, i), + false, + false, + nil, + ), + ) + } + image, err := bufimage.NewImage(imageFiles) + require.NoError(b, err) + b.ResetTimer() + for n := 0; n < b.N; n++ { + newImage, err := bufimage.ImageWithOnlyPathsAllowNotExist(image, []string{"a1.proto"}, nil) + require.NoError(b, err) + require.Equal(b, 1, len(newImage.Files())) + } +} + +func TestBasic(t *testing.T) { + t.Parallel() + + protoImageFileImport := NewProtoImageFileIsImport( + t, + "import.proto", + ) + protoImageFileWellKnownTypeImport := NewProtoImageFileIsImport( + t, + "google/protobuf/timestamp.proto", + ) + protoImageFileAA := NewProtoImageFile( + t, + "a/a.proto", + ) + protoImageFileAB := NewProtoImageFile( + t, + "a/b.proto", + "import.proto", + "google/protobuf/timestamp.proto", + ) + protoImageFileBA := NewProtoImageFile( + t, + "b/a.proto", + "a/a.proto", + "a/b.proto", + ) + protoImageFileBB := NewProtoImageFile( + t, + "b/b.proto", + "a/a.proto", + "a/b.proto", + "b/a.proto", + ) + protoImageFileOutlandishDirectoryName := NewProtoImageFile( + t, + "d/d.proto/d.proto", + "import.proto", + ) + + fileImport := NewImageFile( + t, + protoImageFileImport, + nil, + "", + "some/import/import.proto", + true, + false, + nil, + ) + fileWellKnownTypeImport := NewImageFile( + t, + protoImageFileWellKnownTypeImport, + nil, + "", + "google/protobuf/timestamp.proto", + true, + false, + nil, + ) + fileOneAA := NewImageFile( + t, + protoImageFileAA, + nil, + "", + "foo/one/a/a.proto", + false, + false, + nil, + ) + fileOneAB := NewImageFile( + t, + protoImageFileAB, + nil, + "", + "foo/one/a/b.proto", + false, + false, + nil, + ) + fileTwoBA := NewImageFile( + t, + protoImageFileBA, + nil, + "", + "foo/two/b/a.proto", + false, + false, + nil, + ) + fileTwoBB := NewImageFile( + t, + protoImageFileBB, + nil, + "", + "foo/two/b/b.proto", + false, + false, + nil, + ) + fileOutlandishDirectoryName := NewImageFile( + t, + protoImageFileOutlandishDirectoryName, + nil, + "", + "foo/three/d/d.proto/d.proto", + false, + false, + nil, + ) + + image, err := bufimage.NewImage( + []bufimage.ImageFile{ + fileOneAA, + fileImport, + fileWellKnownTypeImport, + fileOneAB, + fileTwoBA, + fileTwoBB, + fileOutlandishDirectoryName, + }, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + NewImageFile(t, protoImageFileBB, nil, "", "foo/two/b/b.proto", false, false, nil), + NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), + }, + image.Files(), + ) + require.NotNil(t, image.GetFile("a/a.proto")) + require.Nil(t, image.GetFile("one/a/a.proto")) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + NewImageFile(t, protoImageFileBB, nil, "", "foo/two/b/b.proto", false, false, nil), + NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), + }, + bufimage.ImageWithoutImports(image).Files(), + ) + + newImage, err := bufimage.ImageWithOnlyPaths( + image, + []string{ + "b/a.proto", + "a/b.proto", + }, + nil, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", true, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + }, + newImage.Files(), + ) + + _, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "b/a.proto", + "a/b.proto", + "foo.proto", + }, + nil, + ) + require.Error(t, err) + + newImage, err = bufimage.ImageWithOnlyPathsAllowNotExist( + image, + []string{ + "b/a.proto", + "a/b.proto", + "foo.proto", + }, + nil, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", true, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + }, + newImage.Files(), + ) + newImage, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "a", + }, + nil, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + }, + newImage.Files(), + ) + newImage, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "b", + }, + nil, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", true, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", true, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + NewImageFile(t, protoImageFileBB, nil, "", "foo/two/b/b.proto", false, false, nil), + }, + newImage.Files(), + ) + newImage, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "a", + "b/a.proto", + }, + nil, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + }, + newImage.Files(), + ) + _, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "a", + "b/a.proto", + "c", + }, + nil, + ) + require.Error(t, err) + newImage, err = bufimage.ImageWithOnlyPathsAllowNotExist( + image, + []string{ + "a", + "b/a.proto", + "c", + }, + nil, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + }, + newImage.Files(), + ) + newImage, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "a", + "b/a.proto", + "d/d.proto/d.proto", + }, + nil, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), + }, + newImage.Files(), + ) + newImage, err = bufimage.ImageWithOnlyPaths( + image, + []string{ + "a", + "b/a.proto", + "d/d.proto", + }, + nil, + ) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), + }, + newImage.Files(), + ) + + protoImage := &imagev1.Image{ + File: []*imagev1.ImageFile{ + protoImageFileAA, + protoImageFileImport, + protoImageFileWellKnownTypeImport, + protoImageFileAB, + protoImageFileBA, + protoImageFileBB, + protoImageFileOutlandishDirectoryName, + }, + } + newImage, err = bufimage.NewImageForProto(protoImage) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "b/a.proto", false, false, nil), + NewImageFile(t, protoImageFileBB, nil, "", "b/b.proto", false, false, nil), + NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "d/d.proto/d.proto", false, false, nil), + }, + newImage.Files(), + ) + diff := cmp.Diff(protoImage, bufimage.ImageToProtoImage(newImage), protocmp.Transform()) + require.Equal(t, "", diff) + fileDescriptorSet := &descriptorpb.FileDescriptorSet{ + File: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileAA), + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), + testProtoImageFileToFileDescriptorProto(protoImageFileAB), + testProtoImageFileToFileDescriptorProto(protoImageFileBA), + testProtoImageFileToFileDescriptorProto(protoImageFileBB), + testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), + }, + } + diff = cmp.Diff(fileDescriptorSet, bufimage.ImageToFileDescriptorSet(image), protocmp.Transform()) + require.Equal(t, "", diff) + codeGeneratorRequest := &pluginpb.CodeGeneratorRequest{ + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileAA), + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), + testProtoImageFileToFileDescriptorProto(protoImageFileAB), + testProtoImageFileToFileDescriptorProto(protoImageFileBA), + testProtoImageFileToFileDescriptorProto(protoImageFileBB), + testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "a/a.proto", + "a/b.proto", + "b/a.proto", + "b/b.proto", + "d/d.proto/d.proto", + }, + } + diff = cmp.Diff( + codeGeneratorRequest, + bufimage.ImageToCodeGeneratorRequest(image, "foo", nil, false, false), + protocmp.Transform(), + ) + require.Equal(t, "", diff) + + // verify that includeWellKnownTypes is a no-op if includeImports is false + diff = cmp.Diff( + codeGeneratorRequest, + bufimage.ImageToCodeGeneratorRequest(image, "foo", nil, false, true), + protocmp.Transform(), + ) + require.Equal(t, "", diff) + + codeGeneratorRequestIncludeImports := &pluginpb.CodeGeneratorRequest{ + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileAA), + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), + testProtoImageFileToFileDescriptorProto(protoImageFileAB), + testProtoImageFileToFileDescriptorProto(protoImageFileBA), + testProtoImageFileToFileDescriptorProto(protoImageFileBB), + testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "a/a.proto", + "import.proto", + // no WKT + "a/b.proto", + "b/a.proto", + "b/b.proto", + "d/d.proto/d.proto", + }, + } + diff = cmp.Diff( + codeGeneratorRequestIncludeImports, + bufimage.ImageToCodeGeneratorRequest(image, "foo", nil, true, false), + protocmp.Transform(), + ) + require.Equal(t, "", diff) + newImage, err = bufimage.NewImageForCodeGeneratorRequest(codeGeneratorRequest) + require.NoError(t, err) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "a/b.proto", false, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "b/a.proto", false, false, nil), + NewImageFile(t, protoImageFileBB, nil, "", "b/b.proto", false, false, nil), + NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "d/d.proto/d.proto", false, false, nil), + }, + newImage.Files(), + ) + codeGeneratorRequestIncludeImportsAndWellKnownTypes := &pluginpb.CodeGeneratorRequest{ + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileAA), + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), + testProtoImageFileToFileDescriptorProto(protoImageFileAB), + testProtoImageFileToFileDescriptorProto(protoImageFileBA), + testProtoImageFileToFileDescriptorProto(protoImageFileBB), + testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "a/a.proto", + "import.proto", + "google/protobuf/timestamp.proto", + "a/b.proto", + "b/a.proto", + "b/b.proto", + "d/d.proto/d.proto", + }, + } + diff = cmp.Diff( + codeGeneratorRequestIncludeImportsAndWellKnownTypes, + bufimage.ImageToCodeGeneratorRequest(image, "foo", nil, true, true), + protocmp.Transform(), + ) + require.Equal(t, "", diff) + // imagesByDir and multiple Image tests + imagesByDir, err := bufimage.ImageByDir(image) + require.NoError(t, err) + require.Equal(t, 3, len(imagesByDir)) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), + }, + imagesByDir[0].Files(), + ) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", true, false, nil), + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), + NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", true, false, nil), + NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), + NewImageFile(t, protoImageFileBB, nil, "", "foo/two/b/b.proto", false, false, nil), + }, + imagesByDir[1].Files(), + ) + AssertImageFilesEqual( + t, + []bufimage.ImageFile{ + NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), + NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), + }, + imagesByDir[2].Files(), + ) + codeGeneratorRequests := []*pluginpb.CodeGeneratorRequest{ + { + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileAA), + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), + testProtoImageFileToFileDescriptorProto(protoImageFileAB), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "a/a.proto", + "a/b.proto", + }, + }, + { + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileAA), + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), + testProtoImageFileToFileDescriptorProto(protoImageFileAB), + testProtoImageFileToFileDescriptorProto(protoImageFileBA), + testProtoImageFileToFileDescriptorProto(protoImageFileBB), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "b/a.proto", + "b/b.proto", + }, + }, + { + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "d/d.proto/d.proto", + }, + }, + } + requestsFromImages := bufimage.ImagesToCodeGeneratorRequests(imagesByDir, "foo", nil, false, false) + require.Equal(t, len(codeGeneratorRequests), len(requestsFromImages)) + for i := range codeGeneratorRequests { + diff = cmp.Diff(codeGeneratorRequests[i], requestsFromImages[i], protocmp.Transform()) + require.Equal(t, "", diff) + } + codeGeneratorRequestsIncludeImports := []*pluginpb.CodeGeneratorRequest{ + { + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileAA), + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), + testProtoImageFileToFileDescriptorProto(protoImageFileAB), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "a/a.proto", + "import.proto", + "a/b.proto", + }, + }, + { + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileAA), + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), + testProtoImageFileToFileDescriptorProto(protoImageFileAB), + testProtoImageFileToFileDescriptorProto(protoImageFileBA), + testProtoImageFileToFileDescriptorProto(protoImageFileBB), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "b/a.proto", + "b/b.proto", + }, + }, + { + ProtoFile: []*descriptorpb.FileDescriptorProto{ + testProtoImageFileToFileDescriptorProto(protoImageFileImport), + testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), + }, + Parameter: proto.String("foo"), + FileToGenerate: []string{ + "d/d.proto/d.proto", + }, + }, + } + requestsFromImages = bufimage.ImagesToCodeGeneratorRequests(imagesByDir, "foo", nil, true, false) + require.Equal(t, len(codeGeneratorRequestsIncludeImports), len(requestsFromImages)) + for i := range codeGeneratorRequestsIncludeImports { + diff = cmp.Diff(codeGeneratorRequestsIncludeImports[i], requestsFromImages[i], protocmp.Transform()) + require.Equal(t, "", diff) + } +} + +func testProtoImageFileToFileDescriptorProto(imageFile *imagev1.ImageFile) *descriptorpb.FileDescriptorProto { + return &descriptorpb.FileDescriptorProto{ + Name: imageFile.Name, + Dependency: imageFile.Dependency, + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil.go new file mode 100644 index 000000000..032077659 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil.go @@ -0,0 +1,920 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimageutil + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + anyFullName = "google.protobuf.Any" +) + +var ( + // ErrImageFilterTypeNotFound is returned from ImageFilteredByTypes when + // a specified type cannot be found in an image. + ErrImageFilterTypeNotFound = errors.New("not found") + + // ErrImageFilterTypeIsImport is returned from ImageFilteredByTypes when + // a specified type name is declared in a module dependency. + ErrImageFilterTypeIsImport = errors.New("type declared in imported module") +) + +// NewInputFiles converts the ImageFiles to InputFiles. +// +// Since protosource is a pkg package, it cannot depend on bufmoduleref, which has the +// definition for bufmoduleref.ModuleIdentity, so we have our own interfaces for this +// in protosource. Given Go's type system, we need to do a conversion here. +func NewInputFiles(imageFiles []bufimage.ImageFile) []protosource.InputFile { + inputFiles := make([]protosource.InputFile, len(imageFiles)) + for i, imageFile := range imageFiles { + inputFiles[i] = newInputFile(imageFile) + } + return inputFiles +} + +// FreeMessageRangeStrings gets the free MessageRange strings for the target files. +// +// Recursive. +func FreeMessageRangeStrings( + ctx context.Context, + filePaths []string, + image bufimage.Image, +) ([]string, error) { + var s []string + for _, filePath := range filePaths { + imageFile := image.GetFile(filePath) + if imageFile == nil { + return nil, fmt.Errorf("unexpected nil image file: %q", filePath) + } + file, err := protosource.NewFile(newInputFile(imageFile)) + if err != nil { + return nil, err + } + for _, message := range file.Messages() { + s = freeMessageRangeStringsRec(s, message) + } + } + return s, nil +} + +// ImageFilterOption is an option that can be passed to ImageFilteredByTypesWithOptions. +type ImageFilterOption func(*imageFilterOptions) + +// WithExcludeCustomOptions returns an option that will cause an image filtered via +// ImageFilteredByTypesWithOptions to *not* include custom options unless they are +// explicitly named in the list of filter types. +func WithExcludeCustomOptions() ImageFilterOption { + return func(opts *imageFilterOptions) { + opts.includeCustomOptions = false + } +} + +// WithExcludeKnownExtensions returns an option that will cause an image filtered via +// ImageFilteredByTypesWithOptions to *not* include the known extensions for included +// extendable messages unless they are explicitly named in the list of filter types. +func WithExcludeKnownExtensions() ImageFilterOption { + return func(opts *imageFilterOptions) { + opts.includeKnownExtensions = false + } +} + +// WithAllowFilterByImportedType returns an option for ImageFilteredByTypesWithOptions +// that allows a named filter type to be in an imported file or module. Without this +// option, only types defined directly in the image to be filtered are allowed. +func WithAllowFilterByImportedType() ImageFilterOption { + return func(opts *imageFilterOptions) { + opts.allowImportedTypes = true + } +} + +// ImageFilteredByTypes returns a minimal image containing only the descriptors +// required to define those types. The resulting contains only files in which +// those descriptors and their transitive closure of required descriptors, with +// each file only contains the minimal required types and imports. +// +// Although this returns a new [bufimage.Image], it mutates the original image's +// underlying file's [descriptorpb.FileDescriptorProto]. So the old image should +// not continue to be used. +// +// A descriptor is said to require another descriptor if the dependent +// descriptor is needed to accurately and completely describe that descriptor. +// For the following types that includes: +// +// Messages +// - messages & enums referenced in fields +// - proto2 extension declarations for this field +// - custom options for the message, its fields, and the file in which the +// message is defined +// - the parent message if this message is a nested definition +// +// Enums +// - Custom options used in the enum, enum values, and the file +// in which the message is defined +// - the parent message if this message is a nested definition +// +// Services +// - request & response types referenced in methods +// - custom options for the service, its methods, and the file +// in which the message is defined +// +// As an example, consider the following proto structure: +// +// --- foo.proto --- +// package pkg; +// message Foo { +// optional Bar bar = 1; +// extensions 2 to 3; +// } +// message Bar { ... } +// message Baz { +// other.Qux qux = 1 [(other.my_option).field = "buf"]; +// } +// --- baz.proto --- +// package other; +// extend Foo { +// optional Qux baz = 2; +// } +// message Qux{ ... } +// message Quux{ ... } +// extend google.protobuf.FieldOptions { +// optional Quux my_option = 51234; +// } +// +// A filtered image for type `pkg.Foo` would include +// +// files: [foo.proto, bar.proto] +// messages: [pkg.Foo, pkg.Bar, other.Qux] +// extensions: [other.baz] +// +// A filtered image for type `pkg.Bar` would include +// +// files: [foo.proto] +// messages: [pkg.Bar] +// +// A filtered image for type `pkg.Baz` would include +// files: [foo.proto, bar.proto] +// messages: [pkg.Baz, other.Quux, other.Qux] +// extensions: [other.my_option] +func ImageFilteredByTypes(image bufimage.Image, types ...string) (bufimage.Image, error) { + return ImageFilteredByTypesWithOptions(image, types) +} + +// ImageFilteredByTypesWithOptions returns a minimal image containing only the descriptors +// required to define those types. See ImageFilteredByTypes for more details. This version +// allows for customizing the behavior with options. +func ImageFilteredByTypesWithOptions(image bufimage.Image, types []string, opts ...ImageFilterOption) (bufimage.Image, error) { + options := newImageFilterOptions() + for _, o := range opts { + o(options) + } + + imageIndex, err := newImageIndexForImage(image, options) + if err != nil { + return nil, err + } + // Check types exist + startingDescriptors := make([]namedDescriptor, 0, len(types)) + var startingPackages []*protoPackage + for _, typeName := range types { + // TODO: consider supporting a glob syntax of some kind, to do more advanced pattern + // matching, such as ability to get a package AND all of its sub-packages. + startingDescriptor, ok := imageIndex.ByName[typeName] + if ok { + // It's a type name + typeInfo := imageIndex.ByDescriptor[startingDescriptor] + if image.GetFile(typeInfo.file).IsImport() && !options.allowImportedTypes { + return nil, fmt.Errorf("filtering by type %q: %w", typeName, ErrImageFilterTypeIsImport) + } + startingDescriptors = append(startingDescriptors, startingDescriptor) + continue + } + // It could be a package name + pkg, ok := imageIndex.Packages[typeName] + if !ok { + // but it's not... + return nil, fmt.Errorf("filtering by type %q: %w", typeName, ErrImageFilterTypeNotFound) + } + if !options.allowImportedTypes { + // if package includes only imported files, then reject + onlyImported := true + for _, file := range pkg.files { + if !file.IsImport() { + onlyImported = false + break + } + } + if onlyImported { + return nil, fmt.Errorf("filtering by type %q: %w", typeName, ErrImageFilterTypeIsImport) + } + } + startingPackages = append(startingPackages, pkg) + } + // Find all types to include in filtered image. + closure := newTransitiveClosure() + for _, startingPackage := range startingPackages { + if err := closure.addPackage(startingPackage, imageIndex, options); err != nil { + return nil, err + } + } + for _, startingDescriptor := range startingDescriptors { + if err := closure.addElement(startingDescriptor, "", false, imageIndex, options); err != nil { + return nil, err + } + } + // After all types are added, add their known extensions + if err := closure.addExtensions(imageIndex, options); err != nil { + return nil, err + } + // Create a new image with only the required descriptors. + var includedFiles []bufimage.ImageFile + for _, imageFile := range image.Files() { + _, ok := closure.files[imageFile.Path()] + if !ok { + continue + } + includedFiles = append(includedFiles, imageFile) + imageFileDescriptor := imageFile.Proto() + + importsRequired := closure.imports[imageFile.Path()] + // If the file has source code info, we need to remap paths to correctly + // update this info for the elements retained after filtering. + var sourcePathRemapper *sourcePathsRemapTrie + if len(imageFileDescriptor.SourceCodeInfo.GetLocation()) > 0 { + sourcePathRemapper = &sourcePathsRemapTrie{} + } + // We track the source path as we go through the model, so that we can + // mark paths as moved or deleted. Whenever an element is deleted, any + // subsequent elements of the same type in the same scope have are "moved", + // because their index is shifted down. + basePath := make([]int32, 1, 16) + basePath[0] = fileDependencyTag + // While employing + // https://github.com/golang/go/wiki/SliceTricks#filter-in-place, + // also keep a record of which index moved where, so we can fixup + // the file's WeakDependency field. + indexFromTo := make(map[int32]int32) + indexTo := 0 + for indexFrom, importPath := range imageFileDescriptor.GetDependency() { + path := append(basePath, int32(indexFrom)) + if _, ok := importsRequired[importPath]; ok { + sourcePathRemapper.markMoved(path, int32(indexTo)) + indexFromTo[int32(indexFrom)] = int32(indexTo) + imageFileDescriptor.Dependency[indexTo] = importPath + indexTo++ + // markDeleted them as we go, so we know which ones weren't in the list + delete(importsRequired, importPath) + } else { + sourcePathRemapper.markDeleted(path) + } + } + imageFileDescriptor.Dependency = imageFileDescriptor.Dependency[:indexTo] + + // Add any other imports (which may not have been in the list because + // they were picked up via a public import). The filtered files will not + // use public imports. + for importPath := range importsRequired { + imageFileDescriptor.Dependency = append(imageFileDescriptor.Dependency, importPath) + } + imageFileDescriptor.PublicDependency = nil + sourcePathRemapper.markDeleted([]int32{filePublicDependencyTag}) + + basePath = basePath[:1] + basePath[0] = fileWeakDependencyTag + i := 0 + for _, indexFrom := range imageFileDescriptor.WeakDependency { + path := append(basePath, indexFrom) + if indexTo, ok := indexFromTo[indexFrom]; ok { + sourcePathRemapper.markMoved(path, indexTo) + imageFileDescriptor.WeakDependency[i] = indexTo + i++ + } else { + sourcePathRemapper.markDeleted(path) + } + } + imageFileDescriptor.WeakDependency = imageFileDescriptor.WeakDependency[:i] + + if _, ok := closure.completeFiles[imageFile.Path()]; !ok { + // if not keeping entire file, filter contents now + basePath = basePath[:0] + imageFileDescriptor.MessageType = trimMessageDescriptors(imageFileDescriptor.MessageType, closure.elements, sourcePathRemapper, append(basePath, fileMessagesTag)) + imageFileDescriptor.EnumType = trimSlice(imageFileDescriptor.EnumType, closure.elements, sourcePathRemapper, append(basePath, fileEnumsTag)) + // TODO: We could end up removing all extensions from a particular extend block + // but we then don't mark that extend block's source code info for deletion. This + // is because extend blocks don't have distinct paths -- we have to actually look + // at the span information to determine which extensions correspond to which blocks + // to decide which blocks to remove. That is possible, but non-trivial, and it's + // unclear if the "juice is worth the squeeze", so we leave it. The best we do is + // to remove comments for extend blocks when there are NO extensions. + extsPath := append(basePath, fileExtensionsTag) + imageFileDescriptor.Extension = trimSlice(imageFileDescriptor.Extension, closure.elements, sourcePathRemapper, extsPath) + if len(imageFileDescriptor.Extension) == 0 { + sourcePathRemapper.markDeleted(extsPath) + } + svcsPath := append(basePath, fileServicesTag) + // We must iterate through the services *before* we trim the slice. That way the + // index we see is for the "old path", which we need to know to mark elements as + // moved or deleted with the sourcePathRemapper. + for index, serviceDescriptor := range imageFileDescriptor.Service { + if _, ok := closure.elements[serviceDescriptor]; !ok { + continue + } + methodPath := append(svcsPath, int32(index), serviceMethodsTag) + serviceDescriptor.Method = trimSlice(serviceDescriptor.Method, closure.elements, sourcePathRemapper, methodPath) + } + imageFileDescriptor.Service = trimSlice(imageFileDescriptor.Service, closure.elements, sourcePathRemapper, svcsPath) + } + + if len(imageFileDescriptor.SourceCodeInfo.GetLocation()) > 0 { + // Now the sourcePathRemapper has been fully populated for all of the deletions + // and moves above. So we can use it to reconstruct the source code info slice + // of locations. + i := 0 + for _, location := range imageFileDescriptor.SourceCodeInfo.Location { + // This function returns newPath==nil if the element at the given path + // was marked for deletion (so this location should be omitted). + newPath, noComment := sourcePathRemapper.newPath(location.Path) + if newPath != nil { + imageFileDescriptor.SourceCodeInfo.Location[i] = location + location.Path = newPath + if noComment { + location.LeadingDetachedComments = nil + location.LeadingComments = nil + location.TrailingComments = nil + } + i++ + } + } + imageFileDescriptor.SourceCodeInfo.Location = imageFileDescriptor.SourceCodeInfo.Location[:i] + } + } + return bufimage.NewImage(includedFiles) +} + +// trimMessageDescriptors removes (nested) messages and nested enums from a slice +// of message descriptors if their type names are not found in the toKeep map. +func trimMessageDescriptors( + in []*descriptorpb.DescriptorProto, + toKeep map[namedDescriptor]closureInclusionMode, + sourcePathRemapper *sourcePathsRemapTrie, + pathSoFar []int32, +) []*descriptorpb.DescriptorProto { + // We must iterate through the messages *before* we trim the slice. That way the + // index we see is for the "old path", which we need to know to mark elements as + // moved or deleted with the sourcePathRemapper. + for index, messageDescriptor := range in { + path := append(pathSoFar, int32(index)) + mode, ok := toKeep[messageDescriptor] + if !ok { + continue + } + if mode == inclusionModeEnclosing { + // if this is just an enclosing element, we only care about it as a namespace for + // other types and don't care about the rest of its contents + messageDescriptor.Field = nil + messageDescriptor.OneofDecl = nil + messageDescriptor.ExtensionRange = nil + messageDescriptor.ReservedRange = nil + messageDescriptor.ReservedName = nil + sourcePathRemapper.markNoComment(path) + sourcePathRemapper.markDeleted(append(path, messageFieldsTag)) + sourcePathRemapper.markDeleted(append(path, messageOneofsTag)) + sourcePathRemapper.markDeleted(append(path, messageExtensionRangesTag)) + sourcePathRemapper.markDeleted(append(path, messageReservedRangesTag)) + sourcePathRemapper.markDeleted(append(path, messageReservedNamesTag)) + } + messageDescriptor.NestedType = trimMessageDescriptors(messageDescriptor.NestedType, toKeep, sourcePathRemapper, append(path, messageNestedMessagesTag)) + messageDescriptor.EnumType = trimSlice(messageDescriptor.EnumType, toKeep, sourcePathRemapper, append(path, messageEnumsTag)) + // TODO: We could end up removing all extensions from a particular extend block + // but we then don't mark that extend block's source code info for deletion. The + // best we do is to remove comments for extend blocks when there are NO extensions. + // See comment above for file extensions for more info. + extsPath := append(path, messageExtensionsTag) + messageDescriptor.Extension = trimSlice(messageDescriptor.Extension, toKeep, sourcePathRemapper, extsPath) + if len(messageDescriptor.Extension) == 0 { + sourcePathRemapper.markDeleted(extsPath) + } + } + return trimSlice(in, toKeep, sourcePathRemapper, pathSoFar) +} + +// trimSlice removes elements from a slice of descriptors if they are +// not present in the given map. +func trimSlice[T namedDescriptor]( + in []T, + toKeep map[namedDescriptor]closureInclusionMode, + sourcePathRemapper *sourcePathsRemapTrie, + pathSoFar []int32, +) []T { + i := 0 + for index, descriptor := range in { + path := append(pathSoFar, int32(index)) + if _, ok := toKeep[descriptor]; ok { + sourcePathRemapper.markMoved(path, int32(i)) + in[i] = descriptor + i++ + } else { + sourcePathRemapper.markDeleted(path) + } + } + return in[:i] +} + +// transitiveClosure accumulates the elements, files, and needed imports for a +// subset of an image. When an element is added to the closure, all of its +// dependencies are recursively added. +type transitiveClosure struct { + // The elements included in the transitive closure. + elements map[namedDescriptor]closureInclusionMode + // The set of files that contain all items in elements. + files map[string]struct{} + // Any files that are part of the closure in their entirety (due to an + // entire package being included). The above fields are used to filter the + // contents of files. But files named in this set will not be filtered. + completeFiles map[string]struct{} + // The set of imports for each file. This allows for re-writing imports + // for files whose contents have been pruned. + imports map[string]map[string]struct{} +} + +type closureInclusionMode int + +const ( + // Element is included in closure because it is directly reachable from a root. + inclusionModeExplicit = closureInclusionMode(iota) + // Element is included in closure because it is a message or service that + // *contains* an explicitly included element but is not itself directly + // reachable. + inclusionModeEnclosing + // Element is included in closure because it is implied by the presence of a + // custom option. For example, a field element with a custom option implies + // the presence of google.protobuf.FieldOptions. An option type could instead be + // explicitly included if it is also directly reachable (i.e. some type in the + // graph explicitly refers to the option type). + inclusionModeImplicit +) + +func newTransitiveClosure() *transitiveClosure { + return &transitiveClosure{ + elements: map[namedDescriptor]closureInclusionMode{}, + files: map[string]struct{}{}, + completeFiles: map[string]struct{}{}, + imports: map[string]map[string]struct{}{}, + } +} + +func (t *transitiveClosure) addImport(fromPath, toPath string) { + if fromPath == toPath { + return // no need for a file to import itself + } + imps := t.imports[fromPath] + if imps == nil { + imps = map[string]struct{}{} + t.imports[fromPath] = imps + } + imps[toPath] = struct{}{} +} + +func (t *transitiveClosure) addFile(file string, imageIndex *imageIndex, opts *imageFilterOptions) error { + if _, ok := t.files[file]; ok { + return nil // already added + } + t.files[file] = struct{}{} + return t.exploreCustomOptions(imageIndex.Files[file], file, imageIndex, opts) +} + +func (t *transitiveClosure) addPackage( + pkg *protoPackage, + imageIndex *imageIndex, + opts *imageFilterOptions, +) error { + for _, file := range pkg.files { + if err := t.addFile(file.Path(), imageIndex, opts); err != nil { + return err + } + t.completeFiles[file.Path()] = struct{}{} + } + for _, descriptor := range pkg.elements { + if err := t.addElement(descriptor, "", false, imageIndex, opts); err != nil { + return err + } + } + return nil +} + +func (t *transitiveClosure) addElement( + descriptor namedDescriptor, + referrerFile string, + impliedByCustomOption bool, + imageIndex *imageIndex, + opts *imageFilterOptions, +) error { + descriptorInfo := imageIndex.ByDescriptor[descriptor] + if err := t.addFile(descriptorInfo.file, imageIndex, opts); err != nil { + return err + } + if referrerFile != "" { + t.addImport(referrerFile, descriptorInfo.file) + } + + if existingMode, ok := t.elements[descriptor]; ok && existingMode != inclusionModeEnclosing { + if existingMode == inclusionModeImplicit && !impliedByCustomOption { + // upgrade from implied to explicitly part of closure + t.elements[descriptor] = inclusionModeExplicit + } + return nil // already added this element + } + if impliedByCustomOption { + t.elements[descriptor] = inclusionModeImplicit + } else { + t.elements[descriptor] = inclusionModeExplicit + } + + // if this type is enclosed inside another, add enclosing types + if err := t.addEnclosing(descriptorInfo.parent, descriptorInfo.file, imageIndex, opts); err != nil { + return err + } + // add any custom options and their dependencies + if err := t.exploreCustomOptions(descriptor, descriptorInfo.file, imageIndex, opts); err != nil { + return err + } + + switch typedDescriptor := descriptor.(type) { + case *descriptorpb.DescriptorProto: + // Options and types for all fields + for _, field := range typedDescriptor.GetField() { + if err := t.addFieldType(field, descriptorInfo.file, imageIndex, opts); err != nil { + return err + } + if err := t.exploreCustomOptions(field, referrerFile, imageIndex, opts); err != nil { + return err + } + } + // Options for all oneofs in this message + for _, oneOfDescriptor := range typedDescriptor.GetOneofDecl() { + if err := t.exploreCustomOptions(oneOfDescriptor, descriptorInfo.file, imageIndex, opts); err != nil { + return err + } + } + // Options for all extension ranges in this message + for _, extRange := range typedDescriptor.GetExtensionRange() { + if err := t.exploreCustomOptions(extRange, descriptorInfo.file, imageIndex, opts); err != nil { + return err + } + } + + case *descriptorpb.EnumDescriptorProto: + for _, enumValue := range typedDescriptor.GetValue() { + if err := t.exploreCustomOptions(enumValue, descriptorInfo.file, imageIndex, opts); err != nil { + return err + } + } + + case *descriptorpb.ServiceDescriptorProto: + for _, method := range typedDescriptor.GetMethod() { + if err := t.addElement(method, "", false, imageIndex, opts); err != nil { + return err + } + } + + case *descriptorpb.MethodDescriptorProto: + inputName := strings.TrimPrefix(typedDescriptor.GetInputType(), ".") + inputDescriptor, ok := imageIndex.ByName[inputName] + if !ok { + return fmt.Errorf("missing %q", inputName) + } + if err := t.addElement(inputDescriptor, descriptorInfo.file, false, imageIndex, opts); err != nil { + return err + } + + outputName := strings.TrimPrefix(typedDescriptor.GetOutputType(), ".") + outputDescriptor, ok := imageIndex.ByName[outputName] + if !ok { + return fmt.Errorf("missing %q", outputName) + } + if err := t.addElement(outputDescriptor, descriptorInfo.file, false, imageIndex, opts); err != nil { + return err + } + + case *descriptorpb.FieldDescriptorProto: + // Regular fields are handled above in message descriptor case. + // We should only find our way here for extensions. + if typedDescriptor.Extendee == nil { + return errorUnsupportedFilterType(descriptor, descriptorInfo.fullName) + } + if typedDescriptor.GetExtendee() == "" { + return fmt.Errorf("expected extendee for field %q to not be empty", descriptorInfo.fullName) + } + extendeeName := strings.TrimPrefix(typedDescriptor.GetExtendee(), ".") + extendeeDescriptor, ok := imageIndex.ByName[extendeeName] + if !ok { + return fmt.Errorf("missing %q", extendeeName) + } + if err := t.addElement(extendeeDescriptor, descriptorInfo.file, impliedByCustomOption, imageIndex, opts); err != nil { + return err + } + if err := t.addFieldType(typedDescriptor, descriptorInfo.file, imageIndex, opts); err != nil { + return err + } + + default: + return errorUnsupportedFilterType(descriptor, descriptorInfo.fullName) + } + + return nil +} + +func errorUnsupportedFilterType(descriptor namedDescriptor, fullName string) error { + var descriptorType string + switch d := descriptor.(type) { + case *descriptorpb.FileDescriptorProto: + descriptorType = "file" + case *descriptorpb.DescriptorProto: + descriptorType = "message" + case *descriptorpb.FieldDescriptorProto: + if d.Extendee != nil { + descriptorType = "extension field" + } else { + descriptorType = "non-extension field" + } + case *descriptorpb.OneofDescriptorProto: + descriptorType = "oneof" + case *descriptorpb.EnumDescriptorProto: + descriptorType = "enum" + case *descriptorpb.EnumValueDescriptorProto: + descriptorType = "enum value" + case *descriptorpb.ServiceDescriptorProto: + descriptorType = "service" + case *descriptorpb.MethodDescriptorProto: + descriptorType = "method" + default: + descriptorType = fmt.Sprintf("%T", d) + } + return fmt.Errorf("%s is unsupported filter type: %s", fullName, descriptorType) +} + +func (t *transitiveClosure) addEnclosing(descriptor namedDescriptor, enclosingFile string, imageIndex *imageIndex, opts *imageFilterOptions) error { + // loop through all enclosing parents since nesting level + // could be arbitrarily deep + for descriptor != nil { + _, isMsg := descriptor.(*descriptorpb.DescriptorProto) + _, isSvc := descriptor.(*descriptorpb.ServiceDescriptorProto) + if !isMsg && !isSvc { + break // not an enclosing type + } + if _, ok := t.elements[descriptor]; ok { + break // already in closure + } + t.elements[descriptor] = inclusionModeEnclosing + if err := t.exploreCustomOptions(descriptor, enclosingFile, imageIndex, opts); err != nil { + return err + } + // now move into this element's parent + descriptor = imageIndex.ByDescriptor[descriptor].parent + } + return nil +} + +func (t *transitiveClosure) addFieldType(field *descriptorpb.FieldDescriptorProto, referrerFile string, imageIndex *imageIndex, opts *imageFilterOptions) error { + switch field.GetType() { + case descriptorpb.FieldDescriptorProto_TYPE_ENUM, + descriptorpb.FieldDescriptorProto_TYPE_MESSAGE, + descriptorpb.FieldDescriptorProto_TYPE_GROUP: + typeName := strings.TrimPrefix(field.GetTypeName(), ".") + typeDescriptor, ok := imageIndex.ByName[typeName] + if !ok { + return fmt.Errorf("missing %q", typeName) + } + err := t.addElement(typeDescriptor, referrerFile, false, imageIndex, opts) + if err != nil { + return err + } + case descriptorpb.FieldDescriptorProto_TYPE_DOUBLE, + descriptorpb.FieldDescriptorProto_TYPE_FLOAT, + descriptorpb.FieldDescriptorProto_TYPE_INT64, + descriptorpb.FieldDescriptorProto_TYPE_UINT64, + descriptorpb.FieldDescriptorProto_TYPE_INT32, + descriptorpb.FieldDescriptorProto_TYPE_FIXED64, + descriptorpb.FieldDescriptorProto_TYPE_FIXED32, + descriptorpb.FieldDescriptorProto_TYPE_BOOL, + descriptorpb.FieldDescriptorProto_TYPE_STRING, + descriptorpb.FieldDescriptorProto_TYPE_BYTES, + descriptorpb.FieldDescriptorProto_TYPE_UINT32, + descriptorpb.FieldDescriptorProto_TYPE_SFIXED32, + descriptorpb.FieldDescriptorProto_TYPE_SFIXED64, + descriptorpb.FieldDescriptorProto_TYPE_SINT32, + descriptorpb.FieldDescriptorProto_TYPE_SINT64: + // nothing to follow, custom options handled below. + default: + return fmt.Errorf("unknown field type %d", field.GetType()) + } + return nil +} + +func (t *transitiveClosure) addExtensions( + imageIndex *imageIndex, + opts *imageFilterOptions, +) error { + if !opts.includeKnownExtensions { + return nil // nothing to do + } + for e, mode := range t.elements { + if mode != inclusionModeExplicit { + // we only collect extensions for messages that are directly reachable/referenced. + continue + } + msgDescriptor, ok := e.(*descriptorpb.DescriptorProto) + if !ok { + // not a message, nothing to do + continue + } + descriptorInfo := imageIndex.ByDescriptor[msgDescriptor] + for _, extendsDescriptor := range imageIndex.NameToExtensions[descriptorInfo.fullName] { + if err := t.addElement(extendsDescriptor, "", false, imageIndex, opts); err != nil { + return err + } + } + } + return nil +} + +func (t *transitiveClosure) exploreCustomOptions( + descriptor proto.Message, + referrerFile string, + imageIndex *imageIndex, + opts *imageFilterOptions, +) error { + if !opts.includeCustomOptions { + return nil + } + + var options protoreflect.Message + switch descriptor := descriptor.(type) { + case *descriptorpb.FileDescriptorProto: + options = descriptor.GetOptions().ProtoReflect() + case *descriptorpb.DescriptorProto: + options = descriptor.GetOptions().ProtoReflect() + case *descriptorpb.FieldDescriptorProto: + options = descriptor.GetOptions().ProtoReflect() + case *descriptorpb.OneofDescriptorProto: + options = descriptor.GetOptions().ProtoReflect() + case *descriptorpb.EnumDescriptorProto: + options = descriptor.GetOptions().ProtoReflect() + case *descriptorpb.EnumValueDescriptorProto: + options = descriptor.GetOptions().ProtoReflect() + case *descriptorpb.ServiceDescriptorProto: + options = descriptor.GetOptions().ProtoReflect() + case *descriptorpb.MethodDescriptorProto: + options = descriptor.GetOptions().ProtoReflect() + case *descriptorpb.DescriptorProto_ExtensionRange: + options = descriptor.GetOptions().ProtoReflect() + default: + return fmt.Errorf("unexpected type for exploring options %T", descriptor) + } + + optionsName := string(options.Descriptor().FullName()) + var err error + options.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool { + // If the value contains an Any message, we should add the message type + // therein to the closure. + if err = t.exploreOptionValueForAny(fd, val, referrerFile, imageIndex, opts); err != nil { + return false + } + + // Also include custom option definitions (e.g. extensions) + if !fd.IsExtension() { + return true + } + optionsByNumber := imageIndex.NameToOptions[optionsName] + field, ok := optionsByNumber[int32(fd.Number())] + if !ok { + err = fmt.Errorf("cannot find ext no %d on %s", fd.Number(), optionsName) + return false + } + err = t.addElement(field, referrerFile, true, imageIndex, opts) + return err == nil + }) + return err +} + +func isMessageKind(k protoreflect.Kind) bool { + return k == protoreflect.MessageKind || k == protoreflect.GroupKind +} + +func (t *transitiveClosure) exploreOptionValueForAny( + fd protoreflect.FieldDescriptor, + val protoreflect.Value, + referrerFile string, + imageIndex *imageIndex, + opts *imageFilterOptions, +) error { + switch { + case fd.IsMap(): + if isMessageKind(fd.MapValue().Kind()) { + var err error + val.Map().Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { + if err = t.exploreOptionSingularValueForAny(v.Message(), referrerFile, imageIndex, opts); err != nil { + return false + } + return true + }) + return err + } + case isMessageKind(fd.Kind()): + if fd.IsList() { + listVal := val.List() + for i := 0; i < listVal.Len(); i++ { + if err := t.exploreOptionSingularValueForAny(listVal.Get(i).Message(), referrerFile, imageIndex, opts); err != nil { + return err + } + } + } else { + return t.exploreOptionSingularValueForAny(val.Message(), referrerFile, imageIndex, opts) + } + } + return nil +} + +func (t *transitiveClosure) exploreOptionSingularValueForAny( + msg protoreflect.Message, + referrerFile string, + imageIndex *imageIndex, + opts *imageFilterOptions, +) error { + md := msg.Descriptor() + if md.FullName() == anyFullName { + // Found one! + typeURLFd := md.Fields().ByNumber(1) + if typeURLFd.Kind() != protoreflect.StringKind || typeURLFd.IsList() { + // should not be possible... + return nil + } + typeURL := msg.Get(typeURLFd).String() + pos := strings.LastIndexByte(typeURL, '/') + msgType := typeURL[pos+1:] + d, _ := imageIndex.ByName[msgType].(*descriptorpb.DescriptorProto) + if d != nil { + if err := t.addElement(d, referrerFile, false, imageIndex, opts); err != nil { + return err + } + } + // TODO: unmarshal the bytes to see if there are any nested Any messages + return nil + } + // keep digging + var err error + msg.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool { + err = t.exploreOptionValueForAny(fd, val, referrerFile, imageIndex, opts) + return err == nil + }) + return err +} + +func freeMessageRangeStringsRec( + s []string, + message protosource.Message, +) []string { + for _, nestedMessage := range message.Messages() { + s = freeMessageRangeStringsRec(s, nestedMessage) + } + if e := protosource.FreeMessageRangeString(message); e != "" { + return append(s, e) + } + return s +} + +type imageFilterOptions struct { + includeCustomOptions bool + includeKnownExtensions bool + allowImportedTypes bool +} + +func newImageFilterOptions() *imageFilterOptions { + return &imageFilterOptions{ + includeCustomOptions: true, + includeKnownExtensions: true, + allowImportedTypes: false, + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil_test.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil_test.go new file mode 100644 index 000000000..0679f0519 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil_test.go @@ -0,0 +1,502 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimageutil + +import ( + "bytes" + "context" + "fmt" + "io" + "sort" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/jhump/protoreflect/desc" + "github.com/jhump/protoreflect/desc/protoprint" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "go.uber.org/zap/zaptest" + "golang.org/x/tools/txtar" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" +) + +// IF YOU HAVE ANY FAILING TESTS IN HERE, ESPECIALLY AFTER A PROTOC UPGRADE, +// SWITCH THIS TO TRUE, TURN OFF PARALLEL TESTING, RE-RUN THE TESTS AND THEN SWITCH BACK TO FALSE. +const shouldUpdateExpectations = false + +func TestOptions(t *testing.T) { + t.Parallel() + t.Run("message", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/options", []string{"pkg.Foo"}, "pkg.Foo.txtar") + }) + t.Run("enum", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/options", []string{"pkg.FooEnum"}, "pkg.FooEnum.txtar") + }) + t.Run("service", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/options", []string{"pkg.FooService"}, "pkg.FooService.txtar") + }) + t.Run("method", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/options", []string{"pkg.FooService.Do"}, "pkg.FooService.Do.txtar") + }) + t.Run("all", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/options", []string{"pkg.Foo", "pkg.FooEnum", "pkg.FooService"}, "all.txtar") + }) + t.Run("exclude-options", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/options", []string{"pkg.Foo", "pkg.FooEnum", "pkg.FooService"}, "all-exclude-options.txtar", WithExcludeCustomOptions()) + }) + t.Run("files", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/options", []string{"Files"}, "Files.txtar") + }) + t.Run("all-with-files", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/options", []string{"pkg.Foo", "pkg.FooEnum", "pkg.FooService", "Files"}, "all-with-Files.txtar") + }) +} + +func TestNesting(t *testing.T) { + t.Parallel() + t.Run("message", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/nesting", []string{"pkg.Foo"}, "message.txtar") + }) + t.Run("recursenested", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/nesting", []string{"pkg.Foo.NestedFoo.NestedNestedFoo"}, "recursenested.txtar") + }) + t.Run("enum", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/nesting", []string{"pkg.FooEnum"}, "enum.txtar") + }) + t.Run("usingother", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/nesting", []string{"pkg.Baz"}, "usingother.txtar") + }) +} + +func TestImportModifiers(t *testing.T) { + t.Parallel() + t.Run("regular_weak", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/importmods", []string{"ImportRegular", "ImportWeak"}, "regular_weak.txtar") + }) + t.Run("weak_public", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/importmods", []string{"ImportWeak", "ImportPublic"}, "weak_public.txtar") + }) + t.Run("regular_public", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/importmods", []string{"ImportRegular", "ImportPublic"}, "regular_public.txtar") + }) + t.Run("noimports", func(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/importmods", []string{"NoImports"}, "noimports.txtar") + }) +} + +func TestExtensions(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/extensions", []string{"pkg.Foo"}, "extensions.txtar") + runDiffTest(t, "testdata/extensions", []string{"pkg.Foo"}, "extensions-excluded.txtar", WithExcludeKnownExtensions()) +} + +func TestPackages(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/packages", []string{""}, "root.txtar") + runDiffTest(t, "testdata/packages", []string{"foo"}, "foo.txtar") + runDiffTest(t, "testdata/packages", []string{"foo.bar"}, "foo.bar.txtar") + runDiffTest(t, "testdata/packages", []string{"foo.bar.baz"}, "foo.bar.baz.txtar") +} + +func TestAny(t *testing.T) { + t.Parallel() + runDiffTest(t, "testdata/any", []string{"ExtendedAnySyntax"}, "c1.txtar") + runDiffTest(t, "testdata/any", []string{"ExtendedAnySyntax_InField"}, "c2.txtar") + runDiffTest(t, "testdata/any", []string{"ExtendedAnySyntax_InList"}, "c3.txtar") + runDiffTest(t, "testdata/any", []string{"ExtendedAnySyntax_InMap"}, "c4.txtar") + runDiffTest(t, "testdata/any", []string{"NormalMessageSyntaxValidType"}, "d.txtar") + runDiffTest(t, "testdata/any", []string{"NormalMessageSyntaxInvalidType"}, "e.txtar") +} + +func TestSourceCodeInfo(t *testing.T) { + t.Parallel() + noExts := []ImageFilterOption{WithExcludeCustomOptions(), WithExcludeKnownExtensions()} + runSourceCodeInfoTest(t, "foo.bar.Foo", "Foo.txtar", noExts...) + runSourceCodeInfoTest(t, "foo.bar.Foo", "Foo+Ext.txtar") + runSourceCodeInfoTest(t, "foo.bar.Foo.NestedFoo", "NestedFoo.txtar", noExts...) + runSourceCodeInfoTest(t, "foo.bar.Bar", "Bar.txtar", noExts...) + runSourceCodeInfoTest(t, "foo.bar.Baz", "Baz.txtar", noExts...) + runSourceCodeInfoTest(t, "foo.bar.Quz", "Quz.txtar", noExts...) + runSourceCodeInfoTest(t, "foo.bar.Svc", "Svc.txtar", noExts...) + runSourceCodeInfoTest(t, "foo.bar.Svc.Do", "Do.txtar", noExts...) + runSourceCodeInfoTest(t, "foo.bar", "all.txtar") +} + +func TestTransitivePublic(t *testing.T) { + t.Parallel() + ctx := context.Background() + bucket, err := storagemem.NewReadBucket(map[string][]byte{ + "a.proto": []byte(`syntax = "proto3";package a;message Foo{}`), + "b.proto": []byte(`syntax = "proto3";package b;import public "a.proto";message Bar {}`), + "c.proto": []byte(`syntax = "proto3";package c;import "b.proto";message Baz{ a.Foo foo = 1; }`), + }) + require.NoError(t, err) + module, err := bufmodule.NewModuleForBucket(ctx, bucket) + require.NoError(t, err) + image, analysis, err := bufimagebuild.NewBuilder( + zaptest.NewLogger(t), + bufmodule.NewNopModuleReader(), + ).Build( + ctx, + module, + bufimagebuild.WithExcludeSourceCodeInfo(), + ) + require.NoError(t, err) + require.Empty(t, analysis) + + filteredImage, err := ImageFilteredByTypes(image, "c.Baz") + require.NoError(t, err) + + _, err = desc.CreateFileDescriptorsFromSet(bufimage.ImageToFileDescriptorSet(filteredImage)) + require.NoError(t, err) +} + +func TestTypesFromMainModule(t *testing.T) { + t.Parallel() + + ctx := context.Background() + moduleIdentityString := "buf.build/repo/main" + moduleIdentity, err := bufmoduleref.ModuleIdentityForString(moduleIdentityString) + require.NoError(t, err) + moduleIdentityDepString := "buf.build/repo/dep" + moduleIdentityDep, err := bufmoduleref.ModuleIdentityForString(moduleIdentityDepString) + require.NoError(t, err) + bucket := storagemem.NewReadWriteBucket() + require.NoError(t, storage.PutPath(ctx, bucket, "a.proto", []byte(`syntax = "proto3";import "b.proto";package pkg;message Foo { dependency.Dep bar = 1;}`))) + require.NoError(t, bufmoduletesting.WriteTestLockFileToBucket(ctx, bucket, moduleIdentityDepString)) + module, err := bufmodule.NewModuleForBucket(ctx, bucket, bufmodule.ModuleWithModuleIdentity(moduleIdentity)) + require.NoError(t, err) + bucketDep, err := storagemem.NewReadBucket(map[string][]byte{ + "b.proto": []byte(`syntax = "proto3";package dependency; message Dep{}`), + }) + require.NoError(t, err) + moduleDep, err := bufmodule.NewModuleForBucket(ctx, bucketDep, bufmodule.ModuleWithModuleIdentity(moduleIdentityDep)) + require.NoError(t, err) + image, analysis, err := bufimagebuild.NewBuilder( + zaptest.NewLogger(t), + bufmoduletesting.NewTestModuleReader( + map[string]bufmodule.Module{ + moduleIdentityDep.IdentityString(): moduleDep, + }, + ), + ).Build( + ctx, + module, + bufimagebuild.WithExcludeSourceCodeInfo(), + ) + require.NoError(t, err) + require.Empty(t, analysis) + + _, err = ImageFilteredByTypes(image, "dependency.Dep") + require.Error(t, err) + assert.ErrorIs(t, err, ErrImageFilterTypeIsImport) + + // allowed if we specify option + _, err = ImageFilteredByTypesWithOptions(image, []string{"dependency.Dep"}, WithAllowFilterByImportedType()) + require.NoError(t, err) + + _, err = ImageFilteredByTypes(image, "nonexisting") + require.Error(t, err) + assert.ErrorIs(t, err, ErrImageFilterTypeNotFound) +} + +func getImage(ctx context.Context, logger *zap.Logger, testdataDir string, options ...bufimagebuild.BuildOption) (storage.ReadWriteBucket, bufimage.Image, error) { + bucket, err := storageos.NewProvider().NewReadWriteBucket(testdataDir) + if err != nil { + return nil, nil, err + } + module, err := bufmodule.NewModuleForBucket( + ctx, + storage.MapReadBucket(bucket, storage.MatchPathExt(".proto")), + ) + if err != nil { + return nil, nil, err + } + builder := bufimagebuild.NewBuilder(logger, bufmodule.NewNopModuleReader()) + image, analysis, err := builder.Build( + ctx, + module, + options..., + ) + if err != nil { + return nil, nil, err + } + if len(analysis) > 0 { + return nil, nil, fmt.Errorf("%d errors in source when building", len(analysis)) + } + return bucket, image, nil +} + +func runDiffTest(t *testing.T, testdataDir string, typenames []string, expectedFile string, opts ...ImageFilterOption) { + ctx := context.Background() + bucket, image, err := getImage(ctx, zaptest.NewLogger(t), testdataDir, bufimagebuild.WithExcludeSourceCodeInfo()) + require.NoError(t, err) + + filteredImage, err := ImageFilteredByTypesWithOptions(image, typenames, opts...) + require.NoError(t, err) + assert.NotNil(t, image) + assert.True(t, imageIsDependencyOrdered(filteredImage), "image files not in dependency order") + + // We may have filtered out custom options from the set in the step above. However, the options messages + // still contain extension fields that refer to the custom options, as a result of building the image. + // So we serialize and then de-serialize, and use only the filtered results to parse extensions. That + // way, the result will omit custom options that aren't present in the filtered set (as they will be + // considered unrecognized fields). + resolver, err := protoencoding.NewResolver(bufimage.ImageToFileDescriptors(filteredImage)...) + require.NoError(t, err) + data, err := proto.Marshal(bufimage.ImageToFileDescriptorSet(filteredImage)) + require.NoError(t, err) + fileDescriptorSet := &descriptorpb.FileDescriptorSet{} + err = proto.UnmarshalOptions{Resolver: resolver}.Unmarshal(data, fileDescriptorSet) + require.NoError(t, err) + + reflectDescriptors, err := desc.CreateFileDescriptorsFromSet(fileDescriptorSet) + require.NoError(t, err) + archive := &txtar.Archive{} + printer := protoprint.Printer{ + SortElements: true, + Compact: true, + } + for fname, d := range reflectDescriptors { + fileBuilder := &bytes.Buffer{} + require.NoError(t, printer.PrintProtoFile(d, fileBuilder), "expected no error while printing %q", fname) + archive.Files = append( + archive.Files, + txtar.File{ + Name: fname, + Data: fileBuilder.Bytes(), + }, + ) + } + sort.SliceStable(archive.Files, func(i, j int) bool { + return archive.Files[i].Name < archive.Files[j].Name + }) + generated := txtar.Format(archive) + checkExpectation(t, ctx, generated, bucket, expectedFile) +} + +func checkExpectation(t *testing.T, ctx context.Context, actual []byte, bucket storage.ReadWriteBucket, expectedFile string) { + if shouldUpdateExpectations { + writer, err := bucket.Put(ctx, expectedFile) + require.NoError(t, err) + _, err = writer.Write(actual) + require.NoError(t, err) + require.NoError(t, writer.Close()) + } else { + expectedReader, err := bucket.Get(ctx, expectedFile) + require.NoError(t, err) + expected, err := io.ReadAll(expectedReader) + require.NoError(t, err) + assert.Equal(t, string(expected), string(actual)) + } +} + +func runSourceCodeInfoTest(t *testing.T, typename string, expectedFile string, opts ...ImageFilterOption) { + ctx := context.Background() + bucket, image, err := getImage(ctx, zaptest.NewLogger(t), "testdata/sourcecodeinfo") + require.NoError(t, err) + + filteredImage, err := ImageFilteredByTypesWithOptions(image, []string{typename}, opts...) + require.NoError(t, err) + + imageFile := filteredImage.GetFile("test.proto") + sourceCodeInfo := imageFile.FileDescriptor().GetSourceCodeInfo() + actual, err := protoencoding.NewJSONMarshaler(nil, protoencoding.JSONMarshalerWithIndent()).Marshal(sourceCodeInfo) + require.NoError(t, err) + + checkExpectation(t, ctx, actual, bucket, expectedFile) + + resolver, err := protoencoding.NewResolver(bufimage.ImageToFileDescriptors(filteredImage)...) + require.NoError(t, err) + file, err := resolver.FindFileByPath("test.proto") + require.NoError(t, err) + examineComments(t, file) +} + +func imageIsDependencyOrdered(image bufimage.Image) bool { + seen := make(map[string]struct{}) + for _, file := range image.Files() { + for _, importName := range file.Proto().Dependency { + if _, ok := seen[importName]; !ok { + return false + } + } + seen[file.Path()] = struct{}{} + } + return true +} + +func examineComments(t *testing.T, file protoreflect.FileDescriptor) { + examineCommentsInTypeContainer(t, file, file) + svcs := file.Services() + for i, numSvcs := 0, svcs.Len(); i < numSvcs; i++ { + svc := svcs.Get(i) + examineComment(t, file, svc) + methods := svc.Methods() + for j, numMethods := 0, methods.Len(); j < numMethods; j++ { + method := methods.Get(j) + examineComment(t, file, method) + } + } +} + +type typeContainer interface { + Messages() protoreflect.MessageDescriptors + Enums() protoreflect.EnumDescriptors + Extensions() protoreflect.ExtensionDescriptors +} + +func examineCommentsInTypeContainer(t *testing.T, file protoreflect.FileDescriptor, descriptor typeContainer) { + msgs := descriptor.Messages() + for i, numMsgs := 0, msgs.Len(); i < numMsgs; i++ { + msg := msgs.Get(i) + examineComment(t, file, msg) + fields := msg.Fields() + for j, numFields := 0, fields.Len(); j < numFields; j++ { + field := fields.Get(j) + examineComment(t, file, field) + } + oneofs := msg.Oneofs() + for j, numOneofs := 0, oneofs.Len(); j < numOneofs; j++ { + oneof := oneofs.Get(j) + examineComment(t, file, oneof) + } + examineCommentsInTypeContainer(t, file, msg) + } + enums := descriptor.Enums() + for i, numEnums := 0, enums.Len(); i < numEnums; i++ { + enum := enums.Get(i) + examineComment(t, file, enum) + vals := enum.Values() + for j, numVals := 0, vals.Len(); j < numVals; j++ { + val := vals.Get(j) + examineComment(t, file, val) + } + } + exts := descriptor.Extensions() + for i, numExts := 0, exts.Len(); i < numExts; i++ { + ext := exts.Get(i) + examineComment(t, file, ext) + } +} + +func examineComment(t *testing.T, file protoreflect.FileDescriptor, descriptor protoreflect.Descriptor) { + loc := file.SourceLocations().ByDescriptor(descriptor) + if loc.LeadingComments == "" { + // Messages that are only present because they are namespaces that contains a retained + // type will not have a comment. So we can skip the comment check for that case. + if msg, ok := descriptor.(protoreflect.MessageDescriptor); ok && msg.Fields().Len() == 0 { + return + } + } + // Verify we got the correct location by checking that the comment contains the element's name + require.Contains(t, loc.LeadingComments, string(descriptor.Name())) +} + +func BenchmarkFilterImage_WithoutSourceCodeInfo(b *testing.B) { + benchmarkFilterImage(b, bufimagebuild.WithExcludeSourceCodeInfo()) +} + +func BenchmarkFilterImage_WithSourceCodeInfo(b *testing.B) { + benchmarkFilterImage(b) +} + +func benchmarkFilterImage(b *testing.B, opts ...bufimagebuild.BuildOption) { + benchmarkCases := []*struct { + folder string + image bufimage.Image + types []string + }{ + { + folder: "testdata/extensions", + types: []string{"pkg.Foo"}, + }, + { + folder: "testdata/importmods", + types: []string{"ImportRegular", "ImportWeak", "ImportPublic", "NoImports"}, + }, + { + folder: "testdata/nesting", + types: []string{"pkg.Foo", "pkg.Foo.NestedFoo.NestedNestedFoo", "pkg.Baz", "pkg.FooEnum"}, + }, + { + folder: "testdata/options", + types: []string{"pkg.Foo", "pkg.FooEnum", "pkg.FooService", "pkg.FooService.Do"}, + }, + } + ctx := context.Background() + for _, benchmarkCase := range benchmarkCases { + _, image, err := getImage(ctx, zaptest.NewLogger(b), benchmarkCase.folder, opts...) + require.NoError(b, err) + benchmarkCase.image = image + } + b.ResetTimer() + + i := 0 + for { + for _, benchmarkCase := range benchmarkCases { + for _, typeName := range benchmarkCase.types { + // filtering is destructive, so we have to make a copy + b.StopTimer() + imageFiles := make([]bufimage.ImageFile, len(benchmarkCase.image.Files())) + for j, file := range benchmarkCase.image.Files() { + clone, ok := proto.Clone(file.Proto()).(*descriptorpb.FileDescriptorProto) + require.True(b, ok) + var err error + imageFiles[j], err = bufimage.NewImageFile(clone, nil, "", "", false, false, nil) + require.NoError(b, err) + } + image, err := bufimage.NewImage(imageFiles) + require.NoError(b, err) + b.StartTimer() + + _, err = ImageFilteredByTypes(image, typeName) + require.NoError(b, err) + i++ + if i == b.N { + return + } + } + } + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/image_index.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/image_index.go new file mode 100644 index 000000000..b095c2f3d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/image_index.go @@ -0,0 +1,203 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimageutil + +import ( + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/bufbuild/protocompile/walk" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" +) + +// imageIndex holds an index that allows for easily navigating a descriptor +// hierarchy and its relationships. +type imageIndex struct { + // ByDescriptor maps descriptor proto pointers to information about the + // element. The info includes the actual descriptor proto, its parent + // element (if it has one), and the file in which it is defined. + ByDescriptor map[namedDescriptor]elementInfo + // ByName maps fully qualified type names to information about the named + // element. + ByName map[string]namedDescriptor + // Files maps fully qualified type names to the path of the file that + // declares the type. + Files map[string]*descriptorpb.FileDescriptorProto + + // NameToExtensions maps fully qualified type names to all known + // extension definitions for a type name. + NameToExtensions map[string][]*descriptorpb.FieldDescriptorProto + + // NameToOptions maps `google.protobuf.*Options` type names to their + // known extensions by field tag. + NameToOptions map[string]map[int32]*descriptorpb.FieldDescriptorProto + + // Packages maps package names to package contents. + Packages map[string]*protoPackage +} + +type namedDescriptor interface { + proto.Message + GetName() string +} + +var ( + _ namedDescriptor = (*descriptorpb.FileDescriptorProto)(nil) + _ namedDescriptor = (*descriptorpb.DescriptorProto)(nil) + _ namedDescriptor = (*descriptorpb.FieldDescriptorProto)(nil) + _ namedDescriptor = (*descriptorpb.OneofDescriptorProto)(nil) + _ namedDescriptor = (*descriptorpb.EnumDescriptorProto)(nil) + _ namedDescriptor = (*descriptorpb.EnumValueDescriptorProto)(nil) + _ namedDescriptor = (*descriptorpb.ServiceDescriptorProto)(nil) + _ namedDescriptor = (*descriptorpb.MethodDescriptorProto)(nil) +) + +type elementInfo struct { + fullName, file string + parent namedDescriptor +} + +type protoPackage struct { + files []bufimage.ImageFile + elements []namedDescriptor + subPackages []*protoPackage +} + +// newImageIndexForImage builds an imageIndex for a given image. +func newImageIndexForImage(image bufimage.Image, opts *imageFilterOptions) (*imageIndex, error) { + index := &imageIndex{ + ByName: make(map[string]namedDescriptor), + ByDescriptor: make(map[namedDescriptor]elementInfo), + Files: make(map[string]*descriptorpb.FileDescriptorProto), + Packages: make(map[string]*protoPackage), + } + if opts.includeCustomOptions { + index.NameToOptions = make(map[string]map[int32]*descriptorpb.FieldDescriptorProto) + } + if opts.includeKnownExtensions { + index.NameToExtensions = make(map[string][]*descriptorpb.FieldDescriptorProto) + } + + for _, file := range image.Files() { + pkg := addPackageToIndex(file.FileDescriptor().GetPackage(), index) + pkg.files = append(pkg.files, file) + fileName := file.Path() + fileDescriptorProto := file.Proto() + index.Files[fileName] = fileDescriptorProto + err := walk.DescriptorProtos(fileDescriptorProto, func(name protoreflect.FullName, msg proto.Message) error { + if existing := index.ByName[string(name)]; existing != nil { + return fmt.Errorf("duplicate for %q", name) + } + descriptor, ok := msg.(namedDescriptor) + if !ok { + return fmt.Errorf("unexpected descriptor type %T", msg) + } + var parent namedDescriptor + if pos := strings.LastIndexByte(string(name), '.'); pos != -1 { + parent = index.ByName[string(name[:pos])] + if parent == nil { + // parent name was a package name, not an element name + parent = fileDescriptorProto + } + } + + // certain descriptor types don't need to be indexed: + // enum values, normal (non-extension) fields, and oneofs + var includeInIndex bool + switch d := descriptor.(type) { + case *descriptorpb.EnumValueDescriptorProto, *descriptorpb.OneofDescriptorProto: + // do not add to package elements; these elements are implicitly included by their enclosing type + case *descriptorpb.FieldDescriptorProto: + // only add to elements if an extension (regular fields implicitly included by containing message) + includeInIndex = d.Extendee != nil + default: + includeInIndex = true + } + + if includeInIndex { + index.ByName[string(name)] = descriptor + index.ByDescriptor[descriptor] = elementInfo{ + fullName: string(name), + parent: parent, + file: fileName, + } + pkg.elements = append(pkg.elements, descriptor) + } + + ext, ok := descriptor.(*descriptorpb.FieldDescriptorProto) + if !ok || ext.Extendee == nil { + // not an extension, so the rest does not apply + return nil + } + + extendeeName := strings.TrimPrefix(ext.GetExtendee(), ".") + if opts.includeCustomOptions && isOptionsTypeName(extendeeName) { + if _, ok := index.NameToOptions[extendeeName]; !ok { + index.NameToOptions[extendeeName] = make(map[int32]*descriptorpb.FieldDescriptorProto) + } + index.NameToOptions[extendeeName][ext.GetNumber()] = ext + } + if opts.includeKnownExtensions { + index.NameToExtensions[extendeeName] = append(index.NameToExtensions[extendeeName], ext) + } + + return nil + }) + if err != nil { + return nil, err + } + } + return index, nil +} + +func addPackageToIndex(pkgName string, index *imageIndex) *protoPackage { + pkg := index.Packages[pkgName] + if pkg != nil { + return pkg + } + pkg = &protoPackage{} + index.Packages[pkgName] = pkg + if pkgName == "" { + return pkg + } + var parentPkgName string + if pos := strings.LastIndexByte(pkgName, '.'); pos != -1 { + parentPkgName = pkgName[:pos] + } + parentPkg := addPackageToIndex(parentPkgName, index) + parentPkg.subPackages = append(parentPkg.subPackages, pkg) + return pkg +} + +func isOptionsTypeName(typeName string) bool { + switch typeName { + case "google.protobuf.FileOptions", + "google.protobuf.MessageOptions", + "google.protobuf.FieldOptions", + "google.protobuf.OneofOptions", + "google.protobuf.ExtensionRangeOptions", + "google.protobuf.EnumOptions", + "google.protobuf.EnumValueOptions", + "google.protobuf.ServiceOptions", + "google.protobuf.MethodOptions": + return true + default: + return false + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/input_file.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/input_file.go new file mode 100644 index 000000000..a750a31f8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/input_file.go @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimageutil + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" +) + +type inputFile struct { + bufimage.ImageFile +} + +func newInputFile(imageFile bufimage.ImageFile) *inputFile { + return &inputFile{ + ImageFile: imageFile, + } +} + +func (i *inputFile) ModuleIdentity() protosource.ModuleIdentity { + return i.ImageFile.ModuleIdentity() +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap.go new file mode 100644 index 000000000..d307fa0e7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap.go @@ -0,0 +1,146 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimageutil + +import "sort" + +// sourcePathsRemapTrieNode is a node in a trie. Each node represents the +// path of a source code location. +type sourcePathsRemapTrieNode struct { + oldIndex int32 + // If == -1, the item at this path is being deleted. Otherwise, + // if != oldIndex, the item at this path is being moved, as well as + // all its descendents in the trie. + newIndex int32 + // If true, the item at this point has its comments omitted. This is + // used to omit comments for messages that, after filtering, are only + // present as a namespace (so the comments likely no longer apply). + noComment bool + // This node's children. These represent paths for which the current + // node is a path prefix (aka ancestor). + children sourcePathsRemapTrie +} + +// sourcePathsRemapTrie is a trie (aka prefix tree) whose children are a +// sorted slice (more efficient than a map, mainly due to not having to +// sort it with every addition, in practice, since source code info is +// mostly sorted). +// +// Each node in the trie represents some path of a source code location. +// This is used to track renumbering and deletions of paths. +type sourcePathsRemapTrie []*sourcePathsRemapTrieNode + +// markMoved inserts the given path into the trie and marks the last element +// of oldPath to be replaced with newIndex. +func (t *sourcePathsRemapTrie) markMoved(oldPath []int32, newIndex int32) { + t.doTrieInsert(oldPath, newIndex, false) +} + +// markDeleted marks the given path for deletion. +func (t *sourcePathsRemapTrie) markDeleted(oldPath []int32) { + t.doTrieInsert(oldPath, -1, false) +} + +// markNoComment inserts the given path into the trie and marks the element so +// its comments will be dropped. +func (t *sourcePathsRemapTrie) markNoComment(oldPath []int32) { + t.doTrieInsert(oldPath, oldPath[len(oldPath)-1], true) +} + +func (t *sourcePathsRemapTrie) doTrieInsert(oldPath []int32, newIndex int32, noComment bool) { + if t == nil { + return + } + items := *t + searchIndex := oldPath[0] + idx, found := sort.Find(len(items), func(i int) int { + return int(searchIndex - items[i].oldIndex) + }) + if !found { + // shouldn't usually need to sort because incoming items are often in order + needSort := len(items) > 0 && searchIndex < items[len(items)-1].oldIndex + idx = len(items) + items = append(items, &sourcePathsRemapTrieNode{ + oldIndex: searchIndex, + newIndex: searchIndex, + }) + if needSort { + sort.Slice(items, func(i, j int) bool { + return items[i].oldIndex < items[j].oldIndex + }) + // find the index of the thing we just added + idx, _ = sort.Find(len(items), func(i int) int { + return int(searchIndex - items[i].oldIndex) + }) + } + *t = items + } + if len(oldPath) > 1 { + items[idx].children.doTrieInsert(oldPath[1:], newIndex, noComment) + return + } + if noComment { + items[idx].noComment = noComment + } else { + items[idx].newIndex = newIndex + } +} + +// newPath returns the corrected path of oldPath, given any moves and +// deletions inserted into t. If the item at the given oldPath was deleted +// then nil is returned. Otherwise, the corrected path is returned. If the +// item at oldPath was not moved or deleted, the returned path has the +// same values as oldPath. +func (t *sourcePathsRemapTrie) newPath(oldPath []int32) (path []int32, noComment bool) { + if len(oldPath) == 0 { + // make sure return value is non-nil, so response doesn't + // get confused for "delete this entry" + return []int32{}, false + } + if t == nil { + return oldPath, false + } + newPath := make([]int32, len(oldPath)) + keep, noComment := t.fix(oldPath, newPath) + if !keep { + return nil, false + } + return newPath, noComment +} + +func (t *sourcePathsRemapTrie) fix(oldPath, newPath []int32) (keep, noComment bool) { + items := *t + searchIndex := oldPath[0] + idx, found := sort.Find(len(items), func(i int) int { + return int(searchIndex - items[i].oldIndex) + }) + if !found { + copy(newPath, oldPath) + return true, false + } + item := items[idx] + if item.newIndex == -1 { + return false, false + } + newPath[0] = item.newIndex + if len(oldPath) > 1 { + if item.newIndex == -1 { + newPath[0] = item.oldIndex + } + return item.children.fix(oldPath[1:], newPath[1:]) + } + return true, item.noComment +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap_test.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap_test.go new file mode 100644 index 000000000..990024d20 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap_test.go @@ -0,0 +1,211 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimageutil + +import ( + "fmt" + "math/rand" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestSourcePathsRemapTrie_Insert(t *testing.T) { + t.Parallel() + expectedSlices := [][]string{ + {"4"}, + {"4", "1 -> -1"}, + {"4", "2 -> 1"}, + {"4", "2 -> 1", "2"}, + {"4", "2 -> 1", "2", "0 -> -1"}, + {"4", "2 -> 1", "2", "1 -> 0"}, + {"4", "2 -> 1", "2", "1 -> 0", "8"}, + {"4", "2 -> 1", "2", "1 -> 0", "8", "3 -> -1"}, + {"4", "2 -> 1", "2", "1 -> 0", "8", "4 -> -1"}, + {"4", "2 -> 1", "2", "1 -> 0", "8", "5 -> 3"}, + {"4", "2 -> 1", "2", "1 -> 0", "8", "6 -> 4"}, + {"4", "2 -> 1", "2", "1 -> 0", "8", "7 -> 5"}, + {"4", "3 -> 2"}, + {"4", "4 -> 3"}, + {"4", "5 -> -1"}, + } + t.Run("in order", func(t *testing.T) { + t.Parallel() + trie := createTrie(nil) + slices := asSlices(trie) + require.Equal(t, expectedSlices, slices) + }) + // shuffle a few times and make sure the trie is always constructed correctly + for i := 0; i < 5; i++ { + rnd := rand.New(rand.NewSource(int64(i))) + t.Run(fmt.Sprintf("random order %d", i), func(t *testing.T) { + t.Parallel() + trie := createTrie(func(ops []insertionOp) []insertionOp { + shuffle(rnd, ops) + return ops + }) + slices := asSlices(trie) + require.Equal(t, expectedSlices, slices) + }) + } +} + +func TestSourcePathsRemapTrie_NewPath(t *testing.T) { + t.Parallel() + trie := createTrie(nil) + // make sure the items in the trie construct correct new path + path, noComment := trie.newPath([]int32{4, 1}) + require.Nil(t, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 2}) + require.Equal(t, []int32{4, 1}, path) + require.True(t, noComment) + path, noComment = trie.newPath([]int32{4, 2, 2, 0}) + require.Nil(t, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 2, 2, 1}) + require.Equal(t, []int32{4, 1, 2, 0}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 3}) + require.Nil(t, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 4}) + require.Nil(t, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 5}) + require.Equal(t, []int32{4, 1, 2, 0, 8, 3}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 6}) + require.Equal(t, []int32{4, 1, 2, 0, 8, 4}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 7}) + require.Equal(t, []int32{4, 1, 2, 0, 8, 5}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 3}) + require.Equal(t, []int32{4, 2}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 4}) + require.Equal(t, []int32{4, 3}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 5}) + require.Nil(t, path) + require.False(t, noComment) + + // items not in the trie or not re-written remain unchanged + path, noComment = trie.newPath([]int32{0, 1, 2, 3}) + require.Equal(t, []int32{0, 1, 2, 3}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 0, 3, 2, 8, 5}) + require.Equal(t, []int32{4, 0, 3, 2, 8, 5}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 6}) + require.Equal(t, []int32{4, 6}, path) + require.False(t, noComment) + // items that are descendants of re-written items are also changed + path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 5, 5, 9, 4, 4}) + require.Equal(t, []int32{4, 1, 2, 0, 8, 3, 5, 9, 4, 4}, path) + require.False(t, noComment) + path, noComment = trie.newPath([]int32{4, 4, 9, 4, 3, 5}) + require.Equal(t, []int32{4, 3, 9, 4, 3, 5}, path) + require.False(t, noComment) + // items that are descendants of deleted items are also deleted + path, noComment = trie.newPath([]int32{4, 5, 1, 3, 4, 5}) + require.Nil(t, path) + require.False(t, noComment) +} + +type insertionOp struct { + oldPath []int32 + newIndex int32 +} + +func createTrie(permutation func([]insertionOp) []insertionOp) *sourcePathsRemapTrie { + // Test data has the following source info path changes + // 4,1 -> deleted + // 4,2 -> 4,1 *no comment + // 4,2,2,0 -> deleted + // 4,2,2,1 -> 4,1,2,0 + // 4,2,2,1,8,3 -> deleted + // 4,2,2,1,8,4 -> deleted + // 4,2,2,1,8,5 -> 4,1,2,0,8,3 + // 4,2,2,1,8,6 -> 4,1,2,0,8,4 + // 4,2,2,1,8,7 -> 4,1,2,0,8,5 + // 4,3 -> 4,2 + // 4,4 -> 4,3 + // 4,5 -> deleted + // Test data is sorted (unless permutation function rearranges) + ops := []insertionOp{ + {[]int32{4, 1}, -1}, + {[]int32{4, 2}, 1}, + {[]int32{4, 2}, -2}, + {[]int32{4, 2, 2, 0}, -1}, + {[]int32{4, 2, 2, 1}, 0}, + {[]int32{4, 2, 2, 1, 8, 3}, -1}, + {[]int32{4, 2, 2, 1, 8, 4}, -1}, + {[]int32{4, 2, 2, 1, 8, 5}, 3}, + {[]int32{4, 2, 2, 1, 8, 6}, 4}, + {[]int32{4, 2, 2, 1, 8, 7}, 5}, + {[]int32{4, 3}, 2}, + {[]int32{4, 4}, 3}, + {[]int32{4, 5}, -1}, + } + if permutation != nil { + ops = permutation(ops) + } + trie := &sourcePathsRemapTrie{} + for _, op := range ops { + if op.newIndex == -2 { + trie.markNoComment(op.oldPath) + continue + } + trie.markMoved(op.oldPath, op.newIndex) + } + return trie +} + +func shuffle[T any](rnd *rand.Rand, slice []T) { + for i := range slice { + pick := rnd.Intn(len(slice)-i) + i + if i != pick { + slice[i], slice[pick] = slice[pick], slice[i] + } + } +} + +func asSlices(t *sourcePathsRemapTrie) [][]string { + var result [][]string + for _, child := range *t { + toSlices(child, nil, &result) + } + return result +} + +func toSlices(t *sourcePathsRemapTrieNode, soFar []string, result *[][]string) { + if t.oldIndex == t.newIndex { + soFar = append(soFar, fmt.Sprintf("%d", t.oldIndex)) + } else { + soFar = append(soFar, fmt.Sprintf("%d -> %d", t.oldIndex, t.newIndex)) + } + clone := make([]string, len(soFar)) + copy(clone, soFar) + *result = append(*result, clone) + if len(t.children) == 0 { + return + } + for _, child := range t.children { + toSlices(child, soFar, result) + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/tags.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/tags.go new file mode 100644 index 000000000..da85cfe66 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/tags.go @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimageutil + +const ( + // These constants are tag numbers for fields of messages in descriptor.proto. + // We use them to construct source code info paths, which must be re-written + // when we filter out elements of an image. + + fileDependencyTag = 3 + filePublicDependencyTag = 10 + fileWeakDependencyTag = 11 + fileMessagesTag = 4 + fileEnumsTag = 5 + fileServicesTag = 6 + fileExtensionsTag = 7 + messageFieldsTag = 2 + messageNestedMessagesTag = 3 + messageEnumsTag = 4 + messageExtensionsTag = 6 + messageOneofsTag = 8 + messageExtensionRangesTag = 5 + messageReservedRangesTag = 9 + messageReservedNamesTag = 10 + enumValuesTag = 2 + serviceMethodsTag = 2 +) diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/a.proto new file mode 100644 index 000000000..db4f2af00 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/a.proto @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.MessageOptions { + google.protobuf.Any extra = 10101; + AnyInField extra_in_field = 10102; + AnyInList extra_in_list = 10103; + AnyInMap extra_in_map = 10104; +} + +message AnyInField { + google.protobuf.Any any = 1; +} + +message AnyInList { + repeated google.protobuf.Any list_any = 1; +} + +message AnyInMap { + map map = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/b.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/b.proto new file mode 100644 index 000000000..c52b6782b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/b.proto @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.baz; + +message Foo { + string name = 1; + int32 id = 2; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.proto new file mode 100644 index 000000000..9c6b01784 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.proto @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "a.proto"; +import "b.proto"; + +message ExtendedAnySyntax { + option (extra) = { + [type.googleapis.com/foo.bar.baz.Foo]: { + name: "Bob Loblaw" + id: 42 + } + }; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.txtar new file mode 100644 index 000000000..dcde9a132 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.txtar @@ -0,0 +1,69 @@ +-- a.proto -- +syntax = "proto3"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; +extend google.protobuf.MessageOptions { + google.protobuf.Any extra = 10101; +} +-- b.proto -- +syntax = "proto3"; +package foo.bar.baz; +message Foo { + string name = 1; + int32 id = 2; +} +-- c1.proto -- +syntax = "proto3"; +import "a.proto"; +import "b.proto"; +message ExtendedAnySyntax { + option (extra) = { + [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } + }; +} +-- google/protobuf/any.proto -- +syntax = "proto3"; +package google.protobuf; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; +option java_multiple_files = true; +option java_outer_classname = "AnyProto"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +message Any { + string type_url = 1; + bytes value = 2; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.proto new file mode 100644 index 000000000..ac7dd0999 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "a.proto"; +import "b.proto"; + +message ExtendedAnySyntax_InField { + option (extra_in_field) = { + any: { + [type.googleapis.com/foo.bar.baz.Foo]: { + name: "Bob Loblaw" + id: 42 + } + } + }; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.txtar new file mode 100644 index 000000000..55249e9be --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.txtar @@ -0,0 +1,74 @@ +-- a.proto -- +syntax = "proto3"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; +message AnyInField { + google.protobuf.Any any = 1; +} +extend google.protobuf.MessageOptions { + AnyInField extra_in_field = 10102; +} +-- b.proto -- +syntax = "proto3"; +package foo.bar.baz; +message Foo { + string name = 1; + int32 id = 2; +} +-- c2.proto -- +syntax = "proto3"; +import "a.proto"; +import "b.proto"; +message ExtendedAnySyntax_InField { + option (extra_in_field) = { + any: { + [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } + } + }; +} +-- google/protobuf/any.proto -- +syntax = "proto3"; +package google.protobuf; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; +option java_multiple_files = true; +option java_outer_classname = "AnyProto"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +message Any { + string type_url = 1; + bytes value = 2; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.proto new file mode 100644 index 000000000..7f60d196b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "a.proto"; +import "b.proto"; + +message ExtendedAnySyntax_InList { + option (extra_in_list) = { + list_any: { + [type.googleapis.com/ExtendedAnySyntax_InList]: {} + } + list_any: { + [type.googleapis.com/foo.bar.baz.Foo]: { + name: "Bob Loblaw" + id: 42 + } + } + }; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.txtar new file mode 100644 index 000000000..8810e901a --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.txtar @@ -0,0 +1,79 @@ +-- a.proto -- +syntax = "proto3"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; +message AnyInList { + repeated google.protobuf.Any list_any = 1; +} +extend google.protobuf.MessageOptions { + AnyInList extra_in_list = 10103; +} +-- b.proto -- +syntax = "proto3"; +package foo.bar.baz; +message Foo { + string name = 1; + int32 id = 2; +} +-- c3.proto -- +syntax = "proto3"; +import "a.proto"; +import "b.proto"; +message ExtendedAnySyntax_InList { + option (extra_in_list) = { + list_any: [ + { + [type.googleapis.com/ExtendedAnySyntax_InList]: { } + }, + { + [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } + } + ] + }; +} +-- google/protobuf/any.proto -- +syntax = "proto3"; +package google.protobuf; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; +option java_multiple_files = true; +option java_outer_classname = "AnyProto"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +message Any { + string type_url = 1; + bytes value = 2; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.proto new file mode 100644 index 000000000..33ab273a2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.proto @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "a.proto"; +import "b.proto"; + +message ExtendedAnySyntax_InMap { + option (extra_in_map) = { + map: [ + { + key: "foo" + value: { + any: { + [type.googleapis.com/ExtendedAnySyntax_InMap]: {} + } + } + }, + { + key: "bar" + value: { + any: { + [type.googleapis.com/foo.bar.baz.Foo]: { + name: "Bob Loblaw" + id: 42 + } + } + } + } + ] + }; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.txtar new file mode 100644 index 000000000..169d5ec24 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.txtar @@ -0,0 +1,92 @@ +-- a.proto -- +syntax = "proto3"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; +message AnyInField { + google.protobuf.Any any = 1; +} +message AnyInMap { + map map = 1; +} +extend google.protobuf.MessageOptions { + AnyInMap extra_in_map = 10104; +} +-- b.proto -- +syntax = "proto3"; +package foo.bar.baz; +message Foo { + string name = 1; + int32 id = 2; +} +-- c4.proto -- +syntax = "proto3"; +import "a.proto"; +import "b.proto"; +message ExtendedAnySyntax_InMap { + option (extra_in_map) = { + map: [ + { + key: "bar", + value: { + any: { + [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } + } + } + }, + { + key: "foo", + value: { + any: { + [type.googleapis.com/ExtendedAnySyntax_InMap]: { } + } + } + } + ] + }; +} +-- google/protobuf/any.proto -- +syntax = "proto3"; +package google.protobuf; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; +option java_multiple_files = true; +option java_outer_classname = "AnyProto"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +message Any { + string type_url = 1; + bytes value = 2; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.proto new file mode 100644 index 000000000..1db57f72e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "a.proto"; + +message NormalMessageSyntaxValidType { + option (extra) = { + type_url: "type.googleapis.com/foo.bar.baz.Foo" + value: "\x0a\x0a\x42\x6f\x62\x20\x4c\x6f\x62\x6c\x61\x77\x10\x2a" + }; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.txtar new file mode 100644 index 000000000..c8d3538d6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.txtar @@ -0,0 +1,69 @@ +-- a.proto -- +syntax = "proto3"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; +extend google.protobuf.MessageOptions { + google.protobuf.Any extra = 10101; +} +-- b.proto -- +syntax = "proto3"; +package foo.bar.baz; +message Foo { + string name = 1; + int32 id = 2; +} +-- d.proto -- +syntax = "proto3"; +import "a.proto"; +import "b.proto"; +message NormalMessageSyntaxValidType { + option (extra) = { + [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } + }; +} +-- google/protobuf/any.proto -- +syntax = "proto3"; +package google.protobuf; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; +option java_multiple_files = true; +option java_outer_classname = "AnyProto"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +message Any { + string type_url = 1; + bytes value = 2; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.proto new file mode 100644 index 000000000..6dfb315a2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.proto @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "a.proto"; + +message NormalMessageSyntaxInvalidType { + option (extra) = { + type_url: "type.googleapis.com/blah.blah.Blah" + value: "\x01\x02\x03\x04" + }; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.txtar new file mode 100644 index 000000000..a8a3669a7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.txtar @@ -0,0 +1,59 @@ +-- a.proto -- +syntax = "proto3"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; +extend google.protobuf.MessageOptions { + google.protobuf.Any extra = 10101; +} +-- e.proto -- +syntax = "proto3"; +import "a.proto"; +message NormalMessageSyntaxInvalidType { + option (extra) = { type_url: "type.googleapis.com/blah.blah.Blah", value: "\001\002\003\004" }; +} +-- google/protobuf/any.proto -- +syntax = "proto3"; +package google.protobuf; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; +option java_multiple_files = true; +option java_outer_classname = "AnyProto"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +message Any { + string type_url = 1; + bytes value = 2; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/a.proto new file mode 100644 index 000000000..b170923bf --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/a.proto @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; +package pkg; + +message Foo { + optional string a = 1; + optional Foo b = 2; + extensions 10 to max; +} + +extend Foo { + optional string extended = 11; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/b.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/b.proto new file mode 100644 index 000000000..b24394b1f --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/b.proto @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; +package other; +import "a.proto"; + +message Embedded { + extend pkg.Foo { + optional Embedded from_other_file = 12; + } + + optional string foo = 1; +} + +message Referenced { + optional string x = 1; +} + +extend pkg.Foo { + optional Referenced from_other_file = 13; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions-excluded.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions-excluded.txtar new file mode 100644 index 000000000..d5d4528e9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions-excluded.txtar @@ -0,0 +1,8 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +message Foo { + optional string a = 1; + optional Foo b = 2; + extensions 10 to max; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions.txtar new file mode 100644 index 000000000..c3a1965db --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions.txtar @@ -0,0 +1,27 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +message Foo { + optional string a = 1; + optional Foo b = 2; + extensions 10 to max; +} +extend Foo { + optional string extended = 11; +} +-- b.proto -- +syntax = "proto2"; +package other; +import "a.proto"; +message Embedded { + optional string foo = 1; + extend pkg.Foo { + optional Embedded from_other_file = 12; + } +} +message Referenced { + optional string x = 1; +} +extend pkg.Foo { + optional Referenced from_other_file = 13; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/a.proto new file mode 100644 index 000000000..826fde97b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/a.proto @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "regular.proto"; +import weak "weak.proto"; +import public "public.proto"; + +message ImportRegular { + Regular x = 1; +} + +message ImportWeak { + Weak x = 1; +} + +message ImportPublic { + Public x = 1; +} + +message NoImports { + string x = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/noimports.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/noimports.txtar new file mode 100644 index 000000000..1e006a090 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/noimports.txtar @@ -0,0 +1,5 @@ +-- a.proto -- +syntax = "proto3"; +message NoImports { + string x = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/public.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/public.proto new file mode 100644 index 000000000..001d803de --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/public.proto @@ -0,0 +1,17 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Public {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular.proto new file mode 100644 index 000000000..ff6701563 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular.proto @@ -0,0 +1,17 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Regular {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_public.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_public.txtar new file mode 100644 index 000000000..239e32847 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_public.txtar @@ -0,0 +1,18 @@ +-- a.proto -- +syntax = "proto3"; +import "public.proto"; +import "regular.proto"; +message ImportPublic { + Public x = 1; +} +message ImportRegular { + Regular x = 1; +} +-- public.proto -- +syntax = "proto3"; +message Public { +} +-- regular.proto -- +syntax = "proto3"; +message Regular { +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_weak.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_weak.txtar new file mode 100644 index 000000000..044fa6209 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_weak.txtar @@ -0,0 +1,18 @@ +-- a.proto -- +syntax = "proto3"; +import "regular.proto"; +import weak "weak.proto"; +message ImportRegular { + Regular x = 1; +} +message ImportWeak { + Weak x = 1; +} +-- regular.proto -- +syntax = "proto3"; +message Regular { +} +-- weak.proto -- +syntax = "proto3"; +message Weak { +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak.proto new file mode 100644 index 000000000..54ba30be9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak.proto @@ -0,0 +1,17 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +message Weak {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak_public.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak_public.txtar new file mode 100644 index 000000000..09433d551 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak_public.txtar @@ -0,0 +1,18 @@ +-- a.proto -- +syntax = "proto3"; +import "public.proto"; +import weak "weak.proto"; +message ImportPublic { + Public x = 1; +} +message ImportWeak { + Weak x = 1; +} +-- public.proto -- +syntax = "proto3"; +message Public { +} +-- weak.proto -- +syntax = "proto3"; +message Weak { +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/a.proto new file mode 100644 index 000000000..ebb448a38 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/a.proto @@ -0,0 +1,50 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +package pkg; + +message Foo { + message NestedFoo { + message NestedNestedFoo { + string nested_nested_x = 1; + } + string nested_x = 1; + } + + message NestedButNotUsed { + string nested_but_not_used = 1; + } + string x = 1; + NestedFoo nested_foo = 2; +} + +enum FooEnum { + FOO_ENUM_X = 0; + FOO_ENUM_Y = 1; +} + +message Bar { + enum NestedBarEnum { + NESTED_BAR_ENUM_X = 0; + NESTED_BAR_ENUM_Y = 1; + } + FooEnum foo_enum = 1; + Foo.NestedFoo nested_foo = 2; +} + +message Baz { + Bar.NestedBarEnum nested_bar_enum = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/enum.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/enum.txtar new file mode 100644 index 000000000..36b9f3da9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/enum.txtar @@ -0,0 +1,7 @@ +-- a.proto -- +syntax = "proto3"; +package pkg; +enum FooEnum { + FOO_ENUM_X = 0; + FOO_ENUM_Y = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/message.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/message.txtar new file mode 100644 index 000000000..0c02c7645 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/message.txtar @@ -0,0 +1,10 @@ +-- a.proto -- +syntax = "proto3"; +package pkg; +message Foo { + string x = 1; + NestedFoo nested_foo = 2; + message NestedFoo { + string nested_x = 1; + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/recursenested.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/recursenested.txtar new file mode 100644 index 000000000..4fe6961c8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/recursenested.txtar @@ -0,0 +1,10 @@ +-- a.proto -- +syntax = "proto3"; +package pkg; +message Foo { + message NestedFoo { + message NestedNestedFoo { + string nested_nested_x = 1; + } + } +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/usingother.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/usingother.txtar new file mode 100644 index 000000000..83eada7da --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/usingother.txtar @@ -0,0 +1,12 @@ +-- a.proto -- +syntax = "proto3"; +package pkg; +message Bar { + enum NestedBarEnum { + NESTED_BAR_ENUM_X = 0; + NESTED_BAR_ENUM_Y = 1; + } +} +message Baz { + Bar.NestedBarEnum nested_bar_enum = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/Files.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/Files.txtar new file mode 100644 index 000000000..68ef47716 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/Files.txtar @@ -0,0 +1,314 @@ +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message DescriptorProto { + optional string name = 1; + repeated FieldDescriptorProto field = 2; + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + repeated ExtensionRange extension_range = 5; + repeated FieldDescriptorProto extension = 6; + optional MessageOptions options = 7; + repeated OneofDescriptorProto oneof_decl = 8; + repeated ReservedRange reserved_range = 9; + repeated string reserved_name = 10; + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + optional ExtensionRangeOptions options = 3; + } + message ReservedRange { + optional int32 start = 1; + optional int32 end = 2; + } +} +message EnumDescriptorProto { + optional string name = 1; + repeated EnumValueDescriptorProto value = 2; + optional EnumOptions options = 3; + repeated EnumReservedRange reserved_range = 4; + repeated string reserved_name = 5; + message EnumReservedRange { + optional int32 start = 1; + optional int32 end = 2; + } +} +message EnumOptions { + optional bool allow_alias = 2; + optional bool deprecated = 3 [default = false]; + optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 5; +} +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + optional EnumValueOptions options = 3; +} +message EnumValueOptions { + optional bool deprecated = 1 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message ExtensionRangeOptions { + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message FieldDescriptorProto { + optional string name = 1; + optional string extendee = 2; + optional int32 number = 3; + optional Label label = 4; + optional Type type = 5; + optional string type_name = 6; + optional string default_value = 7; + optional FieldOptions options = 8; + optional int32 oneof_index = 9; + optional string json_name = 10; + optional bool proto3_optional = 17; + enum Label { + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + } + enum Type { + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; + TYPE_SINT64 = 18; + } +} +message FieldOptions { + optional CType ctype = 1 [default = STRING]; + optional bool packed = 2; + optional bool deprecated = 3 [default = false]; + optional bool lazy = 5 [default = false]; + optional JSType jstype = 6 [default = JS_NORMAL]; + optional bool weak = 10 [default = false]; + optional bool unverified_lazy = 15 [default = false]; + optional bool debug_redact = 16 [default = false]; + optional OptionRetention retention = 17; + optional OptionTargetType target = 18; + repeated UninterpretedOption uninterpreted_option = 999; + enum CType { + STRING = 0; + CORD = 1; + STRING_PIECE = 2; + } + enum JSType { + JS_NORMAL = 0; + JS_STRING = 1; + JS_NUMBER = 2; + } + enum OptionRetention { + RETENTION_UNKNOWN = 0; + RETENTION_RUNTIME = 1; + RETENTION_SOURCE = 2; + } + enum OptionTargetType { + TARGET_TYPE_UNKNOWN = 0; + TARGET_TYPE_FILE = 1; + TARGET_TYPE_EXTENSION_RANGE = 2; + TARGET_TYPE_MESSAGE = 3; + TARGET_TYPE_FIELD = 4; + TARGET_TYPE_ONEOF = 5; + TARGET_TYPE_ENUM = 6; + TARGET_TYPE_ENUM_ENTRY = 7; + TARGET_TYPE_SERVICE = 8; + TARGET_TYPE_METHOD = 9; + } + extensions 1000 to max; + reserved 4; +} +message FileDescriptorProto { + optional string name = 1; + optional string package = 2; + repeated string dependency = 3; + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + optional FileOptions options = 8; + optional SourceCodeInfo source_code_info = 9; + repeated int32 public_dependency = 10; + repeated int32 weak_dependency = 11; + optional string syntax = 12; + optional string edition = 13; +} +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} +message FileOptions { + optional string java_package = 1; + optional string java_outer_classname = 8; + optional OptimizeMode optimize_for = 9 [default = SPEED]; + optional bool java_multiple_files = 10 [default = false]; + optional string go_package = 11; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool deprecated = 23 [default = false]; + optional bool java_string_check_utf8 = 27 [default = false]; + optional bool cc_enable_arenas = 31 [default = true]; + optional string objc_class_prefix = 36; + optional string csharp_namespace = 37; + optional string swift_prefix = 39; + optional string php_class_prefix = 40; + optional string php_namespace = 41; + optional bool php_generic_services = 42 [default = false]; + optional string php_metadata_namespace = 44; + optional string ruby_package = 45; + repeated UninterpretedOption uninterpreted_option = 999; + enum OptimizeMode { + SPEED = 1; + CODE_SIZE = 2; + LITE_RUNTIME = 3; + } + extensions 1000 to max; + reserved 38; +} +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message MethodDescriptorProto { + optional string name = 1; + optional string input_type = 2; + optional string output_type = 3; + optional MethodOptions options = 4; + optional bool client_streaming = 5 [default = false]; + optional bool server_streaming = 6 [default = false]; +} +message MethodOptions { + optional bool deprecated = 33 [default = false]; + optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + repeated UninterpretedOption uninterpreted_option = 999; + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; + IDEMPOTENT = 2; + } + extensions 1000 to max; +} +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} +message OneofOptions { + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + optional ServiceOptions options = 3; +} +message ServiceOptions { + optional bool deprecated = 33 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message SourceCodeInfo { + repeated Location location = 1; + message Location { + repeated int32 path = 1 [packed = true]; + repeated int32 span = 2 [packed = true]; + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +message Files { + google.protobuf.FileDescriptorSet files = 1; +} +message UnusedOption { + string foo = 1; +} +message UsedOption { + string foo = 1; + extend google.protobuf.FileOptions { + optional UsedOption file_foo = 50000; + optional UnusedOption file_bar = 50001; + optional string file_baz = 50002; + } +} +extend google.protobuf.EnumOptions { + optional UsedOption enum_foo = 50000; + optional UnusedOption enum_bar = 50001; + optional string enum_baz = 50002; +} +extend google.protobuf.EnumValueOptions { + optional UsedOption enum_value_foo = 50000; + optional UnusedOption enum_value_bar = 50001; + optional string enum_value_baz = 50002; +} +extend google.protobuf.FieldOptions { + optional UsedOption field_foo = 50000; + optional UnusedOption field_bar = 50001; + optional string field_baz = 50002; +} +extend google.protobuf.MessageOptions { + optional UsedOption message_foo = 50000; + optional UnusedOption message_bar = 50001; + optional string message_baz = 50002; +} +extend google.protobuf.MethodOptions { + optional UsedOption method_foo = 50000; + optional UnusedOption method_bar = 50001; + optional string method_baz = 50002; +} +extend google.protobuf.OneofOptions { + optional UsedOption oneof_foo = 50000; + optional UnusedOption oneof_bar = 50001; + optional string oneof_baz = 50002; +} +extend google.protobuf.ServiceOptions { + optional UsedOption service_foo = 50000; + optional UnusedOption service_bar = 50001; + optional string service_baz = 50002; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/a.proto new file mode 100644 index 000000000..5f9d243a4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/a.proto @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; +package pkg; +import "options.proto"; + +option (UsedOption.file_foo).foo = "str"; +option (UsedOption.file_baz) = "str"; + +message Foo { + option (message_foo).foo = "str"; + option (message_baz) = "str"; + + optional string foo = 1 [ + (field_foo).foo = "str", + (field_baz) = "str", + jstype = JS_STRING + ]; + + oneof testOneof { + option (oneof_foo).foo = "str"; + option (oneof_baz) = "str"; + + string bar = 2; + bytes baz = 3; + } + + extensions 10 to max; +} + +enum FooEnum { + option (enum_foo).foo = "str"; + option (enum_baz) = "str"; + option deprecated = true; + + FOO_ENUM_X = 0; + FOO_ENUM_Y = 1 [ + (enum_value_foo).foo = "str", + (enum_value_baz) = "str" + ]; +} + +message Empty{} + +service FooService { + option (service_foo).foo = "str"; + option (service_baz) = "str"; + + rpc Do(Empty) returns (Empty) { + option (method_foo).foo = "str"; + option (method_baz) = "str"; + }; + + rpc DoNot(Empty) returns (Empty) { + option (method_foo).foo = "str"; + option (method_baz) = "str"; + }; +} + +extend Foo { + optional string extension = 11 [ + (field_foo).foo = "str", + (field_baz) = "str" + ]; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-exclude-options.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-exclude-options.txtar new file mode 100644 index 000000000..052623406 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-exclude-options.txtar @@ -0,0 +1,25 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +message Empty { +} +message Foo { + optional string foo = 1 [jstype = JS_STRING]; + oneof testOneof { + string bar = 2; + bytes baz = 3; + } + extensions 10 to max; +} +enum FooEnum { + option deprecated = true; + FOO_ENUM_X = 0; + FOO_ENUM_Y = 1; +} +service FooService { + rpc Do ( Empty ) returns ( Empty ); + rpc DoNot ( Empty ) returns ( Empty ); +} +extend Foo { + optional string extension = 11; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-with-Files.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-with-Files.txtar new file mode 100644 index 000000000..96c065f61 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-with-Files.txtar @@ -0,0 +1,363 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +import "options.proto"; +option (UsedOption.file_baz) = "str"; +option (UsedOption.file_foo) = { foo: "str" }; +message Empty { +} +message Foo { + option (message_baz) = "str"; + option (message_foo) = { foo: "str" }; + optional string foo = 1 [ + jstype = JS_STRING, + (field_baz) = "str", + (field_foo) = { foo: "str" } + ]; + oneof testOneof { + option (oneof_baz) = "str"; + option (oneof_foo) = { foo: "str" }; + string bar = 2; + bytes baz = 3; + } + extensions 10 to max; +} +enum FooEnum { + option deprecated = true; + option (enum_baz) = "str"; + option (enum_foo) = { foo: "str" }; + FOO_ENUM_X = 0; + FOO_ENUM_Y = 1 [ + (enum_value_baz) = "str", + (enum_value_foo) = { foo: "str" } + ]; +} +service FooService { + option (service_baz) = "str"; + option (service_foo) = { foo: "str" }; + rpc Do ( Empty ) returns ( Empty ) { + option (method_baz) = "str"; + option (method_foo) = { foo: "str" }; + } + rpc DoNot ( Empty ) returns ( Empty ) { + option (method_baz) = "str"; + option (method_foo) = { foo: "str" }; + } +} +extend Foo { + optional string extension = 11 [(field_baz) = "str", (field_foo) = { foo: "str" }]; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message DescriptorProto { + optional string name = 1; + repeated FieldDescriptorProto field = 2; + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + repeated ExtensionRange extension_range = 5; + repeated FieldDescriptorProto extension = 6; + optional MessageOptions options = 7; + repeated OneofDescriptorProto oneof_decl = 8; + repeated ReservedRange reserved_range = 9; + repeated string reserved_name = 10; + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + optional ExtensionRangeOptions options = 3; + } + message ReservedRange { + optional int32 start = 1; + optional int32 end = 2; + } +} +message EnumDescriptorProto { + optional string name = 1; + repeated EnumValueDescriptorProto value = 2; + optional EnumOptions options = 3; + repeated EnumReservedRange reserved_range = 4; + repeated string reserved_name = 5; + message EnumReservedRange { + optional int32 start = 1; + optional int32 end = 2; + } +} +message EnumOptions { + optional bool allow_alias = 2; + optional bool deprecated = 3 [default = false]; + optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 5; +} +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + optional EnumValueOptions options = 3; +} +message EnumValueOptions { + optional bool deprecated = 1 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message ExtensionRangeOptions { + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message FieldDescriptorProto { + optional string name = 1; + optional string extendee = 2; + optional int32 number = 3; + optional Label label = 4; + optional Type type = 5; + optional string type_name = 6; + optional string default_value = 7; + optional FieldOptions options = 8; + optional int32 oneof_index = 9; + optional string json_name = 10; + optional bool proto3_optional = 17; + enum Label { + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + } + enum Type { + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; + TYPE_SINT64 = 18; + } +} +message FieldOptions { + optional CType ctype = 1 [default = STRING]; + optional bool packed = 2; + optional bool deprecated = 3 [default = false]; + optional bool lazy = 5 [default = false]; + optional JSType jstype = 6 [default = JS_NORMAL]; + optional bool weak = 10 [default = false]; + optional bool unverified_lazy = 15 [default = false]; + optional bool debug_redact = 16 [default = false]; + optional OptionRetention retention = 17; + optional OptionTargetType target = 18; + repeated UninterpretedOption uninterpreted_option = 999; + enum CType { + STRING = 0; + CORD = 1; + STRING_PIECE = 2; + } + enum JSType { + JS_NORMAL = 0; + JS_STRING = 1; + JS_NUMBER = 2; + } + enum OptionRetention { + RETENTION_UNKNOWN = 0; + RETENTION_RUNTIME = 1; + RETENTION_SOURCE = 2; + } + enum OptionTargetType { + TARGET_TYPE_UNKNOWN = 0; + TARGET_TYPE_FILE = 1; + TARGET_TYPE_EXTENSION_RANGE = 2; + TARGET_TYPE_MESSAGE = 3; + TARGET_TYPE_FIELD = 4; + TARGET_TYPE_ONEOF = 5; + TARGET_TYPE_ENUM = 6; + TARGET_TYPE_ENUM_ENTRY = 7; + TARGET_TYPE_SERVICE = 8; + TARGET_TYPE_METHOD = 9; + } + extensions 1000 to max; + reserved 4; +} +message FileDescriptorProto { + optional string name = 1; + optional string package = 2; + repeated string dependency = 3; + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + optional FileOptions options = 8; + optional SourceCodeInfo source_code_info = 9; + repeated int32 public_dependency = 10; + repeated int32 weak_dependency = 11; + optional string syntax = 12; + optional string edition = 13; +} +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} +message FileOptions { + optional string java_package = 1; + optional string java_outer_classname = 8; + optional OptimizeMode optimize_for = 9 [default = SPEED]; + optional bool java_multiple_files = 10 [default = false]; + optional string go_package = 11; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool deprecated = 23 [default = false]; + optional bool java_string_check_utf8 = 27 [default = false]; + optional bool cc_enable_arenas = 31 [default = true]; + optional string objc_class_prefix = 36; + optional string csharp_namespace = 37; + optional string swift_prefix = 39; + optional string php_class_prefix = 40; + optional string php_namespace = 41; + optional bool php_generic_services = 42 [default = false]; + optional string php_metadata_namespace = 44; + optional string ruby_package = 45; + repeated UninterpretedOption uninterpreted_option = 999; + enum OptimizeMode { + SPEED = 1; + CODE_SIZE = 2; + LITE_RUNTIME = 3; + } + extensions 1000 to max; + reserved 38; +} +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message MethodDescriptorProto { + optional string name = 1; + optional string input_type = 2; + optional string output_type = 3; + optional MethodOptions options = 4; + optional bool client_streaming = 5 [default = false]; + optional bool server_streaming = 6 [default = false]; +} +message MethodOptions { + optional bool deprecated = 33 [default = false]; + optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + repeated UninterpretedOption uninterpreted_option = 999; + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; + IDEMPOTENT = 2; + } + extensions 1000 to max; +} +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} +message OneofOptions { + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + optional ServiceOptions options = 3; +} +message ServiceOptions { + optional bool deprecated = 33 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message SourceCodeInfo { + repeated Location location = 1; + message Location { + repeated int32 path = 1 [packed = true]; + repeated int32 span = 2 [packed = true]; + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +message Files { + google.protobuf.FileDescriptorSet files = 1; +} +message UnusedOption { + string foo = 1; +} +message UsedOption { + string foo = 1; + extend google.protobuf.FileOptions { + optional UsedOption file_foo = 50000; + optional UnusedOption file_bar = 50001; + optional string file_baz = 50002; + } +} +extend google.protobuf.EnumOptions { + optional UsedOption enum_foo = 50000; + optional UnusedOption enum_bar = 50001; + optional string enum_baz = 50002; +} +extend google.protobuf.EnumValueOptions { + optional UsedOption enum_value_foo = 50000; + optional UnusedOption enum_value_bar = 50001; + optional string enum_value_baz = 50002; +} +extend google.protobuf.FieldOptions { + optional UsedOption field_foo = 50000; + optional UnusedOption field_bar = 50001; + optional string field_baz = 50002; +} +extend google.protobuf.MessageOptions { + optional UsedOption message_foo = 50000; + optional UnusedOption message_bar = 50001; + optional string message_baz = 50002; +} +extend google.protobuf.MethodOptions { + optional UsedOption method_foo = 50000; + optional UnusedOption method_bar = 50001; + optional string method_baz = 50002; +} +extend google.protobuf.OneofOptions { + optional UsedOption oneof_foo = 50000; + optional UnusedOption oneof_bar = 50001; + optional string oneof_baz = 50002; +} +extend google.protobuf.ServiceOptions { + optional UsedOption service_foo = 50000; + optional UnusedOption service_bar = 50001; + optional string service_baz = 50002; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all.txtar new file mode 100644 index 000000000..a8c47bfac --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all.txtar @@ -0,0 +1,225 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +import "options.proto"; +option (UsedOption.file_baz) = "str"; +option (UsedOption.file_foo) = { foo: "str" }; +message Empty { +} +message Foo { + option (message_baz) = "str"; + option (message_foo) = { foo: "str" }; + optional string foo = 1 [ + jstype = JS_STRING, + (field_baz) = "str", + (field_foo) = { foo: "str" } + ]; + oneof testOneof { + option (oneof_baz) = "str"; + option (oneof_foo) = { foo: "str" }; + string bar = 2; + bytes baz = 3; + } + extensions 10 to max; +} +enum FooEnum { + option deprecated = true; + option (enum_baz) = "str"; + option (enum_foo) = { foo: "str" }; + FOO_ENUM_X = 0; + FOO_ENUM_Y = 1 [ + (enum_value_baz) = "str", + (enum_value_foo) = { foo: "str" } + ]; +} +service FooService { + option (service_baz) = "str"; + option (service_foo) = { foo: "str" }; + rpc Do ( Empty ) returns ( Empty ) { + option (method_baz) = "str"; + option (method_foo) = { foo: "str" }; + } + rpc DoNot ( Empty ) returns ( Empty ) { + option (method_baz) = "str"; + option (method_foo) = { foo: "str" }; + } +} +extend Foo { + optional string extension = 11 [(field_baz) = "str", (field_foo) = { foo: "str" }]; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message EnumOptions { + optional bool allow_alias = 2; + optional bool deprecated = 3 [default = false]; + optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 5; +} +message EnumValueOptions { + optional bool deprecated = 1 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message FieldOptions { + optional CType ctype = 1 [default = STRING]; + optional bool packed = 2; + optional bool deprecated = 3 [default = false]; + optional bool lazy = 5 [default = false]; + optional JSType jstype = 6 [default = JS_NORMAL]; + optional bool weak = 10 [default = false]; + optional bool unverified_lazy = 15 [default = false]; + optional bool debug_redact = 16 [default = false]; + optional OptionRetention retention = 17; + optional OptionTargetType target = 18; + repeated UninterpretedOption uninterpreted_option = 999; + enum CType { + STRING = 0; + CORD = 1; + STRING_PIECE = 2; + } + enum JSType { + JS_NORMAL = 0; + JS_STRING = 1; + JS_NUMBER = 2; + } + enum OptionRetention { + RETENTION_UNKNOWN = 0; + RETENTION_RUNTIME = 1; + RETENTION_SOURCE = 2; + } + enum OptionTargetType { + TARGET_TYPE_UNKNOWN = 0; + TARGET_TYPE_FILE = 1; + TARGET_TYPE_EXTENSION_RANGE = 2; + TARGET_TYPE_MESSAGE = 3; + TARGET_TYPE_FIELD = 4; + TARGET_TYPE_ONEOF = 5; + TARGET_TYPE_ENUM = 6; + TARGET_TYPE_ENUM_ENTRY = 7; + TARGET_TYPE_SERVICE = 8; + TARGET_TYPE_METHOD = 9; + } + extensions 1000 to max; + reserved 4; +} +message FileOptions { + optional string java_package = 1; + optional string java_outer_classname = 8; + optional OptimizeMode optimize_for = 9 [default = SPEED]; + optional bool java_multiple_files = 10 [default = false]; + optional string go_package = 11; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool deprecated = 23 [default = false]; + optional bool java_string_check_utf8 = 27 [default = false]; + optional bool cc_enable_arenas = 31 [default = true]; + optional string objc_class_prefix = 36; + optional string csharp_namespace = 37; + optional string swift_prefix = 39; + optional string php_class_prefix = 40; + optional string php_namespace = 41; + optional bool php_generic_services = 42 [default = false]; + optional string php_metadata_namespace = 44; + optional string ruby_package = 45; + repeated UninterpretedOption uninterpreted_option = 999; + enum OptimizeMode { + SPEED = 1; + CODE_SIZE = 2; + LITE_RUNTIME = 3; + } + extensions 1000 to max; + reserved 38; +} +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message MethodOptions { + optional bool deprecated = 33 [default = false]; + optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + repeated UninterpretedOption uninterpreted_option = 999; + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; + IDEMPOTENT = 2; + } + extensions 1000 to max; +} +message OneofOptions { + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message ServiceOptions { + optional bool deprecated = 33 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +message UsedOption { + string foo = 1; + extend google.protobuf.FileOptions { + optional UsedOption file_foo = 50000; + optional string file_baz = 50002; + } +} +extend google.protobuf.EnumOptions { + optional UsedOption enum_foo = 50000; + optional string enum_baz = 50002; +} +extend google.protobuf.EnumValueOptions { + optional UsedOption enum_value_foo = 50000; + optional string enum_value_baz = 50002; +} +extend google.protobuf.FieldOptions { + optional UsedOption field_foo = 50000; + optional string field_baz = 50002; +} +extend google.protobuf.MessageOptions { + optional UsedOption message_foo = 50000; + optional string message_baz = 50002; +} +extend google.protobuf.MethodOptions { + optional UsedOption method_foo = 50000; + optional string method_baz = 50002; +} +extend google.protobuf.OneofOptions { + optional UsedOption oneof_foo = 50000; + optional string oneof_baz = 50002; +} +extend google.protobuf.ServiceOptions { + optional UsedOption service_foo = 50000; + optional string service_baz = 50002; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/options.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/options.proto new file mode 100644 index 000000000..d0cad0f7d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/options.proto @@ -0,0 +1,71 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; + +message UnusedOption { + string foo = 1; +} + +message UsedOption { + extend google.protobuf.FileOptions { + optional UsedOption file_foo = 50000; + optional UnusedOption file_bar = 50001; + optional string file_baz = 50002; + } + + string foo = 1; +} + +extend google.protobuf.MessageOptions { + optional UsedOption message_foo = 50000; + optional UnusedOption message_bar = 50001; + optional string message_baz = 50002; +} +extend google.protobuf.FieldOptions { + optional UsedOption field_foo = 50000; + optional UnusedOption field_bar = 50001; + optional string field_baz = 50002; +} +extend google.protobuf.OneofOptions { + optional UsedOption oneof_foo = 50000; + optional UnusedOption oneof_bar = 50001; + optional string oneof_baz = 50002; +} +extend google.protobuf.EnumOptions { + optional UsedOption enum_foo = 50000; + optional UnusedOption enum_bar = 50001; + optional string enum_baz = 50002; +} +extend google.protobuf.EnumValueOptions { + optional UsedOption enum_value_foo = 50000; + optional UnusedOption enum_value_bar = 50001; + optional string enum_value_baz = 50002; +} +extend google.protobuf.ServiceOptions { + optional UsedOption service_foo = 50000; + optional UnusedOption service_bar = 50001; + optional string service_baz = 50002; +} +extend google.protobuf.MethodOptions { + optional UsedOption method_foo = 50000; + optional UnusedOption method_bar = 50001; + optional string method_baz = 50002; +} + +message Files { + google.protobuf.FileDescriptorSet files = 1; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.Foo.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.Foo.txtar new file mode 100644 index 000000000..0859ec338 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.Foo.txtar @@ -0,0 +1,156 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +import "options.proto"; +option (UsedOption.file_baz) = "str"; +option (UsedOption.file_foo) = { foo: "str" }; +message Foo { + option (message_baz) = "str"; + option (message_foo) = { foo: "str" }; + optional string foo = 1 [ + jstype = JS_STRING, + (field_baz) = "str", + (field_foo) = { foo: "str" } + ]; + oneof testOneof { + option (oneof_baz) = "str"; + option (oneof_foo) = { foo: "str" }; + string bar = 2; + bytes baz = 3; + } + extensions 10 to max; +} +extend Foo { + optional string extension = 11 [(field_baz) = "str", (field_foo) = { foo: "str" }]; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message FieldOptions { + optional CType ctype = 1 [default = STRING]; + optional bool packed = 2; + optional bool deprecated = 3 [default = false]; + optional bool lazy = 5 [default = false]; + optional JSType jstype = 6 [default = JS_NORMAL]; + optional bool weak = 10 [default = false]; + optional bool unverified_lazy = 15 [default = false]; + optional bool debug_redact = 16 [default = false]; + optional OptionRetention retention = 17; + optional OptionTargetType target = 18; + repeated UninterpretedOption uninterpreted_option = 999; + enum CType { + STRING = 0; + CORD = 1; + STRING_PIECE = 2; + } + enum JSType { + JS_NORMAL = 0; + JS_STRING = 1; + JS_NUMBER = 2; + } + enum OptionRetention { + RETENTION_UNKNOWN = 0; + RETENTION_RUNTIME = 1; + RETENTION_SOURCE = 2; + } + enum OptionTargetType { + TARGET_TYPE_UNKNOWN = 0; + TARGET_TYPE_FILE = 1; + TARGET_TYPE_EXTENSION_RANGE = 2; + TARGET_TYPE_MESSAGE = 3; + TARGET_TYPE_FIELD = 4; + TARGET_TYPE_ONEOF = 5; + TARGET_TYPE_ENUM = 6; + TARGET_TYPE_ENUM_ENTRY = 7; + TARGET_TYPE_SERVICE = 8; + TARGET_TYPE_METHOD = 9; + } + extensions 1000 to max; + reserved 4; +} +message FileOptions { + optional string java_package = 1; + optional string java_outer_classname = 8; + optional OptimizeMode optimize_for = 9 [default = SPEED]; + optional bool java_multiple_files = 10 [default = false]; + optional string go_package = 11; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool deprecated = 23 [default = false]; + optional bool java_string_check_utf8 = 27 [default = false]; + optional bool cc_enable_arenas = 31 [default = true]; + optional string objc_class_prefix = 36; + optional string csharp_namespace = 37; + optional string swift_prefix = 39; + optional string php_class_prefix = 40; + optional string php_namespace = 41; + optional bool php_generic_services = 42 [default = false]; + optional string php_metadata_namespace = 44; + optional string ruby_package = 45; + repeated UninterpretedOption uninterpreted_option = 999; + enum OptimizeMode { + SPEED = 1; + CODE_SIZE = 2; + LITE_RUNTIME = 3; + } + extensions 1000 to max; + reserved 38; +} +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message OneofOptions { + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +message UsedOption { + string foo = 1; + extend google.protobuf.FileOptions { + optional UsedOption file_foo = 50000; + optional string file_baz = 50002; + } +} +extend google.protobuf.FieldOptions { + optional UsedOption field_foo = 50000; + optional string field_baz = 50002; +} +extend google.protobuf.MessageOptions { + optional UsedOption message_foo = 50000; + optional string message_baz = 50002; +} +extend google.protobuf.OneofOptions { + optional UsedOption oneof_foo = 50000; + optional string oneof_baz = 50002; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooEnum.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooEnum.txtar new file mode 100644 index 000000000..67c79649d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooEnum.txtar @@ -0,0 +1,100 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +import "options.proto"; +option (UsedOption.file_baz) = "str"; +option (UsedOption.file_foo) = { foo: "str" }; +enum FooEnum { + option deprecated = true; + option (enum_baz) = "str"; + option (enum_foo) = { foo: "str" }; + FOO_ENUM_X = 0; + FOO_ENUM_Y = 1 [ + (enum_value_baz) = "str", + (enum_value_foo) = { foo: "str" } + ]; +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message EnumOptions { + optional bool allow_alias = 2; + optional bool deprecated = 3 [default = false]; + optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 5; +} +message EnumValueOptions { + optional bool deprecated = 1 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message FileOptions { + optional string java_package = 1; + optional string java_outer_classname = 8; + optional OptimizeMode optimize_for = 9 [default = SPEED]; + optional bool java_multiple_files = 10 [default = false]; + optional string go_package = 11; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool deprecated = 23 [default = false]; + optional bool java_string_check_utf8 = 27 [default = false]; + optional bool cc_enable_arenas = 31 [default = true]; + optional string objc_class_prefix = 36; + optional string csharp_namespace = 37; + optional string swift_prefix = 39; + optional string php_class_prefix = 40; + optional string php_namespace = 41; + optional bool php_generic_services = 42 [default = false]; + optional string php_metadata_namespace = 44; + optional string ruby_package = 45; + repeated UninterpretedOption uninterpreted_option = 999; + enum OptimizeMode { + SPEED = 1; + CODE_SIZE = 2; + LITE_RUNTIME = 3; + } + extensions 1000 to max; + reserved 38; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +message UsedOption { + string foo = 1; + extend google.protobuf.FileOptions { + optional UsedOption file_foo = 50000; + optional string file_baz = 50002; + } +} +extend google.protobuf.EnumOptions { + optional UsedOption enum_foo = 50000; + optional string enum_baz = 50002; +} +extend google.protobuf.EnumValueOptions { + optional UsedOption enum_value_foo = 50000; + optional string enum_value_baz = 50002; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.Do.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.Do.txtar new file mode 100644 index 000000000..3afb6143d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.Do.txtar @@ -0,0 +1,103 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +import "options.proto"; +option (UsedOption.file_baz) = "str"; +option (UsedOption.file_foo) = { foo: "str" }; +message Empty { +} +service FooService { + option (service_baz) = "str"; + option (service_foo) = { foo: "str" }; + rpc Do ( Empty ) returns ( Empty ) { + option (method_baz) = "str"; + option (method_foo) = { foo: "str" }; + } +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message FileOptions { + optional string java_package = 1; + optional string java_outer_classname = 8; + optional OptimizeMode optimize_for = 9 [default = SPEED]; + optional bool java_multiple_files = 10 [default = false]; + optional string go_package = 11; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool deprecated = 23 [default = false]; + optional bool java_string_check_utf8 = 27 [default = false]; + optional bool cc_enable_arenas = 31 [default = true]; + optional string objc_class_prefix = 36; + optional string csharp_namespace = 37; + optional string swift_prefix = 39; + optional string php_class_prefix = 40; + optional string php_namespace = 41; + optional bool php_generic_services = 42 [default = false]; + optional string php_metadata_namespace = 44; + optional string ruby_package = 45; + repeated UninterpretedOption uninterpreted_option = 999; + enum OptimizeMode { + SPEED = 1; + CODE_SIZE = 2; + LITE_RUNTIME = 3; + } + extensions 1000 to max; + reserved 38; +} +message MethodOptions { + optional bool deprecated = 33 [default = false]; + optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + repeated UninterpretedOption uninterpreted_option = 999; + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; + IDEMPOTENT = 2; + } + extensions 1000 to max; +} +message ServiceOptions { + optional bool deprecated = 33 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +message UsedOption { + string foo = 1; + extend google.protobuf.FileOptions { + optional UsedOption file_foo = 50000; + optional string file_baz = 50002; + } +} +extend google.protobuf.MethodOptions { + optional UsedOption method_foo = 50000; + optional string method_baz = 50002; +} +extend google.protobuf.ServiceOptions { + optional UsedOption service_foo = 50000; + optional string service_baz = 50002; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.txtar new file mode 100644 index 000000000..7175dc688 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.txtar @@ -0,0 +1,107 @@ +-- a.proto -- +syntax = "proto2"; +package pkg; +import "options.proto"; +option (UsedOption.file_baz) = "str"; +option (UsedOption.file_foo) = { foo: "str" }; +message Empty { +} +service FooService { + option (service_baz) = "str"; + option (service_foo) = { foo: "str" }; + rpc Do ( Empty ) returns ( Empty ) { + option (method_baz) = "str"; + option (method_foo) = { foo: "str" }; + } + rpc DoNot ( Empty ) returns ( Empty ) { + option (method_baz) = "str"; + option (method_foo) = { foo: "str" }; + } +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message FileOptions { + optional string java_package = 1; + optional string java_outer_classname = 8; + optional OptimizeMode optimize_for = 9 [default = SPEED]; + optional bool java_multiple_files = 10 [default = false]; + optional string go_package = 11; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool deprecated = 23 [default = false]; + optional bool java_string_check_utf8 = 27 [default = false]; + optional bool cc_enable_arenas = 31 [default = true]; + optional string objc_class_prefix = 36; + optional string csharp_namespace = 37; + optional string swift_prefix = 39; + optional string php_class_prefix = 40; + optional string php_namespace = 41; + optional bool php_generic_services = 42 [default = false]; + optional string php_metadata_namespace = 44; + optional string ruby_package = 45; + repeated UninterpretedOption uninterpreted_option = 999; + enum OptimizeMode { + SPEED = 1; + CODE_SIZE = 2; + LITE_RUNTIME = 3; + } + extensions 1000 to max; + reserved 38; +} +message MethodOptions { + optional bool deprecated = 33 [default = false]; + optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + repeated UninterpretedOption uninterpreted_option = 999; + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; + IDEMPOTENT = 2; + } + extensions 1000 to max; +} +message ServiceOptions { + optional bool deprecated = 33 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +message UsedOption { + string foo = 1; + extend google.protobuf.FileOptions { + optional UsedOption file_foo = 50000; + optional string file_baz = 50002; + } +} +extend google.protobuf.MethodOptions { + optional UsedOption method_foo = 50000; + optional string method_baz = 50002; +} +extend google.protobuf.ServiceOptions { + optional UsedOption service_foo = 50000; + optional string service_baz = 50002; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/bar.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/bar.proto new file mode 100644 index 000000000..7b98073a1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/bar.proto @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar; + +message MessageInBar { +} + +enum EnumInBar { + UNSET = 0; +} + +service ServiceInBar { + rpc Bar(MessageInBar) returns (MessageInBar); +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz1.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz1.proto new file mode 100644 index 000000000..2ebffa6b6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz1.proto @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.baz; + +message Foo { + enum Enum { + VALUE0 = 0; VALUE1 = 1; VALUE2 = 2; + } + Enum en = 1; + string name = 2; + oneof loc { + string address = 3; + uint32 zip_code = 4; + uint64 other_xref = 5; + } +} + +message Bar { + map attributes = 1; +} + +service BazService { + rpc GetBaz(Foo) returns (Bar); +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz2.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz2.proto new file mode 100644 index 000000000..904632174 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz2.proto @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo.bar.baz; + +import "nopackage.proto"; + +message Empty {} + +enum AlmostEmpty { + UNSET = 0; +} + +service NoOp { + option (svc_option_str) = "blah"; + rpc Nothing(Empty) returns (Empty); +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.baz.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.baz.txtar new file mode 100644 index 000000000..c01b3acb0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.baz.txtar @@ -0,0 +1,70 @@ +-- baz1.proto -- +syntax = "proto3"; +package foo.bar.baz; +message Bar { + map attributes = 1; +} +message Foo { + Enum en = 1; + string name = 2; + oneof loc { + string address = 3; + uint32 zip_code = 4; + uint64 other_xref = 5; + } + enum Enum { + VALUE0 = 0; + VALUE1 = 1; + VALUE2 = 2; + } +} +service BazService { + rpc GetBaz ( Foo ) returns ( Bar ); +} +-- baz2.proto -- +syntax = "proto3"; +package foo.bar.baz; +import "options.proto"; +message Empty { +} +enum AlmostEmpty { + UNSET = 0; +} +service NoOp { + option (svc_option_str) = "blah"; + rpc Nothing ( Empty ) returns ( Empty ); +} +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message ServiceOptions { + optional bool deprecated = 33 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +extend google.protobuf.ServiceOptions { + string svc_option_str = 30000; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.txtar new file mode 100644 index 000000000..f9e01d5fe --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.txtar @@ -0,0 +1,11 @@ +-- bar.proto -- +syntax = "proto3"; +package foo.bar; +message MessageInBar { +} +enum EnumInBar { + UNSET = 0; +} +service ServiceInBar { + rpc Bar ( MessageInBar ) returns ( MessageInBar ); +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.proto new file mode 100644 index 000000000..b05811222 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.proto @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; + +message MessageInFoo {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.txtar new file mode 100644 index 000000000..600d08f5a --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.txtar @@ -0,0 +1,5 @@ +-- foo.proto -- +syntax = "proto3"; +package foo; +message MessageInFoo { +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/nopackage.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/nopackage.proto new file mode 100644 index 000000000..36d3208b0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/nopackage.proto @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "google/protobuf/descriptor.proto"; +import public "options.proto"; + +option (file_option_str) = "foo"; + +message Foo { + option (msg_option_str) = "foo"; + oneof x { + string bar = 1; + string baz = 2; + } +} + +extend google.protobuf.ExtensionRangeOptions { + int64 rand = 30000; +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/options.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/options.proto new file mode 100644 index 000000000..86a94fd4b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/options.proto @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.FileOptions { + string file_option_str = 30000; +} + +extend google.protobuf.MessageOptions { + string msg_option_str = 30000; +} + +extend google.protobuf.ServiceOptions { + string svc_option_str = 30000; +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/other.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/other.proto new file mode 100644 index 000000000..1deb4ca21 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/other.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package other; \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/root.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/root.txtar new file mode 100644 index 000000000..29791ff9e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/root.txtar @@ -0,0 +1,99 @@ +-- google/protobuf/descriptor.proto -- +syntax = "proto2"; +package google.protobuf; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_outer_classname = "DescriptorProtos"; +option java_package = "com.google.protobuf"; +option objc_class_prefix = "GPB"; +option optimize_for = SPEED; +message ExtensionRangeOptions { + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message FileOptions { + optional string java_package = 1; + optional string java_outer_classname = 8; + optional OptimizeMode optimize_for = 9 [default = SPEED]; + optional bool java_multiple_files = 10 [default = false]; + optional string go_package = 11; + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + optional bool deprecated = 23 [default = false]; + optional bool java_string_check_utf8 = 27 [default = false]; + optional bool cc_enable_arenas = 31 [default = true]; + optional string objc_class_prefix = 36; + optional string csharp_namespace = 37; + optional string swift_prefix = 39; + optional string php_class_prefix = 40; + optional string php_namespace = 41; + optional bool php_generic_services = 42 [default = false]; + optional string php_metadata_namespace = 44; + optional string ruby_package = 45; + repeated UninterpretedOption uninterpreted_option = 999; + enum OptimizeMode { + SPEED = 1; + CODE_SIZE = 2; + LITE_RUNTIME = 3; + } + extensions 1000 to max; + reserved 38; +} +message MessageOptions { + optional bool message_set_wire_format = 1 [default = false]; + optional bool no_standard_descriptor_accessor = 2 [default = false]; + optional bool deprecated = 3 [default = false]; + optional bool map_entry = 7; + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; + reserved 4, 5, 6, 8, 9; +} +message ServiceOptions { + optional bool deprecated = 33 [default = false]; + repeated UninterpretedOption uninterpreted_option = 999; + extensions 1000 to max; +} +message UninterpretedOption { + repeated NamePart name = 2; + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } +} +-- nopackage.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +import "options.proto"; +option (file_option_str) = "foo"; +message Foo { + option (msg_option_str) = "foo"; + oneof x { + string bar = 1; + string baz = 2; + } +} +extend google.protobuf.ExtensionRangeOptions { + int64 rand = 30000; +} +-- options.proto -- +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; +extend google.protobuf.FileOptions { + string file_option_str = 30000; +} +extend google.protobuf.MessageOptions { + string msg_option_str = 30000; +} +extend google.protobuf.ServiceOptions { + string svc_option_str = 30000; +} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Bar.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Bar.txtar new file mode 100644 index 000000000..4a5ec4e85 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Bar.txtar @@ -0,0 +1,798 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 4, + 0 + ], + "span": [ + 40, + 0, + 89, + 1 + ], + "leadingComments": " Keep if Foo: comment on message Foo\n", + "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", + "leadingDetachedComments": [ + " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" + ] + }, + { + "path": [ + 4, + 0, + 1 + ], + "span": [ + 40, + 8, + 11 + ] + }, + { + "path": [ + 4, + 0, + 7 + ], + "span": [ + 46, + 2, + 26 + ] + }, + { + "path": [ + 4, + 0, + 7, + 10101 + ], + "span": [ + 46, + 2, + 26 + ], + "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 0, + 2, + 0 + ], + "span": [ + 49, + 2, + 27 + ], + "leadingComments": " Keep if Foo: comment on field name\n" + }, + { + "path": [ + 4, + 0, + 2, + 0, + 4 + ], + "span": [ + 49, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 5 + ], + "span": [ + 49, + 11, + 17 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 1 + ], + "span": [ + 49, + 18, + 22 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 3 + ], + "span": [ + 49, + 25, + 26 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1 + ], + "span": [ + 51, + 2, + 26 + ], + "leadingComments": " Keep if Foo: comment on field bits\n" + }, + { + "path": [ + 4, + 0, + 2, + 1, + 4 + ], + "span": [ + 51, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 5 + ], + "span": [ + 51, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 1 + ], + "span": [ + 51, + 17, + 21 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 3 + ], + "span": [ + 51, + 24, + 25 + ] + }, + { + "path": [ + 4, + 0, + 9 + ], + "span": [ + 54, + 2, + 20 + ], + "leadingComments": " Keep if Foo: comment on reserved range\n" + }, + { + "path": [ + 4, + 0, + 9, + 0 + ], + "span": [ + 54, + 11, + 19 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 1 + ], + "span": [ + 54, + 11, + 13 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 2 + ], + "span": [ + 54, + 17, + 19 + ] + }, + { + "path": [ + 4, + 0, + 10 + ], + "span": [ + 56, + 2, + 31 + ], + "leadingComments": " Keep if Foo: comment on reserved names\n" + }, + { + "path": [ + 4, + 0, + 10, + 0 + ], + "span": [ + 56, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 10, + 1 + ], + "span": [ + 56, + 18, + 23 + ] + }, + { + "path": [ + 4, + 0, + 10, + 2 + ], + "span": [ + 56, + 25, + 30 + ] + }, + { + "path": [ + 4, + 0, + 5 + ], + "span": [ + 58, + 2, + 24 + ], + "leadingComments": " Keep if Foo: comment on extension range\n" + }, + { + "path": [ + 4, + 0, + 5, + 0 + ], + "span": [ + 58, + 13, + 23 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 1 + ], + "span": [ + 58, + 13, + 16 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 2 + ], + "span": [ + 58, + 20, + 23 + ] + }, + { + "path": [ + 4, + 1 + ], + "span": [ + 95, + 0, + 105, + 1 + ], + "leadingComments": " Keep if Bar: comment on message Bar\n", + "leadingDetachedComments": [ + " \"Keep if Bar\" are also kept for Svc and Svc.Do since those\n elements depend on Bar.\n" + ] + }, + { + "path": [ + 4, + 1, + 1 + ], + "span": [ + 95, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0 + ], + "span": [ + 97, + 2, + 23 + ], + "leadingComments": " Keep if Bar: comment on field foo\n" + }, + { + "path": [ + 4, + 1, + 2, + 0, + 4 + ], + "span": [ + 97, + 2, + 10 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 6 + ], + "span": [ + 97, + 11, + 14 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 1 + ], + "span": [ + 97, + 15, + 18 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 3 + ], + "span": [ + 97, + 21, + 22 + ] + }, + { + "path": [ + 4, + 1, + 8, + 0 + ], + "span": [ + 99, + 2, + 104, + 3 + ], + "leadingComments": " Keep if Bar: comment on oneof status\n" + }, + { + "path": [ + 4, + 1, + 8, + 0, + 1 + ], + "span": [ + 99, + 8, + 14 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1 + ], + "span": [ + 101, + 4, + 16 + ], + "leadingComments": " Keep if Bar: comment on field baz\n" + }, + { + "path": [ + 4, + 1, + 2, + 1, + 6 + ], + "span": [ + 101, + 4, + 7 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 1 + ], + "span": [ + 101, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 3 + ], + "span": [ + 101, + 14, + 15 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2 + ], + "span": [ + 103, + 4, + 16 + ], + "leadingComments": " Keep if Bar: comment on field quz\n" + }, + { + "path": [ + 4, + 1, + 2, + 2, + 6 + ], + "span": [ + 103, + 4, + 7 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2, + 1 + ], + "span": [ + 103, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2, + 3 + ], + "span": [ + 103, + 14, + 15 + ] + }, + { + "path": [ + 5, + 0 + ], + "span": [ + 111, + 0, + 114, + 1 + ], + "leadingComments": " Keep if Baz: comment on enum Baz\n", + "leadingDetachedComments": [ + " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" + ] + }, + { + "path": [ + 5, + 0, + 1 + ], + "span": [ + 111, + 5, + 8 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0 + ], + "span": [ + 113, + 2, + 22 + ], + "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 0, + 2, + 0, + 1 + ], + "span": [ + 113, + 2, + 17 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0, + 2 + ], + "span": [ + 113, + 20, + 21 + ] + }, + { + "path": [ + 5, + 1 + ], + "span": [ + 117, + 0, + 120, + 1 + ], + "leadingComments": " Keep if Quz: comment on enum Quz\n" + }, + { + "path": [ + 5, + 1, + 1 + ], + "span": [ + 117, + 5, + 8 + ] + }, + { + "path": [ + 5, + 1, + 2, + 0 + ], + "span": [ + 119, + 2, + 22 + ], + "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 1, + 2, + 0, + 1 + ], + "span": [ + 119, + 2, + 17 + ] + }, + { + "path": [ + 5, + 1, + 2, + 0, + 2 + ], + "span": [ + 119, + 20, + 21 + ] + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Baz.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Baz.txtar new file mode 100644 index 000000000..44c12138c --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Baz.txtar @@ -0,0 +1,137 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 5, + 0 + ], + "span": [ + 111, + 0, + 114, + 1 + ], + "leadingComments": " Keep if Baz: comment on enum Baz\n", + "leadingDetachedComments": [ + " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" + ] + }, + { + "path": [ + 5, + 0, + 1 + ], + "span": [ + 111, + 5, + 8 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0 + ], + "span": [ + 113, + 2, + 22 + ], + "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 0, + 2, + 0, + 1 + ], + "span": [ + 113, + 2, + 17 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0, + 2 + ], + "span": [ + 113, + 20, + 21 + ] + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Do.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Do.txtar new file mode 100644 index 000000000..6dc8c818b --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Do.txtar @@ -0,0 +1,936 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 4, + 0 + ], + "span": [ + 40, + 0, + 89, + 1 + ], + "leadingComments": " Keep if Foo: comment on message Foo\n", + "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", + "leadingDetachedComments": [ + " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" + ] + }, + { + "path": [ + 4, + 0, + 1 + ], + "span": [ + 40, + 8, + 11 + ] + }, + { + "path": [ + 4, + 0, + 7 + ], + "span": [ + 46, + 2, + 26 + ] + }, + { + "path": [ + 4, + 0, + 7, + 10101 + ], + "span": [ + 46, + 2, + 26 + ], + "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 0, + 2, + 0 + ], + "span": [ + 49, + 2, + 27 + ], + "leadingComments": " Keep if Foo: comment on field name\n" + }, + { + "path": [ + 4, + 0, + 2, + 0, + 4 + ], + "span": [ + 49, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 5 + ], + "span": [ + 49, + 11, + 17 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 1 + ], + "span": [ + 49, + 18, + 22 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 3 + ], + "span": [ + 49, + 25, + 26 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1 + ], + "span": [ + 51, + 2, + 26 + ], + "leadingComments": " Keep if Foo: comment on field bits\n" + }, + { + "path": [ + 4, + 0, + 2, + 1, + 4 + ], + "span": [ + 51, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 5 + ], + "span": [ + 51, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 1 + ], + "span": [ + 51, + 17, + 21 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 3 + ], + "span": [ + 51, + 24, + 25 + ] + }, + { + "path": [ + 4, + 0, + 9 + ], + "span": [ + 54, + 2, + 20 + ], + "leadingComments": " Keep if Foo: comment on reserved range\n" + }, + { + "path": [ + 4, + 0, + 9, + 0 + ], + "span": [ + 54, + 11, + 19 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 1 + ], + "span": [ + 54, + 11, + 13 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 2 + ], + "span": [ + 54, + 17, + 19 + ] + }, + { + "path": [ + 4, + 0, + 10 + ], + "span": [ + 56, + 2, + 31 + ], + "leadingComments": " Keep if Foo: comment on reserved names\n" + }, + { + "path": [ + 4, + 0, + 10, + 0 + ], + "span": [ + 56, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 10, + 1 + ], + "span": [ + 56, + 18, + 23 + ] + }, + { + "path": [ + 4, + 0, + 10, + 2 + ], + "span": [ + 56, + 25, + 30 + ] + }, + { + "path": [ + 4, + 0, + 5 + ], + "span": [ + 58, + 2, + 24 + ], + "leadingComments": " Keep if Foo: comment on extension range\n" + }, + { + "path": [ + 4, + 0, + 5, + 0 + ], + "span": [ + 58, + 13, + 23 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 1 + ], + "span": [ + 58, + 13, + 16 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 2 + ], + "span": [ + 58, + 20, + 23 + ] + }, + { + "path": [ + 4, + 1 + ], + "span": [ + 95, + 0, + 105, + 1 + ], + "leadingComments": " Keep if Bar: comment on message Bar\n", + "leadingDetachedComments": [ + " \"Keep if Bar\" are also kept for Svc and Svc.Do since those\n elements depend on Bar.\n" + ] + }, + { + "path": [ + 4, + 1, + 1 + ], + "span": [ + 95, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0 + ], + "span": [ + 97, + 2, + 23 + ], + "leadingComments": " Keep if Bar: comment on field foo\n" + }, + { + "path": [ + 4, + 1, + 2, + 0, + 4 + ], + "span": [ + 97, + 2, + 10 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 6 + ], + "span": [ + 97, + 11, + 14 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 1 + ], + "span": [ + 97, + 15, + 18 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 3 + ], + "span": [ + 97, + 21, + 22 + ] + }, + { + "path": [ + 4, + 1, + 8, + 0 + ], + "span": [ + 99, + 2, + 104, + 3 + ], + "leadingComments": " Keep if Bar: comment on oneof status\n" + }, + { + "path": [ + 4, + 1, + 8, + 0, + 1 + ], + "span": [ + 99, + 8, + 14 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1 + ], + "span": [ + 101, + 4, + 16 + ], + "leadingComments": " Keep if Bar: comment on field baz\n" + }, + { + "path": [ + 4, + 1, + 2, + 1, + 6 + ], + "span": [ + 101, + 4, + 7 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 1 + ], + "span": [ + 101, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 3 + ], + "span": [ + 101, + 14, + 15 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2 + ], + "span": [ + 103, + 4, + 16 + ], + "leadingComments": " Keep if Bar: comment on field quz\n" + }, + { + "path": [ + 4, + 1, + 2, + 2, + 6 + ], + "span": [ + 103, + 4, + 7 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2, + 1 + ], + "span": [ + 103, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2, + 3 + ], + "span": [ + 103, + 14, + 15 + ] + }, + { + "path": [ + 5, + 0 + ], + "span": [ + 111, + 0, + 114, + 1 + ], + "leadingComments": " Keep if Baz: comment on enum Baz\n", + "leadingDetachedComments": [ + " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" + ] + }, + { + "path": [ + 5, + 0, + 1 + ], + "span": [ + 111, + 5, + 8 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0 + ], + "span": [ + 113, + 2, + 22 + ], + "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 0, + 2, + 0, + 1 + ], + "span": [ + 113, + 2, + 17 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0, + 2 + ], + "span": [ + 113, + 20, + 21 + ] + }, + { + "path": [ + 5, + 1 + ], + "span": [ + 117, + 0, + 120, + 1 + ], + "leadingComments": " Keep if Quz: comment on enum Quz\n" + }, + { + "path": [ + 5, + 1, + 1 + ], + "span": [ + 117, + 5, + 8 + ] + }, + { + "path": [ + 5, + 1, + 2, + 0 + ], + "span": [ + 119, + 2, + 22 + ], + "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 1, + 2, + 0, + 1 + ], + "span": [ + 119, + 2, + 17 + ] + }, + { + "path": [ + 5, + 1, + 2, + 0, + 2 + ], + "span": [ + 119, + 20, + 21 + ] + }, + { + "path": [ + 6, + 0 + ], + "span": [ + 141, + 0, + 153, + 1 + ], + "leadingComments": " Keep if Svc: comment on service Svc\n" + }, + { + "path": [ + 6, + 0, + 1 + ], + "span": [ + 141, + 8, + 11 + ] + }, + { + "path": [ + 6, + 0, + 3 + ], + "span": [ + 143, + 2, + 29 + ] + }, + { + "path": [ + 6, + 0, + 3, + 10101 + ], + "span": [ + 143, + 2, + 29 + ], + "leadingComments": " Keep if Svc: comment on option\n" + }, + { + "path": [ + 6, + 0, + 2, + 0 + ], + "span": [ + 146, + 2, + 149, + 3 + ], + "leadingComments": " Keep if Svc.Do: comment on rpc Do\n" + }, + { + "path": [ + 6, + 0, + 2, + 0, + 1 + ], + "span": [ + 146, + 6, + 8 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 2 + ], + "span": [ + 146, + 9, + 12 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 3 + ], + "span": [ + 146, + 23, + 26 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 4 + ], + "span": [ + 148, + 4, + 47 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 4, + 34 + ], + "span": [ + 148, + 4, + 47 + ], + "leadingComments": " Keep if Svc.Do: comment on option\n" + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo+Ext.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo+Ext.txtar new file mode 100644 index 000000000..bb2fb5dee --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo+Ext.txtar @@ -0,0 +1,700 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 3, + 0 + ], + "span": [ + 10, + 0, + 42 + ], + "leadingComments": " Keep if ext: comment on import descriptor.proto\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 7 + ], + "span": [ + 19, + 0, + 22, + 1 + ], + "leadingComments": " Keep if ext: comment on extend block\n" + }, + { + "path": [ + 7, + 0 + ], + "span": [ + 21, + 2, + 33 + ], + "leadingComments": " Keep if ext: comment on custom option bizniz\n" + }, + { + "path": [ + 7, + 0, + 2 + ], + "span": [ + 19, + 7, + 37 + ] + }, + { + "path": [ + 7, + 0, + 4 + ], + "span": [ + 21, + 2, + 10 + ] + }, + { + "path": [ + 7, + 0, + 5 + ], + "span": [ + 21, + 11, + 17 + ] + }, + { + "path": [ + 7, + 0, + 1 + ], + "span": [ + 21, + 18, + 24 + ] + }, + { + "path": [ + 7, + 0, + 3 + ], + "span": [ + 21, + 27, + 32 + ] + }, + { + "path": [ + 7 + ], + "span": [ + 25, + 0, + 28, + 1 + ], + "leadingComments": " Keep if ext: comment on extend block\n" + }, + { + "path": [ + 4, + 0 + ], + "span": [ + 40, + 0, + 89, + 1 + ], + "leadingComments": " Keep if Foo: comment on message Foo\n", + "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", + "leadingDetachedComments": [ + " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" + ] + }, + { + "path": [ + 4, + 0, + 1 + ], + "span": [ + 40, + 8, + 11 + ] + }, + { + "path": [ + 4, + 0, + 7 + ], + "span": [ + 46, + 2, + 26 + ] + }, + { + "path": [ + 4, + 0, + 7, + 10101 + ], + "span": [ + 46, + 2, + 26 + ], + "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 0, + 2, + 0 + ], + "span": [ + 49, + 2, + 27 + ], + "leadingComments": " Keep if Foo: comment on field name\n" + }, + { + "path": [ + 4, + 0, + 2, + 0, + 4 + ], + "span": [ + 49, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 5 + ], + "span": [ + 49, + 11, + 17 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 1 + ], + "span": [ + 49, + 18, + 22 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 3 + ], + "span": [ + 49, + 25, + 26 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1 + ], + "span": [ + 51, + 2, + 26 + ], + "leadingComments": " Keep if Foo: comment on field bits\n" + }, + { + "path": [ + 4, + 0, + 2, + 1, + 4 + ], + "span": [ + 51, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 5 + ], + "span": [ + 51, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 1 + ], + "span": [ + 51, + 17, + 21 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 3 + ], + "span": [ + 51, + 24, + 25 + ] + }, + { + "path": [ + 4, + 0, + 9 + ], + "span": [ + 54, + 2, + 20 + ], + "leadingComments": " Keep if Foo: comment on reserved range\n" + }, + { + "path": [ + 4, + 0, + 9, + 0 + ], + "span": [ + 54, + 11, + 19 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 1 + ], + "span": [ + 54, + 11, + 13 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 2 + ], + "span": [ + 54, + 17, + 19 + ] + }, + { + "path": [ + 4, + 0, + 10 + ], + "span": [ + 56, + 2, + 31 + ], + "leadingComments": " Keep if Foo: comment on reserved names\n" + }, + { + "path": [ + 4, + 0, + 10, + 0 + ], + "span": [ + 56, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 10, + 1 + ], + "span": [ + 56, + 18, + 23 + ] + }, + { + "path": [ + 4, + 0, + 10, + 2 + ], + "span": [ + 56, + 25, + 30 + ] + }, + { + "path": [ + 4, + 0, + 5 + ], + "span": [ + 58, + 2, + 24 + ], + "leadingComments": " Keep if Foo: comment on extension range\n" + }, + { + "path": [ + 4, + 0, + 5, + 0 + ], + "span": [ + 58, + 13, + 23 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 1 + ], + "span": [ + 58, + 13, + 16 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 2 + ], + "span": [ + 58, + 20, + 23 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0 + ], + "span": [ + 61, + 2, + 88, + 3 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 1 + ], + "span": [ + 61, + 10, + 19 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 7 + ], + "span": [ + 67, + 4, + 28 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 7, + 10101 + ], + "span": [ + 67, + 4, + 28 + ], + "leadingComments": " Keep if Foo + ext | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 6 + ], + "span": [ + 84, + 4, + 87, + 5 + ], + "leadingComments": " Keep if Foo + ext: comment on extend block\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 6, + 0 + ], + "span": [ + 86, + 6, + 32 + ], + "leadingComments": " Keep if Foo + ext: comment on extension blah\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 6, + 0, + 2 + ], + "span": [ + 84, + 11, + 14 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 6, + 0, + 4 + ], + "span": [ + 86, + 6, + 14 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 6, + 0, + 5 + ], + "span": [ + 86, + 15, + 20 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 6, + 0, + 1 + ], + "span": [ + 86, + 21, + 25 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 6, + 0, + 3 + ], + "span": [ + 86, + 28, + 31 + ] + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo.txtar new file mode 100644 index 000000000..aa63fa39a --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo.txtar @@ -0,0 +1,422 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 4, + 0 + ], + "span": [ + 40, + 0, + 89, + 1 + ], + "leadingComments": " Keep if Foo: comment on message Foo\n", + "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", + "leadingDetachedComments": [ + " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" + ] + }, + { + "path": [ + 4, + 0, + 1 + ], + "span": [ + 40, + 8, + 11 + ] + }, + { + "path": [ + 4, + 0, + 7 + ], + "span": [ + 46, + 2, + 26 + ] + }, + { + "path": [ + 4, + 0, + 7, + 10101 + ], + "span": [ + 46, + 2, + 26 + ], + "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 0, + 2, + 0 + ], + "span": [ + 49, + 2, + 27 + ], + "leadingComments": " Keep if Foo: comment on field name\n" + }, + { + "path": [ + 4, + 0, + 2, + 0, + 4 + ], + "span": [ + 49, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 5 + ], + "span": [ + 49, + 11, + 17 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 1 + ], + "span": [ + 49, + 18, + 22 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 3 + ], + "span": [ + 49, + 25, + 26 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1 + ], + "span": [ + 51, + 2, + 26 + ], + "leadingComments": " Keep if Foo: comment on field bits\n" + }, + { + "path": [ + 4, + 0, + 2, + 1, + 4 + ], + "span": [ + 51, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 5 + ], + "span": [ + 51, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 1 + ], + "span": [ + 51, + 17, + 21 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 3 + ], + "span": [ + 51, + 24, + 25 + ] + }, + { + "path": [ + 4, + 0, + 9 + ], + "span": [ + 54, + 2, + 20 + ], + "leadingComments": " Keep if Foo: comment on reserved range\n" + }, + { + "path": [ + 4, + 0, + 9, + 0 + ], + "span": [ + 54, + 11, + 19 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 1 + ], + "span": [ + 54, + 11, + 13 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 2 + ], + "span": [ + 54, + 17, + 19 + ] + }, + { + "path": [ + 4, + 0, + 10 + ], + "span": [ + 56, + 2, + 31 + ], + "leadingComments": " Keep if Foo: comment on reserved names\n" + }, + { + "path": [ + 4, + 0, + 10, + 0 + ], + "span": [ + 56, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 10, + 1 + ], + "span": [ + 56, + 18, + 23 + ] + }, + { + "path": [ + 4, + 0, + 10, + 2 + ], + "span": [ + 56, + 25, + 30 + ] + }, + { + "path": [ + 4, + 0, + 5 + ], + "span": [ + 58, + 2, + 24 + ], + "leadingComments": " Keep if Foo: comment on extension range\n" + }, + { + "path": [ + 4, + 0, + 5, + 0 + ], + "span": [ + 58, + 13, + 23 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 1 + ], + "span": [ + 58, + 13, + 16 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 2 + ], + "span": [ + 58, + 20, + 23 + ] + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/NestedFoo.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/NestedFoo.txtar new file mode 100644 index 000000000..749b5a818 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/NestedFoo.txtar @@ -0,0 +1,570 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 3, + 0 + ], + "span": [ + 16, + 0, + 40 + ], + "leadingComments": " Keep if NestedFoo: comment on import any.proto\n" + }, + { + "path": [ + 4, + 0 + ], + "span": [ + 40, + 0, + 89, + 1 + ] + }, + { + "path": [ + 4, + 0, + 1 + ], + "span": [ + 40, + 8, + 11 + ] + }, + { + "path": [ + 4, + 0, + 7 + ], + "span": [ + 46, + 2, + 26 + ] + }, + { + "path": [ + 4, + 0, + 7, + 10101 + ], + "span": [ + 46, + 2, + 26 + ], + "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 0, + 3, + 0 + ], + "span": [ + 61, + 2, + 88, + 3 + ], + "leadingComments": " Keep if NestedFoo: comment on message NestedFoo\n", + "trailingComments": " We keep the following comment for Foo + ext because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 1 + ], + "span": [ + 61, + 10, + 19 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 7 + ], + "span": [ + 67, + 4, + 28 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 7, + 10101 + ], + "span": [ + 67, + 4, + 28 + ], + "leadingComments": " Keep if Foo + ext | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 0 + ], + "span": [ + 69, + 4, + 28 + ], + "leadingComments": " Keep if NestedFoo: comment on field uid\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 0, + 4 + ], + "span": [ + 69, + 4, + 12 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 0, + 5 + ], + "span": [ + 69, + 13, + 19 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 0, + 1 + ], + "span": [ + 69, + 20, + 23 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 0, + 3 + ], + "span": [ + 69, + 26, + 27 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 1 + ], + "span": [ + 71, + 4, + 42 + ], + "leadingComments": " Keep if NestedFoo: comment on field meta\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 1, + 4 + ], + "span": [ + 71, + 4, + 12 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 1, + 6 + ], + "span": [ + 71, + 13, + 32 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 1, + 1 + ], + "span": [ + 71, + 33, + 37 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 1, + 3 + ], + "span": [ + 71, + 40, + 41 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 2 + ], + "span": [ + 73, + 4, + 29 + ], + "leadingComments": " Keep if NestedFoo: comment on field state\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 2, + 4 + ], + "span": [ + 73, + 4, + 12 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 2, + 6 + ], + "span": [ + 73, + 13, + 18 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 2, + 1 + ], + "span": [ + 73, + 19, + 24 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 2, + 2, + 3 + ], + "span": [ + 73, + 27, + 28 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 4, + 0 + ], + "span": [ + 76, + 4, + 81, + 5 + ], + "leadingComments": " Keep if NestedFoo: comment on enum State\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 4, + 0, + 1 + ], + "span": [ + 76, + 9, + 14 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 4, + 0, + 2, + 0 + ], + "span": [ + 78, + 6, + 28 + ], + "leadingComments": " Keep if NestedFoo: comment on enum value STATE_UNSPECIFIED\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 4, + 0, + 2, + 0, + 1 + ], + "span": [ + 78, + 6, + 23 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 4, + 0, + 2, + 0, + 2 + ], + "span": [ + 78, + 26, + 27 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 4, + 0, + 2, + 1 + ], + "span": [ + 80, + 6, + 21 + ], + "leadingComments": " Keep if NestedFoo: comment on enum value STATE_GOOD\n" + }, + { + "path": [ + 4, + 0, + 3, + 0, + 4, + 0, + 2, + 1, + 1 + ], + "span": [ + 80, + 6, + 16 + ] + }, + { + "path": [ + 4, + 0, + 3, + 0, + 4, + 0, + 2, + 1, + 2 + ], + "span": [ + 80, + 19, + 20 + ] + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Quz.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Quz.txtar new file mode 100644 index 000000000..20a4c7223 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Quz.txtar @@ -0,0 +1,134 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 5, + 0 + ], + "span": [ + 117, + 0, + 120, + 1 + ], + "leadingComments": " Keep if Quz: comment on enum Quz\n" + }, + { + "path": [ + 5, + 0, + 1 + ], + "span": [ + 117, + 5, + 8 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0 + ], + "span": [ + 119, + 2, + 22 + ], + "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 0, + 2, + 0, + 1 + ], + "span": [ + 119, + 2, + 17 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0, + 2 + ], + "span": [ + 119, + 20, + 21 + ] + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Svc.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Svc.txtar new file mode 100644 index 000000000..876719864 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Svc.txtar @@ -0,0 +1,992 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 4, + 0 + ], + "span": [ + 40, + 0, + 89, + 1 + ], + "leadingComments": " Keep if Foo: comment on message Foo\n", + "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", + "leadingDetachedComments": [ + " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" + ] + }, + { + "path": [ + 4, + 0, + 1 + ], + "span": [ + 40, + 8, + 11 + ] + }, + { + "path": [ + 4, + 0, + 7 + ], + "span": [ + 46, + 2, + 26 + ] + }, + { + "path": [ + 4, + 0, + 7, + 10101 + ], + "span": [ + 46, + 2, + 26 + ], + "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 0, + 2, + 0 + ], + "span": [ + 49, + 2, + 27 + ], + "leadingComments": " Keep if Foo: comment on field name\n" + }, + { + "path": [ + 4, + 0, + 2, + 0, + 4 + ], + "span": [ + 49, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 5 + ], + "span": [ + 49, + 11, + 17 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 1 + ], + "span": [ + 49, + 18, + 22 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 3 + ], + "span": [ + 49, + 25, + 26 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1 + ], + "span": [ + 51, + 2, + 26 + ], + "leadingComments": " Keep if Foo: comment on field bits\n" + }, + { + "path": [ + 4, + 0, + 2, + 1, + 4 + ], + "span": [ + 51, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 5 + ], + "span": [ + 51, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 1 + ], + "span": [ + 51, + 17, + 21 + ] + }, + { + "path": [ + 4, + 0, + 2, + 1, + 3 + ], + "span": [ + 51, + 24, + 25 + ] + }, + { + "path": [ + 4, + 0, + 9 + ], + "span": [ + 54, + 2, + 20 + ], + "leadingComments": " Keep if Foo: comment on reserved range\n" + }, + { + "path": [ + 4, + 0, + 9, + 0 + ], + "span": [ + 54, + 11, + 19 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 1 + ], + "span": [ + 54, + 11, + 13 + ] + }, + { + "path": [ + 4, + 0, + 9, + 0, + 2 + ], + "span": [ + 54, + 17, + 19 + ] + }, + { + "path": [ + 4, + 0, + 10 + ], + "span": [ + 56, + 2, + 31 + ], + "leadingComments": " Keep if Foo: comment on reserved names\n" + }, + { + "path": [ + 4, + 0, + 10, + 0 + ], + "span": [ + 56, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 10, + 1 + ], + "span": [ + 56, + 18, + 23 + ] + }, + { + "path": [ + 4, + 0, + 10, + 2 + ], + "span": [ + 56, + 25, + 30 + ] + }, + { + "path": [ + 4, + 0, + 5 + ], + "span": [ + 58, + 2, + 24 + ], + "leadingComments": " Keep if Foo: comment on extension range\n" + }, + { + "path": [ + 4, + 0, + 5, + 0 + ], + "span": [ + 58, + 13, + 23 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 1 + ], + "span": [ + 58, + 13, + 16 + ] + }, + { + "path": [ + 4, + 0, + 5, + 0, + 2 + ], + "span": [ + 58, + 20, + 23 + ] + }, + { + "path": [ + 4, + 1 + ], + "span": [ + 95, + 0, + 105, + 1 + ], + "leadingComments": " Keep if Bar: comment on message Bar\n", + "leadingDetachedComments": [ + " \"Keep if Bar\" are also kept for Svc and Svc.Do since those\n elements depend on Bar.\n" + ] + }, + { + "path": [ + 4, + 1, + 1 + ], + "span": [ + 95, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0 + ], + "span": [ + 97, + 2, + 23 + ], + "leadingComments": " Keep if Bar: comment on field foo\n" + }, + { + "path": [ + 4, + 1, + 2, + 0, + 4 + ], + "span": [ + 97, + 2, + 10 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 6 + ], + "span": [ + 97, + 11, + 14 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 1 + ], + "span": [ + 97, + 15, + 18 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 3 + ], + "span": [ + 97, + 21, + 22 + ] + }, + { + "path": [ + 4, + 1, + 8, + 0 + ], + "span": [ + 99, + 2, + 104, + 3 + ], + "leadingComments": " Keep if Bar: comment on oneof status\n" + }, + { + "path": [ + 4, + 1, + 8, + 0, + 1 + ], + "span": [ + 99, + 8, + 14 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1 + ], + "span": [ + 101, + 4, + 16 + ], + "leadingComments": " Keep if Bar: comment on field baz\n" + }, + { + "path": [ + 4, + 1, + 2, + 1, + 6 + ], + "span": [ + 101, + 4, + 7 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 1 + ], + "span": [ + 101, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 3 + ], + "span": [ + 101, + 14, + 15 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2 + ], + "span": [ + 103, + 4, + 16 + ], + "leadingComments": " Keep if Bar: comment on field quz\n" + }, + { + "path": [ + 4, + 1, + 2, + 2, + 6 + ], + "span": [ + 103, + 4, + 7 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2, + 1 + ], + "span": [ + 103, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 2, + 2, + 3 + ], + "span": [ + 103, + 14, + 15 + ] + }, + { + "path": [ + 5, + 0 + ], + "span": [ + 111, + 0, + 114, + 1 + ], + "leadingComments": " Keep if Baz: comment on enum Baz\n", + "leadingDetachedComments": [ + " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" + ] + }, + { + "path": [ + 5, + 0, + 1 + ], + "span": [ + 111, + 5, + 8 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0 + ], + "span": [ + 113, + 2, + 22 + ], + "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 0, + 2, + 0, + 1 + ], + "span": [ + 113, + 2, + 17 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0, + 2 + ], + "span": [ + 113, + 20, + 21 + ] + }, + { + "path": [ + 5, + 1 + ], + "span": [ + 117, + 0, + 120, + 1 + ], + "leadingComments": " Keep if Quz: comment on enum Quz\n" + }, + { + "path": [ + 5, + 1, + 1 + ], + "span": [ + 117, + 5, + 8 + ] + }, + { + "path": [ + 5, + 1, + 2, + 0 + ], + "span": [ + 119, + 2, + 22 + ], + "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 1, + 2, + 0, + 1 + ], + "span": [ + 119, + 2, + 17 + ] + }, + { + "path": [ + 5, + 1, + 2, + 0, + 2 + ], + "span": [ + 119, + 20, + 21 + ] + }, + { + "path": [ + 6, + 0 + ], + "span": [ + 141, + 0, + 153, + 1 + ], + "leadingComments": " Keep if Svc: comment on service Svc\n" + }, + { + "path": [ + 6, + 0, + 1 + ], + "span": [ + 141, + 8, + 11 + ] + }, + { + "path": [ + 6, + 0, + 3 + ], + "span": [ + 143, + 2, + 29 + ] + }, + { + "path": [ + 6, + 0, + 3, + 10101 + ], + "span": [ + 143, + 2, + 29 + ], + "leadingComments": " Keep if Svc: comment on option\n" + }, + { + "path": [ + 6, + 0, + 2, + 0 + ], + "span": [ + 146, + 2, + 149, + 3 + ], + "leadingComments": " Keep if Svc.Do: comment on rpc Do\n" + }, + { + "path": [ + 6, + 0, + 2, + 0, + 1 + ], + "span": [ + 146, + 6, + 8 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 2 + ], + "span": [ + 146, + 9, + 12 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 3 + ], + "span": [ + 146, + 23, + 26 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 4 + ], + "span": [ + 148, + 4, + 47 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 4, + 34 + ], + "span": [ + 148, + 4, + 47 + ], + "leadingComments": " Keep if Svc.Do: comment on option\n" + }, + { + "path": [ + 6, + 0, + 2, + 1 + ], + "span": [ + 152, + 2, + 30 + ], + "leadingComments": " Keep if Svc: comment on rpc Dont\n" + }, + { + "path": [ + 6, + 0, + 2, + 1, + 1 + ], + "span": [ + 152, + 6, + 10 + ] + }, + { + "path": [ + 6, + 0, + 2, + 1, + 2 + ], + "span": [ + 152, + 11, + 14 + ] + }, + { + "path": [ + 6, + 0, + 2, + 1, + 3 + ], + "span": [ + 152, + 25, + 28 + ] + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/all.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/all.txtar new file mode 100644 index 000000000..3d08341ef --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/all.txtar @@ -0,0 +1,2103 @@ +{ + "location": [ + { + "span": [ + 1, + 0, + 153, + 1 + ] + }, + { + "path": [ + 12 + ], + "span": [ + 1, + 0, + 18 + ], + "leadingComments": " Keep 1: comment on syntax\n" + }, + { + "path": [ + 2 + ], + "span": [ + 4, + 0, + 16 + ], + "leadingComments": " Keep 2: comment on package\n" + }, + { + "path": [ + 8 + ], + "span": [ + 7, + 0, + 34 + ] + }, + { + "path": [ + 8, + 11 + ], + "span": [ + 7, + 0, + 34 + ], + "leadingComments": " Keep 3: comment on option\n" + }, + { + "path": [ + 3, + 0 + ], + "span": [ + 10, + 0, + 42 + ], + "leadingComments": " Keep if ext: comment on import descriptor.proto\n" + }, + { + "path": [ + 11, + 0 + ], + "span": [ + 13, + 7, + 11 + ] + }, + { + "path": [ + 3, + 1 + ], + "span": [ + 16, + 0, + 40 + ], + "leadingComments": " Keep if NestedFoo: comment on import any.proto\n" + }, + { + "path": [ + 7 + ], + "span": [ + 19, + 0, + 22, + 1 + ], + "leadingComments": " Keep if ext: comment on extend block\n" + }, + { + "path": [ + 7, + 0 + ], + "span": [ + 21, + 2, + 33 + ], + "leadingComments": " Keep if ext: comment on custom option bizniz\n" + }, + { + "path": [ + 7, + 0, + 2 + ], + "span": [ + 19, + 7, + 37 + ] + }, + { + "path": [ + 7, + 0, + 4 + ], + "span": [ + 21, + 2, + 10 + ] + }, + { + "path": [ + 7, + 0, + 5 + ], + "span": [ + 21, + 11, + 17 + ] + }, + { + "path": [ + 7, + 0, + 1 + ], + "span": [ + 21, + 18, + 24 + ] + }, + { + "path": [ + 7, + 0, + 3 + ], + "span": [ + 21, + 27, + 32 + ] + }, + { + "path": [ + 7 + ], + "span": [ + 25, + 0, + 28, + 1 + ], + "leadingComments": " Keep if ext: comment on extend block\n" + }, + { + "path": [ + 7, + 1 + ], + "span": [ + 27, + 2, + 35 + ], + "leadingComments": " Keep if ext + Svc: comment on custom option fizzbuzz\n" + }, + { + "path": [ + 7, + 1, + 2 + ], + "span": [ + 25, + 7, + 37 + ] + }, + { + "path": [ + 7, + 1, + 4 + ], + "span": [ + 27, + 2, + 10 + ] + }, + { + "path": [ + 7, + 1, + 5 + ], + "span": [ + 27, + 11, + 17 + ] + }, + { + "path": [ + 7, + 1, + 1 + ], + "span": [ + 27, + 18, + 26 + ] + }, + { + "path": [ + 7, + 1, + 3 + ], + "span": [ + 27, + 29, + 34 + ] + }, + { + "path": [ + 4, + 0 + ], + "span": [ + 31, + 0, + 34, + 1 + ], + "leadingComments": " Keep if all: comment on message Frobnitz\n" + }, + { + "path": [ + 4, + 0, + 1 + ], + "span": [ + 31, + 8, + 16 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0 + ], + "span": [ + 33, + 2, + 25 + ], + "leadingComments": " Keep if all: comment on field xyz\n" + }, + { + "path": [ + 4, + 0, + 2, + 0, + 4 + ], + "span": [ + 33, + 2, + 10 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 5 + ], + "span": [ + 33, + 11, + 16 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 1 + ], + "span": [ + 33, + 17, + 20 + ] + }, + { + "path": [ + 4, + 0, + 2, + 0, + 3 + ], + "span": [ + 33, + 23, + 24 + ] + }, + { + "path": [ + 4, + 1 + ], + "span": [ + 40, + 0, + 89, + 1 + ], + "leadingComments": " Keep if Foo: comment on message Foo\n", + "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", + "leadingDetachedComments": [ + " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" + ] + }, + { + "path": [ + 4, + 1, + 1 + ], + "span": [ + 40, + 8, + 11 + ] + }, + { + "path": [ + 4, + 1, + 7 + ], + "span": [ + 46, + 2, + 26 + ] + }, + { + "path": [ + 4, + 1, + 7, + 10101 + ], + "span": [ + 46, + 2, + 26 + ], + "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 1, + 2, + 0 + ], + "span": [ + 49, + 2, + 27 + ], + "leadingComments": " Keep if Foo: comment on field name\n" + }, + { + "path": [ + 4, + 1, + 2, + 0, + 4 + ], + "span": [ + 49, + 2, + 10 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 5 + ], + "span": [ + 49, + 11, + 17 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 1 + ], + "span": [ + 49, + 18, + 22 + ] + }, + { + "path": [ + 4, + 1, + 2, + 0, + 3 + ], + "span": [ + 49, + 25, + 26 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1 + ], + "span": [ + 51, + 2, + 26 + ], + "leadingComments": " Keep if Foo: comment on field bits\n" + }, + { + "path": [ + 4, + 1, + 2, + 1, + 4 + ], + "span": [ + 51, + 2, + 10 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 5 + ], + "span": [ + 51, + 11, + 16 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 1 + ], + "span": [ + 51, + 17, + 21 + ] + }, + { + "path": [ + 4, + 1, + 2, + 1, + 3 + ], + "span": [ + 51, + 24, + 25 + ] + }, + { + "path": [ + 4, + 1, + 9 + ], + "span": [ + 54, + 2, + 20 + ], + "leadingComments": " Keep if Foo: comment on reserved range\n" + }, + { + "path": [ + 4, + 1, + 9, + 0 + ], + "span": [ + 54, + 11, + 19 + ] + }, + { + "path": [ + 4, + 1, + 9, + 0, + 1 + ], + "span": [ + 54, + 11, + 13 + ] + }, + { + "path": [ + 4, + 1, + 9, + 0, + 2 + ], + "span": [ + 54, + 17, + 19 + ] + }, + { + "path": [ + 4, + 1, + 10 + ], + "span": [ + 56, + 2, + 31 + ], + "leadingComments": " Keep if Foo: comment on reserved names\n" + }, + { + "path": [ + 4, + 1, + 10, + 0 + ], + "span": [ + 56, + 11, + 16 + ] + }, + { + "path": [ + 4, + 1, + 10, + 1 + ], + "span": [ + 56, + 18, + 23 + ] + }, + { + "path": [ + 4, + 1, + 10, + 2 + ], + "span": [ + 56, + 25, + 30 + ] + }, + { + "path": [ + 4, + 1, + 5 + ], + "span": [ + 58, + 2, + 24 + ], + "leadingComments": " Keep if Foo: comment on extension range\n" + }, + { + "path": [ + 4, + 1, + 5, + 0 + ], + "span": [ + 58, + 13, + 23 + ] + }, + { + "path": [ + 4, + 1, + 5, + 0, + 1 + ], + "span": [ + 58, + 13, + 16 + ] + }, + { + "path": [ + 4, + 1, + 5, + 0, + 2 + ], + "span": [ + 58, + 20, + 23 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0 + ], + "span": [ + 61, + 2, + 88, + 3 + ], + "leadingComments": " Keep if NestedFoo: comment on message NestedFoo\n", + "trailingComments": " We keep the following comment for Foo + ext because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 1 + ], + "span": [ + 61, + 10, + 19 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 7 + ], + "span": [ + 67, + 4, + 28 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 7, + 10101 + ], + "span": [ + 67, + 4, + 28 + ], + "leadingComments": " Keep if Foo + ext | NestedFoo: comment on option\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 0 + ], + "span": [ + 69, + 4, + 28 + ], + "leadingComments": " Keep if NestedFoo: comment on field uid\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 0, + 4 + ], + "span": [ + 69, + 4, + 12 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 0, + 5 + ], + "span": [ + 69, + 13, + 19 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 0, + 1 + ], + "span": [ + 69, + 20, + 23 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 0, + 3 + ], + "span": [ + 69, + 26, + 27 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 1 + ], + "span": [ + 71, + 4, + 42 + ], + "leadingComments": " Keep if NestedFoo: comment on field meta\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 1, + 4 + ], + "span": [ + 71, + 4, + 12 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 1, + 6 + ], + "span": [ + 71, + 13, + 32 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 1, + 1 + ], + "span": [ + 71, + 33, + 37 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 1, + 3 + ], + "span": [ + 71, + 40, + 41 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 2 + ], + "span": [ + 73, + 4, + 29 + ], + "leadingComments": " Keep if NestedFoo: comment on field state\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 2, + 4 + ], + "span": [ + 73, + 4, + 12 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 2, + 6 + ], + "span": [ + 73, + 13, + 18 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 2, + 1 + ], + "span": [ + 73, + 19, + 24 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 2, + 2, + 3 + ], + "span": [ + 73, + 27, + 28 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 4, + 0 + ], + "span": [ + 76, + 4, + 81, + 5 + ], + "leadingComments": " Keep if NestedFoo: comment on enum State\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 4, + 0, + 1 + ], + "span": [ + 76, + 9, + 14 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 4, + 0, + 2, + 0 + ], + "span": [ + 78, + 6, + 28 + ], + "leadingComments": " Keep if NestedFoo: comment on enum value STATE_UNSPECIFIED\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 4, + 0, + 2, + 0, + 1 + ], + "span": [ + 78, + 6, + 23 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 4, + 0, + 2, + 0, + 2 + ], + "span": [ + 78, + 26, + 27 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 4, + 0, + 2, + 1 + ], + "span": [ + 80, + 6, + 21 + ], + "leadingComments": " Keep if NestedFoo: comment on enum value STATE_GOOD\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 4, + 0, + 2, + 1, + 1 + ], + "span": [ + 80, + 6, + 16 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 4, + 0, + 2, + 1, + 2 + ], + "span": [ + 80, + 19, + 20 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 6 + ], + "span": [ + 84, + 4, + 87, + 5 + ], + "leadingComments": " Keep if Foo + ext: comment on extend block\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 6, + 0 + ], + "span": [ + 86, + 6, + 32 + ], + "leadingComments": " Keep if Foo + ext: comment on extension blah\n" + }, + { + "path": [ + 4, + 1, + 3, + 0, + 6, + 0, + 2 + ], + "span": [ + 84, + 11, + 14 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 6, + 0, + 4 + ], + "span": [ + 86, + 6, + 14 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 6, + 0, + 5 + ], + "span": [ + 86, + 15, + 20 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 6, + 0, + 1 + ], + "span": [ + 86, + 21, + 25 + ] + }, + { + "path": [ + 4, + 1, + 3, + 0, + 6, + 0, + 3 + ], + "span": [ + 86, + 28, + 31 + ] + }, + { + "path": [ + 4, + 2 + ], + "span": [ + 95, + 0, + 105, + 1 + ], + "leadingComments": " Keep if Bar: comment on message Bar\n", + "leadingDetachedComments": [ + " \"Keep if Bar\" are also kept for Svc and Svc.Do since those\n elements depend on Bar.\n" + ] + }, + { + "path": [ + 4, + 2, + 1 + ], + "span": [ + 95, + 8, + 11 + ] + }, + { + "path": [ + 4, + 2, + 2, + 0 + ], + "span": [ + 97, + 2, + 23 + ], + "leadingComments": " Keep if Bar: comment on field foo\n" + }, + { + "path": [ + 4, + 2, + 2, + 0, + 4 + ], + "span": [ + 97, + 2, + 10 + ] + }, + { + "path": [ + 4, + 2, + 2, + 0, + 6 + ], + "span": [ + 97, + 11, + 14 + ] + }, + { + "path": [ + 4, + 2, + 2, + 0, + 1 + ], + "span": [ + 97, + 15, + 18 + ] + }, + { + "path": [ + 4, + 2, + 2, + 0, + 3 + ], + "span": [ + 97, + 21, + 22 + ] + }, + { + "path": [ + 4, + 2, + 8, + 0 + ], + "span": [ + 99, + 2, + 104, + 3 + ], + "leadingComments": " Keep if Bar: comment on oneof status\n" + }, + { + "path": [ + 4, + 2, + 8, + 0, + 1 + ], + "span": [ + 99, + 8, + 14 + ] + }, + { + "path": [ + 4, + 2, + 2, + 1 + ], + "span": [ + 101, + 4, + 16 + ], + "leadingComments": " Keep if Bar: comment on field baz\n" + }, + { + "path": [ + 4, + 2, + 2, + 1, + 6 + ], + "span": [ + 101, + 4, + 7 + ] + }, + { + "path": [ + 4, + 2, + 2, + 1, + 1 + ], + "span": [ + 101, + 8, + 11 + ] + }, + { + "path": [ + 4, + 2, + 2, + 1, + 3 + ], + "span": [ + 101, + 14, + 15 + ] + }, + { + "path": [ + 4, + 2, + 2, + 2 + ], + "span": [ + 103, + 4, + 16 + ], + "leadingComments": " Keep if Bar: comment on field quz\n" + }, + { + "path": [ + 4, + 2, + 2, + 2, + 6 + ], + "span": [ + 103, + 4, + 7 + ] + }, + { + "path": [ + 4, + 2, + 2, + 2, + 1 + ], + "span": [ + 103, + 8, + 11 + ] + }, + { + "path": [ + 4, + 2, + 2, + 2, + 3 + ], + "span": [ + 103, + 14, + 15 + ] + }, + { + "path": [ + 5, + 0 + ], + "span": [ + 111, + 0, + 114, + 1 + ], + "leadingComments": " Keep if Baz: comment on enum Baz\n", + "leadingDetachedComments": [ + " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" + ] + }, + { + "path": [ + 5, + 0, + 1 + ], + "span": [ + 111, + 5, + 8 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0 + ], + "span": [ + 113, + 2, + 22 + ], + "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 0, + 2, + 0, + 1 + ], + "span": [ + 113, + 2, + 17 + ] + }, + { + "path": [ + 5, + 0, + 2, + 0, + 2 + ], + "span": [ + 113, + 20, + 21 + ] + }, + { + "path": [ + 5, + 1 + ], + "span": [ + 117, + 0, + 120, + 1 + ], + "leadingComments": " Keep if Quz: comment on enum Quz\n" + }, + { + "path": [ + 5, + 1, + 1 + ], + "span": [ + 117, + 5, + 8 + ] + }, + { + "path": [ + 5, + 1, + 2, + 0 + ], + "span": [ + 119, + 2, + 22 + ], + "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" + }, + { + "path": [ + 5, + 1, + 2, + 0, + 1 + ], + "span": [ + 119, + 2, + 17 + ] + }, + { + "path": [ + 5, + 1, + 2, + 0, + 2 + ], + "span": [ + 119, + 20, + 21 + ] + }, + { + "path": [ + 4, + 3 + ], + "span": [ + 123, + 0, + 126, + 1 + ], + "leadingComments": " Keep if all: comment on message Buzz\n" + }, + { + "path": [ + 4, + 3, + 1 + ], + "span": [ + 123, + 8, + 12 + ] + }, + { + "path": [ + 4, + 3, + 2, + 0 + ], + "span": [ + 125, + 2, + 24 + ], + "leadingComments": " Keep if all: comment on field s\n" + }, + { + "path": [ + 4, + 3, + 2, + 0, + 4 + ], + "span": [ + 125, + 2, + 10 + ] + }, + { + "path": [ + 4, + 3, + 2, + 0, + 5 + ], + "span": [ + 125, + 11, + 17 + ] + }, + { + "path": [ + 4, + 3, + 2, + 0, + 1 + ], + "span": [ + 125, + 18, + 19 + ] + }, + { + "path": [ + 4, + 3, + 2, + 0, + 3 + ], + "span": [ + 125, + 22, + 23 + ] + }, + { + "path": [ + 4, + 4 + ], + "span": [ + 129, + 0, + 132, + 1 + ], + "leadingComments": " Keep if all: comment on message Bedazzle\n" + }, + { + "path": [ + 4, + 4, + 1 + ], + "span": [ + 129, + 8, + 16 + ] + }, + { + "path": [ + 4, + 4, + 2, + 0 + ], + "span": [ + 131, + 2, + 24 + ], + "leadingComments": " Keep if all: comment on field t\n" + }, + { + "path": [ + 4, + 4, + 2, + 0, + 4 + ], + "span": [ + 131, + 2, + 10 + ] + }, + { + "path": [ + 4, + 4, + 2, + 0, + 5 + ], + "span": [ + 131, + 11, + 17 + ] + }, + { + "path": [ + 4, + 4, + 2, + 0, + 1 + ], + "span": [ + 131, + 18, + 19 + ] + }, + { + "path": [ + 4, + 4, + 2, + 0, + 3 + ], + "span": [ + 131, + 22, + 23 + ] + }, + { + "path": [ + 6, + 0 + ], + "span": [ + 135, + 0, + 138, + 1 + ], + "leadingComments": " Keep if all: comment on service BuzzService\n" + }, + { + "path": [ + 6, + 0, + 1 + ], + "span": [ + 135, + 8, + 19 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0 + ], + "span": [ + 137, + 2, + 41 + ], + "leadingComments": " Keep if all: comment on method BuzzyBuzz\n" + }, + { + "path": [ + 6, + 0, + 2, + 0, + 1 + ], + "span": [ + 137, + 6, + 15 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 2 + ], + "span": [ + 137, + 16, + 20 + ] + }, + { + "path": [ + 6, + 0, + 2, + 0, + 3 + ], + "span": [ + 137, + 31, + 39 + ] + }, + { + "path": [ + 6, + 1 + ], + "span": [ + 141, + 0, + 153, + 1 + ], + "leadingComments": " Keep if Svc: comment on service Svc\n" + }, + { + "path": [ + 6, + 1, + 1 + ], + "span": [ + 141, + 8, + 11 + ] + }, + { + "path": [ + 6, + 1, + 3 + ], + "span": [ + 143, + 2, + 29 + ] + }, + { + "path": [ + 6, + 1, + 3, + 10101 + ], + "span": [ + 143, + 2, + 29 + ], + "leadingComments": " Keep if Svc: comment on option\n" + }, + { + "path": [ + 6, + 1, + 2, + 0 + ], + "span": [ + 146, + 2, + 149, + 3 + ], + "leadingComments": " Keep if Svc.Do: comment on rpc Do\n" + }, + { + "path": [ + 6, + 1, + 2, + 0, + 1 + ], + "span": [ + 146, + 6, + 8 + ] + }, + { + "path": [ + 6, + 1, + 2, + 0, + 2 + ], + "span": [ + 146, + 9, + 12 + ] + }, + { + "path": [ + 6, + 1, + 2, + 0, + 3 + ], + "span": [ + 146, + 23, + 26 + ] + }, + { + "path": [ + 6, + 1, + 2, + 0, + 4 + ], + "span": [ + 148, + 4, + 47 + ] + }, + { + "path": [ + 6, + 1, + 2, + 0, + 4, + 34 + ], + "span": [ + 148, + 4, + 47 + ], + "leadingComments": " Keep if Svc.Do: comment on option\n" + }, + { + "path": [ + 6, + 1, + 2, + 1 + ], + "span": [ + 152, + 2, + 30 + ], + "leadingComments": " Keep if Svc: comment on rpc Dont\n" + }, + { + "path": [ + 6, + 1, + 2, + 1, + 1 + ], + "span": [ + 152, + 6, + 10 + ] + }, + { + "path": [ + 6, + 1, + 2, + 1, + 2 + ], + "span": [ + 152, + 11, + 14 + ] + }, + { + "path": [ + 6, + 1, + 2, + 1, + 3 + ], + "span": [ + 152, + 25, + 28 + ] + } + ] +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/test.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/test.proto new file mode 100644 index 000000000..7a3f7a929 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/test.proto @@ -0,0 +1,169 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Keep 1: comment on syntax +syntax = "proto2"; + +// Keep 2: comment on package +package foo.bar; + +// Keep 3: comment on option +option go_package = "foo.bar/baz"; + +// Keep if ext: comment on import descriptor.proto +import "google/protobuf/descriptor.proto"; + +// No keep +import weak "google/protobuf/struct.proto"; + +// Keep if NestedFoo: comment on import any.proto +import weak "google/protobuf/any.proto"; + +// Keep if ext: comment on extend block +extend google.protobuf.MessageOptions { + // Keep if ext: comment on custom option bizniz + optional string bizniz = 10101; +} + +// Keep if ext: comment on extend block +extend google.protobuf.ServiceOptions { + // Keep if ext + Svc: comment on custom option fizzbuzz + optional string fizzbuzz = 10101; +} + +// Keep if all: comment on message Frobnitz +message Frobnitz { + // Keep if all: comment on field xyz + optional bytes xyz = 1; +} + +// "Keep if Foo" are also kept for Bar, Svc, and Svc.Do since those +// elements depend on Foo. + +// Keep if Foo: comment on message Foo +message Foo { + // We keep the following comment for NestedFoo because we don't + // discard options or option comments even if we're only retaining + // a message as a namespace for another retained element. + + // Keep if Foo | NestedFoo: comment on option + option (bizniz) = "abc"; + + // Keep if Foo: comment on field name + optional string name = 1; + // Keep if Foo: comment on field bits + repeated int64 bits = 2; + + // Keep if Foo: comment on reserved range + reserved 10 to 20; + // Keep if Foo: comment on reserved names + reserved "abc", "def", "ghi"; + // Keep if Foo: comment on extension range + extensions 100 to max; + + // Keep if NestedFoo: comment on message NestedFoo + message NestedFoo { + // We keep the following comment for Foo + ext because we don't + // discard options or option comments even if we're only retaining + // a message as a namespace for another retained element. + + // Keep if Foo + ext | NestedFoo: comment on option + option (bizniz) = "abc"; + // Keep if NestedFoo: comment on field uid + optional uint64 uid = 1; + // Keep if NestedFoo: comment on field meta + repeated google.protobuf.Any meta = 2; + // Keep if NestedFoo: comment on field state + optional State state = 3; + + // Keep if NestedFoo: comment on enum State + enum State { + // Keep if NestedFoo: comment on enum value STATE_UNSPECIFIED + STATE_UNSPECIFIED = 0; + // Keep if NestedFoo: comment on enum value STATE_GOOD + STATE_GOOD = 1; + } + + // Keep if Foo + ext: comment on extend block + extend Foo { + // Keep if Foo + ext: comment on extension blah + repeated bytes blah = 101; + } + } +} + +// "Keep if Bar" are also kept for Svc and Svc.Do since those +// elements depend on Bar. + +// Keep if Bar: comment on message Bar +message Bar { + // Keep if Bar: comment on field foo + optional Foo foo = 1; + // Keep if Bar: comment on oneof status + oneof status { + // Keep if Bar: comment on field baz + Baz baz = 2; + // Keep if Bar: comment on field quz + Quz quz = 3; + } +} + +// "Keep if Baz" and "Keep if Quz" are also kept for Bar, Svc, and Svc.Do +// since those elements depend on Baz and Quz. + +// Keep if Baz: comment on enum Baz +enum Baz { + // Keep if Baz: comment on enum value BAZ_UNSPECIFIED + BAZ_UNSPECIFIED = 0; +} + +// Keep if Quz: comment on enum Quz +enum Quz { + // Keep if Quz: comment on enum value QUZ_UNSPECIFIED + QUZ_UNSPECIFIED = 0; +} + +// Keep if all: comment on message Buzz +message Buzz { + // Keep if all: comment on field s + optional string s = 1; +} + +// Keep if all: comment on message Bedazzle +message Bedazzle { + // Keep if all: comment on field t + optional string t = 1; +} + +// Keep if all: comment on service BuzzService +service BuzzService { + // Keep if all: comment on method BuzzyBuzz + rpc BuzzyBuzz(Buzz) returns (Bedazzle); +} + +// Keep if Svc: comment on service Svc +service Svc { + // Keep if Svc: comment on option + option (fizzbuzz) = "wxyz"; + + // Keep if Svc.Do: comment on rpc Do + rpc Do(Foo) returns (Bar) { + // Keep if Svc.Do: comment on option + option idempotency_level = NO_SIDE_EFFECTS; + } + + // Keep if Svc: comment on rpc Dont + rpc Dont(Foo) returns (Bar); +} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/image.go b/pkg/bufman/bufpkg/bufimage/image.go new file mode 100644 index 000000000..ec45e3be6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/image.go @@ -0,0 +1,126 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "errors" + "fmt" +) + +var _ Image = &image{} + +type image struct { + files []ImageFile + pathToImageFile map[string]ImageFile +} + +func newImage(files []ImageFile, reorder bool) (*image, error) { + if len(files) == 0 { + return nil, errors.New("image contains no files") + } + pathToImageFile := make(map[string]ImageFile, len(files)) + identityStringToCommit := make(map[string]string) + for _, file := range files { + path := file.Path() + if _, ok := pathToImageFile[path]; ok { + return nil, fmt.Errorf("duplicate file: %s", path) + } + pathToImageFile[path] = file + if moduleIdentity := file.ModuleIdentity(); moduleIdentity != nil { + identityString := moduleIdentity.IdentityString() + existingCommit, ok := identityStringToCommit[identityString] + if ok { + if existingCommit != file.Commit() { + return nil, fmt.Errorf("image had two different commits for the same module: %q and %q", existingCommit, file.Commit()) + } + } else { + identityStringToCommit[identityString] = file.Commit() + } + } + } + if reorder { + files = orderImageFiles(files, pathToImageFile) + } + return &image{ + files: files, + pathToImageFile: pathToImageFile, + }, nil +} + +func newImageNoValidate(files []ImageFile) *image { + pathToImageFile := make(map[string]ImageFile, len(files)) + for _, file := range files { + path := file.Path() + pathToImageFile[path] = file + } + return &image{ + files: files, + pathToImageFile: pathToImageFile, + } +} + +func (i *image) Files() []ImageFile { + return i.files +} + +func (i *image) GetFile(path string) ImageFile { + return i.pathToImageFile[path] +} + +func (*image) isImage() {} + +// orderImageFiles re-orders the ImageFiles in DAG order. +func orderImageFiles( + inputImageFiles []ImageFile, + pathToImageFile map[string]ImageFile, +) []ImageFile { + outputImageFiles := make([]ImageFile, 0, len(inputImageFiles)) + alreadySeen := map[string]struct{}{} + for _, inputImageFile := range inputImageFiles { + outputImageFiles = orderImageFilesRec( + inputImageFile, + outputImageFiles, + pathToImageFile, + alreadySeen, + ) + } + return outputImageFiles +} + +func orderImageFilesRec( + inputImageFile ImageFile, + outputImageFiles []ImageFile, + pathToImageFile map[string]ImageFile, + alreadySeen map[string]struct{}, +) []ImageFile { + path := inputImageFile.Path() + if _, ok := alreadySeen[path]; ok { + return outputImageFiles + } + alreadySeen[path] = struct{}{} + for _, dependency := range inputImageFile.FileDescriptor().GetDependency() { + dependencyImageFile, ok := pathToImageFile[dependency] + if ok { + outputImageFiles = orderImageFilesRec( + dependencyImageFile, + outputImageFiles, + pathToImageFile, + alreadySeen, + ) + } + } + return append(outputImageFiles, inputImageFile) +} diff --git a/pkg/bufman/bufpkg/bufimage/image_file.go b/pkg/bufman/bufpkg/bufimage/image_file.go new file mode 100644 index 000000000..b178d0ae2 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/image_file.go @@ -0,0 +1,99 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "google.golang.org/protobuf/types/descriptorpb" +) + +var _ ImageFile = &imageFile{} + +type imageFile struct { + bufmoduleref.FileInfo + + fileDescriptorProto *descriptorpb.FileDescriptorProto + + isSyntaxUnspecified bool + storedUnusedDependencyIndexes []int32 +} + +func newImageFile( + fileDescriptor protodescriptor.FileDescriptor, + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, + externalPath string, + isImport bool, + isSyntaxUnspecified bool, + unusedDependencyIndexes []int32, +) (*imageFile, error) { + if err := protodescriptor.ValidateFileDescriptor(fileDescriptor); err != nil { + return nil, err + } + fileInfo, err := bufmoduleref.NewFileInfo( + fileDescriptor.GetName(), + externalPath, + isImport, + moduleIdentity, + commit, + ) + if err != nil { + return nil, err + } + // just to normalize in other places between empty and unset + if len(unusedDependencyIndexes) == 0 { + unusedDependencyIndexes = nil + } + return &imageFile{ + FileInfo: fileInfo, + // protodescriptor.FileDescriptorProtoForFileDescriptor is a no-op if fileDescriptor + // is already a *descriptorpb.FileDescriptorProto + fileDescriptorProto: protodescriptor.FileDescriptorProtoForFileDescriptor(fileDescriptor), + isSyntaxUnspecified: isSyntaxUnspecified, + storedUnusedDependencyIndexes: unusedDependencyIndexes, + }, nil +} + +func (f *imageFile) Proto() *descriptorpb.FileDescriptorProto { + return f.fileDescriptorProto +} + +func (f *imageFile) FileDescriptor() protodescriptor.FileDescriptor { + return f.fileDescriptorProto +} + +func (f *imageFile) IsSyntaxUnspecified() bool { + return f.isSyntaxUnspecified +} + +func (f *imageFile) UnusedDependencyIndexes() []int32 { + return f.storedUnusedDependencyIndexes +} + +func (f *imageFile) withIsImport(isImport bool) ImageFile { + if f.IsImport() == isImport { + return f + } + return &imageFile{ + FileInfo: f.FileInfo.WithIsImport(isImport), + fileDescriptorProto: f.fileDescriptorProto, + isSyntaxUnspecified: f.isSyntaxUnspecified, + storedUnusedDependencyIndexes: f.storedUnusedDependencyIndexes, + } +} + +func (*imageFile) isImageFile() {} diff --git a/pkg/bufman/bufpkg/bufimage/image_module_dependency.go b/pkg/bufman/bufpkg/bufimage/image_module_dependency.go new file mode 100644 index 000000000..41b7f1f3c --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/image_module_dependency.go @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" +) + +var _ ImageModuleDependency = &imageModuleDependency{} + +type imageModuleDependency struct { + moduleIdentity bufmoduleref.ModuleIdentity + commit string + isDirect bool +} + +func newImageModuleDependency( + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, + isDirect bool, +) *imageModuleDependency { + return &imageModuleDependency{ + moduleIdentity: moduleIdentity, + commit: commit, + isDirect: isDirect, + } +} + +func (i *imageModuleDependency) ModuleIdentity() bufmoduleref.ModuleIdentity { + return i.moduleIdentity +} + +func (i *imageModuleDependency) Commit() string { + return i.commit +} + +func (i *imageModuleDependency) IsDirect() bool { + return i.isDirect +} + +func (i *imageModuleDependency) String() string { + moduleIdentityString := i.moduleIdentity.IdentityString() + if i.commit != "" { + return moduleIdentityString + ":" + i.commit + } + return moduleIdentityString +} + +func (*imageModuleDependency) isImageModuleDependency() {} diff --git a/pkg/bufman/bufpkg/bufimage/image_test.go b/pkg/bufman/bufpkg/bufimage/image_test.go new file mode 100644 index 000000000..ae9d60b02 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/image_test.go @@ -0,0 +1,140 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "testing" + + imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" +) + +func TestMergeImagesWithImports(t *testing.T) { + t.Parallel() + firstProtoImage := &imagev1.Image{ + File: []*imagev1.ImageFile{ + { + Syntax: proto.String("proto3"), + Name: proto.String("a.proto"), + Dependency: []string{"b.proto"}, + }, + { + Syntax: proto.String("proto3"), + Name: proto.String("b.proto"), + BufExtension: &imagev1.ImageFileExtension{ + IsImport: proto.Bool(true), + }, + }, + { + Syntax: proto.String("proto3"), + Name: proto.String("c.proto"), + BufExtension: &imagev1.ImageFileExtension{ + IsImport: proto.Bool(true), + }, + }, + }, + } + secondProtoImage := &imagev1.Image{ + File: []*imagev1.ImageFile{ + { + Syntax: proto.String("proto3"), + Name: proto.String("b.proto"), + }, + }, + } + + firstImage, err := NewImageForProto(firstProtoImage) + require.NoError(t, err) + secondImage, err := NewImageForProto(secondProtoImage) + require.NoError(t, err) + mergedImage, err := MergeImages(firstImage, secondImage) + require.NoError(t, err) + + imageFiles := mergedImage.Files() + require.Len(t, imageFiles, 3) + assert.False(t, mergedImage.GetFile("a.proto").IsImport()) + assert.False(t, mergedImage.GetFile("b.proto").IsImport()) + assert.True(t, mergedImage.GetFile("c.proto").IsImport()) +} + +func TestMergeImagesWithDuplicateFile(t *testing.T) { + t.Parallel() + firstProtoImage := &imagev1.Image{ + File: []*imagev1.ImageFile{ + { + Syntax: proto.String("proto3"), + Name: proto.String("a.proto"), + }, + }, + } + secondProtoImage := &imagev1.Image{ + File: []*imagev1.ImageFile{ + { + Syntax: proto.String("proto3"), + Name: proto.String("a.proto"), + }, + }, + } + + firstImage, err := NewImageForProto(firstProtoImage) + require.NoError(t, err) + secondImage, err := NewImageForProto(secondProtoImage) + require.NoError(t, err) + _, err = MergeImages(firstImage, secondImage) + require.Error(t, err) +} + +func TestMergeImagesOrdered(t *testing.T) { + t.Parallel() + firstProtoImage := &imagev1.Image{ + File: []*imagev1.ImageFile{ + { + Syntax: proto.String("proto3"), + Name: proto.String("a.proto"), + }, + { + Syntax: proto.String("proto3"), + Name: proto.String("b.proto"), + }, + }, + } + secondProtoImage := &imagev1.Image{ + File: []*imagev1.ImageFile{ + { + Syntax: proto.String("proto3"), + Name: proto.String("c.proto"), + }, + { + Syntax: proto.String("proto3"), + Name: proto.String("d.proto"), + }, + }, + } + + firstImage, err := NewImageForProto(firstProtoImage) + require.NoError(t, err) + secondImage, err := NewImageForProto(secondProtoImage) + require.NoError(t, err) + image, err := MergeImages(firstImage, secondImage) + require.NoError(t, err) + var paths []string + for _, imageFile := range image.Files() { + paths = append(paths, imageFile.Path()) + } + assert.Equal(t, []string{"a.proto", "b.proto", "c.proto", "d.proto"}, paths) +} diff --git a/pkg/bufman/bufpkg/bufimage/import_tracker.go b/pkg/bufman/bufpkg/bufimage/import_tracker.go new file mode 100644 index 000000000..f68dad92e --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/import_tracker.go @@ -0,0 +1,227 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "strings" + + imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/known/anypb" +) + +var anyMessageName = (*anypb.Any)(nil).ProtoReflect().Descriptor().FullName() + +type importTracker struct { + resolver protoencoding.Resolver + used map[string]map[string]struct{} +} + +func (t *importTracker) markUsed(importer *imagev1.ImageFile, element string) { + desc, err := t.resolver.FindDescriptorByName(protoreflect.FullName(strings.TrimPrefix(element, "."))) + if err != nil { + // TODO: Shouldn't be possible. If this happens, element is not in + // the resolved files, so nothing to mark anyway... + return + } + importedFile := desc.ParentFile().Path() + + fileImports := t.used[importer.GetName()] + if fileImports == nil { + fileImports = map[string]struct{}{} + t.used[importer.GetName()] = fileImports + } + for _, depPath := range importer.Dependency { + if importedFile == depPath { + // Found it! + fileImports[depPath] = struct{}{} + return + } + } + // Not in any imports. So see if it is publicly imported. + for _, depPath := range importer.Dependency { + depFile, err := t.resolver.FindFileByPath(depPath) + if err != nil { + // Shouldn't be possible... bail. + continue + } + if t.publiclyImports(depFile, importedFile) { + // Found it! + fileImports[depPath] = struct{}{} + return + } + } +} + +func (t *importTracker) publiclyImports(file protoreflect.FileDescriptor, importedFile string) bool { + deps := file.Imports() + for i, depsLen := 0, deps.Len(); i < depsLen; i++ { + dep := deps.Get(i) + if !dep.IsPublic { + continue + } + if dep.Path() == importedFile { + return true + } + if t.publiclyImports(dep, importedFile) { + return true + } + } + return false +} + +func (t *importTracker) findUsedImports(protoImage *imagev1.Image) { + for _, file := range protoImage.File { + if len(file.Dependency) == 0 { + // no imports so nothing to do + continue + } + t.findUsedImportsInOptions(file, file.Options) + for _, msg := range file.MessageType { + t.findUsedImportsInMessage(file, msg) + } + for _, enum := range file.EnumType { + t.findUsedImportsInEnum(file, enum) + } + for _, ext := range file.Extension { + t.findUsedImportsInField(file, ext) + } + for _, svc := range file.Service { + t.findUsedImportsInOptions(file, svc.Options) + for _, method := range svc.Method { + t.findUsedImportsInOptions(file, method.Options) + t.markUsed(file, method.GetInputType()) + t.markUsed(file, method.GetOutputType()) + } + } + } +} + +func (t *importTracker) findUsedImportsInMessage(file *imagev1.ImageFile, msg *descriptorpb.DescriptorProto) { + t.findUsedImportsInOptions(file, msg.Options) + for _, field := range msg.Field { + t.findUsedImportsInField(file, field) + } + for _, oneof := range msg.OneofDecl { + t.findUsedImportsInOptions(file, oneof.Options) + } + for _, extRange := range msg.ExtensionRange { + t.findUsedImportsInOptions(file, extRange.Options) + } + + for _, nestedMsg := range msg.NestedType { + t.findUsedImportsInMessage(file, nestedMsg) + } + for _, enum := range msg.EnumType { + t.findUsedImportsInEnum(file, enum) + } + for _, ext := range msg.Extension { + t.findUsedImportsInField(file, ext) + } +} + +func (t *importTracker) findUsedImportsInEnum(file *imagev1.ImageFile, enum *descriptorpb.EnumDescriptorProto) { + t.findUsedImportsInOptions(file, enum.Options) + for _, value := range enum.Value { + t.findUsedImportsInOptions(file, value.Options) + } +} + +func (t *importTracker) findUsedImportsInField(file *imagev1.ImageFile, field *descriptorpb.FieldDescriptorProto) { + t.findUsedImportsInOptions(file, field.Options) + switch field.GetType() { + case descriptorpb.FieldDescriptorProto_TYPE_MESSAGE, + descriptorpb.FieldDescriptorProto_TYPE_GROUP, + descriptorpb.FieldDescriptorProto_TYPE_ENUM: + t.markUsed(file, field.GetTypeName()) + } + extendee := field.GetExtendee() + if extendee != "" { + t.markUsed(file, extendee) + } +} + +func (t *importTracker) findUsedImportsInOptions(file *imagev1.ImageFile, optionMessage proto.Message) { + optionMessage.ProtoReflect().Range(func(field protoreflect.FieldDescriptor, val protoreflect.Value) bool { + t.findUsedImportsInOptionValue(file, field, val) + return true + }) +} + +func (t *importTracker) findUsedImportsInOptionValue(file *imagev1.ImageFile, optionField protoreflect.FieldDescriptor, val protoreflect.Value) { + if optionField.IsExtension() { + t.markUsed(file, string(optionField.FullName())) + } + switch { + case optionField.IsMap(): + if optionField.MapValue().Message() == nil { + return // no messages to examine + } + val.Map().Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { + t.findUsedImportsInMessageValue(file, v.Message()) + return true + }) + case optionField.IsList(): + if optionField.Message() == nil { + return // no messages to examine + } + list := val.List() + for i, l := 0, list.Len(); i < l; i++ { + t.findUsedImportsInMessageValue(file, list.Get(i).Message()) + } + case optionField.Message() != nil: + t.findUsedImportsInMessageValue(file, val.Message()) + } +} + +func (t *importTracker) findUsedImportsInMessageValue(file *imagev1.ImageFile, msg protoreflect.Message) { + if msg.Descriptor().FullName() == anyMessageName { + typeURLField := msg.Descriptor().Fields().ByNumber(1) + if typeURLField == nil || typeURLField.Kind() != protoreflect.StringKind || typeURLField.IsList() { + // ruh-roh... this should not happen + return + } + valueField := msg.Descriptor().Fields().ByNumber(2) + if valueField == nil || valueField.Kind() != protoreflect.BytesKind || valueField.IsList() { + // oof, this should not happen + return + } + + typeURL := msg.Get(typeURLField).String() + msgType, err := t.resolver.FindMessageByURL(typeURL) + if err != nil { + // message is not present in the image + return + } + t.markUsed(file, string(msgType.Descriptor().FullName())) + // process Any messages that might be nested inside this one + value := msg.Get(valueField).Bytes() + nestedMessage := msgType.New() + err = proto.UnmarshalOptions{Resolver: t.resolver}.Unmarshal(value, nestedMessage.Interface()) + if err != nil { + // bytes are not valid; skip it + return + } + msg = nestedMessage // fall-through to recurse into this message + } + msg.Range(func(field protoreflect.FieldDescriptor, val protoreflect.Value) bool { + t.findUsedImportsInOptionValue(file, field, val) + return true + }) +} diff --git a/pkg/bufman/bufpkg/bufimage/util.go b/pkg/bufman/bufpkg/bufimage/util.go new file mode 100644 index 000000000..5283b9a31 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/util.go @@ -0,0 +1,569 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "errors" + "fmt" + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/data/datawkt" + imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +// Must match the tag number for ImageFile.buf_extensions defined in proto/buf/alpha/image/v1/image.proto. +const bufExtensionFieldNumber = 8042 + +// paths can be either files (ending in .proto) or directories +// paths must be normalized and validated, and not duplicated +// if a directory, all .proto files underneath will be included +func imageWithOnlyPaths(image Image, fileOrDirPaths []string, excludeFileOrDirPaths []string, allowNotExist bool) (Image, error) { + if err := normalpath.ValidatePathsNormalizedValidatedUnique(fileOrDirPaths); err != nil { + return nil, err + } + if err := normalpath.ValidatePathsNormalizedValidatedUnique(excludeFileOrDirPaths); err != nil { + return nil, err + } + excludeFileOrDirPathMap := stringutil.SliceToMap(excludeFileOrDirPaths) + // These are the files that fileOrDirPaths actually reference and will + // result in the non-imports in our resulting Image. The Image will also include + // the ImageFiles that the nonImportImageFiles import + nonImportPaths := make(map[string]struct{}) + var nonImportImageFiles []ImageFile + // We have only exclude paths, and therefore all other paths are target paths. + if len(fileOrDirPaths) == 0 && len(excludeFileOrDirPaths) > 0 { + for _, imageFile := range image.Files() { + if !imageFile.IsImport() { + if !normalpath.MapHasEqualOrContainingPath(excludeFileOrDirPathMap, imageFile.Path(), normalpath.Relative) { + nonImportPaths[imageFile.Path()] = struct{}{} + nonImportImageFiles = append(nonImportImageFiles, imageFile) + } + } + } + // Finally, before we construct the image, we need to validate that all exclude paths + // provided adhere to the allowNotExist flag. + if !allowNotExist { + if err := checkExcludePathsExistInImage(image, excludeFileOrDirPaths); err != nil { + return nil, err + } + } + return getImageWithImports(image, nonImportPaths, nonImportImageFiles) + } + // We do a check here to ensure that no paths are duplicated as a target and an exclude. + for _, fileOrDirPath := range fileOrDirPaths { + if _, ok := excludeFileOrDirPathMap[fileOrDirPath]; ok { + return nil, fmt.Errorf( + "cannot set the same path for both --path and --exclude-path flags: %s", + normalpath.Unnormalize(fileOrDirPath), + ) + } + } + // potentialDirPaths are paths that we need to check if they are directories + // these are any files that do not end in .proto, as well as files that + // end in .proto but do not have a corresponding ImageFile - if there + // is not an ImageFile, the path ending in .proto could be a directory + // that itself contains ImageFiles, i.e. a/b.proto/c.proto is valid if not dumb + var potentialDirPaths []string + for _, fileOrDirPath := range fileOrDirPaths { + // this is not allowed, this is the equivalent of a root + if fileOrDirPath == "." { + return nil, errors.New(`"." is not a valid path value`) + } + if normalpath.Ext(fileOrDirPath) != ".proto" { + // not a .proto file, therefore must be a directory + potentialDirPaths = append(potentialDirPaths, fileOrDirPath) + } else { + if imageFile := image.GetFile(fileOrDirPath); imageFile != nil { + // We do not need to check excludes here, since we already checked for duplicated + // paths, and target files that resolve to a specific image file are always a leaf, + // thus, we would always include it if it's specified. + // We have an ImageFile, therefore the fileOrDirPath was a file path + // add to the nonImportImageFiles if does not already exist + if _, ok := nonImportPaths[fileOrDirPath]; !ok { + nonImportPaths[fileOrDirPath] = struct{}{} + nonImportImageFiles = append(nonImportImageFiles, imageFile) + } + } else { + // we do not have an image file, so even though this path ends + // in .proto, this could be a directory - we need to check it + potentialDirPaths = append(potentialDirPaths, fileOrDirPath) + } + } + } + if len(potentialDirPaths) == 0 { + // We had no potential directory paths as we were able to get + // an ImageFile for all fileOrDirPaths, so we can return an Image now. + // This means we do not have to do the expensive O(image.Files()) operation + // to check to see if each file is within a potential directory path. + // + // We do not need to check the excluded paths for the allowNotExist flag because all target + // paths were image files, therefore the exclude paths would not apply in this case. + // + // Unfortunately, we need to do the expensive operation of checking to make sure the exclude + // paths exist in the case where `allowNotExist == false`. + if !allowNotExist { + if err := checkExcludePathsExistInImage(image, excludeFileOrDirPaths); err != nil { + return nil, err + } + } + return getImageWithImports(image, nonImportPaths, nonImportImageFiles) + } + // we have potential directory paths, do the expensive operation + // make a map of the directory paths + // note that we do not make this a map to begin with as maps are unordered, + // and we want to make sure we iterate over the paths in a deterministic order + potentialDirPathMap := stringutil.SliceToMap(potentialDirPaths) + + // map of all paths based on the imageFiles + // the map of paths within potentialDirPath that matches a file in image.Files() + // this needs to contain all paths in potentialDirPathMap at the end for us to + // have had matches for every inputted fileOrDirPath + matchingPotentialDirPathMap := make(map[string]struct{}) + // the same thing is done for exclude paths + matchingPotentialExcludePathMap := make(map[string]struct{}) + for _, imageFile := range image.Files() { + imageFilePath := imageFile.Path() + fileMatchingExcludePathMap := normalpath.MapAllEqualOrContainingPathMap( + excludeFileOrDirPathMap, + imageFilePath, + normalpath.Relative, + ) + if len(fileMatchingExcludePathMap) > 0 { + for key := range fileMatchingExcludePathMap { + matchingPotentialExcludePathMap[key] = struct{}{} + } + } + // get the paths in potentialDirPathMap that match this imageFilePath + fileMatchingPathMap := normalpath.MapAllEqualOrContainingPathMap( + potentialDirPathMap, + imageFilePath, + normalpath.Relative, + ) + if shouldExcludeFile(fileMatchingPathMap, fileMatchingExcludePathMap) { + continue + } + if len(fileMatchingPathMap) > 0 { + // we had a match, this means that some path in potentialDirPaths matched + // the imageFilePath, add all the paths in potentialDirPathMap that + // matched to matchingPotentialDirPathMap + for key := range fileMatchingPathMap { + matchingPotentialDirPathMap[key] = struct{}{} + } + // then, add the file to non-imports if it is not added + if _, ok := nonImportPaths[imageFilePath]; !ok { + nonImportPaths[imageFilePath] = struct{}{} + nonImportImageFiles = append(nonImportImageFiles, imageFile) + } + } + } + // if !allowNotExist, i.e. if all fileOrDirPaths must have a matching ImageFile, + // we check the matchingPotentialDirPathMap against the potentialDirPathMap + // to make sure that potentialDirPathMap is covered + if !allowNotExist { + for potentialDirPath := range potentialDirPathMap { + if _, ok := matchingPotentialDirPathMap[potentialDirPath]; !ok { + // no match, this is an error given that allowNotExist is false + return nil, fmt.Errorf("path %q has no matching file in the image", potentialDirPath) + } + } + for excludeFileOrDirPath := range excludeFileOrDirPathMap { + if _, ok := matchingPotentialExcludePathMap[excludeFileOrDirPath]; !ok { + // no match, this is an error given that allowNotExist is false + return nil, fmt.Errorf("path %q has no matching file in the image", excludeFileOrDirPath) + } + } + } + // we finally have all files that match fileOrDirPath that we can find, make the image + return getImageWithImports(image, nonImportPaths, nonImportImageFiles) +} + +// shouldExcludeFile takes the map of all the matching target paths and the map of all the matching +// exclude paths for an image file and takes the union of the two sets of matches to return +// a bool on whether or not we should exclude the file from the image. +func shouldExcludeFile( + fileMatchingPathMap map[string]struct{}, + fileMatchingExcludePathMap map[string]struct{}, +) bool { + for fileMatchingPath := range fileMatchingPathMap { + for fileMatchingExcludePath := range fileMatchingExcludePathMap { + if normalpath.EqualsOrContainsPath(fileMatchingPath, fileMatchingExcludePath, normalpath.Relative) { + delete(fileMatchingPathMap, fileMatchingPath) + continue + } + } + } + // If there are no potential paths remaining, + // then the file should be excluded. + return len(fileMatchingPathMap) == 0 +} + +func getImageWithImports( + image Image, + nonImportPaths map[string]struct{}, + nonImportImageFiles []ImageFile, +) (Image, error) { + var imageFiles []ImageFile + seenPaths := make(map[string]struct{}) + for _, nonImportImageFile := range nonImportImageFiles { + imageFiles = addFileWithImports( + imageFiles, + image, + nonImportPaths, + seenPaths, + nonImportImageFile, + ) + } + return NewImage(imageFiles) +} + +// returns accumulated files in correct order +func addFileWithImports( + accumulator []ImageFile, + image Image, + nonImportPaths map[string]struct{}, + seenPaths map[string]struct{}, + imageFile ImageFile, +) []ImageFile { + path := imageFile.Path() + // if seen already, skip + if _, ok := seenPaths[path]; ok { + return accumulator + } + seenPaths[path] = struct{}{} + + // then, add imports first, for proper ordering + for _, importPath := range imageFile.FileDescriptor().GetDependency() { + if importFile := image.GetFile(importPath); importFile != nil { + accumulator = addFileWithImports( + accumulator, + image, + nonImportPaths, + seenPaths, + importFile, + ) + } + } + + // finally, add this file + // check if this is an import or not + _, isNotImport := nonImportPaths[path] + accumulator = append( + accumulator, + imageFile.withIsImport(!isNotImport), + ) + return accumulator +} + +func checkExcludePathsExistInImage(image Image, excludeFileOrDirPaths []string) error { + for _, excludeFileOrDirPath := range excludeFileOrDirPaths { + var foundPath bool + for _, imageFile := range image.Files() { + if normalpath.EqualsOrContainsPath(excludeFileOrDirPath, imageFile.Path(), normalpath.Relative) { + foundPath = true + break + } + } + if !foundPath { + // no match, this is an error given that allowNotExist is false + return fmt.Errorf("path %q has no matching file in the image", excludeFileOrDirPath) + } + } + return nil +} + +func protoImageFilesToFileDescriptors(protoImageFiles []*imagev1.ImageFile) []protodescriptor.FileDescriptor { + fileDescriptors := make([]protodescriptor.FileDescriptor, len(protoImageFiles)) + for i, protoImageFile := range protoImageFiles { + fileDescriptors[i] = protoImageFile + } + return fileDescriptors +} + +func imageFilesToFileDescriptors(imageFiles []ImageFile) []protodescriptor.FileDescriptor { + fileDescriptors := make([]protodescriptor.FileDescriptor, len(imageFiles)) + for i, imageFile := range imageFiles { + fileDescriptors[i] = imageFile.FileDescriptor() + } + return fileDescriptors +} + +func imageFilesToFileDescriptorProtos(imageFiles []ImageFile) []*descriptorpb.FileDescriptorProto { + fileDescriptorProtos := make([]*descriptorpb.FileDescriptorProto, len(imageFiles)) + for i, imageFile := range imageFiles { + fileDescriptorProtos[i] = imageFile.Proto() + } + return fileDescriptorProtos +} + +func imageFileToProtoImageFile(imageFile ImageFile) *imagev1.ImageFile { + return fileDescriptorProtoToProtoImageFile( + imageFile.Proto(), + imageFile.IsImport(), + imageFile.IsSyntaxUnspecified(), + imageFile.UnusedDependencyIndexes(), + imageFile.ModuleIdentity(), + imageFile.Commit(), + ) +} + +func fileDescriptorProtoToProtoImageFile( + fileDescriptorProto *descriptorpb.FileDescriptorProto, + isImport bool, + isSyntaxUnspecified bool, + unusedDependencyIndexes []int32, + moduleIdentity bufmoduleref.ModuleIdentity, + moduleCommit string, +) *imagev1.ImageFile { + var protoModuleInfo *imagev1.ModuleInfo + if moduleIdentity != nil { + protoModuleInfo = &imagev1.ModuleInfo{ + Name: &imagev1.ModuleName{ + Remote: proto.String(moduleIdentity.Remote()), + Owner: proto.String(moduleIdentity.Owner()), + Repository: proto.String(moduleIdentity.Repository()), + }, + } + if moduleCommit != "" { + protoModuleInfo.Commit = proto.String(moduleCommit) + } + } + if len(unusedDependencyIndexes) == 0 { + unusedDependencyIndexes = nil + } + resultFile := &imagev1.ImageFile{ + Name: fileDescriptorProto.Name, + Package: fileDescriptorProto.Package, + Syntax: fileDescriptorProto.Syntax, + Dependency: fileDescriptorProto.GetDependency(), + PublicDependency: fileDescriptorProto.GetPublicDependency(), + WeakDependency: fileDescriptorProto.GetWeakDependency(), + MessageType: fileDescriptorProto.GetMessageType(), + EnumType: fileDescriptorProto.GetEnumType(), + Service: fileDescriptorProto.GetService(), + Extension: fileDescriptorProto.GetExtension(), + Options: fileDescriptorProto.GetOptions(), + SourceCodeInfo: fileDescriptorProto.GetSourceCodeInfo(), + Edition: fileDescriptorProto.Edition, + BufExtension: &imagev1.ImageFileExtension{ + // we might actually want to differentiate between unset and false + IsImport: proto.Bool(isImport), + // we might actually want to differentiate between unset and false + IsSyntaxUnspecified: proto.Bool(isSyntaxUnspecified), + UnusedDependency: unusedDependencyIndexes, + ModuleInfo: protoModuleInfo, + }, + } + resultFile.ProtoReflect().SetUnknown(stripBufExtensionField(fileDescriptorProto.ProtoReflect().GetUnknown())) + return resultFile +} + +func stripBufExtensionField(unknownFields protoreflect.RawFields) protoreflect.RawFields { + // We accumulate the new bytes in result. However, for efficiency, we don't do any + // allocation/copying until we have to (i.e. until we actually see the field we're + // trying to strip). So result will be left nil and initialized lazily if-and-only-if + // we actually need to strip data from unknownFields. + var result protoreflect.RawFields + bytesRemaining := unknownFields + for len(bytesRemaining) > 0 { + num, wireType, n := protowire.ConsumeTag(bytesRemaining) + if n < 0 { + // shouldn't be possible unless explicitly set to invalid bytes via reflection + return unknownFields + } + var skip bool + if num == bufExtensionFieldNumber { + // We need to strip this field. + skip = true + if result == nil { + // Lazily initialize result to the preface that we've already examined. + result = append( + make(protoreflect.RawFields, 0, len(unknownFields)), + unknownFields[:len(unknownFields)-len(bytesRemaining)]..., + ) + } + } else if result != nil { + // accumulate data in result as we go + result = append(result, bytesRemaining[:n]...) + } + bytesRemaining = bytesRemaining[n:] + n = protowire.ConsumeFieldValue(num, wireType, bytesRemaining) + if n < 0 { + return unknownFields + } + if !skip && result != nil { + result = append(result, bytesRemaining[:n]...) + } + bytesRemaining = bytesRemaining[n:] + } + if result == nil { + // we did not have to remove anything + return unknownFields + } + return result +} + +func imageToCodeGeneratorRequest( + image Image, + parameter string, + compilerVersion *pluginpb.Version, + includeImports bool, + includeWellKnownTypes bool, + alreadyUsedPaths map[string]struct{}, + nonImportPaths map[string]struct{}, +) *pluginpb.CodeGeneratorRequest { + imageFiles := image.Files() + request := &pluginpb.CodeGeneratorRequest{ + ProtoFile: make([]*descriptorpb.FileDescriptorProto, len(imageFiles)), + CompilerVersion: compilerVersion, + } + if parameter != "" { + request.Parameter = proto.String(parameter) + } + for i, imageFile := range imageFiles { + request.ProtoFile[i] = imageFile.Proto() + if isFileToGenerate( + imageFile, + alreadyUsedPaths, + nonImportPaths, + includeImports, + includeWellKnownTypes, + ) { + request.FileToGenerate = append(request.FileToGenerate, imageFile.Path()) + } + } + return request +} + +func isFileToGenerate( + imageFile ImageFile, + alreadyUsedPaths map[string]struct{}, + nonImportPaths map[string]struct{}, + includeImports bool, + includeWellKnownTypes bool, +) bool { + path := imageFile.Path() + if !imageFile.IsImport() { + if alreadyUsedPaths != nil { + // set as already used + alreadyUsedPaths[path] = struct{}{} + } + // this is a non-import in this image, we always want to generate + return true + } + if !includeImports { + // we don't want to include imports + return false + } + if !includeWellKnownTypes && datawkt.Exists(path) { + // we don't want to generate wkt even if includeImports is set unless + // includeWellKnownTypes is set + return false + } + if alreadyUsedPaths != nil { + if _, ok := alreadyUsedPaths[path]; ok { + // this was already added for generate to another image + return false + } + } + if nonImportPaths != nil { + if _, ok := nonImportPaths[path]; ok { + // this is a non-import in another image so it will be generated + // from another image + return false + } + } + // includeImports is set, this isn't a wkt, and it won't be generated in another image + if alreadyUsedPaths != nil { + // set as already used + alreadyUsedPaths[path] = struct{}{} + } + return true +} + +func sortImageModuleDependencies(imageModuleDependencies []ImageModuleDependency) { + sort.Slice(imageModuleDependencies, func(i, j int) bool { + return imageModuleDependencyLess(imageModuleDependencies[i], imageModuleDependencies[j]) + }) +} + +func imageModuleDependencyLess(a ImageModuleDependency, b ImageModuleDependency) bool { + return imageModuleDependencyCompareTo(a, b) < 0 +} + +// return -1 if less +// return 1 if greater +// return 0 if equal +func imageModuleDependencyCompareTo(a ImageModuleDependency, b ImageModuleDependency) int { + if a == nil && b == nil { + return 0 + } + if a == nil && b != nil { + return -1 + } + if a != nil && b == nil { + return 1 + } + aModuleIdentity := a.ModuleIdentity() + bModuleIdentity := b.ModuleIdentity() + if aModuleIdentity != nil || bModuleIdentity != nil { + if aModuleIdentity == nil && bModuleIdentity != nil { + return -1 + } + if aModuleIdentity != nil && bModuleIdentity == nil { + return 1 + } + if aModuleIdentity.Remote() < bModuleIdentity.Remote() { + return -1 + } + if aModuleIdentity.Remote() > bModuleIdentity.Remote() { + return 1 + } + if aModuleIdentity.Owner() < bModuleIdentity.Owner() { + return -1 + } + if aModuleIdentity.Owner() > bModuleIdentity.Owner() { + return 1 + } + if aModuleIdentity.Repository() < bModuleIdentity.Repository() { + return -1 + } + if aModuleIdentity.Repository() > bModuleIdentity.Repository() { + return 1 + } + } + if a.Commit() < b.Commit() { + return -1 + } + if a.Commit() > b.Commit() { + return 1 + } + if a.IsDirect() && !b.IsDirect() { + return -1 + } + if !a.IsDirect() && b.IsDirect() { + return 1 + } + return 0 +} diff --git a/pkg/bufman/bufpkg/bufimage/util_test.go b/pkg/bufman/bufpkg/bufimage/util_test.go new file mode 100644 index 000000000..266f5005d --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/util_test.go @@ -0,0 +1,203 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "bytes" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/descriptorpb" +) + +func TestStripBufExtensionField(t *testing.T) { + t.Parallel() + file := &imagev1.ImageFile{ + BufExtension: &imagev1.ImageFileExtension{ + IsImport: proto.Bool(true), + UnusedDependency: []int32{1, 3, 5}, + ModuleInfo: &imagev1.ModuleInfo{ + Name: &imagev1.ModuleName{ + Remote: proto.String("buf.build"), + Owner: proto.String("foo"), + Repository: proto.String("bar"), + }, + Commit: proto.String("1234981234123412341234"), + }, + }, + } + dataToBeStripped, err := proto.Marshal(file) + require.NoError(t, err) + + otherData := protowire.AppendTag(nil, 122, protowire.BytesType) + otherData = protowire.AppendBytes(otherData, []byte{1, 18, 28, 123, 5, 3, 1}) + otherData = protowire.AppendTag(otherData, 123, protowire.VarintType) + otherData = protowire.AppendVarint(otherData, 23456) + otherData = protowire.AppendTag(otherData, 124, protowire.Fixed32Type) + otherData = protowire.AppendFixed32(otherData, 23456) + otherData = protowire.AppendTag(otherData, 125, protowire.Fixed64Type) + otherData = protowire.AppendFixed64(otherData, 23456) + otherData = protowire.AppendTag(otherData, 126, protowire.StartGroupType) + { + otherData = protowire.AppendTag(otherData, 1, protowire.VarintType) + otherData = protowire.AppendVarint(otherData, 123) + otherData = protowire.AppendTag(otherData, 2, protowire.BytesType) + otherData = protowire.AppendBytes(otherData, []byte("foo-bar-baz")) + } + otherData = protowire.AppendTag(otherData, 126, protowire.EndGroupType) + + testCases := []struct { + name string + input []byte + expectedOutput []byte + }{ + { + name: "nothing to strip", + input: otherData, + expectedOutput: otherData, + }, + { + name: "nothing left after strip", + input: dataToBeStripped, + expectedOutput: []byte{}, + }, + { + name: "stripped field at start", + input: bytes.Join([][]byte{dataToBeStripped, otherData}, nil), + expectedOutput: otherData, + }, + { + name: "stripped field at end", + input: bytes.Join([][]byte{otherData, dataToBeStripped}, nil), + expectedOutput: otherData, + }, + { + name: "stripped field in the middle", + input: bytes.Join([][]byte{otherData, dataToBeStripped, otherData}, nil), + expectedOutput: bytes.Repeat(otherData, 2), + }, + } + for i := range testCases { + testCase := testCases[i] + t.Run(testCase.name, func(t *testing.T) { + t.Parallel() + stripped := stripBufExtensionField(testCase.input) + require.Equal(t, testCase.expectedOutput, []byte(stripped)) + }) + } +} + +func TestImageToProtoPreservesUnrecognizedFields(t *testing.T) { + t.Parallel() + fileDescriptor := &descriptorpb.FileDescriptorProto{ + Name: proto.String("foo/bar/baz.proto"), + Package: proto.String("foo.bar.baz"), + Syntax: proto.String("proto3"), + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: proto.String("Foo"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: proto.String("id"), + Number: proto.Int32(1), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: descriptorpb.FieldDescriptorProto_TYPE_INT64.Enum(), + JsonName: proto.String("id"), + }, + { + Name: proto.String("name"), + Number: proto.Int32(2), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + JsonName: proto.String("name"), + }, + }, + }, + }, + } + otherData := protowire.AppendTag(nil, 122, protowire.BytesType) + otherData = protowire.AppendBytes(otherData, []byte{1, 18, 28, 123, 5, 3, 1}) + otherData = protowire.AppendTag(otherData, 123, protowire.VarintType) + otherData = protowire.AppendVarint(otherData, 23456) + otherData = protowire.AppendTag(otherData, 124, protowire.Fixed32Type) + otherData = protowire.AppendFixed32(otherData, 23456) + fileDescriptor.ProtoReflect().SetUnknown(otherData) + + module, err := bufmoduleref.ModuleIdentityForString("buf.build/foo/bar") + require.NoError(t, err) + imageFile, err := NewImageFile( + fileDescriptor, + module, + "1234123451235", + "foo/bar/baz.proto", + false, + false, + nil, + ) + require.NoError(t, err) + + protoImageFile := imageFileToProtoImageFile(imageFile) + // make sure unrecognized bytes survived + require.Equal(t, otherData, []byte(protoImageFile.ProtoReflect().GetUnknown())) + + // now round-trip it back through + imageFileBytes, err := proto.Marshal(protoImageFile) + require.NoError(t, err) + + roundTrippedFileDescriptor := &descriptorpb.FileDescriptorProto{} + err = proto.Unmarshal(imageFileBytes, roundTrippedFileDescriptor) + require.NoError(t, err) + // unrecognized now includes image file's buf extension + require.Greater(t, len(roundTrippedFileDescriptor.ProtoReflect().GetUnknown()), len(otherData)) + + // if we go back through an image file, we should strip out the + // buf extension unknown bytes but preserve the rest + module, err = bufmoduleref.ModuleIdentityForString("buf.build/abc/def") + require.NoError(t, err) + // NB: intentionally different metadata + imageFile, err = NewImageFile( + fileDescriptor, + module, + "987654321", + "abc/def/xyz.proto", + false, + true, + []int32{1, 2, 3}, + ) + require.NoError(t, err) + + protoImageFile = imageFileToProtoImageFile(imageFile) + // make sure unrecognized bytes survived and extraneous buf extension is not present + require.Equal(t, otherData, []byte(protoImageFile.ProtoReflect().GetUnknown())) + + // double-check via round-trip, to make sure resulting image file equals the input + // (to verify that the original unknown bytes byf extension didn't interfere) + imageFileBytes, err = proto.Marshal(protoImageFile) + require.NoError(t, err) + + roundTrippedImageFile := &imagev1.ImageFile{} + err = proto.Unmarshal(imageFileBytes, roundTrippedImageFile) + require.NoError(t, err) + + diff := cmp.Diff(protoImageFile, roundTrippedImageFile, protocmp.Transform()) + require.Empty(t, diff) +} diff --git a/pkg/bufman/bufpkg/bufimage/validate.go b/pkg/bufman/bufpkg/bufimage/validate.go new file mode 100644 index 000000000..eb14de330 --- /dev/null +++ b/pkg/bufman/bufpkg/bufimage/validate.go @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufimage + +import ( + "errors" + "fmt" + + imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" +) + +// we validate the actual fields of the FileDescriptorProtos as part of newImageFile +func validateProtoImage(protoImage *imagev1.Image) error { + if protoImage == nil { + return errors.New("nil Image") + } + if len(protoImage.File) == 0 { + return errors.New("image contains no files") + } + for _, protoImageFile := range protoImage.File { + if err := validateProtoImageFile(protoImageFile); err != nil { + return err + } + } + return nil +} + +func validateProtoImageFile(protoImageFile *imagev1.ImageFile) error { + if protoImageFileExtension := protoImageFile.GetBufExtension(); protoImageFileExtension != nil { + lenDependencies := len(protoImageFile.GetDependency()) + for _, index := range protoImageFileExtension.GetUnusedDependency() { + if int(index) >= lenDependencies || int(index) < 0 { + return fmt.Errorf("unused dependency index %d is out of range", index) + } + } + if protoModuleInfo := protoImageFileExtension.GetModuleInfo(); protoModuleInfo != nil { + return validateProtoModuleInfo(protoModuleInfo) + } + } + return nil +} + +func validateProtoModuleInfo(protoModuleInfo *imagev1.ModuleInfo) error { + if protoModuleName := protoModuleInfo.GetName(); protoModuleName != nil { + return validateProtoModuleName(protoModuleInfo.Name) + } + return nil +} + +func validateProtoModuleName(protoModuleName *imagev1.ModuleName) error { + if protoModuleName.GetRemote() == "" { + return errors.New("empty ModuleName.Remote") + } + if protoModuleName.GetOwner() == "" { + return errors.New("empty ModuleName.Owner") + } + if protoModuleName.GetRepository() == "" { + return errors.New("empty ModuleName.Repository") + } + return nil +} diff --git a/pkg/bufman/bufpkg/buflock/buflock.go b/pkg/bufman/bufpkg/buflock/buflock.go new file mode 100644 index 000000000..7401ef657 --- /dev/null +++ b/pkg/bufman/bufpkg/buflock/buflock.go @@ -0,0 +1,155 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package buflock manages the buf.lock lock file. +package buflock + +import ( + "context" + "strings" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +const ( + // ExternalConfigFilePath defines the path to the lock file, relative to the root of the module. + ExternalConfigFilePath = "buf.lock" + // V1Version is the string used to identify the v1 version of the lock file. + V1Version = "v1" + // V1Beta1Version is the string used to identify the v1beta1 version of the lock file. + V1Beta1Version = "v1beta1" + // Header is the header prepended to any lock files. + Header = "# Generated by buf. DO NOT EDIT.\n" +) + +// Config holds the parsed lock file information. +type Config struct { + Dependencies []Dependency +} + +// Dependency describes a single pinned dependency. +type Dependency struct { + Remote string + Owner string + Repository string + Commit string + Digest string +} + +// ReadConfig reads the lock file at ExternalConfigFilePath relative +// to the root of the bucket. +func ReadConfig(ctx context.Context, readBucket storage.ReadBucket) (*Config, error) { + return readConfig(ctx, readBucket) +} + +// WriteConfig writes the lock file to the WriteBucket at ExternalConfigFilePath. +func WriteConfig(ctx context.Context, writeBucket storage.WriteBucket, config *Config) error { + return writeConfig(ctx, writeBucket, config) +} + +// ExternalConfigV1 represents the v1 lock file. +type ExternalConfigV1 struct { + Version string `json:"version,omitempty" yaml:"version,omitempty"` + Deps []ExternalConfigDependencyV1 `json:"deps,omitempty" yaml:"deps,omitempty"` +} + +// ExternalConfigV1Beta1 represents the v1beta1 lock file. +type ExternalConfigV1Beta1 struct { + Version string `json:"version,omitempty" yaml:"version,omitempty"` + Deps []ExternalConfigDependencyV1Beta1 `json:"deps,omitempty" yaml:"deps,omitempty"` +} + +// ExternalConfigDependencyV1 represents a single dependency within +// the v1 lock file. +type ExternalConfigDependencyV1 struct { + Remote string `json:"remote,omitempty" yaml:"remote,omitempty"` + Owner string `json:"owner,omitempty" yaml:"owner,omitempty"` + Repository string `json:"repository,omitempty" yaml:"repository,omitempty"` + Branch string `json:"branch,omitempty" yaml:"branch,omitempty"` + Commit string `json:"commit,omitempty" yaml:"commit,omitempty"` + Digest string `json:"digest,omitempty" yaml:"digest,omitempty"` + CreateTime time.Time `json:"create_time,omitempty" yaml:"create_time,omitempty"` +} + +// DependencyForExternalConfigDependencyV1 returns the Dependency representation of a ExternalConfigDependencyV1. +func DependencyForExternalConfigDependencyV1(dep ExternalConfigDependencyV1) Dependency { + digest := dep.Digest + // Don't consume old b1/b3 buf digests. + if strings.HasPrefix(digest, "b1-") || strings.HasPrefix(digest, "b3-") { + digest = "" + } + return Dependency{ + Remote: dep.Remote, + Owner: dep.Owner, + Repository: dep.Repository, + Commit: dep.Commit, + Digest: digest, + } +} + +// ExternalConfigDependencyV1ForDependency returns the ExternalConfigDependencyV1 of a Dependency. +// +// Note, some fields will be their empty value since not all values are available on the Dependency. +func ExternalConfigDependencyV1ForDependency(dep Dependency) ExternalConfigDependencyV1 { + return ExternalConfigDependencyV1{ + Remote: dep.Remote, + Owner: dep.Owner, + Repository: dep.Repository, + Commit: dep.Commit, + Digest: dep.Digest, + } +} + +// ExternalConfigDependencyV1Beta1 represents a single dependency within +// the v1beta1 lock file. +type ExternalConfigDependencyV1Beta1 struct { + Remote string `json:"remote,omitempty" yaml:"remote,omitempty"` + Owner string `json:"owner,omitempty" yaml:"owner,omitempty"` + Repository string `json:"repository,omitempty" yaml:"repository,omitempty"` + Branch string `json:"branch,omitempty" yaml:"branch,omitempty"` + Commit string `json:"commit,omitempty" yaml:"commit,omitempty"` + Digest string `json:"digest,omitempty" yaml:"digest,omitempty"` + CreateTime time.Time `json:"create_time,omitempty" yaml:"create_time,omitempty"` +} + +// DependencyForExternalConfigDependencyV1Beta1 returns the Dependency representation of a ExternalConfigDependencyV1Beta1. +func DependencyForExternalConfigDependencyV1Beta1(dep ExternalConfigDependencyV1Beta1) Dependency { + return Dependency{ + Remote: dep.Remote, + Owner: dep.Owner, + Repository: dep.Repository, + Commit: dep.Commit, + Digest: "", // digests in v1Beta1 are not valid v1 digests + } +} + +// ExternalConfigDependencyV1Beta1ForDependency returns the ExternalConfigDependencyV1Beta1 of a Dependency. +// +// Note, some fields will be their empty value since not all values are available on the Dependency. +func ExternalConfigDependencyV1Beta1ForDependency(dep Dependency) ExternalConfigDependencyV1Beta1 { + return ExternalConfigDependencyV1Beta1{ + Remote: dep.Remote, + Owner: dep.Owner, + Repository: dep.Repository, + Commit: dep.Commit, + } +} + +// ExternalConfigVersion defines the subset of all lock +// file versions that is used to determine the version. +type ExternalConfigVersion struct { + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} diff --git a/pkg/bufman/bufpkg/buflock/buflock_test.go b/pkg/bufman/bufpkg/buflock/buflock_test.go new file mode 100644 index 000000000..da9d6fc50 --- /dev/null +++ b/pkg/bufman/bufpkg/buflock/buflock_test.go @@ -0,0 +1,306 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflock_test + +import ( + "bytes" + "context" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buflock" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestReadConfigV1Beta1(t *testing.T) { + t.Parallel() + testReadConfig(t, "v1beta1") +} + +func TestReadConfigV1(t *testing.T) { + t.Parallel() + testReadConfig(t, "v1") +} + +func testReadConfig(t *testing.T, version string) { + successConfig := &buflock.Config{ + Dependencies: []buflock.Dependency{ + { + Remote: "bufbuild.test", + Owner: "acme", + Repository: "weather", + Commit: "e9191fcdc2294e2f8f3b82c528fc90a8", + }, + }, + } + ctx := context.Background() + provider := storageos.NewProvider() + readBucket, err := provider.NewReadWriteBucket(filepath.Join("testdata", version, "success")) + require.NoError(t, err) + config, err := buflock.ReadConfig(ctx, readBucket) + require.NoError(t, err) + require.Equal(t, successConfig, config) + + readBucket, err = provider.NewReadWriteBucket(filepath.Join("testdata", version, "failure")) + require.NoError(t, err) + _, err = buflock.ReadConfig(ctx, readBucket) + require.Error(t, err) +} + +func TestWriteReadConfig(t *testing.T) { + t.Parallel() + tmpDir := t.TempDir() + readWriteBucket, err := storageos.NewProvider().NewReadWriteBucket(tmpDir) + require.NoError(t, err) + testConfig := &buflock.Config{ + Dependencies: []buflock.Dependency{ + { + Remote: "buf.build", + Owner: "test1", + Repository: "foob1", + Commit: bufmoduletesting.TestCommit, + }, + { + Remote: "buf.build", + Owner: "test2", + Repository: "foob2", + Commit: bufmoduletesting.TestCommit, + }, + }, + } + err = buflock.WriteConfig(context.Background(), readWriteBucket, testConfig) + require.NoError(t, err) + + readConfig, err := buflock.ReadConfig(context.Background(), readWriteBucket) + require.NoError(t, err) + require.Equal(t, testConfig, readConfig) +} + +func TestWriteReadEmptyConfig(t *testing.T) { + t.Parallel() + tmpDir := t.TempDir() + readWriteBucket, err := storageos.NewProvider().NewReadWriteBucket(tmpDir) + require.NoError(t, err) + err = buflock.WriteConfig(context.Background(), readWriteBucket, &buflock.Config{}) + require.NoError(t, err) + + readConfig, err := buflock.ReadConfig(context.Background(), readWriteBucket) + require.NoError(t, err) + require.Equal(t, &buflock.Config{}, readConfig) +} + +// TODO: Write fuzz tester for the invariant ReadConfig(WriteConfig(file)) == file. + +func TestParseV1Beta1Config(t *testing.T) { + t.Parallel() + tmpDir := t.TempDir() + readWriteBucket, err := storageos.NewProvider().NewReadWriteBucket(tmpDir) + require.NoError(t, err) + testConfig := &buflock.Config{ + Dependencies: []buflock.Dependency{ + { + Remote: "buf.build", + Owner: "test1", + Repository: "foob1", + Commit: bufmoduletesting.TestCommit, + }, + { + Remote: "buf.build", + Owner: "test2", + Repository: "foob2", + Commit: bufmoduletesting.TestCommit, + }, + }, + } + writeObjectCloser, err := readWriteBucket.Put(context.Background(), buflock.ExternalConfigFilePath) + require.NoError(t, err) + t.Cleanup(func() { + require.NoError(t, writeObjectCloser.Close()) + }) + v1beta1Config := &buflock.ExternalConfigV1Beta1{ + Deps: []buflock.ExternalConfigDependencyV1Beta1{ + buflock.ExternalConfigDependencyV1Beta1ForDependency(testConfig.Dependencies[0]), + buflock.ExternalConfigDependencyV1Beta1ForDependency(testConfig.Dependencies[1]), + }, + } + err = encoding.NewYAMLEncoder(writeObjectCloser).Encode(v1beta1Config) + require.NoError(t, err) + + readConfig, err := buflock.ReadConfig(context.Background(), readWriteBucket) + require.NoError(t, err) + require.Equal(t, testConfig, readConfig) +} + +func TestParseNoConfig(t *testing.T) { + t.Parallel() + emptyReadBucket := storagemem.NewReadWriteBucket() + readConfig, err := buflock.ReadConfig(context.Background(), emptyReadBucket) + require.NoError(t, err) + require.Empty(t, readConfig) +} + +func TestParseIncompleteConfig(t *testing.T) { + t.Parallel() + tmpDir := t.TempDir() + readWriteBucket, err := storageos.NewProvider().NewReadWriteBucket(tmpDir) + require.NoError(t, err) + testConfig := &buflock.Config{ + Dependencies: []buflock.Dependency{ + { + Remote: "buf.build", + Owner: "test1", + Repository: "foob1", + Commit: bufmoduletesting.TestCommit, + }, + }, + } + configBytes, err := encoding.MarshalYAML(&buflock.ExternalConfigV1{ + Version: buflock.V1Version, + Deps: []buflock.ExternalConfigDependencyV1{ + buflock.ExternalConfigDependencyV1ForDependency(testConfig.Dependencies[0]), + }, + }) + require.NoError(t, err) + err = storage.PutPath(context.Background(), readWriteBucket, buflock.ExternalConfigFilePath, configBytes) + require.NoError(t, err) + + readConfig, err := buflock.ReadConfig(context.Background(), readWriteBucket) + require.NoError(t, err) + require.Equal(t, testConfig, readConfig) + + err = buflock.WriteConfig(context.Background(), readWriteBucket, readConfig) + require.NoError(t, err) + + // And again after using the proper WriteConfig + readConfig, err = buflock.ReadConfig(context.Background(), readWriteBucket) + require.NoError(t, err) + require.Equal(t, testConfig, readConfig) +} + +func TestDependencyForExternalConfigDependencyV1(t *testing.T) { + t.Parallel() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + nullDigest, err := digester.Digest(&bytes.Buffer{}) + require.NoError(t, err) + testDependencyForExternalConfigDependencyV1( + t, + "typical", + buflock.ExternalConfigDependencyV1{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + Digest: nullDigest.String(), + }, + buflock.Dependency{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + Digest: nullDigest.String(), + }, + ) + testDependencyForExternalConfigDependencyV1( + t, + "no digest", + buflock.ExternalConfigDependencyV1{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + }, + buflock.Dependency{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + }, + ) + testDependencyForExternalConfigDependencyV1( + t, + "filter out b1 hash", + buflock.ExternalConfigDependencyV1{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + Digest: "b1-gLO3B_5ClhdU52w1gMOxk4GokvCoM1OqjarxMfjStGQ=", + }, + buflock.Dependency{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + }, + ) + testDependencyForExternalConfigDependencyV1( + t, + "filter out b3 hash", + buflock.ExternalConfigDependencyV1{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + Digest: "b3-j7iu4iVzYQUFr97mbq2PNAlM5UjEnjtwEas0q7g4DVM", + }, + buflock.Dependency{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + }, + ) + testDependencyForExternalConfigDependencyV1( + t, + "don't filter out non-b1/b3 invalid hashes", + buflock.ExternalConfigDependencyV1{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + Digest: "shake256:abcd", + }, + buflock.Dependency{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "aabbccd", + Digest: "shake256:abcd", + }, + ) +} + +func testDependencyForExternalConfigDependencyV1( + t *testing.T, + desc string, + in buflock.ExternalConfigDependencyV1, + expect buflock.Dependency, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + actual := buflock.DependencyForExternalConfigDependencyV1(in) + assert.Equal(t, expect, actual) + }) +} diff --git a/pkg/bufman/bufpkg/buflock/lock_file.go b/pkg/bufman/bufpkg/buflock/lock_file.go new file mode 100644 index 000000000..e2641529a --- /dev/null +++ b/pkg/bufman/bufpkg/buflock/lock_file.go @@ -0,0 +1,86 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buflock + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +func readConfig(ctx context.Context, readBucket storage.ReadBucket) (_ *Config, retErr error) { + configBytes, err := storage.ReadPath(ctx, readBucket, ExternalConfigFilePath) + if err != nil { + if storage.IsNotExist(err) { + // If the lock file doesn't exist, just return no dependencies. + return &Config{}, nil + } + return nil, fmt.Errorf("failed to read lock file: %w", err) + } + var configVersion ExternalConfigVersion + if err := encoding.UnmarshalYAMLNonStrict(configBytes, &configVersion); err != nil { + return nil, fmt.Errorf("failed to decode lock file as YAML: %w", err) + } + switch configVersion.Version { + case "", V1Beta1Version: + var externalConfig ExternalConfigV1Beta1 + if err := encoding.UnmarshalYAMLStrict(configBytes, &externalConfig); err != nil { + return nil, fmt.Errorf("failed to unmarshal lock file at %s: %w", V1Beta1Version, err) + } + config := &Config{} + for _, dep := range externalConfig.Deps { + config.Dependencies = append(config.Dependencies, DependencyForExternalConfigDependencyV1Beta1(dep)) + } + return config, nil + case V1Version: + var externalConfig ExternalConfigV1 + if err := encoding.UnmarshalYAMLStrict(configBytes, &externalConfig); err != nil { + return nil, fmt.Errorf("failed to unmarshal lock file at %s: %w", V1Version, err) + } + config := &Config{} + for _, dep := range externalConfig.Deps { + config.Dependencies = append(config.Dependencies, DependencyForExternalConfigDependencyV1(dep)) + } + return config, nil + default: + return nil, fmt.Errorf("unknown lock file versions %q", configVersion.Version) + } +} + +func writeConfig(ctx context.Context, writeBucket storage.WriteBucket, config *Config) error { + externalConfig := ExternalConfigV1{ + Version: V1Version, + Deps: make([]ExternalConfigDependencyV1, 0, len(config.Dependencies)), + } + for _, dep := range config.Dependencies { + externalConfig.Deps = append(externalConfig.Deps, ExternalConfigDependencyV1ForDependency(dep)) + } + configBytes, err := encoding.MarshalYAML(&externalConfig) + if err != nil { + return fmt.Errorf("failed to marshal lock file: %w", err) + } + if err := storage.PutPath( + ctx, + writeBucket, + ExternalConfigFilePath, + append([]byte(Header), configBytes...), + ); err != nil { + return fmt.Errorf("failed to write lock file: %w", err) + } + return nil +} diff --git a/pkg/bufman/bufpkg/buflock/testdata/v1/failure/buf.lock b/pkg/bufman/bufpkg/buflock/testdata/v1/failure/buf.lock new file mode 100644 index 000000000..0d7637a3b --- /dev/null +++ b/pkg/bufman/bufpkg/buflock/testdata/v1/failure/buf.lock @@ -0,0 +1,3 @@ +version: v1 +deps: + - remote-invalid: bufbuild.test diff --git a/pkg/bufman/bufpkg/buflock/testdata/v1/success/buf.lock b/pkg/bufman/bufpkg/buflock/testdata/v1/success/buf.lock new file mode 100644 index 000000000..1afa13ba5 --- /dev/null +++ b/pkg/bufman/bufpkg/buflock/testdata/v1/success/buf.lock @@ -0,0 +1,10 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: bufbuild.test + owner: acme + repository: weather + commit: e9191fcdc2294e2f8f3b82c528fc90a8 + branch: main + digest: b1-gLO3B_5ClhdU52w1gMOxk4GokvCoM1OqjarxMfjStGQ= + create_time: 2000-01-01T00:00:00.000000Z diff --git a/pkg/bufman/bufpkg/buflock/testdata/v1beta1/failure/buf.lock b/pkg/bufman/bufpkg/buflock/testdata/v1beta1/failure/buf.lock new file mode 100644 index 000000000..640afb903 --- /dev/null +++ b/pkg/bufman/bufpkg/buflock/testdata/v1beta1/failure/buf.lock @@ -0,0 +1,2 @@ +deps: + - remote-invalid: bufbuild.test diff --git a/pkg/bufman/bufpkg/buflock/testdata/v1beta1/success/buf.lock b/pkg/bufman/bufpkg/buflock/testdata/v1beta1/success/buf.lock new file mode 100644 index 000000000..bf7359dd3 --- /dev/null +++ b/pkg/bufman/bufpkg/buflock/testdata/v1beta1/success/buf.lock @@ -0,0 +1,9 @@ +# Generated by buf. DO NOT EDIT. +deps: + - remote: bufbuild.test + owner: acme + repository: weather + commit: e9191fcdc2294e2f8f3b82c528fc90a8 + branch: main + digest: b1-gLO3B_5ClhdU52w1gMOxk4GokvCoM1OqjarxMfjStGQ= + create_time: 2000-01-01T00:00:00.000000Z diff --git a/pkg/bufman/bufpkg/bufmanifest/bucket.go b/pkg/bufman/bufpkg/bufmanifest/bucket.go new file mode 100644 index 000000000..64581ff9a --- /dev/null +++ b/pkg/bufman/bufpkg/bufmanifest/bucket.go @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmanifest + +import ( + "context" + "fmt" + + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +// NewBucketFromManifestBlobs builds a storage bucket from a manifest blob and a +// set of other blobs, provided in protobuf form. It makes sure that all blobs +// (including manifest) content match with their digest, and additionally checks +// that the blob set matches completely with the manifest paths (no missing nor +// extra blobs). This bucket is suitable for building or exporting. +func NewBucketFromManifestBlobs( + ctx context.Context, + manifestBlob *modulev1alpha1.Blob, + blobs []*modulev1alpha1.Blob, +) (storage.ReadBucket, error) { + parsedManifest, err := NewManifestFromProto(ctx, manifestBlob) + if err != nil { + return nil, err + } + blobSet, err := NewBlobSetFromProto(ctx, blobs) + if err != nil { + return nil, err + } + manifestBucket, err := manifest.NewBucket( + *parsedManifest, + *blobSet, + manifest.BucketWithAllManifestBlobsValidation(), + manifest.BucketWithNoExtraBlobsValidation(), + ) + if err != nil { + return nil, fmt.Errorf("new manifest bucket: %w", err) + } + return manifestBucket, nil +} diff --git a/pkg/bufman/bufpkg/bufmanifest/bufmanifest.go b/pkg/bufman/bufpkg/bufmanifest/bufmanifest.go new file mode 100644 index 000000000..e79d30c1f --- /dev/null +++ b/pkg/bufman/bufpkg/bufmanifest/bufmanifest.go @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmanifest diff --git a/pkg/bufman/bufpkg/bufmanifest/mapper.go b/pkg/bufman/bufpkg/bufmanifest/mapper.go new file mode 100644 index 000000000..0fefea9ff --- /dev/null +++ b/pkg/bufman/bufpkg/bufmanifest/mapper.go @@ -0,0 +1,147 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmanifest + +import ( + "context" + "fmt" + "io" + + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "go.uber.org/multierr" +) + +var ( + protoDigestTypeToDigestType = map[modulev1alpha1.DigestType]manifest.DigestType{ + modulev1alpha1.DigestType_DIGEST_TYPE_SHAKE256: manifest.DigestTypeShake256, + } + digestTypeToProtoDigestType = map[manifest.DigestType]modulev1alpha1.DigestType{ + manifest.DigestTypeShake256: modulev1alpha1.DigestType_DIGEST_TYPE_SHAKE256, + } +) + +// NewDigestFromProtoDigest maps a modulev1alpha1.Digest to a Digest. +func NewDigestFromProtoDigest(digest *modulev1alpha1.Digest) (*manifest.Digest, error) { + if digest == nil { + return nil, fmt.Errorf("nil digest") + } + dType, ok := protoDigestTypeToDigestType[digest.DigestType] + if !ok { + return nil, fmt.Errorf("unsupported digest kind: %s", digest.DigestType.String()) + } + return manifest.NewDigestFromBytes(dType, digest.Digest) +} + +// AsProtoBlob returns the passed blob as a proto module blob. +func AsProtoBlob(ctx context.Context, b manifest.Blob) (_ *modulev1alpha1.Blob, retErr error) { + digestType, ok := digestTypeToProtoDigestType[b.Digest().Type()] + if !ok { + return nil, fmt.Errorf("digest type %q not supported by module proto", b.Digest().Type()) + } + rc, err := b.Open(ctx) + if err != nil { + return nil, fmt.Errorf("cannot open blob: %w", err) + } + defer func() { + retErr = multierr.Append(retErr, rc.Close()) + }() + content, err := io.ReadAll(rc) + if err != nil { + return nil, fmt.Errorf("cannot read blob contents: %w", err) + } + return &modulev1alpha1.Blob{ + Digest: &modulev1alpha1.Digest{ + DigestType: digestType, + Digest: b.Digest().Bytes(), + }, + Content: content, + }, nil +} + +// NewManifestFromProto returns a Manifest from a proto module blob. It makes sure the +// digest and content matches. +func NewManifestFromProto(ctx context.Context, b *modulev1alpha1.Blob) (_ *manifest.Manifest, retErr error) { + blob, err := NewBlobFromProto(b) + if err != nil { + return nil, fmt.Errorf("invalid manifest: %w", err) + } + r, err := blob.Open(ctx) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, r.Close()) + }() + return manifest.NewFromReader(r) +} + +// NewBlobSetFromProto returns a BlobSet from a slice of proto module blobs. +// It makes sure the digest and content matches for each blob. +func NewBlobSetFromProto(ctx context.Context, blobs []*modulev1alpha1.Blob) (*manifest.BlobSet, error) { + var memBlobs []manifest.Blob + for i, modBlob := range blobs { + memBlob, err := NewBlobFromProto(modBlob) + if err != nil { + return nil, fmt.Errorf("invalid blob at index %d: %w", i, err) + } + memBlobs = append(memBlobs, memBlob) + } + return manifest.NewBlobSet(ctx, memBlobs) +} + +// NewBlobFromProto returns a Blob from a proto module blob. It makes sure the +// digest and content matches. +func NewBlobFromProto(b *modulev1alpha1.Blob) (manifest.Blob, error) { + if b == nil { + return nil, fmt.Errorf("nil blob") + } + digest, err := NewDigestFromProtoDigest(b.Digest) + if err != nil { + return nil, fmt.Errorf("digest from proto digest: %w", err) + } + memBlob, err := manifest.NewMemoryBlob( + *digest, + b.Content, + manifest.MemoryBlobWithDigestValidation(), + ) + if err != nil { + return nil, fmt.Errorf("new memory blob: %w", err) + } + return memBlob, nil +} + +// ToProtoManifestAndBlobs converts a Manifest and BlobSet to the protobuf types. +func ToProtoManifestAndBlobs(ctx context.Context, manifest *manifest.Manifest, blobs *manifest.BlobSet) (*modulev1alpha1.Blob, []*modulev1alpha1.Blob, error) { + manifestBlob, err := manifest.Blob() + if err != nil { + return nil, nil, err + } + manifestProtoBlob, err := AsProtoBlob(ctx, manifestBlob) + if err != nil { + return nil, nil, err + } + filesBlobs := blobs.Blobs() + filesProtoBlobs := make([]*modulev1alpha1.Blob, len(filesBlobs)) + for i, b := range filesBlobs { + pb, err := AsProtoBlob(ctx, b) + if err != nil { + return nil, nil, err + } + filesProtoBlobs[i] = pb + } + return manifestProtoBlob, filesProtoBlobs, nil +} diff --git a/pkg/bufman/bufpkg/bufmanifest/mapper_test.go b/pkg/bufman/bufpkg/bufmanifest/mapper_test.go new file mode 100644 index 000000000..02ab6e644 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmanifest/mapper_test.go @@ -0,0 +1,134 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmanifest_test + +import ( + "bytes" + "context" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmanifest" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestDigestFromProtoDigest(t *testing.T) { + t.Parallel() + const ( + fileContent = "one line\nanother line\nyet another one\n" + ) + digestFromContent, err := manifest.NewDigestFromBytes( + manifest.DigestTypeShake256, + mustDigestShake256(t, []byte(fileContent)).Bytes(), + ) + require.NoError(t, err) + assert.Equal(t, manifest.DigestTypeShake256, digestFromContent.Type()) + protoDigest := modulev1alpha1.Digest{ + DigestType: modulev1alpha1.DigestType_DIGEST_TYPE_SHAKE256, + Digest: digestFromContent.Bytes(), + } + digest, err := bufmanifest.NewDigestFromProtoDigest(&protoDigest) + require.NoError(t, err) + assert.Equal(t, digestFromContent.String(), digest.String()) +} + +func TestNewDigestFromProtoDigest(t *testing.T) { + t.Parallel() + digest := mustDigestShake256(t, []byte("my content")) + retDigest, err := bufmanifest.NewDigestFromProtoDigest(&modulev1alpha1.Digest{ + DigestType: modulev1alpha1.DigestType_DIGEST_TYPE_SHAKE256, + Digest: digest.Bytes(), + }) + require.NoError(t, err) + assert.True(t, digest.Equal(*retDigest)) +} + +func TestInvalidNewDigestFromProtoDigest(t *testing.T) { + t.Parallel() + _, err := bufmanifest.NewDigestFromProtoDigest(nil) + assert.Error(t, err) + _, err = bufmanifest.NewDigestFromProtoDigest(&modulev1alpha1.Digest{ + DigestType: modulev1alpha1.DigestType_DIGEST_TYPE_UNSPECIFIED, + }) + assert.Error(t, err) + _, err = bufmanifest.NewDigestFromProtoDigest(&modulev1alpha1.Digest{ + DigestType: modulev1alpha1.DigestType_DIGEST_TYPE_SHAKE256, + Digest: []byte("invalid digest"), + }) + assert.Error(t, err) +} + +func TestProtoBlob(t *testing.T) { + t.Parallel() + content := []byte("hello world") + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + digest, err := digester.Digest(bytes.NewReader(content)) + require.NoError(t, err) + blob, err := manifest.NewMemoryBlob(*digest, content) + require.NoError(t, err) + ctx := context.Background() + protoBlob, err := bufmanifest.AsProtoBlob(ctx, blob) + require.NoError(t, err) + rtBlob, err := bufmanifest.NewBlobFromProto(protoBlob) + require.NoError(t, err) + equal, err := manifest.BlobEqual(ctx, blob, rtBlob) + require.NoError(t, err) + assert.True(t, equal) +} + +func TestBlobFromReader(t *testing.T) { + t.Parallel() + testBlobFromReader( + t, + []byte("hello"), + []byte{ + 0x12, 0x34, 0x07, 0x5a, 0xe4, 0xa1, 0xe7, 0x73, 0x16, 0xcf, 0x2d, + 0x80, 0x00, 0x97, 0x45, 0x81, 0xa3, 0x43, 0xb9, 0xeb, 0xbc, 0xa7, + 0xe3, 0xd1, 0xdb, 0x83, 0x39, 0x4c, 0x30, 0xf2, 0x21, 0x62, 0x6f, + 0x59, 0x4e, 0x4f, 0x0d, 0xe6, 0x39, 0x02, 0x34, 0x9a, 0x5e, 0xa5, + 0x78, 0x12, 0x13, 0x21, 0x58, 0x13, 0x91, 0x9f, 0x92, 0xa4, 0xd8, + 0x6d, 0x12, 0x74, 0x66, 0xe3, 0xd0, 0x7e, 0x8b, 0xe3, + }, + ) +} + +func testBlobFromReader(t *testing.T, content []byte, digest []byte) { + t.Helper() + blob, err := manifest.NewMemoryBlobFromReader(bytes.NewReader(content)) + require.NoError(t, err) + protoBlob, err := bufmanifest.AsProtoBlob(context.Background(), blob) + require.NoError(t, err) + expect := &modulev1alpha1.Blob{ + Digest: &modulev1alpha1.Digest{ + DigestType: modulev1alpha1.DigestType_DIGEST_TYPE_SHAKE256, + Digest: digest, + }, + Content: content, + } + assert.Equal(t, expect, protoBlob) +} + +func mustDigestShake256(t *testing.T, content []byte) *manifest.Digest { + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + require.NotNil(t, digester) + digest, err := digester.Digest(bytes.NewReader(content)) + require.NoError(t, err) + return digest +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodule.go b/pkg/bufman/bufpkg/bufmodule/bufmodule.go new file mode 100644 index 000000000..4f01dbaa8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodule.go @@ -0,0 +1,565 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + "crypto/sha256" + "encoding/base64" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + breakingv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/breaking/v1" + lintv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/lint/v1" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "go.uber.org/multierr" +) + +const ( + // DefaultDocumentationPath defines the default path to the documentation file, relative to the root of the module. + DefaultDocumentationPath = "buf.md" + // LicenseFilePath defines the path to the license file, relative to the root of the module. + LicenseFilePath = "LICENSE" + + // b3DigestPrefix is the digest prefix for the third version of the digest function. + // + // It is used by the CLI cache and intended to eventually replace b1 entirely. + b3DigestPrefix = "b3" +) + +// AllDocumentationPaths defines all possible paths to the documentation file, relative to the root of the module. +var AllDocumentationPaths = []string{ + DefaultDocumentationPath, + "README.md", + "README.markdown", +} + +// ModuleFile is a module file. +type ModuleFile interface { + bufmoduleref.FileInfo + io.ReadCloser + + isModuleFile() +} + +// Module is a Protobuf module. +// +// It contains the files for the sources, and the dependency names. +// +// Terminology: +// +// Targets (Modules and ModuleFileSets): +// +// Just the files specified to build. This will either be sources, or will be specific files +// within sources, ie this is a subset of Sources. The difference between Targets and Sources happens +// when i.e. the --path flag is used. +// +// Sources (Modules and ModuleFileSets): +// +// The files with no dependencies. This is a superset of Targets and subset of All. +// +// All (ModuleFileSets only): +// +// All files including dependencies. This is a superset of Sources. +type Module interface { + // TargetFileInfos gets all FileInfos specified as target files. This is either + // all the FileInfos belonging to the module, or those specified by ModuleWithTargetPaths(). + // + // It does not include dependencies. + // + // The returned TargetFileInfos are sorted by path. + TargetFileInfos(ctx context.Context) ([]bufmoduleref.FileInfo, error) + // SourceFileInfos gets all FileInfos belonging to the module. + // + // It does not include dependencies. + // + // The returned SourceFileInfos are sorted by path. + SourceFileInfos(ctx context.Context) ([]bufmoduleref.FileInfo, error) + // GetModuleFile gets the source file for the given path. + // + // Returns storage.IsNotExist error if the file does not exist. + GetModuleFile(ctx context.Context, path string) (ModuleFile, error) + // DeclaredDirectDependencies returns the direct dependencies declared in the configuration file. + // + // The returned ModuleReferences are sorted by remote, owner, repository, and reference (if + // present). The returned ModulePins are unique by remote, owner, repository. + // + // This does not include any transitive dependencies, but if the declarations are correct, + // this should be a subset of the dependencies from DependencyModulePins. + // + // TODO: validate that this is a subset? This may mess up construction. + DeclaredDirectDependencies() []bufmoduleref.ModuleReference + // DependencyModulePins gets the dependency ModulePins. + // + // The returned ModulePins are sorted by remote, owner, repository, branch, commit, and then digest. + // The returned ModulePins are unique by remote, owner, repository. + // + // This includes all transitive dependencies. + DependencyModulePins() []bufmoduleref.ModulePin + // Documentation gets the contents of the module documentation file, buf.md and returns the string representation. + // This may return an empty string if the documentation file does not exist. + Documentation() string + // DocumentationPath returns the path to the documentation file for the module. + // Can be one of `buf.md`, `README.md` or `README.markdown` + DocumentationPath() string + // License gets the contents of the module license file, LICENSE and returns the string representation. + // This may return an empty string if the documentation file does not exist. + License() string + // BreakingConfig returns the breaking change check configuration set for the module. + // + // This may be nil, since older versions of the module would not have this stored. + BreakingConfig() *bufbreakingconfig.Config + // LintConfig returns the lint check configuration set for the module. + // + // This may be nil, since older versions of the module would not have this stored. + LintConfig() *buflintconfig.Config + // Manifest returns the manifest for the module (possibly nil). + // A manifest's contents contain a lexicographically sorted list of path names along + // with each path's digest. The manifest also stores a digest of its own contents which + // allows verification of the entire Buf module. In addition to the .proto files in + // the module, it also lists the buf.yaml, LICENSE, buf.md, and buf.lock files (if + // present). + Manifest() *manifest.Manifest + // BlobSet returns the raw data for the module (possibly nil). + // Each blob in the blob set is indexed by the digest of the blob's contents. For + // example, the buf.yaml file will be listed in the Manifest with a given digest, + // whose contents can be retrieved by looking up the corresponding digest in the + // blob set. This allows API consumers to get access to the original file contents + // of every file in the module, which is useful for caching or recreating a module's + // original files. + BlobSet() *manifest.BlobSet + + getSourceReadBucket() storage.ReadBucket + // ModuleIdentity returns the ModuleIdentity for the Module, if it was + // provided at construction time via ModuleWithModuleIdentity or ModuleWithModuleIdentityAndCommit. + // + // Note this *can* be nil if we did not build from a named module. + // All code must assume this can be nil. + // nil checking should work since the backing type is always a pointer. + ModuleIdentity() bufmoduleref.ModuleIdentity + // Commit returns the commit for the Module, if it was + // provided at construction time via ModuleWithModuleIdentityAndCommit. + + // Note this can be empty. + // This will only be set if ModuleIdentity is set. but may not be set + // even if ModuleIdentity is set, that is commit is optional information + // even if we know what module this file came from. + Commit() string + isModule() +} + +// ModuleOption is used to construct Modules. +type ModuleOption func(*module) + +// ModuleWithModuleIdentity is used to construct a Module with a ModuleIdentity. +func ModuleWithModuleIdentity(moduleIdentity bufmoduleref.ModuleIdentity) ModuleOption { + return func(module *module) { + module.moduleIdentity = moduleIdentity + } +} + +// ModuleWithModuleIdentityAndCommit is used to construct a Module with a ModuleIdentity and commit. +// +// If the moduleIdentity is nil, the commit must be empty, that is it is not valid to have +// a non-empty commit and a nil moduleIdentity. +func ModuleWithModuleIdentityAndCommit(moduleIdentity bufmoduleref.ModuleIdentity, commit string) ModuleOption { + return func(module *module) { + module.moduleIdentity = moduleIdentity + module.commit = commit + } +} + +// NewModuleForBucket returns a new Module. It attempts to read dependencies +// from a lock file in the read bucket. +func NewModuleForBucket( + ctx context.Context, + readBucket storage.ReadBucket, + options ...ModuleOption, +) (Module, error) { + return newModuleForBucket(ctx, readBucket, options...) +} + +// NewModuleForProto returns a new Module for the given proto Module. +func NewModuleForProto( + ctx context.Context, + protoModule *modulev1alpha1.Module, + options ...ModuleOption, +) (Module, error) { + return newModuleForProto(ctx, protoModule, options...) +} + +// NewModuleForManifestAndBlobSet returns a new Module given the manifest and blob set. +func NewModuleForManifestAndBlobSet( + ctx context.Context, + manifest *manifest.Manifest, + blobSet *manifest.BlobSet, + options ...ModuleOption, +) (Module, error) { + return newModuleForManifestAndBlobSet(ctx, manifest, blobSet, options...) +} + +// ModuleWithTargetPaths returns a new Module that specifies specific file or directory paths to build. +// +// These paths must exist. +// These paths must be relative to the roots. +// These paths will be normalized and validated. +// These paths must be unique when normalized and validated. +// Multiple calls to this option will override previous calls. +// +// Note that this will result in TargetFileInfos containing only these paths, and not +// any imports. Imports, and non-targeted files, are still available via SourceFileInfos. +func ModuleWithTargetPaths( + module Module, + targetPaths []string, + excludePaths []string, +) (Module, error) { + return newTargetingModule(module, targetPaths, excludePaths, false) +} + +// ModuleWithTargetPathsAllowNotExist returns a new Module specifies specific file or directory paths to build, +// but allows the specified paths to not exist. +// +// Note that this will result in TargetFileInfos containing only these paths, and not +// any imports. Imports, and non-targeted files, are still available via SourceFileInfos. +func ModuleWithTargetPathsAllowNotExist( + module Module, + targetPaths []string, + excludePaths []string, +) (Module, error) { + return newTargetingModule(module, targetPaths, excludePaths, true) +} + +// ModuleWithExcludePaths returns a new Module that excludes specific file or directory +// paths to build. +// +// Note that this will result in TargetFileInfos containing only the paths that have not been +// excluded and any imports. Imports are still available via SourceFileInfos. +func ModuleWithExcludePaths( + module Module, + excludePaths []string, +) (Module, error) { + return newTargetingModule(module, nil, excludePaths, false) +} + +// ModuleWithExcludePathsAllowNotExist returns a new Module that excludes specific file or +// directory paths to build, but allows the specified paths to not exist. +// +// Note that this will result in TargetFileInfos containing only these paths, and not +// any imports. Imports, and non-targeted files, are still available via SourceFileInfos. +func ModuleWithExcludePathsAllowNotExist( + module Module, + excludePaths []string, +) (Module, error) { + return newTargetingModule(module, nil, excludePaths, true) +} + +// ModuleResolver resolves modules. +type ModuleResolver interface { + // GetModulePin resolves the provided ModuleReference to a ModulePin. + // + // Returns an error that fufills storage.IsNotExist if the named Module does not exist. + GetModulePin(ctx context.Context, moduleReference bufmoduleref.ModuleReference) (bufmoduleref.ModulePin, error) +} + +// NewNopModuleResolver returns a new ModuleResolver that always returns a storage.IsNotExist error. +func NewNopModuleResolver() ModuleResolver { + return newNopModuleResolver() +} + +// ModuleReader reads resolved modules. +type ModuleReader interface { + // GetModule gets the Module for the ModulePin. + // + // Returns an error that fulfills storage.IsNotExist if the Module does not exist. + GetModule(ctx context.Context, modulePin bufmoduleref.ModulePin) (Module, error) +} + +// NewNopModuleReader returns a new ModuleReader that always returns a storage.IsNotExist error. +func NewNopModuleReader() ModuleReader { + return newNopModuleReader() +} + +// ModuleFileSet is a Protobuf module file set. +// +// It contains the files for both targets, sources and dependencies. +// +// TODO: we should not have ModuleFileSet inherit from Module, this is confusing +type ModuleFileSet interface { + // Note that GetModuleFile will pull from All files instead of just Source Files! + Module + // AllFileInfos gets all FileInfos associated with the module, including dependencies. + // + // The returned FileInfos are sorted by path. + AllFileInfos(ctx context.Context) ([]bufmoduleref.FileInfo, error) + + isModuleFileSet() +} + +// NewModuleFileSet returns a new ModuleFileSet. +func NewModuleFileSet( + module Module, + dependencies []Module, +) ModuleFileSet { + return newModuleFileSet(module, dependencies) +} + +// Workspace represents a workspace. +// +// It is guaranteed that all Modules within this workspace have no overlapping file paths. +type Workspace interface { + // GetModule gets the module identified by the given ModuleIdentity. + // + GetModule(moduleIdentity bufmoduleref.ModuleIdentity) (Module, bool) + // GetModules returns all of the modules found in the workspace. + GetModules() []Module +} + +// NewWorkspace returns a new module workspace. +// +// The Context is not retained, and is only used for validation during construction. +func NewWorkspace( + ctx context.Context, + namedModules map[string]Module, + allModules []Module, +) (Workspace, error) { + return newWorkspace( + ctx, + namedModules, + allModules, + ) +} + +// ModuleToProtoModule converts the Module to a proto Module. +// +// This takes all Sources and puts them in the Module, not just Targets. +func ModuleToProtoModule(ctx context.Context, module Module) (*modulev1alpha1.Module, error) { + // these are returned sorted, so there is no need to sort + // the resulting protoModuleFiles afterwards + sourceFileInfos, err := module.SourceFileInfos(ctx) + if err != nil { + return nil, err + } + protoModuleFiles := make([]*modulev1alpha1.ModuleFile, len(sourceFileInfos)) + for i, sourceFileInfo := range sourceFileInfos { + protoModuleFile, err := moduleFileToProto(ctx, module, sourceFileInfo.Path()) + if err != nil { + return nil, err + } + protoModuleFiles[i] = protoModuleFile + } + // these are returned sorted, so there is no need to sort + // the resulting protoModuleNames afterwards + dependencyModulePins := module.DependencyModulePins() + protoModulePins := make([]*modulev1alpha1.ModulePin, len(dependencyModulePins)) + for i, dependencyModulePin := range dependencyModulePins { + protoModulePins[i] = bufmoduleref.NewProtoModulePinForModulePin(dependencyModulePin) + } + var protoBreakingConfig *breakingv1.Config + if module.BreakingConfig() != nil { + protoBreakingConfig = bufbreakingconfig.ProtoForConfig(module.BreakingConfig()) + } + var protoLintConfig *lintv1.Config + if module.LintConfig() != nil { + protoLintConfig = buflintconfig.ProtoForConfig(module.LintConfig()) + } + protoModule := &modulev1alpha1.Module{ + Files: protoModuleFiles, + Dependencies: protoModulePins, + Documentation: module.Documentation(), + DocumentationPath: module.DocumentationPath(), + BreakingConfig: protoBreakingConfig, + LintConfig: protoLintConfig, + License: module.License(), + } + if err := ValidateProtoModule(protoModule); err != nil { + return nil, err + } + return protoModule, nil +} + +// ModuleDigestB3 returns the b3 digest for the Module. +// +// To create the module digest (SHA256): +// 1. For every file in the module (sorted lexicographically by path): +// a. Add the file path +// b. Add the file contents +// 2. Add the dependency's module identity and commit ID (sorted lexicographically by commit ID) +// 3. Add the module identity if available. +// 4. Add the module documentation if available. +// 5. Add the module documentation path if available. +// 6. Add the module license if available. +// 7. Add the breaking and lint configurations if available. +// 8. Produce the final digest by URL-base64 encoding the summed bytes and prefixing it with the digest prefix +func ModuleDigestB3(ctx context.Context, module Module) (string, error) { + hash := sha256.New() + // We do not want to change the sort order as the rest of the codebase relies on it, + // but we only want to use commit as part of the sort order, so we make a copy of + // the slice and sort it by commit + for _, dependencyModulePin := range copyModulePinsSortedByOnlyCommit(module.DependencyModulePins()) { + if _, err := hash.Write([]byte(dependencyModulePin.IdentityString() + ":" + dependencyModulePin.Commit())); err != nil { + return "", err + } + } + sourceFileInfos, err := module.SourceFileInfos(ctx) + if err != nil { + return "", err + } + for _, sourceFileInfo := range sourceFileInfos { + if _, err := hash.Write([]byte(sourceFileInfo.Path())); err != nil { + return "", err + } + moduleFile, err := module.GetModuleFile(ctx, sourceFileInfo.Path()) + if err != nil { + return "", err + } + if _, err := io.Copy(hash, moduleFile); err != nil { + return "", multierr.Append(err, moduleFile.Close()) + } + if err := moduleFile.Close(); err != nil { + return "", err + } + } + if moduleIdentity := module.ModuleIdentity(); moduleIdentity != nil { + if _, err := hash.Write([]byte(moduleIdentity.IdentityString())); err != nil { + return "", err + } + } + if docs := module.Documentation(); docs != "" { + if _, err := hash.Write([]byte(docs)); err != nil { + return "", err + } + } + if docPath := module.DocumentationPath(); docPath != "" && docPath != DefaultDocumentationPath { + if _, err := hash.Write([]byte(docPath)); err != nil { + return "", err + } + } + if license := module.License(); license != "" { + if _, err := hash.Write([]byte(license)); err != nil { + return "", err + } + } + if breakingConfig := module.BreakingConfig(); breakingConfig != nil { + breakingConfigBytes, err := bufbreakingconfig.BytesForConfig(breakingConfig) + if err != nil { + return "", err + } + if _, err := hash.Write(breakingConfigBytes); err != nil { + return "", err + } + } + if lintConfig := module.LintConfig(); lintConfig != nil { + lintConfigBytes, err := buflintconfig.BytesForConfig(lintConfig) + if err != nil { + return "", err + } + if _, err := hash.Write(lintConfigBytes); err != nil { + return "", err + } + } + return fmt.Sprintf("%s-%s", b3DigestPrefix, base64.URLEncoding.EncodeToString(hash.Sum(nil))), nil +} + +// ModuleToBucket writes the given Module to the WriteBucket. +// +// This writes the sources and the buf.lock file. +// This copies external paths if the WriteBucket supports setting of external paths. +func ModuleToBucket( + ctx context.Context, + module Module, + writeBucket storage.WriteBucket, +) error { + fileInfos, err := module.SourceFileInfos(ctx) + if err != nil { + return err + } + for _, fileInfo := range fileInfos { + if err := putModuleFileToBucket(ctx, module, fileInfo.Path(), writeBucket); err != nil { + return err + } + } + if docs := module.Documentation(); docs != "" { + moduleDocPath := DefaultDocumentationPath + if docPath := module.DocumentationPath(); docPath != "" { + moduleDocPath = docPath + } + if err := storage.PutPath(ctx, writeBucket, moduleDocPath, []byte(docs)); err != nil { + return err + } + } + if license := module.License(); license != "" { + if err := storage.PutPath(ctx, writeBucket, LicenseFilePath, []byte(license)); err != nil { + return err + } + } + if err := bufmoduleref.PutDependencyModulePinsToBucket(ctx, writeBucket, module.DependencyModulePins()); err != nil { + return err + } + // This is the default version created by bufconfig getters. The versions should be the + // same across lint and breaking configs. + version := bufconfig.V1Version + var breakingConfigVersion string + if module.BreakingConfig() != nil { + breakingConfigVersion = module.BreakingConfig().Version + } + var lintConfigVersion string + if module.LintConfig() != nil { + lintConfigVersion = module.LintConfig().Version + } + // If one of either breaking or lint config is non-nil, then other config will also be non-nil, + // even if a module does not set both configurations. An empty with the correct version + // will be set by the configuration getters. + if breakingConfigVersion != lintConfigVersion { + return fmt.Errorf("breaking config version %q does not match lint config version %q", breakingConfigVersion, lintConfigVersion) + } + if breakingConfigVersion != "" || lintConfigVersion != "" { + version = breakingConfigVersion + } + writeConfigOptions := []bufconfig.WriteConfigOption{ + bufconfig.WriteConfigWithModuleIdentity(module.ModuleIdentity()), + bufconfig.WriteConfigWithBreakingConfig(module.BreakingConfig()), + bufconfig.WriteConfigWithLintConfig(module.LintConfig()), + bufconfig.WriteConfigWithVersion(version), + } + return bufconfig.WriteConfig(ctx, writeBucket, writeConfigOptions...) +} + +// TargetModuleFilesToBucket writes the target files of the given Module to the WriteBucket. +// +// This does not write the buf.lock file. +// This copies external paths if the WriteBucket supports setting of external paths. +func TargetModuleFilesToBucket( + ctx context.Context, + module Module, + writeBucket storage.WriteBucket, +) error { + fileInfos, err := module.TargetFileInfos(ctx) + if err != nil { + return err + } + for _, fileInfo := range fileInfos { + if err := putModuleFileToBucket(ctx, module, fileInfo.Path(), writeBucket); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/bufmodulebuild.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/bufmodulebuild.go new file mode 100644 index 000000000..f577e498c --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/bufmodulebuild.go @@ -0,0 +1,171 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulebuild + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/zap" +) + +// ModuleFileSetBuilder builds ModuleFileSets from Modules. +type ModuleFileSetBuilder interface { + Build( + ctx context.Context, + module bufmodule.Module, + options ...BuildModuleFileSetOption, + ) (bufmodule.ModuleFileSet, error) +} + +// NewModuleFileSetBuilder returns a new ModuleSetProvider. +func NewModuleFileSetBuilder( + logger *zap.Logger, + moduleReader bufmodule.ModuleReader, +) ModuleFileSetBuilder { + return newModuleFileSetBuilder(logger, moduleReader) +} + +// BuildModuleFileSetOption is an option for Build. +type BuildModuleFileSetOption func(*buildModuleFileSetOptions) + +// WithWorkspace returns a new BuildModuleFileSetOption that specifies a workspace. +func WithWorkspace(workspace bufmodule.Workspace) BuildModuleFileSetOption { + return func(buildModuleFileSetOptions *buildModuleFileSetOptions) { + buildModuleFileSetOptions.workspace = workspace + } +} + +// BuiltModule ties a bufmodule.Module with the configuration and a bucket +// containing just the files required to build it. +type BuiltModule struct { + bufmodule.Module + Bucket storage.ReadBucket +} + +// ModuleBucketBuilder builds modules for buckets. +type ModuleBucketBuilder interface { + // BuildForBucket constructs a minimal bucket from the passed readBucket and + // builds a module from it. + // + // config's value is used even if the bucket contains configuration (buf.yaml). + // This means the module is built differently than described in storage, which + // may cause building to fail or succeed when it shouldn't. For your own + // sanity, you should pass a config value read from the provided bucket. + // + // TODO: why do we pass a config here?! This parameter should be removed. + BuildForBucket( + ctx context.Context, + readBucket storage.ReadBucket, + config *bufmoduleconfig.Config, + options ...BuildOption, + ) (*BuiltModule, error) +} + +// NewModuleBucketBuilder returns a new BucketBuilder. +func NewModuleBucketBuilder() ModuleBucketBuilder { + return newModuleBucketBuilder() +} + +// ModuleIncludeBuilder builds modules for includes. +// +// This is used for protoc. +type ModuleIncludeBuilder interface { + // BuildForIncludes builds a module for the given includes and file paths. + BuildForIncludes( + ctx context.Context, + includeDirPaths []string, + options ...BuildOption, + ) (bufmodule.Module, error) +} + +// NewModuleIncludeBuilder returns a new ModuleIncludeBuilder. +// +// TODO: we should parse includeDirPaths for modules as well in theory +// would be nice to be able to do buf alpha protoc -I path/to/dir -I buf.build/foo/bar/v1 +func NewModuleIncludeBuilder( + logger *zap.Logger, + storageosProvider storageos.Provider, +) ModuleIncludeBuilder { + return newModuleIncludeBuilder(logger, storageosProvider) +} + +// BuildOption is an option for BuildForBucket. +type BuildOption func(*buildOptions) + +// WithPaths returns a new BuildOption that specifies specific file or directory paths to build. +// +// These paths must exist. +// These paths must be relative to the bucket or include directory paths. +// These paths will be normalized. +// Multiple calls to this option and WithPathsAllowNotExist will override previous calls. +// +// This results in ModuleWithTargetPaths being used on the resulting build module. +// This is done within bufmodulebuild so we can resolve the paths relative to their roots. +func WithPaths(paths []string) BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.paths = &paths + } +} + +// WithPathsAllowNotExist returns a new BuildOption that specifies specific file or directory paths to build, +// but allows the specified paths to not exist. +// +// These paths must exist. +// These paths must be relative to the bucket or include directory paths. +// These paths will be normalized. +// Multiple calls to this option and WithPaths will override previous calls. +// +// This results in ModuleWithPathsAllowNotExist being used on the resulting build module. +// This is done within bufmodulebuild so we can resolve the paths relative to their roots. +func WithPathsAllowNotExist(paths []string) BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.paths = &paths + buildOptions.pathsAllowNotExist = true + } +} + +// WithModuleIdentity returns a new BuildOption that is used to construct a Module with a ModuleIdentity. +// +// TODO: this is never called +// TODO: we also have ModuleWithModuleIdentityAndCommit in bufmodule +// We need to disambiguate module building between bufmodule and bufmodulebuild +// bufimage and bufimagebuild work, but bufmodule and bufmodulebuild are a mess +func WithModuleIdentity(moduleIdentity bufmoduleref.ModuleIdentity) BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.moduleIdentity = moduleIdentity + } +} + +// WithExcludePaths returns a new BuildOption that specifies files to be excluded from the build. +func WithExcludePaths(excludePaths []string) BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.excludePaths = excludePaths + } +} + +// WithExcludePathsAllowNotExist returns a new BuildOption that specifies files to be excluded from the build, +// but allows the specified paths to not exist. +func WithExcludePathsAllowNotExist(excludePaths []string) BuildOption { + return func(buildOptions *buildOptions) { + buildOptions.excludePaths = excludePaths + buildOptions.pathsAllowNotExist = true + } +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder.go new file mode 100644 index 000000000..24e914ed9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder.go @@ -0,0 +1,170 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulebuild + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buflock" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" +) + +type moduleBucketBuilder struct{} + +func newModuleBucketBuilder() *moduleBucketBuilder { + return &moduleBucketBuilder{} +} + +func (b *moduleBucketBuilder) BuildForBucket( + ctx context.Context, + readBucket storage.ReadBucket, + config *bufmoduleconfig.Config, + options ...BuildOption, +) (*BuiltModule, error) { + buildOptions := &buildOptions{} + for _, option := range options { + option(buildOptions) + } + return b.buildForBucket( + ctx, + readBucket, + config, + buildOptions, + ) +} + +func (b *moduleBucketBuilder) buildForBucket( + ctx context.Context, + readBucket storage.ReadBucket, + config *bufmoduleconfig.Config, + buildOptions *buildOptions, +) (*BuiltModule, error) { + // proxy plain files + externalPaths := []string{ + buflock.ExternalConfigFilePath, + bufmodule.LicenseFilePath, + } + externalPaths = append(externalPaths, bufconfig.AllConfigFilePaths...) + rootBuckets := make([]storage.ReadBucket, 0, len(externalPaths)+1) + for _, docPath := range bufmodule.AllDocumentationPaths { + bucket, err := getFileReadBucket(ctx, readBucket, docPath) + if err != nil { + return nil, err + } + if bucket != nil { + rootBuckets = append(rootBuckets, bucket) + break + } + } + for _, path := range externalPaths { + bucket, err := getFileReadBucket(ctx, readBucket, path) + if err != nil { + return nil, err + } + if bucket != nil { + rootBuckets = append(rootBuckets, bucket) + } + } + + roots := make([]string, 0, len(config.RootToExcludes)) + for root, excludes := range config.RootToExcludes { + roots = append(roots, root) + mappers := []storage.Mapper{ + // need to do match extension here + // https://github.com/ProtobufMan/bufman-cli/issues/113 + storage.MatchPathExt(".proto"), + storage.MapOnPrefix(root), + } + if len(excludes) != 0 { + var notOrMatchers []storage.Matcher + for _, exclude := range excludes { + notOrMatchers = append( + notOrMatchers, + storage.MatchPathContained(exclude), + ) + } + mappers = append( + mappers, + storage.MatchNot( + storage.MatchOr( + notOrMatchers..., + ), + ), + ) + } + rootBuckets = append( + rootBuckets, + storage.MapReadBucket( + readBucket, + mappers..., + ), + ) + } + bucket := storage.MultiReadBucket(rootBuckets...) + module, err := bufmodule.NewModuleForBucket( + ctx, + bucket, + bufmodule.ModuleWithModuleIdentity( + buildOptions.moduleIdentity, // This may be nil + ), + ) + if err != nil { + return nil, err + } + appliedModule, err := applyModulePaths( + module, + roots, + buildOptions.paths, + buildOptions.excludePaths, + buildOptions.pathsAllowNotExist, + normalpath.Relative, + ) + if err != nil { + return nil, err + } + return &BuiltModule{ + Module: appliedModule, + Bucket: bucket, + }, nil +} + +// may return nil. +func getFileReadBucket( + ctx context.Context, + readBucket storage.ReadBucket, + filePath string, +) (storage.ReadBucket, error) { + fileData, err := storage.ReadPath(ctx, readBucket, filePath) + if err != nil { + if storage.IsNotExist(err) { + return nil, nil + } + return nil, err + } + if len(fileData) == 0 { + return nil, nil + } + return storagemem.NewReadBucket( + map[string][]byte{ + filePath: fileData, + }, + ) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_test.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_test.go new file mode 100644 index 000000000..56927a582 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_test.go @@ -0,0 +1,585 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulebuild + +import ( + "context" + "io" + "path/filepath" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestBucketGetFileInfos1(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1( + bufmoduleconfig.ExternalConfigV1{ + Excludes: []string{"proto/b"}, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/1", + config, + bufmoduletesting.NewFileInfo(t, "proto/a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/c/1.proto", "testdata/1/proto/a/c/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/c/2.proto", "testdata/1/proto/a/c/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/c/3.proto", "testdata/1/proto/a/c/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), + ) +} + +func TestBucketGetFileInfos2(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1( + bufmoduleconfig.ExternalConfigV1{ + Excludes: []string{"proto/a"}, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/1", + config, + bufmoduletesting.NewFileInfo(t, "proto/b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), + ) +} + +func TestBucketGetFileInfo3(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1( + bufmoduleconfig.ExternalConfigV1{ + Excludes: []string{"proto/a/c"}, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/1", + config, + bufmoduletesting.NewFileInfo(t, "proto/a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), + ) +} + +func TestBucketGetFileInfos4(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1( + bufmoduleconfig.ExternalConfigV1{ + Excludes: []string{ + "proto/a/c", + "proto/d", + }, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/1", + config, + bufmoduletesting.NewFileInfo(t, "proto/a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), + ) +} + +func TestBucketGetAllFileInfos5(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1( + bufmoduleconfig.ExternalConfigV1{}, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/3", + config, + ) +} + +func TestConfigV1Beta1BucketGetFileInfos1(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1Beta1( + bufmoduleconfig.ExternalConfigV1Beta1{ + Roots: []string{ + "proto", + }, + Excludes: []string{ + "proto/b", + }, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/1", + config, + bufmoduletesting.NewFileInfo(t, "a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/c/1.proto", "testdata/1/proto/a/c/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/c/2.proto", "testdata/1/proto/a/c/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/c/3.proto", "testdata/1/proto/a/c/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), + ) +} + +func TestConfigV1Beta1BucketGetFileInfos2(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1Beta1( + bufmoduleconfig.ExternalConfigV1Beta1{ + Roots: []string{ + "proto", + }, + Excludes: []string{ + "proto/a", + }, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/1", + config, + bufmoduletesting.NewFileInfo(t, "b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), + ) +} + +func TestConfigV1Beta1BucketGetFileInfo3(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1Beta1( + bufmoduleconfig.ExternalConfigV1Beta1{ + Roots: []string{ + "proto", + }, + Excludes: []string{ + "proto/a/c", + }, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/1", + config, + bufmoduletesting.NewFileInfo(t, "a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), + ) +} + +func TestConfigV1Beta1BucketGetFileInfos4(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1Beta1( + bufmoduleconfig.ExternalConfigV1Beta1{ + Roots: []string{ + "proto", + }, + Excludes: []string{ + "proto/a/c", + "proto/d", + }, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/1", + config, + bufmoduletesting.NewFileInfo(t, "a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), + ) +} + +func TestConfigV1Beta1BucketGetAllFileInfos5(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1Beta1( + bufmoduleconfig.ExternalConfigV1Beta1{ + Roots: []string{ + ".", + }, + }, + ) + require.NoError(t, err) + testBucketGetFileInfos( + t, + "testdata/3", + config, + ) +} + +func TestConfigV1Beta1BucketGetAllFileInfosError1(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1Beta1( + bufmoduleconfig.ExternalConfigV1Beta1{ + Roots: []string{ + "a", + "b", + }, + }, + ) + require.NoError(t, err) + testBucketGetAllFileInfosError( + t, + "testdata/2", + config, + nil, + ) +} + +func TestConfigV1Beta1BucketGetFileInfosForExternalPathsError1(t *testing.T) { + t.Parallel() + config, err := bufmoduleconfig.NewConfigV1Beta1( + bufmoduleconfig.ExternalConfigV1Beta1{ + Roots: []string{ + "a", + "b", + }, + }, + ) + require.NoError(t, err) + testBucketGetFileInfosForExternalPathsError( + t, + "testdata/2", + config, + []string{ + "testdata/2/a/1.proto", + "testdata/2/a/2.proto", + "testdata/2/a/3.proto", + "testdata/2/b/1.proto", + "testdata/2/b/4.proto", + }, + ) +} + +func TestDocumentation(t *testing.T) { + t.Parallel() + testDocumentationBucket( + t, + "testdata/4", + bufmodule.DefaultDocumentationPath, + bufmoduletesting.NewFileInfo(t, "proto/1.proto", "testdata/4/proto/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/4/proto/a/2.proto", false, nil, ""), + ) +} + +func TestLicense(t *testing.T) { + t.Parallel() + testLicenseBucket( + t, + "testdata/5", + "Test Module License", + bufmoduletesting.NewFileInfo(t, "proto/1.proto", "testdata/5/proto/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/5/proto/a/2.proto", false, nil, ""), + ) +} + +func TestConfigInclusion(t *testing.T) { + t.Parallel() + t.Run("buf.yaml", func(t *testing.T) { + t.Parallel() + testConfigInclusion(t, "buf.yaml") + }) + t.Run("buf.mod", func(t *testing.T) { + t.Parallel() + testConfigInclusion(t, "buf.mod") + }) +} + +func testConfigInclusion(t *testing.T, confname string) { + // bucket creation + bufyaml := ` +version: v1 +breaking: + ignore_unstable_packages: true +lint: + allow_comment_ignores: true +` + ctx := context.Background() + bucket, err := memBucket(ctx, + confname, bufyaml, + "a/1.proto", "", + ) + require.NoError(t, err) + + // build + config, err := bufmoduleconfig.NewConfigV1( + bufmoduleconfig.ExternalConfigV1{}, + ) + require.NoError(t, err) + module, err := NewModuleBucketBuilder().BuildForBucket( + ctx, + bucket, + config, + ) + require.NoError(t, err) + require.NotNil(t, module) + + // assert: one proto consumed + fileInfos, err := module.TargetFileInfos(ctx) + assert.NoError(t, err) + assert.Len(t, fileInfos, 1) + + // assert: breaking and lint configuration exists + zeroBreaking := bufbreakingconfig.NewConfigV1( + bufbreakingconfig.ExternalConfigV1{}, + ) + assert.NotEqual(t, zeroBreaking, module.BreakingConfig(), "empty BreakingConfig") + zeroLint := buflintconfig.NewConfigV1( + buflintconfig.ExternalConfigV1{}, + ) + assert.NotEqual(t, zeroLint, module.LintConfig(), "empty LintConfig") +} + +func memBucket(ctx context.Context, pathcontent ...string) (storage.ReadBucket, error) { + membucket := storagemem.NewReadWriteBucket() + for i := 0; i < len(pathcontent); i += 2 { + fh, err := membucket.Put(ctx, pathcontent[i]) + if err != nil { + return nil, err + } + _, err = io.Copy(fh, strings.NewReader(pathcontent[i+1])) + if err != nil { + return nil, err + } + fh.Close() + } + return membucket, nil +} + +func testBucketGetFileInfos( + t *testing.T, + relDir string, + config *bufmoduleconfig.Config, + expectedFileInfos ...bufmoduleref.FileInfo, +) { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + relDir, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + module, err := NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config, + ) + require.NoError(t, err) + fileInfos, err := module.SourceFileInfos(context.Background()) + assert.NoError(t, err) + assert.Equal( + t, + expectedFileInfos, + fileInfos, + ) + if len(expectedFileInfos) > 1 { + expectedFileInfos = expectedFileInfos[:len(expectedFileInfos)-1] + bucketRelPaths := make([]string, len(expectedFileInfos)) + for i, expectedFileInfo := range expectedFileInfos { + bucketRelExternalPath, err := filepath.Rel(relDir, expectedFileInfo.ExternalPath()) + require.NoError(t, err) + bucketRelPath, err := normalpath.NormalizeAndValidate(bucketRelExternalPath) + require.NoError(t, err) + bucketRelPaths[i] = bucketRelPath + } + module, err := NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config, + WithPaths(bucketRelPaths), + ) + require.NoError(t, err) + fileInfos, err := module.TargetFileInfos(context.Background()) + assert.NoError(t, err) + assert.Equal( + t, + expectedFileInfos, + fileInfos, + ) + } +} + +func testBucketGetAllFileInfosError( + t *testing.T, + relDir string, + config *bufmoduleconfig.Config, + expectedSpecificError error, +) { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + relDir, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + module, err := NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config, + ) + require.NoError(t, err) + _, err = module.SourceFileInfos(context.Background()) + if expectedSpecificError != nil { + assert.Equal(t, expectedSpecificError, err) + } else { + assert.Error(t, err) + } +} + +func testBucketGetFileInfosForExternalPathsError( + t *testing.T, + relDir string, + config *bufmoduleconfig.Config, + externalPaths []string, +) { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + relDir, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + bucketRelPaths := make([]string, len(externalPaths)) + for i, externalPath := range externalPaths { + bucketRelExternalPath, err := filepath.Rel(relDir, externalPath) + require.NoError(t, err) + bucketRelPath, err := normalpath.NormalizeAndValidate(bucketRelExternalPath) + require.NoError(t, err) + bucketRelPaths[i] = bucketRelPath + } + _, err = NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config, + WithPaths(bucketRelPaths), + ) + assert.Error(t, err) +} + +func testDocumentationBucket( + t *testing.T, + relDir string, + expectedDocPath string, + expectedFileInfos ...bufmoduleref.FileInfo, +) { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + relDir, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + config, err := bufmoduleconfig.NewConfigV1( + bufmoduleconfig.ExternalConfigV1{}, + ) + require.NoError(t, err) + module, err := NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config, + ) + require.NoError(t, err) + require.NotNil(t, module) + assert.NotEmpty(t, module.Documentation()) + assert.Equal(t, expectedDocPath, module.DocumentationPath()) + fileInfos, err := module.TargetFileInfos(context.Background()) + assert.NoError(t, err) + assert.Equal( + t, + expectedFileInfos, + fileInfos, + ) +} + +func testLicenseBucket( + t *testing.T, + relDir string, + expectedLicense string, + expectedFileInfos ...bufmoduleref.FileInfo, +) { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + readWriteBucket, err := storageosProvider.NewReadWriteBucket( + relDir, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + config, err := bufmoduleconfig.NewConfigV1( + bufmoduleconfig.ExternalConfigV1{}, + ) + require.NoError(t, err) + module, err := NewModuleBucketBuilder().BuildForBucket( + context.Background(), + readWriteBucket, + config, + ) + require.NoError(t, err) + require.NotNil(t, module) + assert.NotEmpty(t, module.License()) + assert.Equal(t, expectedLicense, module.License()) + fileInfos, err := module.TargetFileInfos(context.Background()) + assert.NoError(t, err) + assert.Equal( + t, + expectedFileInfos, + fileInfos, + ) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_unix_test.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_unix_test.go new file mode 100644 index 000000000..21444b684 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_unix_test.go @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package bufmodulebuild + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" +) + +func TestLicenseSymlink(t *testing.T) { + t.Parallel() + testLicenseBucket( + t, + "testdata/6", + "Test Module License", // expecting the same license with testdata/5 as it symlink to the license there + bufmoduletesting.NewFileInfo(t, "proto/1.proto", "testdata/6/proto/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/6/proto/a/2.proto", false, nil, ""), + ) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_file_set_builder.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_file_set_builder.go new file mode 100644 index 000000000..b0df379ec --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_file_set_builder.go @@ -0,0 +1,177 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulebuild + +import ( + "context" + "encoding/hex" + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "go.uber.org/zap" + "golang.org/x/crypto/sha3" +) + +type moduleFileSetBuilder struct { + logger *zap.Logger + moduleReader bufmodule.ModuleReader +} + +func newModuleFileSetBuilder( + logger *zap.Logger, + moduleReader bufmodule.ModuleReader, +) *moduleFileSetBuilder { + return &moduleFileSetBuilder{ + logger: logger, + moduleReader: moduleReader, + } +} + +func (m *moduleFileSetBuilder) Build( + ctx context.Context, + module bufmodule.Module, + options ...BuildModuleFileSetOption, +) (bufmodule.ModuleFileSet, error) { + buildModuleFileSetOptions := &buildModuleFileSetOptions{} + for _, option := range options { + option(buildModuleFileSetOptions) + } + return m.build( + ctx, + module, + buildModuleFileSetOptions.workspace, + ) +} + +func (m *moduleFileSetBuilder) build( + ctx context.Context, + module bufmodule.Module, + workspace bufmodule.Workspace, +) (bufmodule.ModuleFileSet, error) { + var dependencyModules []bufmodule.Module + hashes := make(map[string]struct{}) + moduleHash, err := protoPathsHash(ctx, module) + if err != nil { + return nil, err + } + hashes[moduleHash] = struct{}{} + if workspace != nil { + // From the perspective of the ModuleFileSet, we include all of the files + // specified in the workspace. When we build the Image from the ModuleFileSet, + // we construct it based on the TargetFileInfos, and thus only include the files + // in the transitive closure. + // + // This is defensible as we're saying that everything in the workspace is a potential + // dependency, even if some are not actual dependencies of this specific module. In this + // case, the extra modules are no different than unused dependencies in a buf.yaml/buf.lock. + // + // By including all the Modules from the workspace, we are potentially including the input + // Module itself. This is bad, and will result in errors when using the result ModuleFileSet. + // The ModuleFileSet expects a Module, and its dependency Modules, but it is not OK for + // a Module to both be the input Module and a dependency Module. We have no concept + // of Module "ID" - a Module may have a ModuleIdentity and commit associated with it, + // but there is no guarantee of this. To get around this, we do a hash of the .proto file + // paths within a Module, and say that Modules are equivalent if they contain the exact + // same .proto file paths. If they have the same .proto file paths, then we do not + // add the Module as a dependency. + // + // We know from bufmodule.Workspace that no two Modules in a Workspace will have overlapping + // file paths, therefore if the Module is in the Workspace and has equivalent file paths, + // we know that it must be the same module. If the Module is not in the workspace...why + // did we provide a workspace? + // + // We could use other methods for equivalence or to say "do not add": + // + // - If there are any overlapping files: for example, one module has a.proto, one module + // has b.proto, and both have c.proto. We don't use this heuristic as what we are looking + // for here is a situation where based on our Module construction, we have two actually-equivalent + // Modules. The existence of any overlapping files will result in an error during build, which + // is what we want. This would also indicate this Module did not come from the Workspace, given + // the property of file uniqueness in Workspaces. + // - Golang object equivalence: for example, doing "module != potentialDependencyModule". This + // happens to work since we only construct Modules once, but it's error-prone: it's totally + // possible to create two Module objects from the same source, and if they represent the + // same Module on disk/in the BSR, we don't want to include these as duplicates. + // - Full module digest and/or proto file content: We could include buf.yaml, buf.lock, + // README.md, etc, and also hash the actual content of the .proto files, but we're saying + // that this doesn't help us any more than just comparing .proto files, and may lead to + // false negatives. However, this is the most likely candidate as an alternative, as you + // could argue that at the ModuleFileSetBuilder level, we should say "assume any difference + // is a real difference". + // + // We could also determine which modules could be omitted here, but it would incur + // the cost of parsing the target files and detecting exactly which imports are + // used. We already get this for free in Image construction, so it's simplest and + // most efficient to bundle all of the modules together like so. + for _, potentialDependencyModule := range workspace.GetModules() { + potentialDependencyModuleHash, err := protoPathsHash(ctx, potentialDependencyModule) + if err != nil { + return nil, err + } + if _, ok := hashes[potentialDependencyModuleHash]; !ok { + dependencyModules = append(dependencyModules, potentialDependencyModule) + } else { + hashes[potentialDependencyModuleHash] = struct{}{} + } + } + } + // We know these are unique by remote, owner, repository and + // contain all transitive dependencies. + for _, dependencyModulePin := range module.DependencyModulePins() { + if workspace != nil { + if _, ok := workspace.GetModule(dependencyModulePin); ok { + // This dependency is already provided by the workspace, so we don't + // need to consult the ModuleReader. + continue + } + } + dependencyModule, err := m.moduleReader.GetModule(ctx, dependencyModulePin) + if err != nil { + return nil, err + } + dependencyModuleHash, err := protoPathsHash(ctx, dependencyModule) + if err != nil { + return nil, err + } + // At this point, this is really just a safety check. + if _, ok := hashes[dependencyModuleHash]; ok { + return nil, errors.New("module declared in DependencyModulePins but not in workspace was already added to the dependency Module set, this is a system error") + } + dependencyModules = append(dependencyModules, dependencyModule) + hashes[dependencyModuleHash] = struct{}{} + } + return bufmodule.NewModuleFileSet(module, dependencyModules), nil +} + +// protoPathsHash returns a hash representing the paths of the .proto files within the Module. +func protoPathsHash(ctx context.Context, module bufmodule.Module) (string, error) { + fileInfos, err := module.SourceFileInfos(ctx) + if err != nil { + return "", err + } + shakeHash := sha3.NewShake256() + for _, fileInfo := range fileInfos { + _, err := shakeHash.Write([]byte(fileInfo.Path())) + if err != nil { + return "", err + } + } + data := make([]byte, 64) + if _, err := shakeHash.Read(data); err != nil { + return "", err + } + return hex.EncodeToString(data), nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder.go new file mode 100644 index 000000000..5bb47b4aa --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder.go @@ -0,0 +1,119 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulebuild + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/zap" +) + +type moduleIncludeBuilder struct { + logger *zap.Logger + storageosProvider storageos.Provider +} + +func newModuleIncludeBuilder( + logger *zap.Logger, + storageosProvider storageos.Provider, +) *moduleIncludeBuilder { + return &moduleIncludeBuilder{ + logger: logger, + storageosProvider: storageosProvider, + } +} + +func (b *moduleIncludeBuilder) BuildForIncludes( + ctx context.Context, + includeDirPaths []string, + options ...BuildOption, +) (bufmodule.Module, error) { + buildOptions := &buildOptions{} + for _, option := range options { + option(buildOptions) + } + return b.buildForIncludes( + ctx, + includeDirPaths, + buildOptions.paths, + buildOptions.pathsAllowNotExist, + ) +} + +func (b *moduleIncludeBuilder) buildForIncludes( + ctx context.Context, + includeDirPaths []string, + fileOrDirPaths *[]string, + fileOrDirPathsAllowNotExist bool, +) (bufmodule.Module, error) { + if len(includeDirPaths) == 0 { + includeDirPaths = []string{"."} + } + absIncludeDirPaths, err := internal.NormalizeAndCheckPaths( + includeDirPaths, + "include directory", + normalpath.Absolute, + true, + ) + if err != nil { + return nil, err + } + var absFileOrDirPaths *[]string + if fileOrDirPaths != nil { + normalizedAndCheckedFileOrDirPaths, err := internal.NormalizeAndCheckPaths( + *fileOrDirPaths, + "input file", + normalpath.Absolute, + false, + ) + if err != nil { + return nil, err + } + if len(normalizedAndCheckedFileOrDirPaths) > 0 { + absFileOrDirPaths = &normalizedAndCheckedFileOrDirPaths + } + } + var rootBuckets []storage.ReadBucket + for _, includeDirPath := range includeDirPaths { + rootBucket, err := b.storageosProvider.NewReadWriteBucket( + includeDirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + if err != nil { + return nil, err + } + // need to do match extension here + // https://github.com/ProtobufMan/bufman-cli/issues/113 + rootBuckets = append(rootBuckets, storage.MapReadBucket(rootBucket, storage.MatchPathExt(".proto"))) + } + module, err := bufmodule.NewModuleForBucket(ctx, storage.MultiReadBucket(rootBuckets...)) + if err != nil { + return nil, err + } + return applyModulePaths( + module, + absIncludeDirPaths, + absFileOrDirPaths, + nil, // Excluding files isn't supported for the ModuleIncludeBuilder. + fileOrDirPathsAllowNotExist, + normalpath.Absolute, + ) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder_test.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder_test.go new file mode 100644 index 000000000..a94c283a7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder_test.go @@ -0,0 +1,200 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulebuild + +import ( + "context" + "fmt" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestIncludeGetFileInfos1(t *testing.T) { + t.Parallel() + testIncludeGetFileInfos( + t, + "testdata/1", + []string{ + "proto", + }, + bufmoduletesting.NewFileInfo(t, "a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/c/1.proto", "testdata/1/proto/a/c/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/c/2.proto", "testdata/1/proto/a/c/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/c/3.proto", "testdata/1/proto/a/c/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), + ) +} + +func TestIncludeGetFileInfos2(t *testing.T) { + t.Parallel() + testIncludeGetFileInfos( + t, + "testdata/3", + []string{ + ".", + }, + ) +} + +func TestIncludeGetFileInfosForExternalPathsError1(t *testing.T) { + t.Parallel() + testIncludeGetFileInfosForExternalPathsError( + t, + "testdata/2", + []string{ + "a", + "b", + }, + []string{ + "testdata/2/a/1.proto", + "testdata/2/a/2.proto", + "testdata/2/a/3.proto", + "testdata/2/b/1.proto", + "testdata/2/b/4.proto", + }, + ) +} + +func testIncludeGetFileInfos( + t *testing.T, + relDir string, + relRoots []string, + expectedFileInfos ...bufmoduleref.FileInfo, +) { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + for _, isAbs := range []bool{true, false} { + isAbs := isAbs + expectedFileInfos := expectedFileInfos + if isAbs { + expectedFileInfos = fileInfosToAbs(t, expectedFileInfos) + } + t.Run(fmt.Sprintf("abs=%v", isAbs), func(t *testing.T) { + t.Parallel() + includeDirPaths := testIncludeDirPaths(t, relDir, relRoots, isAbs) + module, err := NewModuleIncludeBuilder(zap.NewNop(), storageosProvider).BuildForIncludes( + context.Background(), + includeDirPaths, + ) + require.NoError(t, err) + fileInfos, err := module.SourceFileInfos(context.Background()) + assert.NoError(t, err) + assert.Equal( + t, + expectedFileInfos, + fileInfos, + ) + if len(expectedFileInfos) > 1 { + expectedFileInfos = expectedFileInfos[:len(expectedFileInfos)-1] + filePaths := make([]string, len(expectedFileInfos)) + for i := 0; i < len(expectedFileInfos); i++ { + filePaths[i] = expectedFileInfos[i].ExternalPath() + } + module, err := NewModuleIncludeBuilder(zap.NewNop(), storageosProvider).BuildForIncludes( + context.Background(), + includeDirPaths, + WithPaths(filePaths), + ) + require.NoError(t, err) + fileInfos, err := module.TargetFileInfos(context.Background()) + assert.NoError(t, err) + assert.Equal( + t, + expectedFileInfos, + fileInfos, + ) + } + }) + } +} + +func testIncludeGetFileInfosForExternalPathsError( + t *testing.T, + relDir string, + relRoots []string, + externalPaths []string, +) { + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + for _, isAbs := range []bool{true, false} { + isAbs := isAbs + t.Run(fmt.Sprintf("abs=%v", isAbs), func(t *testing.T) { + t.Parallel() + includeDirPaths := testIncludeDirPaths(t, relDir, relRoots, isAbs) + _, err := NewModuleIncludeBuilder(zap.NewNop(), storageosProvider).BuildForIncludes( + context.Background(), + includeDirPaths, + WithPaths(externalPaths), + ) + assert.Error(t, err) + }) + } +} + +func testIncludeDirPaths( + t *testing.T, + relDir string, + relRoots []string, + isAbs bool, +) []string { + includeDirPaths := make([]string, len(relRoots)) + for i, relRoot := range relRoots { + includeDirPaths[i] = normalpath.Unnormalize(normalpath.Join(relDir, relRoot)) + } + if isAbs { + for i, includeDirPath := range includeDirPaths { + absIncludeDirPath, err := filepath.Abs(includeDirPath) + require.NoError(t, err) + includeDirPaths[i] = absIncludeDirPath + } + } + return includeDirPaths +} + +// fileInfosToAbs converts the external paths to absolute. +func fileInfosToAbs(t *testing.T, fileInfos []bufmoduleref.FileInfo) []bufmoduleref.FileInfo { + if fileInfos == nil { + return nil + } + newFileInfos := make([]bufmoduleref.FileInfo, len(fileInfos)) + for i, fileInfo := range fileInfos { + absExternalPath, err := normalpath.NormalizeAndAbsolute(fileInfo.ExternalPath()) + require.NoError(t, err) + newFileInfo := bufmoduletesting.NewFileInfo( + t, + fileInfo.Path(), + absExternalPath, + fileInfo.IsImport(), + nil, + "", + ) + newFileInfos[i] = newFileInfo + } + return newFileInfos +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/2.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/2.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/3.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/3.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/2.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/2.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/3.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/3.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/2.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/2.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/3.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/3.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/2.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/2.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/3.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/3.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/2.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/2.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/3.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/3.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/4.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/4.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/4.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/5.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/5.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/5.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/3/nop b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/3/nop new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/buf.md b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/buf.md new file mode 100644 index 000000000..d2e86f30f --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/buf.md @@ -0,0 +1 @@ +# Test Module Documentation diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/a/2.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/a/2.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/LICENSE b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/LICENSE new file mode 100644 index 000000000..f07de0e8e --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/LICENSE @@ -0,0 +1 @@ +Test Module License \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/a/2.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/a/2.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/LICENSE b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/LICENSE new file mode 100644 index 000000000..0f3baae22 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/LICENSE @@ -0,0 +1 @@ +../5/LICENSE \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/1.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/1.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/a/2.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/a/2.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/util.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/util.go new file mode 100644 index 000000000..dd22ca338 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/util.go @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulebuild + +import ( + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +func applyModulePaths( + module bufmodule.Module, + roots []string, + fileOrDirPaths *[]string, + excludeFileOrDirPaths []string, + fileOrDirPathsAllowNotExist bool, + pathType normalpath.PathType, +) (bufmodule.Module, error) { + if fileOrDirPaths == nil && excludeFileOrDirPaths == nil { + return module, nil + } + var excludePaths []string + if len(excludeFileOrDirPaths) != 0 { + var err error + excludePaths, err = pathsToTargetPaths(roots, excludeFileOrDirPaths, pathType) + if err != nil { + return nil, err + } + } + if fileOrDirPaths == nil { + if fileOrDirPathsAllowNotExist { + return bufmodule.ModuleWithExcludePathsAllowNotExist(module, excludePaths) + } + return bufmodule.ModuleWithExcludePaths(module, excludePaths) + } + targetPaths, err := pathsToTargetPaths(roots, *fileOrDirPaths, pathType) + if err != nil { + return nil, err + } + if fileOrDirPathsAllowNotExist { + return bufmodule.ModuleWithTargetPathsAllowNotExist(module, targetPaths, excludePaths) + } + return bufmodule.ModuleWithTargetPaths(module, targetPaths, excludePaths) +} + +func pathsToTargetPaths(roots []string, paths []string, pathType normalpath.PathType) ([]string, error) { + if len(roots) == 0 { + // this should never happen + return nil, errors.New("no roots on config") + } + + targetPaths := make([]string, len(paths)) + for i, path := range paths { + targetPath, err := pathToTargetPath(roots, path, pathType) + if err != nil { + return nil, err + } + targetPaths[i] = targetPath + } + return targetPaths, nil +} + +func pathToTargetPath(roots []string, path string, pathType normalpath.PathType) (string, error) { + var matchingRoots []string + for _, root := range roots { + if normalpath.ContainsPath(root, path, pathType) { + matchingRoots = append(matchingRoots, root) + } + } + switch len(matchingRoots) { + case 0: + // this is a user error and will likely happen often + return "", fmt.Errorf( + "path %q is not contained within any of roots %s - note that specified paths "+ + "cannot be roots, but must be contained within roots", + path, + stringutil.SliceToHumanStringQuoted(roots), + ) + case 1: + targetPath, err := normalpath.Rel(matchingRoots[0], path) + if err != nil { + return "", err + } + // just in case + return normalpath.NormalizeAndValidate(targetPath) + default: + // this should never happen + return "", fmt.Errorf("%q is contained in multiple roots %s", path, stringutil.SliceToHumanStringQuoted(roots)) + } +} + +type buildOptions struct { + moduleIdentity bufmoduleref.ModuleIdentity + // If nil, all files are considered targets. + // If empty (but non-nil), the module will have no target paths. + paths *[]string + pathsAllowNotExist bool + // Paths that will be excluded from the module build process. This is handled in conjunction + // with `paths`. + excludePaths []string +} + +type buildModuleFileSetOptions struct { + workspace bufmodule.Workspace +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/bufmodulecache.go b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/bufmodulecache.go new file mode 100644 index 000000000..cfdc711c6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/bufmodulecache.go @@ -0,0 +1,50 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulecache + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/connectclient" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/verbose" + "go.uber.org/zap" +) + +type RepositoryServiceClientFactory func(address string) registryv1alpha1connect.RepositoryServiceClient + +func NewRepositoryServiceClientFactory(clientConfig *connectclient.Config) RepositoryServiceClientFactory { + return func(address string) registryv1alpha1connect.RepositoryServiceClient { + return connectclient.Make(clientConfig, address, registryv1alpha1connect.NewRepositoryServiceClient) + } +} + +// NewModuleReader creates a new module reader using content addressable storage. +func NewModuleReader( + logger *zap.Logger, + verbosePrinter verbose.Printer, + bucket storage.ReadWriteBucket, + delegate bufmodule.ModuleReader, + repositoryClientFactory RepositoryServiceClientFactory, +) bufmodule.ModuleReader { + return newCASModuleReader( + bucket, + delegate, + repositoryClientFactory, + logger, + verbosePrinter, + ) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cache_stats.go b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cache_stats.go new file mode 100644 index 000000000..c87306a3a --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cache_stats.go @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulecache + +import "sync" + +type cacheStats struct { + lock sync.RWMutex + count int + hits int +} + +func (s *cacheStats) MarkHit() { + s.lock.Lock() + defer s.lock.Unlock() + s.count++ + s.hits++ +} + +func (s *cacheStats) MarkMiss() { + s.lock.Lock() + defer s.lock.Unlock() + s.count++ +} + +func (s *cacheStats) Count() int { + s.lock.RLock() + defer s.lock.RUnlock() + return s.count +} + +func (s *cacheStats) Hits() int { + s.lock.RLock() + defer s.lock.RUnlock() + return s.hits +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_cacher.go b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_cacher.go new file mode 100644 index 000000000..b272dae68 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_cacher.go @@ -0,0 +1,266 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulecache + +import ( + "context" + "errors" + "fmt" + "io" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "go.uber.org/multierr" + "go.uber.org/zap" +) + +// subdirectories under ~/.cache/buf/v2/{remote}/{owner}/{repo} +const ( + blobsDir = "blobs" + commitsDir = "commits" +) + +type casModuleCacher struct { + logger *zap.Logger + bucket storage.ReadWriteBucket +} + +func (c *casModuleCacher) GetModule( + ctx context.Context, + modulePin bufmoduleref.ModulePin, +) (_ bufmodule.Module, retErr error) { + moduleBasedir := normalpath.Join(modulePin.Remote(), modulePin.Owner(), modulePin.Repository()) + manifestDigestStr := modulePin.Digest() + if manifestDigestStr == "" { + // Attempt to look up manifest digest from commit + commitPath := normalpath.Join(moduleBasedir, commitsDir, modulePin.Commit()) + manifestDigestBytes, err := c.loadPath(ctx, commitPath) + if err != nil { + return nil, err + } + manifestDigestStr = string(manifestDigestBytes) + } + manifestDigest, err := manifest.NewDigestFromString(manifestDigestStr) + if err != nil { + return nil, err + } + manifestFromCache, err := c.readManifest(ctx, moduleBasedir, *manifestDigest) + if err != nil { + return nil, err + } + digests := manifestFromCache.Digests() + blobs := make([]manifest.Blob, len(digests)) + for i, digest := range digests { + blob, err := c.readBlob(ctx, moduleBasedir, digest) + if err != nil { + return nil, err + } + blobs[i] = blob + } + blobSet, err := manifest.NewBlobSet(ctx, blobs) + if err != nil { + return nil, err + } + return bufmodule.NewModuleForManifestAndBlobSet( + ctx, + manifestFromCache, + blobSet, + bufmodule.ModuleWithModuleIdentityAndCommit( + modulePin, + modulePin.Commit(), + ), + ) +} + +func (c *casModuleCacher) PutModule( + ctx context.Context, + modulePin bufmoduleref.ModulePin, + module bufmodule.Module, +) (retErr error) { + moduleManifest := module.Manifest() + if moduleManifest == nil { + return fmt.Errorf("manifest must be non-nil") + } + manifestBlob, err := moduleManifest.Blob() + if err != nil { + return err + } + manifestDigest := manifestBlob.Digest() + if manifestDigest == nil { + return errors.New("empty manifest digest") + } + if modulePinDigestEncoded := modulePin.Digest(); modulePinDigestEncoded != "" { + modulePinDigest, err := manifest.NewDigestFromString(modulePinDigestEncoded) + if err != nil { + return fmt.Errorf("invalid module pin digest %q: %w", modulePinDigestEncoded, err) + } + if !manifestDigest.Equal(*modulePinDigest) { + return fmt.Errorf("manifest digest mismatch: pin=%q, module=%q", modulePinDigest.String(), manifestDigest.String()) + } + } + moduleBasedir := normalpath.Join(modulePin.Remote(), modulePin.Owner(), modulePin.Repository()) + // Write blobs + for _, digest := range moduleManifest.Digests() { + blobDigestStr := digest.String() + blob, found := module.BlobSet().BlobFor(blobDigestStr) + if !found { + paths, _ := moduleManifest.PathsFor(blobDigestStr) + return fmt.Errorf("blob not found for digest=%q (paths=%v)", blobDigestStr, paths) + } + if err := c.writeBlob(ctx, moduleBasedir, blob); err != nil { + return err + } + } + // Write manifest + if err := c.writeBlob(ctx, moduleBasedir, manifestBlob); err != nil { + return err + } + // Write commit + commitPath := normalpath.Join(moduleBasedir, commitsDir, modulePin.Commit()) + if err := c.atomicWrite(ctx, strings.NewReader(manifestBlob.Digest().String()), commitPath); err != nil { + return err + } + return nil +} + +func (c *casModuleCacher) readBlob( + ctx context.Context, + moduleBasedir string, + digest manifest.Digest, +) (_ manifest.Blob, retErr error) { + hexDigest := digest.Hex() + blobPath := normalpath.Join(moduleBasedir, blobsDir, hexDigest[:2], hexDigest[2:]) + contents, err := c.loadPath(ctx, blobPath) + if err != nil { + return nil, err + } + blob, err := manifest.NewMemoryBlob(digest, contents, manifest.MemoryBlobWithDigestValidation()) + if err != nil { + return nil, fmt.Errorf("failed to create blob from path %s: %w", blobPath, err) + } + return blob, nil +} + +func (c *casModuleCacher) validateBlob( + ctx context.Context, + moduleBasedir string, + digest *manifest.Digest, +) (bool, error) { + hexDigest := digest.Hex() + blobPath := normalpath.Join(moduleBasedir, blobsDir, hexDigest[:2], hexDigest[2:]) + f, err := c.bucket.Get(ctx, blobPath) + if err != nil { + return false, err + } + defer func() { + if err := f.Close(); err != nil { + c.logger.Sugar().Debug("err closing blob", zap.Error(err)) + } + }() + digester, err := manifest.NewDigester(digest.Type()) + if err != nil { + return false, err + } + cacheDigest, err := digester.Digest(f) + if err != nil { + return false, err + } + return digest.Equal(*cacheDigest), nil +} + +func (c *casModuleCacher) readManifest( + ctx context.Context, + moduleBasedir string, + manifestDigest manifest.Digest, +) (_ *manifest.Manifest, retErr error) { + blob, err := c.readBlob(ctx, moduleBasedir, manifestDigest) + if err != nil { + return nil, err + } + f, err := blob.Open(ctx) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, f.Close()) + }() + moduleManifest, err := manifest.NewFromReader(f) + if err != nil { + return nil, fmt.Errorf("failed to read manifest %s: %w", manifestDigest.String(), err) + } + return moduleManifest, nil +} + +func (c *casModuleCacher) writeBlob( + ctx context.Context, + moduleBasedir string, + blob manifest.Blob, +) (retErr error) { + // Avoid unnecessary write if the blob is already written to disk + valid, err := c.validateBlob(ctx, moduleBasedir, blob.Digest()) + if err == nil && valid { + return nil + } + if !storage.IsNotExist(err) { + c.logger.Sugar().Debug( + "repairing cache entry", + zap.String("basedir", moduleBasedir), + zap.String("digest", blob.Digest().String()), + ) + } + contents, err := blob.Open(ctx) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, contents.Close()) + }() + hexDigest := blob.Digest().Hex() + blobPath := normalpath.Join(moduleBasedir, blobsDir, hexDigest[:2], hexDigest[2:]) + return c.atomicWrite(ctx, contents, blobPath) +} + +func (c *casModuleCacher) atomicWrite(ctx context.Context, contents io.Reader, path string) (retErr error) { + f, err := c.bucket.Put(ctx, path, storage.PutWithAtomic()) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, f.Close()) + }() + if _, err := io.Copy(f, contents); err != nil { + return err + } + return nil +} + +func (c *casModuleCacher) loadPath( + ctx context.Context, + path string, +) (_ []byte, retErr error) { + f, err := c.bucket.Get(ctx, path) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, f.Close()) + }() + return io.ReadAll(f) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_reader.go b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_reader.go new file mode 100644 index 000000000..c6284c3ca --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_reader.go @@ -0,0 +1,109 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulecache + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/verbose" + "go.uber.org/zap" +) + +type casModuleReader struct { + // required parameters + delegate bufmodule.ModuleReader + repositoryClientFactory RepositoryServiceClientFactory + logger *zap.Logger + verbosePrinter verbose.Printer + // initialized in newCASModuleReader + cache *casModuleCacher + stats *cacheStats +} + +var _ bufmodule.ModuleReader = (*casModuleReader)(nil) + +func newCASModuleReader( + bucket storage.ReadWriteBucket, + delegate bufmodule.ModuleReader, + repositoryClientFactory RepositoryServiceClientFactory, + logger *zap.Logger, + verbosePrinter verbose.Printer, +) *casModuleReader { + return &casModuleReader{ + delegate: delegate, + repositoryClientFactory: repositoryClientFactory, + logger: logger, + verbosePrinter: verbosePrinter, + cache: &casModuleCacher{ + logger: logger, + bucket: bucket, + }, + stats: &cacheStats{}, + } +} + +func (c *casModuleReader) GetModule( + ctx context.Context, + modulePin bufmoduleref.ModulePin, +) (bufmodule.Module, error) { + var modulePinDigest *manifest.Digest + if digest := modulePin.Digest(); digest != "" { + var err error + modulePinDigest, err = manifest.NewDigestFromString(digest) + // Fail fast if the buf.lock file contains a malformed digest + if err != nil { + return nil, fmt.Errorf("malformed module digest %q: %w", digest, err) + } + } + cachedModule, err := c.cache.GetModule(ctx, modulePin) + if err == nil { + c.stats.MarkHit() + return cachedModule, nil + } + c.logger.Sugar().Debug("module cache miss", zap.Error(err)) + c.stats.MarkMiss() + remoteModule, err := c.delegate.GetModule(ctx, modulePin) + if err != nil { + return nil, err + } + // Manifest and BlobSet should always be set. + if remoteModule.Manifest() == nil || remoteModule.BlobSet() == nil { + return nil, fmt.Errorf("required manifest/blobSet not set on module") + } + if modulePinDigest != nil { + manifestBlob, err := remoteModule.Manifest().Blob() + if err != nil { + return nil, err + } + manifestDigest := manifestBlob.Digest() + if !modulePinDigest.Equal(*manifestDigest) { + // buf.lock module digest and BSR module don't match - fail without overwriting cache + return nil, fmt.Errorf("module digest mismatch - expected: %q, found: %q", modulePinDigest, manifestDigest) + } + } + if err := c.cache.PutModule(ctx, modulePin, remoteModule); err != nil { + return nil, err + } + if err := warnIfDeprecated(ctx, c.repositoryClientFactory, modulePin, c.logger); err != nil { + return nil, err + } + return remoteModule, nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_reader_test.go b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_reader_test.go new file mode 100644 index 000000000..b0846fbe0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/cas_module_reader_test.go @@ -0,0 +1,268 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulecache + +import ( + "bytes" + "context" + "io" + "strings" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/connect/registry/v1alpha1/registryv1alpha1connect" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/verbose" + "github.com/bufbuild/connect-go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" +) + +const pingProto = `syntax = "proto3"; + +package connect.ping.v1; + +message PingRequest { + int64 number = 1; + string text = 2; +} + +message PingResponse { + int64 number = 1; + string text = 2; +} + +service PingService { + rpc Ping(PingRequest) returns (PingResponse) {} +} +` + +func TestCASModuleReaderHappyPath(t *testing.T) { + t.Parallel() + moduleManifest, blobs := createSampleManifestAndBlobs(t) + moduleBlob, err := moduleManifest.Blob() + require.NoError(t, err) + testModule, err := bufmodule.NewModuleForManifestAndBlobSet(context.Background(), moduleManifest, blobs) + require.NoError(t, err) + storageProvider := storageos.NewProvider() + storageBucket, err := storageProvider.NewReadWriteBucket(t.TempDir()) + require.NoError(t, err) + + moduleReader := newCASModuleReader(storageBucket, &testModuleReader{module: testModule}, func(_ string) registryv1alpha1connect.RepositoryServiceClient { + return &testRepositoryServiceClient{} + }, zaptest.NewLogger(t), &testVerbosePrinter{t: t}) + pin, err := bufmoduleref.NewModulePin( + "buf.build", + "test", + "ping", + "", + "abcd", + moduleBlob.Digest().String(), + time.Now(), + ) + require.NoError(t, err) + _, err = moduleReader.GetModule(context.Background(), pin) // non-cached + require.NoError(t, err) + assert.Equal(t, 1, moduleReader.stats.Count()) + assert.Equal(t, 0, moduleReader.stats.Hits()) + verifyCache(t, storageBucket, pin, moduleManifest, blobs) + + cachedMod, err := moduleReader.GetModule(context.Background(), pin) + require.NoError(t, err) + assertModuleIdentity(t, cachedMod, pin.IdentityString(), pin.Commit()) + assert.Equal(t, 2, moduleReader.stats.Count()) + assert.Equal(t, 1, moduleReader.stats.Hits()) // We should have a cache hit the second time + verifyCache(t, storageBucket, pin, moduleManifest, blobs) +} + +func TestCASModuleReaderNoDigest(t *testing.T) { + t.Parallel() + moduleManifest, blobs := createSampleManifestAndBlobs(t) + testModule, err := bufmodule.NewModuleForManifestAndBlobSet(context.Background(), moduleManifest, blobs) + require.NoError(t, err) + storageProvider := storageos.NewProvider() + storageBucket, err := storageProvider.NewReadWriteBucket(t.TempDir()) + require.NoError(t, err) + moduleReader := newCASModuleReader(storageBucket, &testModuleReader{module: testModule}, func(_ string) registryv1alpha1connect.RepositoryServiceClient { + return &testRepositoryServiceClient{} + }, zaptest.NewLogger(t), &testVerbosePrinter{t: t}) + pin, err := bufmoduleref.NewModulePin( + "buf.build", + "test", + "ping", + "", + "abcd", + "", + time.Now(), + ) + require.NoError(t, err) + _, err = moduleReader.GetModule(context.Background(), pin) + require.NoError(t, err) + assert.Equal(t, 1, moduleReader.stats.Count()) + assert.Equal(t, 0, moduleReader.stats.Hits()) + verifyCache(t, storageBucket, pin, moduleManifest, blobs) +} + +func TestCASModuleReaderDigestMismatch(t *testing.T) { + t.Parallel() + moduleManifest, blobs := createSampleManifestAndBlobs(t) + testModule, err := bufmodule.NewModuleForManifestAndBlobSet(context.Background(), moduleManifest, blobs) + require.NoError(t, err) + storageProvider := storageos.NewProvider() + storageBucket, err := storageProvider.NewReadWriteBucket(t.TempDir()) + require.NoError(t, err) + moduleReader := newCASModuleReader(storageBucket, &testModuleReader{module: testModule}, func(_ string) registryv1alpha1connect.RepositoryServiceClient { + return &testRepositoryServiceClient{} + }, zaptest.NewLogger(t), &testVerbosePrinter{t: t}) + pin, err := bufmoduleref.NewModulePin( + "buf.build", + "test", + "ping", + "", + "abcd", + "shake256:"+strings.Repeat("00", 64), // Digest which doesn't match module's digest + time.Now(), + ) + require.NoError(t, err) + _, err = moduleReader.GetModule(context.Background(), pin) + require.Error(t, err) + numFiles := 0 + err = storageBucket.Walk(context.Background(), "", func(info storage.ObjectInfo) error { + numFiles++ + return nil + }) + require.NoError(t, err) + assert.Equal(t, 0, numFiles) // Verify nothing written to cache on digest mismatch +} + +func verifyCache( + t *testing.T, + bucket storage.ReadWriteBucket, + pin bufmoduleref.ModulePin, + moduleManifest *manifest.Manifest, + blobs *manifest.BlobSet, +) { + t.Helper() + ctx := context.Background() + moduleCacheDir := normalpath.Join(pin.Remote(), pin.Owner(), pin.Repository()) + // {remote}/{owner}/{repo}/manifests/{..}/{....} => should return manifest contents + moduleBlob, err := moduleManifest.Blob() + require.NoError(t, err) + verifyBlobContents(t, bucket, normalpath.Join(moduleCacheDir, blobsDir), moduleBlob) + for _, path := range moduleManifest.Paths() { + protoDigest, found := moduleManifest.DigestFor(path) + require.True(t, found) + protoBlob, found := blobs.BlobFor(protoDigest.String()) + require.True(t, found) + // {remote}/{owner}/{repo}/blobs/{..}/{....} => should return proto blob contents + verifyBlobContents(t, bucket, normalpath.Join(moduleCacheDir, blobsDir), protoBlob) + } + f, err := bucket.Get(ctx, normalpath.Join(moduleCacheDir, commitsDir, pin.Commit())) + require.NoError(t, err) + defer f.Close() + commitContents, err := io.ReadAll(f) + require.NoError(t, err) + // {remote}/{owner}/{repo}/commits/{commit} => should return digest string format + assert.Equal(t, []byte(moduleBlob.Digest().String()), commitContents) +} + +func createSampleManifestAndBlobs(t *testing.T) (*manifest.Manifest, *manifest.BlobSet) { + t.Helper() + blob, err := manifest.NewMemoryBlobFromReader(strings.NewReader(pingProto)) + require.NoError(t, err) + var moduleManifest manifest.Manifest + err = moduleManifest.AddEntry("connect/ping/v1/ping.proto", *blob.Digest()) + require.NoError(t, err) + blobSet, err := manifest.NewBlobSet(context.Background(), []manifest.Blob{blob}) + require.NoError(t, err) + return &moduleManifest, blobSet +} + +func verifyBlobContents(t *testing.T, bucket storage.ReadWriteBucket, basedir string, blob manifest.Blob) { + t.Helper() + moduleHexDigest := blob.Digest().Hex() + r, err := blob.Open(context.Background()) + require.NoError(t, err) + var bb bytes.Buffer + _, err = io.Copy(&bb, r) + require.NoError(t, err) + f, err := bucket.Get(context.Background(), normalpath.Join(basedir, moduleHexDigest[:2], moduleHexDigest[2:])) + require.NoError(t, err) + defer f.Close() + cachedModule, err := io.ReadAll(f) + require.NoError(t, err) + assert.Equal(t, bb.Bytes(), cachedModule) +} + +func assertModuleIdentity(t *testing.T, module bufmodule.Module, expectedModuleIdentity string, expectedCommit string) { + require.NotNil(t, module) + require.NotEmpty(t, expectedCommit) + fileInfos, err := module.SourceFileInfos(context.Background()) + require.NoError(t, err) + for _, fileInfo := range fileInfos { + require.NotNil(t, fileInfo.ModuleIdentity()) + assert.Equalf( + t, expectedModuleIdentity, fileInfo.ModuleIdentity().IdentityString(), + "unexpected module identity for file %q", fileInfo.Path(), + ) + assert.Equalf( + t, expectedCommit, fileInfo.Commit(), + "unexpected commit for file %q", fileInfo.Path(), + ) + } +} + +type testModuleReader struct { + module bufmodule.Module +} + +var _ bufmodule.ModuleReader = (*testModuleReader)(nil) + +func (t *testModuleReader) GetModule(_ context.Context, _ bufmoduleref.ModulePin) (bufmodule.Module, error) { + return t.module, nil +} + +type testRepositoryServiceClient struct { + registryv1alpha1connect.UnimplementedRepositoryServiceHandler +} + +var _ registryv1alpha1connect.RepositoryServiceClient = (*testRepositoryServiceClient)(nil) + +func (t *testRepositoryServiceClient) GetRepositoryByFullName( + _ context.Context, + _ *connect.Request[registryv1alpha1.GetRepositoryByFullNameRequest], +) (*connect.Response[registryv1alpha1.GetRepositoryByFullNameResponse], error) { + return connect.NewResponse(®istryv1alpha1.GetRepositoryByFullNameResponse{ + Repository: ®istryv1alpha1.Repository{}, + }), nil +} + +type testVerbosePrinter struct { + t *testing.T +} + +var _ verbose.Printer = (*testVerbosePrinter)(nil) + +func (t testVerbosePrinter) Printf(format string, args ...interface{}) { + t.t.Logf(format, args...) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go new file mode 100644 index 000000000..7eb8c7333 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulecache + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "go.uber.org/zap" +) + +// warnIfDeprecated emits a warning message to logger if the repository +// is deprecated on the BSR. +func warnIfDeprecated( + ctx context.Context, + clientFactory RepositoryServiceClientFactory, + modulePin bufmoduleref.ModulePin, + logger *zap.Logger, +) error { + repositoryService := clientFactory(modulePin.Remote()) + resp, err := repositoryService.GetRepositoryByFullName( + ctx, + connect.NewRequest(®istryv1alpha1.GetRepositoryByFullNameRequest{ + FullName: fmt.Sprintf("%s/%s", modulePin.Owner(), modulePin.Repository()), + }), + ) + if err != nil { + return err + } + repository := resp.Msg.Repository + if repository.Deprecated { + warnMsg := fmt.Sprintf(`Repository "%s" is deprecated`, modulePin.IdentityString()) + if repository.DeprecationMessage != "" { + warnMsg = fmt.Sprintf("%s: %s", warnMsg, repository.DeprecationMessage) + } + logger.Sugar().Warn(warnMsg) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/bufmoduleconfig.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/bufmoduleconfig.go new file mode 100644 index 000000000..52448213c --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/bufmoduleconfig.go @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleconfig + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + +// Config is a configuration for build. +type Config struct { + // RootToExcludes contains a map from root to the excludes for that root. + // + // Roots are the root directories within a bucket to search for Protobuf files. + // + // There will be no between the roots, ie foo/bar and foo are not allowed. + // All Protobuf files must be unique relative to the roots, ie if foo and bar + // are roots, then foo/baz.proto and bar/baz.proto are not allowed. + // + // All roots will be normalized and validated. + // + // Excludes are the directories within a bucket to exclude. + // + // There should be no overlap between the excludes, ie foo/bar and foo are not allowed. + // + // All excludes must reside within a root, but none will be equal to a root. + // All excludes will be normalized and validated. + // The excludes in this map will be relative to the root they map to! + // + // If RootToExcludes is empty, the default is "." with no excludes. + RootToExcludes map[string][]string + DependencyModuleReferences []bufmoduleref.ModuleReference +} + +// NewConfigV1Beta1 returns a new, validated Config for the ExternalConfig. +func NewConfigV1Beta1(externalConfig ExternalConfigV1Beta1, deps ...string) (*Config, error) { + return newConfigV1Beta1(externalConfig, deps...) +} + +// NewConfigV1 returns a new, validated Config for the ExternalConfig. +func NewConfigV1(externalConfig ExternalConfigV1, deps ...string) (*Config, error) { + return newConfigV1(externalConfig, deps...) +} + +// ExternalConfigV1Beta1 is an external config. +type ExternalConfigV1Beta1 struct { + Roots []string `json:"roots,omitempty" yaml:"roots,omitempty"` + Excludes []string `json:"excludes,omitempty" yaml:"excludes,omitempty"` +} + +// ExternalConfigV1 is an external config. +type ExternalConfigV1 struct { + Excludes []string `json:"excludes,omitempty" yaml:"excludes,omitempty"` +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/config.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/config.go new file mode 100644 index 000000000..546907bf5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/config.go @@ -0,0 +1,162 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleconfig + +import ( + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +func newConfigV1Beta1(externalConfig ExternalConfigV1Beta1, deps ...string) (*Config, error) { + dependencyModuleReferences, err := parseDependencyModuleReferences(deps...) + if err != nil { + return nil, err + } + + rootToExcludes := make(map[string][]string) + + roots := externalConfig.Roots + // not yet relative to roots + fullExcludes := externalConfig.Excludes + + if len(roots) == 0 { + roots = []string{"."} + } + roots, err = internal.NormalizeAndCheckPaths(roots, "root", normalpath.Relative, true) + if err != nil { + return nil, err + } + for _, root := range roots { + // we already checked duplicates, but just in case + if _, ok := rootToExcludes[root]; ok { + return nil, fmt.Errorf("unexpected duplicate root: %q", root) + } + rootToExcludes[root] = make([]string, 0) + } + + if len(fullExcludes) == 0 { + return &Config{ + RootToExcludes: rootToExcludes, + DependencyModuleReferences: dependencyModuleReferences, + }, nil + } + + // this also verifies that fullExcludes is unique + fullExcludes, err = internal.NormalizeAndCheckPaths(fullExcludes, "exclude", normalpath.Relative, true) + if err != nil { + return nil, err + } + + // verify that no exclude equals a root directly and only directories are specified + for _, fullExclude := range fullExcludes { + if normalpath.Ext(fullExclude) == ".proto" { + return nil, fmt.Errorf("excludes can only be directories but file %s discovered", fullExclude) + } + if _, ok := rootToExcludes[fullExclude]; ok { + return nil, fmt.Errorf("%s is both a root and exclude, which means the entire root is excluded, which is not valid", fullExclude) + } + } + + // verify that all excludes are within a root + rootMap := stringutil.SliceToMap(roots) + for _, fullExclude := range fullExcludes { + switch matchingRoots := normalpath.MapAllEqualOrContainingPaths(rootMap, fullExclude, normalpath.Relative); len(matchingRoots) { + case 0: + return nil, fmt.Errorf("exclude %s is not contained in any root, which is not valid", fullExclude) + case 1: + root := matchingRoots[0] + exclude, err := normalpath.Rel(root, fullExclude) + if err != nil { + return nil, err + } + // just in case + exclude, err = normalpath.NormalizeAndValidate(exclude) + if err != nil { + return nil, err + } + rootToExcludes[root] = append(rootToExcludes[root], exclude) + default: + // this should never happen, but just in case + return nil, fmt.Errorf("exclude %q was in multiple roots %v (system error)", fullExclude, matchingRoots) + } + } + + for root, excludes := range rootToExcludes { + uniqueSortedExcludes := stringutil.SliceToUniqueSortedSliceFilterEmptyStrings(excludes) + if len(excludes) != len(uniqueSortedExcludes) { + // this should never happen, but just in case + return nil, fmt.Errorf("excludes %v are not unique (system error)", excludes) + } + rootToExcludes[root] = uniqueSortedExcludes + } + return &Config{ + RootToExcludes: rootToExcludes, + DependencyModuleReferences: dependencyModuleReferences, + }, nil +} + +func newConfigV1(externalConfig ExternalConfigV1, deps ...string) (*Config, error) { + dependencyModuleReferences, err := parseDependencyModuleReferences(deps...) + if err != nil { + return nil, err + } + // this also verifies that the excludes are unique, normalized, and validated + excludes, err := internal.NormalizeAndCheckPaths(externalConfig.Excludes, "exclude", normalpath.Relative, true) + if err != nil { + return nil, err + } + for _, exclude := range excludes { + if normalpath.Ext(exclude) == ".proto" { + return nil, fmt.Errorf("excludes can only be directories but file %s discovered", exclude) + } + } + uniqueSortedExcludes := stringutil.SliceToUniqueSortedSliceFilterEmptyStrings(excludes) + if len(excludes) != len(uniqueSortedExcludes) { + // this should never happen, but just in case + return nil, fmt.Errorf("excludes %v are not unique (system error)", excludes) + } + rootToExcludes := map[string][]string{ + ".": excludes, // all excludes are relative to the root + } + return &Config{ + RootToExcludes: rootToExcludes, + DependencyModuleReferences: dependencyModuleReferences, + }, nil +} + +func parseDependencyModuleReferences(deps ...string) ([]bufmoduleref.ModuleReference, error) { + if len(deps) == 0 { + return nil, nil + } + moduleReferences := make([]bufmoduleref.ModuleReference, 0, len(deps)) + for _, dep := range deps { + dep := strings.TrimSpace(dep) + moduleReference, err := bufmoduleref.ModuleReferenceForString(dep) + if err != nil { + return nil, err + } + moduleReferences = append(moduleReferences, moduleReference) + } + if err := bufmoduleref.ValidateModuleReferencesUniqueByIdentity(moduleReferences); err != nil { + return nil, err + } + return moduleReferences, nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/config_test.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/config_test.go new file mode 100644 index 000000000..35274f502 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig/config_test.go @@ -0,0 +1,449 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleconfig_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestNewConfigV1Beta1Success1(t *testing.T) { + // https://github.com/ProtobufMan/bufman-cli/issues/56 + t.Parallel() + testNewConfigV1Beta1Success( + t, + []string{ + "proto", + "proto-vendor", + }, + []string{}, + []string{}, + ) +} + +func TestNewConfigV1Beta1Error1(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + "/a/b", + }, + []string{}, + []string{}, + ) +} + +func TestNewConfigV1Beta1Error2(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{}, + []string{ + "/a/b", + }, + []string{}, + ) +} + +func TestNewConfigV1Beta1Error3(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + "a/b", + "a/b", + }, + []string{}, + []string{}, + ) +} + +func TestNewConfigV1Beta1Error4(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + "a/b", + "a/b/c", + }, + []string{}, + []string{}, + ) +} + +func TestNewConfigV1Beta1Error5(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + "a/b", + }, + []string{ + "a/c", + }, + []string{}, + ) +} + +func TestNewConfigV1Beta1Error6(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + ".", + "a", + }, + []string{}, + []string{}, + ) +} + +func TestNewConfigV1Beta1Error7(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + "proto", + }, + []string{ + "proto/a/c", + // error since not a directory + "proto/d/1.proto", + }, + []string{}, + ) +} + +func TestNewConfigV1Beta1Error8(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + "proto", + }, + []string{}, + []string{ + // Duplicate dependency + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBarV2String, + }, + ) +} + +func TestNewConfigV1Beta1Error9(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + "proto", + }, + []string{}, + []string{ + // Duplicate dependency + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBarCommitString, + }, + ) +} + +func TestNewConfigV1Beta1Error10(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Error( + t, + []string{ + "proto", + }, + []string{}, + []string{ + // Duplicate dependency + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBarV1String, + }, + ) +} + +func TestNewConfigV1Beta1Equal1(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Equal( + t, + []string{ + "a", + "b", + }, + []string{ + "a/foob", + }, + []string{ + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBazCommitString, + }, + &bufmoduleconfig.Config{ + RootToExcludes: map[string][]string{ + "a": { + "foob", + }, + "b": {}, + }, + DependencyModuleReferences: testParseDependencyModuleReferences( + t, + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBazCommitString, + ), + }, + ) +} + +func TestNewConfigV1Beta1Equal2(t *testing.T) { + t.Parallel() + testNewConfigV1Beta1Equal( + t, + []string{ + "a", + "b", + }, + []string{ + "a/foob", + "b/foob", + "b/barr", + }, + []string{}, + &bufmoduleconfig.Config{ + RootToExcludes: map[string][]string{ + "a": { + "foob", + }, + "b": { + "barr", + "foob", + }, + }, + }, + ) +} + +func TestNewConfigV1Success1(t *testing.T) { + // https://github.com/ProtobufMan/bufman-cli/issues/56 + t.Parallel() + testNewConfigV1Success( + t, + []string{ + "a", + "b", + }, + []string{}, + ) +} + +func TestNewConfigV1Error1(t *testing.T) { + t.Parallel() + testNewConfigV1Error( + t, + []string{ + "/a/b", + }, + []string{}, + ) +} + +func TestNewConfigV1Error2(t *testing.T) { + t.Parallel() + testNewConfigV1Error( + t, + []string{ + "a/b", + "a/b/c", + }, + []string{}, + ) +} + +func TestNewConfigV1Error3(t *testing.T) { + t.Parallel() + testNewConfigV1Error( + t, + []string{ + ".", + "a", + }, + []string{}, + ) +} + +func TestNewConfigV1Error4(t *testing.T) { + t.Parallel() + testNewConfigV1Error( + t, + []string{ + "proto/a/c", + // error since not a directory + "proto/d/1.proto", + }, + []string{}, + ) +} + +func TestNewConfigV1Error5(t *testing.T) { + t.Parallel() + testNewConfigV1Error( + t, + []string{}, + []string{ + // Duplicate dependency + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBarV2String, + }, + ) +} + +func TestNewConfigV1Error6(t *testing.T) { + t.Parallel() + testNewConfigV1Error( + t, + []string{}, + []string{ + // Duplicate dependency + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBarCommitString, + }, + ) +} + +func TestNewConfigV1Error7(t *testing.T) { + t.Parallel() + testNewConfigV1Error( + t, + []string{}, + []string{ + // Duplicate dependency + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBarV1String, + }, + ) +} + +func TestNewConfigV1Equal1(t *testing.T) { + t.Parallel() + testNewConfigV1Equal( + t, + []string{ + "a/foob", + }, + []string{ + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBazCommitString, + }, + &bufmoduleconfig.Config{ + RootToExcludes: map[string][]string{ + ".": { + "a/foob", + }, + }, + DependencyModuleReferences: testParseDependencyModuleReferences( + t, + bufmoduletesting.TestModuleReferenceFooBarV1String, + bufmoduletesting.TestModuleReferenceFooBazCommitString, + ), + }, + ) +} + +func TestNewConfigV1Equal2(t *testing.T) { + t.Parallel() + testNewConfigV1Equal( + t, + []string{ + "a/foob", + "b/foob", + "b/barr", + }, + []string{}, + &bufmoduleconfig.Config{ + RootToExcludes: map[string][]string{ + ".": { + "a/foob", + "b/barr", + "b/foob", + }, + }, + }, + ) +} + +func testNewConfigV1Beta1Success(t *testing.T, roots []string, excludes []string, deps []string) { + _, err := bufmoduleconfig.NewConfigV1Beta1(bufmoduleconfig.ExternalConfigV1Beta1{Roots: roots, Excludes: excludes}, deps...) + assert.NoError(t, err, fmt.Sprintf("%v %v %v", roots, excludes, deps)) +} + +func testNewConfigV1Beta1Error(t *testing.T, roots []string, excludes []string, deps []string) { + _, err := bufmoduleconfig.NewConfigV1Beta1(bufmoduleconfig.ExternalConfigV1Beta1{Roots: roots, Excludes: excludes}, deps...) + assert.Error(t, err, fmt.Sprintf("%v %v %v", roots, excludes, deps)) +} + +func testNewConfigV1Beta1Equal( + t *testing.T, + roots []string, + excludes []string, + deps []string, + expectedConfig *bufmoduleconfig.Config, +) { + config, err := bufmoduleconfig.NewConfigV1Beta1(bufmoduleconfig.ExternalConfigV1Beta1{Roots: roots, Excludes: excludes}, deps...) + assert.NoError(t, err, fmt.Sprintf("%v %v %v", roots, excludes, deps)) + assert.Equal(t, expectedConfig, config) +} + +func testNewConfigV1Success(t *testing.T, excludes []string, deps []string) { + _, err := bufmoduleconfig.NewConfigV1(bufmoduleconfig.ExternalConfigV1{Excludes: excludes}, deps...) + assert.NoError(t, err, fmt.Sprintf("%v %v", excludes, deps)) +} + +func testNewConfigV1Error(t *testing.T, excludes []string, deps []string) { + _, err := bufmoduleconfig.NewConfigV1(bufmoduleconfig.ExternalConfigV1{Excludes: excludes}, deps...) + assert.Error(t, err, fmt.Sprintf("%v %v", excludes, deps)) +} + +func testNewConfigV1Equal( + t *testing.T, + excludes []string, + deps []string, + expectedConfig *bufmoduleconfig.Config, +) { + config, err := bufmoduleconfig.NewConfigV1(bufmoduleconfig.ExternalConfigV1{Excludes: excludes}, deps...) + assert.NoError(t, err, fmt.Sprintf("%v %v", excludes, deps)) + assert.Equal(t, expectedConfig, config) +} + +func testParseDependencyModuleReferences(t *testing.T, deps ...string) []bufmoduleref.ModuleReference { + if len(deps) == 0 { + return nil + } + moduleReferences := make([]bufmoduleref.ModuleReference, 0, len(deps)) + for _, dep := range deps { + dep := strings.TrimSpace(dep) + moduleReference, err := bufmoduleref.ModuleReferenceForString(dep) + require.NoError(t, err) + moduleReferences = append(moduleReferences, moduleReference) + } + err := bufmoduleref.ValidateModuleReferencesUniqueByIdentity(moduleReferences) + require.NoError(t, err) + return moduleReferences +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile/bufmoduleprotocompile.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile/bufmoduleprotocompile.go new file mode 100644 index 000000000..2056668ca --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile/bufmoduleprotocompile.go @@ -0,0 +1,127 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleprotocompile + +import ( + "context" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/bufbuild/protocompile/reporter" +) + +// ParserAccessorHandler handles source file access operations for protocompile. +type ParserAccessorHandler interface { + // Open opens the given path, and tracks the external path and import status. + // + // This function can be used as the accessor function for a protocompile.SourceResolver. + Open(path string) (io.ReadCloser, error) + // ExternalPath returns the external path for the input path. + // + // Returns the input path if the external path is not known. + ExternalPath(path string) string + // IsImport returns true if the path is an import. + IsImport(path string) bool + // ModuleIdentity returns nil if not available. + ModuleIdentity(path string) bufmoduleref.ModuleIdentity + // Commit returns empty if not available. + Commit(path string) string +} + +// NewParserAccessorHandler returns a new ParserAccessorHandler. +// +// TODO: make this dependent on whatever derivative getter type we create to replace ModuleFileSet. +func NewParserAccessorHandler(ctx context.Context, moduleFileSet bufmodule.ModuleFileSet) ParserAccessorHandler { + return newParserAccessorHandler(ctx, moduleFileSet) +} + +// GetFileAnnotations gets the FileAnnotations for the ErrorWithPos errors. +func GetFileAnnotations( + ctx context.Context, + parserAccessorHandler ParserAccessorHandler, + errorsWithPos []reporter.ErrorWithPos, +) ([]bufanalysis.FileAnnotation, error) { + fileAnnotations := make([]bufanalysis.FileAnnotation, 0, len(errorsWithPos)) + for _, errorWithPos := range errorsWithPos { + fileAnnotation, err := GetFileAnnotation( + ctx, + parserAccessorHandler, + errorWithPos, + ) + if err != nil { + return nil, err + } + fileAnnotations = append(fileAnnotations, fileAnnotation) + } + return fileAnnotations, nil +} + +// GetFileAnnotation gets the FileAnnotation for the ErrorWithPos error. +func GetFileAnnotation( + ctx context.Context, + parserAccessorHandler ParserAccessorHandler, + errorWithPos reporter.ErrorWithPos, +) (bufanalysis.FileAnnotation, error) { + var fileInfo bufmoduleref.FileInfo + var startLine int + var startColumn int + var endLine int + var endColumn int + typeString := "COMPILE" + message := "Compile error." + // this should never happen + // maybe we should error + if errorWithPos.Unwrap() != nil { + message = errorWithPos.Unwrap().Error() + } + sourcePos := errorWithPos.GetPosition() + if sourcePos.Filename != "" { + path, err := normalpath.NormalizeAndValidate(sourcePos.Filename) + if err != nil { + return nil, err + } + fileInfo, err = bufmoduleref.NewFileInfo( + path, + parserAccessorHandler.ExternalPath(path), + parserAccessorHandler.IsImport(path), + nil, + "", + ) + if err != nil { + return nil, err + } + } + if sourcePos.Line > 0 { + startLine = sourcePos.Line + endLine = sourcePos.Line + } + if sourcePos.Col > 0 { + startColumn = sourcePos.Col + endColumn = sourcePos.Col + } + return bufanalysis.NewFileAnnotation( + fileInfo, + startLine, + startColumn, + endLine, + endColumn, + typeString, + message, + ), nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile/path_resolver.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile/path_resolver.go new file mode 100644 index 000000000..2e92eef9a --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile/path_resolver.go @@ -0,0 +1,154 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleprotocompile + +import ( + "context" + "fmt" + "io" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/data/datawkt" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "go.uber.org/multierr" +) + +// TODO: remove when we remove ModuleFileSet +type moduleFileReader interface { + GetModuleFile(context.Context, string) (bufmodule.ModuleFile, error) +} + +type parserAccessorHandler struct { + ctx context.Context + moduleFileReader moduleFileReader + pathToExternalPath map[string]string + nonImportPaths map[string]struct{} + pathToModuleIdentity map[string]bufmoduleref.ModuleIdentity + pathToCommit map[string]string + lock sync.RWMutex +} + +func newParserAccessorHandler( + ctx context.Context, + moduleFileReader moduleFileReader, +) *parserAccessorHandler { + return &parserAccessorHandler{ + ctx: ctx, + moduleFileReader: moduleFileReader, + pathToExternalPath: make(map[string]string), + nonImportPaths: make(map[string]struct{}), + pathToModuleIdentity: make(map[string]bufmoduleref.ModuleIdentity), + pathToCommit: make(map[string]string), + } +} + +func (p *parserAccessorHandler) Open(path string) (_ io.ReadCloser, retErr error) { + moduleFile, moduleErr := p.moduleFileReader.GetModuleFile(p.ctx, path) + if moduleErr != nil { + if !storage.IsNotExist(moduleErr) { + return nil, moduleErr + } + if wktModuleFile, wktErr := datawkt.ReadBucket.Get(p.ctx, path); wktErr == nil { + if wktModuleFile.Path() != path { + // this should never happen, but just in case + return nil, fmt.Errorf("parser accessor requested path %q but got %q", path, wktModuleFile.Path()) + } + if err := p.addPath(path, path, true, nil, ""); err != nil { + return nil, err + } + return wktModuleFile, nil + } + return nil, moduleErr + } + defer func() { + if retErr != nil { + retErr = multierr.Append(retErr, moduleFile.Close()) + } + }() + if moduleFile.Path() != path { + // this should never happen, but just in case + return nil, fmt.Errorf("parser accessor requested path %q but got %q", path, moduleFile.Path()) + } + if err := p.addPath( + path, + moduleFile.ExternalPath(), + moduleFile.IsImport(), + moduleFile.ModuleIdentity(), + moduleFile.Commit(), + ); err != nil { + return nil, err + } + return moduleFile, nil +} + +func (p *parserAccessorHandler) ExternalPath(path string) string { + p.lock.RLock() + defer p.lock.RUnlock() + if externalPath := p.pathToExternalPath[path]; externalPath != "" { + return externalPath + } + return path +} + +func (p *parserAccessorHandler) IsImport(path string) bool { + p.lock.RLock() + defer p.lock.RUnlock() + _, isNotImport := p.nonImportPaths[path] + return !isNotImport +} + +func (p *parserAccessorHandler) ModuleIdentity(path string) bufmoduleref.ModuleIdentity { + p.lock.RLock() + defer p.lock.RUnlock() + return p.pathToModuleIdentity[path] // nil is a valid value. +} + +func (p *parserAccessorHandler) Commit(path string) string { + p.lock.RLock() + defer p.lock.RUnlock() + return p.pathToCommit[path] // empty is a valid value. +} + +func (p *parserAccessorHandler) addPath( + path string, + externalPath string, + isImport bool, + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, +) error { + p.lock.Lock() + defer p.lock.Unlock() + existingExternalPath, ok := p.pathToExternalPath[path] + if ok { + if existingExternalPath != externalPath { + return fmt.Errorf("parser accessor had external paths %q and %q for path %q", existingExternalPath, externalPath, path) + } + } else { + p.pathToExternalPath[path] = externalPath + } + if !isImport { + p.nonImportPaths[path] = struct{}{} + } + if moduleIdentity != nil { + p.pathToModuleIdentity[path] = moduleIdentity + } + if commit != "" { + p.pathToCommit[path] = commit + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/bufmoduleref.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/bufmoduleref.go new file mode 100644 index 000000000..77db16a4f --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/bufmoduleref.go @@ -0,0 +1,576 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "context" + "errors" + "fmt" + "sort" + "strings" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buflock" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/uuidutil" + "go.uber.org/multierr" +) + +const ( + // Main is the default reference used if no other reference is specified. + Main = "main" +) + +// FileInfo contains module file info. +type FileInfo interface { + // Path is the path of the file relative to the root it is contained within. + // This will be normalized, validated and never empty, + // This will be unique within a given Image. + Path() string + // ExternalPath returns the path that identifies this file externally. + // + // This will be unnormalized. + // Never empty. Falls back to Path if there is not an external path. + // + // Example: + // Assume we had the input path /foo/bar which is a local directory. + // Path: one/one.proto + // RootDirPath: proto + // ExternalPath: /foo/bar/proto/one/one.proto + ExternalPath() string + // IsImport returns true if this file is an import. + IsImport() bool + // ModuleIdentity is the module that this file came from. + // + // Note this *can* be nil if we did not build from a named module. + // All code must assume this can be nil. + // Note that nil checking should work since the backing type is always a pointer. + ModuleIdentity() ModuleIdentity + // Commit is the commit for the module that this file came from. + // + // This will only be set if ModuleIdentity is set, but may not be set + // even if ModuleIdentity is set, that is commit is optional information + // even if we know what module this file came from. + Commit() string + // WithIsImport returns this FileInfo with the given IsImport value. + WithIsImport(isImport bool) FileInfo + + isFileInfo() +} + +// NewFileInfo returns a new FileInfo. +// +// TODO: we should make moduleIdentity and commit options. +// TODO: we don't validate commit +func NewFileInfo( + path string, + externalPath string, + isImport bool, + moduleIdentity ModuleIdentity, + commit string, +) (FileInfo, error) { + return newFileInfo( + path, + externalPath, + isImport, + moduleIdentity, + commit, + ) +} + +// ModuleOwner is a module owner. +// +// It just contains remote, owner. +// +// This is shared by ModuleIdentity. +type ModuleOwner interface { + Remote() string + Owner() string + + isModuleOwner() +} + +// NewModuleOwner returns a new ModuleOwner. +func NewModuleOwner( + remote string, + owner string, +) (ModuleOwner, error) { + return newModuleOwner(remote, owner) +} + +// ModuleOwnerForString returns a new ModuleOwner for the given string. +// +// This parses the path in the form remote/owner. +func ModuleOwnerForString(path string) (ModuleOwner, error) { + slashSplit := strings.Split(path, "/") + if len(slashSplit) != 2 { + return nil, newInvalidModuleOwnerStringError(path) + } + remote := strings.TrimSpace(slashSplit[0]) + if remote == "" { + return nil, newInvalidModuleIdentityStringError(path) + } + owner := strings.TrimSpace(slashSplit[1]) + if owner == "" { + return nil, newInvalidModuleIdentityStringError(path) + } + return NewModuleOwner(remote, owner) +} + +// ModuleIdentity is a module identity. +// +// It just contains remote, owner, repository. +// +// This is shared by ModuleReference and ModulePin. +type ModuleIdentity interface { + ModuleOwner + + Repository() string + + // IdentityString is the string remote/owner/repository. + IdentityString() string + + isModuleIdentity() +} + +// NewModuleIdentity returns a new ModuleIdentity. +func NewModuleIdentity( + remote string, + owner string, + repository string, +) (ModuleIdentity, error) { + return newModuleIdentity(remote, owner, repository) +} + +// ModuleIdentityForString returns a new ModuleIdentity for the given string. +// +// This parses the path in the form remote/owner/repository +// +// TODO: we may want to add a special error if we detect / or @ as this may be a common mistake. +func ModuleIdentityForString(path string) (ModuleIdentity, error) { + remote, owner, repository, err := parseModuleIdentityComponents(path) + if err != nil { + return nil, err + } + return NewModuleIdentity(remote, owner, repository) +} + +// ModuleReference is a module reference. +// +// It references either a branch, tag, or a commit. +// Note that since commits belong to branches, we can deduce +// the branch from the commit when resolving. +type ModuleReference interface { + ModuleIdentity + + // Prints either remote/owner/repository:{branch,commit} + // If the reference is equal to MainBranch, prints remote/owner/repository. + fmt.Stringer + + // Either branch, tag, or commit + Reference() string + + isModuleReference() +} + +// NewModuleReference returns a new validated ModuleReference. +func NewModuleReference( + remote string, + owner string, + repository string, + reference string, +) (ModuleReference, error) { + return newModuleReference(remote, owner, repository, reference) +} + +// NewModuleReferenceForProto returns a new ModuleReference for the given proto ModuleReference. +func NewModuleReferenceForProto(protoModuleReference *modulev1alpha1.ModuleReference) (ModuleReference, error) { + return newModuleReferenceForProto(protoModuleReference) +} + +// NewModuleReferencesForProtos maps the Protobuf equivalent into the internal representation. +func NewModuleReferencesForProtos(protoModuleReferences ...*modulev1alpha1.ModuleReference) ([]ModuleReference, error) { + if len(protoModuleReferences) == 0 { + return nil, nil + } + moduleReferences := make([]ModuleReference, len(protoModuleReferences)) + for i, protoModuleReference := range protoModuleReferences { + moduleReference, err := NewModuleReferenceForProto(protoModuleReference) + if err != nil { + return nil, err + } + moduleReferences[i] = moduleReference + } + return moduleReferences, nil +} + +// NewProtoModuleReferenceForModuleReference returns a new proto ModuleReference for the given ModuleReference. +func NewProtoModuleReferenceForModuleReference(moduleReference ModuleReference) *modulev1alpha1.ModuleReference { + return newProtoModuleReferenceForModuleReference(moduleReference) +} + +// NewProtoModuleReferencesForModuleReferences maps the given module references into the protobuf representation. +func NewProtoModuleReferencesForModuleReferences(moduleReferences ...ModuleReference) []*modulev1alpha1.ModuleReference { + if len(moduleReferences) == 0 { + return nil + } + protoModuleReferences := make([]*modulev1alpha1.ModuleReference, len(moduleReferences)) + for i, moduleReference := range moduleReferences { + protoModuleReferences[i] = NewProtoModuleReferenceForModuleReference(moduleReference) + } + return protoModuleReferences +} + +// ModuleReferenceForString returns a new ModuleReference for the given string. +// If a branch, commit, draft, or tag is not provided, the "main" branch is used. +// +// This parses the path in the form remote/owner/repository{:branch,:commit,:draft,:tag}. +func ModuleReferenceForString(path string) (ModuleReference, error) { + remote, owner, repository, reference, err := parseModuleReferenceComponents(path) + if err != nil { + return nil, err + } + if reference == "" { + // Default to the main branch if a ':' separator was not specified. + reference = Main + } + return NewModuleReference(remote, owner, repository, reference) +} + +// IsCommitModuleReference returns true if the ModuleReference references a commit. +// +// If false, this means the ModuleReference references a branch or tag. +// Branch and tag disambiguation needs to be done server-side. +func IsCommitModuleReference(moduleReference ModuleReference) bool { + return IsCommitReference(moduleReference.Reference()) +} + +// IsCommitReference returns whether the provided reference is a commit. +func IsCommitReference(reference string) bool { + _, err := uuidutil.FromDashless(reference) + return err == nil +} + +// ModulePin is a module pin. +// +// It references a specific point in time of a Module. +// +// Note that a commit does this itself, but we want all this information. +// This is what is stored in a buf.lock file. +type ModulePin interface { + ModuleIdentity + + // Prints remote/owner/repository:commit, which matches ModuleReference + fmt.Stringer + + // all of these will be set + Branch() string + Commit() string + Digest() string + CreateTime() time.Time + + isModulePin() +} + +// NewModulePin returns a new validated ModulePin. +func NewModulePin( + remote string, + owner string, + repository string, + branch string, + commit string, + digest string, + createTime time.Time, +) (ModulePin, error) { + return newModulePin(remote, owner, repository, branch, commit, digest, createTime) +} + +// NewModulePinForProto returns a new ModulePin for the given proto ModulePin. +func NewModulePinForProto(protoModulePin *modulev1alpha1.ModulePin) (ModulePin, error) { + return newModulePinForProto(protoModulePin) +} + +// NewModulePinsForProtos maps the Protobuf equivalent into the internal representation. +func NewModulePinsForProtos(protoModulePins ...*modulev1alpha1.ModulePin) ([]ModulePin, error) { + if len(protoModulePins) == 0 { + return nil, nil + } + modulePins := make([]ModulePin, len(protoModulePins)) + for i, protoModulePin := range protoModulePins { + modulePin, err := NewModulePinForProto(protoModulePin) + if err != nil { + return nil, err + } + modulePins[i] = modulePin + } + return modulePins, nil +} + +// NewProtoModulePinForModulePin returns a new proto ModulePin for the given ModulePin. +func NewProtoModulePinForModulePin(modulePin ModulePin) *modulev1alpha1.ModulePin { + return newProtoModulePinForModulePin(modulePin) +} + +// NewProtoModulePinsForModulePins maps the given module pins into the protobuf representation. +func NewProtoModulePinsForModulePins(modulePins ...ModulePin) []*modulev1alpha1.ModulePin { + if len(modulePins) == 0 { + return nil + } + protoModulePins := make([]*modulev1alpha1.ModulePin, len(modulePins)) + for i, modulePin := range modulePins { + protoModulePins[i] = NewProtoModulePinForModulePin(modulePin) + } + return protoModulePins +} + +// ValidateModuleReferencesUniqueByIdentity returns an error if the module references contain any duplicates. +// +// This only checks remote, owner, repository. +func ValidateModuleReferencesUniqueByIdentity(moduleReferences []ModuleReference) error { + seenModuleReferences := make(map[string]struct{}) + for _, moduleReference := range moduleReferences { + moduleIdentityString := moduleReference.IdentityString() + if _, ok := seenModuleReferences[moduleIdentityString]; ok { + return fmt.Errorf("module %s appeared twice", moduleIdentityString) + } + seenModuleReferences[moduleIdentityString] = struct{}{} + } + return nil +} + +// ValidateModulePinsUniqueByIdentity returns an error if the module pins contain any duplicates. +// +// This only checks remote, owner, repository. +func ValidateModulePinsUniqueByIdentity(modulePins []ModulePin) error { + seenModulePins := make(map[string]struct{}) + for _, modulePin := range modulePins { + moduleIdentityString := modulePin.IdentityString() + if _, ok := seenModulePins[moduleIdentityString]; ok { + return fmt.Errorf("module %s appeared twice", moduleIdentityString) + } + seenModulePins[moduleIdentityString] = struct{}{} + } + return nil +} + +// ValidateModulePinsConsistentDigests verifies that module pins to the same commit don't change digests. +// This is important to avoid MITM issues, where the module digest stored in a buf.lock file doesn't match +// the module pin returned from the BSR. +// Returns an error that fulfills IsDigestChanged if any valid digest changed from the buf.lock file for +// the same dependency commit. +func ValidateModulePinsConsistentDigests( + ctx context.Context, + bucket storage.ReadBucket, + modulePins []ModulePin, +) error { + currentConfig, err := buflock.ReadConfig(ctx, bucket) + if err != nil { + if storage.IsNotExist(err) { + return nil + } + return err + } + if len(currentConfig.Dependencies) == 0 { + return nil + } + currentIdentityAndCommitToDigest := make(map[string]string, len(currentConfig.Dependencies)) + for _, dep := range currentConfig.Dependencies { + // Ignore dependencies with no digest + if dep.Digest == "" { + continue + } + // Ignore dependencies with an invalid digest. + // We want to replace these with a valid digest. + if _, err := manifest.NewDigestFromString(dep.Digest); err != nil { + continue + } + key := fmt.Sprintf("%s/%s/%s:%s", dep.Remote, dep.Owner, dep.Repository, dep.Commit) + currentIdentityAndCommitToDigest[key] = dep.Digest + } + var changedErrors error + for _, pin := range modulePins { + if pin.Digest() == "" { + continue + } + if currentDigest, ok := currentIdentityAndCommitToDigest[pin.String()]; ok && currentDigest != pin.Digest() { + changedErrors = multierr.Append(changedErrors, &digestChangedError{ + currentDigest: currentDigest, + updatedPin: pin, + }) + } + } + return changedErrors +} + +// ModuleReferenceEqual returns true if a equals b. +func ModuleReferenceEqual(a ModuleReference, b ModuleReference) bool { + if (a == nil) != (b == nil) { + return false + } + if a == nil { + return true + } + return a.Remote() == b.Remote() && + a.Owner() == b.Owner() && + a.Repository() == b.Repository() && + a.Reference() == b.Reference() +} + +// ModulePinEqual returns true if a equals b. +func ModulePinEqual(a ModulePin, b ModulePin) bool { + if (a == nil) != (b == nil) { + return false + } + if a == nil { + return true + } + return a.Remote() == b.Remote() && + a.Owner() == b.Owner() && + a.Repository() == b.Repository() && + a.Branch() == b.Branch() && + a.Commit() == b.Commit() && + a.Digest() == b.Digest() && + a.CreateTime().Equal(b.CreateTime()) +} + +// DependencyModulePinsForBucket reads the module dependencies from the lock file in the bucket. +func DependencyModulePinsForBucket( + ctx context.Context, + readBucket storage.ReadBucket, +) ([]ModulePin, error) { + lockFile, err := buflock.ReadConfig(ctx, readBucket) + if err != nil { + return nil, fmt.Errorf("failed to read lock file: %w", err) + } + modulePins := make([]ModulePin, 0, len(lockFile.Dependencies)) + for _, dep := range lockFile.Dependencies { + modulePin, err := NewModulePin( + dep.Remote, + dep.Owner, + dep.Repository, + "", + dep.Commit, + dep.Digest, + time.Time{}, + ) + if err != nil { + return nil, err + } + modulePins = append(modulePins, modulePin) + } + // just to be safe + SortModulePins(modulePins) + if err := ValidateModulePinsUniqueByIdentity(modulePins); err != nil { + return nil, err + } + return modulePins, nil +} + +// PutDependencyModulePinsToBucket writes the module dependencies to the write bucket in the form of a lock file. +func PutDependencyModulePinsToBucket( + ctx context.Context, + writeBucket storage.WriteBucket, + modulePins []ModulePin, +) error { + if err := ValidateModulePinsUniqueByIdentity(modulePins); err != nil { + return err + } + SortModulePins(modulePins) + lockFile := &buflock.Config{ + Dependencies: make([]buflock.Dependency, 0, len(modulePins)), + } + for _, pin := range modulePins { + lockFile.Dependencies = append( + lockFile.Dependencies, + buflock.Dependency{ + Remote: pin.Remote(), + Owner: pin.Owner(), + Repository: pin.Repository(), + Commit: pin.Commit(), + Digest: pin.Digest(), + }, + ) + } + return buflock.WriteConfig(ctx, writeBucket, lockFile) +} + +// SortFileInfos sorts the FileInfos by Path. +// +// This should be treated as the default sorting mechanism. +func SortFileInfos(fileInfos []FileInfo) { + if len(fileInfos) == 0 { + return + } + sort.Slice( + fileInfos, + func(i int, j int) bool { + return fileInfos[i].Path() < fileInfos[j].Path() + }, + ) +} + +// SortFileInfosByExternalPath sorts the FileInfos by ExternalPath. +func SortFileInfosByExternalPath(fileInfos []FileInfo) { + if len(fileInfos) == 0 { + return + } + sort.Slice( + fileInfos, + func(i int, j int) bool { + return fileInfos[i].ExternalPath() < fileInfos[j].ExternalPath() + }, + ) +} + +// SortModuleReferences sorts the ModuleReferences lexicographically by their identity. +func SortModuleReferences(references []ModuleReference) { + sort.Slice(references, func(i, j int) bool { + return references[i].IdentityString() < references[j].IdentityString() + }) +} + +// SortModulePins sorts the ModulePins. +func SortModulePins(modulePins []ModulePin) { + sort.Slice(modulePins, func(i, j int) bool { + return modulePinLess(modulePins[i], modulePins[j]) + }) +} + +// IsDigestChanged returns true if the error indicates an unexpected digest change. +func IsDigestChanged(err error) bool { + var errDigestChanged *digestChangedError + return errors.As(err, &errDigestChanged) +} + +// digestChangedError is returned if module pin digests have changed unexpectedly. +type digestChangedError struct { + // currentDigest is the digest found in the buf.lock file. + currentDigest string + // updatedPin is a module pin with a different digest than currentDigest for the same commit. + updatedPin ModulePin +} + +func (e *digestChangedError) Error() string { + return fmt.Sprintf( + "module %s commit %q returned an unexpected digest: local buf.lock=%q, remote=%q", + e.updatedPin.IdentityString(), + e.updatedPin.Commit(), + e.currentDigest, + e.updatedPin.Digest(), + ) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/bufmoduleref_test.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/bufmoduleref_test.go new file mode 100644 index 000000000..9b6b19e02 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/bufmoduleref_test.go @@ -0,0 +1,258 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "bytes" + "context" + "io" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buflock" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestPutDependencyModulePinsToBucket(t *testing.T) { + t.Parallel() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + nullDigest, err := digester.Digest(&bytes.Buffer{}) + require.NoError(t, err) + const lockV1Header = buflock.Header + "version: v1\n" + testPutDependencyModulePinsToBucket( + t, + "no pins", + []ModulePin{}, + lockV1Header, + ) + testPutDependencyModulePinsToBucket( + t, + "one pin", + []ModulePin{ + pin(t, "repository"), + }, + lockV1Header+deps( + t, + buflock.ExternalConfigDependencyV1{ + Remote: "remote", + Owner: "owner", + Repository: "repository", + Commit: "commit", + Digest: nullDigest.String(), + }, + ), + ) + testPutDependencyModulePinsToBucket( + t, + "two pins", + []ModulePin{ + pin(t, "repo-a"), + pin(t, "repo-b"), + }, + lockV1Header+deps( + t, + buflock.ExternalConfigDependencyV1{ + Remote: "remote", + Owner: "owner", + Repository: "repo-a", + Commit: "commit", + Digest: nullDigest.String(), + }, + buflock.ExternalConfigDependencyV1{ + Remote: "remote", + Owner: "owner", + Repository: "repo-b", + Commit: "commit", + Digest: nullDigest.String(), + }, + ), + ) +} + +func TestDependencyModulePinsForBucket(t *testing.T) { + t.Parallel() + testDependencyModulePinsForBucket( + t, + "no pins", + []ModulePin{}, + ) + testDependencyModulePinsForBucket( + t, + "one pin", + []ModulePin{ + pin(t, "repo"), + }, + ) + testDependencyModulePinsForBucket( + t, + "two pins", + []ModulePin{ + pin(t, "repo-a"), + pin(t, "repo-b"), + }, + ) +} + +func TestValidateModulePinsConsistentDigests(t *testing.T) { + t.Parallel() + ctx := context.Background() + modulePin := pin(t, "repo") + bucket := bucketWithBufLock(t, modulePin) + // Pin matches all fields + require.NoError(t, ValidateModulePinsConsistentDigests(ctx, bucket, []ModulePin{modulePin})) + // Change digest and nothing else + modulePinChangedDigest, err := NewModulePin( + modulePin.Remote(), + modulePin.Owner(), + modulePin.Repository(), + modulePin.Branch(), + modulePin.Commit(), + createDigest(t, []byte("abc")), + modulePin.CreateTime(), + ) + require.NoError(t, err) + err = ValidateModulePinsConsistentDigests(ctx, bucket, []ModulePin{modulePinChangedDigest}) + assert.True(t, IsDigestChanged(err)) + // Change commit and digest - this is ok + modulePinChangedCommitAndDigest, err := NewModulePin( + modulePin.Remote(), + modulePin.Owner(), + modulePin.Repository(), + modulePin.Branch(), + "updatedcommit", + createDigest(t, []byte("abc")), + modulePin.CreateTime(), + ) + require.NoError(t, err) + require.NoError(t, ValidateModulePinsConsistentDigests(ctx, bucket, []ModulePin{modulePinChangedCommitAndDigest})) +} + +func bucketWithBufLock(t *testing.T, pin ModulePin) storage.ReadWriteBucket { + t.Helper() + bufLock := &buflock.Config{ + Dependencies: []buflock.Dependency{ + { + Remote: pin.Remote(), + Owner: pin.Owner(), + Repository: pin.Repository(), + Commit: pin.Commit(), + Digest: pin.Digest(), + }, + }, + } + bucket := storagemem.NewReadWriteBucket() + err := buflock.WriteConfig(context.Background(), bucket, bufLock) + require.NoError(t, err) + return bucket +} + +func pin(t *testing.T, repository string) ModulePin { + t.Helper() + pin, err := NewModulePin( + "remote", + "owner", + repository, + "branch", + "commit", + createDigest(t, []byte{}), + time.Now(), + ) + require.NoError(t, err) + return pin +} + +func createDigest(t *testing.T, b []byte) string { + t.Helper() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + digest, err := digester.Digest(bytes.NewReader(b)) + require.NoError(t, err) + return digest.String() +} + +func deps( + t *testing.T, + dependencies ...buflock.ExternalConfigDependencyV1, +) string { + deps, err := encoding.MarshalYAML( + &buflock.ExternalConfigV1{Deps: dependencies}, + ) + require.NoError(t, err) + return string(deps) +} + +func testPutDependencyModulePinsToBucket( + t *testing.T, + desc string, + modulePins []ModulePin, + buflock string, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + ctx := context.Background() + writeBucket := storagemem.NewReadWriteBucket() + err := PutDependencyModulePinsToBucket( + ctx, + writeBucket, + modulePins, + ) + require.NoError(t, err) + file, err := writeBucket.Get(ctx, "buf.lock") + require.NoError(t, err) + defer file.Close() + actual, err := io.ReadAll(file) + require.NoError(t, err) + assert.Equal(t, buflock, string(actual)) + }) +} + +func testDependencyModulePinsForBucket( + t *testing.T, + desc string, + modulePins []ModulePin, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + ctx := context.Background() + writeBucket := storagemem.NewReadWriteBucket() + // we can assume put works given we've tested put in isolation + err := PutDependencyModulePinsToBucket( + ctx, + writeBucket, + modulePins, + ) + require.NoError(t, err) + retPins, err := DependencyModulePinsForBucket(ctx, writeBucket) + require.NoError(t, err) + assert.Equal(t, len(modulePins), len(retPins)) + for i, actual := range retPins { + assert.Equal(t, modulePins[i].Remote(), actual.Remote()) + assert.Equal(t, modulePins[i].Owner(), actual.Owner()) + assert.Equal(t, modulePins[i].Repository(), actual.Repository()) + assert.Equal(t, modulePins[i].Commit(), actual.Commit()) + assert.Equal(t, modulePins[i].Digest(), actual.Digest()) + assert.Equal(t, "", actual.Branch()) // branch is never consumed + } + }) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/file_info.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/file_info.go new file mode 100644 index 000000000..4543d2df6 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/file_info.go @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" +) + +var _ FileInfo = &fileInfo{} + +type fileInfo struct { + path string + externalPath string + isImport bool + moduleIdentity ModuleIdentity + commit string +} + +func newFileInfo( + path string, + externalPath string, + isImport bool, + moduleIdentity ModuleIdentity, + commit string, +) (*fileInfo, error) { + if err := protodescriptor.ValidateProtoPath("root relative file path", path); err != nil { + return nil, err + } + if externalPath == "" { + externalPath = path + } + return newFileInfoNoValidate( + path, + externalPath, + isImport, + moduleIdentity, + commit, + ), nil +} + +func newFileInfoNoValidate( + path string, + externalPath string, + isImport bool, + moduleIdentity ModuleIdentity, + commit string, +) *fileInfo { + return &fileInfo{ + path: path, + externalPath: externalPath, + isImport: isImport, + moduleIdentity: moduleIdentity, + commit: commit, + } +} + +func (f *fileInfo) Path() string { + return f.path +} + +func (f *fileInfo) ExternalPath() string { + return f.externalPath +} + +func (f *fileInfo) IsImport() bool { + return f.isImport +} + +func (f *fileInfo) ModuleIdentity() ModuleIdentity { + return f.moduleIdentity +} + +func (f *fileInfo) Commit() string { + return f.commit +} + +func (f *fileInfo) WithIsImport(isImport bool) FileInfo { + return newFileInfoNoValidate( + f.path, + f.externalPath, + isImport, + f.moduleIdentity, + f.commit, + ) +} + +func (*fileInfo) isFileInfo() {} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_identity.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_identity.go new file mode 100644 index 000000000..db4479c29 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_identity.go @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +type moduleIdentity struct { + remote string + owner string + repository string +} + +func newModuleIdentity( + remote string, + owner string, + repository string, +) (*moduleIdentity, error) { + moduleIdentity := &moduleIdentity{ + remote: remote, + owner: owner, + repository: repository, + } + if err := validateModuleIdentity(moduleIdentity); err != nil { + return nil, err + } + return moduleIdentity, nil +} + +func (m *moduleIdentity) Remote() string { + return m.remote +} + +func (m *moduleIdentity) Owner() string { + return m.owner +} + +func (m *moduleIdentity) Repository() string { + return m.repository +} + +func (m *moduleIdentity) IdentityString() string { + return m.remote + "/" + m.owner + "/" + m.repository +} + +func (*moduleIdentity) isModuleOwner() {} +func (*moduleIdentity) isModuleIdentity() {} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_owner.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_owner.go new file mode 100644 index 000000000..e0b265df4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_owner.go @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +type moduleOwner struct { + remote string + owner string +} + +func newModuleOwner( + remote string, + owner string, +) (*moduleOwner, error) { + moduleOwner := &moduleOwner{ + remote: remote, + owner: owner, + } + if err := validateModuleOwner(moduleOwner); err != nil { + return nil, err + } + return moduleOwner, nil +} + +func (m *moduleOwner) Remote() string { + return m.remote +} + +func (m *moduleOwner) Owner() string { + return m.owner +} + +func (*moduleOwner) isModuleOwner() {} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_owner_test.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_owner_test.go new file mode 100644 index 000000000..37cff5afe --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_owner_test.go @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestModuleOwnerForString(t *testing.T) { + t.Parallel() + expectedModuleOwner, err := NewModuleOwner("foo.com", "barr") + require.NoError(t, err) + require.Equal(t, "foo.com", expectedModuleOwner.Remote()) + require.Equal(t, "barr", expectedModuleOwner.Owner()) + moduleOwner, err := ModuleOwnerForString("foo.com/barr") + require.NoError(t, err) + require.Equal(t, expectedModuleOwner, moduleOwner) +} + +func TestModuleOwnerForStringError(t *testing.T) { + t.Parallel() + testCases := []struct { + Name string + Input string + }{ + { + Name: "Module owner without a remote", + Input: "/foo", + }, + { + Name: "Module owner with a repository", + Input: "foo.com/bar/baz", + }, + { + Name: "Module owner with a branch", + Input: "foo.com//bar:v1", + }, + { + Name: "Module owner with invalid characters", + Input: "foo@bar.com/baz", + }, + } + for _, testCase := range testCases { + testCase := testCase + t.Run(testCase.Name, func(t *testing.T) { + t.Parallel() + _, err := ModuleOwnerForString(testCase.Input) + require.Error(t, err) + }) + } +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_pin.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_pin.go new file mode 100644 index 000000000..a107ff0ee --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_pin.go @@ -0,0 +1,132 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "time" + + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/prototime" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type modulePin struct { + remote string + owner string + repository string + branch string + commit string + digest string + createTime time.Time +} + +func newModulePin( + remote string, + owner string, + repository string, + branch string, + commit string, + digest string, + createTime time.Time, +) (*modulePin, error) { + protoCreateTime, err := prototime.NewTimestamp(createTime) + if err != nil { + return nil, err + } + return newModulePinForProto( + &modulev1alpha1.ModulePin{ + Remote: remote, + Owner: owner, + Repository: repository, + Branch: branch, + Commit: commit, + ManifestDigest: digest, + CreateTime: protoCreateTime, + }, + ) +} + +func newModulePinForProto( + protoModulePin *modulev1alpha1.ModulePin, +) (*modulePin, error) { + if err := ValidateProtoModulePin(protoModulePin); err != nil { + return nil, err + } + return &modulePin{ + remote: protoModulePin.Remote, + owner: protoModulePin.Owner, + repository: protoModulePin.Repository, + branch: protoModulePin.Branch, + commit: protoModulePin.Commit, + digest: protoModulePin.ManifestDigest, + createTime: protoModulePin.CreateTime.AsTime(), + }, nil +} + +func newProtoModulePinForModulePin( + modulePin ModulePin, +) *modulev1alpha1.ModulePin { + return &modulev1alpha1.ModulePin{ + Remote: modulePin.Remote(), + Owner: modulePin.Owner(), + Repository: modulePin.Repository(), + Branch: modulePin.Branch(), + Commit: modulePin.Commit(), + ManifestDigest: modulePin.Digest(), + // no need to validate as we already know this is valid + CreateTime: timestamppb.New(modulePin.CreateTime()), + } +} + +func (m *modulePin) Remote() string { + return m.remote +} + +func (m *modulePin) Owner() string { + return m.owner +} + +func (m *modulePin) Repository() string { + return m.repository +} + +func (m *modulePin) Branch() string { + return m.branch +} + +func (m *modulePin) Commit() string { + return m.commit +} + +func (m *modulePin) Digest() string { + return m.digest +} + +func (m *modulePin) CreateTime() time.Time { + return m.createTime +} + +func (m *modulePin) String() string { + return m.remote + "/" + m.owner + "/" + m.repository + ":" + m.commit +} + +func (m *modulePin) IdentityString() string { + return m.remote + "/" + m.owner + "/" + m.repository +} + +func (*modulePin) isModuleOwner() {} +func (*modulePin) isModuleIdentity() {} +func (*modulePin) isModulePin() {} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_pin_test.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_pin_test.go new file mode 100644 index 000000000..2929fe891 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_pin_test.go @@ -0,0 +1,63 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "bytes" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestNewModulePin(t *testing.T) { + t.Parallel() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + nullDigest, err := digester.Digest(&bytes.Buffer{}) + require.NoError(t, err) + testNewModulePin(t, "no digest", "", true) + testNewModulePin(t, "nominal digest", nullDigest.String(), false) +} + +func testNewModulePin( + t *testing.T, + desc string, + digest string, + expectEmptyDigest bool, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + pin, err := NewModulePin( + "remote", + "owner", + "repository", + "branch", + "commit", + digest, + time.Now(), + ) + assert.NoError(t, err) + if expectEmptyDigest { + assert.Equal(t, "", pin.Digest()) + } else { + assert.Equal(t, digest, pin.Digest()) + } + }) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_reference.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_reference.go new file mode 100644 index 000000000..f2cd89c1e --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_reference.go @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" +) + +type moduleReference struct { + remote string + owner string + repository string + reference string +} + +func newModuleReference( + remote string, + owner string, + repository string, + reference string, +) (*moduleReference, error) { + protoModuleReference := &modulev1alpha1.ModuleReference{ + Remote: remote, + Owner: owner, + Repository: repository, + Reference: reference, + } + return newModuleReferenceForProto(protoModuleReference) +} + +func newModuleReferenceForProto( + protoModuleReference *modulev1alpha1.ModuleReference, +) (*moduleReference, error) { + if err := ValidateProtoModuleReference(protoModuleReference); err != nil { + return nil, err + } + return &moduleReference{ + remote: protoModuleReference.Remote, + owner: protoModuleReference.Owner, + repository: protoModuleReference.Repository, + reference: protoModuleReference.Reference, + }, nil +} + +func newProtoModuleReferenceForModuleReference( + moduleReference ModuleReference, +) *modulev1alpha1.ModuleReference { + // no need to validate as we know we have a valid ModuleReference constructed + // by this package due to the private interface + return &modulev1alpha1.ModuleReference{ + Remote: moduleReference.Remote(), + Owner: moduleReference.Owner(), + Repository: moduleReference.Repository(), + Reference: moduleReference.Reference(), + } +} + +func (m *moduleReference) Remote() string { + return m.remote +} + +func (m *moduleReference) Owner() string { + return m.owner +} + +func (m *moduleReference) Repository() string { + return m.repository +} + +func (m *moduleReference) Reference() string { + return m.reference +} + +func (m *moduleReference) String() string { + if m.reference == Main { + return m.remote + "/" + m.owner + "/" + m.repository + } + return m.remote + "/" + m.owner + "/" + m.repository + ":" + m.reference +} + +func (m *moduleReference) IdentityString() string { + return m.remote + "/" + m.owner + "/" + m.repository +} + +func (*moduleReference) isModuleOwner() {} +func (*moduleReference) isModuleIdentity() {} +func (*moduleReference) isModuleReference() {} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_reference_test.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_reference_test.go new file mode 100644 index 000000000..8b06eaaa5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/module_reference_test.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/uuidutil" + "github.com/stretchr/testify/require" +) + +func TestModuleReferenceForString(t *testing.T) { + t.Parallel() + expectedModuleReference, err := NewModuleReference("foo.com", "barr", "baz", "main") + require.NoError(t, err) + require.Equal(t, "foo.com/barr/baz", expectedModuleReference.String()) + moduleReference, err := ModuleReferenceForString("foo.com/barr/baz") + require.NoError(t, err) + require.Equal(t, expectedModuleReference, moduleReference) + branchModuleReference, err := ModuleReferenceForString("foo.com/barr/baz") + require.NoError(t, err) + require.Equal(t, expectedModuleReference, branchModuleReference) + require.False(t, IsCommitModuleReference(branchModuleReference)) + + expectedModuleReference, err = NewModuleReference("foo.com", "barr", "baz", "v1") + require.NoError(t, err) + require.Equal(t, "foo.com/barr/baz:v1", expectedModuleReference.String()) + moduleReference, err = ModuleReferenceForString("foo.com/barr/baz:v1") + require.NoError(t, err) + require.Equal(t, expectedModuleReference, moduleReference) + branchModuleReference, err = ModuleReferenceForString("foo.com/barr/baz:v1") + require.NoError(t, err) + require.Equal(t, expectedModuleReference, branchModuleReference) + require.False(t, IsCommitModuleReference(branchModuleReference)) + + commitUUID, err := uuidutil.New() + require.NoError(t, err) + commit, err := uuidutil.ToDashless(commitUUID) + require.NoError(t, err) + expectedModuleReference, err = NewModuleReference("foo.com", "barr", "baz", commit) + require.NoError(t, err) + require.Equal(t, "foo.com/barr/baz:"+commit, expectedModuleReference.String()) + moduleReference, err = ModuleReferenceForString("foo.com/barr/baz:" + commit) + require.NoError(t, err) + require.Equal(t, expectedModuleReference, moduleReference) + commitModuleReference, err := ModuleReferenceForString("foo.com/barr/baz:" + commit) + require.NoError(t, err) + require.Equal(t, expectedModuleReference, commitModuleReference) + require.True(t, IsCommitModuleReference(commitModuleReference)) + + expectedModuleReference, err = NewModuleReference("foo.com", "barr", "baz", "some/draft") + require.NoError(t, err) + require.Equal(t, "foo.com/barr/baz:some/draft", expectedModuleReference.String()) + moduleReference, err = ModuleReferenceForString("foo.com/barr/baz:some/draft") + require.NoError(t, err) + require.Equal(t, expectedModuleReference, moduleReference) + require.False(t, IsCommitModuleReference(moduleReference)) + + expectedModuleReference, err = NewModuleReference("localhost:8080", "barr", "baz", "some/draft") + require.NoError(t, err) + require.Equal(t, "localhost:8080/barr/baz:some/draft", expectedModuleReference.String()) + moduleReference, err = ModuleReferenceForString("localhost:8080/barr/baz:some/draft") + require.NoError(t, err) + require.Equal(t, expectedModuleReference, moduleReference) + require.False(t, IsCommitModuleReference(moduleReference)) + + expectedModuleReference, err = NewModuleReference("localhost:8080", "barr", "baz", "ref") + require.NoError(t, err) + require.Equal(t, "localhost:8080/barr/baz:ref", expectedModuleReference.String()) + moduleReference, err = ModuleReferenceForString("localhost:8080/barr/baz:ref") + require.NoError(t, err) + require.Equal(t, expectedModuleReference, moduleReference) + require.False(t, IsCommitModuleReference(moduleReference)) + + expectedModuleReference, err = NewModuleReference("localhost:8080", "barr", "baz", "main") + require.NoError(t, err) + require.Equal(t, "localhost:8080/barr/baz", expectedModuleReference.String()) + moduleReference, err = ModuleReferenceForString("localhost:8080/barr/baz") + require.NoError(t, err) + require.Equal(t, expectedModuleReference, moduleReference) + require.False(t, IsCommitModuleReference(moduleReference)) +} + +func TestModuleReferenceForStringError(t *testing.T) { + t.Parallel() + testCases := []struct { + Name string + Input string + }{ + { + Name: "Module without a remote", + Input: "/barr/baz:v1", + }, + { + Name: "Module without an owner", + Input: "foo.com//baz:v1", + }, + { + Name: "Module without a repository", + Input: "foo.com/barr/:v1", + }, + { + Name: "Module without a branch or commit", + Input: "foo.com/barr/baz:", + }, + } + for _, testCase := range testCases { + testCase := testCase + t.Run(testCase.Name, func(t *testing.T) { + t.Parallel() + _, err := ModuleReferenceForString(testCase.Input) + require.Error(t, err) + }) + } +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/util.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/util.go new file mode 100644 index 000000000..04edb0676 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/util.go @@ -0,0 +1,144 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "fmt" + "strings" +) + +// parseModuleReferenceComponents parses and returns the remote, owner, repository, +// and ref (branch, commit, draft, or tag) from the given path. +func parseModuleReferenceComponents(path string) (remote string, owner string, repository string, ref string, err error) { + // split by the first "/" to separate the remote and remaining part + slashSplit := strings.SplitN(path, "/", 2) + if len(slashSplit) != 2 { + return "", "", "", "", newInvalidModuleReferenceStringError(path) + } + remote, rest := slashSplit[0], slashSplit[1] + // split the remaining part by ":" to separate the reference + colonSplit := strings.Split(rest, ":") + switch len(colonSplit) { + case 1: + // path excluding remote has no colon, no need to handle its ref + case 2: + ref = strings.TrimSpace(colonSplit[1]) + if ref == "" { + return "", "", "", "", newInvalidModuleReferenceStringError(path) + } + default: + return "", "", "", "", newInvalidModuleReferenceStringError(path) + } + remote, owner, repository, err = parseModuleIdentityComponents(remote + "/" + colonSplit[0]) + if err != nil { + return "", "", "", "", newInvalidModuleReferenceStringError(path) + } + return remote, owner, repository, ref, nil +} + +func parseModuleIdentityComponents(path string) (remote string, owner string, repository string, err error) { + slashSplit := strings.Split(path, "/") + if len(slashSplit) != 3 { + return "", "", "", newInvalidModuleIdentityStringError(path) + } + remote = strings.TrimSpace(slashSplit[0]) + if remote == "" { + return "", "", "", newInvalidModuleIdentityStringError(path) + } + owner = strings.TrimSpace(slashSplit[1]) + if owner == "" { + return "", "", "", newInvalidModuleIdentityStringError(path) + } + repository = strings.TrimSpace(slashSplit[2]) + if repository == "" { + return "", "", "", newInvalidModuleIdentityStringError(path) + } + return remote, owner, repository, nil +} + +func modulePinLess(a ModulePin, b ModulePin) bool { + return modulePinCompareTo(a, b) < 0 +} + +// return -1 if less +// return 1 if greater +// return 0 if equal +func modulePinCompareTo(a ModulePin, b ModulePin) int { + if a == nil && b == nil { + return 0 + } + if a == nil && b != nil { + return -1 + } + if a != nil && b == nil { + return 1 + } + if a.Remote() < b.Remote() { + return -1 + } + if a.Remote() > b.Remote() { + return 1 + } + if a.Owner() < b.Owner() { + return -1 + } + if a.Owner() > b.Owner() { + return 1 + } + if a.Repository() < b.Repository() { + return -1 + } + if a.Repository() > b.Repository() { + return 1 + } + if a.Branch() < b.Branch() { + return -1 + } + if a.Branch() > b.Branch() { + return 1 + } + if a.Commit() < b.Commit() { + return -1 + } + if a.Commit() > b.Commit() { + return 1 + } + if a.Digest() < b.Digest() { + return -1 + } + if a.Digest() > b.Digest() { + return 1 + } + if a.CreateTime().Before(b.CreateTime()) { + return -1 + } + if a.CreateTime().After(b.CreateTime()) { + return 1 + } + return 0 +} + +func newInvalidModuleOwnerStringError(s string) error { + return fmt.Errorf("module owner %q is invalid: must be in the form remote/owner", s) +} + +func newInvalidModuleIdentityStringError(s string) error { + return fmt.Errorf("module identity %q is invalid: must be in the form remote/owner/repository", s) +} + +func newInvalidModuleReferenceStringError(s string) error { + return fmt.Errorf("module reference %q is invalid: must be in the form remote/owner/repository:reference", s) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/validate.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/validate.go new file mode 100644 index 000000000..ae9c0e18f --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/validate.go @@ -0,0 +1,211 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "errors" + "fmt" + "strings" + + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/netextended" +) + +// ValidateProtoModuleReference verifies the given module reference is well-formed. +// It performs client-side validation only, and is limited to fields +// we do not think will change in the future. +func ValidateProtoModuleReference(protoModuleReference *modulev1alpha1.ModuleReference) error { + if protoModuleReference == nil { + return errors.New("module reference is required") + } + if err := validateRemote(protoModuleReference.Remote); err != nil { + return err + } + if err := ValidateOwner(protoModuleReference.Owner, "owner"); err != nil { + return err + } + if err := ValidateRepository(protoModuleReference.Repository); err != nil { + return err + } + return ValidateReference(protoModuleReference.Reference) +} + +// ValidateProtoModulePin verifies the given module pin is well-formed. +// It performs client-side validation only, and is limited to fields +// we do not think will change in the future. +func ValidateProtoModulePin(protoModulePin *modulev1alpha1.ModulePin) error { + if protoModulePin == nil { + return errors.New("module pin is required") + } + if err := validateRemote(protoModulePin.Remote); err != nil { + return err + } + if err := ValidateOwner(protoModulePin.Owner, "owner"); err != nil { + return err + } + if err := ValidateRepository(protoModulePin.Repository); err != nil { + return err + } + if err := ValidateCommit(protoModulePin.Commit); err != nil { + return err + } + return nil +} + +// ValidateUser verifies the given user name is well-formed. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateUser(user string) error { + return ValidateOwner(user, "user") +} + +// ValidateOrganization verifies the given organization name is well-formed. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateOrganization(organization string) error { + return ValidateOwner(organization, "organization") +} + +// ValidateOwner verifies the given owner name is well-formed. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateOwner(owner string, ownerType string) error { + if owner == "" { + return fmt.Errorf("%s name is required", ownerType) + } + return nil +} + +// ValidateRepository verifies the given repository name is well-formed. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateRepository(repository string) error { + if repository == "" { + return errors.New("repository name is required") + } + return nil +} + +// ValidateReference validates that the given ModuleReference reference is well-formed. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateReference(reference string) error { + if reference == "" { + return errors.New("repository reference is required") + } + return nil +} + +// ValidateCommit verifies the given commit is well-formed. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateCommit(commit string) error { + if commit == "" { + return errors.New("empty commit") + } + return nil +} + +// ValidateBranch verifies the given repository branch is well-formed. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateBranch(branch string) error { + if branch != Main { + return fmt.Errorf("branch is not %s", Main) + } + //if branch == "" { + // return errors.New("repository branch is required") + //} + return nil +} + +// ValidateTag verifies the given tag is well-formed. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateTag(tag string) error { + if tag == "" { + return errors.New("repository tag is required") + } + return nil +} + +// ValidateModuleFilePath validates that the module file path is not empty. +// It performs client-side validation only, and is limited to properties +// we do not think will change in the future. +func ValidateModuleFilePath(path string) error { + if path == "" { + return errors.New("empty path") + } + return nil +} + +// ValidateRemoteNotEmpty validates that the given remote address is not an empty string +// It performs client-side validation only, and is limited to fields +// we do not think will change in the future. +func ValidateRemoteNotEmpty(remote string) error { + if remote == "" { + return appcmd.NewInvalidArgumentError("you must specify a remote module") + } + return nil +} + +// ValidateRemoteHasNoPaths validates that the given remote address contains no paths/subdirectories after the root +// It performs client-side validation only, and is limited to fields +// we do not think will change in the future. +func ValidateRemoteHasNoPaths(remote string) error { + _, path, ok := strings.Cut(remote, "/") + if ok && path != "" { + return appcmd.NewInvalidArgumentError(fmt.Sprintf(`invalid remote address, must not contain any paths. Try removing "/%s" from the address.`, path)) + } + return nil +} + +func validateModuleOwner(moduleOwner ModuleOwner) error { + if moduleOwner == nil { + return errors.New("module owner is required") + } + if err := validateRemote(moduleOwner.Remote()); err != nil { + return err + } + if err := ValidateOwner(moduleOwner.Owner(), "owner"); err != nil { + return err + } + return nil +} + +func validateModuleIdentity(moduleIdentity ModuleIdentity) error { + if moduleIdentity == nil { + return errors.New("module identity is required") + } + if err := validateRemote(moduleIdentity.Remote()); err != nil { + return err + } + if err := ValidateOwner(moduleIdentity.Owner(), "owner"); err != nil { + return err + } + if err := ValidateRepository(moduleIdentity.Repository()); err != nil { + return err + } + return nil +} + +func validateRemote(remote string) error { + if _, err := netextended.ValidateHostname(remote); err != nil { + return fmt.Errorf("invalid remote %q: %w", remote, err) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduleref/validate_test.go b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/validate_test.go new file mode 100644 index 000000000..22565023a --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduleref/validate_test.go @@ -0,0 +1,72 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduleref + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestValidateRemoteNotEmpty(t *testing.T) { + t.Parallel() + err := ValidateRemoteNotEmpty("") + require.Equal(t, "you must specify a remote module", err.Error()) + require.NoError(t, ValidateRemoteNotEmpty("buf.build")) +} + +func TestValidateRemoteHasNoPaths(t *testing.T) { + t.Parallel() + testCases := []struct { + Name string + Input string + InvalidPath string + }{ + { + Name: "Remote with two trailing slashes", + Input: "buf.build//", + InvalidPath: "//", + }, + { + Name: "Remote with a single path", + Input: "buf.build/path1", + InvalidPath: "/path1", + }, + { + Name: "Remote with a single path and trailing slash", + Input: "buf.build/path1/", + InvalidPath: "/path1/", + }, + { + Name: "Remote with two paths", + Input: "buf.build/path1/path2", + InvalidPath: "/path1/path2", + }, + } + + for _, testCase := range testCases { + testCase := testCase + t.Run(testCase.Name, func(t *testing.T) { + t.Parallel() + err := ValidateRemoteHasNoPaths(testCase.Input) + require.Equal(t, fmt.Sprintf(`invalid remote address, must not contain any paths. Try removing "%s" from the address.`, testCase.InvalidPath), err.Error()) + }) + } + require.NoError(t, ValidateRemoteHasNoPaths("")) + require.NoError(t, ValidateRemoteHasNoPaths("buf.build")) + require.NoError(t, ValidateRemoteHasNoPaths("buf.build/")) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulestat/bufmodulestat.go b/pkg/bufman/bufpkg/bufmodule/bufmodulestat/bufmodulestat.go new file mode 100644 index 000000000..039b72e91 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulestat/bufmodulestat.go @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulestat + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protostat" +) + +// NewFileWalker returns a new FileWalker for the given Module. +// +// This walks all target files from TargetFileInfos. +// +// We use TargetFileInfos instead of SourceFileInfos as this means +// that if someone sets up a filter at a higher level, this will respect it. +// In most cases, TargetFileInfos is the same as SourceFileInfos. +func NewFileWalker(module bufmodule.Module) protostat.FileWalker { + return newFileWalker(module) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulestat/file_walker.go b/pkg/bufman/bufpkg/bufmodule/bufmodulestat/file_walker.go new file mode 100644 index 000000000..190b07746 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulestat/file_walker.go @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodulestat + +import ( + "context" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "go.uber.org/multierr" +) + +type fileWalker struct { + module bufmodule.Module +} + +func newFileWalker(module bufmodule.Module) *fileWalker { + return &fileWalker{ + module: module, + } +} + +func (f *fileWalker) Walk(ctx context.Context, fu func(io.Reader) error) error { + fileInfos, err := f.module.TargetFileInfos(ctx) + if err != nil { + return err + } + for _, fileInfo := range fileInfos { + moduleFile, err := f.module.GetModuleFile(ctx, fileInfo.Path()) + if err != nil { + return err + } + if err := fu(moduleFile); err != nil { + return multierr.Append(err, moduleFile.Close()) + } + if err := moduleFile.Close(); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go new file mode 100644 index 000000000..8fa963a2a --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting.go @@ -0,0 +1,282 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduletesting + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buflock" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + breakingv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/breaking/v1" + lintv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/lint/v1" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/uuidutil" +) + +const ( + // TestDigest is a valid digest. + // + // This matches TestData. + TestDigest = "b1-gLO3B_5ClhdU52w1gMOxk4GokvCoM1OqjarxMfjStGQ=" + // TestDigestB3WithConfiguration is a valid digest. + // + // This matches TestDataWithConfiguration. + TestDigestB3WithConfiguration = "b3-b2gkRgE1WxTKpEfsK4ql8STGxqc6nRimCeMBGB5i2OU=" + // This matches TestDataWithConfigurationAndFallbackDocumentationPath. + TestDigestB3WithConfigurationAndFallbackDocumentationPath = "b3-Zy8TSrRHq9GvkqVGz8bChvBEpAW3psNvXjzCHkxWzTE=" + // TestDigestWithDocumentation is a valid test digest. + // + // This matches TestDataWithDocumentation. + TestDigestWithDocumentation = "b1-Vqi49Lw-sr3tTLQVwSJrRJnJSwV0yeg97ea957z02B0=" + // TestDigestB3WithLicense is a valid digest. + // + // This matches TestDataWithLicense. + TestDigestB3WithLicense = "b3-j7iu4iVzYQUFr97mbq2PNAlM5UjEnjtwEas0q7g4DVM=" + // TestModuleReferenceFooBarV1String is a valid module reference string. + TestModuleReferenceFooBarV1String = "buf.build/foob/bar:v1" + // TestModuleReferenceFooBarV2String is a valid module reference string. + TestModuleReferenceFooBarV2String = "buf.build/foob/bar:v2" + // TestModuleReferenceFooBazV1String is a valid module reference string. + TestModuleReferenceFooBazV1String = "buf.build/foob/baz:v1" + // TestModuleReferenceFooBazV2String is a valid module reference string. + TestModuleReferenceFooBazV2String = "buf.build/foob/baz:v2" + // TestModuleDocumentation is a markdown module documentation file. + TestModuleDocumentation = "# Module Documentation" + // TestModuleDocumentationPath is the default path for module documentation file. + TestModuleDocumentationPath = "buf.md" + // TestModuleFallbackDocumentationPath is a fallback path for module documentation file. + TestModuleFallbackDocumentationPath = "README.md" + // TestModuleLicense is a txt module license file. + TestModuleLicense = "Module License" + // TestModuleConfiguration is a configuration file with an arbitrary module name, + // and example lint and breaking configuration that covers every key. At least two + // items are included in every key (where applicable) so that we validate whether + // or not the digest is deterministic. + TestModuleConfiguration = ` +version: v1 +name: buf.build/acme/weather +lint: + use: + - DEFAULT + - UNARY_RPC + except: + - BASIC + - FILE_LOWER_SNAKE_CASE + ignore: + - file1.proto + - folder/file2.proto + ignore_only: + ENUM_PASCAL_CASE: + - file1.proto + - folder + BASIC: + - file1.proto + - folder + enum_zero_value_suffix: _UNSPECIFIED + rpc_allow_same_request_response: true + rpc_allow_google_protobuf_empty_requests: true + rpc_allow_google_protobuf_empty_responses: true + service_suffix: Service + allow_comment_ignores: true +breaking: + use: + - FILE + - WIRE + except: + - FILE_NO_DELETE + - RPC_NO_DELETE + ignore: + - file1.proto + - folder/file2.proto + ignore_only: + FIELD_SAME_JSON_NAME: + - file1.proto + - folder + WIRE: + - file1.proto + - folder + ignore_unstable_packages: true +` +) + +var ( + // TestData is the data that maps to TestDigest with TestModuleReferenceString. + TestData = map[string][]byte{ + TestFile1Path: []byte(`syntax="proto3";`), + TestFile2Path: []byte(`syntax="proto3";`), + } + // TestDataProto is the proto representation of TestData. + TestDataProto = &modulev1alpha1.Module{ + Files: []*modulev1alpha1.ModuleFile{ + { + Path: TestFile1Path, + Content: []byte(`syntax="proto3";`), + }, + { + Path: TestFile2Path, + Content: []byte(`syntax="proto3";`), + }, + }, + BreakingConfig: &breakingv1.Config{Version: "v1beta1"}, + LintConfig: &lintv1.Config{Version: "v1beta1"}, + } + // TestDataWithDocumentation is the data that maps to TestDigestB3WithConfiguration. + // + // It includes a buf.md file. + TestDataWithDocumentation = map[string][]byte{ + TestFile1Path: []byte(`syntax="proto3";`), + TestModuleDocumentationPath: []byte(TestModuleDocumentation), + } + // TestDataWithFallbackDocumentationPath is the data that maps to TestDigestWithDocumentation. + // + // It includes a README.md file. + TestDataWithFallbackDocumentationPath = map[string][]byte{ + TestFile1Path: []byte(`syntax="proto3";`), + TestModuleFallbackDocumentationPath: []byte(TestModuleDocumentation), + } + // TestDataWithDocumentationProto is the proto representation of TestDataWithDocumentation. + TestDataWithDocumentationProto = &modulev1alpha1.Module{ + Files: []*modulev1alpha1.ModuleFile{ + { + Path: TestFile1Path, + Content: []byte(`syntax="proto3";`), + }, + }, + Documentation: TestModuleDocumentation, + DocumentationPath: TestModuleDocumentationPath, + BreakingConfig: &breakingv1.Config{Version: "v1beta1"}, + LintConfig: &lintv1.Config{Version: "v1beta1"}, + } + // TestDataWithConfiguration is the data that maps to TestDigestWithConfiguration. + // + // It includes a buf.yaml and a buf.md file. + TestDataWithConfiguration = map[string][]byte{ + TestFile1Path: []byte(`syntax="proto3";`), + TestFile2Path: []byte(`syntax="proto3";`), + "buf.yaml": []byte(TestModuleConfiguration), + TestModuleDocumentationPath: []byte(TestModuleDocumentation), + } + // TestDataWithConfigurationAndFallbackDocumentationPath is the data that maps to TestDigestB3WithConfigurationAndFallbackDocumentation. + // + // It includes a buf.yaml and a README.md file. + TestDataWithConfigurationAndFallbackDocumentationPath = map[string][]byte{ + TestFile1Path: []byte(`syntax="proto3";`), + TestFile2Path: []byte(`syntax="proto3";`), + "buf.yaml": []byte(TestModuleConfiguration), + TestModuleFallbackDocumentationPath: []byte(TestModuleDocumentation), + } + // TestDataWithLicense is the data that maps to TestDigestB3WithLicense. + // + // It includes a LICENSE file. + TestDataWithLicense = map[string][]byte{ + TestFile1Path: []byte(`syntax="proto3";`), + "LICENSE": []byte(TestModuleLicense), + } + // TestFile1Path is the path of file1.proto. + TestFile1Path = "file1.proto" + // TestFile2Path is the path of file2.proto. + TestFile2Path = "folder/file2.proto" + // TestCommit is a valid commit. + TestCommit string + // TestModuleReferenceFooBarCommitString is a valid module reference string. + TestModuleReferenceFooBarCommitString string + // TestModuleReferenceFooBazCommitString is a valid module reference string. + TestModuleReferenceFooBazCommitString string +) + +// NewTestModuleReader returns a new ModuleReader that will return the mapped module +// for any ModulePin that has the IdentityString matching the key. +// +// For example: +// +// {"buf.build/foo/bar" -> testModule } +// +// For any ModulePin that has remote "buf.build", owner "foo", and repository "bar", +// testModule will be returned. +// +// Will typically need to be used in conjunction with WriteTestLockFileToBucket. +// A bucket will be built with .proto files and a lock file that references the moduleIdentities, +// and then a test ModuleReader will be created with these Modules. +// +// Example: +// +// bucket := storagemem.NewReadWriteBucket() +// err := storage.PutPaths(ctx, bucket, map[string][]data{...}) // put the .proto files +// require.NoError(t, err) +// err = WriteTestLockFileToBucket(ctx, bucket, "buf.build/acme/bar", "buf.build/acme/baz") +// require.NoError(t, err) +// fooModule, err := bufmodule.NewModuleForBucket(ctx, bucket) +// require.NoError(t, err) +// imageBuilder := bufimagebuild.NewBuilder( +// zap.NewNop(), +// bufmoduletesting.NewTestModuleReader( +// map[string]bufmodule.Module{ +// "buf.build/acme/bar": barModule, +// "buf.build/acme/baz": bazModule, +// }, +// ), +// ) +// err = imageBuilder.Build(ctx, fooModule) +// +// TODO: change this to moduleCommitToModule if we ever introduce a ModuleCommit type to +// replace ModulePin. +func NewTestModuleReader(moduleIdentityStringToModule map[string]bufmodule.Module) bufmodule.ModuleReader { + return newTestModuleReader(moduleIdentityStringToModule) +} + +// WriteTestLockFileToBucket write a test buf.lock to the given bucket with the given IdentityStrings. +// +// Must be used with a ModuleReader created with NewTestModuleReader. +// See NewTestModuleReader for example usage. +func WriteTestLockFileToBucket(ctx context.Context, writeBucket storage.WriteBucket, moduleIdentityStrings ...string) error { + moduleIdentities := make([]bufmoduleref.ModuleIdentity, len(moduleIdentityStrings)) + for i, moduleIdentityString := range moduleIdentityStrings { + moduleIdentity, err := bufmoduleref.ModuleIdentityForString(moduleIdentityString) + if err != nil { + return err + } + moduleIdentities[i] = moduleIdentity + } + lockConfig := &buflock.Config{ + Dependencies: make([]buflock.Dependency, len(moduleIdentities)), + } + for i, moduleIdentity := range moduleIdentities { + lockConfig.Dependencies[i] = buflock.Dependency{ + Remote: moduleIdentity.Remote(), + Owner: moduleIdentity.Owner(), + Repository: moduleIdentity.Repository(), + Commit: TestCommit, + Digest: TestDigest, + } + } + return buflock.WriteConfig(ctx, writeBucket, lockConfig) +} + +func init() { + testCommitUUID, err := uuidutil.New() + if err != nil { + panic(err.Error()) + } + testCommitDashless, err := uuidutil.ToDashless(testCommitUUID) + if err != nil { + panic(err.Error()) + } + TestCommit = testCommitDashless + TestModuleReferenceFooBarCommitString = "buf.build/foob/bar:" + TestCommit + TestModuleReferenceFooBazCommitString = "buf.build/foob/baz:" + TestCommit +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_test.go b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_test.go new file mode 100644 index 000000000..3c643dd50 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_test.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduletesting_test + +import ( + "context" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/stretchr/testify/require" +) + +func TestModuleDigestB3(t *testing.T) { + t.Parallel() + readBucket, err := storagemem.NewReadBucket(bufmoduletesting.TestDataWithConfiguration) + require.NoError(t, err) + module, err := bufmodule.NewModuleForBucket(context.Background(), readBucket) + require.NoError(t, err) + digest, err := bufmodule.ModuleDigestB3(context.Background(), module) + require.NoError(t, err) + require.Equal(t, bufmoduletesting.TestDigestB3WithConfiguration, digest) +} + +func TestModuleDigestB3withFallbackDocumentationPath(t *testing.T) { + t.Parallel() + readBucket, err := storagemem.NewReadBucket(bufmoduletesting.TestDataWithConfigurationAndFallbackDocumentationPath) + require.NoError(t, err) + module, err := bufmodule.NewModuleForBucket(context.Background(), readBucket) + require.NoError(t, err) + digest, err := bufmodule.ModuleDigestB3(context.Background(), module) + require.NoError(t, err) + require.Equal(t, bufmoduletesting.TestDigestB3WithConfigurationAndFallbackDocumentationPath, digest) +} + +func TestModuleDigestB3WithLicense(t *testing.T) { + t.Parallel() + readBucket, err := storagemem.NewReadBucket(bufmoduletesting.TestDataWithLicense) + require.NoError(t, err) + module, err := bufmodule.NewModuleForBucket(context.Background(), readBucket) + require.NoError(t, err) + digest, err := bufmodule.ModuleDigestB3(context.Background(), module) + require.NoError(t, err) + require.Equal(t, bufmoduletesting.TestDigestB3WithLicense, digest) +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_unix.go b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_unix.go new file mode 100644 index 000000000..3255150a9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_unix.go @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matching the unix-like build tags in the Golang standard library based on the dependency +// on "path/filepath", i.e. https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/path/filepath/path_unix.go;l=5-6 + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package bufmoduletesting + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/stretchr/testify/require" +) + +// NewFileInfo returns a new FileInfo for testing. +func NewFileInfo( + t *testing.T, + path string, + externalPath string, + isImport bool, + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, +) bufmoduleref.FileInfo { + fileInfo, err := bufmoduleref.NewFileInfo( + path, + externalPath, + isImport, + moduleIdentity, + commit, + ) + require.NoError(t, err) + return fileInfo +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_windows.go b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_windows.go new file mode 100644 index 000000000..e885acb47 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/bufmoduletesting_windows.go @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package bufmoduletesting + +import ( + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/stretchr/testify/require" +) + +// NewFileInfo returns a new FileInfo for testing. +func NewFileInfo( + t *testing.T, + path string, + externalPath string, + isImport bool, + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, +) bufmoduleref.FileInfo { + fileInfo, err := bufmoduleref.NewFileInfo( + path, + filepath.Clean(filepath.FromSlash(externalPath)), + isImport, + moduleIdentity, + commit, + ) + require.NoError(t, err) + return fileInfo +} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/test_module_reader.go b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/test_module_reader.go new file mode 100644 index 000000000..b42bab590 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/bufmoduletesting/test_module_reader.go @@ -0,0 +1,42 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmoduletesting + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +type testModuleReader struct { + moduleIdentityStringToModule map[string]bufmodule.Module +} + +func newTestModuleReader(moduleIdentityStringToModule map[string]bufmodule.Module) *testModuleReader { + return &testModuleReader{ + moduleIdentityStringToModule: moduleIdentityStringToModule, + } +} + +func (r *testModuleReader) GetModule(ctx context.Context, modulePin bufmoduleref.ModulePin) (bufmodule.Module, error) { + module, ok := r.moduleIdentityStringToModule[modulePin.IdentityString()] + if !ok { + return nil, storage.NewErrNotExist(modulePin.String()) + } + return module, nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/internal/internal.go b/pkg/bufman/bufpkg/bufmodule/internal/internal.go new file mode 100644 index 000000000..d3e2b3a25 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/internal/internal.go @@ -0,0 +1,87 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "fmt" + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +// NormalizeAndCheckPaths verifies that: +// +// - No paths are empty. +// - All paths are normalized and validated if pathType is Relative. +// - All paths are normalized if pathType is Absolute. +// +// If sortAndCheckDuplicates is true: + +// - All paths are unique. +// - No path contains another path. +// +// Normalizes the paths. +// Sorts the paths if sortAndCheckDuplicates is true. +// Makes the paths absolute if pathType is Absolute. +func NormalizeAndCheckPaths( + paths []string, + name string, + pathType normalpath.PathType, + sortAndCheckDuplicates bool, +) ([]string, error) { + if len(paths) == 0 { + return paths, nil + } + outputs := make([]string, len(paths)) + for i, path := range paths { + if path == "" { + return nil, fmt.Errorf("%s contained an empty path", name) + } + output, err := normalpath.NormalizeAndTransformForPathType(path, pathType) + if err != nil { + // user error + return nil, err + } + outputs[i] = output + } + if sortAndCheckDuplicates { + return sortAndCheckDuplicatePaths(outputs, name, pathType) + } + return outputs, nil +} + +// TODO: refactor this +func sortAndCheckDuplicatePaths(outputs []string, name string, pathType normalpath.PathType) ([]string, error) { + sort.Strings(outputs) + for i := 0; i < len(outputs); i++ { + for j := i + 1; j < len(outputs); j++ { + output1 := outputs[i] + output2 := outputs[j] + + if output1 == output2 { + return nil, fmt.Errorf("duplicate %s %q", name, output1) + } + if normalpath.EqualsOrContainsPath(output2, output1, pathType) { + return nil, fmt.Errorf("%s %q is within %s %q which is not allowed", name, output1, name, output2) + } + if normalpath.EqualsOrContainsPath(output1, output2, pathType) { + return nil, fmt.Errorf("%s %q is within %s %q which is not allowed", name, output2, name, output1) + } + } + } + + return outputs, nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/internal/internal_test.go b/pkg/bufman/bufpkg/bufmodule/internal/internal_test.go new file mode 100644 index 000000000..06e89cd46 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/internal/internal_test.go @@ -0,0 +1,309 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestNormalizeAndCheckPathsRelSuccess1(t *testing.T) { + // https://github.com/ProtobufMan/bufman-cli/issues/56 + t.Parallel() + testNormalizeAndCheckPathsRelSuccess( + t, + []string{ + "proto", + "proto-vendor", + }, + ) +} + +func TestNormalizeAndCheckPathsRelError1(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsRelError( + t, + []string{ + "/a/b", + }, + ) +} + +func TestNormalizeAndCheckPathsRelError2(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsRelError( + t, + []string{ + "a/b", + "a/b", + }, + ) +} + +func TestNormalizeAndCheckPathsRelError3(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsRelError( + t, + []string{ + "a/b", + "a/b/c", + }, + ) +} + +func TestNormalizeAndCheckPathsRelError4(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsRelError( + t, + []string{ + ".", + "a", + }, + ) +} + +func TestNormalizeAndCheckPathsRelError5(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsRelError( + t, + []string{ + "", + }, + ) +} + +func TestNormalizeAndCheckPathsRelError6(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsRelError( + t, + []string{ + "a/b", + "", + }, + ) +} + +func TestNormalizeAndCheckPathsRelEqual1(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsRelEqual( + t, + []string{ + "b", + "a/../a", + }, + []string{ + "a", + "b", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsSuccess1(t *testing.T) { + // https://github.com/ProtobufMan/bufman-cli/issues/56 + t.Parallel() + testNormalizeAndCheckPathsAbsSuccess( + t, + []string{ + "proto", + "proto-vendor", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsError1(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsAbsError( + t, + []string{ + "a/b", + "a/b", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsError2(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsAbsError( + t, + []string{ + "a/b", + "a/b/c", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsError3(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsAbsError( + t, + []string{ + ".", + "a", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsError4(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsAbsError( + t, + []string{ + "", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsError5(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsAbsError( + t, + []string{ + "a/b", + "", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsEqual1(t *testing.T) { + t.Parallel() + absA, err := filepath.Abs("a") + require.NoError(t, err) + absA = filepath.ToSlash(absA) + absB, err := filepath.Abs("b") + require.NoError(t, err) + absB = filepath.ToSlash(absB) + testNormalizeAndCheckPathsAbsEqual( + t, + []string{ + "b", + "a/../a", + }, + []string{ + absA, + absB, + }, + ) +} + +func TestNormalizeAndCheckPathsAbsSuccessAbs1(t *testing.T) { + // https://github.com/ProtobufMan/bufman-cli/issues/56 + t.Parallel() + testNormalizeAndCheckPathsAbsSuccess( + t, + []string{ + "/proto", + "/proto-vendor", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsErrorAbs1(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsAbsError( + t, + []string{ + "/a/b", + "/a/b", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsErrorAbs2(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsAbsError( + t, + []string{ + "/a/b", + "/a/b/c", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsErrorAbs3(t *testing.T) { + t.Parallel() + testNormalizeAndCheckPathsAbsError( + t, + []string{ + "/", + "/a", + }, + ) +} + +func TestNormalizeAndCheckPathsAbsEqualAbs1(t *testing.T) { + t.Parallel() + absA, err := filepath.Abs("/a") + require.NoError(t, err) + absA = filepath.ToSlash(absA) + absB, err := filepath.Abs("/b") + require.NoError(t, err) + absB = filepath.ToSlash(absB) + testNormalizeAndCheckPathsAbsEqual( + t, + []string{ + "/b", + "/a/../a", + }, + []string{ + absA, + absB, + }, + ) +} + +func testNormalizeAndCheckPathsRelSuccess(t *testing.T, paths []string) { + _, err := NormalizeAndCheckPaths(paths, "test", normalpath.Relative, true) + assert.NoError(t, err, paths) +} + +func testNormalizeAndCheckPathsRelError(t *testing.T, paths []string) { + _, err := NormalizeAndCheckPaths(paths, "test", normalpath.Relative, true) + assert.Error(t, err, paths) +} + +func testNormalizeAndCheckPathsRelEqual( + t *testing.T, + paths []string, + expected []string, +) { + actual, err := NormalizeAndCheckPaths(paths, "test", normalpath.Relative, true) + assert.NoError(t, err, paths) + assert.Equal(t, expected, actual) +} + +func testNormalizeAndCheckPathsAbsSuccess(t *testing.T, paths []string) { + _, err := NormalizeAndCheckPaths(paths, "test", normalpath.Absolute, true) + assert.NoError(t, err, paths) +} + +func testNormalizeAndCheckPathsAbsError(t *testing.T, paths []string) { + _, err := NormalizeAndCheckPaths(paths, "test", normalpath.Absolute, true) + assert.Error(t, err, paths) +} + +func testNormalizeAndCheckPathsAbsEqual( + t *testing.T, + paths []string, + expected []string, +) { + actual, err := NormalizeAndCheckPaths(paths, "test", normalpath.Absolute, true) + assert.NoError(t, err, paths) + assert.Equal(t, expected, actual) +} diff --git a/pkg/bufman/bufpkg/bufmodule/module.go b/pkg/bufman/bufpkg/bufmodule/module.go new file mode 100644 index 000000000..eb0de4964 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/module.go @@ -0,0 +1,371 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + breakingv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/breaking/v1" + lintv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/lint/v1" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" +) + +type module struct { + sourceReadBucket storage.ReadBucket + declaredDirectDependencies []bufmoduleref.ModuleReference + dependencyModulePins []bufmoduleref.ModulePin + moduleIdentity bufmoduleref.ModuleIdentity + commit string + documentation string + documentationPath string + license string + breakingConfig *bufbreakingconfig.Config + lintConfig *buflintconfig.Config + manifest *manifest.Manifest + blobSet *manifest.BlobSet +} + +func newModuleForProto( + ctx context.Context, + protoModule *modulev1alpha1.Module, + options ...ModuleOption, +) (*module, error) { + if err := ValidateProtoModule(protoModule); err != nil { + return nil, err + } + // We store this as a ReadBucket as this should never be modified outside of this function. + readWriteBucket := storagemem.NewReadWriteBucket() + for _, moduleFile := range protoModule.Files { + if normalpath.Ext(moduleFile.Path) != ".proto" { + return nil, fmt.Errorf("expected .proto file but got %q", moduleFile) + } + // we already know that paths are unique from validation + if err := storage.PutPath(ctx, readWriteBucket, moduleFile.Path, moduleFile.Content); err != nil { + return nil, err + } + } + dependencyModulePins, err := bufmoduleref.NewModulePinsForProtos(protoModule.Dependencies...) + if err != nil { + return nil, err + } + breakingConfig, lintConfig, err := configsForProto(protoModule.GetBreakingConfig(), protoModule.GetLintConfig()) + if err != nil { + return nil, err + } + allDependenciesRefs := make([]bufmoduleref.ModuleReference, len(dependencyModulePins)) + for i, dep := range dependencyModulePins { + allDependenciesRefs[i], err = bufmoduleref.NewModuleReference( + dep.Remote(), dep.Owner(), dep.Repository(), dep.Commit(), + ) + if err != nil { + return nil, fmt.Errorf("cannot build module reference from dependency pin %s: %w", dep.String(), err) + } + } + return newModule( + ctx, + readWriteBucket, + allDependenciesRefs, // Since proto has no distinction between direct/transitive dependencies, we'll need to set them all as direct, otherwise the build will fail. + dependencyModulePins, + nil, // The module identity is not stored on the proto. We rely on the layer above, (e.g. `ModuleReader`) to set this as needed. + protoModule.GetDocumentation(), + protoModule.GetDocumentationPath(), + protoModule.GetLicense(), + breakingConfig, + lintConfig, + options..., + ) +} + +func configsForProto( + protoBreakingConfig *breakingv1.Config, + protoLintConfig *lintv1.Config, +) (*bufbreakingconfig.Config, *buflintconfig.Config, error) { + var breakingConfig *bufbreakingconfig.Config + var breakingConfigVersion string + if protoBreakingConfig != nil { + breakingConfig = bufbreakingconfig.ConfigForProto(protoBreakingConfig) + breakingConfigVersion = breakingConfig.Version + } + var lintConfig *buflintconfig.Config + var lintConfigVersion string + if protoLintConfig != nil { + lintConfig = buflintconfig.ConfigForProto(protoLintConfig) + lintConfigVersion = lintConfig.Version + } + if lintConfigVersion != breakingConfigVersion { + return nil, nil, fmt.Errorf("mismatched breaking config version %q and lint config version %q found", breakingConfigVersion, lintConfigVersion) + } + // If there is no breaking and lint configs, we want to default to the v1 version. + if breakingConfig == nil && lintConfig == nil { + breakingConfig = &bufbreakingconfig.Config{ + Version: bufconfig.V1Version, + } + lintConfig = &buflintconfig.Config{ + Version: bufconfig.V1Version, + } + } else if breakingConfig == nil { + // In the case that only breaking config is nil, we'll use generated an empty default config + // using the lint config version. + breakingConfig = &bufbreakingconfig.Config{ + Version: lintConfigVersion, + } + } else if lintConfig == nil { + // In the case that only lint config is nil, we'll use generated an empty default config + // using the breaking config version. + lintConfig = &buflintconfig.Config{ + Version: breakingConfigVersion, + } + } + // Finally, validate the config versions are valid. This should always pass in the case of + // the default values. + if err := bufconfig.ValidateVersion(breakingConfig.Version); err != nil { + return nil, nil, err + } + if err := bufconfig.ValidateVersion(lintConfig.Version); err != nil { + return nil, nil, err + } + return breakingConfig, lintConfig, nil +} + +func newModuleForBucket( + ctx context.Context, + sourceReadBucket storage.ReadBucket, + options ...ModuleOption, +) (*module, error) { + dependencyModulePins, err := bufmoduleref.DependencyModulePinsForBucket(ctx, sourceReadBucket) + if err != nil { + return nil, err + } + var documentation string + var documentationPath string + for _, docPath := range AllDocumentationPaths { + documentation, err = getFileContentForBucket(ctx, sourceReadBucket, docPath) + if err != nil { + return nil, err + } + if documentation != "" { + documentationPath = docPath + break + } + } + license, err := getFileContentForBucket(ctx, sourceReadBucket, LicenseFilePath) + if err != nil { + return nil, err + } + moduleConfig, err := bufconfig.GetConfigForBucket(ctx, sourceReadBucket) + if err != nil { + return nil, err + } + var moduleIdentity bufmoduleref.ModuleIdentity + // if the module config has an identity, set the module identity + if moduleConfig.ModuleIdentity != nil { + moduleIdentity = moduleConfig.ModuleIdentity + } + return newModule( + ctx, + storage.MapReadBucket(sourceReadBucket, storage.MatchPathExt(".proto")), + moduleConfig.Build.DependencyModuleReferences, // straight copy from the buf.yaml file + dependencyModulePins, + moduleIdentity, + documentation, + documentationPath, + license, + moduleConfig.Breaking, + moduleConfig.Lint, + options..., + ) +} + +func newModuleForManifestAndBlobSet( + ctx context.Context, + moduleManifest *manifest.Manifest, + blobSet *manifest.BlobSet, + options ...ModuleOption, +) (*module, error) { + bucket, err := manifest.NewBucket( + *moduleManifest, + *blobSet, + manifest.BucketWithAllManifestBlobsValidation(), + manifest.BucketWithNoExtraBlobsValidation(), + ) + if err != nil { + return nil, err + } + module, err := newModuleForBucket(ctx, bucket, options...) + if err != nil { + return nil, err + } + module.manifest = moduleManifest + module.blobSet = blobSet + return module, nil +} + +// this should only be called by other newModule constructors +func newModule( + ctx context.Context, + // must only contain .proto files + sourceReadBucket storage.ReadBucket, + declaredDirectDependencies []bufmoduleref.ModuleReference, + dependencyModulePins []bufmoduleref.ModulePin, + moduleIdentity bufmoduleref.ModuleIdentity, + documentation string, + documentationPath string, + license string, + breakingConfig *bufbreakingconfig.Config, + lintConfig *buflintconfig.Config, + options ...ModuleOption, +) (_ *module, retErr error) { + if err := bufmoduleref.ValidateModuleReferencesUniqueByIdentity(declaredDirectDependencies); err != nil { + return nil, err + } + if err := bufmoduleref.ValidateModulePinsUniqueByIdentity(dependencyModulePins); err != nil { + return nil, err + } + // we rely on this being sorted here + bufmoduleref.SortModuleReferences(declaredDirectDependencies) + bufmoduleref.SortModulePins(dependencyModulePins) + module := &module{ + sourceReadBucket: sourceReadBucket, + declaredDirectDependencies: declaredDirectDependencies, + dependencyModulePins: dependencyModulePins, + moduleIdentity: moduleIdentity, + documentation: documentation, + documentationPath: documentationPath, + license: license, + breakingConfig: breakingConfig, + lintConfig: lintConfig, + } + for _, option := range options { + option(module) + } + if module.moduleIdentity == nil && module.commit != "" { + return nil, fmt.Errorf("module was constructed with commit %q but no associated ModuleIdentity", module.commit) + } + return module, nil +} + +func (m *module) TargetFileInfos(ctx context.Context) ([]bufmoduleref.FileInfo, error) { + return m.SourceFileInfos(ctx) +} + +func (m *module) SourceFileInfos(ctx context.Context) ([]bufmoduleref.FileInfo, error) { + var fileInfos []bufmoduleref.FileInfo + if walkErr := m.sourceReadBucket.Walk(ctx, "", func(objectInfo storage.ObjectInfo) error { + // super overkill but ok + if err := bufmoduleref.ValidateModuleFilePath(objectInfo.Path()); err != nil { + return err + } + fileInfo, err := bufmoduleref.NewFileInfo( + objectInfo.Path(), + objectInfo.ExternalPath(), + false, + m.moduleIdentity, + m.commit, + ) + if err != nil { + return err + } + fileInfos = append(fileInfos, fileInfo) + return nil + }); walkErr != nil { + return nil, fmt.Errorf("failed to enumerate module files: %w", walkErr) + } + bufmoduleref.SortFileInfos(fileInfos) + return fileInfos, nil +} + +func (m *module) GetModuleFile(ctx context.Context, path string) (ModuleFile, error) { + // super overkill but ok + if err := bufmoduleref.ValidateModuleFilePath(path); err != nil { + return nil, err + } + readObjectCloser, err := m.sourceReadBucket.Get(ctx, path) + if err != nil { + return nil, err + } + fileInfo, err := bufmoduleref.NewFileInfo( + readObjectCloser.Path(), + readObjectCloser.ExternalPath(), + false, + m.moduleIdentity, + m.commit, + ) + if err != nil { + return nil, err + } + return newModuleFile(fileInfo, readObjectCloser), nil +} + +func (m *module) DeclaredDirectDependencies() []bufmoduleref.ModuleReference { + // already sorted in constructor + return m.declaredDirectDependencies +} + +func (m *module) DependencyModulePins() []bufmoduleref.ModulePin { + // already sorted in constructor + return m.dependencyModulePins +} + +func (m *module) Documentation() string { + return m.documentation +} + +func (m *module) DocumentationPath() string { + return m.documentationPath +} + +func (m *module) License() string { + return m.license +} + +func (m *module) BreakingConfig() *bufbreakingconfig.Config { + return m.breakingConfig +} + +func (m *module) LintConfig() *buflintconfig.Config { + return m.lintConfig +} + +func (m *module) Manifest() *manifest.Manifest { + return m.manifest +} + +func (m *module) BlobSet() *manifest.BlobSet { + return m.blobSet +} + +func (m *module) ModuleIdentity() bufmoduleref.ModuleIdentity { + return m.moduleIdentity +} + +func (m *module) Commit() string { + return m.commit +} + +func (m *module) getSourceReadBucket() storage.ReadBucket { + return m.sourceReadBucket +} + +func (m *module) isModule() {} diff --git a/pkg/bufman/bufpkg/bufmodule/module_file.go b/pkg/bufman/bufpkg/bufmodule/module_file.go new file mode 100644 index 000000000..8b715c566 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/module_file.go @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" +) + +var _ ModuleFile = &moduleFile{} + +type moduleFile struct { + bufmoduleref.FileInfo + io.ReadCloser +} + +func newModuleFile(fileInfo bufmoduleref.FileInfo, readCloser io.ReadCloser) moduleFile { + return moduleFile{ + FileInfo: fileInfo, + ReadCloser: readCloser, + } +} + +func (moduleFile) isModuleFile() {} diff --git a/pkg/bufman/bufpkg/bufmodule/module_file_set.go b/pkg/bufman/bufpkg/bufmodule/module_file_set.go new file mode 100644 index 000000000..b5f8539b1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/module_file_set.go @@ -0,0 +1,125 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +var _ ModuleFileSet = &moduleFileSet{} + +type moduleFileSet struct { + Module + + allModuleReadBucket moduleReadBucket +} + +func newModuleFileSet( + module Module, + dependencies []Module, +) *moduleFileSet { + // TODO: We can remove the getModuleRef method on the + // Module type if we fetch FileInfos from the Module + // and plumb in the ModuleRef here. + // + // This approach assumes that all of the FileInfos returned + // from SourceFileInfos will have their ModuleRef + // set to the same value. That can be enforced here. + moduleReadBuckets := []moduleReadBucket{ + newSingleModuleReadBucket( + module.getSourceReadBucket(), + module.ModuleIdentity(), + module.Commit(), + ), + } + for _, dependency := range dependencies { + moduleReadBuckets = append( + moduleReadBuckets, + newSingleModuleReadBucket( + dependency.getSourceReadBucket(), + dependency.ModuleIdentity(), + dependency.Commit(), + ), + ) + } + return &moduleFileSet{ + Module: module, + allModuleReadBucket: newMultiModuleReadBucket(moduleReadBuckets...), + } +} + +func (m *moduleFileSet) AllFileInfos(ctx context.Context) ([]bufmoduleref.FileInfo, error) { + var fileInfos []bufmoduleref.FileInfo + if walkErr := m.allModuleReadBucket.WalkModuleFiles(ctx, "", func(moduleObjectInfo *moduleObjectInfo) error { + if err := bufmoduleref.ValidateModuleFilePath(moduleObjectInfo.Path()); err != nil { + return err + } + isNotImport, err := storage.Exists(ctx, m.Module.getSourceReadBucket(), moduleObjectInfo.Path()) + if err != nil { + return err + } + fileInfo, err := bufmoduleref.NewFileInfo( + moduleObjectInfo.Path(), + moduleObjectInfo.ExternalPath(), + !isNotImport, + moduleObjectInfo.ModuleIdentity(), + moduleObjectInfo.Commit(), + ) + if err != nil { + return err + } + fileInfos = append(fileInfos, fileInfo) + return nil + }); walkErr != nil { + return nil, walkErr + } + bufmoduleref.SortFileInfos(fileInfos) + return fileInfos, nil +} + +func (m *moduleFileSet) GetModuleFile(ctx context.Context, path string) (ModuleFile, error) { + if err := bufmoduleref.ValidateModuleFilePath(path); err != nil { + return nil, err + } + readObjectCloser, err := m.allModuleReadBucket.Get(ctx, path) + if err != nil { + return nil, err + } + isNotImport, err := storage.Exists(ctx, m.Module.getSourceReadBucket(), path) + if err != nil { + return nil, err + } + moduleObjectInfo, err := m.allModuleReadBucket.StatModuleFile(ctx, path) + if err != nil { + return nil, err + } + fileInfo, err := bufmoduleref.NewFileInfo( + readObjectCloser.Path(), + readObjectCloser.ExternalPath(), + !isNotImport, + moduleObjectInfo.ModuleIdentity(), + moduleObjectInfo.Commit(), + ) + if err != nil { + return nil, err + } + return newModuleFile(fileInfo, readObjectCloser), nil +} + +func (*moduleFileSet) isModuleFileSet() {} diff --git a/pkg/bufman/bufpkg/bufmodule/module_object_info.go b/pkg/bufman/bufpkg/bufmodule/module_object_info.go new file mode 100644 index 000000000..de005131d --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/module_object_info.go @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +// moduleObjectInfo is used in moduleReadBucket. +type moduleObjectInfo struct { + storage.ObjectInfo + + moduleIdentity bufmoduleref.ModuleIdentity + commit string +} + +func newModuleObjectInfo( + storageObjectInfo storage.ObjectInfo, + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, +) *moduleObjectInfo { + return &moduleObjectInfo{ + ObjectInfo: storageObjectInfo, + moduleIdentity: moduleIdentity, + commit: commit, + } +} + +func (o *moduleObjectInfo) ModuleIdentity() bufmoduleref.ModuleIdentity { + return o.moduleIdentity +} + +func (o *moduleObjectInfo) Commit() string { + return o.commit +} diff --git a/pkg/bufman/bufpkg/bufmodule/module_read_bucket.go b/pkg/bufman/bufpkg/bufmodule/module_read_bucket.go new file mode 100644 index 000000000..dd84a1848 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/module_read_bucket.go @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +// moduleReadBucket is a ReadBucket that has associated module information. +// +// this is a helper type used in moduleFileSet. +type moduleReadBucket interface { + storage.ReadBucket + + // StatModuleFile gets info in the object, including info + // specific to the file's module. + StatModuleFile(ctx context.Context, path string) (*moduleObjectInfo, error) + // WalkModuleFiles walks the bucket with the prefix, calling f on + // each path. If the prefix doesn't exist, this is a no-op. + WalkModuleFiles(ctx context.Context, path string, f func(*moduleObjectInfo) error) error +} diff --git a/pkg/bufman/bufpkg/bufmodule/module_test.go b/pkg/bufman/bufpkg/bufmodule/module_test.go new file mode 100644 index 000000000..05e4982dd --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/module_test.go @@ -0,0 +1,137 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule_test + +import ( + "bytes" + "context" + "fmt" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestNewModuleForBucket(t *testing.T) { + t.Parallel() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + nullDigest, err := digester.Digest(&bytes.Buffer{}) + require.NoError(t, err) + testNewModuleForBucket(t, + "an empty bucket is a valid parse", + map[string][]byte{}, + false, + false, + []bufmoduleref.ModulePin{}, + "", + "", + ) + + wantPin, err := bufmoduleref.NewModulePin( + "foo", + "bar", + "baz", + "", + "62f35d8aed1149c291d606d958a7ce32", + nullDigest.String(), + time.Time{}, + ) + require.NoError(t, err) + testNewModuleForBucket(t, + "pins are consumed", + map[string][]byte{ + "buf.lock": []byte(fmt.Sprintf(` +version: v1 +deps: + - remote: foo + owner: bar + repository: baz + commit: 62f35d8aed1149c291d606d958a7ce32 + digest: %s +`, nullDigest)), + }, + false, + false, + []bufmoduleref.ModulePin{wantPin}, + "", + "", + ) + + testNewModuleForBucket(t, + "license and documentation are consumed", + map[string][]byte{ + bufmoduletesting.TestModuleDocumentationPath: []byte("foo"), + "LICENSE": []byte("bar"), + }, + false, + false, + []bufmoduleref.ModulePin{}, + "foo", + "bar", + ) + + testNewModuleForBucket(t, + "invalid buf.lock", + map[string][]byte{ + "buf.lock": []byte("version: v0"), + }, + true, + false, + []bufmoduleref.ModulePin{}, + "", + "", + ) +} + +func testNewModuleForBucket( + t *testing.T, + desc string, + files map[string][]byte, + isError bool, + isNil bool, + pins []bufmoduleref.ModulePin, + documentation string, + license string, +) { + t.Run(desc, func(t *testing.T) { + t.Parallel() + ctx := context.Background() + bucket, err := storagemem.NewReadBucket(files) + require.NoError(t, err) + module, err := bufmodule.NewModuleForBucket(ctx, bucket) + if isError { + assert.Error(t, err, "isError") + return + } + require.NoError(t, err) + if isNil { + assert.Nil(t, module, "isNil") + return + } + require.NotNil(t, module, "!isNil") + + assert.Equal(t, pins, module.DependencyModulePins(), "pins") + assert.Equal(t, documentation, module.Documentation(), "documentation") + assert.Equal(t, license, module.License(), "license") + }) +} diff --git a/pkg/bufman/bufpkg/bufmodule/multi_module_read_bucket.go b/pkg/bufman/bufpkg/bufmodule/multi_module_read_bucket.go new file mode 100644 index 000000000..3384562b9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/multi_module_read_bucket.go @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +type multiModuleReadBucket struct { + storage.ReadBucket + + delegates []moduleReadBucket +} + +func newMultiModuleReadBucket( + delegates ...moduleReadBucket, +) *multiModuleReadBucket { + storageReadBuckets := make([]storage.ReadBucket, len(delegates)) + for i, delegate := range delegates { + storageReadBuckets[i] = delegate + } + return &multiModuleReadBucket{ + ReadBucket: storage.MultiReadBucket(storageReadBuckets...), + delegates: delegates, + } +} + +func (m *multiModuleReadBucket) StatModuleFile(ctx context.Context, path string) (*moduleObjectInfo, error) { + for _, delegate := range m.delegates { + objectInfo, err := delegate.StatModuleFile(ctx, path) + if err != nil { + if storage.IsNotExist(err) { + continue + } + return nil, err + } + return objectInfo, nil + } + return nil, storage.NewErrNotExist(path) +} + +func (m *multiModuleReadBucket) WalkModuleFiles(ctx context.Context, prefix string, f func(*moduleObjectInfo) error) error { + for _, delegate := range m.delegates { + if err := delegate.WalkModuleFiles(ctx, prefix, f); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/nop_module_reader.go b/pkg/bufman/bufpkg/bufmodule/nop_module_reader.go new file mode 100644 index 000000000..1812d8882 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/nop_module_reader.go @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +type nopModuleReader struct{} + +func newNopModuleReader() *nopModuleReader { + return &nopModuleReader{} +} + +func (*nopModuleReader) GetModule(_ context.Context, modulePin bufmoduleref.ModulePin) (Module, error) { + return nil, storage.NewErrNotExist(modulePin.String()) +} diff --git a/pkg/bufman/bufpkg/bufmodule/nop_module_resolver.go b/pkg/bufman/bufpkg/bufmodule/nop_module_resolver.go new file mode 100644 index 000000000..abf5de622 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/nop_module_resolver.go @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +type nopModuleResolver struct{} + +func newNopModuleResolver() *nopModuleResolver { + return &nopModuleResolver{} +} + +func (*nopModuleResolver) GetModulePin(_ context.Context, moduleReference bufmoduleref.ModuleReference) (bufmoduleref.ModulePin, error) { + return nil, storage.NewErrNotExist(moduleReference.String()) +} diff --git a/pkg/bufman/bufpkg/bufmodule/single_module_read_bucket.go b/pkg/bufman/bufpkg/bufmodule/single_module_read_bucket.go new file mode 100644 index 000000000..fe99a04f9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/single_module_read_bucket.go @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +type singleModuleReadBucket struct { + storage.ReadBucket + + moduleIdentity bufmoduleref.ModuleIdentity + commit string +} + +func newSingleModuleReadBucket( + sourceReadBucket storage.ReadBucket, + moduleIdentity bufmoduleref.ModuleIdentity, + commit string, +) *singleModuleReadBucket { + return &singleModuleReadBucket{ + ReadBucket: sourceReadBucket, + moduleIdentity: moduleIdentity, + commit: commit, + } +} + +func (r *singleModuleReadBucket) StatModuleFile(ctx context.Context, path string) (*moduleObjectInfo, error) { + objectInfo, err := r.ReadBucket.Stat(ctx, path) + if err != nil { + return nil, err + } + return newModuleObjectInfo(objectInfo, r.moduleIdentity, r.commit), nil +} + +func (r *singleModuleReadBucket) WalkModuleFiles(ctx context.Context, path string, f func(*moduleObjectInfo) error) error { + return r.ReadBucket.Walk( + ctx, + path, + func(objectInfo storage.ObjectInfo) error { + return f(newModuleObjectInfo(objectInfo, r.moduleIdentity, r.commit)) + }, + ) +} diff --git a/pkg/bufman/bufpkg/bufmodule/targeting_module.go b/pkg/bufman/bufpkg/bufmodule/targeting_module.go new file mode 100644 index 000000000..4a51657b8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/targeting_module.go @@ -0,0 +1,249 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +type targetingModule struct { + Module + targetPaths []string + pathsAllowNotExistOnWalk bool + excludePaths []string +} + +func newTargetingModule( + delegate Module, + targetPaths []string, + excludePaths []string, + pathsAllowNotExistOnWalk bool, +) (*targetingModule, error) { + if err := normalpath.ValidatePathsNormalizedValidatedUnique(targetPaths); err != nil { + return nil, err + } + return &targetingModule{ + Module: delegate, + targetPaths: targetPaths, + pathsAllowNotExistOnWalk: pathsAllowNotExistOnWalk, + excludePaths: excludePaths, + }, nil +} + +func (m *targetingModule) TargetFileInfos(ctx context.Context) (fileInfos []bufmoduleref.FileInfo, retErr error) { + defer func() { + if retErr == nil { + bufmoduleref.SortFileInfos(fileInfos) + } + }() + excludePathMap := stringutil.SliceToMap(m.excludePaths) + // We start by ensuring that no paths have been duplicated between target and exclude pathes. + for _, targetPath := range m.targetPaths { + if _, ok := excludePathMap[targetPath]; ok { + return nil, fmt.Errorf( + "cannot set the same path for both --path and --exclude-path flags: %s", + normalpath.Unnormalize(targetPath), + ) + } + } + sourceReadBucket := m.getSourceReadBucket() + // potentialDirPaths are paths that we need to check if they are directories. + // These are any files that do not end in .proto, as well as files that end in .proto, but + // do not have a corresponding file in the source ReadBucket. + // If there is not an file the path ending in .proto could be a directory + // that itself contains files, i.e. a/b.proto/c.proto is valid. + var potentialDirPaths []string + // fileInfoPaths are the paths that are files, so we return them as a separate set. + fileInfoPaths := make(map[string]struct{}) + // If m.targetPaths == nil then we are accepting all paths and we only need to filter on + // the excluded paths. + // + // In the event that we do have target paths, we need first gather up all the target paths + // that are proto files. If all target paths proto files, we can return them first. + if m.targetPaths != nil { + for _, targetPath := range m.targetPaths { + if normalpath.Ext(targetPath) != ".proto" { + // not a .proto file, therefore must be a directory + potentialDirPaths = append(potentialDirPaths, targetPath) + } else { + objectInfo, err := sourceReadBucket.Stat(ctx, targetPath) + if err != nil { + if !storage.IsNotExist(err) { + return nil, err + } + // we do not have a file, so even though this path ends + // in .proto, this could be a directory - we need to check it + potentialDirPaths = append(potentialDirPaths, targetPath) + } else { + // Since all of these are specific files to include, and we've already checked + // for duplicated excludes, we know that this file is not excluded. + // We have a file, therefore the targetPath was a file path + // add to the nonImportImageFiles if does not already exist + if _, ok := fileInfoPaths[targetPath]; !ok { + fileInfoPaths[targetPath] = struct{}{} + fileInfo, err := bufmoduleref.NewFileInfo( + objectInfo.Path(), + objectInfo.ExternalPath(), + false, + m.Module.ModuleIdentity(), + m.Module.Commit(), + ) + if err != nil { + return nil, err + } + fileInfos = append(fileInfos, fileInfo) + } + } + } + } + if len(potentialDirPaths) == 0 { + // We had no potential directory paths as we were able to get + // an file for all targetPaths, so we can return the FileInfos now + // this means we do not have to do the expensive O(sourceReadBucketSize) operation + // to check to see if each file is within a potential directory path. + if !m.pathsAllowNotExistOnWalk { + foundPathSentinelError := errors.New("sentinel") + for _, excludePath := range m.excludePaths { + var foundPath bool + if walkErr := sourceReadBucket.Walk( + ctx, + "", + func(objectInfo storage.ObjectInfo) error { + if normalpath.EqualsOrContainsPath(excludePath, objectInfo.Path(), normalpath.Relative) { + foundPath = true + // We return early using the sentinel error here, since we don't need to do + // the rest of the walk if the path is found. + return foundPathSentinelError + } + return nil + }, + ); walkErr != nil && !errors.Is(walkErr, foundPathSentinelError) { + return nil, walkErr + } + if !foundPath { + return nil, fmt.Errorf("path %q has no matching file in the image", excludePath) + } + } + } + return fileInfos, nil + } + } + // We have potential directory paths, do the expensive operation to + // make a map of the directory paths. + potentialDirPathMap := stringutil.SliceToMap(potentialDirPaths) + // The map of paths within potentialDirPath that matches a file. + // This needs to contain all paths in potentialDirPathMap at the end for us to + // have had matches for every targetPath input. + matchingPotentialDirPathMap := make(map[string]struct{}) + // The map of exclude paths that have a match on the walk. This is used to check against + // pathsAllowNotExistOnWalk. + matchingExcludePaths := make(map[string]struct{}) + if walkErr := sourceReadBucket.Walk( + ctx, + "", + func(objectInfo storage.ObjectInfo) error { + path := objectInfo.Path() + fileMatchingExcludePathMap := normalpath.MapAllEqualOrContainingPathMap( + excludePathMap, + path, + normalpath.Relative, + ) + for excludeMatchingPath := range fileMatchingExcludePathMap { + if _, ok := matchingExcludePaths[excludeMatchingPath]; !ok { + matchingExcludePaths[excludeMatchingPath] = struct{}{} + } + } + // get the paths in potentialDirPathMap that match this path + fileMatchingPathMap := normalpath.MapAllEqualOrContainingPathMap( + potentialDirPathMap, + path, + normalpath.Relative, + ) + if shouldExcludeFile(fileMatchingPathMap, fileMatchingExcludePathMap) { + return nil + } + if m.targetPaths != nil { + // We had a match, this means that some path in potentialDirPaths matched + // the path, add all the paths in potentialDirPathMap that + // matched to matchingPotentialDirPathMap. + for key := range fileMatchingPathMap { + matchingPotentialDirPathMap[key] = struct{}{} + } + } + // then, add the file if it is not added + if _, ok := fileInfoPaths[path]; !ok { + fileInfoPaths[path] = struct{}{} + fileInfo, err := bufmoduleref.NewFileInfo( + objectInfo.Path(), + objectInfo.ExternalPath(), + false, + m.Module.ModuleIdentity(), + m.Module.Commit(), + ) + if err != nil { + return err + } + fileInfos = append(fileInfos, fileInfo) + } + return nil + }, + ); walkErr != nil { + return nil, walkErr + } + // if !allowNotExist, i.e. if all targetPaths must have a matching file, + // we check the matchingPotentialDirPathMap against the potentialDirPathMap + // to make sure that potentialDirPathMap is covered + if !m.pathsAllowNotExistOnWalk { + for potentialDirPath := range potentialDirPathMap { + if _, ok := matchingPotentialDirPathMap[potentialDirPath]; !ok { + // no match, this is an error given that allowNotExist is false + return nil, fmt.Errorf("path %q has no matching file in the module", potentialDirPath) + } + } + for excludePath := range excludePathMap { + if _, ok := matchingExcludePaths[excludePath]; !ok { + // no match, this is an error given that allowNotExist is false + return nil, fmt.Errorf("path %q has no matching file in the module", excludePath) + } + } + } + return fileInfos, nil +} + +func shouldExcludeFile( + fileMatchingPathMap map[string]struct{}, + fileMatchingExcludePathMap map[string]struct{}, +) bool { + if fileMatchingPathMap == nil { + return len(fileMatchingExcludePathMap) > 0 + } + for fileMatchingPath := range fileMatchingPathMap { + for fileMatchingExcludePath := range fileMatchingExcludePathMap { + if normalpath.EqualsOrContainsPath(fileMatchingPath, fileMatchingExcludePath, normalpath.Relative) { + delete(fileMatchingPathMap, fileMatchingPath) + continue + } + } + } + return len(fileMatchingPathMap) == 0 +} diff --git a/pkg/bufman/bufpkg/bufmodule/targeting_module_test.go b/pkg/bufman/bufpkg/bufmodule/targeting_module_test.go new file mode 100644 index 000000000..1ce786213 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/targeting_module_test.go @@ -0,0 +1,236 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule_test + +import ( + "context" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestTargetingModuleBasic(t *testing.T) { + t.Parallel() + ctx := context.Background() + module, err := bufmodule.NewModuleForProto( + ctx, + &modulev1alpha1.Module{ + Files: []*modulev1alpha1.ModuleFile{ + { + Path: "a/a.proto", + Content: []byte(`syntax = "proto3"; package a;`), + }, + { + Path: "a/b.proto", + Content: []byte(`syntax = "proto3"; package a;`), + }, + { + Path: "b/a.proto", + Content: []byte(`syntax = "proto3"; package b; import "a/a.proto";`), + }, + { + Path: "b/b.proto", + Content: []byte(`syntax = "proto3"; package b; import "a/b.proto";`), + }, + { + Path: "c/c.proto/a.proto", + Content: []byte(`syntax = "proto3"; package c; import "b/a.proto";`), + }, + { + Path: "c/c.proto/b.proto", + Content: []byte(`syntax = "proto3"; package c; import "b/b.proto";`), + }, + }, + }, + ) + require.NoError(t, err) + + fileInfos, err := module.SourceFileInfos(ctx) + require.NoError(t, err) + assert.Equal( + t, + []bufmoduleref.FileInfo{ + bufmoduletesting.NewFileInfo(t, "a/a.proto", "a/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/b.proto", "a/b.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/a.proto", "b/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/b.proto", "b/b.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "c/c.proto/a.proto", "c/c.proto/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "c/c.proto/b.proto", "c/c.proto/b.proto", false, nil, ""), + }, + fileInfos, + ) + + targetModule, err := bufmodule.ModuleWithTargetPaths( + module, + []string{ + "b/a.proto", + "b/b.proto", + }, + nil, + ) + require.NoError(t, err) + targetFileInfos, err := targetModule.TargetFileInfos(ctx) + require.NoError(t, err) + assert.Equal( + t, + []bufmoduleref.FileInfo{ + bufmoduletesting.NewFileInfo(t, "b/a.proto", "b/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/b.proto", "b/b.proto", false, nil, ""), + }, + targetFileInfos, + false, + ) + + targetModule, err = bufmodule.ModuleWithTargetPaths( + module, + []string{ + "b", + }, + nil, + ) + require.NoError(t, err) + targetFileInfos, err = targetModule.TargetFileInfos(ctx) + require.NoError(t, err) + assert.Equal( + t, + []bufmoduleref.FileInfo{ + bufmoduletesting.NewFileInfo(t, "b/a.proto", "b/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/b.proto", "b/b.proto", false, nil, ""), + }, + targetFileInfos, + ) + + targetModule, err = bufmodule.ModuleWithTargetPaths( + module, + []string{ + "b", + "b/a.proto", + }, + nil, + ) + require.NoError(t, err) + targetFileInfos, err = targetModule.TargetFileInfos(ctx) + require.NoError(t, err) + assert.Equal( + t, + []bufmoduleref.FileInfo{ + bufmoduletesting.NewFileInfo(t, "b/a.proto", "b/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/b.proto", "b/b.proto", false, nil, ""), + }, + targetFileInfos, + ) + + targetModule, err = bufmodule.ModuleWithTargetPaths( + module, + []string{ + "b", + "a", + }, + nil, + ) + require.NoError(t, err) + targetFileInfos, err = targetModule.TargetFileInfos(ctx) + require.NoError(t, err) + assert.Equal( + t, + []bufmoduleref.FileInfo{ + bufmoduletesting.NewFileInfo(t, "a/a.proto", "a/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "a/b.proto", "a/b.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/a.proto", "b/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/b.proto", "b/b.proto", false, nil, ""), + }, + targetFileInfos, + ) + + targetModule, err = bufmodule.ModuleWithTargetPaths( + module, + []string{ + "b", + // the directory is c/c.proto, not c.proto + "c.proto", + }, + nil, + ) + require.NoError(t, err) + _, err = targetModule.TargetFileInfos(ctx) + require.Error(t, err) + + targetModule, err = bufmodule.ModuleWithTargetPathsAllowNotExist( + module, + []string{ + "b", + // the directory is c/c.proto, not c.proto + "c.proto", + }, + nil, + ) + require.NoError(t, err) + targetFileInfos, err = targetModule.TargetFileInfos(ctx) + require.NoError(t, err) + assert.Equal( + t, + []bufmoduleref.FileInfo{ + bufmoduletesting.NewFileInfo(t, "b/a.proto", "b/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/b.proto", "b/b.proto", false, nil, ""), + }, + targetFileInfos, + ) + + targetModule, err = bufmodule.ModuleWithTargetPaths( + module, + []string{ + "b", + "c/c.proto", + }, + nil, + ) + require.NoError(t, err) + targetFileInfos, err = targetModule.TargetFileInfos(ctx) + require.NoError(t, err) + assert.Equal( + t, + []bufmoduleref.FileInfo{ + bufmoduletesting.NewFileInfo(t, "b/a.proto", "b/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "b/b.proto", "b/b.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "c/c.proto/a.proto", "c/c.proto/a.proto", false, nil, ""), + bufmoduletesting.NewFileInfo(t, "c/c.proto/b.proto", "c/c.proto/b.proto", false, nil, ""), + }, + targetFileInfos, + ) + + targetModule, err = bufmodule.ModuleWithTargetPaths( + module, + []string{ + "c/c.proto/a.proto", + }, + nil, + ) + require.NoError(t, err) + targetFileInfos, err = targetModule.TargetFileInfos(ctx) + require.NoError(t, err) + assert.Equal( + t, + []bufmoduleref.FileInfo{ + bufmoduletesting.NewFileInfo(t, "c/c.proto/a.proto", "c/c.proto/a.proto", false, nil, ""), + }, + targetFileInfos, + ) +} diff --git a/pkg/bufman/bufpkg/bufmodule/util.go b/pkg/bufman/bufpkg/bufmodule/util.go new file mode 100644 index 000000000..33c750050 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/util.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + "io" + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "go.uber.org/multierr" +) + +func putModuleFileToBucket(ctx context.Context, module Module, path string, writeBucket storage.WriteBucket) (retErr error) { + moduleFile, err := module.GetModuleFile(ctx, path) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, moduleFile.Close()) + }() + var copyOptions []storage.CopyOption + if writeBucket.SetExternalPathSupported() { + copyOptions = append(copyOptions, storage.CopyWithExternalPaths()) + } + return storage.CopyReadObject(ctx, writeBucket, moduleFile, copyOptions...) +} + +func moduleFileToProto(ctx context.Context, module Module, path string) (_ *modulev1alpha1.ModuleFile, retErr error) { + protoModuleFile := &modulev1alpha1.ModuleFile{ + Path: path, + } + moduleFile, err := module.GetModuleFile(ctx, path) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, moduleFile.Close()) + }() + protoModuleFile.Content, err = io.ReadAll(moduleFile) + if err != nil { + return nil, err + } + return protoModuleFile, nil +} + +func getFileContentForBucket( + ctx context.Context, + readBucket storage.ReadBucket, + path string, +) (string, error) { + data, err := storage.ReadPath(ctx, readBucket, path) + if err != nil { + if storage.IsNotExist(err) { + return "", nil + } + return "", err + } + return string(data), nil +} + +func copyModulePinsSortedByOnlyCommit(modulePins []bufmoduleref.ModulePin) []bufmoduleref.ModulePin { + s := make([]bufmoduleref.ModulePin, len(modulePins)) + copy(s, modulePins) + sort.Slice(s, func(i, j int) bool { + return modulePinLessOnlyCommit(s[i], s[j]) + }) + return s +} + +func modulePinLessOnlyCommit(a bufmoduleref.ModulePin, b bufmoduleref.ModulePin) bool { + return modulePinCompareToOnlyCommit(a, b) < 0 +} + +// return -1 if less +// return 1 if greater +// return 0 if equal +func modulePinCompareToOnlyCommit(a bufmoduleref.ModulePin, b bufmoduleref.ModulePin) int { + if a == nil && b == nil { + return 0 + } + if a == nil && b != nil { + return -1 + } + if a != nil && b == nil { + return 1 + } + if a.Remote() < b.Remote() { + return -1 + } + if a.Remote() > b.Remote() { + return 1 + } + if a.Owner() < b.Owner() { + return -1 + } + if a.Owner() > b.Owner() { + return 1 + } + if a.Repository() < b.Repository() { + return -1 + } + if a.Repository() > b.Repository() { + return 1 + } + if a.Commit() < b.Commit() { + return -1 + } + if a.Commit() > b.Commit() { + return 1 + } + return 0 +} diff --git a/pkg/bufman/bufpkg/bufmodule/validate.go b/pkg/bufman/bufpkg/bufmodule/validate.go new file mode 100644 index 000000000..94aaa1592 --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/validate.go @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" +) + +const ( + // 32MB + maxModuleTotalContentLength = 32 << 20 + protoFileMaxCount = 16384 +) + +// ValidateProtoModule verifies the given module is well-formed. +// It performs client-side validation only, and is limited to fields +// we do not think will change in the future. +func ValidateProtoModule(protoModule *modulev1alpha1.Module) error { + if protoModule == nil { + return errors.New("module is required") + } + if len(protoModule.Files) == 0 { + return errors.New("module has no files") + } + if len(protoModule.Files) > protoFileMaxCount { + return fmt.Errorf("module can contain at most %d files", protoFileMaxCount) + } + totalContentLength := 0 + filePathMap := make(map[string]struct{}, len(protoModule.Files)) + for _, protoModuleFile := range protoModule.Files { + if err := bufmoduleref.ValidateModuleFilePath(protoModuleFile.Path); err != nil { + return err + } + if _, ok := filePathMap[protoModuleFile.Path]; ok { + return fmt.Errorf("duplicate module file path: %s", protoModuleFile.Path) + } + filePathMap[protoModuleFile.Path] = struct{}{} + totalContentLength += len(protoModuleFile.Content) + } + if totalContentLength > maxModuleTotalContentLength { + return fmt.Errorf("total module content length is %d when max is %d", totalContentLength, maxModuleTotalContentLength) + } + for _, dependency := range protoModule.Dependencies { + if err := bufmoduleref.ValidateProtoModulePin(dependency); err != nil { + return fmt.Errorf("module had invalid dependency: %v", err) + } + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufmodule/workspace.go b/pkg/bufman/bufpkg/bufmodule/workspace.go new file mode 100644 index 000000000..f7384f52a --- /dev/null +++ b/pkg/bufman/bufpkg/bufmodule/workspace.go @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufmodule + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +type workspace struct { + // bufmoduleref.ModuleIdentity -> bufmodule.Module + namedModules map[string]Module + allModules []Module +} + +func newWorkspace( + ctx context.Context, + namedModules map[string]Module, + allModules []Module, +) (*workspace, error) { + pathToExternalPaths := make(map[string][]string) + for _, module := range allModules { + fileInfos, err := module.SourceFileInfos(ctx) + if err != nil { + return nil, err + } + for _, fileInfo := range fileInfos { + pathToExternalPaths[fileInfo.Path()] = append(pathToExternalPaths[fileInfo.Path()], fileInfo.ExternalPath()) + } + } + for path, externalPaths := range pathToExternalPaths { + // Will be >1 even if the externalPaths are equal, we mostly care ab0out the count + if len(externalPaths) > 1 { + return nil, storage.NewErrExistsMultipleLocations(path, externalPaths...) + } + } + return &workspace{ + namedModules: namedModules, + allModules: allModules, + }, nil +} + +func (w *workspace) GetModule(moduleIdentity bufmoduleref.ModuleIdentity) (Module, bool) { + module, ok := w.namedModules[moduleIdentity.IdentityString()] + return module, ok +} + +func (w *workspace) GetModules() []Module { + return w.allModules +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugin.go b/pkg/bufman/bufpkg/bufplugin/bufplugin.go new file mode 100644 index 000000000..6c1edd32a --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufplugin.go @@ -0,0 +1,503 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufplugin + +import ( + "fmt" + "sort" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginref" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" +) + +// Plugin represents a plugin defined by a buf.plugin.yaml. +type Plugin interface { + // Version is the version of the plugin's implementation + // (e.g. the protoc-gen-connect-go implementation is v0.2.0). + Version() string + // SourceURL is an optional attribute used to specify where the source + // for the plugin can be found. + SourceURL() string + // Description is an optional attribute to provide a more detailed + // description for the plugin. + Description() string + // Dependencies are the dependencies this plugin has on other plugins. + // + // An example of a dependency might be a 'protoc-gen-go-grpc' plugin + // which depends on the 'protoc-gen-go' generated code. + Dependencies() []bufpluginref.PluginReference + // Registry is the registry configuration, which lets the user specify + // registry dependencies, and other metadata that applies to a specific + // remote generation registry (e.g. the Go module proxy, NPM registry, + // etc). + Registry() *bufpluginconfig.RegistryConfig + // ContainerImageDigest returns the plugin's source image digest. + // + // For now, we only support docker image sources, but this + // might evolve to support others later on. + ContainerImageDigest() string +} + +// NewPlugin creates a new plugin from the given configuration and image digest. +func NewPlugin( + version string, + dependencies []bufpluginref.PluginReference, + registryConfig *bufpluginconfig.RegistryConfig, + imageDigest string, + sourceURL string, + description string, +) (Plugin, error) { + return newPlugin(version, dependencies, registryConfig, imageDigest, sourceURL, description) +} + +// PluginToProtoPluginRegistryType determines the appropriate registryv1alpha1.PluginRegistryType for the plugin. +func PluginToProtoPluginRegistryType(plugin Plugin) registryv1alpha1.PluginRegistryType { + registryType := registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_UNSPECIFIED + if plugin.Registry() != nil { + if plugin.Registry().Go != nil { + registryType = registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_GO + } else if plugin.Registry().NPM != nil { + registryType = registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_NPM + } else if plugin.Registry().Maven != nil { + registryType = registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_MAVEN + } else if plugin.Registry().Swift != nil { + registryType = registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_SWIFT + } + } + return registryType +} + +// OutputLanguagesToProtoLanguages determines the appropriate registryv1alpha1.PluginRegistryType for the plugin. +func OutputLanguagesToProtoLanguages(languages []string) ([]registryv1alpha1.PluginLanguage, error) { + languageToEnum := make(map[string]registryv1alpha1.PluginLanguage) + var supportedLanguages []string + for pluginLanguageKey, pluginLanguage := range registryv1alpha1.PluginLanguage_value { + if pluginLanguage == 0 { + continue + } + pluginLanguageKey := strings.TrimPrefix(pluginLanguageKey, "PLUGIN_LANGUAGE_") + pluginLanguageKey = strings.ToLower(pluginLanguageKey) + // Example: + // { go: 1, javascript: 2 } + languageToEnum[pluginLanguageKey] = registryv1alpha1.PluginLanguage(pluginLanguage) + supportedLanguages = append(supportedLanguages, pluginLanguageKey) + } + sort.Strings(supportedLanguages) + var protoLanguages []registryv1alpha1.PluginLanguage + for _, language := range languages { + if pluginLanguage, ok := languageToEnum[language]; ok { + protoLanguages = append(protoLanguages, pluginLanguage) + continue + } + return nil, fmt.Errorf("invalid plugin output language: %q\nsupported languages: %s", language, strings.Join(supportedLanguages, ", ")) + } + sort.Slice(protoLanguages, func(i, j int) bool { + return protoLanguages[i] < protoLanguages[j] + }) + return protoLanguages, nil +} + +// PluginRegistryToProtoRegistryConfig converts a bufpluginconfig.RegistryConfig to a registryv1alpha1.RegistryConfig. +func PluginRegistryToProtoRegistryConfig(pluginRegistry *bufpluginconfig.RegistryConfig) (*registryv1alpha1.RegistryConfig, error) { + if pluginRegistry == nil { + return nil, nil + } + registryConfig := ®istryv1alpha1.RegistryConfig{ + Options: bufpluginconfig.PluginOptionsToOptionsSlice(pluginRegistry.Options), + } + if pluginRegistry.Go != nil { + goConfig := ®istryv1alpha1.GoConfig{} + goConfig.MinimumVersion = pluginRegistry.Go.MinVersion + if pluginRegistry.Go.Deps != nil { + goConfig.RuntimeLibraries = make([]*registryv1alpha1.GoConfig_RuntimeLibrary, 0, len(pluginRegistry.Go.Deps)) + for _, dependency := range pluginRegistry.Go.Deps { + goConfig.RuntimeLibraries = append(goConfig.RuntimeLibraries, goRuntimeDependencyToProtoGoRuntimeLibrary(dependency)) + } + } + registryConfig.RegistryConfig = ®istryv1alpha1.RegistryConfig_GoConfig{GoConfig: goConfig} + } else if pluginRegistry.NPM != nil { + importStyle, err := npmImportStyleToNPMProtoImportStyle(pluginRegistry.NPM.ImportStyle) + if err != nil { + return nil, err + } + npmConfig := ®istryv1alpha1.NPMConfig{ + RewriteImportPathSuffix: pluginRegistry.NPM.RewriteImportPathSuffix, + ImportStyle: importStyle, + } + if pluginRegistry.NPM.Deps != nil { + npmConfig.RuntimeLibraries = make([]*registryv1alpha1.NPMConfig_RuntimeLibrary, 0, len(pluginRegistry.NPM.Deps)) + for _, dependency := range pluginRegistry.NPM.Deps { + npmConfig.RuntimeLibraries = append(npmConfig.RuntimeLibraries, npmRuntimeDependencyToProtoNPMRuntimeLibrary(dependency)) + } + } + registryConfig.RegistryConfig = ®istryv1alpha1.RegistryConfig_NpmConfig{NpmConfig: npmConfig} + } else if pluginRegistry.Maven != nil { + mavenConfig := ®istryv1alpha1.MavenConfig{} + var javaCompilerConfig *registryv1alpha1.MavenConfig_CompilerJavaConfig + if compiler := pluginRegistry.Maven.Compiler.Java; compiler != (bufpluginconfig.MavenCompilerJavaConfig{}) { + javaCompilerConfig = ®istryv1alpha1.MavenConfig_CompilerJavaConfig{ + Encoding: compiler.Encoding, + Release: int32(compiler.Release), + Source: int32(compiler.Source), + Target: int32(compiler.Target), + } + } + var kotlinCompilerConfig *registryv1alpha1.MavenConfig_CompilerKotlinConfig + if compiler := pluginRegistry.Maven.Compiler.Kotlin; compiler != (bufpluginconfig.MavenCompilerKotlinConfig{}) { + kotlinCompilerConfig = ®istryv1alpha1.MavenConfig_CompilerKotlinConfig{ + Version: compiler.Version, + ApiVersion: compiler.APIVersion, + JvmTarget: compiler.JVMTarget, + LanguageVersion: compiler.LanguageVersion, + } + } + if javaCompilerConfig != nil || kotlinCompilerConfig != nil { + mavenConfig.Compiler = ®istryv1alpha1.MavenConfig_CompilerConfig{ + Java: javaCompilerConfig, + Kotlin: kotlinCompilerConfig, + } + } + if pluginRegistry.Maven.Deps != nil { + mavenConfig.RuntimeLibraries = make([]*registryv1alpha1.MavenConfig_RuntimeLibrary, len(pluginRegistry.Maven.Deps)) + for i, dependency := range pluginRegistry.Maven.Deps { + mavenConfig.RuntimeLibraries[i] = MavenDependencyConfigToProtoRuntimeLibrary(dependency) + } + } + if pluginRegistry.Maven.AdditionalRuntimes != nil { + mavenConfig.AdditionalRuntimes = make([]*registryv1alpha1.MavenConfig_RuntimeConfig, len(pluginRegistry.Maven.AdditionalRuntimes)) + for i, runtime := range pluginRegistry.Maven.AdditionalRuntimes { + mavenConfig.AdditionalRuntimes[i] = MavenRuntimeConfigToProtoRuntimeConfig(runtime) + } + } + registryConfig.RegistryConfig = ®istryv1alpha1.RegistryConfig_MavenConfig{MavenConfig: mavenConfig} + } else if pluginRegistry.Swift != nil { + swiftConfig := SwiftRegistryConfigToProtoSwiftConfig(pluginRegistry.Swift) + registryConfig.RegistryConfig = ®istryv1alpha1.RegistryConfig_SwiftConfig{SwiftConfig: swiftConfig} + } + return registryConfig, nil +} + +// MavenDependencyConfigToProtoRuntimeLibrary converts a bufpluginconfig.MavenDependencyConfig to an equivalent registryv1alpha1.MavenConfig_RuntimeLibrary. +func MavenDependencyConfigToProtoRuntimeLibrary(dependency bufpluginconfig.MavenDependencyConfig) *registryv1alpha1.MavenConfig_RuntimeLibrary { + return ®istryv1alpha1.MavenConfig_RuntimeLibrary{ + GroupId: dependency.GroupID, + ArtifactId: dependency.ArtifactID, + Version: dependency.Version, + Classifier: dependency.Classifier, + Extension: dependency.Extension, + } +} + +// ProtoRegistryConfigToPluginRegistry converts a registryv1alpha1.RegistryConfig to a bufpluginconfig.RegistryConfig . +func ProtoRegistryConfigToPluginRegistry(config *registryv1alpha1.RegistryConfig) (*bufpluginconfig.RegistryConfig, error) { + if config == nil { + return nil, nil + } + registryConfig := &bufpluginconfig.RegistryConfig{ + Options: bufpluginconfig.OptionsSliceToPluginOptions(config.Options), + } + if config.GetGoConfig() != nil { + goConfig := &bufpluginconfig.GoRegistryConfig{} + goConfig.MinVersion = config.GetGoConfig().GetMinimumVersion() + runtimeLibraries := config.GetGoConfig().GetRuntimeLibraries() + if runtimeLibraries != nil { + goConfig.Deps = make([]*bufpluginconfig.GoRegistryDependencyConfig, 0, len(runtimeLibraries)) + for _, library := range runtimeLibraries { + goConfig.Deps = append(goConfig.Deps, protoGoRuntimeLibraryToGoRuntimeDependency(library)) + } + } + registryConfig.Go = goConfig + } else if config.GetNpmConfig() != nil { + importStyle, err := npmProtoImportStyleToNPMImportStyle(config.GetNpmConfig().GetImportStyle()) + if err != nil { + return nil, err + } + npmConfig := &bufpluginconfig.NPMRegistryConfig{ + RewriteImportPathSuffix: config.GetNpmConfig().GetRewriteImportPathSuffix(), + ImportStyle: importStyle, + } + runtimeLibraries := config.GetNpmConfig().GetRuntimeLibraries() + if runtimeLibraries != nil { + npmConfig.Deps = make([]*bufpluginconfig.NPMRegistryDependencyConfig, 0, len(runtimeLibraries)) + for _, library := range runtimeLibraries { + npmConfig.Deps = append(npmConfig.Deps, protoNPMRuntimeLibraryToNPMRuntimeDependency(library)) + } + } + registryConfig.NPM = npmConfig + } else if protoMavenConfig := config.GetMavenConfig(); protoMavenConfig != nil { + mavenConfig, err := ProtoMavenConfigToMavenRegistryConfig(protoMavenConfig) + if err != nil { + return nil, err + } + registryConfig.Maven = mavenConfig + } else if protoSwiftConfig := config.GetSwiftConfig(); protoSwiftConfig != nil { + swiftConfig, err := ProtoSwiftConfigToSwiftRegistryConfig(protoSwiftConfig) + if err != nil { + return nil, err + } + registryConfig.Swift = swiftConfig + } + return registryConfig, nil +} + +func ProtoSwiftConfigToSwiftRegistryConfig(protoSwiftConfig *registryv1alpha1.SwiftConfig) (*bufpluginconfig.SwiftRegistryConfig, error) { + swiftConfig := &bufpluginconfig.SwiftRegistryConfig{} + runtimeLibs := protoSwiftConfig.GetRuntimeLibraries() + if runtimeLibs != nil { + swiftConfig.Dependencies = make([]bufpluginconfig.SwiftRegistryDependencyConfig, 0, len(runtimeLibs)) + for _, runtimeLib := range runtimeLibs { + dependencyConfig := bufpluginconfig.SwiftRegistryDependencyConfig{ + Source: runtimeLib.GetSource(), + Package: runtimeLib.GetPackage(), + Version: runtimeLib.GetVersion(), + Products: runtimeLib.GetProducts(), + SwiftVersions: runtimeLib.GetSwiftVersions(), + } + platforms := runtimeLib.GetPlatforms() + for _, platform := range platforms { + switch platform.GetName() { + case registryv1alpha1.SwiftPlatformType_SWIFT_PLATFORM_TYPE_MACOS: + dependencyConfig.Platforms.MacOS = platform.GetVersion() + case registryv1alpha1.SwiftPlatformType_SWIFT_PLATFORM_TYPE_IOS: + dependencyConfig.Platforms.IOS = platform.GetVersion() + case registryv1alpha1.SwiftPlatformType_SWIFT_PLATFORM_TYPE_TVOS: + dependencyConfig.Platforms.TVOS = platform.GetVersion() + case registryv1alpha1.SwiftPlatformType_SWIFT_PLATFORM_TYPE_WATCHOS: + dependencyConfig.Platforms.WatchOS = platform.GetVersion() + default: + return nil, fmt.Errorf("unknown platform type: %v", platform.GetName()) + } + } + swiftConfig.Dependencies = append(swiftConfig.Dependencies, dependencyConfig) + } + } + return swiftConfig, nil +} + +func SwiftRegistryConfigToProtoSwiftConfig(swiftConfig *bufpluginconfig.SwiftRegistryConfig) *registryv1alpha1.SwiftConfig { + protoSwiftConfig := ®istryv1alpha1.SwiftConfig{} + if swiftConfig.Dependencies != nil { + protoSwiftConfig.RuntimeLibraries = make([]*registryv1alpha1.SwiftConfig_RuntimeLibrary, 0, len(swiftConfig.Dependencies)) + for _, dependency := range swiftConfig.Dependencies { + depConfig := ®istryv1alpha1.SwiftConfig_RuntimeLibrary{ + Source: dependency.Source, + Package: dependency.Package, + Version: dependency.Version, + Products: dependency.Products, + SwiftVersions: dependency.SwiftVersions, + } + if dependency.Platforms.MacOS != "" { + depConfig.Platforms = append(depConfig.Platforms, ®istryv1alpha1.SwiftConfig_RuntimeLibrary_Platform{ + Name: registryv1alpha1.SwiftPlatformType_SWIFT_PLATFORM_TYPE_MACOS, + Version: dependency.Platforms.MacOS, + }) + } + if dependency.Platforms.IOS != "" { + depConfig.Platforms = append(depConfig.Platforms, ®istryv1alpha1.SwiftConfig_RuntimeLibrary_Platform{ + Name: registryv1alpha1.SwiftPlatformType_SWIFT_PLATFORM_TYPE_IOS, + Version: dependency.Platforms.IOS, + }) + } + if dependency.Platforms.TVOS != "" { + depConfig.Platforms = append(depConfig.Platforms, ®istryv1alpha1.SwiftConfig_RuntimeLibrary_Platform{ + Name: registryv1alpha1.SwiftPlatformType_SWIFT_PLATFORM_TYPE_TVOS, + Version: dependency.Platforms.TVOS, + }) + } + if dependency.Platforms.WatchOS != "" { + depConfig.Platforms = append(depConfig.Platforms, ®istryv1alpha1.SwiftConfig_RuntimeLibrary_Platform{ + Name: registryv1alpha1.SwiftPlatformType_SWIFT_PLATFORM_TYPE_WATCHOS, + Version: dependency.Platforms.WatchOS, + }) + } + protoSwiftConfig.RuntimeLibraries = append(protoSwiftConfig.RuntimeLibraries, depConfig) + } + } + return protoSwiftConfig +} + +// ProtoMavenConfigToMavenRegistryConfig converts a registryv1alpha1.MavenConfig to a bufpluginconfig.MavenRegistryConfig. +func ProtoMavenConfigToMavenRegistryConfig(protoMavenConfig *registryv1alpha1.MavenConfig) (*bufpluginconfig.MavenRegistryConfig, error) { + mavenConfig := &bufpluginconfig.MavenRegistryConfig{} + if protoCompiler := protoMavenConfig.GetCompiler(); protoCompiler != nil { + mavenConfig.Compiler = bufpluginconfig.MavenCompilerConfig{} + if protoJavaCompiler := protoCompiler.GetJava(); protoJavaCompiler != nil { + mavenConfig.Compiler.Java = bufpluginconfig.MavenCompilerJavaConfig{ + Encoding: protoJavaCompiler.GetEncoding(), + Release: int(protoJavaCompiler.GetRelease()), + Source: int(protoJavaCompiler.GetSource()), + Target: int(protoJavaCompiler.GetTarget()), + } + } + if protoKotlinCompiler := protoCompiler.GetKotlin(); protoKotlinCompiler != nil { + mavenConfig.Compiler.Kotlin = bufpluginconfig.MavenCompilerKotlinConfig{ + APIVersion: protoKotlinCompiler.GetApiVersion(), + JVMTarget: protoKotlinCompiler.GetJvmTarget(), + LanguageVersion: protoKotlinCompiler.GetLanguageVersion(), + Version: protoKotlinCompiler.GetVersion(), + } + } + } + runtimeLibraries := protoMavenConfig.GetRuntimeLibraries() + if runtimeLibraries != nil { + mavenConfig.Deps = make([]bufpluginconfig.MavenDependencyConfig, len(runtimeLibraries)) + for i, library := range runtimeLibraries { + mavenConfig.Deps[i] = ProtoMavenRuntimeLibraryToDependencyConfig(library) + } + } + additionalRuntimes := protoMavenConfig.GetAdditionalRuntimes() + if additionalRuntimes != nil { + mavenConfig.AdditionalRuntimes = make([]bufpluginconfig.MavenRuntimeConfig, len(additionalRuntimes)) + for i, additionalRuntime := range additionalRuntimes { + runtime, err := MavenProtoRuntimeConfigToRuntimeConfig(additionalRuntime) + if err != nil { + return nil, err + } + mavenConfig.AdditionalRuntimes[i] = runtime + } + } + return mavenConfig, nil +} + +// MavenProtoRuntimeConfigToRuntimeConfig converts a registryv1alpha1.MavenConfig_RuntimeConfig to a bufpluginconfig.MavenRuntimeConfig. +func MavenProtoRuntimeConfigToRuntimeConfig(proto *registryv1alpha1.MavenConfig_RuntimeConfig) (bufpluginconfig.MavenRuntimeConfig, error) { + libraries := proto.GetRuntimeLibraries() + var dependencies []bufpluginconfig.MavenDependencyConfig + for _, library := range libraries { + dependencies = append(dependencies, ProtoMavenRuntimeLibraryToDependencyConfig(library)) + } + return bufpluginconfig.MavenRuntimeConfig{ + Name: proto.GetName(), + Deps: dependencies, + Options: proto.GetOptions(), + }, nil +} + +// MavenRuntimeConfigToProtoRuntimeConfig converts a bufpluginconfig.MavenRuntimeConfig to a registryv1alpha1.MavenConfig_RuntimeLibrary. +func MavenRuntimeConfigToProtoRuntimeConfig(runtime bufpluginconfig.MavenRuntimeConfig) *registryv1alpha1.MavenConfig_RuntimeConfig { + var libraries []*registryv1alpha1.MavenConfig_RuntimeLibrary + for _, dependency := range runtime.Deps { + libraries = append(libraries, MavenDependencyConfigToProtoRuntimeLibrary(dependency)) + } + return ®istryv1alpha1.MavenConfig_RuntimeConfig{ + Name: runtime.Name, + RuntimeLibraries: libraries, + Options: runtime.Options, + } +} + +// ProtoMavenRuntimeLibraryToDependencyConfig converts a registryv1alpha1 to a bufpluginconfig.MavenDependencyConfig. +func ProtoMavenRuntimeLibraryToDependencyConfig(proto *registryv1alpha1.MavenConfig_RuntimeLibrary) bufpluginconfig.MavenDependencyConfig { + return bufpluginconfig.MavenDependencyConfig{ + GroupID: proto.GetGroupId(), + ArtifactID: proto.GetArtifactId(), + Version: proto.GetVersion(), + Classifier: proto.GetClassifier(), + Extension: proto.GetExtension(), + } +} + +func npmImportStyleToNPMProtoImportStyle(importStyle string) (registryv1alpha1.NPMImportStyle, error) { + switch importStyle { + case "commonjs": + return registryv1alpha1.NPMImportStyle_NPM_IMPORT_STYLE_COMMONJS, nil + case "module": + return registryv1alpha1.NPMImportStyle_NPM_IMPORT_STYLE_MODULE, nil + } + return 0, fmt.Errorf(`invalid import style %q: must be one of "module" or "commonjs"`, importStyle) +} + +func npmProtoImportStyleToNPMImportStyle(importStyle registryv1alpha1.NPMImportStyle) (string, error) { + switch importStyle { + case registryv1alpha1.NPMImportStyle_NPM_IMPORT_STYLE_COMMONJS: + return "commonjs", nil + case registryv1alpha1.NPMImportStyle_NPM_IMPORT_STYLE_MODULE: + return "module", nil + } + return "", fmt.Errorf("unknown import style: %v", importStyle) +} + +// goRuntimeDependencyToProtoGoRuntimeLibrary converts a bufpluginconfig.GoRegistryDependencyConfig to a registryv1alpha1.GoConfig_RuntimeLibrary. +func goRuntimeDependencyToProtoGoRuntimeLibrary(config *bufpluginconfig.GoRegistryDependencyConfig) *registryv1alpha1.GoConfig_RuntimeLibrary { + return ®istryv1alpha1.GoConfig_RuntimeLibrary{ + Module: config.Module, + Version: config.Version, + } +} + +// protoGoRuntimeLibraryToGoRuntimeDependency converts a registryv1alpha1.GoConfig_RuntimeLibrary to a bufpluginconfig.GoRegistryDependencyConfig. +func protoGoRuntimeLibraryToGoRuntimeDependency(config *registryv1alpha1.GoConfig_RuntimeLibrary) *bufpluginconfig.GoRegistryDependencyConfig { + return &bufpluginconfig.GoRegistryDependencyConfig{ + Module: config.Module, + Version: config.Version, + } +} + +// npmRuntimeDependencyToProtoNPMRuntimeLibrary converts a bufpluginconfig.NPMRegistryConfig to a registryv1alpha1.NPMConfig_RuntimeLibrary. +func npmRuntimeDependencyToProtoNPMRuntimeLibrary(config *bufpluginconfig.NPMRegistryDependencyConfig) *registryv1alpha1.NPMConfig_RuntimeLibrary { + return ®istryv1alpha1.NPMConfig_RuntimeLibrary{ + Package: config.Package, + Version: config.Version, + } +} + +// protoNPMRuntimeLibraryToNPMRuntimeDependency converts a registryv1alpha1.NPMConfig_RuntimeLibrary to a bufpluginconfig.NPMRegistryDependencyConfig. +func protoNPMRuntimeLibraryToNPMRuntimeDependency(config *registryv1alpha1.NPMConfig_RuntimeLibrary) *bufpluginconfig.NPMRegistryDependencyConfig { + return &bufpluginconfig.NPMRegistryDependencyConfig{ + Package: config.Package, + Version: config.Version, + } +} + +// PluginReferencesToCuratedProtoPluginReferences converts a slice of bufpluginref.PluginReference to a slice of registryv1alpha1.CuratedPluginReference. +func PluginReferencesToCuratedProtoPluginReferences(references []bufpluginref.PluginReference) []*registryv1alpha1.CuratedPluginReference { + if references == nil { + return nil + } + protoReferences := make([]*registryv1alpha1.CuratedPluginReference, 0, len(references)) + for _, reference := range references { + protoReferences = append(protoReferences, PluginReferenceToProtoCuratedPluginReference(reference)) + } + return protoReferences +} + +// PluginReferenceToProtoCuratedPluginReference converts a bufpluginref.PluginReference to a registryv1alpha1.CuratedPluginReference. +func PluginReferenceToProtoCuratedPluginReference(reference bufpluginref.PluginReference) *registryv1alpha1.CuratedPluginReference { + if reference == nil { + return nil + } + return ®istryv1alpha1.CuratedPluginReference{ + Owner: reference.Owner(), + Name: reference.Plugin(), + Version: reference.Version(), + Revision: uint32(reference.Revision()), + } +} + +// PluginIdentityToProtoCuratedPluginReference converts a bufpluginref.PluginIdentity to a registryv1alpha1.CuratedPluginReference. +// +// The returned CuratedPluginReference contains no Version/Revision information. +func PluginIdentityToProtoCuratedPluginReference(identity bufpluginref.PluginIdentity) *registryv1alpha1.CuratedPluginReference { + if identity == nil { + return nil + } + return ®istryv1alpha1.CuratedPluginReference{ + Owner: identity.Owner(), + Name: identity.Plugin(), + } +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugin_test.go b/pkg/bufman/bufpkg/bufplugin/bufplugin_test.go new file mode 100644 index 000000000..0ae057efe --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufplugin_test.go @@ -0,0 +1,221 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufplugin + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginconfig" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestPluginToProtoPluginRegistryType(t *testing.T) { + t.Parallel() + assertPluginToPluginRegistryType(t, nil, registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_UNSPECIFIED) + assertPluginToPluginRegistryType(t, &bufpluginconfig.RegistryConfig{Go: &bufpluginconfig.GoRegistryConfig{}}, registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_GO) + assertPluginToPluginRegistryType(t, &bufpluginconfig.RegistryConfig{NPM: &bufpluginconfig.NPMRegistryConfig{}}, registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_NPM) + assertPluginToPluginRegistryType(t, &bufpluginconfig.RegistryConfig{Maven: &bufpluginconfig.MavenRegistryConfig{}}, registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_MAVEN) + assertPluginToPluginRegistryType(t, &bufpluginconfig.RegistryConfig{Swift: &bufpluginconfig.SwiftRegistryConfig{}}, registryv1alpha1.PluginRegistryType_PLUGIN_REGISTRY_TYPE_SWIFT) +} + +func assertPluginToPluginRegistryType(t testing.TB, config *bufpluginconfig.RegistryConfig, registryType registryv1alpha1.PluginRegistryType) { + plugin, err := NewPlugin("v1.0.0", nil, config, "sha256:digest", "", "") + require.Nil(t, err) + assert.Equal(t, registryType, PluginToProtoPluginRegistryType(plugin)) +} + +func TestPluginRegistryRoundTrip(t *testing.T) { + t.Parallel() + assertPluginRegistryRoundTrip(t, nil) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{}) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + Go: &bufpluginconfig.GoRegistryConfig{}, + }) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + Go: &bufpluginconfig.GoRegistryConfig{ + MinVersion: "1.18", + Deps: []*bufpluginconfig.GoRegistryDependencyConfig{ + { + Module: "github.com/bufbuild/connect-go", + Version: "v0.1.1", + }, + }, + }, + }) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + NPM: &bufpluginconfig.NPMRegistryConfig{ + ImportStyle: "commonjs", + }, + }) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + NPM: &bufpluginconfig.NPMRegistryConfig{ + ImportStyle: "module", + RewriteImportPathSuffix: "connectweb.js", + Deps: []*bufpluginconfig.NPMRegistryDependencyConfig{ + { + Package: "@bufbuild/protobuf", + Version: "^0.0.4", + }, + }, + }, + }) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + Go: &bufpluginconfig.GoRegistryConfig{ + MinVersion: "1.18", + Deps: []*bufpluginconfig.GoRegistryDependencyConfig{ + { + Module: "github.com/bufbuild/connect-go", + Version: "v0.4.0", + }, + }, + }, + Options: map[string]string{ + "separate_package": "true", + }, + }) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + Maven: &bufpluginconfig.MavenRegistryConfig{}, + }) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + Maven: &bufpluginconfig.MavenRegistryConfig{ + Compiler: bufpluginconfig.MavenCompilerConfig{ + Java: bufpluginconfig.MavenCompilerJavaConfig{ + Encoding: "UTF-8", + Release: 7, + Source: 8, + Target: 9, + }, + Kotlin: bufpluginconfig.MavenCompilerKotlinConfig{ + APIVersion: "7", + JVMTarget: "8", + LanguageVersion: "9", + Version: "1.8.0", + }, + }, + Deps: []bufpluginconfig.MavenDependencyConfig{ + { + GroupID: "io.grpc", + ArtifactID: "grpc-core", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "grpc-protobuf", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "protoc-gen-grpc-java", + Version: "1.52.1", + Classifier: "linux-x86_64", + Extension: "exe", + }, + }, + AdditionalRuntimes: []bufpluginconfig.MavenRuntimeConfig{ + { + Name: "lite", + Deps: []bufpluginconfig.MavenDependencyConfig{ + { + GroupID: "io.grpc", + ArtifactID: "grpc-core", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "grpc-protobuflite", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "protoc-gen-grpc-java", + Version: "1.52.1", + Classifier: "linux-x86_64", + Extension: "exe", + }, + }, + Options: []string{"lite"}, + }, + }, + }, + }) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + Swift: &bufpluginconfig.SwiftRegistryConfig{}, + }) + assertPluginRegistryRoundTrip(t, &bufpluginconfig.RegistryConfig{ + Swift: &bufpluginconfig.SwiftRegistryConfig{ + Dependencies: []bufpluginconfig.SwiftRegistryDependencyConfig{ + { + Source: "https://github.com/apple/swift-protobuf.git", + Package: "swift-protobuf", + Version: "1.12.0", + Products: []string{"SwiftProtobuf"}, + SwiftVersions: []string{".v5"}, + Platforms: bufpluginconfig.SwiftRegistryDependencyPlatformConfig{ + MacOS: "v10_15", + IOS: "v10_15", + TVOS: "v10_15", + WatchOS: "v10_15", + }, + }, + }, + }, + }) +} + +func assertPluginRegistryRoundTrip(t testing.TB, config *bufpluginconfig.RegistryConfig) { + protoRegistryConfig, err := PluginRegistryToProtoRegistryConfig(config) + require.NoError(t, err) + registryConfig, err := ProtoRegistryConfigToPluginRegistry(protoRegistryConfig) + require.NoError(t, err) + assert.Equal(t, config, registryConfig) +} + +func TestLanguagesToProtoLanguages(t *testing.T) { + t.Parallel() + protoLanguages, err := OutputLanguagesToProtoLanguages([]string{"go"}) + require.NoError(t, err) + assert.Equal(t, + []registryv1alpha1.PluginLanguage{ + registryv1alpha1.PluginLanguage_PLUGIN_LANGUAGE_GO, + }, + protoLanguages, + ) + protoLanguages, err = OutputLanguagesToProtoLanguages([]string{"typescript", "javascript"}) + require.NoError(t, err) + assert.Equal(t, + []registryv1alpha1.PluginLanguage{ + registryv1alpha1.PluginLanguage_PLUGIN_LANGUAGE_JAVASCRIPT, + registryv1alpha1.PluginLanguage_PLUGIN_LANGUAGE_TYPESCRIPT, + }, + protoLanguages, + ) + protoLanguages, err = OutputLanguagesToProtoLanguages([]string{"java", "kotlin"}) + require.NoError(t, err) + assert.Equal(t, + []registryv1alpha1.PluginLanguage{ + registryv1alpha1.PluginLanguage_PLUGIN_LANGUAGE_JAVA, + registryv1alpha1.PluginLanguage_PLUGIN_LANGUAGE_KOTLIN, + }, + protoLanguages, + ) + _, err = OutputLanguagesToProtoLanguages([]string{"unknown_language", "another_unknown_language"}) + require.Error(t, err) + protoLanguages, err = OutputLanguagesToProtoLanguages(nil) + require.NoError(t, err) + assert.Equal(t, 0, len(protoLanguages)) +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig.go b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig.go new file mode 100644 index 000000000..07d68be6f --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig.go @@ -0,0 +1,471 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufpluginconfig defines the buf.plugin.yaml file. +package bufpluginconfig + +import ( + "context" + "fmt" + "os" + "path/filepath" + "sort" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +const ( + // ExternalConfigFilePath is the default configuration file path for v1. + ExternalConfigFilePath = "buf.plugin.yaml" + // V1Version is the version string used to indicate the v1 version of the buf.plugin.yaml file. + V1Version = "v1" +) + +// AllConfigFilePaths are all acceptable config file paths without overrides. +// +// These are in the order we should check. +var AllConfigFilePaths = []string{ + ExternalConfigFilePath, +} + +// Config is the plugin config. +type Config struct { + // Name is the name of the plugin (e.g. 'buf.build/protocolbuffers/go'). + Name bufpluginref.PluginIdentity + // PluginVersion is the version of the plugin's implementation + // (e.g. the protoc-gen-connect-go implementation is v0.2.0). + // + // This excludes any other details found in the buf.plugin.yaml + // or plugin source (e.g. Dockerfile) that would otherwise influence + // the plugin's behavior. + PluginVersion string + // SourceURL is an optional attribute used to specify where the source + // for the plugin can be found. + SourceURL string + // Description is an optional attribute to provide a more detailed + // description for the plugin. + Description string + // Dependencies are the dependencies this plugin has on other plugins. + // + // An example of a dependency might be a 'protoc-gen-go-grpc' plugin + // which depends on the 'protoc-gen-go' generated code. + Dependencies []bufpluginref.PluginReference + // OutputLanguages is a list of output languages the plugin supports. + OutputLanguages []string + // Registry is the registry configuration, which lets the user specify + // dependencies and other metadata that applies to a specific + // remote generation registry (e.g. the Go module proxy, NPM registry, + // etc). + Registry *RegistryConfig + // SPDXLicenseID is the license of the plugin, which should be one of + // the identifiers defined in https://spdx.org/licenses + SPDXLicenseID string + // LicenseURL specifies where the plugin's license can be found. + LicenseURL string +} + +// RegistryConfig is the configuration for the registry of a plugin. +// +// Only one field will be set. +type RegistryConfig struct { + Go *GoRegistryConfig + NPM *NPMRegistryConfig + Maven *MavenRegistryConfig + Swift *SwiftRegistryConfig + // Options is the set of options passed into the plugin for the + // remote registryv1alpha1. + // + // For now, all options are string values. This could eventually + // support other types (like JSON Schema and Terraform variables), + // where strings are the default value unless otherwise specified. + // + // Note that some legacy plugins don't always express their options + // as key value pairs. For example, protoc-gen-java has an option + // that can be passed like so: + // + // java_opt=annotate_code + // + // In those cases, the option value in this map will be set to + // the empty string, and the option will be propagated to the + // compiler without the '=' delimiter. + Options map[string]string +} + +// GoRegistryConfig is the registry configuration for a Go plugin. +type GoRegistryConfig struct { + MinVersion string + Deps []*GoRegistryDependencyConfig +} + +// GoRegistryDependencyConfig is the go registry dependency configuration. +type GoRegistryDependencyConfig struct { + Module string + Version string +} + +// NPMRegistryConfig is the registry configuration for a JavaScript NPM plugin. +type NPMRegistryConfig struct { + RewriteImportPathSuffix string + Deps []*NPMRegistryDependencyConfig + ImportStyle string +} + +// NPMRegistryDependencyConfig is the npm registry dependency configuration. +type NPMRegistryDependencyConfig struct { + Package string + Version string +} + +// MavenRegistryConfig is the registry configuration for a Maven plugin. +type MavenRegistryConfig struct { + // Compiler specifies Java and/or Kotlin compiler settings for remote packages. + Compiler MavenCompilerConfig + // Deps are dependencies for the remote package. + Deps []MavenDependencyConfig + // AdditionalRuntimes tracks additional runtimes (like the 'lite' runtime). + // This is used to support multiple artifacts targeting different runtimes, plugin options, and dependencies. + AdditionalRuntimes []MavenRuntimeConfig +} + +// MavenCompilerConfig specifies compiler settings for Java and/or Kotlin. +type MavenCompilerConfig struct { + Java MavenCompilerJavaConfig + Kotlin MavenCompilerKotlinConfig +} + +// MavenCompilerJavaConfig specifies compiler settings for Java code. +type MavenCompilerJavaConfig struct { + // Encoding specifies the encoding of the source files (default: UTF-8). + Encoding string + // Release specifies the target Java release (default: 8). + Release int + // Source specifies the source bytecode level (default: 8). + Source int + // Target specifies the target bytecode level (default: 8). + Target int +} + +// MavenCompilerKotlinConfig specifies compiler settings for Kotlin code. +type MavenCompilerKotlinConfig struct { + // APIVersion specifies the Kotlin API version to target. + APIVersion string + // JVMTarget specifies the target version of the JVM bytecode (default: 1.8) + JVMTarget string + // LanguageVersion is used to provide source compatibility with the specified Kotlin version. + LanguageVersion string + // Version of the Kotlin compiler to use (required for Kotlin plugins). + Version string +} + +// MavenDependencyConfig defines a runtime dependency for a remote package artifact. +type MavenDependencyConfig struct { + GroupID string + ArtifactID string + Version string + Classifier string + // Extension is the file extension, also known as the Maven type. + Extension string +} + +// MavenRuntimeConfig is used to specify additional runtimes for a given plugin. +type MavenRuntimeConfig struct { + // Name is the required, unique name for the runtime in MavenRegistryConfig.AdditionalRuntimes. + Name string + // Deps contains the Maven dependencies for the runtime. Overrides MavenRegistryConfig.Deps. + Deps []MavenDependencyConfig + // Options contains the Maven plugin options for the runtime. Overrides RegistryConfig.Options. + Options []string +} + +// SwiftRegistryConfig is the registry configuration for a Swift plugin. +type SwiftRegistryConfig struct { + // Dependencies are dependencies for the remote package. + Dependencies []SwiftRegistryDependencyConfig +} + +// SwiftRegistryDependencyConfig is the swift registry dependency configuration. +type SwiftRegistryDependencyConfig struct { + // Source specifies the source of the dependency. + Source string + // Package is the name of the Swift package. + Package string + // Version is the version of the Swift package. + Version string + // Products are the names of the products available to import. + Products []string + // Platforms are the minimum versions for platforms the package supports. + Platforms SwiftRegistryDependencyPlatformConfig + // SwiftVersions are the versions of Swift the package supports. + SwiftVersions []string +} + +// SwiftRegistryDependencyPlatformConfig is the swift registry dependency platform configuration. +type SwiftRegistryDependencyPlatformConfig struct { + // macOS specifies the version of the macOS platform. + MacOS string + // iOS specifies the version of the iOS platform. + IOS string + // TVOS specifies the version of the tvOS platform. + TVOS string + // WatchOS specifies the version of the watchOS platform. + WatchOS string +} + +// ConfigOption is an optional option used when loading a Config. +type ConfigOption func(*configOptions) + +// WithOverrideRemote will update the remote found in the plugin name and dependencies. +func WithOverrideRemote(remote string) ConfigOption { + return func(options *configOptions) { + options.overrideRemote = remote + } +} + +// GetConfigForBucket gets the Config for the YAML data at ConfigFilePath. +// +// If the data is of length 0, returns the default config. +func GetConfigForBucket(ctx context.Context, readBucket storage.ReadBucket, options ...ConfigOption) (*Config, error) { + return getConfigForBucket(ctx, readBucket, options) +} + +// GetConfigForData gets the Config for the given JSON or YAML data. +// +// If the data is of length 0, returns the default config. +func GetConfigForData(ctx context.Context, data []byte, options ...ConfigOption) (*Config, error) { + return getConfigForData(ctx, data, options) +} + +// ExistingConfigFilePath checks if a configuration file exists, and if so, returns the path +// within the ReadBucket of this configuration file. +// +// Returns empty string and no error if no configuration file exists. +func ExistingConfigFilePath(ctx context.Context, readBucket storage.ReadBucket) (string, error) { + for _, configFilePath := range AllConfigFilePaths { + exists, err := storage.Exists(ctx, readBucket, configFilePath) + if err != nil { + return "", err + } + if exists { + return configFilePath, nil + } + } + return "", nil +} + +// ParseConfig parses the file at the given path as a Config. +func ParseConfig(config string, options ...ConfigOption) (*Config, error) { + var data []byte + var err error + switch filepath.Ext(config) { + case ".json", ".yaml", ".yml": + data, err = os.ReadFile(config) + if err != nil { + return nil, fmt.Errorf("could not read file: %w", err) + } + default: + return nil, fmt.Errorf("invalid extension %s, must be .json, .yaml or .yml", filepath.Ext(config)) + } + var externalConfig ExternalConfig + if err := encoding.UnmarshalJSONOrYAMLStrict(data, &externalConfig); err != nil { + return nil, fmt.Errorf("failed to unmarshal plugin config: %w", err) + } + switch externalConfig.Version { + case V1Version: + return newConfig(externalConfig, options) + } + return nil, fmt.Errorf("invalid plugin configuration version: must be one of %v", AllConfigFilePaths) +} + +// PluginOptionsToOptionsSlice converts a map representation of plugin options to a slice of the form '=' or '' for empty values. +func PluginOptionsToOptionsSlice(pluginOptions map[string]string) []string { + if pluginOptions == nil { + return nil + } + options := make([]string, 0, len(pluginOptions)) + for key, value := range pluginOptions { + if len(value) > 0 { + options = append(options, key+"="+value) + } else { + options = append(options, key) + } + } + sort.Strings(options) + return options +} + +// OptionsSliceToPluginOptions converts a slice of plugin options to a map (using the first '=' as a delimiter between key and value). +// If no '=' is found, the option will be stored in the map with an empty string value. +func OptionsSliceToPluginOptions(options []string) map[string]string { + if options == nil { + return nil + } + pluginOptions := make(map[string]string, len(options)) + for _, option := range options { + fields := strings.SplitN(option, "=", 2) + if len(fields) == 2 { + pluginOptions[fields[0]] = fields[1] + } else { + pluginOptions[option] = "" + } + } + return pluginOptions +} + +// ExternalConfig represents the on-disk representation +// of the plugin configuration at version v1. +type ExternalConfig struct { + Version string `json:"version,omitempty" yaml:"version,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + PluginVersion string `json:"plugin_version,omitempty" yaml:"plugin_version,omitempty"` + SourceURL string `json:"source_url,omitempty" yaml:"source_url,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Deps []ExternalDependency `json:"deps,omitempty" yaml:"deps,omitempty"` + OutputLanguages []string `json:"output_languages,omitempty" yaml:"output_languages,omitempty"` + Registry ExternalRegistryConfig `json:"registry,omitempty" yaml:"registry,omitempty"` + SPDXLicenseID string `json:"spdx_license_id,omitempty" yaml:"spdx_license_id,omitempty"` + LicenseURL string `json:"license_url,omitempty" yaml:"license_url,omitempty"` +} + +// ExternalDependency represents a dependency on another plugin. +type ExternalDependency struct { + Plugin string `json:"plugin,omitempty" yaml:"plugin,omitempty"` + Revision int `json:"revision,omitempty" yaml:"revision,omitempty"` +} + +// ExternalRegistryConfig is the external configuration for the registry +// of a plugin. +type ExternalRegistryConfig struct { + Go *ExternalGoRegistryConfig `json:"go,omitempty" yaml:"go,omitempty"` + NPM *ExternalNPMRegistryConfig `json:"npm,omitempty" yaml:"npm,omitempty"` + Maven *ExternalMavenRegistryConfig `json:"maven,omitempty" yaml:"maven,omitempty"` + Swift *ExternalSwiftRegistryConfig `json:"swift,omitempty" yaml:"swift,omitempty"` + Opts []string `json:"opts,omitempty" yaml:"opts,omitempty"` +} + +// ExternalGoRegistryConfig is the external registry configuration for a Go plugin. +type ExternalGoRegistryConfig struct { + // The minimum Go version required by the plugin. + MinVersion string `json:"min_version,omitempty" yaml:"min_version,omitempty"` + Deps []struct { + Module string `json:"module,omitempty" yaml:"module,omitempty"` + Version string `json:"version,omitempty" yaml:"version,omitempty"` + } `json:"deps,omitempty" yaml:"deps,omitempty"` +} + +// ExternalNPMRegistryConfig is the external registry configuration for a JavaScript NPM plugin. +type ExternalNPMRegistryConfig struct { + RewriteImportPathSuffix string `json:"rewrite_import_path_suffix,omitempty" yaml:"rewrite_import_path_suffix,omitempty"` + Deps []struct { + Package string `json:"package,omitempty" yaml:"package,omitempty"` + Version string `json:"version,omitempty" yaml:"version,omitempty"` + } `json:"deps,omitempty" yaml:"deps,omitempty"` + // The import style used for the "type" field in the package.json file. + // Must be one of "module" or "commonjs". + ImportStyle string `json:"import_style,omitempty" yaml:"import_style,omitempty"` +} + +// ExternalMavenRegistryConfig is the external registry configuration for a Maven plugin. +type ExternalMavenRegistryConfig struct { + Compiler ExternalMavenCompilerConfig `json:"compiler" yaml:"compiler"` + Deps []string `json:"deps,omitempty" yaml:"deps,omitempty"` + AdditionalRuntimes []ExternalMavenRuntimeConfig `json:"additional_runtimes,omitempty" yaml:"additional_runtimes,omitempty"` +} + +// ExternalMavenCompilerConfig configures compiler settings for Maven remote packages. +type ExternalMavenCompilerConfig struct { + Java ExternalMavenCompilerJavaConfig `json:"java" yaml:"java"` + Kotlin ExternalMavenCompilerKotlinConfig `json:"kotlin" yaml:"kotlin"` +} + +// ExternalMavenCompilerJavaConfig configures the Java compiler settings for remote packages. +type ExternalMavenCompilerJavaConfig struct { + // Encoding specifies the encoding of the source files (default: UTF-8). + Encoding string `json:"encoding" yaml:"encoding"` + // Release specifies the target Java release (default: 8). + Release int `json:"release" yaml:"release"` + // Source specifies the source bytecode level (default: 8). + Source int `json:"source" yaml:"source"` + // Target specifies the target bytecode level (default: 8). + Target int `json:"target" yaml:"target"` +} + +// ExternalMavenCompilerKotlinConfig configures the Kotlin compiler settings for remote packages. +type ExternalMavenCompilerKotlinConfig struct { + // APIVersion specifies the Kotlin API version to target. + APIVersion string `json:"api_version" yaml:"api_version"` + // JVMTarget specifies the target version of the JVM bytecode (default: 1.8) + JVMTarget string `json:"jvm_target" yaml:"jvm_target"` + // LanguageVersion is used to provide source compatibility with the specified Kotlin version. + LanguageVersion string `json:"language_version" yaml:"language_version"` + // Version of the Kotlin compiler to use (required for Kotlin plugins). + Version string `json:"version" yaml:"version"` +} + +// ExternalMavenRuntimeConfig allows configuring additional runtimes for remote packages. +// These can specify different dependencies and compiler options than the default runtime. +// This is used to support a single plugin supporting both full and lite Protobuf runtimes. +type ExternalMavenRuntimeConfig struct { + // Name contains the Maven runtime name (e.g. 'lite'). + Name string `json:"name" yaml:"name"` + // Deps contains the Maven dependencies for the runtime. Overrides ExternalMavenRuntimeConfig.Deps. + Deps []string `json:"deps,omitempty" yaml:"deps,omitempty"` + // Opts contains the Maven plugin options for the runtime. Overrides ExternalRegistryConfig.Opts. + Opts []string `json:"opts,omitempty" yaml:"opts,omitempty"` +} + +// ExternalSwiftRegistryConfig is the registry configuration for a Swift plugin. +type ExternalSwiftRegistryConfig struct { + // Deps are dependencies for the remote package. + Deps []ExternalSwiftRegistryDependencyConfig `json:"deps,omitempty" yaml:"deps,omitempty"` +} + +// ExternalSwiftRegistryDependencyConfig is the swift registry dependency configuration. +type ExternalSwiftRegistryDependencyConfig struct { + // Source is the URL of the Swift package. + Source string `json:"source,omitempty" yaml:"source,omitempty"` + // Package is the name of the Swift package. + Package string `json:"package,omitempty" yaml:"package,omitempty"` + // Version is the version of the Swift package. + Version string `json:"version,omitempty" yaml:"version,omitempty"` + // Products are the names of the products available to import. + Products []string `json:"products,omitempty" yaml:"products,omitempty"` + // Platforms are the minimum versions for platforms the package supports. + Platforms ExternalSwiftRegistryDependencyPlatformConfig `json:"platforms,omitempty" yaml:"platforms,omitempty"` + // SwiftVersions are the versions of Swift the package supports. + SwiftVersions []string `json:"swift_versions,omitempty" yaml:"swift_versions,omitempty"` +} + +// ExternalSwiftRegistryDependencyPlatformConfig is the swift registry dependency platform configuration. +type ExternalSwiftRegistryDependencyPlatformConfig struct { + // macOS specifies the version of the macOS platform. + MacOS string `json:"macos,omitempty" yaml:"macos,omitempty"` + // iOS specifies the version of the iOS platform. + IOS string `json:"ios,omitempty" yaml:"ios,omitempty"` + // TVOS specifies the version of the tvOS platform. + TVOS string `json:"tvos,omitempty" yaml:"tvos,omitempty"` + // WatchOS specifies the version of the watchOS platform. + WatchOS string `json:"watchos,omitempty" yaml:"watchos,omitempty"` +} + +type externalConfigVersion struct { + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} + +type configOptions struct { + overrideRemote string +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go new file mode 100644 index 000000000..d1725aac9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go @@ -0,0 +1,389 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginconfig + +import ( + "context" + "math" + "os" + "path/filepath" + "sort" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "gopkg.in/yaml.v3" +) + +func TestGetConfigForBucket(t *testing.T) { + t.Parallel() + storageosProvider := storageos.NewProvider() + readWriteBucket, err := storageosProvider.NewReadWriteBucket(filepath.Join("testdata", "success", "go")) + require.NoError(t, err) + pluginConfig, err := GetConfigForBucket(context.Background(), readWriteBucket) + require.NoError(t, err) + pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/library/go-grpc") + require.NoError(t, err) + pluginDependency, err := bufpluginref.PluginReferenceForString("buf.build/library/go:v1.28.0", 1) + require.NoError(t, err) + require.Equal( + t, + &Config{ + Name: pluginIdentity, + PluginVersion: "v1.2.0", + SourceURL: "https://github.com/grpc/grpc-go", + Description: "Generates Go language bindings of services in protobuf definition files for gRPC.", + Dependencies: []bufpluginref.PluginReference{ + pluginDependency, + }, + OutputLanguages: []string{"go"}, + Registry: &RegistryConfig{ + Go: &GoRegistryConfig{ + MinVersion: "1.18", + Deps: []*GoRegistryDependencyConfig{ + { + Module: "google.golang.org/grpc", + Version: "v1.32.0", + }, + }, + }, + Options: map[string]string{ + "separate_package": "true", + }, + }, + SPDXLicenseID: "Apache-2.0", + LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE", + }, + pluginConfig, + ) +} + +func TestParsePluginConfigGoYAML(t *testing.T) { + t.Parallel() + pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "go", "buf.plugin.yaml")) + require.NoError(t, err) + pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/library/go-grpc") + require.NoError(t, err) + pluginDependency, err := bufpluginref.PluginReferenceForString("buf.build/library/go:v1.28.0", 1) + require.NoError(t, err) + require.Equal( + t, + &Config{ + Name: pluginIdentity, + PluginVersion: "v1.2.0", + SourceURL: "https://github.com/grpc/grpc-go", + Description: "Generates Go language bindings of services in protobuf definition files for gRPC.", + Dependencies: []bufpluginref.PluginReference{ + pluginDependency, + }, + OutputLanguages: []string{"go"}, + Registry: &RegistryConfig{ + Go: &GoRegistryConfig{ + MinVersion: "1.18", + Deps: []*GoRegistryDependencyConfig{ + { + Module: "google.golang.org/grpc", + Version: "v1.32.0", + }, + }, + }, + Options: map[string]string{ + "separate_package": "true", + }, + }, + SPDXLicenseID: "Apache-2.0", + LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE", + }, + pluginConfig, + ) +} + +func TestParsePluginConfigGoYAMLOverrideRemote(t *testing.T) { + t.Parallel() + pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "go", "buf.plugin.yaml"), WithOverrideRemote("buf.mydomain.com")) + require.NoError(t, err) + pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.mydomain.com/library/go-grpc") + require.NoError(t, err) + pluginDependency, err := bufpluginref.PluginReferenceForString("buf.mydomain.com/library/go:v1.28.0", 1) + require.NoError(t, err) + assert.Equal(t, pluginIdentity, pluginConfig.Name) + require.Len(t, pluginConfig.Dependencies, 1) + assert.Equal(t, pluginDependency, pluginConfig.Dependencies[0]) +} + +func TestParsePluginConfigNPMYAML(t *testing.T) { + t.Parallel() + pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "npm", "buf.plugin.yaml")) + require.NoError(t, err) + pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/protocolbuffers/js") + require.NoError(t, err) + require.Equal( + t, + &Config{ + Name: pluginIdentity, + PluginVersion: "v1.0.0", + OutputLanguages: []string{"typescript"}, + Registry: &RegistryConfig{ + NPM: &NPMRegistryConfig{ + ImportStyle: "commonjs", + Deps: []*NPMRegistryDependencyConfig{ + { + Package: "grpc-web", + Version: "^1.3.1", + }, + { + Package: "@types/google-protobuf", + Version: "^3.15.6", + }, + }, + }, + }, + SPDXLicenseID: "BSD-3-Clause", + }, + pluginConfig, + ) +} + +func TestParsePluginConfigMavenYAML(t *testing.T) { + t.Parallel() + pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "maven", "buf.plugin.yaml")) + require.NoError(t, err) + pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/grpc/java") + require.NoError(t, err) + pluginDep, err := bufpluginref.PluginReferenceForString("buf.build/protocolbuffers/java:v22.2", 0) + require.NoError(t, err) + require.Equal( + t, + &Config{ + Name: pluginIdentity, + Dependencies: []bufpluginref.PluginReference{pluginDep}, + PluginVersion: "v1.0.0", + OutputLanguages: []string{"java"}, + Registry: &RegistryConfig{ + Maven: &MavenRegistryConfig{ + Compiler: MavenCompilerConfig{ + Java: MavenCompilerJavaConfig{ + Encoding: "UTF-8", + Release: 11, + Source: 8, + Target: 17, + }, + Kotlin: MavenCompilerKotlinConfig{ + APIVersion: "1.8", + JVMTarget: "9", + LanguageVersion: "1.7", + Version: "1.8.0", + }, + }, + Deps: []MavenDependencyConfig{ + { + GroupID: "io.grpc", + ArtifactID: "grpc-core", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "grpc-protobuf", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "grpc-stub", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "protoc-gen-grpc-java", + Version: "1.52.1", + Classifier: "linux-x86_64", + Extension: "exe", + }, + }, + AdditionalRuntimes: []MavenRuntimeConfig{ + { + Name: "lite", + Deps: []MavenDependencyConfig{ + { + GroupID: "io.grpc", + ArtifactID: "grpc-core", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "grpc-protobuf-lite", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "grpc-stub", + Version: "1.52.1", + }, + { + GroupID: "io.grpc", + ArtifactID: "protoc-gen-grpc-java", + Version: "1.52.1", + Classifier: "linux-x86_64", + Extension: "exe", + }, + }, + Options: []string{ + "lite", + }, + }, + }, + }, + }, + SPDXLicenseID: "BSD-3-Clause", + }, + pluginConfig, + ) +} + +func TestParsePluginConfigSwiftYAML(t *testing.T) { + t.Parallel() + pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "swift", "buf.plugin.yaml")) + require.NoError(t, err) + pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/bufbuild/connect-swift") + require.NoError(t, err) + pluginDep, err := bufpluginref.PluginReferenceForString("buf.build/apple/swift:v1.21.0", 0) + require.NoError(t, err) + require.Equal( + t, + &Config{ + Name: pluginIdentity, + PluginVersion: "v0.5.0", + SourceURL: "https://github.com/bufbuild/connect-swift", + Description: "Idiomatic gRPC & Connect RPCs for Swift.", + Dependencies: []bufpluginref.PluginReference{pluginDep}, + OutputLanguages: []string{"swift"}, + Registry: &RegistryConfig{ + Swift: &SwiftRegistryConfig{ + Dependencies: []SwiftRegistryDependencyConfig{ + { + Source: "https://github.com/apple/swift-protobuf.git", + Package: "swift-protobuf", + Version: "1.21.0", + Products: []string{"SwiftProtobuf"}, + SwiftVersions: []string{".v5"}, + Platforms: SwiftRegistryDependencyPlatformConfig{ + MacOS: "v10_15", + IOS: "v10_15", + TVOS: "v10_15", + WatchOS: "v10_15", + }, + }, + }, + }, + }, + SPDXLicenseID: "Apache-2.0", + LicenseURL: "https://github.com/bufbuild/connect-swift/blob/0.5.0/LICENSE", + }, + pluginConfig, + ) +} + +func TestParsePluginConfigOptionsYAML(t *testing.T) { + t.Parallel() + pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "options", "buf.plugin.yaml")) + require.NoError(t, err) + pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/protocolbuffers/java") + require.NoError(t, err) + require.Equal( + t, + &Config{ + Name: pluginIdentity, + PluginVersion: "v2.0.0", + }, + pluginConfig, + ) +} + +func TestParsePluginConfigMultipleRegistryConfigsYAML(t *testing.T) { + t.Parallel() + _, err := ParseConfig(filepath.Join("testdata", "failure", "invalid-multiple-registries.yaml")) + require.Error(t, err) +} + +func TestParsePluginConfigEmptyVersionYAML(t *testing.T) { + t.Parallel() + _, err := ParseConfig(filepath.Join("testdata", "failure", "invalid-empty-version.yaml")) + require.Error(t, err) +} + +func TestParsePluginConfigGoNoDepsOrMinVersion(t *testing.T) { + t.Parallel() + cfg, err := ParseConfig(filepath.Join("testdata", "success", "go-empty-registry", "buf.plugin.yaml")) + require.NoError(t, err) + assert.NotNil(t, cfg.Registry) + assert.NotNil(t, cfg.Registry.Go) + assert.Equal(t, &GoRegistryConfig{}, cfg.Registry.Go) +} + +func TestPluginOptionsRoundTrip(t *testing.T) { + t.Parallel() + assertPluginOptionsRoundTrip(t, nil) + assertPluginOptionsRoundTrip(t, map[string]string{}) + assertPluginOptionsRoundTrip(t, map[string]string{ + "option-1": "value-1", + "option-2": "value-2", + "option-no-value-3": "", + }) +} + +func assertPluginOptionsRoundTrip(t testing.TB, options map[string]string) { + optionsSlice := PluginOptionsToOptionsSlice(options) + assert.True(t, sort.SliceIsSorted(optionsSlice, func(i, j int) bool { + return optionsSlice[i] < optionsSlice[j] + })) + assert.Equal(t, options, OptionsSliceToPluginOptions(optionsSlice)) +} + +func TestGetConfigForDataInvalidDependency(t *testing.T) { + t.Parallel() + validConfig, err := os.ReadFile(filepath.Join("testdata", "success", "go", "buf.plugin.yaml")) + require.NoError(t, err) + // Valid dependencies + verifyDependencies(t, validConfig, false, ExternalDependency{Plugin: "buf.build/library/go:v1.27.1"}) + verifyDependencies(t, validConfig, false, ExternalDependency{Plugin: "buf.build/library/go:v1.27.1-rc.1"}) + // Invalid dependencies + verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "library/go:v1.28.0"}) + verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go"}) + verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "other.buf.build/library/go:v1.28.0"}) + verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go:1.28.0"}) + verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go:v1.28.0", Revision: -1}) + verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go:v1.28.0", Revision: math.MaxInt32 + 1}) + // duplicate dependencies (doesn't matter if version differs) + verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go:v1.28.0"}, ExternalDependency{Plugin: "buf.build/library/go:v1.27.0", Revision: 1}) +} + +func verifyDependencies(t testing.TB, validConfigBytes []byte, fail bool, invalidDependencies ...ExternalDependency) { + t.Helper() + // make a defensive copy of a valid parsed config + var cloned *ExternalConfig + err := yaml.Unmarshal(validConfigBytes, &cloned) + require.NoError(t, err) + cloned.Deps = append([]ExternalDependency{}, invalidDependencies...) + yamlBytes, err := yaml.Marshal(cloned) + require.NoError(t, err) + _, err = GetConfigForData(context.Background(), yamlBytes) + if fail { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/config.go b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/config.go new file mode 100644 index 000000000..afc063cd0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/config.go @@ -0,0 +1,376 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginconfig + +import ( + "errors" + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/data/dataspdx" + "golang.org/x/mod/modfile" + "golang.org/x/mod/semver" +) + +func newConfig(externalConfig ExternalConfig, options []ConfigOption) (*Config, error) { + opts := &configOptions{} + for _, option := range options { + option(opts) + } + pluginIdentity, err := pluginIdentityForStringWithOverrideRemote(externalConfig.Name, opts.overrideRemote) + if err != nil { + return nil, err + } + pluginVersion := externalConfig.PluginVersion + if pluginVersion == "" { + return nil, errors.New("a plugin_version is required") + } + if !semver.IsValid(pluginVersion) { + return nil, fmt.Errorf("plugin_version %q must be a valid semantic version", externalConfig.PluginVersion) + } + var dependencies []bufpluginref.PluginReference + if len(externalConfig.Deps) > 0 { + existingDeps := make(map[string]struct{}) + for _, dependency := range externalConfig.Deps { + reference, err := pluginReferenceForStringWithOverrideRemote(dependency.Plugin, dependency.Revision, opts.overrideRemote) + if err != nil { + return nil, err + } + if reference.Remote() != pluginIdentity.Remote() { + return nil, fmt.Errorf("plugin dependency %q must use same remote as plugin %q", dependency, pluginIdentity.Remote()) + } + if _, ok := existingDeps[reference.IdentityString()]; ok { + return nil, fmt.Errorf("plugin dependency %q was specified more than once", dependency) + } + existingDeps[reference.IdentityString()] = struct{}{} + dependencies = append(dependencies, reference) + } + } + registryConfig, err := newRegistryConfig(externalConfig.Registry) + if err != nil { + return nil, err + } + spdxLicenseID := externalConfig.SPDXLicenseID + if spdxLicenseID != "" { + if licenseInfo, ok := dataspdx.GetLicenseInfo(spdxLicenseID); ok { + spdxLicenseID = licenseInfo.ID() + } else { + return nil, fmt.Errorf("unknown SPDX License ID %q", spdxLicenseID) + } + } + return &Config{ + Name: pluginIdentity, + PluginVersion: pluginVersion, + Dependencies: dependencies, + Registry: registryConfig, + SourceURL: externalConfig.SourceURL, + Description: externalConfig.Description, + OutputLanguages: externalConfig.OutputLanguages, + SPDXLicenseID: spdxLicenseID, + LicenseURL: externalConfig.LicenseURL, + }, nil +} + +func newRegistryConfig(externalRegistryConfig ExternalRegistryConfig) (*RegistryConfig, error) { + var ( + isGoEmpty = externalRegistryConfig.Go == nil + isNPMEmpty = externalRegistryConfig.NPM == nil + isMavenEmpty = externalRegistryConfig.Maven == nil + isSwiftEmpty = externalRegistryConfig.Swift == nil + ) + var registryCount int + for _, isEmpty := range []bool{ + isGoEmpty, + isNPMEmpty, + isMavenEmpty, + isSwiftEmpty, + } { + if !isEmpty { + registryCount++ + } + if registryCount > 1 { + // We might eventually want to support multiple runtime configuration, + // but it's safe to start with an error for now. + return nil, fmt.Errorf("%s configuration contains multiple registry configurations", ExternalConfigFilePath) + } + } + if registryCount == 0 { + // It's possible that the plugin doesn't have any runtime dependencies. + return nil, nil + } + options := OptionsSliceToPluginOptions(externalRegistryConfig.Opts) + switch { + case !isGoEmpty: + goRegistryConfig, err := newGoRegistryConfig(externalRegistryConfig.Go) + if err != nil { + return nil, err + } + return &RegistryConfig{ + Go: goRegistryConfig, + Options: options, + }, nil + case !isNPMEmpty: + npmRegistryConfig, err := newNPMRegistryConfig(externalRegistryConfig.NPM) + if err != nil { + return nil, err + } + return &RegistryConfig{ + NPM: npmRegistryConfig, + Options: options, + }, nil + case !isMavenEmpty: + mavenRegistryConfig, err := newMavenRegistryConfig(externalRegistryConfig.Maven) + if err != nil { + return nil, err + } + return &RegistryConfig{ + Maven: mavenRegistryConfig, + Options: options, + }, nil + case !isSwiftEmpty: + swiftRegistryConfig, err := newSwiftRegistryConfig(externalRegistryConfig.Swift) + if err != nil { + return nil, err + } + return &RegistryConfig{ + Swift: swiftRegistryConfig, + Options: options, + }, nil + default: + return nil, errors.New("unknown registry configuration") + } +} + +func newNPMRegistryConfig(externalNPMRegistryConfig *ExternalNPMRegistryConfig) (*NPMRegistryConfig, error) { + if externalNPMRegistryConfig == nil { + return nil, nil + } + var dependencies []*NPMRegistryDependencyConfig + for _, dep := range externalNPMRegistryConfig.Deps { + if dep.Package == "" { + return nil, errors.New("npm runtime dependency requires a non-empty package name") + } + if dep.Version == "" { + return nil, errors.New("npm runtime dependency requires a non-empty version name") + } + // TODO: Note that we don't have NPM-specific validation yet - any + // non-empty string will work for the package and version. + // + // For a complete set of the version syntax we need to support, see + // https://docs.npmjs.com/cli/v6/using-npm/semver + // + // https://github.com/Masterminds/semver might be a good candidate for + // this, but it might not support all of the constraints supported + // by NPM. + dependencies = append( + dependencies, + &NPMRegistryDependencyConfig{ + Package: dep.Package, + Version: dep.Version, + }, + ) + } + switch externalNPMRegistryConfig.ImportStyle { + case "module", "commonjs": + default: + return nil, errors.New(`npm registry config import_style must be one of: "module" or "commonjs"`) + } + return &NPMRegistryConfig{ + RewriteImportPathSuffix: externalNPMRegistryConfig.RewriteImportPathSuffix, + Deps: dependencies, + ImportStyle: externalNPMRegistryConfig.ImportStyle, + }, nil +} + +func newGoRegistryConfig(externalGoRegistryConfig *ExternalGoRegistryConfig) (*GoRegistryConfig, error) { + if externalGoRegistryConfig == nil { + return nil, nil + } + if externalGoRegistryConfig.MinVersion != "" && !modfile.GoVersionRE.MatchString(externalGoRegistryConfig.MinVersion) { + return nil, fmt.Errorf("the go minimum version %q must be a valid semantic version in the form of .", externalGoRegistryConfig.MinVersion) + } + var dependencies []*GoRegistryDependencyConfig + for _, dep := range externalGoRegistryConfig.Deps { + if dep.Module == "" { + return nil, errors.New("go runtime dependency requires a non-empty module name") + } + if dep.Version == "" { + return nil, errors.New("go runtime dependency requires a non-empty version name") + } + if !semver.IsValid(dep.Version) { + return nil, fmt.Errorf("go runtime dependency %s:%s does not have a valid semantic version", dep.Module, dep.Version) + } + dependencies = append( + dependencies, + &GoRegistryDependencyConfig{ + Module: dep.Module, + Version: dep.Version, + }, + ) + } + return &GoRegistryConfig{ + MinVersion: externalGoRegistryConfig.MinVersion, + Deps: dependencies, + }, nil +} + +func newMavenRegistryConfig(externalMavenRegistryConfig *ExternalMavenRegistryConfig) (*MavenRegistryConfig, error) { + if externalMavenRegistryConfig == nil { + return nil, nil + } + var dependencies []MavenDependencyConfig + for _, externalDep := range externalMavenRegistryConfig.Deps { + dep, err := mavenExternalDependencyToDependencyConfig(externalDep) + if err != nil { + return nil, err + } + dependencies = append(dependencies, dep) + } + var additionalRuntimes []MavenRuntimeConfig + for _, runtime := range externalMavenRegistryConfig.AdditionalRuntimes { + var deps []MavenDependencyConfig + for _, externalDep := range runtime.Deps { + dep, err := mavenExternalDependencyToDependencyConfig(externalDep) + if err != nil { + return nil, err + } + deps = append(deps, dep) + } + config := MavenRuntimeConfig{ + Name: runtime.Name, + Deps: deps, + Options: runtime.Opts, + } + additionalRuntimes = append(additionalRuntimes, config) + } + return &MavenRegistryConfig{ + Compiler: MavenCompilerConfig{ + Java: MavenCompilerJavaConfig{ + Encoding: externalMavenRegistryConfig.Compiler.Java.Encoding, + Release: externalMavenRegistryConfig.Compiler.Java.Release, + Source: externalMavenRegistryConfig.Compiler.Java.Source, + Target: externalMavenRegistryConfig.Compiler.Java.Target, + }, + Kotlin: MavenCompilerKotlinConfig{ + APIVersion: externalMavenRegistryConfig.Compiler.Kotlin.APIVersion, + JVMTarget: externalMavenRegistryConfig.Compiler.Kotlin.JVMTarget, + LanguageVersion: externalMavenRegistryConfig.Compiler.Kotlin.LanguageVersion, + Version: externalMavenRegistryConfig.Compiler.Kotlin.Version, + }, + }, + Deps: dependencies, + AdditionalRuntimes: additionalRuntimes, + }, nil +} + +func newSwiftRegistryConfig(externalSwiftRegistryConfig *ExternalSwiftRegistryConfig) (*SwiftRegistryConfig, error) { + if externalSwiftRegistryConfig == nil { + return nil, nil + } + var dependencies []SwiftRegistryDependencyConfig + for _, externalDependency := range externalSwiftRegistryConfig.Deps { + dependency, err := swiftExternalDependencyToDependencyConfig(externalDependency) + if err != nil { + return nil, err + } + dependencies = append(dependencies, dependency) + } + return &SwiftRegistryConfig{ + Dependencies: dependencies, + }, nil +} + +func swiftExternalDependencyToDependencyConfig(externalDep ExternalSwiftRegistryDependencyConfig) (SwiftRegistryDependencyConfig, error) { + if externalDep.Source == "" { + return SwiftRegistryDependencyConfig{}, errors.New("swift runtime dependency requires a non-empty source") + } + if externalDep.Package == "" { + return SwiftRegistryDependencyConfig{}, errors.New("swift runtime dependency requires a non-empty package name") + } + if externalDep.Version == "" { + return SwiftRegistryDependencyConfig{}, errors.New("swift runtime dependency requires a non-empty version name") + } + // Swift SemVers are typically not prefixed with a "v". The Golang semver library requires a "v" prefix. + if !semver.IsValid(fmt.Sprintf("v%s", externalDep.Version)) { + return SwiftRegistryDependencyConfig{}, fmt.Errorf("swift runtime dependency %s:%s does not have a valid semantic version", externalDep.Package, externalDep.Version) + } + return SwiftRegistryDependencyConfig{ + Source: externalDep.Source, + Package: externalDep.Package, + Version: externalDep.Version, + Products: externalDep.Products, + SwiftVersions: externalDep.SwiftVersions, + Platforms: SwiftRegistryDependencyPlatformConfig{ + MacOS: externalDep.Platforms.MacOS, + IOS: externalDep.Platforms.IOS, + TVOS: externalDep.Platforms.TVOS, + WatchOS: externalDep.Platforms.WatchOS, + }, + }, nil +} + +func pluginIdentityForStringWithOverrideRemote(identityStr string, overrideRemote string) (bufpluginref.PluginIdentity, error) { + identity, err := bufpluginref.PluginIdentityForString(identityStr) + if err != nil { + return nil, err + } + if len(overrideRemote) == 0 { + return identity, nil + } + return bufpluginref.NewPluginIdentity(overrideRemote, identity.Owner(), identity.Plugin()) +} + +func pluginReferenceForStringWithOverrideRemote( + referenceStr string, + revision int, + overrideRemote string, +) (bufpluginref.PluginReference, error) { + reference, err := bufpluginref.PluginReferenceForString(referenceStr, revision) + if err != nil { + return nil, err + } + if len(overrideRemote) == 0 { + return reference, nil + } + overrideIdentity, err := pluginIdentityForStringWithOverrideRemote(reference.IdentityString(), overrideRemote) + if err != nil { + return nil, err + } + return bufpluginref.NewPluginReference(overrideIdentity, reference.Version(), reference.Revision()) +} + +func mavenExternalDependencyToDependencyConfig(dependency string) (MavenDependencyConfig, error) { + // ::[:][@] + dependencyWithoutExtension, extension, _ := strings.Cut(dependency, "@") + components := strings.Split(dependencyWithoutExtension, ":") + if len(components) < 3 { + return MavenDependencyConfig{}, fmt.Errorf("invalid dependency %q: missing required groupId:artifactId:version fields", dependency) + } + if len(components) > 4 { + return MavenDependencyConfig{}, fmt.Errorf("invalid dependency %q: maximum 4 fields before optional type", dependency) + } + config := MavenDependencyConfig{ + GroupID: components[0], + ArtifactID: components[1], + Version: components[2], + Extension: extension, + } + if len(components) == 4 { + config.Classifier = components[3] + } + return config, nil +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/get.go b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/get.go new file mode 100644 index 000000000..735f94989 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/get.go @@ -0,0 +1,141 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginconfig + +import ( + "context" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" + "go.uber.org/multierr" +) + +func getConfigForBucket(ctx context.Context, readBucket storage.ReadBucket, options []ConfigOption) (_ *Config, retErr error) { + ctx, span := otel.GetTracerProvider().Tracer("bufbuild/buf").Start(ctx, "get_plugin_config") + defer span.End() + defer func() { + if retErr != nil { + span.RecordError(retErr) + span.SetStatus(codes.Error, retErr.Error()) + } + }() + // This will be in the order of precedence. + var foundConfigFilePaths []string + // Go through all valid config file paths and see which ones are present. + // If none are present, return the default config. + // If multiple are present, error. + for _, configFilePath := range AllConfigFilePaths { + exists, err := storage.Exists(ctx, readBucket, configFilePath) + if err != nil { + return nil, err + } + if exists { + foundConfigFilePaths = append(foundConfigFilePaths, configFilePath) + } + } + switch len(foundConfigFilePaths) { + case 0: + // Did not find anything, return the default. + return newConfig(ExternalConfig{}, options) + case 1: + readObjectCloser, err := readBucket.Get(ctx, foundConfigFilePaths[0]) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, readObjectCloser.Close()) + }() + data, err := io.ReadAll(readObjectCloser) + if err != nil { + return nil, err + } + return getConfigForDataInternal( + ctx, + encoding.UnmarshalYAMLNonStrict, + encoding.UnmarshalYAMLStrict, + data, + readObjectCloser.ExternalPath(), + options, + ) + default: + return nil, fmt.Errorf("only one plugin file can exist but found multiple plugin files: %s", stringutil.SliceToString(foundConfigFilePaths)) + } +} + +func getConfigForData(ctx context.Context, data []byte, options []ConfigOption) (*Config, error) { + _, span := otel.GetTracerProvider().Tracer("bufbuild/buf").Start(ctx, "get_plugin_config_for_data") + defer span.End() + config, err := getConfigForDataInternal( + ctx, + encoding.UnmarshalJSONOrYAMLNonStrict, + encoding.UnmarshalJSONOrYAMLStrict, + data, + "Plugin configuration data", + options, + ) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + } + return config, err +} + +func getConfigForDataInternal( + ctx context.Context, + unmarshalNonStrict func([]byte, interface{}) error, + unmarshalStrict func([]byte, interface{}) error, + data []byte, + id string, + options []ConfigOption, +) (*Config, error) { + var externalConfigVersion externalConfigVersion + if err := unmarshalNonStrict(data, &externalConfigVersion); err != nil { + return nil, err + } + if err := validateExternalConfigVersion(externalConfigVersion, id); err != nil { + return nil, err + } + var externalConfig ExternalConfig + if err := unmarshalStrict(data, &externalConfig); err != nil { + return nil, err + } + return newConfig(externalConfig, options) +} + +func validateExternalConfigVersion(externalConfigVersion externalConfigVersion, id string) error { + switch externalConfigVersion.Version { + case "": + return fmt.Errorf( + `%s has no version set. Please add "version: %s"`, + id, + V1Version, + ) + case V1Version: + return nil + default: + return fmt.Errorf( + `%s has an invalid "version: %s" set. Please add "version: %s"`, + id, + externalConfigVersion.Version, + V1Version, + ) + } +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-plugin-version.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-plugin-version.yaml new file mode 100644 index 000000000..a6681bde5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-plugin-version.yaml @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/protocolbuffers/go diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-version.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-version.yaml new file mode 100644 index 000000000..0e2b1b9aa --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-version.yaml @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: +name: buf.build/protocolbuffers/go +plugin_version: v1.5.0 diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-multiple-registries.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-multiple-registries.yaml new file mode 100644 index 000000000..a424e33a8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-multiple-registries.yaml @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/protocolbuffers/go +plugin_version: v1.5.0 +registry: + npm: + deps: + - package: @types/google-protobuf + version: ^3.15.6 + go: + min_version: 1.18 + maven: + deps: + - group_id: "io.grpc" + artifact_id: "grpc-protobuf" + version: "1.52.1" diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-plugin-version.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-plugin-version.yaml new file mode 100644 index 000000000..4911d7ae3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-plugin-version.yaml @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/protocolbuffers/go +plugin_version: foo diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go-empty-registry/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go-empty-registry/buf.plugin.yaml new file mode 100644 index 000000000..9d1e04cbd --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go-empty-registry/buf.plugin.yaml @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/library/go +plugin_version: v1.28.1 +output_languages: [go] +registry: + go: {} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go/buf.plugin.yaml new file mode 100644 index 000000000..6310777b5 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go/buf.plugin.yaml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/library/go-grpc +plugin_version: v1.2.0 +source_url: https://github.com/grpc/grpc-go +description: Generates Go language bindings of services in protobuf definition files for gRPC. +deps: + - plugin: buf.build/library/go:v1.28.0 + revision: 1 +output_languages: [go] +registry: + go: + min_version: 1.18 + deps: + - module: google.golang.org/grpc + version: v1.32.0 + opts: + - separate_package=true +spdx_license_id: Apache-2.0 +license_url: https://github.com/grpc/grpc-go/blob/master/LICENSE diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/maven/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/maven/buf.plugin.yaml new file mode 100644 index 000000000..e917913ea --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/maven/buf.plugin.yaml @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/grpc/java +plugin_version: v1.0.0 +output_languages: [java] +deps: + - plugin: buf.build/protocolbuffers/java:v22.2 +registry: + maven: + compiler: + java: + encoding: UTF-8 + release: 11 + source: 8 + target: 17 + kotlin: + api_version: 1.8 + jvm_target: 9 + language_version: 1.7 + version: 1.8.0 + deps: + - "io.grpc:grpc-core:1.52.1" + - "io.grpc:grpc-protobuf:1.52.1" + - "io.grpc:grpc-stub:1.52.1" + - "io.grpc:protoc-gen-grpc-java:1.52.1:linux-x86_64@exe" + additional_runtimes: + - name: lite + deps: + - "io.grpc:grpc-core:1.52.1" + - "io.grpc:grpc-protobuf-lite:1.52.1" + - "io.grpc:grpc-stub:1.52.1" + - "io.grpc:protoc-gen-grpc-java:1.52.1:linux-x86_64@exe" + opts: + - lite +spdx_license_id: bsd-3-clause diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/npm/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/npm/buf.plugin.yaml new file mode 100644 index 000000000..ebfd62989 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/npm/buf.plugin.yaml @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/protocolbuffers/js +plugin_version: v1.0.0 +output_languages: [typescript] +registry: + npm: + import_style: commonjs + deps: + - package: "grpc-web" + version: "^1.3.1" + - package: "@types/google-protobuf" + version: "^3.15.6" +spdx_license_id: bsd-3-clause diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/options/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/options/buf.plugin.yaml new file mode 100644 index 000000000..1f6241b57 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/options/buf.plugin.yaml @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/protocolbuffers/java +plugin_version: v2.0.0 diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/swift/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/swift/buf.plugin.yaml new file mode 100644 index 000000000..66c38bf09 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/swift/buf.plugin.yaml @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: v1 +name: buf.build/bufbuild/connect-swift +plugin_version: v0.5.0 +source_url: https://github.com/bufbuild/connect-swift +description: Idiomatic gRPC & Connect RPCs for Swift. +deps: + - plugin: buf.build/apple/swift:v1.21.0 +output_languages: + - swift +registry: + swift: + deps: + - source: https://github.com/apple/swift-protobuf.git + package: swift-protobuf + products: [SwiftProtobuf] + version: 1.21.0 + swift_versions: [".v5"] + platforms: + macos: v10_15 + ios: v10_15 + tvos: v10_15 + watchos: v10_15 +spdx_license_id: Apache-2.0 +license_url: https://github.com/bufbuild/connect-swift/blob/0.5.0/LICENSE diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/bufplugindocker.go b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/bufplugindocker.go new file mode 100644 index 000000000..c920ac37c --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/bufplugindocker.go @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufplugindocker contains utilities for building Buf plugins using the Docker API. +package bufplugindocker + +// ImagePath is the default location for the Docker image archive in a plugin zip file. +const ImagePath = "image.tar" diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker.go b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker.go new file mode 100644 index 000000000..53b2d5251 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker.go @@ -0,0 +1,310 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufplugindocker + +import ( + "bufio" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "strings" + "sync" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginconfig" + "github.com/docker/docker/api/types" + "github.com/docker/docker/client" + "github.com/docker/docker/pkg/jsonmessage" + "github.com/docker/docker/pkg/stringid" + "go.uber.org/multierr" + "go.uber.org/zap" +) + +const ( + // Setting this value on the buf docker client allows us to propagate a custom + // value to the OCI registryv1alpha1. This is a useful property that enables registries + // to differentiate between the buf cli vs other tools like docker cli. + // Note, this does not override the final User-Agent entirely, but instead adds + // the value to the final outgoing User-Agent value in the form: [docker client's UA] UpstreamClient(buf-cli-1.11.0) + // + // Example: User-Agent = [docker/20.10.21 go/go1.18.7 git-commit/3056208 kernel/5.15.49-linuxkit os/linux arch/arm64 UpstreamClient(buf-cli-1.11.0)] + BufUpstreamClientUserAgentPrefix = "buf-cli-" +) + +// Client is a small abstraction over a Docker API client, providing the basic APIs we need to build plugins. +// It ensures that we pass the appropriate parameters to build images (i.e. platform 'linux/amd64'). +type Client interface { + // Load imports a Docker image into the local Docker Engine. + Load(ctx context.Context, image io.Reader) (*LoadResponse, error) + // Push the Docker image to the remote registryv1alpha1. + Push(ctx context.Context, image string, auth *RegistryAuthConfig) (*PushResponse, error) + // Delete removes the Docker image from local Docker Engine. + Delete(ctx context.Context, image string) (*DeleteResponse, error) + // Tag creates a Docker image tag from an existing image and plugin config. + Tag(ctx context.Context, image string, config *bufpluginconfig.Config) (*TagResponse, error) + // Inspect inspects an image and returns the image id. + Inspect(ctx context.Context, image string) (*InspectResponse, error) + // Close releases any resources used by the underlying Docker client. + Close() error +} + +// LoadResponse returns details of a successful load image call. +type LoadResponse struct { + // ImageID specifies the Docker image id in the format :. + // Example: sha256:65001659f150f085e0b37b697a465a95cbfd885d9315b61960883b9ac588744e + ImageID string +} + +// PushResponse is a placeholder for data to be returned from a successful image push call. +type PushResponse struct { + // Digest specifies the Docker image digest in the format :. + // The digest returned from Client.Push differs from the image id returned in Client.Build. + Digest string +} + +// TagResponse returns details of a successful image tag call. +type TagResponse struct { + // Image contains the Docker image name in the local Docker engine including the tag. + // It is created from the bufpluginconfig.Config's Name.IdentityString() and a unique id. + Image string +} + +// DeleteResponse is a placeholder for data to be returned from a successful image delete call. +type DeleteResponse struct{} + +// InspectResponse returns the image id for a given image. +type InspectResponse struct { + // ImageID contains the Docker image's ID. + ImageID string +} + +type dockerAPIClient struct { + cli *client.Client + logger *zap.Logger + lock sync.RWMutex // protects negotiated + negotiated bool +} + +var _ Client = (*dockerAPIClient)(nil) + +func (d *dockerAPIClient) Load(ctx context.Context, image io.Reader) (_ *LoadResponse, retErr error) { + if err := d.negotiateVersion(ctx); err != nil { + return nil, err + } + response, err := d.cli.ImageLoad(ctx, image, true) + if err != nil { + return nil, err + } + defer func() { + if err := response.Body.Close(); err != nil { + retErr = multierr.Append(retErr, fmt.Errorf("docker load response body close error: %w", err)) + } + }() + imageID := "" + responseScanner := bufio.NewScanner(response.Body) + for responseScanner.Scan() { + var jsonMessage jsonmessage.JSONMessage + if err := json.Unmarshal(responseScanner.Bytes(), &jsonMessage); err == nil { + _, loadedImageID, found := strings.Cut(strings.TrimSpace(jsonMessage.Stream), "Loaded image ID: ") + if !found { + continue + } + if !strings.HasPrefix(loadedImageID, "sha256:") { + d.logger.Sugar().Warn("Unsupported image digest", zap.String("imageID", loadedImageID)) + continue + } + if err := stringid.ValidateID(strings.TrimPrefix(loadedImageID, "sha256:")); err != nil { + d.logger.Sugar().Warn("Invalid image id", zap.String("imageID", loadedImageID)) + continue + } + imageID = loadedImageID + } + } + if err := responseScanner.Err(); err != nil { + return nil, err + } + if imageID == "" { + return nil, fmt.Errorf("failed to determine image ID of loaded image") + } + return &LoadResponse{ImageID: imageID}, nil +} + +func (d *dockerAPIClient) Tag(ctx context.Context, image string, config *bufpluginconfig.Config) (*TagResponse, error) { + if err := d.negotiateVersion(ctx); err != nil { + return nil, err + } + buildID := stringid.GenerateRandomID() + imageName := config.Name.IdentityString() + ":" + buildID + if err := d.cli.ImageTag(ctx, image, imageName); err != nil { + return nil, err + } + return &TagResponse{Image: imageName}, nil +} + +func (d *dockerAPIClient) Push(ctx context.Context, image string, auth *RegistryAuthConfig) (response *PushResponse, retErr error) { + if err := d.negotiateVersion(ctx); err != nil { + return nil, err + } + registryAuth, err := auth.ToHeader() + if err != nil { + return nil, err + } + pushReader, err := d.cli.ImagePush(ctx, image, types.ImagePushOptions{ + RegistryAuth: registryAuth, + }) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, pushReader.Close()) + }() + var imageDigest string + pushScanner := bufio.NewScanner(pushReader) + for pushScanner.Scan() { + d.logger.Sugar().Debug(pushScanner.Text()) + var message jsonmessage.JSONMessage + if err := json.Unmarshal([]byte(pushScanner.Text()), &message); err == nil { + if message.Error != nil { + return nil, message.Error + } + if message.Aux != nil { + var pushResult types.PushResult + if err := json.Unmarshal(*message.Aux, &pushResult); err == nil { + imageDigest = pushResult.Digest + } + } + } + } + if err := pushScanner.Err(); err != nil { + return nil, err + } + if len(imageDigest) == 0 { + return nil, fmt.Errorf("failed to determine image digest after push") + } + return &PushResponse{Digest: imageDigest}, nil +} + +func (d *dockerAPIClient) Delete(ctx context.Context, image string) (*DeleteResponse, error) { + if err := d.negotiateVersion(ctx); err != nil { + return nil, err + } + _, err := d.cli.ImageRemove(ctx, image, types.ImageRemoveOptions{}) + if err != nil { + return nil, err + } + return &DeleteResponse{}, nil +} + +func (d *dockerAPIClient) Inspect(ctx context.Context, image string) (*InspectResponse, error) { + if err := d.negotiateVersion(ctx); err != nil { + return nil, err + } + inspect, _, err := d.cli.ImageInspectWithRaw(ctx, image) + if err != nil { + return nil, err + } + return &InspectResponse{ImageID: inspect.ID}, nil +} + +func (d *dockerAPIClient) Close() error { + return d.cli.Close() +} + +func (d *dockerAPIClient) negotiateVersion(ctx context.Context) error { + d.lock.RLock() + negotiated := d.negotiated + d.lock.RUnlock() + if negotiated { + return nil + } + d.lock.Lock() + defer d.lock.Unlock() + if d.negotiated { + return nil + } + deadline := time.Now().Add(5 * time.Second) + if existingDeadline, ok := ctx.Deadline(); ok { + if existingDeadline.Before(deadline) { + deadline = existingDeadline + } + } + ctx, cancel := context.WithDeadline(context.Background(), deadline) + defer cancel() + ping, err := d.cli.Ping(ctx) + if err != nil { + return err + } + d.cli.NegotiateAPIVersionPing(ping) + d.negotiated = true + return nil +} + +// NewClient creates a new Client to use to build Docker plugins. +func NewClient(logger *zap.Logger, cliVersion string, options ...ClientOption) (Client, error) { + if logger == nil { + return nil, errors.New("logger required") + } + opts := &clientOptions{} + for _, option := range options { + option(opts) + } + dockerClientOpts := []client.Opt{ + client.FromEnv, + client.WithHTTPHeaders(map[string]string{ + "User-Agent": BufUpstreamClientUserAgentPrefix + cliVersion, + }), + } + if len(opts.host) > 0 { + dockerClientOpts = append(dockerClientOpts, client.WithHost(opts.host)) + } + if len(opts.version) > 0 { + dockerClientOpts = append(dockerClientOpts, client.WithVersion(opts.version)) + } + cli, err := client.NewClientWithOpts(dockerClientOpts...) + if err != nil { + return nil, err + } + return &dockerAPIClient{ + cli: cli, + logger: logger, + }, nil +} + +type clientOptions struct { + host string + version string +} + +// ClientOption defines options for the NewClient call to customize the underlying Docker client. +type ClientOption func(options *clientOptions) + +// WithHost allows specifying a Docker engine host to connect to (instead of the default lookup using DOCKER_HOST env var). +// This makes it suitable for use by parallel tests. +func WithHost(host string) ClientOption { + return func(options *clientOptions) { + options.host = host + } +} + +// WithVersion allows specifying a Docker API client version instead of using the default version negotiation algorithm. +// This allows tests to implement the Docker engine API using stable URLs. +func WithVersion(version string) ClientOption { + return func(options *clientOptions) { + options.version = version + } +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker_test.go b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker_test.go new file mode 100644 index 000000000..8c7d20d40 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker_test.go @@ -0,0 +1,292 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufplugindocker + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/http/httptest" + "os" + "os/exec" + "path/filepath" + "regexp" + "runtime" + "strings" + "sync" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/docker/docker/api/types" + "github.com/docker/docker/client" + "github.com/docker/docker/pkg/jsonmessage" + "github.com/docker/docker/pkg/stringid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" +) + +const ( + dockerVersion = "1.41" +) + +var imagePattern = regexp.MustCompile("^(?P[^/]+/[^/]+/[^/:]+)(?::(?P[^/]+))?(?:/(?P[^/]+))?$") + +func TestPushSuccess(t *testing.T) { + t.Parallel() + server := newDockerServer(t, dockerVersion) + listenerAddr := server.httpServer.Listener.Addr().String() + dockerClient := createClient(t, WithHost("tcp://"+listenerAddr), WithVersion(dockerVersion)) + image, err := buildDockerPlugin(t, "testdata/success/Dockerfile", listenerAddr+"/library/go") + require.Nilf(t, err, "failed to build docker plugin") + require.NotEmpty(t, image) + pushResponse, err := dockerClient.Push(context.Background(), image, &RegistryAuthConfig{}) + require.Nilf(t, err, "failed to push docker plugin") + require.NotNil(t, pushResponse) + assert.NotEmpty(t, pushResponse.Digest) +} + +func TestPushError(t *testing.T) { + t.Parallel() + server := newDockerServer(t, dockerVersion) + // Send back an error on ImagePush (still return 200 OK). + server.pushErr = errors.New("failed to push image") + listenerAddr := server.httpServer.Listener.Addr().String() + dockerClient := createClient(t, WithHost("tcp://"+listenerAddr), WithVersion(dockerVersion)) + image, err := buildDockerPlugin(t, "testdata/success/Dockerfile", listenerAddr+"/library/go") + require.Nilf(t, err, "failed to build docker plugin") + require.NotEmpty(t, image) + _, err = dockerClient.Push(context.Background(), image, &RegistryAuthConfig{}) + require.NotNil(t, err, "expected error") + assert.Equal(t, server.pushErr.Error(), err.Error()) +} + +func TestMain(m *testing.M) { + var dockerEnabled bool + if cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()); err == nil { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + if _, err := cli.Ping(ctx); err == nil { + dockerEnabled = true + } + _ = cli.Close() + } + if dockerEnabled && runtime.GOOS == "windows" { + // Windows runners don't support building Linux images - need to disable for now. + dockerEnabled = false + } + // call flag.Parse() here if TestMain uses flags + if dockerEnabled { + os.Exit(m.Run()) + } +} + +func createClient(t testing.TB, options ...ClientOption) Client { + t.Helper() + logger, err := zap.NewDevelopment() + require.Nilf(t, err, "failed to create zap logger") + dockerClient, err := NewClient(logger, "buf-cli-1.11.0", options...) + require.Nilf(t, err, "failed to create client") + t.Cleanup(func() { + if err := dockerClient.Close(); err != nil { + t.Errorf("failed to close client: %v", err) + } + }) + return dockerClient +} + +func buildDockerPlugin(t testing.TB, dockerfilePath string, pluginIdentity string) (string, error) { + t.Helper() + docker, err := exec.LookPath("docker") + if err != nil { + return "", err + } + imageName := fmt.Sprintf("%s:%s", pluginIdentity, stringid.GenerateRandomID()) + cmd := command.NewRunner() + envContainer, err := app.NewEnvContainerForOS() + require.NoError(t, err) + if err := cmd.Run( + context.Background(), + docker, + command.RunWithArgs("build", "-t", imageName, "."), + command.RunWithDir(filepath.Dir(dockerfilePath)), + command.RunWithStdout(os.Stdout), + command.RunWithStderr(os.Stderr), + command.RunWithEnv(app.EnvironMap(envContainer)), + ); err != nil { + return "", err + } + t.Logf("created image: %s", imageName) + t.Cleanup(func() { + if err := cmd.Run( + context.Background(), + docker, + command.RunWithArgs("rmi", "--force", imageName), + command.RunWithDir(filepath.Dir(dockerfilePath)), + command.RunWithStdout(os.Stdout), + command.RunWithStderr(os.Stderr), + ); err != nil { + t.Logf("failed to remove temporary docker image: %v", err) + } + }) + return imageName, nil +} + +// dockerServer allows testing some failure flows by simulating the responses to Docker CLI commands. +type dockerServer struct { + httpServer *httptest.Server + h2Server *http2.Server + h2Handler http.Handler + t testing.TB + versionPrefix string + pushErr error + // protects builtImages + mu sync.RWMutex + pushedImages map[string]*pushedImage +} + +type pushedImage struct { + tags []string +} + +func newDockerServer(t testing.TB, version string) *dockerServer { + t.Helper() + versionPrefix := "/v" + version + dockerServer := &dockerServer{ + t: t, + pushedImages: make(map[string]*pushedImage), + versionPrefix: versionPrefix, + } + mux := http.NewServeMux() + mux.HandleFunc(versionPrefix+"/images/", dockerServer.imagesHandler) + mux.HandleFunc("/_ping", func(w http.ResponseWriter, r *http.Request) { + w.Header().Add("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(&types.Ping{APIVersion: version}); err != nil { + t.Fatalf("failed to encode response: %v", err) + } + }) + dockerServer.h2Server = &http2.Server{} + dockerServer.h2Handler = h2c.NewHandler(mux, dockerServer.h2Server) + dockerServer.httpServer = httptest.NewUnstartedServer(dockerServer.h2Handler) + dockerServer.httpServer.Start() + t.Cleanup(dockerServer.httpServer.Close) + return dockerServer +} + +func (d *dockerServer) imagesHandler(w http.ResponseWriter, r *http.Request) { + if _, err := io.Copy(io.Discard, r.Body); err != nil { + d.t.Error("failed to discard body:", err) + } + pathSuffix := strings.TrimPrefix(r.URL.Path, d.versionPrefix+"/images/") + submatches := imagePattern.FindStringSubmatch(pathSuffix) + if len(submatches) == 0 { + w.WriteHeader(http.StatusBadRequest) + return + } + image, tag, operation := submatches[1], submatches[2], submatches[3] + // ImageInspectWithRaw + if r.Method == http.MethodGet && operation == "json" { + d.mu.RLock() + defer d.mu.RUnlock() + foundImageID := d.findImageIDFromName(image + ":" + tag) + if len(foundImageID) == 0 { + http.NotFound(w, r) + return + } + if err := json.NewEncoder(w).Encode(&types.ImageInspect{ + ID: "sha256:" + foundImageID, + RepoTags: d.pushedImages[foundImageID].tags, + }); err != nil { + d.t.Error("failed to encode image inspect response:", err) + } + return + } + // ImageRemove + if r.Method == http.MethodDelete { + d.mu.Lock() + defer d.mu.Unlock() + foundImageID := d.findImageIDFromName(image + ":" + tag) + if len(foundImageID) == 0 { + http.NotFound(w, r) + return + } + delete(d.pushedImages, foundImageID) + if err := json.NewEncoder(w).Encode([]types.ImageDeleteResponseItem{ + {Deleted: "sha256:" + foundImageID}, + }); err != nil { + d.t.Error("failed to encode image delete response:", err) + } + return + } + // ImagePush + w.WriteHeader(http.StatusOK) + if d.pushErr != nil { + d.writeError(w, d.pushErr) + return + } + d.mu.Lock() + defer d.mu.Unlock() + if _, ok := d.pushedImages[image]; !ok { + d.pushedImages[image] = &pushedImage{} + } + imageTag := r.URL.Query()["tag"][0] + d.pushedImages[image].tags = append(d.pushedImages[image].tags, imageTag) + auxJSON, err := json.Marshal(map[string]any{ + "Tag": imageTag, + "Digest": "sha256:" + stringid.GenerateRandomID(), + "Size": 123, + }) + if err != nil { + d.writeError(w, err) + return + } + if err := json.NewEncoder(w).Encode(&jsonmessage.JSONMessage{ + Progress: &jsonmessage.JSONProgress{}, + Aux: (*json.RawMessage)(&auxJSON), + }); err != nil { + d.t.Error("failed to write JSON:", err) + } + if _, err := w.Write([]byte("\r\n")); err != nil { + d.t.Error("failed to write CRLF:", err) + } +} + +func (d *dockerServer) findImageIDFromName(name string) string { + for imageID, builtImageInfo := range d.pushedImages { + for _, imageTag := range builtImageInfo.tags { + if imageTag == name { + return imageID + } + } + } + return "" +} + +func (d *dockerServer) writeError(w http.ResponseWriter, err error) { + if err := json.NewEncoder(w).Encode(&jsonmessage.JSONMessage{Error: &jsonmessage.JSONError{Message: err.Error()}}); err != nil { + d.t.Error("failed to write json message:", err) + } + if _, err := w.Write([]byte{'\r', '\n'}); err != nil { + d.t.Error("failed to write CRLF", err) + } +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config.go b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config.go new file mode 100644 index 000000000..f99e8523a --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config.go @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufplugindocker + +import ( + "encoding/base64" + "encoding/json" + "strings" +) + +// RegistryAuthConfig represents the fields required to authenticate with the Docker Engine API. +// Ref: https://docs.docker.com/engine/api/v1.41/#section/Authentication +type RegistryAuthConfig struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Email string `json:"email,omitempty"` + ServerAddress string `json:"serveraddress,omitempty"` // domain/ip without a protocol +} + +// ToHeader marshals the auth information as a base64 encoded JSON object. +// This is suitable for passing to the Docker API as the X-Registry-Auth header. +func (r *RegistryAuthConfig) ToHeader() (string, error) { + var buffer strings.Builder + writer := base64.NewEncoder(base64.URLEncoding, &buffer) + err := json.NewEncoder(writer).Encode(r) + if err != nil { + return "", err + } + if err := writer.Close(); err != nil { + return "", err + } + return buffer.String(), nil +} + +// fromHeader decodes auth information from a base64 encoded JSON object (see ToHeader). +func (r *RegistryAuthConfig) fromHeader(encoded string) error { + base64Reader := base64.NewDecoder(base64.URLEncoding, strings.NewReader(encoded)) + if err := json.NewDecoder(base64Reader).Decode(r); err != nil { + return err + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config_test.go b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config_test.go new file mode 100644 index 000000000..ff59cc534 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config_test.go @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufplugindocker + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestRegistryAuthMarshalJSON(t *testing.T) { + t.Parallel() + auth := RegistryAuthConfig{ + Username: "someuser", + Password: "somepass", + Email: "someemail@buf.build", + ServerAddress: "buf.build", + } + encoded, err := json.Marshal(auth) + require.NoError(t, err) + var decoded RegistryAuthConfig + err = json.Unmarshal(encoded, &decoded) + require.NoError(t, err) + assert.Equal(t, auth, decoded) +} + +func TestRegistryAuthToFromHeader(t *testing.T) { + t.Parallel() + auth := RegistryAuthConfig{ + Username: "someuser", + Password: "somepass", + Email: "someemail@buf.build", + ServerAddress: "buf.build", + } + encoded, err := auth.ToHeader() + require.NoError(t, err) + var decoded RegistryAuthConfig + err = decoded.fromHeader(encoded) + require.NoError(t, err) + assert.Equal(t, auth, decoded) +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile new file mode 100644 index 000000000..f80657ed4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM alpine:3.18.2 + +RUN echo "success" diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginref/bufpluginref.go b/pkg/bufman/bufpkg/bufplugin/bufpluginref/bufpluginref.go new file mode 100644 index 000000000..ca48641c1 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginref/bufpluginref.go @@ -0,0 +1,158 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginref + +import ( + "fmt" + "strings" +) + +// PluginIdentity is a plugin identity. +// +// It just contains remote, owner, plugin. +type PluginIdentity interface { + Remote() string + Owner() string + Plugin() string + + // IdentityString is the string remote/owner/plugin. + IdentityString() string + + // Prevents this type from being implemented by + // another package. + isPluginIdentity() +} + +// NewPluginIdentity returns a new PluginIdentity. +func NewPluginIdentity( + remote string, + owner string, + plugin string, +) (PluginIdentity, error) { + return newPluginIdentity(remote, owner, plugin) +} + +// PluginIdentityForString returns a new PluginIdentity for the given string. +// +// This parses the path in the form remote/owner/plugin. +func PluginIdentityForString(path string) (PluginIdentity, error) { + remote, owner, plugin, err := parsePluginIdentityComponents(path) + if err != nil { + return nil, err + } + return NewPluginIdentity(remote, owner, plugin) +} + +// PluginReference uniquely references a plugin (including version and revision information). +// +// It can be used to identify dependencies on other plugins. +type PluginReference interface { + PluginIdentity + + // ReferenceString is the string representation of identity:version:revision. + ReferenceString() string + + // Version is the plugin's semantic version. + Version() string + + // Revision is the plugin's revision number. + // + // The accepted range for this value is 0 - math.MaxInt32. + Revision() int + + // Prevents this type from being implemented by + // another package. + isPluginReference() +} + +// NewPluginReference returns a new PluginReference. +func NewPluginReference( + identity PluginIdentity, + version string, + revision int, +) (PluginReference, error) { + return newPluginReference(identity, version, revision) +} + +// PluginReferenceForString returns a new PluginReference for the given string. +// +// This parses the path in the form remote/owner/plugin:version. +func PluginReferenceForString(reference string, revision int) (PluginReference, error) { + return parsePluginReference(reference, revision) +} + +// ParsePluginIdentityOptionalVersion returns the PluginIdentity and version for the given string. +// If the string does not contain a version, the version is assumed to be an empty string. +// This parses the path in the form remote/owner/plugin:version. +func ParsePluginIdentityOptionalVersion(rawReference string) (PluginIdentity, string, error) { + if reference, err := PluginReferenceForString(rawReference, 0); err == nil { + return reference, reference.Version(), nil + } + // Try parsing as a plugin identity (no version information) + identity, err := PluginIdentityForString(rawReference) + if err != nil { + return nil, "", fmt.Errorf("invalid remote plugin %s", rawReference) + } + return identity, "", nil +} + +// IsPluginReferenceOrIdentity returns true if the argument matches a plugin +// reference (with version) or a plugin identity (without version). +func IsPluginReferenceOrIdentity(plugin string) bool { + if _, err := PluginReferenceForString(plugin, 0); err == nil { + return true + } + if _, err := PluginIdentityForString(plugin); err == nil { + return true + } + return false +} + +func parsePluginIdentityComponents(path string) (remote string, owner string, plugin string, err error) { + slashSplit := strings.Split(path, "/") + if len(slashSplit) != 3 { + return "", "", "", newInvalidPluginIdentityStringError(path) + } + remote = strings.TrimSpace(slashSplit[0]) + if remote == "" { + return "", "", "", newInvalidPluginIdentityStringError(path) + } + owner = strings.TrimSpace(slashSplit[1]) + if owner == "" { + return "", "", "", newInvalidPluginIdentityStringError(path) + } + plugin = strings.TrimSpace(slashSplit[2]) + if plugin == "" || strings.ContainsRune(plugin, ':') { + return "", "", "", newInvalidPluginIdentityStringError(path) + } + return remote, owner, plugin, nil +} + +func newInvalidPluginIdentityStringError(s string) error { + return fmt.Errorf("plugin identity %q is invalid: must be in the form remote/owner/plugin", s) +} + +func parsePluginReference(reference string, revision int) (PluginReference, error) { + name, version, ok := strings.Cut(reference, ":") + if !ok { + return nil, fmt.Errorf("plugin references must be specified as \":\" strings") + } + identity, err := PluginIdentityForString(name) + if err != nil { + return nil, err + } + return NewPluginReference(identity, version, revision) +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginref/bufpluginref_test.go b/pkg/bufman/bufpkg/bufplugin/bufpluginref/bufpluginref_test.go new file mode 100644 index 000000000..7fff6fbcb --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginref/bufpluginref_test.go @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginref + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestPluginIdentityForString(t *testing.T) { + t.Parallel() + expectedPluginIdentity, err := NewPluginIdentity("foo.com", "bar", "baz") + require.NoError(t, err) + assert.Equal(t, "foo.com", expectedPluginIdentity.Remote()) + assert.Equal(t, "bar", expectedPluginIdentity.Owner()) + assert.Equal(t, "baz", expectedPluginIdentity.Plugin()) + pluginIdentity, err := PluginIdentityForString("foo.com/bar/baz") + require.NoError(t, err) + assert.Equal(t, expectedPluginIdentity, pluginIdentity) +} + +func TestPluginIdentityForStringError(t *testing.T) { + t.Parallel() + testCases := []struct { + Name string + Input string + }{ + { + Name: "no remote", + Input: "/bar", + }, + { + Name: "no owner", + Input: "foo.com", + }, + { + Name: "empty owner", + Input: "foo.com//baz", + }, + { + Name: "no plugin", + Input: "foo.com/bar", + }, + { + Name: "empty plugin", + Input: "foo.com/bar/", + }, + { + Name: "version separator", + Input: "foo.com/bar/baz:", + }, + { + Name: "version separator with version", + Input: "foo.com/bar/baz:v1.0.0", + }, + } + for _, testCase := range testCases { + testCase := testCase + t.Run(testCase.Name, func(t *testing.T) { + t.Parallel() + _, err := PluginIdentityForString(testCase.Input) + require.Error(t, err) + }) + } +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginref/plugin_identity.go b/pkg/bufman/bufpkg/bufplugin/bufpluginref/plugin_identity.go new file mode 100644 index 000000000..afd69015d --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginref/plugin_identity.go @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginref + +import ( + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/netextended" +) + +type pluginIdentity struct { + remote string + owner string + plugin string +} + +func newPluginIdentity( + remote string, + owner string, + plugin string, +) (*pluginIdentity, error) { + pluginIdentity := &pluginIdentity{ + remote: remote, + owner: owner, + plugin: plugin, + } + if err := ValidatePluginIdentity(pluginIdentity); err != nil { + return nil, err + } + return pluginIdentity, nil +} + +func (m *pluginIdentity) Remote() string { + return m.remote +} + +func (m *pluginIdentity) Owner() string { + return m.owner +} + +func (m *pluginIdentity) Plugin() string { + return m.plugin +} + +func (m *pluginIdentity) IdentityString() string { + return m.remote + "/" + m.owner + "/" + m.plugin +} + +func (*pluginIdentity) isPluginIdentity() {} + +func ValidatePluginIdentity(pluginIdentity PluginIdentity) error { + if pluginIdentity == nil { + return errors.New("plugin identity is required") + } + if err := ValidateRemote(pluginIdentity.Remote()); err != nil { + return err + } + if pluginIdentity.Owner() == "" { + return errors.New("owner name is required") + } + if pluginIdentity.Plugin() == "" { + return errors.New("plugin name is required") + } + return nil +} + +func ValidateRemote(remote string) error { + if remote == "" { + return errors.New("remote name is required") + } + if _, err := netextended.ValidateHostname(remote); err != nil { + return fmt.Errorf("invalid remote %q: %w", remote, err) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginref/plugin_reference.go b/pkg/bufman/bufpkg/bufplugin/bufpluginref/plugin_reference.go new file mode 100644 index 000000000..986d44eea --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/bufpluginref/plugin_reference.go @@ -0,0 +1,93 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginref + +import ( + "fmt" + "math" + "strconv" + + "golang.org/x/mod/semver" +) + +type pluginReference struct { + identity PluginIdentity + version string + revision int +} + +func (p *pluginReference) Remote() string { + return p.identity.Remote() +} + +func (p *pluginReference) Owner() string { + return p.identity.Owner() +} + +func (p *pluginReference) Plugin() string { + return p.identity.Plugin() +} + +func (p *pluginReference) IdentityString() string { + return p.identity.IdentityString() +} + +func (p *pluginReference) isPluginIdentity() {} + +func (p *pluginReference) ReferenceString() string { + return p.identity.IdentityString() + ":" + p.version + ":" + strconv.Itoa(p.revision) +} + +func (p *pluginReference) Version() string { + return p.version +} + +func (p *pluginReference) Revision() int { + return p.revision +} + +func (p *pluginReference) isPluginReference() {} + +func newPluginReference(identity PluginIdentity, version string, revision int) (*pluginReference, error) { + if err := ValidatePluginIdentity(identity); err != nil { + return nil, err + } + if err := ValidatePluginVersion(version); err != nil { + return nil, err + } + if err := validatePluginRevision(revision); err != nil { + return nil, err + } + return &pluginReference{ + identity: identity, + version: version, + revision: revision, + }, nil +} + +func ValidatePluginVersion(version string) error { + if !semver.IsValid(version) { + return fmt.Errorf("plugin version %q is not a valid semantic version", version) + } + return nil +} + +func validatePluginRevision(revision int) error { + if revision < 0 || revision > math.MaxInt32 { + return fmt.Errorf("revision %d is out of accepted range %d-%d", revision, 0, math.MaxInt32) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufplugin/plugin.go b/pkg/bufman/bufpkg/bufplugin/plugin.go new file mode 100644 index 000000000..4cfa81257 --- /dev/null +++ b/pkg/bufman/bufpkg/bufplugin/plugin.go @@ -0,0 +1,97 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufplugin + +import ( + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginref" + "golang.org/x/mod/semver" +) + +type plugin struct { + version string + dependencies []bufpluginref.PluginReference + registry *bufpluginconfig.RegistryConfig + containerImageDigest string + sourceURL string + description string +} + +var _ Plugin = (*plugin)(nil) + +func newPlugin( + version string, + dependencies []bufpluginref.PluginReference, + registryConfig *bufpluginconfig.RegistryConfig, + containerImageDigest string, + sourceURL string, + description string, +) (*plugin, error) { + if version == "" { + return nil, errors.New("plugin version is required") + } + if !semver.IsValid(version) { + // This will probably already be validated in other call-sites + // (e.g. when we construct a *bufpluginconfig.Config or when we + // map from the Protobuf representation), but we may as well + // include it at the lowest common denominator, too. + return nil, fmt.Errorf("plugin version %q must be a valid semantic version", version) + } + if containerImageDigest == "" { + return nil, errors.New("plugin image digest is required") + } + return &plugin{ + version: version, + dependencies: dependencies, + registry: registryConfig, + containerImageDigest: containerImageDigest, + sourceURL: sourceURL, + description: description, + }, nil +} + +// Version returns the plugin's version. +func (p *plugin) Version() string { + return p.version +} + +// Dependencies returns the plugin's dependencies on other plugins. +func (p *plugin) Dependencies() []bufpluginref.PluginReference { + return p.dependencies +} + +// Registry returns the plugin's registry configuration. +func (p *plugin) Registry() *bufpluginconfig.RegistryConfig { + return p.registry +} + +// ContainerImageDigest returns the plugin's image digest. +func (p *plugin) ContainerImageDigest() string { + return p.containerImageDigest +} + +// SourceURL is an optional attribute used to specify where the source for the plugin can be found. +func (p *plugin) SourceURL() string { + return p.sourceURL +} + +// Description is an optional attribute to provide a more detailed description for the plugin. +func (p *plugin) Description() string { + return p.description +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/binary_handler.go b/pkg/bufman/bufpkg/bufpluginexec/binary_handler.go new file mode 100644 index 000000000..59426bbf3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/binary_handler.go @@ -0,0 +1,134 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "bytes" + "context" + "io" + "path/filepath" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appproto" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/ioextended" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "google.golang.org/protobuf/types/pluginpb" +) + +type binaryHandler struct { + runner command.Runner + pluginPath string + tracer trace.Tracer + pluginArgs []string +} + +func newBinaryHandler( + runner command.Runner, + pluginPath string, + pluginArgs []string, +) *binaryHandler { + return &binaryHandler{ + runner: runner, + pluginPath: pluginPath, + tracer: otel.GetTracerProvider().Tracer("bufbuild/buf"), + pluginArgs: pluginArgs, + } +} + +func (h *binaryHandler) Handle( + ctx context.Context, + container app.EnvStderrContainer, + responseWriter appproto.ResponseBuilder, + request *pluginpb.CodeGeneratorRequest, +) error { + ctx, span := h.tracer.Start(ctx, "plugin_proxy", trace.WithAttributes( + attribute.Key("plugin").String(filepath.Base(h.pluginPath)), + )) + defer span.End() + requestData, err := protoencoding.NewWireMarshaler().Marshal(request) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + responseBuffer := bytes.NewBuffer(nil) + stderrWriteCloser := newStderrWriteCloser(container.Stderr(), h.pluginPath) + runOptions := []command.RunOption{ + command.RunWithEnv(app.EnvironMap(container)), + command.RunWithStdin(bytes.NewReader(requestData)), + command.RunWithStdout(responseBuffer), + command.RunWithStderr(stderrWriteCloser), + } + if len(h.pluginArgs) > 0 { + runOptions = append(runOptions, command.RunWithArgs(h.pluginArgs...)) + } + if err := h.runner.Run( + ctx, + h.pluginPath, + runOptions..., + ); err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + response := &pluginpb.CodeGeneratorResponse{} + if err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(responseBuffer.Bytes(), response); err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + response, err = normalizeCodeGeneratorResponse(response) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + if response.GetSupportedFeatures()&uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) != 0 { + responseWriter.SetFeatureProto3Optional() + } + for _, file := range response.File { + if err := responseWriter.AddFile(file); err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + } + // plugin.proto specifies that only non-empty errors are considered errors. + // This is also consistent with protoc's behavior. + // Ref: https://github.com/protocolbuffers/protobuf/blob/069f989b483e63005f87ab309de130677718bbec/src/google/protobuf/compiler/plugin.proto#L100-L108. + if response.GetError() != "" { + responseWriter.AddError(response.GetError()) + } + return nil +} + +func newStderrWriteCloser(delegate io.Writer, pluginPath string) io.WriteCloser { + switch filepath.Base(pluginPath) { + case "protoc-gen-swift": + // https://github.com/ProtobufMan/bufman-cli/issues/1736 + // Swallowing specific stderr message for protoc-gen-swift as protoc-gen-swift, see issue. + // This is all disgusting code but it's simple and it works. + // We did not document if pluginPath is normalized or not, so + return newProtocGenSwiftStderrWriteCloser(delegate) + default: + return ioextended.NopWriteCloser(delegate) + } +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec.go b/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec.go new file mode 100644 index 000000000..bc6d5b47e --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec.go @@ -0,0 +1,244 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufpluginexec provides protoc plugin handling and execution. +// +// Note this is currently implicitly tested through buf's protoc command. +// If this were split out into a separate package, testing would need to be moved to this package. +package bufpluginexec + +import ( + "context" + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufwasm" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appproto" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/zap" + "google.golang.org/protobuf/types/pluginpb" +) + +const ( + // Note on versions: while Protobuf is on vX.0 where X >=21, and we + // download protoc vX.0, the version reported by protoc --version is 3.X.0. + // This is what we want to report here. + + // DefaultMajorVersion is the default major version. + defaultMajorVersion = 4 + // DefaultMinorVersion is the default minor version. + defaultMinorVersion = 22 + // DefaultPatchVersion is the default patch version. + defaultPatchVersion = 0 + // DefaultSuffixVersion is the default suffix version. + defaultSuffixVersion = "" +) + +var ( + // ProtocProxyPluginNames are the names of the plugins that should be proxied through protoc + // in the absence of a binary. + ProtocProxyPluginNames = map[string]struct{}{ + "cpp": {}, + "csharp": {}, + "java": {}, + "js": {}, + "objc": {}, + "php": {}, + "python": {}, + "pyi": {}, + "ruby": {}, + "kotlin": {}, + } + + // DefaultVersion represents the default version to use as compiler version for codegen requests. + DefaultVersion = newVersion( + defaultMajorVersion, + defaultMinorVersion, + defaultPatchVersion, + defaultSuffixVersion, + ) +) + +// Generator is used to generate code with plugins found on the local filesystem. +type Generator interface { + // Generate generates a CodeGeneratorResponse for the given pluginName. The + // pluginName must be available on the system's PATH or one of the plugins + // built-in to protoc. The plugin path can be overridden via the + // GenerateWithPluginPath option. + Generate( + ctx context.Context, + container app.EnvStderrContainer, + pluginName string, + requests []*pluginpb.CodeGeneratorRequest, + options ...GenerateOption, + ) (*pluginpb.CodeGeneratorResponse, error) +} + +// NewGenerator returns a new Generator. +func NewGenerator( + logger *zap.Logger, + storageosProvider storageos.Provider, + runner command.Runner, + wasmPluginExecutor bufwasm.PluginExecutor, +) Generator { + return newGenerator(logger, storageosProvider, runner, wasmPluginExecutor) +} + +// GenerateOption is an option for Generate. +type GenerateOption func(*generateOptions) + +// GenerateWithPluginPath returns a new GenerateOption that uses the given path to the plugin. +// If the path has more than one element, the first is the plugin binary and the others are +// optional additional arguments to pass to the binary. +func GenerateWithPluginPath(pluginPath ...string) GenerateOption { + return func(generateOptions *generateOptions) { + generateOptions.pluginPath = pluginPath + } +} + +// GenerateWithProtocPath returns a new GenerateOption that uses the given protoc +// path to the plugin. +func GenerateWithProtocPath(protocPath string) GenerateOption { + return func(generateOptions *generateOptions) { + generateOptions.protocPath = protocPath + } +} + +// GenerateWithWASMEnabled returns a new GenerateOption that sets wasmEnabled according to the env variable. +func GenerateWithWASMEnabled() GenerateOption { + return func(generateOptions *generateOptions) { + generateOptions.wasmEnabled = true + } +} + +// NewHandler returns a new Handler based on the plugin name and optional path. +// +// protocPath and pluginPath are optional. +// +// - If a WASM plugin path is specified as the plugin name, this returns a WASM handler. +// - If the plugin path is set, this returns a new binary handler for that path. +// - If the plugin path is unset, this does exec.LookPath for a binary named protoc-gen-pluginName, +// and if one is found, a new binary handler is returned for this. +// - Else, if the name is in ProtocProxyPluginNames, this returns a new protoc proxy handler. +// - Else, this returns error. +func NewHandler( + storageosProvider storageos.Provider, + runner command.Runner, + wasmPluginExecutor bufwasm.PluginExecutor, + pluginName string, + options ...HandlerOption, +) (appproto.Handler, error) { + handlerOptions := newHandlerOptions() + for _, option := range options { + option(handlerOptions) + } + + // Initialize WASM plugin handler. This is the quickest check we can do in order to + // branch here. A more stringent check is done inside the handler initialization. + // In a followup we should unify the following three checks into a strategy pattern. + if looksLikeWASM(pluginName) && handlerOptions.wasmEnabled { + return newWasmHandler(wasmPluginExecutor, pluginName) + } + + // Initialize binary plugin handler when path is specified with optional args. Return + // on error as something is wrong with the supplied pluginPath option. + if len(handlerOptions.pluginPath) > 0 { + return NewBinaryHandler(runner, handlerOptions.pluginPath[0], handlerOptions.pluginPath[1:]) + } + + // Initialize binary plugin handler based on plugin name. + if handler, err := NewBinaryHandler(runner, "protoc-gen-"+pluginName, nil); err == nil { + return handler, nil + } + + // Initialize builtin protoc plugin handler. We always look for protoc-gen-X first, + // but if not, check the builtins. + if _, ok := ProtocProxyPluginNames[pluginName]; ok { + if handlerOptions.protocPath == "" { + handlerOptions.protocPath = "protoc" + } + if protocPath, err := unsafeLookPath(handlerOptions.protocPath); err != nil { + return nil, err + } else { + return newProtocProxyHandler(storageosProvider, runner, protocPath, pluginName), nil + } + } + return nil, fmt.Errorf( + "could not find protoc plugin for name %s - please make sure protoc-gen-%s is installed and present on your $PATH", + pluginName, + pluginName, + ) +} + +// HandlerOption is an option for a new Handler. +type HandlerOption func(*handlerOptions) + +// HandlerWithProtocPath returns a new HandlerOption that sets the path to the protoc binary. +// +// The default is to do exec.LookPath on "protoc". +// protocPath is expected to be unnormalized. +func HandlerWithProtocPath(protocPath string) HandlerOption { + return func(handlerOptions *handlerOptions) { + handlerOptions.protocPath = protocPath + } +} + +// HandlerWithPluginPath returns a new HandlerOption that sets the path to the plugin binary. +// +// The default is to do exec.LookPath on "protoc-gen-" + pluginName. pluginPath is expected +// to be unnormalized. If the path has more than one element, the first is the plugin binary +// and the others are optional additional arguments to pass to the binary +func HandlerWithPluginPath(pluginPath ...string) HandlerOption { + return func(handlerOptions *handlerOptions) { + handlerOptions.pluginPath = pluginPath + } +} + +// HandlerWithWASMEnabled returns a new HandlerOption that sets wasmEnabled according to the env variable. +func HandlerWithWASMEnabled() HandlerOption { + return func(handlerOptions *handlerOptions) { + handlerOptions.wasmEnabled = true + } +} + +// NewBinaryHandler returns a new Handler that invokes the specific plugin +// specified by pluginPath. +// +// Used by other repositories. +func NewBinaryHandler(runner command.Runner, pluginPath string, pluginArgs []string) (appproto.Handler, error) { + pluginPath, err := unsafeLookPath(pluginPath) + if err != nil { + return nil, err + } + return newBinaryHandler(runner, pluginPath, pluginArgs), nil +} + +type handlerOptions struct { + protocPath string + pluginPath []string + wasmEnabled bool +} + +func newHandlerOptions() *handlerOptions { + return &handlerOptions{} +} + +// looksLikeWASM is a minimal check for WASM plugins. A more stringent validation +// of the file is done in the handlers Handle method. +func looksLikeWASM(pluginName string) bool { + return strings.HasSuffix(pluginName, ".wasm") +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec_go18.go b/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec_go18.go new file mode 100644 index 000000000..4af2057a3 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec_go18.go @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !go1.19 + +package bufpluginexec + +import ( + "os/exec" +) + +// unsafeLookPath is a wrapper around exec.LookPath that restores the original +// pre-Go 1.19 behavior of resolving queries that would use relative PATH +// entries. We consider it acceptable for the use case of locating plugins. +// +// On Go 1.18 and below, this function is just a direct call to exec.LookPath. +// +// https://pkg.go.dev/os/exec#hdr-Executables_in_the_current_directory +func unsafeLookPath(file string) (string, error) { + return exec.LookPath(file) +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec_go19.go b/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec_go19.go new file mode 100644 index 000000000..1b09e2037 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/bufpluginexec_go19.go @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.19 + +package bufpluginexec + +import ( + "errors" + "os/exec" +) + +// unsafeLookPath is a wrapper around exec.LookPath that restores the original +// pre-Go 1.19 behavior of resolving queries that would use relative PATH +// entries. We consider it acceptable for the use case of locating plugins. +// +// On Go 1.18 and below, this function is just a direct call to exec.LookPath. +// +// https://pkg.go.dev/os/exec#hdr-Executables_in_the_current_directory +func unsafeLookPath(file string) (string, error) { + path, err := exec.LookPath(file) + if errors.Is(err, exec.ErrDot) { + err = nil + } + return path, err +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/generator.go b/pkg/bufman/bufpkg/bufpluginexec/generator.go new file mode 100644 index 000000000..97f49e236 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/generator.go @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufwasm" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appproto" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/zap" + "google.golang.org/protobuf/types/pluginpb" +) + +type generator struct { + logger *zap.Logger + storageosProvider storageos.Provider + runner command.Runner + wasmPluginExecutor bufwasm.PluginExecutor +} + +func newGenerator( + logger *zap.Logger, + storageosProvider storageos.Provider, + runner command.Runner, + wasmPluginExecutor bufwasm.PluginExecutor, +) *generator { + return &generator{ + logger: logger, + storageosProvider: storageosProvider, + runner: runner, + wasmPluginExecutor: wasmPluginExecutor, + } +} + +func (g *generator) Generate( + ctx context.Context, + container app.EnvStderrContainer, + pluginName string, + requests []*pluginpb.CodeGeneratorRequest, + options ...GenerateOption, +) (_ *pluginpb.CodeGeneratorResponse, retErr error) { + generateOptions := newGenerateOptions() + for _, option := range options { + option(generateOptions) + } + handlerOptions := []HandlerOption{ + HandlerWithPluginPath(generateOptions.pluginPath...), + HandlerWithProtocPath(generateOptions.protocPath), + } + if generateOptions.wasmEnabled { + handlerOptions = append( + handlerOptions, + HandlerWithWASMEnabled(), + ) + } + handler, err := NewHandler( + g.storageosProvider, + g.runner, + g.wasmPluginExecutor, + pluginName, + handlerOptions..., + ) + if err != nil { + return nil, err + } + return appproto.NewGenerator( + g.logger, + handler, + ).Generate( + ctx, + container, + requests, + ) +} + +type generateOptions struct { + pluginPath []string + protocPath string + wasmEnabled bool +} + +func newGenerateOptions() *generateOptions { + return &generateOptions{} +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/normalize.go b/pkg/bufman/bufpkg/bufpluginexec/normalize.go new file mode 100644 index 000000000..2bae4500c --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/normalize.go @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "errors" + + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/pluginpb" +) + +func normalizeCodeGeneratorResponse( + response *pluginpb.CodeGeneratorResponse, +) (*pluginpb.CodeGeneratorResponse, error) { + // we do validation after this function returns + if response == nil || len(response.File) == 0 { + return response, nil + } + + prevFile := response.File[0] + if prevFile.GetName() == "" { + return nil, errors.New("first CodeGeneratorResponse.File had no name set") + } + // if we only have one file, just return so that we don't have to handle + // edge cases in our loop + if len(response.File) == 1 { + return response, nil + } + + var curFile *pluginpb.CodeGeneratorResponse_File + newFiles := make([]*pluginpb.CodeGeneratorResponse_File, 0, len(response.File)) + for i := 1; i < len(response.File); i++ { + curFile = response.File[i] + if curFile.GetName() != "" { + // if the name is non-empty, append the previous file to the slice + newFiles = append(newFiles, prevFile) + prevFile = curFile + } else { + // if the name is empty, append the content to the previous file + // after making sure that there is no insertion point on the current file + if curFile.GetInsertionPoint() != "" { + return nil, errors.New("empty name on CodeGeneratorResponse.File with non-empty insertion point") + } + if curFile.Content != nil { + if prevFile.Content == nil { + prevFile.Content = curFile.Content + } else { + prevFile.Content = proto.String( + prevFile.GetContent() + curFile.GetContent(), + ) + } + } + } + // if we are at the end of the loop, add the current file, as we + // will not hit the beginning of the loop again + if i == len(response.File)-1 { + newFiles = append(newFiles, prevFile) + } + } + + return &pluginpb.CodeGeneratorResponse{ + Error: response.Error, + SupportedFeatures: response.SupportedFeatures, + File: newFiles, + }, nil +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/normalize_test.go b/pkg/bufman/bufpkg/bufpluginexec/normalize_test.go new file mode 100644 index 000000000..ebe2f468b --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/normalize_test.go @@ -0,0 +1,187 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "fmt" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/pluginpb" +) + +func TestNormalizeCodeGeneratorResponse(t *testing.T) { + t.Parallel() + for i, testCase := range []struct { + Input *pluginpb.CodeGeneratorResponse + Expected *pluginpb.CodeGeneratorResponse + }{ + { + Input: nil, + Expected: nil, + }, + { + Input: &pluginpb.CodeGeneratorResponse{}, + Expected: &pluginpb.CodeGeneratorResponse{}, + }, + { + Input: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1"), + }, + }, + }, + Expected: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1"), + }, + }, + }, + }, + { + Input: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1"), + }, + { + Content: proto.String("content2"), + }, + }, + }, + Expected: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1content2"), + }, + }, + }, + }, + { + Input: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1"), + }, + { + Content: proto.String("content2"), + }, + { + Name: proto.String("file3"), + Content: proto.String("content3"), + }, + }, + }, + Expected: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1content2"), + }, + { + Name: proto.String("file3"), + Content: proto.String("content3"), + }, + }, + }, + }, + { + Input: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1"), + }, + { + Content: proto.String("content2"), + }, + { + Name: proto.String("file3"), + Content: proto.String("content3"), + }, + { + Content: proto.String("content4"), + }, + }, + }, + Expected: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1content2"), + }, + { + Name: proto.String("file3"), + Content: proto.String("content3content4"), + }, + }, + }, + }, + { + Input: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1"), + }, + { + Content: proto.String("content2"), + }, + { + Name: proto.String("file3"), + Content: proto.String("content3"), + }, + { + Content: proto.String("content4"), + }, + { + Content: proto.String("content5"), + }, + }, + }, + Expected: &pluginpb.CodeGeneratorResponse{ + File: []*pluginpb.CodeGeneratorResponse_File{ + { + Name: proto.String("file1"), + Content: proto.String("content1content2"), + }, + { + Name: proto.String("file3"), + Content: proto.String("content3content4content5"), + }, + }, + }, + }, + } { + testCase := testCase + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + t.Parallel() + actual, err := normalizeCodeGeneratorResponse(testCase.Input) + require.NoError(t, err) + require.Empty(t, cmp.Diff(testCase.Expected, actual, protocmp.Transform())) + }) + } +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/protoc_gen_swift_stderr_write_closer.go b/pkg/bufman/bufpkg/bufpluginexec/protoc_gen_swift_stderr_write_closer.go new file mode 100644 index 000000000..db6826aeb --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/protoc_gen_swift_stderr_write_closer.go @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "bytes" + "errors" + "io" +) + +type protocGenSwiftStderrWriteCloser struct { + delegate io.Writer + buffer *bytes.Buffer +} + +func newProtocGenSwiftStderrWriteCloser(delegate io.Writer) io.WriteCloser { + return &protocGenSwiftStderrWriteCloser{ + delegate: delegate, + buffer: bytes.NewBuffer(nil), + } +} + +func (p *protocGenSwiftStderrWriteCloser) Write(data []byte) (int, error) { + // If protoc-gen-swift, we want to capture all the stderr so we can process it. + return p.buffer.Write(data) +} + +func (p *protocGenSwiftStderrWriteCloser) Close() error { + data := p.buffer.Bytes() + if len(data) == 0 { + return nil + } + newData := bytes.ReplaceAll( + data, + // If swift-protobuf changes their error message, this may not longer filter properly + // but this is OK - this filtering should be treated as non-critical. + // https://github.com/apple/swift-protobuf/blob/c3d060478fcf1f564be0a3876bde8c04247793ae/Sources/protoc-gen-swift/main.swift#L244 + // + // Note that our heuristic as to whether this is protoc-gen-swift or not for isProtocGenSwift + // is that the binary is named protoc-gen-swift, and protoc-gen-swift will print the binary name + // before any message to stderr, so given our protoc-gen-swift heuristic, this is the + // error message that will be printed. + // https://github.com/apple/swift-protobuf/blob/c3d060478fcf1f564be0a3876bde8c04247793ae/Sources/protoc-gen-swift/FileIo.swift#L19 + // + // Tested manually on Mac. + // TODO: Test manually on Windows. + []byte("protoc-gen-swift: WARNING: unknown version of protoc, use 3.2.x or later to ensure JSON support is correct.\n"), + nil, + ) + if len(newData) == 0 { + return nil + } + n, err := p.delegate.Write(newData) + if err != nil { + return err + } + if n != len(newData) { + return errors.New("incomplete write") + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/protoc_proxy_handler.go b/pkg/bufman/bufpkg/bufpluginexec/protoc_proxy_handler.go new file mode 100644 index 000000000..12d36dc31 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/protoc_proxy_handler.go @@ -0,0 +1,203 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "bytes" + "context" + "errors" + "fmt" + "io" + "path/filepath" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appproto" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/ioextended" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/tmp" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.uber.org/multierr" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +type protocProxyHandler struct { + storageosProvider storageos.Provider + runner command.Runner + protocPath string + pluginName string + tracer trace.Tracer +} + +func newProtocProxyHandler( + storageosProvider storageos.Provider, + runner command.Runner, + protocPath string, + pluginName string, +) *protocProxyHandler { + return &protocProxyHandler{ + storageosProvider: storageosProvider, + runner: runner, + protocPath: protocPath, + pluginName: pluginName, + tracer: otel.GetTracerProvider().Tracer("bufbuild/buf"), + } +} + +func (h *protocProxyHandler) Handle( + ctx context.Context, + container app.EnvStderrContainer, + responseWriter appproto.ResponseBuilder, + request *pluginpb.CodeGeneratorRequest, +) (retErr error) { + ctx, span := h.tracer.Start(ctx, "protoc_proxy", trace.WithAttributes( + attribute.Key("plugin").String(filepath.Base(h.pluginName)), + )) + defer span.End() + defer func() { + if retErr != nil { + span.RecordError(retErr) + span.SetStatus(codes.Error, retErr.Error()) + } + }() + protocVersion, err := h.getProtocVersion(ctx, container) + if err != nil { + return err + } + if h.pluginName == "kotlin" && !getKotlinSupportedAsBuiltin(protocVersion) { + return fmt.Errorf("kotlin is not supported for protoc version %s", versionString(protocVersion)) + } + // When we create protocProxyHandlers in NewHandler, we always prefer protoc-gen-.* plugins + // over builtin plugins, so we only get here if we did not find protoc-gen-js, so this + // is an error + if h.pluginName == "js" && !getJSSupportedAsBuiltin(protocVersion) { + return errors.New("js moved to a separate plugin hosted at https://github.com/protocolbuffers/protobuf-javascript in v21, you must install this plugin") + } + fileDescriptorSet := &descriptorpb.FileDescriptorSet{ + File: request.ProtoFile, + } + fileDescriptorSetData, err := protoencoding.NewWireMarshaler().Marshal(fileDescriptorSet) + if err != nil { + return err + } + descriptorFilePath := app.DevStdinFilePath + var tmpFile tmp.File + if descriptorFilePath == "" { + // since we have no stdin file (i.e. Windows), we're going to have to use a temporary file + tmpFile, err = tmp.NewFileWithData(fileDescriptorSetData) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, tmpFile.Close()) + }() + descriptorFilePath = tmpFile.AbsPath() + } + tmpDir, err := tmp.NewDir() + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, tmpDir.Close()) + }() + args := []string{ + fmt.Sprintf("--descriptor_set_in=%s", descriptorFilePath), + fmt.Sprintf("--%s_out=%s", h.pluginName, tmpDir.AbsPath()), + } + if getSetExperimentalAllowProto3OptionalFlag(protocVersion) { + args = append( + args, + "--experimental_allow_proto3_optional", + ) + } + if parameter := request.GetParameter(); parameter != "" { + args = append( + args, + fmt.Sprintf("--%s_opt=%s", h.pluginName, parameter), + ) + } + args = append( + args, + request.FileToGenerate..., + ) + stdin := ioextended.DiscardReader + if descriptorFilePath != "" && descriptorFilePath == app.DevStdinFilePath { + stdin = bytes.NewReader(fileDescriptorSetData) + } + if err := h.runner.Run( + ctx, + h.protocPath, + command.RunWithArgs(args...), + command.RunWithEnv(app.EnvironMap(container)), + command.RunWithStdin(stdin), + command.RunWithStderr(container.Stderr()), + ); err != nil { + // TODO: strip binary path as well? + // We don't know if this is a system error or plugin error, so we assume system error + return handlePotentialTooManyFilesError(err) + } + if getFeatureProto3OptionalSupported(protocVersion) { + responseWriter.SetFeatureProto3Optional() + } + // no need for symlinks here, and don't want to support + readWriteBucket, err := h.storageosProvider.NewReadWriteBucket(tmpDir.AbsPath()) + if err != nil { + return err + } + return storage.WalkReadObjects( + ctx, + readWriteBucket, + "", + func(readObject storage.ReadObject) error { + data, err := io.ReadAll(readObject) + if err != nil { + return err + } + return responseWriter.AddFile( + &pluginpb.CodeGeneratorResponse_File{ + Name: proto.String(readObject.Path()), + Content: proto.String(string(data)), + }, + ) + }, + ) +} + +func (h *protocProxyHandler) getProtocVersion( + ctx context.Context, + container app.EnvContainer, +) (*pluginpb.Version, error) { + stdoutBuffer := bytes.NewBuffer(nil) + if err := h.runner.Run( + ctx, + h.protocPath, + command.RunWithArgs("--version"), + command.RunWithEnv(app.EnvironMap(container)), + command.RunWithStdout(stdoutBuffer), + ); err != nil { + // TODO: strip binary path as well? + return nil, handlePotentialTooManyFilesError(err) + } + return parseVersionForCLIVersion(strings.TrimSpace(stdoutBuffer.String())) +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/util.go b/pkg/bufman/bufpkg/bufpluginexec/util.go new file mode 100644 index 000000000..0a74b2819 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/util.go @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "errors" + "fmt" + "os" +) + +// handlePotentialTooManyFilesError checks if the error is a result of too many files +// being open, and if so, modifies the output error with a help message. +// +// This could potentially go in osextended, but we want to provide a specific help +// message referencing StrategyAll, so it is simplest to just put this here for now. +func handlePotentialTooManyFilesError(err error) error { + if isTooManyFilesError(err) { + return fmt.Errorf("%w: %s", err, tooManyFilesHelpMessage) + } + return err +} + +func isTooManyFilesError(err error) bool { + var syscallError *os.SyscallError + if errors.As(err, &syscallError) { + // This may not actually be correct on other platforms, however the worst case + // is that we just don't provide the additional help message. + // + // Note that syscallError.Syscall has both equalled "pipe" and "fork/exec" in testing, but + // we don't match on this as this could be particularly prone to being platform-specific. + return syscallError.Err != nil && syscallError.Err.Error() == "too many open files" + } + return false +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/util_darwin.go b/pkg/bufman/bufpkg/bufpluginexec/util_darwin.go new file mode 100644 index 000000000..9d9f5edf0 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/util_darwin.go @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build darwin +// +build darwin + +package bufpluginexec + +const tooManyFilesHelpMessage = `This is commonly caused by the maximum file limit being too low. On Mac, the default is 256, which is very low. Run "ulimit -n" to check your file limit. If this happened on generation, setting "strategy: all" for each configured plugin in your buf.gen.yaml can mitigate the issue if you are unable to change your file limit.` diff --git a/pkg/bufman/bufpkg/bufpluginexec/util_undarwin.go b/pkg/bufman/bufpkg/bufpluginexec/util_undarwin.go new file mode 100644 index 000000000..99d751126 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/util_undarwin.go @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !darwin +// +build !darwin + +package bufpluginexec + +const tooManyFilesHelpMessage = `This is commonly caused by the maximum file limit being too low. Run "ulimit -n" to check your file limit. If this happened on generation, setting "strategy: all" for each configured plugin in your buf.gen.yaml can mitigate the issue if you are unable to change your file limit.` diff --git a/pkg/bufman/bufpkg/bufpluginexec/version.go b/pkg/bufman/bufpkg/bufpluginexec/version.go new file mode 100644 index 000000000..f805bb4a7 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/version.go @@ -0,0 +1,155 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "errors" + "fmt" + "strconv" + "strings" + + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/pluginpb" +) + +func newVersion(major int32, minor int32, patch int32, suffix string) *pluginpb.Version { + version := &pluginpb.Version{ + Major: proto.Int32(major), + Minor: proto.Int32(minor), + Patch: proto.Int32(patch), + } + if suffix != "" { + version.Suffix = proto.String(suffix) + } + return version +} + +func parseVersionForCLIVersion(value string) (_ *pluginpb.Version, retErr error) { + defer func() { + if retErr != nil { + retErr = fmt.Errorf("cannot parse protoc version %q: %w", value, retErr) + } + }() + + // protoc always starts with "libprotoc " + value = strings.TrimPrefix(value, "libprotoc ") + split := strings.Split(value, ".") + if n := len(split); n != 2 && n != 3 { + return nil, fmt.Errorf("%d components split by '.'", n) + } + major, err := strconv.ParseInt(split[0], 10, 32) + if err != nil { + return nil, err + } + var suffix string + restSplit := strings.SplitN(split[len(split)-1], "-", 2) + lastNumber, err := strconv.ParseInt(restSplit[0], 10, 32) + if err != nil { + return nil, err + } + switch len(restSplit) { + case 1: + case 2: + suffix = restSplit[1] + default: + return nil, errors.New("more than two patch components split by '-'") + } + var minor int64 + var patch int64 + switch len(split) { + case 2: + minor = lastNumber + case 3: + minor, err = strconv.ParseInt(split[1], 10, 32) + if err != nil { + return nil, err + } + patch = lastNumber + } + return newVersion(int32(major), int32(minor), int32(patch), suffix), nil +} + +func versionString(version *pluginpb.Version) string { + var value string + if version.GetMajor() <= 3 || version.GetPatch() != 0 { + value = fmt.Sprintf("%d.%d.%d", version.GetMajor(), version.GetMinor(), version.GetPatch()) + } else { + value = fmt.Sprintf("%d.%d", version.GetMajor(), version.GetMinor()) + } + if version.Suffix != nil { + value = value + "-" + version.GetSuffix() + } + return value +} + +// Should I set the --experimental_allow_proto3_optional flag? +func getSetExperimentalAllowProto3OptionalFlag(version *pluginpb.Version) bool { + if version.GetSuffix() == "buf" { + return false + } + if version.GetMajor() != 3 { + return false + } + return version.GetMinor() > 11 && version.GetMinor() < 15 +} + +// Should I notify that I am OK with the proto3 optional feature? +func getFeatureProto3OptionalSupported(version *pluginpb.Version) bool { + if version.GetSuffix() == "buf" { + return true + } + if version.GetMajor() < 3 { + return false + } + if version.GetMajor() == 3 { + return version.GetMinor() > 11 + } + // version.GetMajor() > 3 + return true +} + +// Is kotlin supported as a builtin plugin? +func getKotlinSupportedAsBuiltin(version *pluginpb.Version) bool { + if version.GetSuffix() == "buf" { + return true + } + if version.GetMajor() < 3 { + return false + } + if version.GetMajor() == 3 { + return version.GetMinor() > 16 + } + // version.GetMajor() > 3 + return true +} + +// Is js supported as a builtin plugin? +func getJSSupportedAsBuiltin(version *pluginpb.Version) bool { + if version.GetSuffix() == "buf" { + return true + } + if version.GetMajor() < 3 { + return false + } + if version.GetMajor() == 3 { + // v21 and above of protoc still returns "3.MAJOR.Z" for version + return version.GetMinor() < 21 + } + // version.GetMajor() > 3 + // This will catch if they ever change protoc's returned version + // to the proper major version + return false +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/version_test.go b/pkg/bufman/bufpkg/bufpluginexec/version_test.go new file mode 100644 index 000000000..1a605685d --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/version_test.go @@ -0,0 +1,118 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/pluginpb" +) + +func TestVersionString(t *testing.T) { + t.Parallel() + assert.Equal(t, "3.11.1-buf", versionString(newVersion(3, 11, 1, "buf"))) + assert.Equal(t, "3.15.0", versionString(newVersion(3, 15, 0, ""))) + assert.Equal(t, "21.0", versionString(newVersion(21, 0, 0, ""))) + assert.Equal(t, "21.1", versionString(newVersion(21, 1, 0, ""))) + assert.Equal(t, "21.1-rc-1", versionString(newVersion(21, 1, 0, "rc-1"))) + assert.Equal(t, "21.1.1", versionString(newVersion(21, 1, 1, ""))) + assert.Equal(t, "21.1.1-rc-1", versionString(newVersion(21, 1, 1, "rc-1"))) +} + +func TestGetSetExperimentalAllowProto3OptionalFlag(t *testing.T) { + t.Parallel() + assert.False(t, getSetExperimentalAllowProto3OptionalFlag(newVersion(2, 12, 4, ""))) + assert.False(t, getSetExperimentalAllowProto3OptionalFlag(newVersion(3, 11, 1, "buf"))) + assert.False(t, getSetExperimentalAllowProto3OptionalFlag(newVersion(3, 11, 4, ""))) + assert.True(t, getSetExperimentalAllowProto3OptionalFlag(newVersion(3, 12, 1, ""))) + assert.True(t, getSetExperimentalAllowProto3OptionalFlag(newVersion(3, 14, 1, ""))) + assert.False(t, getSetExperimentalAllowProto3OptionalFlag(newVersion(3, 14, 1, "buf"))) + assert.False(t, getSetExperimentalAllowProto3OptionalFlag(newVersion(3, 15, 0, ""))) + assert.False(t, getSetExperimentalAllowProto3OptionalFlag(newVersion(21, 0, 0, ""))) +} + +func TestGetFeatureProto3OptionalSupported(t *testing.T) { + t.Parallel() + assert.False(t, getFeatureProto3OptionalSupported(newVersion(2, 12, 4, ""))) + assert.False(t, getFeatureProto3OptionalSupported(newVersion(3, 11, 4, ""))) + assert.True(t, getFeatureProto3OptionalSupported(newVersion(3, 11, 1, "buf"))) + assert.True(t, getFeatureProto3OptionalSupported(newVersion(3, 12, 1, ""))) + assert.True(t, getFeatureProto3OptionalSupported(newVersion(3, 14, 1, ""))) + assert.True(t, getFeatureProto3OptionalSupported(newVersion(3, 15, 0, ""))) + assert.True(t, getFeatureProto3OptionalSupported(newVersion(21, 0, 0, ""))) +} + +func TestGetKotlinSupportedAsBuiltin(t *testing.T) { + t.Parallel() + assert.True(t, getKotlinSupportedAsBuiltin(newVersion(3, 11, 1, "buf"))) + assert.True(t, getKotlinSupportedAsBuiltin(newVersion(3, 17, 4, ""))) + assert.True(t, getKotlinSupportedAsBuiltin(newVersion(21, 1, 0, ""))) + assert.True(t, getKotlinSupportedAsBuiltin(newVersion(21, 1, 0, "buf"))) + assert.False(t, getKotlinSupportedAsBuiltin(newVersion(3, 12, 1, ""))) + assert.False(t, getKotlinSupportedAsBuiltin(newVersion(3, 14, 1, ""))) +} + +func TestGetJSSupportedAsBuiltin(t *testing.T) { + t.Parallel() + assert.False(t, getJSSupportedAsBuiltin(newVersion(2, 11, 1, ""))) + assert.True(t, getJSSupportedAsBuiltin(newVersion(3, 11, 1, "buf"))) + assert.True(t, getJSSupportedAsBuiltin(newVersion(3, 17, 4, ""))) + assert.True(t, getJSSupportedAsBuiltin(newVersion(3, 20, 1, ""))) + assert.False(t, getJSSupportedAsBuiltin(newVersion(3, 21, 1, ""))) + assert.False(t, getJSSupportedAsBuiltin(newVersion(3, 22, 1, ""))) + assert.False(t, getJSSupportedAsBuiltin(newVersion(21, 1, 0, ""))) + assert.True(t, getJSSupportedAsBuiltin(newVersion(21, 1, 0, "buf"))) +} + +func TestParseVersionForCLIVersion(t *testing.T) { + t.Parallel() + testParseVersionForCLIVersionSuccess(t, "libprotoc 3.14.0", newVersion(3, 14, 0, "")) + testParseVersionForCLIVersionSuccess(t, "libprotoc 3.14.0-rc1", newVersion(3, 14, 0, "rc1")) + testParseVersionForCLIVersionSuccess(t, "libprotoc 3.14.0-rc-1", newVersion(3, 14, 0, "rc-1")) + testParseVersionForCLIVersionSuccess(t, "3.14.0", newVersion(3, 14, 0, "")) + testParseVersionForCLIVersionSuccess(t, "3.14.0-rc1", newVersion(3, 14, 0, "rc1")) + testParseVersionForCLIVersionSuccess(t, "3.14.0-buf", newVersion(3, 14, 0, "buf")) + testParseVersionForCLIVersionSuccess(t, "libprotoc 21.1", newVersion(21, 1, 0, "")) + testParseVersionForCLIVersionSuccess(t, "libprotoc 21.1-rc1", newVersion(21, 1, 0, "rc1")) + testParseVersionForCLIVersionSuccess(t, "libprotoc 21.1-rc-1", newVersion(21, 1, 0, "rc-1")) + testParseVersionForCLIVersionSuccess(t, "21.1", newVersion(21, 1, 0, "")) + testParseVersionForCLIVersionSuccess(t, "21.1-rc1", newVersion(21, 1, 0, "rc1")) + testParseVersionForCLIVersionSuccess(t, "21.1-rc-1", newVersion(21, 1, 0, "rc-1")) + testParseVersionForCLIVersionSuccess(t, "21.1-buf", newVersion(21, 1, 0, "buf")) + testParseVersionForCLIVersionError(t, "libprotoc3.14.0") + testParseVersionForCLIVersionError(t, "libprotoc 3.14.0.1") +} + +func testParseVersionForCLIVersionSuccess( + t *testing.T, + value string, + expectedVersion *pluginpb.Version, +) { + version, err := parseVersionForCLIVersion(value) + assert.NoError(t, err) + if err == nil { + assert.Equal(t, expectedVersion, version) + } +} + +func testParseVersionForCLIVersionError( + t *testing.T, + value string, +) { + _, err := parseVersionForCLIVersion(value) + assert.Error(t, err) +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/wasm_handler.go b/pkg/bufman/bufpkg/bufpluginexec/wasm_handler.go new file mode 100644 index 000000000..c200d7ac4 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/wasm_handler.go @@ -0,0 +1,151 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "bytes" + "context" + "errors" + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufwasm" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appproto" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.uber.org/multierr" + "google.golang.org/protobuf/types/pluginpb" +) + +type wasmHandler struct { + wasmPluginExecutor bufwasm.PluginExecutor + pluginPath string + tracer trace.Tracer +} + +func newWasmHandler( + wasmPluginExecutor bufwasm.PluginExecutor, + pluginPath string, +) (*wasmHandler, error) { + if pluginAbsPath, err := validateWASMFilePath(pluginPath); err != nil { + return nil, err + } else { + return &wasmHandler{ + wasmPluginExecutor: wasmPluginExecutor, + pluginPath: pluginAbsPath, + tracer: otel.GetTracerProvider().Tracer("bufbuild/buf"), + }, nil + } +} + +func (h *wasmHandler) Handle( + ctx context.Context, + container app.EnvStderrContainer, + responseWriter appproto.ResponseBuilder, + request *pluginpb.CodeGeneratorRequest, +) (retErr error) { + ctx, span := h.tracer.Start(ctx, "plugin_proxy", trace.WithAttributes( + attribute.Key("plugin").String(filepath.Base(h.pluginPath)), + )) + defer span.End() + requestData, err := protoencoding.NewWireMarshaler().Marshal(request) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + pluginBytes, err := os.ReadFile(h.pluginPath) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + compiledPlugin, err := h.wasmPluginExecutor.CompilePlugin(ctx, pluginBytes) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + defer func() { + retErr = multierr.Append(retErr, compiledPlugin.Close()) + }() + + responseBuffer := bytes.NewBuffer(nil) + if err := h.wasmPluginExecutor.Run( + ctx, + compiledPlugin, + // command.RunWithEnv(app.EnvironMap(container)), // TODO, not exposed right now + bytes.NewReader(requestData), + responseBuffer, + ); err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + if pluginErr := new(bufwasm.PluginExecutionError); errors.As(err, &pluginErr) { + _, _ = container.Stderr().Write([]byte(pluginErr.Stderr)) + } + return err + } + response := &pluginpb.CodeGeneratorResponse{} + if err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(responseBuffer.Bytes(), response); err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + response, err = normalizeCodeGeneratorResponse(response) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + if response.GetSupportedFeatures()&uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) != 0 { + responseWriter.SetFeatureProto3Optional() + } + for _, file := range response.File { + if err := responseWriter.AddFile(file); err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + } + // plugin.proto specifies that only non-empty errors are considered errors. + // This is also consistent with protoc's behavior. + // Ref: https://github.com/protocolbuffers/protobuf/blob/069f989b483e63005f87ab309de130677718bbec/src/google/protobuf/compiler/plugin.proto#L100-L108. + if response.GetError() != "" { + responseWriter.AddError(response.GetError()) + } + return nil +} + +func validateWASMFilePath(path string) (string, error) { + path, err := filepath.Abs(path) + if err != nil { + return path, err + } + info, err := os.Stat(path) + if err != nil { + return path, err + } + if !info.Mode().IsRegular() || !strings.HasSuffix(path, ".wasm") { + return path, fmt.Errorf("invalid WASM file: %s", path) + } + return path, nil +} diff --git a/pkg/bufman/bufpkg/bufpluginexec/wasm_handler_test.go b/pkg/bufman/bufpkg/bufpluginexec/wasm_handler_test.go new file mode 100644 index 000000000..6ad518c63 --- /dev/null +++ b/pkg/bufman/bufpkg/bufpluginexec/wasm_handler_test.go @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufpluginexec + +import ( + "errors" + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestValidateWASMFilePath(t *testing.T) { + t.Parallel() + wasmPath := t.TempDir() + "/test.wasm" + notWasmPath := t.TempDir() + "/test.txt" + assert.NoError(t, os.WriteFile(wasmPath, []byte("a"), 0o600)) + assert.NoError(t, os.WriteFile(notWasmPath, []byte("a"), 0o600)) + t.Run("pass for valid wasm", func(t *testing.T) { + t.Parallel() + _, err := validateWASMFilePath(wasmPath) + assert.NoError(t, err) + }) + t.Run("fail if not found", func(t *testing.T) { + t.Parallel() + _, err := validateWASMFilePath("notfound") + assert.True(t, errors.Is(err, os.ErrNotExist)) + }) + t.Run("fail if invalid extension", func(t *testing.T) { + t.Parallel() + _, err := validateWASMFilePath(notWasmPath) + assert.Error(t, err) + }) +} diff --git a/pkg/bufman/bufpkg/bufreflect/bufreflect.go b/pkg/bufman/bufpkg/bufreflect/bufreflect.go new file mode 100644 index 000000000..c3bed17a8 --- /dev/null +++ b/pkg/bufman/bufpkg/bufreflect/bufreflect.go @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufreflect + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/dynamicpb" +) + +// NewMessage returns a new dynamic proto.Message for the fully qualified typeName +// in the bufimage.Image. +func NewMessage( + ctx context.Context, + image bufimage.Image, + typeName string, +) (proto.Message, error) { + if err := ValidateTypeName(typeName); err != nil { + return nil, err + } + files, err := protodesc.NewFiles(bufimage.ImageToFileDescriptorSet(image)) + if err != nil { + return nil, err + } + descriptor, err := files.FindDescriptorByName(protoreflect.FullName(typeName)) + if err != nil { + return nil, err + } + typedDescriptor, ok := descriptor.(protoreflect.MessageDescriptor) + if !ok { + return nil, fmt.Errorf("%q must be a message but is a %T", typeName, descriptor) + } + return dynamicpb.NewMessage(typedDescriptor), nil +} + +// ValidateTypeName validates that the typeName is well-formed, such that it has one or more +// '.'-delimited package components and no '/' elements. +func ValidateTypeName(typeName string) error { + if fullName := protoreflect.FullName(typeName); !fullName.IsValid() { + return fmt.Errorf("%q is not a valid fully qualified type name", fullName) + } + return nil +} diff --git a/pkg/bufman/bufpkg/bufremoteplugin/bufremoteplugin.go b/pkg/bufman/bufpkg/bufremoteplugin/bufremoteplugin.go new file mode 100644 index 000000000..a4a543501 --- /dev/null +++ b/pkg/bufman/bufpkg/bufremoteplugin/bufremoteplugin.go @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufremoteplugin + +import ( + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" +) + +const ( + // PluginsPathName is the path prefix used to signify that + // a name belongs to a plugin. + PluginsPathName = "plugins" +) + +// ParsePluginPath parses a string in the format +// into remote, owner and name. +func ParsePluginPath(pluginPath string) (remote string, owner string, name string, _ error) { + if pluginPath == "" { + return "", "", "", appcmd.NewInvalidArgumentError("you must specify a plugin path") + } + components := strings.Split(pluginPath, "/") + if len(components) != 4 || components[2] != PluginsPathName { + return "", "", "", appcmd.NewInvalidArgumentErrorf("%s is not a valid plugin path", pluginPath) + } + return components[0], components[1], components[3], nil +} + +// ParsePluginVersionPath parses a string in the format +// into remote, owner, name and version. The version is empty if not specified. +func ParsePluginVersionPath(pluginVersionPath string) (remote string, owner string, name string, version string, _ error) { + remote, owner, name, err := ParsePluginPath(pluginVersionPath) + if err != nil { + return "", "", "", "", err + } + components := strings.Split(name, ":") + switch len(components) { + case 2: + return remote, owner, components[0], components[1], nil + case 1: + return remote, owner, name, "", nil + default: + return "", "", "", "", fmt.Errorf("invalid version: %q", name) + } +} diff --git a/pkg/bufman/bufpkg/bufstudioagent/buffer_codec.go b/pkg/bufman/bufpkg/bufstudioagent/buffer_codec.go new file mode 100644 index 000000000..33b92b687 --- /dev/null +++ b/pkg/bufman/bufpkg/bufstudioagent/buffer_codec.go @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufstudioagent + +import ( + "bytes" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + connect "github.com/bufbuild/connect-go" + "google.golang.org/protobuf/proto" +) + +// bufferCodec is a connect.Codec for use with clients of type +// connect.Client[bytes.Buffer, bytes.Buffer] which does not attempt to parse +// messages but instead allows the application layer to work on the buffers +// directly. This is useful for creating proxies. +type bufferCodec struct { + name string +} + +var _ connect.Codec = (*bufferCodec)(nil) + +func (b *bufferCodec) Name() string { return b.name } + +func (b *bufferCodec) Marshal(src any) ([]byte, error) { + switch typedSrc := src.(type) { + case *bytes.Buffer: + return typedSrc.Bytes(), nil + case proto.Message: + // When the codec is named "proto", connect will assume that it + // may also be used to unmarshal the errors in the + // grpc-status-details-bin trailer. The type used is not + // exported so we match against the general proto.Message. + return protoencoding.NewWireMarshaler().Marshal(typedSrc) + default: + return nil, fmt.Errorf("marshal unexpected type %T", src) + } +} + +func (b *bufferCodec) Unmarshal(src []byte, dst any) error { + switch destination := dst.(type) { + case *bytes.Buffer: + destination.Reset() + _, err := io.Copy(destination, bytes.NewReader(src)) + return err + case proto.Message: + // When the codec is named "proto", connect will assume that it + // may also be used to unmarshal the errors in the + // grpc-status-details-bin trailer. The type used is not + // exported so we match against the general proto.Message. + return protoencoding.NewWireUnmarshaler(nil).Unmarshal(src, destination) + default: + return fmt.Errorf("unmarshal unexpected type %T", dst) + } +} diff --git a/pkg/bufman/bufpkg/bufstudioagent/bufstudioagent.go b/pkg/bufman/bufpkg/bufstudioagent/bufstudioagent.go new file mode 100644 index 000000000..fc9f4ae40 --- /dev/null +++ b/pkg/bufman/bufpkg/bufstudioagent/bufstudioagent.go @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufstudioagent + +import ( + "crypto/tls" + "net/http" + + "github.com/rs/cors" + "go.uber.org/zap" +) + +// NewHandler creates a new handler that serves the invoke endpoints for the +// agent. +func NewHandler( + logger *zap.Logger, + origin string, + tlsClientConfig *tls.Config, + disallowedHeaders map[string]struct{}, + forwardHeaders map[string]string, + privateNetwork bool, +) http.Handler { + corsHandlerOptions := cors.Options{ + AllowedOrigins: []string{origin}, + AllowedMethods: []string{http.MethodPost, http.MethodOptions}, + AllowCredentials: true, + } + if privateNetwork { + corsHandlerOptions.AllowPrivateNetwork = true + } + corsHandler := cors.New(corsHandlerOptions) + plainHandler := corsHandler.Handler(newPlainPostHandler(logger, disallowedHeaders, forwardHeaders, tlsClientConfig)) + mux := http.NewServeMux() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodGet: + // In the future we could check for an upgrade header here. + _, _ = w.Write([]byte("OK")) + case http.MethodPost: + plainHandler.ServeHTTP(w, r) + return + case http.MethodOptions: + if privateNetwork { + corsHandler.HandlerFunc(w, r) + return + } + // If the private network flag is not used, fall through to the default + fallthrough + default: + http.Error(w, "", http.StatusMethodNotAllowed) + return + } + }) + return mux +} diff --git a/pkg/bufman/bufpkg/bufstudioagent/bufstudioagent_test.go b/pkg/bufman/bufpkg/bufstudioagent/bufstudioagent_test.go new file mode 100644 index 000000000..c1b7dc5ce --- /dev/null +++ b/pkg/bufman/bufpkg/bufstudioagent/bufstudioagent_test.go @@ -0,0 +1,282 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufstudioagent + +import ( + "bytes" + "context" + "crypto/x509" + "encoding/base64" + "errors" + "io" + "net" + "net/http" + "net/http/httptest" + "strconv" + "testing" + + studiov1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/studio/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "github.com/bufbuild/connect-go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" + "google.golang.org/protobuf/proto" +) + +const ( + echoPath = "/echo.Service/EchoEcho" + errorPath = "/error.Service/Error" +) + +func TestPlainPostHandlerTLS(t *testing.T) { + upstreamServerTLS := newTestConnectServer(t, true) + defer upstreamServerTLS.Close() + testPlainPostHandler(t, upstreamServerTLS) + testPlainPostHandlerErrors(t, upstreamServerTLS) +} + +func TestPlainPostHandlerH2C(t *testing.T) { + upstreamServerH2C := newTestConnectServer(t, false) + defer upstreamServerH2C.Close() + testPlainPostHandler(t, upstreamServerH2C) + testPlainPostHandlerErrors(t, upstreamServerH2C) +} + +func testPlainPostHandler(t *testing.T, upstreamServer *httptest.Server) { + agentServer := httptest.NewTLSServer( + NewHandler( + zaptest.NewLogger(t), + "https://example.buf.build", + upstreamServer.TLS, + nil, + map[string]string{"foo": "bar"}, + false, + ), + ) + defer agentServer.Close() + + t.Run("content_type_grpc_proto", func(t *testing.T) { + requestProto := &studiov1alpha1.InvokeRequest{ + Target: upstreamServer.URL + echoPath, + Headers: goHeadersToProtoHeaders(http.Header{ + "Content-Type": []string{"application/grpc+proto"}, + }), + Body: []byte("echothis"), + } + requestBytes := protoMarshalBase64(t, requestProto) + request, err := http.NewRequest(http.MethodPost, agentServer.URL, bytes.NewReader(requestBytes)) + require.NoError(t, err) + request.Header.Set("Content-Type", "text/plain") + request.Header.Set("Origin", "https://example.buf.build") + request.Header.Set("Foo", "foo-value") + response, err := agentServer.Client().Do(request) + require.NoError(t, err) + defer response.Body.Close() + + assert.Equal(t, http.StatusOK, response.StatusCode) + assert.Equal(t, "https://example.buf.build", response.Header.Get("Access-Control-Allow-Origin")) + responseBytes, err := io.ReadAll(response.Body) + assert.NoError(t, err) + invokeResponse := &studiov1alpha1.InvokeResponse{} + protoUnmarshalBase64(t, responseBytes, invokeResponse) + upstreamResponseHeaders := make(http.Header) + addProtoHeadersToGoHeader(invokeResponse.Headers, upstreamResponseHeaders) + addProtoHeadersToGoHeader(invokeResponse.Trailers, upstreamResponseHeaders) + assert.Equal(t, "0", upstreamResponseHeaders.Get("grpc-status")) + assert.Equal(t, []byte("echo: echothis"), invokeResponse.Body) + assert.Equal(t, "foo-value", upstreamResponseHeaders.Get("Echo-Bar")) + }) + + t.Run("content_type_application_proto", func(t *testing.T) { + requestProto := &studiov1alpha1.InvokeRequest{ + Target: upstreamServer.URL + echoPath, + Headers: goHeadersToProtoHeaders(http.Header{ + "Content-Type": []string{"application/proto"}, + }), + Body: []byte("echothis"), + } + requestBytes := protoMarshalBase64(t, requestProto) + request, err := http.NewRequest(http.MethodPost, agentServer.URL, bytes.NewReader(requestBytes)) + require.NoError(t, err) + request.Header.Set("Content-Type", "text/plain") + request.Header.Set("Origin", "https://example.buf.build") + request.Header.Set("Foo", "foo-value") + response, err := agentServer.Client().Do(request) + require.NoError(t, err) + defer response.Body.Close() + + assert.Equal(t, http.StatusOK, response.StatusCode) + assert.Equal(t, "https://example.buf.build", response.Header.Get("Access-Control-Allow-Origin")) + responseBytes, err := io.ReadAll(response.Body) + assert.NoError(t, err) + invokeResponse := &studiov1alpha1.InvokeResponse{} + protoUnmarshalBase64(t, responseBytes, invokeResponse) + upstreamResponseHeaders := make(http.Header) + addProtoHeadersToGoHeader(invokeResponse.Headers, upstreamResponseHeaders) + addProtoHeadersToGoHeader(invokeResponse.Trailers, upstreamResponseHeaders) + assert.Equal(t, "", upstreamResponseHeaders.Get("grpc-status")) + assert.Equal(t, []byte("echo: echothis"), invokeResponse.Body) + assert.Equal(t, "foo-value", upstreamResponseHeaders.Get("Echo-Bar")) + }) +} + +func testPlainPostHandlerErrors(t *testing.T, upstreamServer *httptest.Server) { + agentServer := httptest.NewTLSServer( + NewHandler( + zaptest.NewLogger(t), + "https://example.buf.build", + upstreamServer.TLS, + map[string]struct{}{"forbidden-header": {}}, + nil, + false, + ), + ) + defer agentServer.Close() + + t.Run("forbidden_header", func(t *testing.T) { + requestProto := &studiov1alpha1.InvokeRequest{ + Target: upstreamServer.URL + echoPath, + Headers: goHeadersToProtoHeaders(http.Header{ + "forbidden-header": []string{""}, + }), + } + requestBytes := protoMarshalBase64(t, requestProto) + request, err := http.NewRequest(http.MethodPost, agentServer.URL, bytes.NewReader(requestBytes)) + require.NoError(t, err) + request.Header.Set("Content-Type", "text/plain") + response, err := agentServer.Client().Do(request) + require.NoError(t, err) + defer response.Body.Close() + assert.Equal(t, http.StatusBadRequest, response.StatusCode) + }) + + t.Run("error_response", func(t *testing.T) { + requestProto := &studiov1alpha1.InvokeRequest{ + Target: upstreamServer.URL + errorPath, + Headers: goHeadersToProtoHeaders(http.Header{ + "Content-Type": []string{"application/grpc"}, + }), + Body: []byte("something"), + } + requestBytes := protoMarshalBase64(t, requestProto) + request, err := http.NewRequest(http.MethodPost, agentServer.URL, bytes.NewReader(requestBytes)) + require.NoError(t, err) + request.Header.Set("Content-Type", "text/plain") + response, err := agentServer.Client().Do(request) + require.NoError(t, err) + defer response.Body.Close() + assert.Equal(t, http.StatusOK, response.StatusCode) + responseBytes, err := io.ReadAll(response.Body) + assert.NoError(t, err) + invokeResponse := &studiov1alpha1.InvokeResponse{} + protoUnmarshalBase64(t, responseBytes, invokeResponse) + upstreamResponseHeaders := make(http.Header) + addProtoHeadersToGoHeader(invokeResponse.Headers, upstreamResponseHeaders) + addProtoHeadersToGoHeader(invokeResponse.Trailers, upstreamResponseHeaders) + assert.Equal(t, strconv.Itoa(int(connect.CodeFailedPrecondition)), upstreamResponseHeaders.Get("grpc-status")) + assert.Equal(t, "something", upstreamResponseHeaders.Get("grpc-message")) + }) + + t.Run("invalid_upstream", func(t *testing.T) { + listener, err := net.Listen("tcp", "127.0.0.1:") + require.NoError(t, err) + go func() { + conn, err := listener.Accept() + require.NoError(t, err) + require.NoError(t, conn.Close()) + }() + defer listener.Close() + + requestProto := &studiov1alpha1.InvokeRequest{ + Target: "http://" + listener.Addr().String(), + Headers: goHeadersToProtoHeaders(http.Header{ + "Content-Type": []string{"application/grpc"}, + }), + } + requestBytes := protoMarshalBase64(t, requestProto) + request, err := http.NewRequest(http.MethodPost, agentServer.URL, bytes.NewReader(requestBytes)) + require.NoError(t, err) + request.Header.Set("Content-Type", "text/plain") + response, err := agentServer.Client().Do(request) + require.NoError(t, err) + defer response.Body.Close() + assert.Equal(t, http.StatusBadGateway, response.StatusCode) + }) +} + +func newTestConnectServer(t *testing.T, tls bool) *httptest.Server { + mux := http.NewServeMux() + // echoPath echoes all incoming headers (prefixed with "Echo-") and the + // body bytes prefixed with "echo: " + mux.Handle(echoPath, connect.NewUnaryHandler( + echoPath, + func(ctx context.Context, r *connect.Request[bytes.Buffer]) (*connect.Response[bytes.Buffer], error) { + response := connect.NewResponse(bytes.NewBuffer(append([]byte("echo: "), r.Msg.Bytes()...))) + for header, values := range r.Header() { + for _, value := range values { + response.Header().Add("Echo-"+header, value) + } + } + return response, nil + }, + connect.WithCodec(&bufferCodec{name: "proto"}), + )) + // errorPath returns the body as error message with code failed precondition + mux.Handle(errorPath, connect.NewUnaryHandler( + errorPath, + func(ctx context.Context, r *connect.Request[bytes.Buffer]) (*connect.Response[bytes.Buffer], error) { + return nil, connect.NewError(connect.CodeFailedPrecondition, errors.New(r.Msg.String())) + }, + connect.WithCodec(&bufferCodec{name: "proto"}), + )) + if tls { + upstreamServerTLS := httptest.NewUnstartedServer(mux) + upstreamServerTLS.EnableHTTP2 = true + upstreamServerTLS.StartTLS() + certpool := x509.NewCertPool() + certpool.AddCert(upstreamServerTLS.Certificate()) + upstreamServerTLS.TLS.RootCAs = certpool + return upstreamServerTLS + } + return httptest.NewServer(h2c.NewHandler(mux, &http2.Server{})) +} + +func protoMarshalBase64(t *testing.T, message proto.Message) []byte { + protoBytes, err := protoencoding.NewWireMarshaler().Marshal(message) + require.NoError(t, err) + base64Bytes := make([]byte, base64.StdEncoding.EncodedLen(len(protoBytes))) + base64.StdEncoding.Encode(base64Bytes, protoBytes) + return base64Bytes +} + +func protoUnmarshalBase64(t *testing.T, base64Bytes []byte, message proto.Message) { + protoBytes := make([]byte, base64.StdEncoding.DecodedLen(len(base64Bytes))) + actualLen, err := base64.StdEncoding.Decode(protoBytes, base64Bytes) + require.NoError(t, err) + protoBytes = protoBytes[:actualLen] + require.NoError(t, protoencoding.NewWireUnmarshaler(nil).Unmarshal(protoBytes, message)) +} + +func addProtoHeadersToGoHeader(fromHeaders []*studiov1alpha1.Headers, toHeaders http.Header) { + for _, meta := range fromHeaders { + for _, value := range meta.Value { + toHeaders.Add(meta.Key, value) + } + } +} diff --git a/pkg/bufman/bufpkg/bufstudioagent/plain_post_handler.go b/pkg/bufman/bufpkg/bufstudioagent/plain_post_handler.go new file mode 100644 index 000000000..294b46bdf --- /dev/null +++ b/pkg/bufman/bufpkg/bufstudioagent/plain_post_handler.go @@ -0,0 +1,270 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufstudioagent + +import ( + "bytes" + "crypto/tls" + "encoding/base64" + "errors" + "fmt" + "io" + "net" + "net/http" + "net/textproto" + "net/url" + + studiov1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/studio/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "github.com/bufbuild/connect-go" + "go.uber.org/zap" + "golang.org/x/net/http2" + "google.golang.org/protobuf/proto" +) + +// MaxMessageSizeBytesDefault determines the maximum number of bytes to read +// from the request body. +const MaxMessageSizeBytesDefault = 1024 * 1024 * 5 + +// plainPostHandler implements a POST handler for forwarding requests that can +// be called with simple CORS requests. +// +// Simple CORS requests are limited [1] to certain headers and content types, so +// this handler expects base64 encoded protobuf messages in the body and writes +// out base64 encoded protobuf messages to be able to use Content-Type: text/plain. +// +// Because of the content-type restriction we do not define a protobuf service +// that gets served by connect but instead use a plain post handler. +// +// [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests). +type plainPostHandler struct { + Logger *zap.Logger + MaxMessageSizeBytes int64 + B64Encoding *base64.Encoding + TLSClient *http.Client + H2CClient *http.Client + DisallowedHeaders map[string]struct{} + ForwardHeaders map[string]string +} + +func newPlainPostHandler( + logger *zap.Logger, + disallowedHeaders map[string]struct{}, + forwardHeaders map[string]string, + tlsClientConfig *tls.Config, +) *plainPostHandler { + canonicalDisallowedHeaders := make(map[string]struct{}, len(disallowedHeaders)) + for k := range disallowedHeaders { + canonicalDisallowedHeaders[textproto.CanonicalMIMEHeaderKey(k)] = struct{}{} + } + canonicalForwardHeaders := make(map[string]string, len(forwardHeaders)) + for k, v := range forwardHeaders { + canonicalForwardHeaders[textproto.CanonicalMIMEHeaderKey(k)] = v + } + return &plainPostHandler{ + B64Encoding: base64.StdEncoding, + DisallowedHeaders: canonicalDisallowedHeaders, + ForwardHeaders: canonicalForwardHeaders, + H2CClient: &http.Client{ + Transport: &http2.Transport{ + AllowHTTP: true, + DialTLS: func(netw, addr string, config *tls.Config) (net.Conn, error) { + return net.Dial(netw, addr) + }, + }, + }, + Logger: logger, + MaxMessageSizeBytes: MaxMessageSizeBytesDefault, + TLSClient: &http.Client{ + Transport: &http2.Transport{ + TLSClientConfig: tlsClientConfig, + }, + }, + } +} + +func (i *plainPostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + http.Error(w, "", http.StatusMethodNotAllowed) + return + } + if r.Header.Get("content-type") != "text/plain" { + http.Error(w, "", http.StatusUnsupportedMediaType) + return + } + bodyBytes, err := io.ReadAll( + base64.NewDecoder( + i.B64Encoding, + http.MaxBytesReader(w, r.Body, i.MaxMessageSizeBytes), + ), + ) + if err != nil { + if b64Err := new(base64.CorruptInputError); errors.As(err, &b64Err) { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + http.Error(w, err.Error(), http.StatusRequestEntityTooLarge) + return + } + envelopeRequest := &studiov1alpha1.InvokeRequest{} + if err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(bodyBytes, envelopeRequest); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + request := connect.NewRequest(bytes.NewBuffer(envelopeRequest.GetBody())) + for _, header := range envelopeRequest.Headers { + if _, ok := i.DisallowedHeaders[textproto.CanonicalMIMEHeaderKey(header.Key)]; ok { + http.Error(w, fmt.Sprintf("header %q disallowed by agent", header.Key), http.StatusBadRequest) + return + } + for _, value := range header.Value { + request.Header().Add(header.Key, value) + } + } + for fromHeader, toHeader := range i.ForwardHeaders { + headerValues := r.Header.Values(fromHeader) + if len(headerValues) > 0 { + request.Header().Del(toHeader) + for _, headerValue := range headerValues { + request.Header().Add(toHeader, headerValue) + } + } + } + targetURL, err := url.Parse(envelopeRequest.GetTarget()) + if err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var httpClient *http.Client + switch targetURL.Scheme { + case "http": + httpClient = i.H2CClient + case "https": + httpClient = i.TLSClient + default: + http.Error(w, fmt.Sprintf("must specify http or https url scheme, got %q", targetURL.Scheme), http.StatusBadRequest) + return + } + clientOptions, err := connectClientOptionsFromContentType(request.Header().Get("Content-Type")) + if err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + client := connect.NewClient[bytes.Buffer, bytes.Buffer]( + httpClient, + targetURL.String(), + clientOptions..., + ) + // TODO(rvanginkel) should this context be cloned to remove attached values (but keep timeout)? + response, err := client.CallUnary(r.Context(), request) + if err != nil { + // We need to differentiate client errors from server errors. In the former, + // trigger a `StatusBadGateway` result, and in the latter surface whatever + // error information came back from the server. + // + // Any error here is expected to be wrapped in a `connect.Error` struct. We + // need to check *first* if it's not a wire error, so we can assume the + // request never left the client, or a response never arrived from the + // server. In those scenarios we trigger a `StatusBadGateway` to signal + // that the upstream server is unreachable or in a bad status... + if !connect.IsWireError(err) { + http.Error(w, err.Error(), http.StatusBadGateway) + return + } + // ... but if a response was received from the server, we assume there's + // error information from the server we can surface to the user by including + // it in the headers response, unless it is a `CodeUnknown` error. Connect + // marks any issues connecting with the `CodeUnknown` error. + if connectErr := new(connect.Error); errors.As(err, &connectErr) { + if connectErr.Code() == connect.CodeUnknown { + http.Error(w, err.Error(), http.StatusBadGateway) + return + } + i.writeProtoMessage(w, &studiov1alpha1.InvokeResponse{ + // connectErr.Meta contains the trailers for the + // caller to find out the error details. + Headers: goHeadersToProtoHeaders(connectErr.Meta()), + }) + return + } + i.logger.Sugar().Warn( + "non_connect_unary_error", + zap.Error(err), + ) + http.Error(w, err.Error(), http.StatusBadGateway) + return + } + i.writeProtoMessage(w, &studiov1alpha1.InvokeResponse{ + Headers: goHeadersToProtoHeaders(response.Header()), + Body: response.Msg.Bytes(), + Trailers: goHeadersToProtoHeaders(response.Trailer()), + }) +} + +func connectClientOptionsFromContentType(contentType string) ([]connect.ClientOption, error) { + switch contentType { + case "application/grpc", "application/grpc+proto": + return []connect.ClientOption{ + connect.WithGRPC(), + connect.WithCodec(&bufferCodec{name: "proto"}), + }, nil + case "application/grpc+json": + return []connect.ClientOption{ + connect.WithGRPC(), + connect.WithCodec(&bufferCodec{name: "json"}), + }, nil + case "application/json": + return []connect.ClientOption{ + connect.WithCodec(&bufferCodec{name: "json"}), + }, nil + case "application/proto": + return []connect.ClientOption{ + connect.WithCodec(&bufferCodec{name: "proto"}), + }, nil + default: + return nil, fmt.Errorf("unknown Content-Type: %q", contentType) + } +} + +func (i *plainPostHandler) writeProtoMessage(w http.ResponseWriter, message proto.Message) { + responseProtoBytes, err := protoencoding.NewWireMarshaler().Marshal(message) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + responseB64Bytes := make([]byte, i.B64Encoding.EncodedLen(len(responseProtoBytes))) + i.B64Encoding.Encode(responseB64Bytes, responseProtoBytes) + w.Header().Set("Content-Type", "text/plain") + if n, err := w.Write(responseB64Bytes); n != len(responseB64Bytes) && err != nil { + i.logger.Sugar().Error( + "write_error", + zap.Int("expected_bytes", len(responseB64Bytes)), + zap.Int("actual_bytes", n), + zap.Error(err), + ) + } +} + +func goHeadersToProtoHeaders(in http.Header) []*studiov1alpha1.Headers { + var out []*studiov1alpha1.Headers + for k, v := range in { + out = append(out, &studiov1alpha1.Headers{ + Key: k, + Value: v, + }) + } + return out +} diff --git a/pkg/bufman/bufpkg/bufstyle/analyzer_provider.go b/pkg/bufman/bufpkg/bufstyle/analyzer_provider.go new file mode 100644 index 000000000..0641b7fba --- /dev/null +++ b/pkg/bufman/bufpkg/bufstyle/analyzer_provider.go @@ -0,0 +1,102 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufstyle + +import ( + "path/filepath" + + "go.uber.org/multierr" + "golang.org/x/tools/go/analysis" +) + +type analyzerProvider struct { + absRootDirPath string + ignoreAnalyzerNameToRelFilePaths map[string]map[string]struct{} +} + +func newAnalyzerProvider(rootDirPath string, options ...AnalyzerProviderOption) (*analyzerProvider, error) { + if rootDirPath == "" { + rootDirPath = "." + } + absRootDirPath, err := filepath.Abs(rootDirPath) + if err != nil { + return nil, err + } + analyzerProvider := &analyzerProvider{ + absRootDirPath: absRootDirPath, + ignoreAnalyzerNameToRelFilePaths: make(map[string]map[string]struct{}), + } + for _, option := range options { + option(analyzerProvider) + } + return analyzerProvider, nil +} + +func (a *analyzerProvider) Analyzers() []*analysis.Analyzer { + analyzers := newAnalyzers() + for _, analyzer := range analyzers { + a.modifyAnalyzer(analyzer) + for _, requireAnalyzer := range analyzer.Requires { + a.modifyAnalyzer(requireAnalyzer) + } + } + return analyzers +} + +func (a *analyzerProvider) modifyAnalyzer(analyzer *analysis.Analyzer) { + if analyzer.Run == nil { + return + } + oldRun := analyzer.Run + analyzer.Run = func(pass *analysis.Pass) (interface{}, error) { + oldReport := pass.Report + var reportErr error + pass.Report = func(diagnostic analysis.Diagnostic) { + if pass.Fset == nil { + oldReport(diagnostic) + return + } + relFilePaths, ok := a.ignoreAnalyzerNameToRelFilePaths[analyzer.Name] + if !ok { + oldReport(diagnostic) + return + } + position := pass.Fset.Position(diagnostic.Pos) + filePath := position.Filename + if filePath == "" { + oldReport(diagnostic) + return + } + absFilePath, err := filepath.Abs(position.Filename) + if err != nil { + reportErr = multierr.Append(reportErr, err) + return + } + relFilePath, err := filepath.Rel(a.absRootDirPath, absFilePath) + if err != nil { + reportErr = multierr.Append(reportErr, err) + return + } + if _, ok := relFilePaths[relFilePath]; !ok { + oldReport(diagnostic) + } + } + if reportErr != nil { + return nil, reportErr + } + return oldRun(pass) + } +} diff --git a/pkg/bufman/bufpkg/bufstyle/analyzers.go b/pkg/bufman/bufpkg/bufstyle/analyzers.go new file mode 100644 index 000000000..011e692b9 --- /dev/null +++ b/pkg/bufman/bufpkg/bufstyle/analyzers.go @@ -0,0 +1,97 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufstyle defines lint analyzers that help enforce Buf's Go code standards. +package bufstyle + +import ( + "go/token" + "path/filepath" + "strings" + + "golang.org/x/tools/go/analysis" +) + +// we don't store this as a global because we modify these in the analyzerProvider. +func newAnalyzers() []*analysis.Analyzer { + return []*analysis.Analyzer{ + { + Name: "PACKAGE_FILENAME", + Doc: "Verifies that every package has a file with the same name as the package.", + Run: func(pass *analysis.Pass) (interface{}, error) { + if len(pass.Files) == 0 { + // Nothing to do. We can't report the error anywhere because + // this package doesn't have any files. + return nil, nil + } + packageName := pass.Pkg.Name() + if strings.HasSuffix(packageName, "_test") { + // Ignore test packages. + return nil, nil + } + var found bool + pass.Fset.Iterate( + func(file *token.File) bool { + filename := filepath.Base(file.Name()) + if strings.TrimSuffix(filename, ".go") == packageName { + found = true + return false + } + return true + }, + ) + if !found { + // The package is guaranteed to have at least one + // file with a package declaration, so we report the failure there. + // We checked that len(pass.Files) > 0 above. + pass.Reportf(pass.Files[0].Package, "Package %q does not have a %s.go", packageName, packageName) + } + return nil, nil + }, + }, + { + Name: "NO_SYNC_POOL", + Doc: "Verifies that sync.Pool is not used.", + Run: func(pass *analysis.Pass) (interface{}, error) { + if typesInfo := pass.TypesInfo; typesInfo != nil { + for expr, typeAndValue := range pass.TypesInfo.Types { + if t := typeAndValue.Type; t != nil { + if t.String() == "sync.Pool" { + pass.Reportf(expr.Pos(), "sync.Pool cannot be used") + } + } + } + } + return nil, nil + }, + }, + { + Name: "BEHAVIOUR", + Doc: "Verifies that the word \"behaviour\" is not used in any comment.", + Run: func(pass *analysis.Pass) (interface{}, error) { + for _, file := range pass.Files { + for _, commentGroup := range file.Comments { + for _, comment := range commentGroup.List { + if strings.Contains(strings.ToLower(comment.Text), "behaviour") { + pass.Reportf(comment.Slash, `It is spelled "behavior" not "behaviour"`) + } + } + } + } + return nil, nil + }, + }, + } +} diff --git a/pkg/bufman/bufpkg/bufstyle/bufstyle.go b/pkg/bufman/bufpkg/bufstyle/bufstyle.go new file mode 100644 index 000000000..dd049a50d --- /dev/null +++ b/pkg/bufman/bufpkg/bufstyle/bufstyle.go @@ -0,0 +1,52 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package bufstyle defines lint analyzers that help enforce Buf's Go code standards. +package bufstyle + +import "golang.org/x/tools/go/analysis" + +// ExternalConfig is an external configuration for bufstyle. +type ExternalConfig struct { + // Ignore is a map from analyzer name to a list of relative paths to ignore. + Ignore map[string][]string `json:"ignore,omitempty" yaml:"ignore,omitempty"` +} + +// AnalyzerProvider provides analyzers. +type AnalyzerProvider interface { + Analyzers() []*analysis.Analyzer +} + +// NewAnalyzerProvider returns a new AnalyzerProvider. +func NewAnalyzerProvider(rootDirPath string, options ...AnalyzerProviderOption) (AnalyzerProvider, error) { + return newAnalyzerProvider(rootDirPath, options...) +} + +// AnalyzerProviderOption is an option for a new AnalyzerProvider. +type AnalyzerProviderOption func(*analyzerProvider) + +// WithIgnore will ignore diagnostics for the given file path and analyzer name. +// +// relFilePath should be relative to rootDirPath. +func WithIgnore(analyzerName string, relFilePath string) AnalyzerProviderOption { + return func(analyzerProvider *analyzerProvider) { + relFilePaths, ok := analyzerProvider.ignoreAnalyzerNameToRelFilePaths[analyzerName] + if !ok { + relFilePaths = make(map[string]struct{}) + analyzerProvider.ignoreAnalyzerNameToRelFilePaths[analyzerName] = relFilePaths + } + relFilePaths[relFilePath] = struct{}{} + } +} diff --git a/pkg/bufman/bufpkg/bufstyle/cmd/bufstyle/main.go b/pkg/bufman/bufpkg/bufstyle/cmd/bufstyle/main.go new file mode 100644 index 000000000..0d27cb397 --- /dev/null +++ b/pkg/bufman/bufpkg/bufstyle/cmd/bufstyle/main.go @@ -0,0 +1,99 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "fmt" + "os" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufstyle" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" + "golang.org/x/tools/go/analysis/multichecker" +) + +var externalConfigPath = ".bufstyle.yaml" + +func main() { + analyzerProvider, err := newAnalyzerProvider() + if err != nil { + if errString := err.Error(); errString != "" { + fmt.Fprintln(os.Stderr, errString) + } + os.Exit(1) + } + multichecker.Main(analyzerProvider.Analyzers()...) +} + +func newAnalyzerProvider() (bufstyle.AnalyzerProvider, error) { + externalConfig, err := readExternalConfig() + if err != nil { + return nil, err + } + ignoreAnalyzerNameToRelFilePaths, err := getIgnoreAnalyzerNameToRelFilePaths(externalConfig) + if err != nil { + return nil, err + } + var analyzerProviderOptions []bufstyle.AnalyzerProviderOption + for analyzerName, relFilePaths := range ignoreAnalyzerNameToRelFilePaths { + for relFilePath := range relFilePaths { + analyzerProviderOptions = append( + analyzerProviderOptions, + bufstyle.WithIgnore(analyzerName, relFilePath), + ) + } + } + rootDirPath, err := os.Getwd() + if err != nil { + return nil, err + } + return bufstyle.NewAnalyzerProvider(rootDirPath, analyzerProviderOptions...) +} + +func readExternalConfig() (bufstyle.ExternalConfig, error) { + var externalConfig bufstyle.ExternalConfig + data, err := os.ReadFile(externalConfigPath) + if err != nil { + if os.IsNotExist(err) { + return externalConfig, nil + } + return externalConfig, err + } + if err := encoding.UnmarshalYAMLStrict(data, &externalConfig); err != nil { + return externalConfig, err + } + return externalConfig, nil +} + +func getIgnoreAnalyzerNameToRelFilePaths(externalConfig bufstyle.ExternalConfig) (map[string]map[string]struct{}, error) { + ignoreAnalyzerNameToRelFilePaths := make(map[string]map[string]struct{}) + for analyzerName, relFilePaths := range externalConfig.Ignore { + if len(relFilePaths) == 0 { + return nil, fmt.Errorf("empty ignore file paths") + } + relFilePathMap := make(map[string]struct{}) + for _, relFilePath := range relFilePaths { + if _, ok := relFilePathMap[relFilePath]; ok { + return nil, fmt.Errorf("duplicate ignore file path %q for analyzer %q", relFilePath, analyzerName) + } + relFilePathMap[relFilePath] = struct{}{} + } + if _, ok := ignoreAnalyzerNameToRelFilePaths[analyzerName]; ok { + return nil, fmt.Errorf("duplicate ignore analyzer name: %q", analyzerName) + } + ignoreAnalyzerNameToRelFilePaths[analyzerName] = relFilePathMap + } + return ignoreAnalyzerNameToRelFilePaths, nil +} diff --git a/pkg/bufman/bufpkg/buftesting/buftesting.go b/pkg/bufman/bufpkg/buftesting/buftesting.go new file mode 100644 index 000000000..5aa50eb43 --- /dev/null +++ b/pkg/bufman/bufpkg/buftesting/buftesting.go @@ -0,0 +1,153 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buftesting + +import ( + "context" + "io" + "net/http" + "path/filepath" + "testing" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/github/githubtesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/prototesting" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + // NumGoogleapisFiles is the number of googleapis files on the current test commit. + NumGoogleapisFiles = 1574 + // NumGoogleapisFilesWithImports is the number of googleapis files on the current test commit with imports. + NumGoogleapisFilesWithImports = 1585 + + testGoogleapisCommit = "37c923effe8b002884466074f84bc4e78e6ade62" +) + +var ( + testHTTPClient = &http.Client{ + Timeout: 10 * time.Second, + } + testStorageosProvider = storageos.NewProvider(storageos.ProviderWithSymlinks()) + testArchiveReader = githubtesting.NewArchiveReader( + zap.NewNop(), + testStorageosProvider, + testHTTPClient, + ) + testGoogleapisDirPath = filepath.Join("cache", "googleapis") +) + +// GetActualProtocFileDescriptorSet gets the FileDescriptorSet for actual protoc. +func GetActualProtocFileDescriptorSet( + t *testing.T, + runner command.Runner, + includeImports bool, + includeSourceInfo bool, + dirPath string, + filePaths []string, +) *descriptorpb.FileDescriptorSet { + fileDescriptorSet, err := prototesting.GetProtocFileDescriptorSet( + context.Background(), + runner, + []string{dirPath}, + filePaths, + includeImports, + includeSourceInfo, + ) + require.NoError(t, err) + return fileDescriptorSet +} + +// RunActualProtoc runs actual protoc. +func RunActualProtoc( + t *testing.T, + runner command.Runner, + includeImports bool, + includeSourceInfo bool, + dirPath string, + filePaths []string, + env map[string]string, + stdout io.Writer, + extraFlags ...string, +) { + err := prototesting.RunProtoc( + context.Background(), + runner, + []string{dirPath}, + filePaths, + includeImports, + includeSourceInfo, + env, + stdout, + extraFlags..., + ) + require.NoError(t, err) +} + +// GetGoogleapisDirPath gets the path to a clone of googleapis. +func GetGoogleapisDirPath(t *testing.T, buftestingDirPath string) string { + googleapisDirPath := filepath.Join(buftestingDirPath, testGoogleapisDirPath) + require.NoError( + t, + testArchiveReader.GetArchive( + context.Background(), + googleapisDirPath, + "googleapis", + "googleapis", + testGoogleapisCommit, + ), + ) + return googleapisDirPath +} + +// GetProtocFilePaths gets the file paths for protoc. +// +// Limit limits the number of files returned if > 0. +// protoc has a fixed size for number of characters to argument list. +func GetProtocFilePaths(t *testing.T, dirPath string, limit int) []string { + realFilePaths, err := GetProtocFilePathsErr(context.Background(), dirPath, limit) + require.NoError(t, err) + return realFilePaths +} + +// GetProtocFilePathsErr is like GetProtocFilePaths except it returns an error and accepts a ctx. +func GetProtocFilePathsErr(ctx context.Context, dirPath string, limit int) ([]string, error) { + module, err := bufmodulebuild.NewModuleIncludeBuilder(zap.NewNop(), testStorageosProvider).BuildForIncludes( + ctx, + []string{dirPath}, + ) + if err != nil { + return nil, err + } + targetFileInfos, err := module.TargetFileInfos(ctx) + if err != nil { + return nil, err + } + realFilePaths := make([]string, len(targetFileInfos)) + for i, fileInfo := range targetFileInfos { + realFilePaths[i] = normalpath.Unnormalize(normalpath.Join(dirPath, fileInfo.Path())) + } + if limit > 0 && len(realFilePaths) > limit { + realFilePaths = realFilePaths[:limit] + } + return realFilePaths, nil +} diff --git a/pkg/bufman/bufpkg/buftransport/buftransport.go b/pkg/bufman/bufpkg/buftransport/buftransport.go new file mode 100644 index 000000000..15df69f57 --- /dev/null +++ b/pkg/bufman/bufpkg/buftransport/buftransport.go @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buftransport + +const ( + schemeHTTP = "http" + schemeHTTPS = "https" +) + +// PrependHTTP prepends an http scheme to the given address +func PrependHTTP(address string) string { + return schemeHTTP + "://" + address +} + +// PrependHTTPS prepends an https scheme to the given address +func PrependHTTPS(address string) string { + return schemeHTTPS + "://" + address +} diff --git a/pkg/bufman/bufpkg/bufwasm/bufwasm.go b/pkg/bufman/bufpkg/bufwasm/bufwasm.go new file mode 100644 index 000000000..0afef189c --- /dev/null +++ b/pkg/bufman/bufpkg/bufwasm/bufwasm.go @@ -0,0 +1,290 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufwasm + +import ( + "bytes" + "context" + "errors" + "fmt" + "io" + "strconv" + "strings" + "testing/fstest" + + wasmpluginv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/wasmplugin/v1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "github.com/tetratelabs/wazero" + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/gojs" + "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" + "github.com/tetratelabs/wazero/sys" + "go.uber.org/multierr" + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/proto" +) + +// CustomSectionName is the name of the custom wasm section we look into for buf +// extensions. +const CustomSectionName = ".bufplugin" + +// https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#sections%E2%91%A0 +const customSectionID = 0 + +// maxMemoryBytes wazero memory page limit +const maxMemoryBytes = 1 << 29 // 512MB + +// CompiledPlugin is the compiled representation of loading wasm bytes. +type CompiledPlugin struct { + cache wazero.CompilationCache + runtime wazero.Runtime + module wazero.CompiledModule + + // Metadata parsed from custom sections of the wasm file. May be nil if + // no buf specific sections were found. + ExecConfig *wasmpluginv1.ExecConfig +} + +func (c *CompiledPlugin) ABI() wasmpluginv1.WasmABI { + if c.ExecConfig.GetWasmAbi() != wasmpluginv1.WasmABI_WASM_ABI_UNSPECIFIED { + return c.ExecConfig.GetWasmAbi() + } + exportedFuncs := c.module.ExportedFunctions() + if _, ok := exportedFuncs["_start"]; ok { + return wasmpluginv1.WasmABI_WASM_ABI_WASI_SNAPSHOT_PREVIEW1 + } else if _, ok := exportedFuncs["run"]; ok { + return wasmpluginv1.WasmABI_WASM_ABI_GOJS + } + return wasmpluginv1.WasmABI_WASM_ABI_UNSPECIFIED +} + +// PluginExecutionError is a wrapper for WASM plugin execution errors. +type PluginExecutionError struct { + Stderr string + Exitcode uint32 +} + +// NewPluginExecutionError constructs a new execution error. +func NewPluginExecutionError(stderr string, exitcode uint32) *PluginExecutionError { + return &PluginExecutionError{Stderr: strings.ToValidUTF8(stderr, ""), Exitcode: exitcode} +} + +func (e *PluginExecutionError) Error() string { + return "plugin exited with code " + strconv.Itoa(int(e.Exitcode)) +} + +// EncodeBufSection encodes the ExecConfig message as a custom wasm section. +// The resulting bytes can be appended to any valid wasm file to add the new +// section to that file. +func EncodeBufSection(config *wasmpluginv1.ExecConfig) ([]byte, error) { + metadataBinary, err := protoencoding.NewWireMarshaler().Marshal(config) + if err != nil { + return nil, err + } + // Abusing the protowire package because the wasm file format is similar. + return protowire.AppendBytes( + []byte{customSectionID}, + append( + protowire.AppendString( + nil, + CustomSectionName, + ), + metadataBinary..., + ), + ), nil +} + +// PluginExecutor wraps a wazero end exposes functions to compile and run wasm plugins. +type PluginExecutor interface { + CompilePlugin(ctx context.Context, plugin []byte) (_ *CompiledPlugin, retErr error) + Run(ctx context.Context, plugin *CompiledPlugin, stdin io.Reader, stdout io.Writer) (retErr error) +} + +type WASMPluginExecutor struct { + compilationCacheDir string + runtimeConfig wazero.RuntimeConfig +} + +// NewPluginExecutor creates a new pluginExecutor with a compilation cache dir +// and other buf defaults. +func NewPluginExecutor(compilationCacheDir string, options ...PluginExecutorOption) (*WASMPluginExecutor, error) { + runtimeConfig := wazero.NewRuntimeConfig(). + WithCoreFeatures(api.CoreFeaturesV2). + WithMemoryLimitPages(maxMemoryBytes >> 16). // a page is 2^16 bytes + WithCustomSections(true). + WithCloseOnContextDone(true) + executor := &WASMPluginExecutor{ + compilationCacheDir: compilationCacheDir, + runtimeConfig: runtimeConfig, + } + for _, opt := range options { + opt(executor) + } + return executor, nil +} + +// PluginExecutorOption configuration options for the PluginExecutor. +type PluginExecutorOption func(*WASMPluginExecutor) + +// WithMemoryLimitPages provides a custom per memory limit for a plugin +// executor. The default is 8192 pages for 512MB. +func WithMemoryLimitPages(memoryLimitPages uint32) PluginExecutorOption { + return func(pluginExecutor *WASMPluginExecutor) { + pluginExecutor.runtimeConfig = pluginExecutor.runtimeConfig.WithMemoryLimitPages(memoryLimitPages) + } +} + +// CompilePlugin takes a byte slice with a valid wasm module, compiles it and +// optionally reads out buf plugin metadata. +func (e *WASMPluginExecutor) CompilePlugin(ctx context.Context, plugin []byte) (_ *CompiledPlugin, retErr error) { + // Configure the compilation cache, which must be closed after the runtime. + var cache wazero.CompilationCache + if e.compilationCacheDir == "" { + cache = wazero.NewCompilationCache() + } else { + var err error + cache, err = wazero.NewCompilationCacheWithDir(e.compilationCacheDir) + if err != nil { + return nil, err + } + } + defer func() { + if retErr != nil { + retErr = multierr.Append(retErr, cache.Close(ctx)) + } + }() + + // Create the shared runtime used for all plugin instantiations + runtime := wazero.NewRuntimeWithConfig(ctx, e.runtimeConfig.WithCompilationCache(cache)) + defer func() { + if retErr != nil { + retErr = multierr.Append(retErr, runtime.Close(ctx)) + } + }() + + // Note: before we start accepting user plugins, we should do more + // validation on the metadata here: file path cleaning etc. + compiledModule, err := runtime.CompileModule(ctx, plugin) + if err != nil { + return nil, fmt.Errorf("error compiling wasm: %w", err) + } + + compiledPlugin := &CompiledPlugin{cache: cache, runtime: runtime, module: compiledModule} + + // Try to load any exec configuration stored in the WebAssembly custom section. + var bufsectionBytes []byte + for _, section := range compiledModule.CustomSections() { + if section.Name() == CustomSectionName { + bufsectionBytes = append(bufsectionBytes, section.Data()...) + } + } + if len(bufsectionBytes) > 0 { + metadata := &wasmpluginv1.ExecConfig{} + if err := proto.Unmarshal(bufsectionBytes, metadata); err != nil { + return nil, fmt.Errorf("error unmarshalling custom section: %w", err) + } + compiledPlugin.ExecConfig = metadata + } + + // Instantiate host functions required by the plugin guest. + switch compiledPlugin.ABI() { + case wasmpluginv1.WasmABI_WASM_ABI_GOJS: + if _, err := gojs.Instantiate(ctx, runtime); err != nil { + return nil, fmt.Errorf("error instantiating gojs: %w", err) + } + case wasmpluginv1.WasmABI_WASM_ABI_WASI_SNAPSHOT_PREVIEW1: + if _, err := wasi_snapshot_preview1.Instantiate(ctx, runtime); err != nil { + return nil, fmt.Errorf("error instantiating wasi: %w", err) + } + default: + return nil, errors.New("unable to detect wasm abi") + } + return compiledPlugin, nil +} + +// Run executes a plugin. If the plugin exited with non-zero status, this +// returns a *PluginExecutionError. +func (e *WASMPluginExecutor) Run( + ctx context.Context, + plugin *CompiledPlugin, + stdin io.Reader, + stdout io.Writer, +) (retErr error) { + name := plugin.module.Name() + if name == "" { + // Some plugins will attempt to read argv[0], but don't have a + // name in the wasm file. Fallback to this. + name = "protoc-gen-wasm" + } + + stderr := bytes.NewBuffer(nil) + config := wazero.NewModuleConfig(). + WithName(""). // Remove the module name so that parallel runs cannot conflict + WithArgs(append([]string{name}, plugin.ExecConfig.GetArgs()...)...). + WithStdin(stdin). + WithStdout(stdout). + WithStderr(stderr) + if len(plugin.ExecConfig.GetFiles()) > 0 { + mapFS := make(fstest.MapFS, len(plugin.ExecConfig.GetFiles())) + for _, file := range plugin.ExecConfig.Files { + mapFS[strings.TrimPrefix(file.Path, "/")] = &fstest.MapFile{ + Data: file.Contents, + } + } + config = config.WithFS(mapFS) + } + + runtime := plugin.runtime + + var err error + switch plugin.ABI() { + case wasmpluginv1.WasmABI_WASM_ABI_GOJS: + err = gojs.Run(ctx, runtime, plugin.module, gojs.NewConfig(config)) + case wasmpluginv1.WasmABI_WASM_ABI_WASI_SNAPSHOT_PREVIEW1: + var module api.Module + module, err = runtime.InstantiateModule(ctx, plugin.module, config) + if err != nil { + if exitErr := new(sys.ExitError); errors.As(err, &exitErr) { + if exitErr.ExitCode() == 0 { + return nil + } + return NewPluginExecutionError( + fmt.Sprintf("error instantiating wasi module: %s", err.Error()), exitErr.ExitCode()) + } + return err + } + defer func() { + retErr = multierr.Append(retErr, module.Close(ctx)) + }() + default: + err = errors.New("unable to detect wasm abi") + } + if err != nil { + if exitErr := new(sys.ExitError); errors.As(err, &exitErr) { + if exitErr.ExitCode() == 0 { + return nil + } + return NewPluginExecutionError(stderr.String(), exitErr.ExitCode()) + } + return err + } + return nil +} + +func (c *CompiledPlugin) Close() error { + ctx := context.Background() + return multierr.Append(c.runtime.Close(ctx), c.cache.Close(ctx)) +} diff --git a/pkg/bufman/bufpkg/bufwasm/bufwasm_test.go b/pkg/bufman/bufpkg/bufwasm/bufwasm_test.go new file mode 100644 index 000000000..a662fa973 --- /dev/null +++ b/pkg/bufman/bufpkg/bufwasm/bufwasm_test.go @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufwasm + +import ( + "bytes" + "context" + _ "embed" + "errors" + "io" + "sync" + "testing" + + wasmpluginv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/wasmplugin/v1" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/testing/protocmp" +) + +// echoWasm is a basic wasm file that echos the first 100 bytes from stdin +// before exitting with exit code 11. It serves as a valid wasm file to executed +// during test and manipulate for section reading. +// +// Regenerate it using "wat2wasm echo.wat -o echo.wasm" +// +// For more complex tests, we need to check in bulkier wasm files and add more +// complex toolchains to build them. Since we don't need to re-test wazero here, +// this should suffice for now. +// +//go:embed testdata/echo.wasm +var echoWasm []byte + +func TestSectionEncodeDecode(t *testing.T) { + t.Parallel() + ctx := context.Background() + executor, err := NewPluginExecutor(t.TempDir()) + require.NoError(t, err) + plugin, err := executor.CompilePlugin(ctx, echoWasm) + require.NoError(t, err) + defer func() { + require.NoError(t, plugin.Close()) + }() + assert.Nil(t, plugin.ExecConfig) + + metadataProto := &wasmpluginv1.ExecConfig{ + WasmAbi: wasmpluginv1.WasmABI_WASM_ABI_WASI_SNAPSHOT_PREVIEW1, + Args: []string{"some", "params"}, + } + bufSectionBytes, err := EncodeBufSection(metadataProto) + require.NoError(t, err) + + wasmFileWithBufSection := make([]byte, 0, len(echoWasm)+len(bufSectionBytes)) + wasmFileWithBufSection = append(wasmFileWithBufSection, echoWasm...) + wasmFileWithBufSection = append(wasmFileWithBufSection, bufSectionBytes...) + + plugin, err = executor.CompilePlugin(ctx, wasmFileWithBufSection) + require.NoError(t, err) + defer func() { + require.NoError(t, plugin.Close()) + }() + assert.Empty(t, cmp.Diff(plugin.ExecConfig, metadataProto, protocmp.Transform())) +} + +func TestPluginExecutor(t *testing.T) { + t.Parallel() + ctx := context.Background() + executor, err := NewPluginExecutor(t.TempDir()) + require.NoError(t, err) + plugin, err := executor.CompilePlugin(ctx, echoWasm) + require.NoError(t, err) + defer func() { + require.NoError(t, plugin.Close()) + }() + assert.Nil(t, plugin.ExecConfig) + + stdin := bytes.NewBufferString("foo") + stdout := bytes.NewBuffer(nil) + err = executor.Run(ctx, plugin, stdin, stdout) + pluginErr := new(PluginExecutionError) + require.ErrorAs(t, err, &pluginErr) + assert.Equal(t, uint32(11), pluginErr.Exitcode) + assert.Equal(t, "foo", stdout.String()) +} + +func TestParallelPlugins(t *testing.T) { + t.Parallel() + ctx := context.Background() + executor, err := NewPluginExecutor(t.TempDir()) + require.NoError(t, err) + plugin, err := executor.CompilePlugin(ctx, echoWasm) + require.NoError(t, err) + defer func() { + require.NoError(t, plugin.Close()) + }() + assert.Nil(t, plugin.ExecConfig) + + n := 2 + errors := make([]error, n) + stdOuts := make([]*bytes.Buffer, n) + var wg sync.WaitGroup + for i := 0; i < n; i++ { + i := i + wg.Add(1) + go func() { + defer wg.Done() + stdOut := bytes.NewBuffer(nil) + stdOuts[i] = stdOut + errors[i] = executor.Run(ctx, plugin, bytes.NewBufferString("foo"), stdOut) + }() + } + wg.Wait() + + for i := 0; i < n; i++ { + pluginErr := new(PluginExecutionError) + require.ErrorAs(t, errors[i], &pluginErr) + assert.Equal(t, uint32(11), pluginErr.Exitcode) + assert.Equal(t, "foo", stdOuts[i].String()) + } +} + +func BenchmarkPluginRun(b *testing.B) { + ctx := context.Background() + executor, err := NewPluginExecutor(b.TempDir()) + if err != nil { + b.Fatal(err) + } + plugin, err := executor.CompilePlugin(ctx, echoWasm) + if err != nil { + b.Fatal(err) + } + defer func() { + require.NoError(b, plugin.Close()) + }() + if plugin.ExecConfig != nil { + b.Fatal("expected no plugin.ExecConfig") + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + err := executor.Run(ctx, plugin, bytes.NewBufferString("foo"), io.Discard) + pluginErr := new(PluginExecutionError) + if ok := errors.As(err, &pluginErr); !ok || pluginErr.Exitcode != 11 { + b.Fatal(err) + } + } +} diff --git a/pkg/bufman/bufpkg/bufwasm/testdata/echo.wasm b/pkg/bufman/bufpkg/bufwasm/testdata/echo.wasm new file mode 100644 index 0000000000000000000000000000000000000000..8f8e21cac228f05b76380a2746b07fb40f273172 GIT binary patch literal 208 zcmZ{aK@Ng26b0Y^ML==U#KZ+xFfQDWaGduw`NC8*~hc^B 0 { + // stderr since we do output to stdouot + if err := bufanalysis.PrintFileAnnotations( + container.Stderr(), + fileAnnotations, + "text", + ); err != nil { + return nil, err + } + return nil, failedError + } + return protosource.NewFilesUnstable(ctx, bufimageutil.NewInputFiles(image.Files())...) +} + +func getGolangFileData( + pathToData map[string][]byte, + fullNameToMessage map[string]protosource.Message, + fullNameToEnum map[string]protosource.Enum, + packageName string, +) ([]byte, error) { + buffer := bytes.NewBuffer(nil) + p := func(s string) { + _, _ = buffer.WriteString(s) + } + p(`// Code generated by `) + p(programName) + p(`. DO NOT EDIT. + +package `) + p(packageName) + p(` + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +var ( + // ReadBucket is the storage.ReadBucket with the static data generated for this package. + ReadBucket storage.ReadBucket + + pathToData = map[string][]byte{ +`) + paths := make([]string, 0, len(pathToData)) + for path := range pathToData { + paths = append(paths, path) + } + sort.Strings(paths) + + for _, path := range paths { + p(`"`) + p(path) + p(`": { +`) + data := pathToData[path] + for len(data) > 0 { + n := sliceLength + if n > len(data) { + n = len(data) + } + accum := "" + for _, elem := range data[:n] { + accum += fmt.Sprintf("0x%02x,", elem) + } + p(accum) + p("\n") + data = data[n:] + } + p(`}, +`) + } + p(`} + + messageNameToFilePath = map[string]string{ +`) + for _, fullNameToMessagePair := range sortedPairs(fullNameToMessage) { + p(`"`) + p(fullNameToMessagePair.key) + p(`": "`) + p(fullNameToMessagePair.val.File().Path()) + p(`",`) + p("\n") + } + p(`} + + enumNameToFilePath = map[string]string{ +`) + for _, fullNameToEnumPair := range sortedPairs(fullNameToEnum) { + p(`"`) + p(fullNameToEnumPair.key) + p(`": "`) + p(fullNameToEnumPair.val.File().Path()) + p(`",`) + p("\n") + } + p(`} +) + +func init() { + readBucket, err := storagemem.NewReadBucket(pathToData) + if err != nil { + panic(err.Error()) + } + ReadBucket = readBucket +} + +// Exists returns true if the given path exists in the static data. +// +// The path is normalized within this function. +func Exists(path string) bool { + _, ok := pathToData[normalpath.Normalize(path)] + return ok +} + +// MessageFilePath gets the file path for the given message, if the message exists. +func MessageFilePath(messageName string) (string, bool) { + filePath, ok := messageNameToFilePath[messageName] + return filePath, ok +} + +// EnumFilePath gets the file path for the given enum, if the enum exists. +func EnumFilePath(enumName string) (string, bool) { + filePath, ok := enumNameToFilePath[enumName] + return filePath, ok +} +`) + return format.Source(buffer.Bytes()) +} + +type keyValPair[K any, V any] struct { + key K + val V +} + +func sortedPairs[K constraints.Ordered, V any](m map[K]V) []keyValPair[K, V] { + ret := make([]keyValPair[K, V], 0, len(m)) + for key := range m { + ret = append(ret, keyValPair[K, V]{key: key, val: m[key]}) + } + sort.Slice(ret, func(i, j int) bool { + return ret[i].key < ret[j].key + }) + return ret +} diff --git a/pkg/bufman/pkg/app/app.go b/pkg/bufman/pkg/app/app.go new file mode 100644 index 000000000..626e20276 --- /dev/null +++ b/pkg/bufman/pkg/app/app.go @@ -0,0 +1,353 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package app provides application primitives. +package app + +import ( + "context" + "errors" + "fmt" + "io" + "os" + "sort" + "strconv" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/interrupt" +) + +// EnvContainer provides environment variables. +type EnvContainer interface { + // Env gets the environment variable raw string value for the key. + // + // Returns empty string if the key is not set or the value is empty. + Env(key string) string + // ForEachEnv iterates over all non-empty environment variables and calls the function. + // + // The value will never be empty. + ForEachEnv(func(string, string)) +} + +// NewEnvContainer returns a new EnvContainer. +// +// Empty values are effectively ignored. +func NewEnvContainer(m map[string]string) EnvContainer { + return newEnvContainer(m) +} + +// NewEnvContainerForOS returns a new EnvContainer for the operating system. +func NewEnvContainerForOS() (EnvContainer, error) { + return newEnvContainerForEnviron(os.Environ()) +} + +// NewEnvContainerWithOverrides returns a new EnvContainer with the values of the input +// EnvContainer, overridden by the values in overrides. +// +// Empty values are effectively ignored. To unset a key, set the value to "" in overrides. +func NewEnvContainerWithOverrides(envContainer EnvContainer, overrides map[string]string) EnvContainer { + m := EnvironMap(envContainer) + for key, value := range overrides { + m[key] = value + } + return newEnvContainer(m) +} + +// StdinContainer provides stdin. +type StdinContainer interface { + // Stdin provides stdin. + // + // If no value was passed when Stdio was created, this will return io.EOF on any call. + Stdin() io.Reader +} + +// NewStdinContainer returns a new StdinContainer. +func NewStdinContainer(reader io.Reader) StdinContainer { + return newStdinContainer(reader) +} + +// NewStdinContainerForOS returns a new StdinContainer for the operating system. +func NewStdinContainerForOS() StdinContainer { + return newStdinContainer(os.Stdin) +} + +// StdoutContainer provides stdout. +type StdoutContainer interface { + // Stdout provides stdout. + // + // If no value was passed when Stdio was created, this will return io.EOF on any call. + Stdout() io.Writer +} + +// NewStdoutContainer returns a new StdoutContainer. +func NewStdoutContainer(writer io.Writer) StdoutContainer { + return newStdoutContainer(writer) +} + +// NewStdoutContainerForOS returns a new StdoutContainer for the operatoutg system. +func NewStdoutContainerForOS() StdoutContainer { + return newStdoutContainer(os.Stdout) +} + +// StderrContainer provides stderr. +type StderrContainer interface { + // Stderr provides stderr. + // + // If no value was passed when Stdio was created, this will return io.EOF on any call. + Stderr() io.Writer +} + +// NewStderrContainer returns a new StderrContainer. +func NewStderrContainer(writer io.Writer) StderrContainer { + return newStderrContainer(writer) +} + +// NewStderrContainerForOS returns a new StderrContainer for the operaterrg system. +func NewStderrContainerForOS() StderrContainer { + return newStderrContainer(os.Stderr) +} + +// ArgContainer provides the arguments. +type ArgContainer interface { + // NumArgs gets the number of arguments. + NumArgs() int + // Arg gets the ith argument. + // + // Panics if i < 0 || i >= Len(). + Arg(i int) string +} + +// NewArgContainer returns a new ArgContainer. +func NewArgContainer(args ...string) ArgContainer { + return newArgContainer(args) +} + +// NewArgContainerForOS returns a new ArgContainer for the operating system. +func NewArgContainerForOS() ArgContainer { + return newArgContainer(os.Args) +} + +// Container contains environment variables, args, and stdio. +type Container interface { + EnvContainer + StdinContainer + StdoutContainer + StderrContainer + ArgContainer +} + +// NewContainer returns a new Container. +func NewContainer( + env map[string]string, + stdin io.Reader, + stdout io.Writer, + stderr io.Writer, + args ...string, +) Container { + return newContainer( + NewEnvContainer(env), + NewStdinContainer(stdin), + NewStdoutContainer(stdout), + NewStderrContainer(stderr), + NewArgContainer(args...), + ) +} + +// NewContainerForOS returns a new Container for the operating system. +func NewContainerForOS() (Container, error) { + envContainer, err := NewEnvContainerForOS() + if err != nil { + return nil, err + } + return newContainer( + envContainer, + NewStdinContainerForOS(), + NewStdoutContainerForOS(), + NewStderrContainerForOS(), + NewArgContainerForOS(), + ), nil +} + +// NewContainerForArgs returns a new Container with the replacement args. +func NewContainerForArgs(container Container, newArgs ...string) Container { + return newContainer( + container, + container, + container, + container, + NewArgContainer(newArgs...), + ) +} + +// StdioContainer is a stdio container. +type StdioContainer interface { + StdinContainer + StdoutContainer + StderrContainer +} + +// EnvStdinContainer is an environment and stdin container. +type EnvStdinContainer interface { + EnvContainer + StdinContainer +} + +// EnvStdoutContainer is an environment and stdout container. +type EnvStdoutContainer interface { + EnvContainer + StdoutContainer +} + +// EnvStderrContainer is an environment and stderr container. +type EnvStderrContainer interface { + EnvContainer + StderrContainer +} + +// EnvStdioContainer is an environment and stdio container. +type EnvStdioContainer interface { + EnvContainer + StdioContainer +} + +// Environ returns all environment variables in the form "KEY=VALUE". +// +// Equivalent to os.Environ. +// +// Sorted. +func Environ(envContainer EnvContainer) []string { + var environ []string + envContainer.ForEachEnv(func(key string, value string) { + environ = append(environ, key+"="+value) + }) + sort.Strings(environ) + return environ +} + +// EnvironMap returns all environment variables in a map. +// +// No key will have an empty value. +func EnvironMap(envContainer EnvContainer) map[string]string { + m := make(map[string]string) + envContainer.ForEachEnv(func(key string, value string) { + // This should be done anyways per the EnvContainer documentation but just to make sure + if value != "" { + m[key] = value + } + }) + return m +} + +// Args returns all arguments. +// +// Equivalent to os.Args. +func Args(argList ArgContainer) []string { + numArgs := argList.NumArgs() + args := make([]string, numArgs) + for i := 0; i < numArgs; i++ { + args[i] = argList.Arg(i) + } + return args +} + +// EnvBool EnvBoolValue gets and parses the environment variable bool value for the key. +// +// Returns error on parsing error. +func EnvBool(container EnvContainer, key string, defaultValue bool) (bool, error) { + value := container.Env(key) + if value == "" { + return defaultValue, nil + } + return strconv.ParseBool(value) +} + +// IsDevStdin returns true if the path is the equivalent of /dev/stdin. +func IsDevStdin(path string) bool { + return path != "" && path == DevStdinFilePath +} + +// IsDevStdout returns true if the path is the equivalent of /dev/stdout. +func IsDevStdout(path string) bool { + return path != "" && path == DevStdoutFilePath +} + +// IsDevStderr returns true if the path is the equivalent of /dev/stderr. +func IsDevStderr(path string) bool { + return path != "" && path == DevStderrFilePath +} + +// IsDevNull returns true if the path is the equivalent of /dev/null. +func IsDevNull(path string) bool { + return path != "" && path == DevNullFilePath +} + +// IsDevPath returns true if the path is the equivalent of /dev/stdin, /dev/stdout, +// /dev/stderr, or /dev/null. +func IsDevPath(path string) bool { + return IsDevStdin(path) || IsDevStdout(path) || IsDevStderr(path) || IsDevNull(path) +} + +// Main runs the application using the OS Container and calling os.Exit on the return value of Run. +func Main(ctx context.Context, f func(context.Context, Container) error) { + container, err := NewContainerForOS() + if err != nil { + printError(container, err) + os.Exit(GetExitCode(err)) + } + os.Exit(GetExitCode(Run(ctx, container, f))) +} + +// Run runs the application using the container. +// +// The run will be stopped on interrupt signal. +// The exit code can be determined using GetExitCode. +func Run(ctx context.Context, container Container, f func(context.Context, Container) error) error { + ctx, cancel := interrupt.WithCancel(ctx) + defer cancel() + if err := f(ctx, container); err != nil { + printError(container, err) + return err + } + return nil +} + +// NewError returns a new Error that contains an exit code. +// +// The exit code cannot be 0. +func NewError(exitCode int, message string) error { + return newAppError(exitCode, message) +} + +// NewErrorf returns a new error that contains an exit code. +// +// The exit code cannot be 0. +func NewErrorf(exitCode int, format string, args ...interface{}) error { + return newAppError(exitCode, fmt.Sprintf(format, args...)) +} + +// GetExitCode gets the exit code. +// +// If err == nil, this returns 0. +// If err was created by this package, this returns the exit code from the error. +// Otherwise, this returns 1. +func GetExitCode(err error) int { + if err == nil { + return 0 + } + appErr := &appError{} + if errors.As(err, &appErr) { + return appErr.exitCode + } + return 1 +} diff --git a/pkg/bufman/pkg/app/app_error.go b/pkg/bufman/pkg/app/app_error.go new file mode 100644 index 000000000..264eaaa12 --- /dev/null +++ b/pkg/bufman/pkg/app/app_error.go @@ -0,0 +1,50 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +import ( + "fmt" +) + +type appError struct { + exitCode int + message string +} + +func newAppError(exitCode int, message string) *appError { + if exitCode == 0 { + message = fmt.Sprintf( + "got invalid exit code %d when constructing error (original message was %q)", + exitCode, + message, + ) + exitCode = 1 + } + return &appError{ + exitCode: exitCode, + message: message, + } +} + +func (e *appError) Error() string { + return e.message +} + +func printError(container StderrContainer, err error) { + if errString := err.Error(); errString != "" { + _, _ = fmt.Fprintln(container.Stderr(), errString) + } +} diff --git a/pkg/bufman/pkg/app/app_test.go b/pkg/bufman/pkg/app/app_test.go new file mode 100644 index 000000000..5e2e3b407 --- /dev/null +++ b/pkg/bufman/pkg/app/app_test.go @@ -0,0 +1,163 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestEnvContainer(t *testing.T) { + t.Parallel() + envContainer := NewEnvContainer( + map[string]string{ + "foo1": "bar1", + "foo2": "bar2", + "foo3": "", + }, + ) + assert.Equal(t, "bar1", envContainer.Env("foo1")) + assert.Equal(t, "bar2", envContainer.Env("foo2")) + assert.Equal(t, "", envContainer.Env("foo3")) + assert.Equal( + t, + []string{ + "foo1=bar1", + "foo2=bar2", + }, + Environ(envContainer), + ) + assert.Equal( + t, + map[string]string{ + "foo1": "bar1", + "foo2": "bar2", + }, + EnvironMap(envContainer), + ) + + envContainer, err := newEnvContainerForEnviron( + []string{ + "foo1=bar1", + "foo2=bar2", + "foo3=bar3", + "foo4=", + }, + ) + require.NoError(t, err) + assert.Equal(t, "bar1", envContainer.Env("foo1")) + assert.Equal(t, "bar2", envContainer.Env("foo2")) + assert.Equal(t, "bar3", envContainer.Env("foo3")) + assert.Equal(t, "", envContainer.Env("foo4")) + assert.Equal( + t, + []string{ + "foo1=bar1", + "foo2=bar2", + "foo3=bar3", + }, + Environ(envContainer), + ) + assert.Equal( + t, + map[string]string{ + "foo1": "bar1", + "foo2": "bar2", + "foo3": "bar3", + }, + EnvironMap(envContainer), + ) + + envContainer = NewEnvContainerWithOverrides( + envContainer, + map[string]string{ + "foo1": "", + "foo2": "baz2", + }, + ) + assert.Equal(t, "", envContainer.Env("foo1")) + assert.Equal(t, "baz2", envContainer.Env("foo2")) + assert.Equal(t, "bar3", envContainer.Env("foo3")) + assert.Equal(t, "", envContainer.Env("foo4")) + assert.Equal( + t, + []string{ + "foo2=baz2", + "foo3=bar3", + }, + Environ(envContainer), + ) + assert.Equal( + t, + map[string]string{ + "foo2": "baz2", + "foo3": "bar3", + }, + EnvironMap(envContainer), + ) + + _, err = newEnvContainerForEnviron( + []string{ + "foo1=bar1", + "foo2=bar2", + "foo3", + }, + ) + require.Error(t, err) +} + +func TestArgContainer(t *testing.T) { + t.Parallel() + args := []string{"foo", "bar", "baz"} + assert.Equal(t, args, Args(NewArgContainer(args...))) +} + +func TestIsDev(t *testing.T) { + t.Parallel() + assert.Equal(t, DevStdinFilePath != "", IsDevStdin(DevStdinFilePath)) + assert.Equal(t, DevStdoutFilePath != "", IsDevStdout(DevStdoutFilePath)) + assert.Equal(t, DevStderrFilePath != "", IsDevStderr(DevStderrFilePath)) + assert.Equal(t, DevNullFilePath != "", IsDevNull(DevNullFilePath)) + assert.False(t, IsDevStdin("foo")) + assert.False(t, IsDevStdout("foo")) + assert.False(t, IsDevStderr("foo")) + assert.False(t, IsDevNull("foo")) +} + +func TestEnvBool(t *testing.T) { + t.Parallel() + envContainer := NewEnvContainer( + map[string]string{ + "foo1": "bar1", + "foo2": "true", + "foo3": "false", + }, + ) + val, err := EnvBool(envContainer, "foo1", false) + assert.Error(t, err) + assert.Equal(t, false, val) + val, err = EnvBool(envContainer, "foo2", false) + assert.NoError(t, err) + assert.Equal(t, true, val) + val, err = EnvBool(envContainer, "foo3", false) + assert.NoError(t, err) + assert.Equal(t, false, val) + val, err = EnvBool(envContainer, "notset", true) + assert.NoError(t, err) + assert.Equal(t, true, val) +} diff --git a/pkg/bufman/pkg/app/app_unix.go b/pkg/bufman/pkg/app/app_unix.go new file mode 100644 index 000000000..2f06f8fed --- /dev/null +++ b/pkg/bufman/pkg/app/app_unix.go @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matching the unix-like build tags in the Golang source i.e. https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/file_unix.go#L6 +// +// We expanded this to all unix-like platforms, including those we don't support, as most +// of this should work without issue, and there are bigger problems with supporting i.e. js,wasm +// that are outside the scope of these build tags. Being able to build buf on i.e. openbsd +// was a blocker, see https://github.com/ProtobufMan/bufman-cli/issues/362 and the linked discussions. +// We still only officially support linux and darwin for buf as a whole. + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package app + +import ( + "errors" + "fmt" + "path/filepath" +) + +const ( + // DevStdinFilePath is the equivalent of /dev/stdin. + // + // This will be /dev/stdin for darwin and linux. + // This does not exist for windows. + DevStdinFilePath = "/dev/stdin" + // DevStdoutFilePath is the equivalent of /dev/stdout. + // + // This will be /dev/stdout for darwin and linux. + // This does not exist for windows. + DevStdoutFilePath = "/dev/stdout" + // DevStderrFilePath is the equivalent of /dev/stderr. + // + // This will be /dev/stderr for darwin and linux. + // This does not exist for windows. + DevStderrFilePath = "/dev/stderr" + // DevNullFilePath is the equivalent of /dev/null. + // + // This will be /dev/null for darwin and linux. + // This will be nul for windows. + DevNullFilePath = "/dev/null" +) + +// HomeDirPath returns the home directory path. +// +// This will be $HOME for darwin and linux. +// This will be %USERPROFILE% for windows. +func HomeDirPath(envContainer EnvContainer) (string, error) { + if home := envContainer.Env("HOME"); home != "" { + return home, nil + } + return "", errors.New("$HOME is not set") +} + +// CacheDirPath returns the cache directory path. +// +// This will be $XDG_CACHE_HOME for darwin and linux, falling back to $HOME/.cache. +// This will be %LocalAppData% for windows. +// +// See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +// for darwin and linux. Note that we use the same for darwin and linux as this is +// what developers expect, as opposed to ~/Library/Preferences etc as the stdlib +// does for Go. +// +// Users cannot assume that CacheDirPath, ConfigDirPath, and DataDirPath are unique. +func CacheDirPath(envContainer EnvContainer) (string, error) { + return xdgDirPath(envContainer, "XDG_CACHE_HOME", ".cache") +} + +// ConfigDirPath returns the config directory path. +// +// This will be $XDG_CONFIG_HOME for darwin and linux, falling back to $HOME/.config. +// This will be %AppData% for windows. +// +// See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +// for darwin and linux. Note that we use the same for darwin and linux as this is +// what developers expect, as opposed to ~/Library/Preferences etc as the stdlib +// does for Go. +// +// Users cannot assume that CacheDirPath, ConfigDirPath, and DataDirPath are unique. +func ConfigDirPath(envContainer EnvContainer) (string, error) { + return xdgDirPath(envContainer, "XDG_CONFIG_HOME", ".config") +} + +// DataDirPath returns the data directory path. +// +// This will be $XDG_DATA_HOME for darwin and linux, falling back to $HOME/.local/share. +// This will be %LocalAppData% for windows. +// +// See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +// for darwin and linux. Note that we use the same for darwin and linux as this is +// what developers expect, as opposed to ~/Library/Preferences etc as the stdlib +// does for Go. +// +// Users cannot assume that CacheDirPath, ConfigDirPath, and DataDirPath are unique. +func DataDirPath(envContainer EnvContainer) (string, error) { + return xdgDirPath(envContainer, "XDG_DATA_HOME", filepath.Join(".local", "share")) +} + +func xdgDirPath(envContainer EnvContainer, key string, fallbackRelHomeDirPath string) (string, error) { + if value := envContainer.Env(key); value != "" { + return value, nil + } + if home := envContainer.Env("HOME"); home != "" { + return filepath.Join(home, fallbackRelHomeDirPath), nil + } + return "", fmt.Errorf("$%s and $HOME are not set", key) +} diff --git a/pkg/bufman/pkg/app/app_windows.go b/pkg/bufman/pkg/app/app_windows.go new file mode 100644 index 000000000..5a82a5811 --- /dev/null +++ b/pkg/bufman/pkg/app/app_windows.go @@ -0,0 +1,111 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package app + +import ( + "errors" +) + +const ( + // DevStdinFilePath is the equivalent of /dev/stdin. + // + // This will be /dev/stdin for darwin and linux. + // This does not exist for windows. + DevStdinFilePath = "" + // DevStdoutFilePath is the equivalent of /dev/stdout. + // + // This will be /dev/stdout for darwin and linux. + // This does not exist for windows. + DevStdoutFilePath = "" + // DevStderrFilePath is the equivalent of /dev/stderr. + // + // This will be /dev/stderr for darwin and linux. + // This does not exist for windows. + DevStderrFilePath = "" + // DevNullFilePath is the equivalent of /dev/null. + // + // This will be /dev/null for darwin and linux. + // This will be nul for windows. + DevNullFilePath = "nul" +) + +// HomeDirPath returns the home directory path. +// +// This will be $HOME for darwin and linux. +// This will be %USERPROFILE% for windows. +func HomeDirPath(envContainer EnvContainer) (string, error) { + if value := envContainer.Env("USERPROFILE"); value != "" { + return value, nil + } + return "", errors.New("%USERPROFILE% is not set") +} + +// CacheDirPath returns the cache directory path. +// +// This will be $XDG_CACHE_HOME for darwin and linux, falling back to $HOME/.cache. +// This will be %LocalAppData% for windows. +// +// See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +// for darwin and linux. Note that we use the same for darwin and linux as this is +// what developers expect, as opposed to ~/Library/Preferences etc as the stdlib +// does for Go. +// +// Users cannot assume that CacheDirPath, ConfigDirPath, and DataDirPath are unique. +func CacheDirPath(envContainer EnvContainer) (string, error) { + if value := envContainer.Env("LOCALAPPDATA"); value != "" { + return value, nil + } + return "", errors.New("%LocalAppData% is not set") +} + +// ConfigDirPath returns the config directory path. +// +// This will be $XDG_CONFIG_HOME for darwin and linux, falling back to $HOME/.config. +// This will be %AppData% for windows. +// +// See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +// for darwin and linux. Note that we use the same for darwin and linux as this is +// what developers expect, as opposed to ~/Library/Preferences etc as the stdlib +// does for Go. +// +// Users cannot assume that CacheDirPath, ConfigDirPath, and DataDirPath are unique. +func ConfigDirPath(envContainer EnvContainer) (string, error) { + if value := envContainer.Env("APPDATA"); value != "" { + return value, nil + } + return "", errors.New("%AppData% is not set") +} + +// DataDirPath returns the data directory path. +// +// This will be $XDG_DATA_HOME for darwin and linux, falling back to $HOME/.local/share. +// This will be %LocalAppData% for windows. +// +// See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +// for darwin and linux. Note that we use the same for darwin and linux as this is +// what developers expect, as opposed to ~/Library/Preferences etc as the stdlib +// does for Go. +// +// Users cannot assume that CacheDirPath, ConfigDirPath, and DataDirPath are unique. +func DataDirPath(envContainer EnvContainer) (string, error) { + if value := envContainer.Env("LOCALAPPDATA"); value != "" { + return value, nil + } + return "", errors.New("%LocalAppData% is not set") +} diff --git a/pkg/bufman/pkg/app/appcmd/appcmd.go b/pkg/bufman/pkg/app/appcmd/appcmd.go new file mode 100644 index 000000000..2f4e63d2a --- /dev/null +++ b/pkg/bufman/pkg/app/appcmd/appcmd.go @@ -0,0 +1,379 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package appcmd contains helper functionality for applications using commands. +package appcmd + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" + "github.com/spf13/pflag" +) + +// Command is a command. +type Command struct { + // Use is the one-line usage message. + // Required. + Use string + // Aliases are aliases that can be used instead of the first word in Use. + Aliases []string + // Short is the short message shown in the 'help' output. + // Required if Long is set. + Short string + // Long is the long message shown in the 'help ' output. + // The Short field will be prepended to the Long field with two newlines. + // Must be unset if short is unset. + Long string + // Args are the expected arguments. + // + // TODO: make specific types for appcmd to limit what can be done. + Args cobra.PositionalArgs + // Deprecated says to print this deprecation string. + Deprecated string + // Hidden says to hide this command. + Hidden bool + // BindFlags allows binding of flags on build. + BindFlags func(*pflag.FlagSet) + // BindPersistentFlags allows binding of flags on build. + BindPersistentFlags func(*pflag.FlagSet) + // NormalizeFlag allows for normalization of flag names. + NormalizeFlag func(*pflag.FlagSet, string) string + // NormalizePersistentFlag allows for normalization of flag names. + NormalizePersistentFlag func(*pflag.FlagSet, string) string + // Run is the command to run. + // Required if there are no sub-commands. + // Must be unset if there are sub-commands. + Run func(context.Context, app.Container) error + // SubCommands are the sub-commands. Optional. + // Must be unset if there is a run function. + SubCommands []*Command + // Version the version of the command. + // + // If this is specified, a flag --version will be added to the command + // that precedes all other functionality, and which prints the version + // to stdout. + Version string +} + +// NewInvalidArgumentError creates a new invalidArgumentError, indicating that +// the error was caused by argument validation. This causes us to print the usage +// help text for the command that it is returned from. +func NewInvalidArgumentError(message string) error { + return newInvalidArgumentError(message) +} + +// NewInvalidArgumentErrorf creates a new InvalidArgumentError, indicating that +// the error was caused by argument validation. This causes us to print the usage +// help text for the command that it is returned from. +func NewInvalidArgumentErrorf(format string, args ...interface{}) error { + return NewInvalidArgumentError(fmt.Sprintf(format, args...)) +} + +// Main runs the application using the OS container and calling os.Exit on the return value of Run. +func Main(ctx context.Context, command *Command) { + app.Main(ctx, newRunFunc(command)) +} + +// Run runs the application using the container. +func Run(ctx context.Context, container app.Container, command *Command) error { + return app.Run(ctx, container, newRunFunc(command)) +} + +// BindMultiple is a convenience function for binding multiple flag functions. +func BindMultiple(bindFuncs ...func(*pflag.FlagSet)) func(*pflag.FlagSet) { + return func(flagSet *pflag.FlagSet) { + for _, bindFunc := range bindFuncs { + bindFunc(flagSet) + } + } +} + +func newRunFunc(command *Command) func(context.Context, app.Container) error { + return func(ctx context.Context, container app.Container) error { + return run(ctx, container, command) + } +} + +func run( + ctx context.Context, + container app.Container, + command *Command, +) error { + var runErr error + + cobraCommand, err := commandToCobra(ctx, container, command, &runErr) + if err != nil { + return err + } + + // Cobra 1.2.0 introduced default completion commands under + // " completion "". Since we have + // our own completion commands, disable the generation of the default + // commands. + cobraCommand.CompletionOptions.DisableDefaultCmd = true + + // If the root command is not the only command, add a hidden manpages command + // and a visible completion command. + if len(command.SubCommands) > 0 { + shellCobraCommand, err := commandToCobra( + ctx, + container, + &Command{ + Use: "completion", + Short: "Generate auto-completion scripts for commonly used shells", + SubCommands: []*Command{ + { + Use: "bash", + Short: "Generate auto-completion scripts for bash", + Args: cobra.NoArgs, + Run: func(ctx context.Context, container app.Container) error { + return cobraCommand.GenBashCompletion(container.Stdout()) + }, + }, + { + Use: "fish", + Short: "Generate auto-completion scripts for fish", + Args: cobra.NoArgs, + Run: func(ctx context.Context, container app.Container) error { + return cobraCommand.GenFishCompletion(container.Stdout(), true) + }, + }, + { + Use: "powershell", + Short: "Generate auto-completion scripts for powershell", + Args: cobra.NoArgs, + Run: func(ctx context.Context, container app.Container) error { + return cobraCommand.GenPowerShellCompletion(container.Stdout()) + }, + }, + { + Use: "zsh", + Short: "Generate auto-completion scripts for zsh", + Args: cobra.NoArgs, + Run: func(ctx context.Context, container app.Container) error { + return cobraCommand.GenZshCompletion(container.Stdout()) + }, + }, + }, + }, + &runErr, + ) + if err != nil { + return err + } + cobraCommand.AddCommand(shellCobraCommand) + manpagesCobraCommand, err := commandToCobra( + ctx, + container, + &Command{ + Use: "manpages", + Args: cobra.ExactArgs(1), + Hidden: true, + Run: func(ctx context.Context, container app.Container) error { + return doc.GenManTree( + cobraCommand, + &doc.GenManHeader{ + Title: "Buf", + Section: "1", + }, + container.Arg(0), + ) + }, + }, + &runErr, + ) + if err != nil { + return err + } + cobraCommand.AddCommand(manpagesCobraCommand) + webpagesCobraCommand, err := commandToCobra( + ctx, + container, + newWebpagesCommand(cobraCommand), + &runErr, + ) + if err != nil { + return err + } + cobraCommand.AddCommand(webpagesCobraCommand) + } + + cobraCommand.SetOut(container.Stderr()) + args := app.Args(container)[1:] + // cobra will implicitly create __complete and __completeNoDesc subcommands + // https://github.com/spf13/cobra/blob/4590150168e93f4b017c6e33469e26590ba839df/completions.go#L14-L17 + // at the very last possible point, to enable them to be overridden. Unfortunately + // the creation of the subcommands uses hidden helper methods (unlike the automatic help command support). + // See https://github.com/spf13/cobra/blob/4590150168e93f4b017c6e33469e26590ba839df/completions.go#L134. + // + // Additionally, the automatically generated commands inherit the output of the root command, + // which we are ensuring is always stderr. + // https://github.com/spf13/cobra/blob/4590150168e93f4b017c6e33469e26590ba839df/completions.go#L175 + // + // bash completion has much more detailed code generation and doesn't rely on the __completion command + // in most cases, the zsh and fish completion implementation however exclusively rely on these commands. + // Those completion implementations send stderr to /dev/null + // https://github.com/spf13/cobra/blob/4590150168e93f4b017c6e33469e26590ba839df/zsh_completions.go#L135 + // and the automatically generated __complete command sends extra data to /dev/null so we cannot + // work around this by minimally changing the code generation commands, we would have to rewrite the + // __completion command which is much more complicated. + // + // Instead of all that, we can peek at the positionals and if the sub command starts with __complete + // we sets its output to stdout. This would mean that we cannot add a "real" sub-command that starts with + // __complete _and_ has its output set to stderr. This shouldn't ever be a problem. + // + // SetOut sets the output location for usage, help, and version messages by default. + if len(args) > 0 && strings.HasPrefix(args[0], "__complete") { + cobraCommand.SetOut(container.Stdout()) + } + cobraCommand.SetArgs(args) + // SetErr sets the output location for error messages. + cobraCommand.SetErr(container.Stderr()) + cobraCommand.SetIn(container.Stdin()) + + if err := cobraCommand.Execute(); err != nil { + return err + } + return runErr +} + +func commandToCobra( + ctx context.Context, + container app.Container, + command *Command, + runErrAddr *error, +) (*cobra.Command, error) { + if err := commandValidate(command); err != nil { + return nil, err + } + cobraCommand := &cobra.Command{ + Use: command.Use, + Aliases: command.Aliases, + Args: command.Args, + Deprecated: command.Deprecated, + Hidden: command.Hidden, + Short: strings.TrimSpace(command.Short), + } + cobraCommand.SetHelpTemplate(`{{.Short}} + +{{with .Long}}{{. | trimTrailingWhitespaces}} + +{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`) + cobraCommand.SetHelpFunc( + func(c *cobra.Command, _ []string) { + if err := tmpl(container.Stdout(), c.HelpTemplate(), c); err != nil { + c.PrintErrln(err) + } + }, + ) + if command.Long != "" { + cobraCommand.Long = strings.TrimSpace(command.Long) + } + if command.BindFlags != nil { + command.BindFlags(cobraCommand.Flags()) + } + if command.BindPersistentFlags != nil { + command.BindPersistentFlags(cobraCommand.PersistentFlags()) + } + if command.NormalizeFlag != nil { + cobraCommand.Flags().SetNormalizeFunc(normalizeFunc(command.NormalizeFlag)) + } + if command.NormalizePersistentFlag != nil { + cobraCommand.PersistentFlags().SetNormalizeFunc(normalizeFunc(command.NormalizePersistentFlag)) + } + if command.Run != nil { + cobraCommand.Run = func(_ *cobra.Command, args []string) { + runErr := command.Run(ctx, app.NewContainerForArgs(container, args...)) + if asErr := (&invalidArgumentError{}); errors.As(runErr, &asErr) { + // Print usage for failing command if an args error is returned. + // This has to be done at this level since the usage must relate + // to the command executed. + printUsage(container, cobraCommand.UsageString()) + } + *runErrAddr = runErr + } + } + if len(command.SubCommands) > 0 { + // command.Run will not be set per validation + cobraCommand.Run = func(cmd *cobra.Command, args []string) { + printUsage(container, cobraCommand.UsageString()) + if len(args) == 0 { + *runErrAddr = errors.New("Sub-command required.") + } else { + *runErrAddr = fmt.Errorf("Unknown sub-command: %s", strings.Join(args, " ")) + } + } + for _, subCommand := range command.SubCommands { + subCobraCommand, err := commandToCobra(ctx, container, subCommand, runErrAddr) + if err != nil { + return nil, err + } + cobraCommand.AddCommand(subCobraCommand) + } + } + if command.Version != "" { + doVersion := false + oldRun := cobraCommand.Run + cobraCommand.Flags().BoolVar( + &doVersion, + "version", + false, + "Print the version", + ) + cobraCommand.Run = func(cmd *cobra.Command, args []string) { + if doVersion { + _, err := container.Stdout().Write([]byte(command.Version + "\n")) + *runErrAddr = err + return + } + oldRun(cmd, args) + } + } + // appcommand prints errors, disable to prevent duplicates. + cobraCommand.SilenceErrors = true + return cobraCommand, nil +} + +func commandValidate(command *Command) error { + if command.Use == "" { + return errors.New("must set Command.Use") + } + if command.Long != "" && command.Short == "" { + return errors.New("must set Command.Short if Command.Long is set") + } + if command.Run != nil && len(command.SubCommands) > 0 { + return errors.New("cannot set both Command.Run and Command.SubCommands") + } + if command.Run == nil && len(command.SubCommands) == 0 { + return errors.New("must set one of Command.Run and Command.SubCommands") + } + return nil +} + +func normalizeFunc(f func(*pflag.FlagSet, string) string) func(*pflag.FlagSet, string) pflag.NormalizedName { + return func(flagSet *pflag.FlagSet, name string) pflag.NormalizedName { + return pflag.NormalizedName(f(flagSet, name)) + } +} + +func printUsage(container app.StderrContainer, usage string) { + _, _ = container.Stderr().Write([]byte(usage + "\n")) +} diff --git a/pkg/bufman/pkg/app/appcmd/appcmd_test.go b/pkg/bufman/pkg/app/appcmd/appcmd_test.go new file mode 100644 index 000000000..e19334f2f --- /dev/null +++ b/pkg/bufman/pkg/app/appcmd/appcmd_test.go @@ -0,0 +1,229 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appcmd + +import ( + "bytes" + "context" + "io" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/spf13/pflag" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestBasic(t *testing.T) { + t.Parallel() + var foo string + var bar int + + var actualArgs []string + var actualFoo string + var actualBar int + var actualStdin string + var actualEnvValue string + + rootCommand := &Command{ + Use: "test", + BindPersistentFlags: func(flagSet *pflag.FlagSet) { + flagSet.StringVar(&foo, "foo", "", "Foo.") + }, + SubCommands: []*Command{ + { + Use: "sub", + BindFlags: func(flagSet *pflag.FlagSet) { + flagSet.IntVar(&bar, "bar", 1, "Bar.") + }, + Run: func(ctx context.Context, container app.Container) error { + actualArgs = app.Args(container) + actualFoo = foo + actualBar = bar + data, err := io.ReadAll(container.Stdin()) + if err != nil { + return err + } + actualStdin = string(data) + actualEnvValue = container.Env("KEY") + return nil + }, + }, + }, + } + container := app.NewContainer( + map[string]string{ + "KEY": "VALUE", + }, + strings.NewReader("world"), + nil, + nil, + "test", + "sub", + "one", + "two", + "--foo", + "hello", + ) + require.NoError(t, Run(context.Background(), container, rootCommand)) + assert.Equal(t, []string{"one", "two"}, actualArgs) + assert.Equal(t, "hello", actualFoo) + assert.Equal(t, 1, actualBar) + assert.Equal(t, "world", actualStdin) + assert.Equal(t, "VALUE", actualEnvValue) +} + +func TestError(t *testing.T) { + t.Parallel() + rootCommand := &Command{ + Use: "test", + SubCommands: []*Command{ + { + Use: "sub", + Run: func(ctx context.Context, container app.Container) error { + return app.NewError(5, "bar") + }, + }, + }, + } + container := app.NewContainer( + nil, + nil, + nil, + nil, + "test", + "sub", + ) + require.Equal(t, app.NewError(5, "bar"), Run(context.Background(), container, rootCommand)) +} + +func TestVersionToStdout(t *testing.T) { + t.Parallel() + version := "0.0.1-dev" + rootCommand := &Command{ + Use: "test", + Version: version, + SubCommands: []*Command{ + { + Use: "foo", + Run: func(context.Context, app.Container) error { + return nil + }, + }, + }, + } + buffer := bytes.NewBuffer(nil) + container := app.NewContainer( + nil, + nil, + buffer, + nil, + "test", + "--version", + ) + require.NoError(t, Run(context.Background(), container, rootCommand)) + require.Equal(t, version+"\n", buffer.String()) + + rootCommand = &Command{ + Use: "test", + Version: version, + Run: func(context.Context, app.Container) error { + return nil + }, + } + buffer = bytes.NewBuffer(nil) + container = app.NewContainer( + nil, + nil, + buffer, + nil, + "test", + "--version", + ) + require.NoError(t, Run(context.Background(), container, rootCommand)) + require.Equal(t, version+"\n", buffer.String()) +} + +func TestHelpToStdout(t *testing.T) { + t.Parallel() + rootCommand := &Command{ + Use: "test", + // need a sub-command for "help" to work + // otherwise can do -h + SubCommands: []*Command{ + { + Use: "foo", + Run: func(context.Context, app.Container) error { + return nil + }, + }, + }, + } + buffer := bytes.NewBuffer(nil) + container := app.NewContainer( + nil, + nil, + buffer, + nil, + "test", + "help", + ) + require.NoError(t, Run(context.Background(), container, rootCommand)) + require.NotEmpty(t, buffer.String()) + + rootCommand = &Command{ + Use: "test", + Run: func(context.Context, app.Container) error { + return nil + }, + } + buffer = bytes.NewBuffer(nil) + container = app.NewContainer( + nil, + nil, + buffer, + nil, + "test", + "-h", + ) + require.NoError(t, Run(context.Background(), container, rootCommand)) + require.NotEmpty(t, buffer.String()) +} + +func TestIncorrectFlagEmptyStdout(t *testing.T) { + t.Parallel() + rootCommand := &Command{ + Use: "test", + Run: func(context.Context, app.Container) error { + return nil + }, + } + stderr := bytes.NewBuffer(nil) + stdout := bytes.NewBuffer(nil) + container := app.NewContainer( + nil, + nil, + stdout, + stderr, + "test", + "--foo", + "1", + ) + require.Error(t, Run(context.Background(), container, rootCommand)) + require.Empty(t, stdout.String()) + require.NotEmpty(t, stderr.String()) +} diff --git a/pkg/bufman/pkg/app/appcmd/appcmdtesting/appcmdtesting.go b/pkg/bufman/pkg/app/appcmd/appcmdtesting/appcmdtesting.go new file mode 100644 index 000000000..8d2477594 --- /dev/null +++ b/pkg/bufman/pkg/app/appcmd/appcmdtesting/appcmdtesting.go @@ -0,0 +1,208 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appcmdtesting + +import ( + "bytes" + "context" + "io" + "os" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// RunCommandSuccessStdout runs the command and makes sure it was successful, and compares the stdout output. +func RunCommandSuccessStdout( + t *testing.T, + newCommand func(use string) *appcmd.Command, + expectedStdout string, + newEnv func(use string) map[string]string, + stdin io.Reader, + args ...string, +) { + RunCommandExitCodeStdout(t, newCommand, 0, expectedStdout, newEnv, stdin, args...) +} + +// RunCommandExitCodeStdout runs the command and compares the exit code and stdout output. +func RunCommandExitCodeStdout( + t *testing.T, + newCommand func(use string) *appcmd.Command, + expectedExitCode int, + expectedStdout string, + newEnv func(use string) map[string]string, + stdin io.Reader, + args ...string, +) { + stdout := bytes.NewBuffer(nil) + stderr := bytes.NewBuffer(nil) + RunCommandExitCode(t, newCommand, expectedExitCode, newEnv, stdin, stdout, stderr, args...) + require.Equal(t, stringutil.TrimLines(expectedStdout), stringutil.TrimLines(stdout.String())) +} + +// RunCommandExitCodeStdoutFile runs the command and compares the exit code and stdout output. +func RunCommandExitCodeStdoutFile( + t *testing.T, + newCommand func(use string) *appcmd.Command, + expectedExitCode int, + expectedStdout string, + newEnv func(use string) map[string]string, + stdin io.Reader, + args ...string, +) { + file, err := os.Open(expectedStdout) + require.NoError(t, err) + expectedstdoutConts, err := io.ReadAll(file) + require.NoError(t, err) + RunCommandExitCodeStdout(t, newCommand, expectedExitCode, string(expectedstdoutConts), newEnv, stdin, args...) +} + +// RunCommandExitCodeStdoutStdinFile runs the command and allows a stdinFile to be opened and piped into the command. +func RunCommandExitCodeStdoutStdinFile( + t *testing.T, + newCommand func(use string) *appcmd.Command, + expectedExitCode int, + expectedStdout string, + newEnv func(use string) map[string]string, + stdinFile string, + args ...string, +) { + stdin, err := os.Open(stdinFile) + require.NoError(t, err) + RunCommandExitCodeStdout(t, newCommand, expectedExitCode, expectedStdout, newEnv, stdin, args...) +} + +// RunCommandExitCodeStderr runs the command and compares the exit code and stderr output. +func RunCommandExitCodeStderr( + t *testing.T, + newCommand func(use string) *appcmd.Command, + expectedExitCode int, + expectedStderr string, + newEnv func(use string) map[string]string, + stdin io.Reader, + args ...string, +) { + stdout := bytes.NewBuffer(nil) + stderr := bytes.NewBuffer(nil) + RunCommandExitCode(t, newCommand, expectedExitCode, newEnv, stdin, stdout, stderr, args...) + require.Equal(t, stringutil.TrimLines(expectedStderr), stringutil.TrimLines(stderr.String())) +} + +// RunCommandExitCodeStderrContains runs the command and compares the exit code and stderr output +// with the passed partial messages. +func RunCommandExitCodeStderrContains( + t *testing.T, + newCommand func(use string) *appcmd.Command, + expectedExitCode int, + expectedStderrPartials []string, + newEnv func(use string) map[string]string, + stdin io.Reader, + args ...string, +) { + stdout := bytes.NewBuffer(nil) + stderr := bytes.NewBuffer(nil) + RunCommandExitCode(t, newCommand, expectedExitCode, newEnv, stdin, stdout, stderr, args...) + allStderr := stderr.String() + for _, expectedPartial := range expectedStderrPartials { + assert.Contains(t, allStderr, expectedPartial) + } +} + +// RunCommandExitCodeStdoutStderr runs the command and compares the exit code, stdout, and stderr output. +func RunCommandExitCodeStdoutStderr( + t *testing.T, + newCommand func(use string) *appcmd.Command, + expectedExitCode int, + expectedStdout string, + expectedStderr string, + newEnv func(use string) map[string]string, + stdin io.Reader, + args ...string, +) { + stdout := bytes.NewBuffer(nil) + stderr := bytes.NewBuffer(nil) + RunCommandExitCode(t, newCommand, expectedExitCode, newEnv, stdin, stdout, stderr, args...) + require.Equal(t, stringutil.TrimLines(expectedStdout), stringutil.TrimLines(stdout.String())) + require.Equal(t, stringutil.TrimLines(expectedStderr), stringutil.TrimLines(stderr.String())) +} + +// RunCommandSuccess runs the command and makes sure it was successful. +func RunCommandSuccess( + t *testing.T, + newCommand func(use string) *appcmd.Command, + newEnv func(use string) map[string]string, + stdin io.Reader, + stdout io.Writer, + args ...string, +) { + stderr := bytes.NewBuffer(nil) + RunCommandExitCode(t, newCommand, 0, newEnv, stdin, stdout, stderr, args...) +} + +// RunCommandExitCode runs the command and compares the exit code. +func RunCommandExitCode( + t *testing.T, + newCommand func(use string) *appcmd.Command, + expectedExitCode int, + newEnv func(use string) map[string]string, + stdin io.Reader, + stdout io.Writer, + stderr io.Writer, + args ...string, +) { + // make the use something different than the actual command + // to make sure that all code is binary-name-agnostic. + use := "test" + stdoutCopy := bytes.NewBuffer(nil) + if stdout == nil { + stdout = stdoutCopy + } else { + stdout = io.MultiWriter(stdout, stdoutCopy) + } + stderrCopy := bytes.NewBuffer(nil) + if stderr == nil { + stderr = stderrCopy + } else { + stderr = io.MultiWriter(stderr, stderrCopy) + } + var env map[string]string + if newEnv != nil { + env = newEnv(use) + } + exitCode := app.GetExitCode( + appcmd.Run( + context.Background(), + app.NewContainer( + env, + stdin, + stdout, + stderr, + append([]string{"test"}, args...)..., + ), + newCommand(use), + ), + ) + require.Equal( + t, + expectedExitCode, + exitCode, + stringutil.TrimLines(stdoutCopy.String())+"\n"+stringutil.TrimLines(stderrCopy.String()), + ) +} diff --git a/pkg/bufman/pkg/app/appcmd/cobra.go b/pkg/bufman/pkg/app/appcmd/cobra.go new file mode 100644 index 000000000..9eeb55c1c --- /dev/null +++ b/pkg/bufman/pkg/app/appcmd/cobra.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appcmd + +import ( + "fmt" + "io" + "strings" + "text/template" + "unicode" + + "github.com/spf13/cobra" +) + +// The functions in this file are mostly copied from github.com/spf13/cobra. +// https://github.com/spf13/cobra/blob/master/LICENSE.txt + +var templateFuncs = template.FuncMap{ + "trim": strings.TrimSpace, + "trimRightSpace": trimRightSpace, + "trimTrailingWhitespaces": trimRightSpace, + "rpad": rpad, + "gt": cobra.Gt, + "eq": cobra.Eq, +} + +func trimRightSpace(s string) string { + return strings.TrimRightFunc(s, unicode.IsSpace) +} + +// rpad adds padding to the right of a string. +func rpad(s string, padding int) string { + template := fmt.Sprintf("%%-%ds", padding) + return fmt.Sprintf(template, s) +} + +// tmpl executes the given template text on data, writing the result to w. +func tmpl(w io.Writer, text string, data interface{}) error { + t := template.New("top") + t.Funcs(templateFuncs) + t, err := t.Parse(text) + if err != nil { + return err + } + return t.Execute(w, data) +} diff --git a/pkg/bufman/pkg/app/appcmd/error.go b/pkg/bufman/pkg/app/appcmd/error.go new file mode 100644 index 000000000..b2a937c05 --- /dev/null +++ b/pkg/bufman/pkg/app/appcmd/error.go @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appcmd + +// invalidArgumentError is used to indicate that an error was +// caused by argument validation. +type invalidArgumentError struct { + message string +} + +func newInvalidArgumentError(message string) *invalidArgumentError { + return &invalidArgumentError{message: message} +} + +func (a *invalidArgumentError) Error() string { + return a.message +} diff --git a/pkg/bufman/pkg/app/appcmd/webpages.go b/pkg/bufman/pkg/app/appcmd/webpages.go new file mode 100644 index 000000000..1d02a4833 --- /dev/null +++ b/pkg/bufman/pkg/app/appcmd/webpages.go @@ -0,0 +1,399 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appcmd + +import ( + "bufio" + "bytes" + "context" + "fmt" + "html" + "io" + "os" + "path" + "path/filepath" + "regexp" + "sort" + "strings" + "unicode" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "gopkg.in/yaml.v3" +) + +const ( + webpagesConfigFlag = "config" +) + +var codeBlockRegex = regexp.MustCompile(`(^\s\s\s\s)|(^\t)`) + +type webpagesFlags struct { + Config string +} + +// webpagesConfig configures the doc generator, example config: +// exclude_commands: +// - buf completion +// - buf ls-files +// weight_commands: +// buf beta: 1 +// slug_prefix: /reference/cli/ +// output_dir: output/docs +type webpagesConfig struct { + // ExcludeCommands will filter out these command paths from generation. + ExcludeCommands []string `yaml:"exclude_commands,omitempty"` + // WeightCommands will weight the command paths and show higher weighted commands later on the sidebar. + WeightCommands map[string]int `yaml:"weight_commands,omitempty"` + SlugPrefix string `yaml:"slug_prefix,omitempty"` + OutputDir string `yaml:"output_dir,omitempty"` + // SidebarPathThreshold will dictate if the sidebar label is the full path or just the name. + // if the command path is longer than this then the `cobra.Command.Name()` is used, + // otherwise `cobra.Command.CommandPath() is used. + SidebarPathThreshold int `yaml:"sidebar_path_threshold,omitempty"` +} + +func newWebpagesFlags() *webpagesFlags { + return &webpagesFlags{} +} + +func (f *webpagesFlags) Bind(flagSet *pflag.FlagSet) { + flagSet.StringVar( + &f.Config, + webpagesConfigFlag, + "", + "Config file to use", + ) +} + +// newWebpagesCommand returns a "webpages" command that generates docusaurus markdown for cobra commands. +// In the future this will need to be adapted to accept a Command when cobra.Command is removed. +func newWebpagesCommand( + command *cobra.Command, +) *Command { + flags := newWebpagesFlags() + return &Command{ + Use: "webpages", + Hidden: true, + Run: func(ctx context.Context, container app.Container) error { + cfg, err := readConfig(flags.Config) + if err != nil { + return err + } + excludes := make(map[string]bool) + for _, exclude := range cfg.ExcludeCommands { + excludes[exclude] = true + } + for _, cmd := range command.Commands() { + if excludes[cmd.CommandPath()] { + cmd.Hidden = true + } + } + return generateMarkdownTree( + command, + cfg, + cfg.OutputDir, + ) + }, + BindFlags: flags.Bind, + } +} + +// generateMarkdownTree generates markdown for a whole command tree. +func generateMarkdownTree(cmd *cobra.Command, config webpagesConfig, parentDirPath string) error { + if !cmd.IsAvailableCommand() { + return nil + } + dirPath := parentDirPath + fileName := cmd.Name() + ".md" + if cmd.HasSubCommands() { + dirPath = filepath.Join(parentDirPath, cmd.Name()) + if err := os.MkdirAll(dirPath, os.ModePerm); err != nil { + return err + } + fileName = "index.md" + } + filePath := filepath.Join(dirPath, fileName) + f, err := os.Create(filePath) + if err != nil { + return err + } + defer f.Close() + if err := generateMarkdownPage(cmd, config, f); err != nil { + return err + } + if cmd.HasSubCommands() { + commands := cmd.Commands() + orderCommands(config.WeightCommands, commands) + for _, command := range commands { + if err := generateMarkdownTree(command, config, dirPath); err != nil { + return err + } + } + } + return nil +} + +// generateMarkdownPage creates custom markdown output. +func generateMarkdownPage(cmd *cobra.Command, config webpagesConfig, w io.Writer) error { + var err error + p := func(format string, a ...any) { + _, err = w.Write([]byte(fmt.Sprintf(format, a...))) + } + p("---\n") + p("id: %s\n", websitePageID(cmd)) + p("title: %s\n", cmd.CommandPath()) + p("sidebar_label: %s\n", sidebarLabel(cmd, config.SidebarPathThreshold)) + p("sidebar_position: %d\n", websiteSidebarPosition(cmd, config.WeightCommands)) + p("slug: /%s\n", path.Join(config.SlugPrefix, websiteSlug(cmd))) + p("---\n") + cmd.InitDefaultHelpCmd() + cmd.InitDefaultHelpFlag() + if cmd.Version != "" { + p("version `%s`\n\n", cmd.Version) + } + p(cmd.Short) + p("\n\n") + if cmd.Runnable() { + p("### Usage\n") + p("```terminal\n$ %s\n```\n\n", cmd.UseLine()) + } + if len(cmd.Long) > 0 { + p("### Description\n\n") + p("%s \n\n", escapeDescription(cmd.Long)) + } + if len(cmd.Example) > 0 { + p("### Examples\n\n") + p("```\n%s\n```\n\n", escapeDescription(cmd.Example)) + } + commandFlags := cmd.NonInheritedFlags() + if commandFlags.HasAvailableFlags() { + p("### Flags {#flags}\n\n") + if err := printFlags(commandFlags, w); err != nil { + return err + } + } + inheritedFlags := cmd.InheritedFlags() + if inheritedFlags.HasAvailableFlags() { + p("### Flags inherited from parent commands {#persistent-flags}\n") + if err := printFlags(inheritedFlags, w); err != nil { + return err + } + } + if hasSubCommands(cmd) { + p("### Subcommands\n\n") + children := cmd.Commands() + orderCommands(config.WeightCommands, children) + for _, child := range children { + if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() { + continue + } + childRelPath := child.Name() + ".md" + if child.HasSubCommands() { + childRelPath = filepath.Join(child.Name(), "index.md") + } + p("* [%s](./%s)\t - %s\n", child.CommandPath(), childRelPath, child.Short) + } + p("\n") + } + if cmd.HasParent() { + p("### Parent Command\n\n") + parent := cmd.Parent() + parentName := parent.CommandPath() + if hasSubCommands(cmd) { + p("* [%s](../index.md)\t - %s\n", parentName, parent.Short) + } else { + p("* [%s](./index.md)\t - %s\n", parentName, parent.Short) + } + cmd.VisitParents(func(c *cobra.Command) { + if c.DisableAutoGenTag { + cmd.DisableAutoGenTag = c.DisableAutoGenTag + } + }) + } + return err +} + +func websitePageID(cmd *cobra.Command) string { + return strings.ReplaceAll(cmd.CommandPath(), " ", "-") +} + +func hasSubCommands(cmd *cobra.Command) bool { + for _, command := range cmd.Commands() { + if !command.IsAvailableCommand() || command.IsAdditionalHelpTopicCommand() { + continue + } + return true + } + return false +} + +// escapeDescription is a bit of a hack because docusaurus markdown rendering is a bit weird. +// If the code block is indented then escaping html characters is skipped, otherwise it will +// html.Escape the string. +func escapeDescription(s string) string { + out := &bytes.Buffer{} + read := bufio.NewReader(strings.NewReader(s)) + var inCodeBlock bool + for { + line, _, err := read.ReadLine() + if err == io.EOF { + break + } + text := string(line) + // convert indented code blocks into terminal code blocks so the + // $ isn't copied when using the copy button + if codeBlockRegex.MatchString(text) { + if !inCodeBlock { + out.WriteString("```terminal\n") + inCodeBlock = true + } + // remove the indentation level from the indented code block + text = codeBlockRegex.ReplaceAllString(text, "") + out.WriteString(text) + out.WriteString("\n") + continue + } + // indented code blocks can have blank lines in them so + // if the next line is a whitespace then we don't want to + // terminate the code block + if inCodeBlock && text == "" { + if b, err := read.Peek(1); err == nil && unicode.IsSpace(rune(b[0])) { + out.WriteString(text) + out.WriteString("\n") + continue + } + } + // terminate the fenced code block with ``` + if inCodeBlock { + out.WriteString("```\n") + inCodeBlock = false + } + out.WriteString(html.EscapeString(text)) + out.WriteString("\n") + } + if inCodeBlock { + out.WriteString("```\n") + } + return out.String() +} + +func readConfig(filename string) (webpagesConfig, error) { + if filename == "" { + return webpagesConfig{}, nil + } + file, err := os.Open(filename) + if err != nil { + return webpagesConfig{}, err + } + yamlBytes, err := io.ReadAll(file) + if err != nil { + return webpagesConfig{}, err + } + var cfg webpagesConfig + if err := yaml.Unmarshal(yamlBytes, &cfg); err != nil { + return webpagesConfig{}, err + } + return cfg, err +} + +func orderCommands(weights map[string]int, commands []*cobra.Command) { + sort.SliceStable(commands, func(i, j int) bool { + return weights[commands[i].CommandPath()] < weights[commands[j].CommandPath()] + }) +} + +func printFlags(f *pflag.FlagSet, w io.Writer) error { + var err error + p := func(format string, a ...any) { + _, err = w.Write([]byte(fmt.Sprintf(format, a...))) + } + f.VisitAll(func(flag *pflag.Flag) { + if flag.Hidden { + return + } + if flag.Shorthand != "" && flag.ShorthandDeprecated == "" { + p("#### -%s, --%s", flag.Shorthand, flag.Name) + } else { + p("#### --%s", flag.Name) + } + varname, usage := pflag.UnquoteUsage(flag) + if varname != "" { + p(" *%s*", varname) + } + p(" {#%s}", flag.Name) + p("\n") + p(usage) + if flag.NoOptDefVal != "" { + switch flag.Value.Type() { + case "string": + p("[=\"%s\"]", flag.NoOptDefVal) + case "bool": + if flag.NoOptDefVal != "true" { + p("[=%s]", flag.NoOptDefVal) + } + case "count": + if flag.NoOptDefVal != "+1" { + p("[=%s]", flag.NoOptDefVal) + } + default: + p("[=%s]", flag.NoOptDefVal) + } + } + if len(flag.Deprecated) != 0 { + p(" (DEPRECATED: %s)", flag.Deprecated) + } + p("\n\n") + }) + return err +} + +// websiteSidebarPosition calculates the position of the given command in the website sidebar. +func websiteSidebarPosition(cmd *cobra.Command, weights map[string]int) int { + // Return 0 if the command has no parent + if !cmd.HasParent() { + return 0 + } + siblings := cmd.Parent().Commands() + orderCommands(weights, siblings) + position := 0 + for _, sibling := range siblings { + if isCommandVisible(sibling) { + position++ + if sibling.CommandPath() == cmd.CommandPath() { + return position + } + } + } + return -1 +} + +// isCommandVisible checks if a command is visible (available, not an additional help topic, and not hidden). +func isCommandVisible(cmd *cobra.Command) bool { + return cmd.IsAvailableCommand() && !cmd.IsAdditionalHelpTopicCommand() && !cmd.Hidden +} + +func websiteSlug(cmd *cobra.Command) string { + return strings.ReplaceAll(cmd.CommandPath(), " ", "/") +} + +func sidebarLabel(cmd *cobra.Command, maxSidebarLen int) string { + if len(strings.Split(cmd.CommandPath(), " ")) > maxSidebarLen { + return cmd.Name() + } + return cmd.CommandPath() +} diff --git a/pkg/bufman/pkg/app/appflag/appflag.go b/pkg/bufman/pkg/app/appflag/appflag.go new file mode 100644 index 000000000..5b92205a8 --- /dev/null +++ b/pkg/bufman/pkg/app/appflag/appflag.go @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package appflag contains functionality to work with flags. +package appflag + +import ( + "context" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/applog" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appname" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appverbose" + "github.com/spf13/pflag" +) + +// Container is a container. +type Container interface { + app.Container + appname.Container + applog.Container + appverbose.Container +} + +// Interceptor intercepts and adapts the request or response of run functions. +type Interceptor func(func(context.Context, Container) error) func(context.Context, Container) error + +// Builder builds run functions. +type Builder interface { + BindRoot(flagSet *pflag.FlagSet) + NewRunFunc(func(context.Context, Container) error, ...Interceptor) func(context.Context, app.Container) error +} + +// NewBuilder returns a new Builder. +func NewBuilder(appName string, options ...BuilderOption) Builder { + return newBuilder(appName, options...) +} + +// BuilderOption is an option for a new Builder +type BuilderOption func(*builder) + +// BuilderWithTimeout returns a new BuilderOption that adds a timeout flag and the default timeout. +func BuilderWithTimeout(defaultTimeout time.Duration) BuilderOption { + return func(builder *builder) { + builder.defaultTimeout = defaultTimeout + } +} + +// BuilderWithTracing enables zap tracing for the builder. +func BuilderWithTracing() BuilderOption { + return func(builder *builder) { + builder.tracing = true + } +} diff --git a/pkg/bufman/pkg/app/appflag/builder.go b/pkg/bufman/pkg/app/appflag/builder.go new file mode 100644 index 000000000..c6ddd825c --- /dev/null +++ b/pkg/bufman/pkg/app/appflag/builder.go @@ -0,0 +1,242 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appflag + +import ( + "context" + "fmt" + "os" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/applog" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appverbose" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/observabilityzap" + "github.com/pkg/profile" + "github.com/spf13/pflag" + "go.opentelemetry.io/otel" + "go.uber.org/multierr" + "go.uber.org/zap" +) + +type builder struct { + appName string + + verbose bool + debug bool + noWarn bool + logFormat string + + profile bool + profilePath string + profileLoops int + profileType string + profileAllowError bool + + timeout time.Duration + + defaultTimeout time.Duration + + tracing bool +} + +func newBuilder(appName string, options ...BuilderOption) *builder { + builder := &builder{ + appName: appName, + } + for _, option := range options { + option(builder) + } + return builder +} + +func (b *builder) BindRoot(flagSet *pflag.FlagSet) { + flagSet.BoolVarP(&b.verbose, "verbose", "v", false, "Turn on verbose mode") + flagSet.BoolVar(&b.debug, "debug", false, "Turn on debug logging") + flagSet.StringVar(&b.logFormat, "log-format", "color", "The log format [text,color,json]") + if b.defaultTimeout > 0 { + flagSet.DurationVar(&b.timeout, "timeout", b.defaultTimeout, `The duration until timing out, setting it to zero means no timeout`) + } + + flagSet.BoolVar(&b.profile, "profile", false, "Run profiling") + _ = flagSet.MarkHidden("profile") + flagSet.StringVar(&b.profilePath, "profile-path", "", "The profile base directory path") + _ = flagSet.MarkHidden("profile-path") + flagSet.IntVar(&b.profileLoops, "profile-loops", 1, "The number of loops to run") + _ = flagSet.MarkHidden("profile-loops") + flagSet.StringVar(&b.profileType, "profile-type", "cpu", "The profile type [cpu,mem,block,mutex]") + _ = flagSet.MarkHidden("profile-type") + flagSet.BoolVar(&b.profileAllowError, "profile-allow-error", false, "Allow errors for profiled commands") + _ = flagSet.MarkHidden("profile-allow-error") + + // We do not officially support this flag, this is for testing, where we need warnings turned off. + flagSet.BoolVar(&b.noWarn, "no-warn", false, "Turn off warn logging") + _ = flagSet.MarkHidden("no-warn") +} + +func (b *builder) NewRunFunc( + f func(context.Context, Container) error, + interceptors ...Interceptor, +) func(context.Context, app.Container) error { + interceptor := chainInterceptors(interceptors...) + return func(ctx context.Context, appContainer app.Container) error { + if interceptor != nil { + return b.run(ctx, appContainer, interceptor(f)) + } + return b.run(ctx, appContainer, f) + } +} + +func (b *builder) run( + ctx context.Context, + appContainer app.Container, + f func(context.Context, Container) error, +) (retErr error) { + logLevel, err := getLogLevel(b.debug, b.noWarn) + if err != nil { + return err + } + logger, err := applog.NewLogger(appContainer.Stderr(), logLevel, b.logFormat) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, logger.Sugar().Sync()) + }() + verbosePrinter := appverbose.NewVerbosePrinter(appContainer.Stderr(), b.appName, b.verbose) + container, err := newContainer(appContainer, b.appName, logger, verbosePrinter) + if err != nil { + return err + } + + var cancel context.CancelFunc + if !b.profile && b.timeout != 0 { + ctx, cancel = context.WithTimeout(ctx, b.timeout) + defer cancel() + } + + if b.tracing { + closer := observabilityzap.Start(logger) + defer func() { + retErr = multierr.Append(retErr, closer.Close()) + }() + _, span := otel.GetTracerProvider().Tracer("bufbuild/buf").Start(ctx, "command") + defer span.End() + } + if !b.profile { + return f(ctx, container) + } + return runProfile( + logger, + b.profilePath, + b.profileType, + b.profileLoops, + b.profileAllowError, + func() error { + return f(ctx, container) + }, + ) +} + +// runProfile profiles the function. +func runProfile( + logger *zap.Logger, + profilePath string, + profileType string, + profileLoops int, + profileAllowError bool, + f func() error, +) error { + var err error + if profilePath == "" { + profilePath, err = os.MkdirTemp("", "") + if err != nil { + return err + } + } + logger.Sugar().Debug("profile", zap.String("path", profilePath)) + if profileType == "" { + profileType = "cpu" + } + if profileLoops == 0 { + profileLoops = 10 + } + var profileFunc func(*profile.Profile) + switch profileType { + case "cpu": + profileFunc = profile.CPUProfile + case "mem": + profileFunc = profile.MemProfile + case "block": + profileFunc = profile.BlockProfile + case "mutex": + profileFunc = profile.MutexProfile + default: + return fmt.Errorf("unknown profile type: %q", profileType) + } + stop := profile.Start( + profile.Quiet, + profile.ProfilePath(profilePath), + profileFunc, + ) + for i := 0; i < profileLoops; i++ { + if err := f(); err != nil { + if !profileAllowError { + return err + } + } + } + stop.Stop() + return nil +} + +func getLogLevel(debugFlag bool, noWarnFlag bool) (string, error) { + if debugFlag && noWarnFlag { + return "", fmt.Errorf("cannot set both --debug and --no-warn") + } + if noWarnFlag { + return "error", nil + } + if debugFlag { + return "debug", nil + } + return "info", nil +} + +// chainInterceptors consolidates the given interceptors into one. +// The interceptors are applied in the order they are declared. +func chainInterceptors(interceptors ...Interceptor) Interceptor { + filtered := make([]Interceptor, 0, len(interceptors)) + for _, interceptor := range interceptors { + if interceptor != nil { + filtered = append(filtered, interceptor) + } + } + switch n := len(filtered); n { + case 0: + return nil + case 1: + return filtered[0] + default: + first := filtered[0] + return func(next func(context.Context, Container) error) func(context.Context, Container) error { + for i := len(filtered) - 1; i > 0; i-- { + next = filtered[i](next) + } + return first(next) + } + } +} diff --git a/pkg/bufman/pkg/app/appflag/container.go b/pkg/bufman/pkg/app/appflag/container.go new file mode 100644 index 000000000..49f54ad36 --- /dev/null +++ b/pkg/bufman/pkg/app/appflag/container.go @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appflag + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/applog" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appname" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appverbose" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/verbose" + "go.uber.org/zap" +) + +type container struct { + app.Container + nameContainer appname.Container + logContainer applog.Container + verboseContainer appverbose.Container +} + +func newContainer( + baseContainer app.Container, + appName string, + logger *zap.Logger, + verbosePrinter verbose.Printer, +) (*container, error) { + nameContainer, err := appname.NewContainer(baseContainer, appName) + if err != nil { + return nil, err + } + return &container{ + Container: baseContainer, + nameContainer: nameContainer, + logContainer: applog.NewContainer(logger), + verboseContainer: appverbose.NewContainer(verbosePrinter), + }, nil +} + +func (c *container) AppName() string { + return c.nameContainer.AppName() +} + +func (c *container) ConfigDirPath() string { + return c.nameContainer.ConfigDirPath() +} + +func (c *container) CacheDirPath() string { + return c.nameContainer.CacheDirPath() +} + +func (c *container) DataDirPath() string { + return c.nameContainer.DataDirPath() +} + +func (c *container) Port() (uint16, error) { + return c.nameContainer.Port() +} + +func (c *container) Logger() *zap.Logger { + return c.logContainer.Logger() +} + +func (c *container) VerbosePrinter() verbose.Printer { + return c.verboseContainer.VerbosePrinter() +} diff --git a/pkg/bufman/pkg/app/applog/applog.go b/pkg/bufman/pkg/app/applog/applog.go new file mode 100644 index 000000000..17c74f075 --- /dev/null +++ b/pkg/bufman/pkg/app/applog/applog.go @@ -0,0 +1,83 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package applog contains utilities to work with logging. +package applog + +import ( + "fmt" + "io" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/zaputil" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// Container is a container. +type Container interface { + Logger() *zap.Logger +} + +// NewContainer returns a new Container. +func NewContainer(logger *zap.Logger) Container { + return newContainer(logger) +} + +// NewLogger returns a new logger.Sugar(). +// +// The level can be [debug,info,warn,error]. The default is info. +// The format can be [text,color,json]. The default is color. +func NewLogger(writer io.Writer, levelString string, format string) (*zap.Logger, error) { + level, err := getZapLevel(levelString) + if err != nil { + return nil, err + } + encoder, err := getZapEncoder(format) + if err != nil { + return nil, err + } + return zaputil.NewLogger(writer, level, encoder), nil +} + +func getZapLevel(level string) (zapcore.Level, error) { + level = strings.TrimSpace(strings.ToLower(level)) + switch level { + case "debug": + return zapcore.DebugLevel, nil + case "info", "": + return zapcore.InfoLevel, nil + case "warn": + return zapcore.WarnLevel, nil + case "error": + return zapcore.ErrorLevel, nil + default: + return 0, fmt.Errorf("unknown log level [debug,info,warn,error]: %q", level) + } +} + +func getZapEncoder(format string) (zapcore.Encoder, error) { + format = strings.TrimSpace(strings.ToLower(format)) + switch format { + case "text": + return zaputil.NewTextEncoder(), nil + case "color", "": + return zaputil.NewColortextEncoder(), nil + case "json": + return zaputil.NewJSONEncoder(), nil + default: + return nil, fmt.Errorf("unknown log format [text,color,json]: %q", format) + } +} diff --git a/pkg/bufman/pkg/app/applog/applog_test.go b/pkg/bufman/pkg/app/applog/applog_test.go new file mode 100644 index 000000000..fe38e396c --- /dev/null +++ b/pkg/bufman/pkg/app/applog/applog_test.go @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package applog + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "go.uber.org/zap/zapcore" +) + +func TestGetZapLevel(t *testing.T) { + t.Parallel() + testCases := []struct { + levelString string + expected zapcore.Level + expectError bool + }{ + {"debug", zapcore.DebugLevel, false}, + {"info", zapcore.InfoLevel, false}, + {"warn", zapcore.WarnLevel, false}, + {"error", zapcore.ErrorLevel, false}, + {"", zapcore.InfoLevel, false}, + {"foobar", zapcore.InfoLevel, true}, + } + + for _, tc := range testCases { + actual, err := getZapLevel(tc.levelString) + if tc.expectError && err == nil { + t.Errorf("Expected error for level %q but got none", tc.levelString) + } else if !tc.expectError && err != nil { + t.Errorf("Unexpected error for level %q: %s", tc.levelString, err) + } + if actual != tc.expected { + t.Errorf("For level %q expected %v but got %v", tc.levelString, tc.expected, actual) + } + } +} + +func TestGetZapEncoder(t *testing.T) { + t.Parallel() + // Test valid formats + testCases := []struct { + format string + }{ + {"text"}, + {"color"}, + {"json"}, + {"TEXT"}, + {"COLOR"}, + {"JSON"}, + } + for _, tc := range testCases { + tc := tc + t.Run(fmt.Sprintf("valid format %s", tc.format), func(t *testing.T) { + t.Parallel() + encoder, err := getZapEncoder(tc.format) + assert.NoError(t, err) + assert.NotNil(t, encoder) + }) + } + + // Test unknown format + unknownFormat := "invalid" + _, err := getZapEncoder(unknownFormat) + assert.EqualError(t, err, fmt.Sprintf("unknown log format [text,color,json]: %q", unknownFormat)) +} diff --git a/pkg/bufman/pkg/app/applog/container.go b/pkg/bufman/pkg/app/applog/container.go new file mode 100644 index 000000000..cf273af23 --- /dev/null +++ b/pkg/bufman/pkg/app/applog/container.go @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package applog + +import ( + "go.uber.org/zap" +) + +type container struct { + logger *zap.Logger +} + +func newContainer(logger *zap.Logger) *container { + return &container{ + logger: logger, + } +} + +func (c *container) Logger() *zap.Logger { + return c.logger +} diff --git a/pkg/bufman/pkg/app/appname/appname.go b/pkg/bufman/pkg/app/appname/appname.go new file mode 100644 index 000000000..90aaa3711 --- /dev/null +++ b/pkg/bufman/pkg/app/appname/appname.go @@ -0,0 +1,142 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package appname provides containers for named applications. +// +// Application name foo-bar translate to environment variable prefix FOO_BAR_. +package appname + +import ( + "context" + "errors" + "fmt" + "net" + "os" + "path/filepath" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" +) + +const ( + configFileName = "config.yaml" + secretRelDirPath = "secrets" +) + +// Container is a container. +type Container interface { + // AppName is the application name. + // + // The name must be in [a-zA-Z0-9-_]. + AppName() string + // ConfigDirPath is the config directory path for the named application. + // + // First checks for $APP_NAME_CONFIG_DIR. + // If this is not set, uses app.ConfigDirPath()/app-name. + // Unnormalized. + ConfigDirPath() string + // CacheDirPath is the cache directory path for the named application. + // + // First checks for $APP_NAME_CACHE_DIR. + // If this is not set, uses app.CacheDirPath()/app-name. + // Unnormalized. + CacheDirPath() string + // DataDirPath is the data directory path for the named application. + // + // First checks for $APP_NAME_DATA_DIR. + // If this is not set, uses app.DataDirPath()/app-name. + // Unnormalized. + DataDirPath() string + // Port is the port to use for serving. + // + // First checks for $APP_NAME_PORT. + // If this is not set, checks for $PORT. + // If this is not set, returns 0, which means no port is known. + // Returns error on parse. + Port() (uint16, error) +} + +// NewContainer returns a new Container. +// +// The name must be in [a-zA-Z0-9-_]. +func NewContainer(envContainer app.EnvContainer, name string) (Container, error) { + return newContainer(envContainer, name) +} + +// ReadConfig reads the configuration from the YAML configuration file config.yaml +// in the configuration directory. +// +// If the file does not exist, this is a no-op. +// The value should be a pointer to unmarshal into. +func ReadConfig(container Container, value interface{}) error { + configFilePath := filepath.Join(container.ConfigDirPath(), configFileName) + data, err := os.ReadFile(configFilePath) + if !errors.Is(err, os.ErrNotExist) { + if err != nil { + return fmt.Errorf("could not read %s configuration file at %s: %w", container.AppName(), configFilePath, err) + } + if err := encoding.UnmarshalYAMLStrict(data, value); err != nil { + return fmt.Errorf("invalid %s configuration file: %w", container.AppName(), err) + } + } + return nil +} + +// ReadSecret returns the contents of the file at path +// filepath.Join(container.ConfigDirPath(), secretRelDirPath, name). +func ReadSecret(container Container, name string) (string, error) { + secretFilePath := filepath.Join(container.ConfigDirPath(), secretRelDirPath, name) + data, err := os.ReadFile(secretFilePath) + if err != nil { + return "", fmt.Errorf("failed to read secret at %s: %w", secretFilePath, err) + } + return string(data), nil +} + +// WriteConfig writes the configuration to the YAML configuration file config.yaml +// in the configuration directory. +// +// The directory is created if it does not exist. +// The value should be a pointer to marshal. +func WriteConfig(container Container, value interface{}) error { + data, err := encoding.MarshalYAML(value) + if err != nil { + return err + } + if err := os.MkdirAll(container.ConfigDirPath(), 0o755); err != nil { + return err + } + configFilePath := filepath.Join(container.ConfigDirPath(), configFileName) + fileMode := os.FileMode(0o644) + // OK to use os.Stat instead of os.Lstat here + if fileInfo, err := os.Stat(configFilePath); err == nil { + fileMode = fileInfo.Mode() + } + return os.WriteFile(configFilePath, data, fileMode) +} + +// Listen listens on the container's port, falling back to defaultPort. +func Listen(ctx context.Context, container Container, defaultPort uint16) (net.Listener, error) { + port, err := container.Port() + if err != nil { + return nil, err + } + if port == 0 { + port = defaultPort + } + // Must be 0.0.0.0 + var listenConfig net.ListenConfig + return listenConfig.Listen(ctx, "tcp", fmt.Sprintf("0.0.0.0:%d", port)) +} diff --git a/pkg/bufman/pkg/app/appname/appname_unix_test.go b/pkg/bufman/pkg/app/appname/appname_unix_test.go new file mode 100644 index 000000000..02aaafb61 --- /dev/null +++ b/pkg/bufman/pkg/app/appname/appname_unix_test.go @@ -0,0 +1,145 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matching the unix-like build tags in the Golang source i.e. https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/file_unix.go#L6 + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package appname + +import ( + "os" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/stretchr/testify/require" +) + +func TestRoundTrip1(t *testing.T) { + t.Parallel() + tempDir := t.TempDir() + testRoundTrip( + t, + "foo-bar", + map[string]string{ + "FOO_BAR_CONFIG_DIR": tempDir, + }, + tempDir, + ) +} + +func TestRoundTrip2(t *testing.T) { + t.Parallel() + tempDir := t.TempDir() + testRoundTrip( + t, + "foo-bar", + map[string]string{ + "XDG_CONFIG_HOME": tempDir, + }, + filepath.Join(tempDir, "foo-bar"), + ) +} + +func TestRoundTrip3(t *testing.T) { + t.Parallel() + tempDir := t.TempDir() + testRoundTrip( + t, + "foo-bar", + map[string]string{ + "HOME": tempDir, + }, + filepath.Join(tempDir, ".config", "foo-bar"), + ) +} + +func TestPort1(t *testing.T) { + t.Parallel() + testPort( + t, + "foo-bar", + map[string]string{ + "FOO_BAR_PORT": "4000", + }, + 4000, + ) +} + +func TestPort2(t *testing.T) { + t.Parallel() + testPort( + t, + "foo-bar", + map[string]string{ + "FOO_BAR_PORT": "4000", + "PORT": "2000", + }, + 4000, + ) +} + +func TestPort3(t *testing.T) { + t.Parallel() + testPort( + t, + "foo-bar", + map[string]string{ + "PORT": "4000", + }, + 4000, + ) +} + +func TestPort4(t *testing.T) { + t.Parallel() + testPort( + t, + "foo-bar", + map[string]string{}, + 0, + ) +} + +func testPort(t *testing.T, appName string, env map[string]string, expected uint16) { + container, err := NewContainer(app.NewEnvContainer(env), appName) + require.NoError(t, err) + port, err := container.Port() + require.NoError(t, err) + require.Equal(t, expected, port) +} + +func testRoundTrip(t *testing.T, appName string, env map[string]string, dirPath string) { + _, err := os.Lstat(filepath.Join(dirPath, configFileName)) + require.Error(t, err) + container, err := NewContainer(app.NewEnvContainer(env), appName) + require.NoError(t, err) + inputTestConfig := &testConfig{Bar: "one", Baz: "two"} + err = WriteConfig(container, inputTestConfig) + require.NoError(t, err) + _, err = os.Lstat(filepath.Join(dirPath, configFileName)) + require.NoError(t, err) + outputTestConfig := &testConfig{} + err = ReadConfig(container, outputTestConfig) + require.NoError(t, err) + require.Equal(t, inputTestConfig, outputTestConfig) +} + +type testConfig struct { + Bar string + Baz string +} diff --git a/pkg/bufman/pkg/app/appname/container.go b/pkg/bufman/pkg/app/appname/container.go new file mode 100644 index 000000000..037ef2875 --- /dev/null +++ b/pkg/bufman/pkg/app/appname/container.go @@ -0,0 +1,134 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appname + +import ( + "errors" + "fmt" + "path/filepath" + "strconv" + "strings" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" +) + +type container struct { + envContainer app.EnvContainer + appName string + + configDirPath string + configDirPathOnce sync.Once + cacheDirPath string + cacheDirPathOnce sync.Once + dataDirPath string + dataDirPathOnce sync.Once + port uint16 + portErr error + portOnce sync.Once +} + +func newContainer(envContainer app.EnvContainer, appName string) (*container, error) { + if err := validateAppName(appName); err != nil { + return nil, err + } + return &container{ + envContainer: envContainer, + appName: appName, + }, nil +} + +func (c *container) AppName() string { + return c.appName +} + +func (c *container) ConfigDirPath() string { + c.configDirPathOnce.Do(c.setConfigDirPath) + return c.configDirPath +} + +func (c *container) CacheDirPath() string { + c.cacheDirPathOnce.Do(c.setCacheDirPath) + return c.cacheDirPath +} + +func (c *container) DataDirPath() string { + c.dataDirPathOnce.Do(c.setDataDirPath) + return c.dataDirPath +} + +func (c *container) Port() (uint16, error) { + c.portOnce.Do(c.setPort) + return c.port, c.portErr +} + +func (c *container) setConfigDirPath() { + c.configDirPath = c.getDirPath("CONFIG_DIR", app.ConfigDirPath) +} + +func (c *container) setCacheDirPath() { + c.cacheDirPath = c.getDirPath("CACHE_DIR", app.CacheDirPath) +} + +func (c *container) setDataDirPath() { + c.dataDirPath = c.getDirPath("DATA_DIR", app.DataDirPath) +} + +func (c *container) setPort() { + c.port, c.portErr = c.getPort() +} + +func (c *container) getDirPath(envSuffix string, getBaseDirPath func(app.EnvContainer) (string, error)) string { + dirPath := c.envContainer.Env(getEnvPrefix(c.appName) + envSuffix) + if dirPath == "" { + baseDirPath, err := getBaseDirPath(c.envContainer) + if err == nil { + dirPath = filepath.Join(baseDirPath, c.appName) + } + } + return dirPath +} + +func (c *container) getPort() (uint16, error) { + portString := c.envContainer.Env(getEnvPrefix(c.appName) + "PORT") + if portString == "" { + portString = c.envContainer.Env("PORT") + if portString == "" { + return 0, nil + } + } + port, err := strconv.ParseUint(portString, 10, 16) + if err != nil { + return 0, fmt.Errorf("could not parse port %q to uint16: %v", portString, err) + } + return uint16(port), nil +} + +func getEnvPrefix(appName string) string { + return strings.ToUpper(strings.ReplaceAll(appName, "-", "_")) + "_" +} + +func validateAppName(appName string) error { + if appName == "" { + return errors.New("empty application name") + } + for _, c := range appName { + if !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '_') { + return fmt.Errorf("invalid application name: %s", appName) + } + } + return nil +} diff --git a/pkg/bufman/pkg/app/appproto/appproto.go b/pkg/bufman/pkg/app/appproto/appproto.go new file mode 100644 index 000000000..131b96b7e --- /dev/null +++ b/pkg/bufman/pkg/app/appproto/appproto.go @@ -0,0 +1,299 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package appproto contains helper functionality for protoc plugins. +// +// Note this is currently implicitly tested through buf's protoc command. +// If this were split out into a separate package, testing would need to be +// moved to this package. +package appproto + +import ( + "bufio" + "bytes" + "context" + "fmt" + "io" + "path/filepath" + "unicode" + "unicode/utf8" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "go.uber.org/zap" + "google.golang.org/protobuf/types/pluginpb" +) + +const ( + // Our generated files in `private/gen/proto` are on average 15KB which isn't + // an unreasonable amount of memory to reserve each time we process an insertion + // point and will save a significant number of allocations. + averageGeneratedFileSize = 15 * 1024 + // We don't use insertion points internally, but assume they are smaller than + // entire generated files. + averageInsertionPointSize = 1024 +) + +// ResponseBuilder builds CodeGeneratorResponses. +type ResponseBuilder interface { + // AddFile adds the file to the response. + // + // Returns error if nil or the name is empty. + // Warns to stderr if the name is already added or the name is not normalized. + AddFile(*pluginpb.CodeGeneratorResponse_File) error + // AddError adds the error message to the response. + // + // If there is an existing error message, this will be concatenated with a newline. + // If message is empty, a message "error" will be added. + AddError(message string) + // SetFeatureProto3Optional sets the proto3 optional feature. + SetFeatureProto3Optional() + // toResponse returns the resulting CodeGeneratorResponse. This must + // only be called after all writing has been completed. + toResponse() *pluginpb.CodeGeneratorResponse +} + +// Handler is a protoc plugin handler. +type Handler interface { + // Handle handles the plugin. + // + // This function can assume the request is valid. + // This should only return error on system error. + // Plugin generation errors should be added with AddError. + // See https://github.com/protocolbuffers/protobuf/blob/95e6c5b4746dd7474d540ce4fb375e3f79a086f8/src/google/protobuf/compiler/plugin.proto#L100 + Handle( + ctx context.Context, + container app.EnvStderrContainer, + responseWriter ResponseBuilder, + request *pluginpb.CodeGeneratorRequest, + ) error +} + +// HandlerFunc is a handler function. +type HandlerFunc func( + context.Context, + app.EnvStderrContainer, + ResponseBuilder, + *pluginpb.CodeGeneratorRequest, +) error + +// Handle implements Handler. +func (h HandlerFunc) Handle( + ctx context.Context, + container app.EnvStderrContainer, + responseWriter ResponseBuilder, + request *pluginpb.CodeGeneratorRequest, +) error { + return h(ctx, container, responseWriter, request) +} + +// Main runs the plugin using app.Main and the Handler. +func Main(ctx context.Context, handler Handler) { + app.Main(ctx, newRunFunc(handler)) +} + +// Run runs the plugin using app.Main and the Handler. +// +// The exit code can be determined using app.GetExitCode. +func Run(ctx context.Context, container app.Container, handler Handler) error { + return app.Run(ctx, container, newRunFunc(handler)) +} + +// Generator executes the Handler using protoc's plugin execution logic. +// +// If multiple requests are specified, these are executed in parallel and the +// result is combined into one response that is written. +type Generator interface { + // Generate generates a CodeGeneratorResponse for the given CodeGeneratorRequests. + // + // A new ResponseBuilder is constructed for every invocation of Generate and is + // used to consolidate all of the CodeGeneratorResponse_Files returned from a single + // plugin into a single CodeGeneratorResponse. + Generate( + ctx context.Context, + container app.EnvStderrContainer, + requests []*pluginpb.CodeGeneratorRequest, + ) (*pluginpb.CodeGeneratorResponse, error) +} + +// NewGenerator returns a new Generator. +func NewGenerator( + logger *zap.Logger, + handler Handler, +) Generator { + return newGenerator(logger, handler) +} + +// ResponseWriter handles the response and writes it to the given storage.WriteBucket +// without executing any plugins and handles insertion points as needed. +type ResponseWriter interface { + // WriteResponse writes to the bucket with the given response. In practice, the + // WriteBucket is most often an in-memory bucket. + // + // CodeGeneratorResponses are consolidated into the bucket, and insertion points + // are applied in-place so that they can only access the files created in a single + // generation invocation (just like protoc). + WriteResponse( + ctx context.Context, + writeBucket storage.WriteBucket, + response *pluginpb.CodeGeneratorResponse, + options ...WriteResponseOption, + ) error +} + +// NewResponseWriter returns a new ResponseWriter. +func NewResponseWriter(logger *zap.Logger) ResponseWriter { + return newResponseWriter(logger) +} + +// WriteResponseOption is an option for WriteResponse. +type WriteResponseOption func(*writeResponseOptions) + +// WriteResponseWithInsertionPointReadBucket returns a new WriteResponseOption that uses the given +// ReadBucket to read from for insertion points. +// +// If this is not specified, insertion points are not supported. +func WriteResponseWithInsertionPointReadBucket( + insertionPointReadBucket storage.ReadBucket, +) WriteResponseOption { + return func(writeResponseOptions *writeResponseOptions) { + writeResponseOptions.insertionPointReadBucket = insertionPointReadBucket + } +} + +// PluginResponse encapsulates a CodeGeneratorResponse, +// along with the name of the plugin that created it. +type PluginResponse struct { + Response *pluginpb.CodeGeneratorResponse + PluginName string + PluginOut string +} + +// NewPluginResponse retruns a new *PluginResponse. +func NewPluginResponse( + response *pluginpb.CodeGeneratorResponse, + pluginName string, + pluginOut string, +) *PluginResponse { + return &PluginResponse{ + Response: response, + PluginName: pluginName, + PluginOut: pluginOut, + } +} + +// ValidatePluginResponses validates that each file is only defined by a single *PluginResponse. +func ValidatePluginResponses(pluginResponses []*PluginResponse) error { + seen := make(map[string]string) + for _, pluginResponse := range pluginResponses { + for _, file := range pluginResponse.Response.File { + if file.GetInsertionPoint() != "" { + // We expect insertion points to write + // to files that already exist. + continue + } + fileName := filepath.Join(pluginResponse.PluginOut, file.GetName()) + if pluginName, ok := seen[fileName]; ok { + return fmt.Errorf( + "file %q was generated multiple times: once by plugin %q and again by plugin %q", + fileName, + pluginName, + pluginResponse.PluginName, + ) + } + seen[fileName] = pluginResponse.PluginName + } + } + return nil +} + +// newRunFunc returns a new RunFunc for app.Main and app.Run. +func newRunFunc(handler Handler) func(context.Context, app.Container) error { + return func(ctx context.Context, container app.Container) error { + input, err := io.ReadAll(container.Stdin()) + if err != nil { + return err + } + request := &pluginpb.CodeGeneratorRequest{} + // We do not know the FileDescriptorSet before unmarshaling this + if err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(input, request); err != nil { + return err + } + if err := protodescriptor.ValidateCodeGeneratorRequest(request); err != nil { + return err + } + responseWriter := newResponseBuilder(container) + if err := handler.Handle(ctx, container, responseWriter, request); err != nil { + return err + } + response := responseWriter.toResponse() + if err := protodescriptor.ValidateCodeGeneratorResponse(response); err != nil { + return err + } + data, err := protoencoding.NewWireMarshaler().Marshal(response) + if err != nil { + return err + } + _, err = container.Stdout().Write(data) + return err + } +} + +// NewResponseBuilder returns a new ResponseBuilder. +func NewResponseBuilder(container app.StderrContainer) ResponseBuilder { + return newResponseBuilder(container) +} + +// leadingWhitespace iterates through the given string, +// and returns the leading whitespace substring, if any, +// respecting utf-8 encoding. +// +// leadingWhitespace("\u205F foo ") -> "\u205F " +func leadingWhitespace(buf []byte) []byte { + leadingSize := 0 + iterBuf := buf + for len(iterBuf) > 0 { + r, size := utf8.DecodeRune(iterBuf) + // protobuf strings must always be valid UTF8 + // https://developers.google.com/protocol-buffers/docs/proto3#scalar + // Additionally, utf8.RuneError is not a space so we'll terminate + // and return the leading, valid, UTF8 whitespace sequence. + if !unicode.IsSpace(r) { + out := make([]byte, leadingSize) + copy(out, buf) + return out + } + leadingSize += size + iterBuf = iterBuf[size:] + } + return buf +} + +// scanWithPrefixAndLineEnding iterates over each of the given scanner's lines +// prepends prefix, and appends the newline sequence. +func scanWithPrefixAndLineEnding(scanner *bufio.Scanner, prefix []byte, newline []byte) []byte { + result := bytes.NewBuffer(nil) + result.Grow(averageInsertionPointSize) + for scanner.Scan() { + // These writes cannot fail, they will panic if they cannot + // allocate + _, _ = result.Write(prefix) + _, _ = result.Write(scanner.Bytes()) + _, _ = result.Write(newline) + } + return result.Bytes() +} diff --git a/pkg/bufman/pkg/app/appproto/appproto_test.go b/pkg/bufman/pkg/app/appproto/appproto_test.go new file mode 100644 index 000000000..a24af4348 --- /dev/null +++ b/pkg/bufman/pkg/app/appproto/appproto_test.go @@ -0,0 +1,213 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appproto + +import ( + "context" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/pluginpb" +) + +func TestWriteInsertionPoint(t *testing.T) { + t.Parallel() + // \u205F is "Medium Mathematical Space" + whitespacePrefix := "\u205F\t\t\t" + targetFileContent := `This is a test file +// @@protoc_insertion_point(ip1) + +that has more than one insertion point + // @@protoc_insertion_point(ip2) + +at varied indentation levels +` + whitespacePrefix + "// @@protoc_insertion_point(ip3)\n" + targetFileName := "test.proto" + insertionPointContent := "!!! this content was inserted; こんにちは" + + t.Run("basic", func(t *testing.T) { + t.Parallel() + insertionPointName := "ip1" + insertionPointConsumer := &pluginpb.CodeGeneratorResponse_File{ + Name: &targetFileName, + InsertionPoint: &insertionPointName, + Content: &insertionPointContent, + } + + postInsertionContent, err := writeInsertionPoint( + context.Background(), + insertionPointConsumer, + strings.NewReader(targetFileContent), + ) + require.NoError(t, err) + expectContent := []byte(`This is a test file +!!! this content was inserted; こんにちは +// @@protoc_insertion_point(ip1) + +that has more than one insertion point + // @@protoc_insertion_point(ip2) + +at varied indentation levels +` + whitespacePrefix + "// @@protoc_insertion_point(ip3)") + + assert.Equal(t, expectContent, postInsertionContent) + }) + t.Run("basic_indent", func(t *testing.T) { + t.Parallel() + insertionPointName := "ip2" + insertionPointConsumer := &pluginpb.CodeGeneratorResponse_File{ + Name: &targetFileName, + InsertionPoint: &insertionPointName, + Content: &insertionPointContent, + } + + postInsertionContent, err := writeInsertionPoint( + context.Background(), + insertionPointConsumer, + strings.NewReader(targetFileContent), + ) + require.NoError(t, err) + expectContent := []byte(`This is a test file +// @@protoc_insertion_point(ip1) + +that has more than one insertion point + !!! this content was inserted; こんにちは + // @@protoc_insertion_point(ip2) + +at varied indentation levels +` + whitespacePrefix + "// @@protoc_insertion_point(ip3)") + + assert.Equal(t, expectContent, postInsertionContent) + }) + t.Run("basic_unicode_indent", func(t *testing.T) { + t.Parallel() + insertionPointName := "ip3" + insertionPointConsumer := &pluginpb.CodeGeneratorResponse_File{ + Name: &targetFileName, + InsertionPoint: &insertionPointName, + Content: &insertionPointContent, + } + + postInsertionContent, err := writeInsertionPoint( + context.Background(), + insertionPointConsumer, + strings.NewReader(targetFileContent), + ) + require.NoError(t, err) + expectContent := []byte(`This is a test file +// @@protoc_insertion_point(ip1) + +that has more than one insertion point + // @@protoc_insertion_point(ip2) + +at varied indentation levels +` + + whitespacePrefix + + "!!! this content was inserted; こんにちは" + "\n" + + whitespacePrefix + + "// @@protoc_insertion_point(ip3)") + + assert.Equal(t, expectContent, postInsertionContent) + }) +} + +func BenchmarkWriteInsertionPoint(b *testing.B) { + // \u205F is "Medium Mathematical Space" + whitespacePrefix := "\u205F\t\t\t" + targetFileContent := `This is a test file +// @@protoc_insertion_point(ip1) + +that has more than one insertion point + // @@protoc_insertion_point(ip2) + +at varied indentation levels` + whitespacePrefix + "// @@protoc_insertion_point(ip3)\n" + targetFileName := "test.proto" + insertionPointContent := "!!! this content was inserted; こんにちは" + // Our generated files in private/gen/proto are on average 1100 lines. + inflatedLines := 1100 + + inflatedTargetFileContent := targetFileContent + for i := 0; i < inflatedLines-1; i++ { + inflatedTargetFileContent += "// this is just extra garbage\n" + } + // no trailing newline + inflatedTargetFileContent += "// this is just extra garbage" + + b.Run("basic", func(b *testing.B) { + var postInsertionContent []byte + insertionPointName := "ip1" + insertionPointConsumer := &pluginpb.CodeGeneratorResponse_File{ + Name: &targetFileName, + InsertionPoint: &insertionPointName, + Content: &insertionPointContent, + } + expectContent := []byte(`This is a test file +!!! this content was inserted; こんにちは +// @@protoc_insertion_point(ip1) + +that has more than one insertion point + // @@protoc_insertion_point(ip2) + +at varied indentation levels` + whitespacePrefix + "// @@protoc_insertion_point(ip3)") + + for i := 0; i < b.N; i++ { + b.ReportAllocs() + + postInsertionContent, _ = writeInsertionPoint( + context.Background(), + insertionPointConsumer, + strings.NewReader(targetFileContent), + ) + } + assert.Equal(b, expectContent, postInsertionContent) + }) + + b.Run("inflated", func(b *testing.B) { + insertionPointName := "ip1" + insertionPointConsumer := &pluginpb.CodeGeneratorResponse_File{ + Name: &targetFileName, + InsertionPoint: &insertionPointName, + Content: &insertionPointContent, + } + inflatedExpectContent := []byte(`This is a test file +!!! this content was inserted; こんにちは +// @@protoc_insertion_point(ip1) + +that has more than one insertion point + // @@protoc_insertion_point(ip2) + +at varied indentation levels` + whitespacePrefix + "// @@protoc_insertion_point(ip3)\n") + for i := 0; i < inflatedLines-1; i++ { + inflatedExpectContent = append(inflatedExpectContent, []byte("// this is just extra garbage\n")...) + } + // no trailing newline + inflatedExpectContent = append(inflatedExpectContent, []byte("// this is just extra garbage")...) + + var postInsertionContent []byte + for i := 0; i < b.N; i++ { + b.ReportAllocs() + + postInsertionContent, _ = writeInsertionPoint( + context.Background(), + insertionPointConsumer, + strings.NewReader(inflatedTargetFileContent), + ) + } + assert.Equal(b, inflatedExpectContent, postInsertionContent) + }) +} diff --git a/pkg/bufman/pkg/app/appproto/appprotoos/appprotoos.go b/pkg/bufman/pkg/app/appproto/appprotoos/appprotoos.go new file mode 100644 index 000000000..b6b98977a --- /dev/null +++ b/pkg/bufman/pkg/app/appproto/appprotoos/appprotoos.go @@ -0,0 +1,69 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package appprotoos does OS-specific generation. +package appprotoos + +import ( + "context" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/zap" + "google.golang.org/protobuf/types/pluginpb" +) + +// ResponseWriter writes CodeGeneratorResponses to the OS filesystem. +type ResponseWriter interface { + // Close writes all of the responses to disk. No further calls can be + // made to the ResponseWriter after this call. + io.Closer + + // AddResponse adds the response to the writer, switching on the file extension. + // If there is a .jar extension, this generates a jar. If there is a .zip + // extension, this generates a zip. If there is no extension, this outputs + // to the directory. + // + // pluginOut will be unnormalized within this function. + AddResponse( + ctx context.Context, + response *pluginpb.CodeGeneratorResponse, + pluginOut string, + ) error +} + +// NewResponseWriter returns a new ResponseWriter. +func NewResponseWriter( + logger *zap.Logger, + storageosProvider storageos.Provider, + options ...ResponseWriterOption, +) ResponseWriter { + return newResponseWriter( + logger, + storageosProvider, + options..., + ) +} + +// ResponseWriterOption is an option for the ResponseWriter. +type ResponseWriterOption func(*responseWriterOptions) + +// ResponseWriterWithCreateOutDirIfNotExists returns a new ResponseWriterOption that creates +// the directory if it does not exist. +func ResponseWriterWithCreateOutDirIfNotExists() ResponseWriterOption { + return func(responseWriterOptions *responseWriterOptions) { + responseWriterOptions.createOutDirIfNotExists = true + } +} diff --git a/pkg/bufman/pkg/app/appproto/appprotoos/response_writer.go b/pkg/bufman/pkg/app/appproto/appprotoos/response_writer.go new file mode 100644 index 000000000..1a7a665e6 --- /dev/null +++ b/pkg/bufman/pkg/app/appproto/appprotoos/response_writer.go @@ -0,0 +1,302 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appprotoos + +import ( + "context" + "fmt" + "os" + "path/filepath" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appproto" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagearchive" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/multierr" + "go.uber.org/zap" + "google.golang.org/protobuf/types/pluginpb" +) + +// Constants used to create .jar files. +var ( + manifestPath = normalpath.Join("META-INF", "MANIFEST.MF") + manifestContent = []byte(`Manifest-Version: 1.0 +Created-By: 1.6.0 (protoc) + +`) +) + +type responseWriter struct { + logger *zap.Logger + storageosProvider storageos.Provider + responseWriter appproto.ResponseWriter + // If set, create directories if they don't already exist. + createOutDirIfNotExists bool + // Cache the readWriteBuckets by their respective output paths. + // These builders are transformed to storage.ReadBuckets and written + // to disk once the responseWriter is flushed. + // + // Note that output paths are used as-is with respect to the + // caller's configuration. It's possible that a single invocation + // will specify the same filepath in multiple ways, e.g. "." and + // "$(pwd)". However, we intentionally treat these as distinct paths + // to mirror protoc's insertion point behavior. + // + // For example, the following command will fail because protoc treats + // "." and "$(pwd)" as distinct paths: + // + // $ protoc example.proto --insertion-point-receiver_out=. --insertion-point-writer_out=$(pwd) + // + readWriteBuckets map[string]storage.ReadWriteBucket + // Cache the functions used to flush all of the responses to disk. + // This holds all of the buckets in-memory so that we only write + // the results to disk if all of the responses are successful. + closers []func() error + lock sync.RWMutex +} + +func newResponseWriter( + logger *zap.Logger, + storageosProvider storageos.Provider, + options ...ResponseWriterOption, +) *responseWriter { + responseWriterOptions := newResponseWriterOptions() + for _, option := range options { + option(responseWriterOptions) + } + return &responseWriter{ + logger: logger, + storageosProvider: storageosProvider, + responseWriter: appproto.NewResponseWriter(logger), + createOutDirIfNotExists: responseWriterOptions.createOutDirIfNotExists, + readWriteBuckets: make(map[string]storage.ReadWriteBucket), + } +} + +func (w *responseWriter) AddResponse( + ctx context.Context, + response *pluginpb.CodeGeneratorResponse, + pluginOut string, +) error { + // It's important that we get a consistent output path + // so that we use the same in-memory bucket for paths + // set to the same directory. + // + // filepath.Abs calls filepath.Clean. + // + // For example: + // + // --insertion-point-receiver_out=insertion --insertion-point-writer_out=./insertion/ --insertion-point_writer_out=/foo/insertion + absPluginOut, err := filepath.Abs(normalpath.Unnormalize(pluginOut)) + if err != nil { + return err + } + w.lock.Lock() + defer w.lock.Unlock() + return w.addResponse( + ctx, + response, + absPluginOut, + w.createOutDirIfNotExists, + ) +} + +func (w *responseWriter) Close() error { + w.lock.Lock() + defer w.lock.Unlock() + for _, closeFunc := range w.closers { + if err := closeFunc(); err != nil { + // Although unlikely, if an error happens here, + // some generated files could be written to disk, + // whereas others aren't. + // + // Regardless, we stop at the first error so that + // we don't unncessarily write more results. + return err + } + } + // Re-initialize the cached values to be safe. + w.readWriteBuckets = make(map[string]storage.ReadWriteBucket) + w.closers = nil + return nil +} + +func (w *responseWriter) addResponse( + ctx context.Context, + response *pluginpb.CodeGeneratorResponse, + pluginOut string, + createOutDirIfNotExists bool, +) error { + switch filepath.Ext(pluginOut) { + case ".jar": + return w.writeZip( + ctx, + response, + pluginOut, + true, + createOutDirIfNotExists, + ) + case ".zip": + return w.writeZip( + ctx, + response, + pluginOut, + false, + createOutDirIfNotExists, + ) + default: + return w.writeDirectory( + ctx, + response, + pluginOut, + createOutDirIfNotExists, + ) + } +} + +func (w *responseWriter) writeZip( + ctx context.Context, + response *pluginpb.CodeGeneratorResponse, + outFilePath string, + includeManifest bool, + createOutDirIfNotExists bool, +) (retErr error) { + outDirPath := filepath.Dir(outFilePath) + if readWriteBucket, ok := w.readWriteBuckets[outFilePath]; ok { + // We already have a readWriteBucket for this outFilePath, so + // we can write to the same bucket. + if err := w.responseWriter.WriteResponse( + ctx, + readWriteBucket, + response, + appproto.WriteResponseWithInsertionPointReadBucket(readWriteBucket), + ); err != nil { + return err + } + return nil + } + // OK to use os.Stat instead of os.Lstat here. + fileInfo, err := os.Stat(outDirPath) + if err != nil { + if os.IsNotExist(err) { + if createOutDirIfNotExists { + if err := os.MkdirAll(outDirPath, 0o755); err != nil { + return err + } + } else { + return err + } + } + return err + } else if !fileInfo.IsDir() { + return fmt.Errorf("not a directory: %s", outDirPath) + } + readWriteBucket := storagemem.NewReadWriteBucket() + if includeManifest { + if err := storage.PutPath(ctx, readWriteBucket, manifestPath, manifestContent); err != nil { + return err + } + } + if err := w.responseWriter.WriteResponse( + ctx, + readWriteBucket, + response, + appproto.WriteResponseWithInsertionPointReadBucket(readWriteBucket), + ); err != nil { + return err + } + // Add this readWriteBucket to the set so that other plugins + // can write to the same files (re: insertion points). + w.readWriteBuckets[outFilePath] = readWriteBucket + w.closers = append(w.closers, func() (retErr error) { + // We're done writing all of the content into this + // readWriteBucket, so we zip it when we flush. + file, err := os.Create(outFilePath) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, file.Close()) + }() + // protoc does not compress. + return storagearchive.Zip(ctx, readWriteBucket, file, false) + }) + return nil +} + +func (w *responseWriter) writeDirectory( + ctx context.Context, + response *pluginpb.CodeGeneratorResponse, + outDirPath string, + createOutDirIfNotExists bool, +) error { + if readWriteBucket, ok := w.readWriteBuckets[outDirPath]; ok { + // We already have a readWriteBucket for this outDirPath, so + // we can write to the same bucket. + if err := w.responseWriter.WriteResponse( + ctx, + readWriteBucket, + response, + appproto.WriteResponseWithInsertionPointReadBucket(readWriteBucket), + ); err != nil { + return err + } + return nil + } + readWriteBucket := storagemem.NewReadWriteBucket() + if err := w.responseWriter.WriteResponse( + ctx, + readWriteBucket, + response, + appproto.WriteResponseWithInsertionPointReadBucket(readWriteBucket), + ); err != nil { + return err + } + // Add this readWriteBucket to the set so that other plugins + // can write to the same files (re: insertion points). + w.readWriteBuckets[outDirPath] = readWriteBucket + w.closers = append(w.closers, func() error { + if createOutDirIfNotExists { + if err := os.MkdirAll(outDirPath, 0o755); err != nil { + return err + } + } + // This checks that the directory exists. + osReadWriteBucket, err := w.storageosProvider.NewReadWriteBucket( + outDirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + if err != nil { + return err + } + if _, err := storage.Copy(ctx, readWriteBucket, osReadWriteBucket); err != nil { + return err + } + return nil + }) + return nil +} + +type responseWriterOptions struct { + createOutDirIfNotExists bool +} + +func newResponseWriterOptions() *responseWriterOptions { + return &responseWriterOptions{} +} diff --git a/pkg/bufman/pkg/app/appproto/generator.go b/pkg/bufman/pkg/app/appproto/generator.go new file mode 100644 index 000000000..9e1a1d138 --- /dev/null +++ b/pkg/bufman/pkg/app/appproto/generator.go @@ -0,0 +1,73 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appproto + +import ( + "context" + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" + "go.uber.org/zap" + "google.golang.org/protobuf/types/pluginpb" +) + +type generator struct { + logger *zap.Logger + handler Handler +} + +func newGenerator( + logger *zap.Logger, + handler Handler, +) *generator { + return &generator{ + logger: logger, + handler: handler, + } +} + +func (g *generator) Generate( + ctx context.Context, + container app.EnvStderrContainer, + requests []*pluginpb.CodeGeneratorRequest, +) (*pluginpb.CodeGeneratorResponse, error) { + responseBuilder := newResponseBuilder(container) + jobs := make([]func(context.Context) error, len(requests)) + for i, request := range requests { + request := request + jobs[i] = func(ctx context.Context) error { + if err := protodescriptor.ValidateCodeGeneratorRequest(request); err != nil { + return err + } + return g.handler.Handle(ctx, container, responseBuilder, request) + } + } + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if err := thread.Parallelize(ctx, jobs, thread.ParallelizeWithCancel(cancel)); err != nil { + return nil, err + } + response := responseBuilder.toResponse() + if err := protodescriptor.ValidateCodeGeneratorResponse(response); err != nil { + return nil, err + } + if errString := response.GetError(); errString != "" { + return nil, errors.New(errString) + } + return response, nil +} diff --git a/pkg/bufman/pkg/app/appproto/response_builder.go b/pkg/bufman/pkg/app/appproto/response_builder.go new file mode 100644 index 000000000..ffb1bc8fe --- /dev/null +++ b/pkg/bufman/pkg/app/appproto/response_builder.go @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appproto + +import ( + "errors" + "fmt" + "strings" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/pluginpb" +) + +type responseBuilder struct { + container app.StderrContainer + fileNames map[string]struct{} + files []*pluginpb.CodeGeneratorResponse_File + errorMessages []string + featureProto3Optional bool + lock sync.RWMutex +} + +func newResponseBuilder(container app.StderrContainer) *responseBuilder { + return &responseBuilder{ + container: container, + fileNames: make(map[string]struct{}), + } +} + +func (r *responseBuilder) AddFile(file *pluginpb.CodeGeneratorResponse_File) error { + r.lock.Lock() + defer r.lock.Unlock() + if file == nil { + return errors.New("add CodeGeneratorResponse.File is nil") + } + name := file.GetName() + if name == "" { + return errors.New("add CodeGeneratorResponse.File.Name is empty") + } + // name must be relative, to-slashed, and not contain "." or ".." per the documentation + // this is what normalize does + normalizedName, err := normalpath.NormalizeAndValidate(name) + if err != nil { + // we need names to be normalized for the appproto.Generator to properly put them in buckets + // so we have to error here if it is not validated + return newUnvalidatedNameError(name) + } + if normalizedName != name { + if err := r.warnUnnormalizedName(name); err != nil { + return err + } + // we need names to be normalized for the appproto.Generator to properly put + // them in buckets, so we will coerce this into a normalized name if it is + // validated, ie if it does not container ".." and is absolute, we can still + // continue, assuming we validate here + name = normalizedName + file.Name = proto.String(name) + } + if r.isDuplicate(file) { + if err := r.warnDuplicateName(name); err != nil { + return err + } + } else { + // we drop the file if it is duplicated, and only put in the map and files slice + // if it does not exist + r.fileNames[name] = struct{}{} + r.files = append(r.files, file) + } + return nil +} + +func (r *responseBuilder) AddError(message string) { + r.lock.Lock() + defer r.lock.Unlock() + if message == "" { + // default to an error message to make sure we pass an error + // if this function was called + message = "error" + } + r.errorMessages = append(r.errorMessages, message) +} + +func (r *responseBuilder) SetFeatureProto3Optional() { + r.lock.Lock() + defer r.lock.Unlock() + r.featureProto3Optional = true +} + +// toResponse turns the response writer into a Protobuf CodeGeneratorResponse. +// It should be run after all writing to the response has finished. +func (r *responseBuilder) toResponse() *pluginpb.CodeGeneratorResponse { + r.lock.RLock() + defer r.lock.RUnlock() + response := &pluginpb.CodeGeneratorResponse{ + File: r.files, + } + if len(r.errorMessages) > 0 { + response.Error = proto.String(strings.Join(r.errorMessages, "\n")) + } + if r.featureProto3Optional { + response.SupportedFeatures = proto.Uint64(uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)) + } + return response +} + +// isDuplicate determines if the given file is a duplicate file. +// Insertion points are intentionally ignored because they must +// always reference duplicate files in order to take effect. +// +// Note that we do not acquire the lock here because this helper +// is only called within the context of r.AddFile. +func (r *responseBuilder) isDuplicate(file *pluginpb.CodeGeneratorResponse_File) bool { + if file.GetInsertionPoint() != "" { + return false + } + _, ok := r.fileNames[file.GetName()] + return ok +} + +func (r *responseBuilder) warnUnnormalizedName(name string) error { + _, err := r.container.Stderr().Write([]byte(fmt.Sprintf( + `Warning: Generated file name %q does not conform to the Protobuf generation specification. Note that the file name must be relative, use "/" instead of "\", and not use "." or ".." as part of the file name. Buf will continue without error here, but please raise an issue with the maintainer of the plugin and reference https://github.com/protocolbuffers/protobuf/blob/95e6c5b4746dd7474d540ce4fb375e3f79a086f8/src/google/protobuf/compiler/plugin.proto#L122 +`, + name, + ))) + return err +} + +func (r *responseBuilder) warnDuplicateName(name string) error { + _, err := r.container.Stderr().Write([]byte(fmt.Sprintf( + `Warning: Duplicate generated file name %q. Buf will continue without error here and drop the second occurrence of this file, but please raise an issue with the maintainer of the plugin. +`, + name, + ))) + return err +} + +func newUnvalidatedNameError(name string) error { + return fmt.Errorf( + `Generated file name %q does not conform to the Protobuf generation specification. Note that the file name must be relative, and not use "..". Please raise an issue with the maintainer of the plugin and reference https://github.com/protocolbuffers/protobuf/blob/95e6c5b4746dd7474d540ce4fb375e3f79a086f8/src/google/protobuf/compiler/plugin.proto#L122 +`, + name, + ) +} diff --git a/pkg/bufman/pkg/app/appproto/response_writer.go b/pkg/bufman/pkg/app/appproto/response_writer.go new file mode 100644 index 000000000..d5b463f53 --- /dev/null +++ b/pkg/bufman/pkg/app/appproto/response_writer.go @@ -0,0 +1,155 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appproto + +import ( + "bufio" + "bytes" + "context" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "go.uber.org/multierr" + "go.uber.org/zap" + "google.golang.org/protobuf/types/pluginpb" +) + +type responseWriter struct { + logger *zap.Logger +} + +func newResponseWriter( + logger *zap.Logger, +) *responseWriter { + return &responseWriter{ + logger: logger, + } +} + +func (h *responseWriter) WriteResponse( + ctx context.Context, + writeBucket storage.WriteBucket, + response *pluginpb.CodeGeneratorResponse, + options ...WriteResponseOption, +) error { + writeResponseOptions := newWriteResponseOptions() + for _, option := range options { + option(writeResponseOptions) + } + for _, file := range response.File { + if file.GetInsertionPoint() != "" { + if writeResponseOptions.insertionPointReadBucket == nil { + return storage.NewErrNotExist(file.GetName()) + } + if err := applyInsertionPoint(ctx, file, writeResponseOptions.insertionPointReadBucket, writeBucket); err != nil { + return err + } + } else if err := storage.PutPath(ctx, writeBucket, file.GetName(), []byte(file.GetContent())); err != nil { + return err + } + } + return nil +} + +// applyInsertionPoint inserts the content of the given file at the insertion point that it specfiies. +// For more details on insertion points, see the following: +// +// https://github.com/protocolbuffers/protobuf/blob/f5bdd7cd56aa86612e166706ed8ef139db06edf2/src/google/protobuf/compiler/plugin.proto#L135-L171 +func applyInsertionPoint( + ctx context.Context, + file *pluginpb.CodeGeneratorResponse_File, + readBucket storage.ReadBucket, + writeBucket storage.WriteBucket, +) (retErr error) { + targetReadObjectCloser, err := readBucket.Get(ctx, file.GetName()) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, targetReadObjectCloser.Close()) + }() + resultData, err := writeInsertionPoint(ctx, file, targetReadObjectCloser) + if err != nil { + return err + } + // This relies on storageos buckets maintaining existing file permissions + return storage.PutPath(ctx, writeBucket, file.GetName(), resultData) +} + +// writeInsertionPoint writes the insertion point defined in insertionPointFile +// to the targetFile and returns the result as []byte. The caller must ensure the +// provided targetFile matches the file requested in insertionPointFile.Name. +func writeInsertionPoint( + ctx context.Context, + insertionPointFile *pluginpb.CodeGeneratorResponse_File, + targetFile io.Reader, +) (_ []byte, retErr error) { + targetScanner := bufio.NewScanner(targetFile) + match := []byte("@@protoc_insertion_point(" + insertionPointFile.GetInsertionPoint() + ")") + postInsertionContent := bytes.NewBuffer(nil) + postInsertionContent.Grow(averageGeneratedFileSize) + // TODO: We should respect the line endings in the generated file. This would + // require either targetFile being an io.ReadSeeker and in the worst case + // doing 2 full scans of the file (if it is a single line), or implementing + // bufio.Scanner.Scan() inline + newline := []byte{'\n'} + for targetScanner.Scan() { + targetLine := targetScanner.Bytes() + if !bytes.Contains(targetLine, match) { + // these writes cannot fail, they will panic if they cannot + // allocate + _, _ = postInsertionContent.Write(targetLine) + _, _ = postInsertionContent.Write(newline) + continue + } + // For each line in then new content, apply the + // same amount of whitespace. This is important + // for specific languages, e.g. Python. + whitespace := leadingWhitespace(targetLine) + + // Create another scanner so that we can seamlessly handle + // newlines in a platform-agnostic manner. + insertedContentScanner := bufio.NewScanner(bytes.NewBufferString(insertionPointFile.GetContent())) + insertedContent := scanWithPrefixAndLineEnding(insertedContentScanner, whitespace, newline) + // This write cannot fail, it will panic if it cannot + // allocate + _, _ = postInsertionContent.Write(insertedContent) + + // Code inserted at this point is placed immediately + // above the line containing the insertion point, so + // we include it last. + // These writes cannot fail, they will panic if they cannot + // allocate + _, _ = postInsertionContent.Write(targetLine) + _, _ = postInsertionContent.Write(newline) + } + + if err := targetScanner.Err(); err != nil { + return nil, err + } + + // trim the trailing newline + postInsertionBytes := postInsertionContent.Bytes() + return postInsertionBytes[:len(postInsertionBytes)-1], nil +} + +type writeResponseOptions struct { + insertionPointReadBucket storage.ReadBucket +} + +func newWriteResponseOptions() *writeResponseOptions { + return &writeResponseOptions{} +} diff --git a/pkg/bufman/pkg/app/appverbose/appverbose.go b/pkg/bufman/pkg/app/appverbose/appverbose.go new file mode 100644 index 000000000..4ee40fed0 --- /dev/null +++ b/pkg/bufman/pkg/app/appverbose/appverbose.go @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appverbose + +import ( + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/verbose" +) + +// Container is a container. +type Container interface { + VerbosePrinter() verbose.Printer +} + +// NewContainer returns a new Container. +func NewContainer(verbosePrinter verbose.Printer) Container { + return newContainer(verbosePrinter) +} + +// NewVerbosePrinter returns a new verbose.Printer depending on the value of verboseValue. +func NewVerbosePrinter(writer io.Writer, prefix string, verboseValue bool) verbose.Printer { + if verboseValue { + return verbose.NewWritePrinter(writer, prefix) + } + return verbose.NopPrinter +} diff --git a/pkg/bufman/pkg/app/appverbose/container.go b/pkg/bufman/pkg/app/appverbose/container.go new file mode 100644 index 000000000..2577fa630 --- /dev/null +++ b/pkg/bufman/pkg/app/appverbose/container.go @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package appverbose + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/verbose" + +type container struct { + verbosePrinter verbose.Printer +} + +func newContainer(verbosePrinter verbose.Printer) *container { + return &container{ + verbosePrinter: verbosePrinter, + } +} + +func (c *container) VerbosePrinter() verbose.Printer { + return c.verbosePrinter +} diff --git a/pkg/bufman/pkg/app/arg_container.go b/pkg/bufman/pkg/app/arg_container.go new file mode 100644 index 000000000..0605cd571 --- /dev/null +++ b/pkg/bufman/pkg/app/arg_container.go @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +type argContainer struct { + values []string +} + +func newArgContainer(s []string) *argContainer { + values := make([]string, len(s)) + copy(values, s) + return &argContainer{ + values: values, + } +} + +func (a *argContainer) NumArgs() int { + return len(a.values) +} + +func (a *argContainer) Arg(i int) string { + return a.values[i] +} diff --git a/pkg/bufman/pkg/app/container.go b/pkg/bufman/pkg/app/container.go new file mode 100644 index 000000000..12791725f --- /dev/null +++ b/pkg/bufman/pkg/app/container.go @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +type container struct { + EnvContainer + StdinContainer + StdoutContainer + StderrContainer + ArgContainer +} + +func newContainer( + envContainer EnvContainer, + stdinContainer StdinContainer, + stdoutContainer StdoutContainer, + stderrContainer StderrContainer, + argContainer ArgContainer, +) *container { + return &container{ + EnvContainer: envContainer, + StdinContainer: stdinContainer, + StdoutContainer: stdoutContainer, + StderrContainer: stderrContainer, + ArgContainer: argContainer, + } +} diff --git a/pkg/bufman/pkg/app/env_container.go b/pkg/bufman/pkg/app/env_container.go new file mode 100644 index 000000000..113330236 --- /dev/null +++ b/pkg/bufman/pkg/app/env_container.go @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +import ( + "errors" + "strings" +) + +type envContainer struct { + variables map[string]string +} + +func newEnvContainer(m map[string]string) *envContainer { + variables := make(map[string]string) + for key, value := range m { + if value != "" { + variables[key] = value + } + } + return &envContainer{ + variables: variables, + } +} + +func newEnvContainerForEnviron(environ []string) (*envContainer, error) { + variables := make(map[string]string, len(environ)) + for _, elem := range environ { + if !strings.ContainsRune(elem, '=') { + // Do not print out as we don't want to mistakenly leak a secure environment variable + return nil, errors.New("environment variable does not contain =") + } + split := strings.SplitN(elem, "=", 2) + if len(split) != 2 { + // Do not print out as we don't want to mistakenly leak a secure environment variable + return nil, errors.New("unknown environment split") + } + if split[1] != "" { + variables[split[0]] = split[1] + } + } + return &envContainer{ + variables: variables, + }, nil +} + +func (e *envContainer) Env(key string) string { + return e.variables[key] +} + +func (e *envContainer) ForEachEnv(f func(string, string)) { + for key, value := range e.variables { + // This should be done anyways but just to make sure + if value != "" { + f(key, value) + } + } +} + +func (e *envContainer) Size() int { + return len(e.variables) +} diff --git a/pkg/bufman/pkg/app/stderr_container.go b/pkg/bufman/pkg/app/stderr_container.go new file mode 100644 index 000000000..9693070ac --- /dev/null +++ b/pkg/bufman/pkg/app/stderr_container.go @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +import ( + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/ioextended" +) + +type stderrContainer struct { + writer io.Writer +} + +func newStderrContainer(writer io.Writer) *stderrContainer { + if writer == nil { + writer = io.Discard + } + return &stderrContainer{ + writer: ioextended.LockedWriter(writer), + } +} + +func (s *stderrContainer) Stderr() io.Writer { + return s.writer +} diff --git a/pkg/bufman/pkg/app/stdin_container.go b/pkg/bufman/pkg/app/stdin_container.go new file mode 100644 index 000000000..d8bbceaf9 --- /dev/null +++ b/pkg/bufman/pkg/app/stdin_container.go @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +import ( + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/ioextended" +) + +type stdinContainer struct { + reader io.Reader +} + +func newStdinContainer(reader io.Reader) *stdinContainer { + if reader == nil { + reader = ioextended.DiscardReader + } + return &stdinContainer{ + reader: reader, + } +} + +func (s *stdinContainer) Stdin() io.Reader { + return s.reader +} diff --git a/pkg/bufman/pkg/app/stdout_container.go b/pkg/bufman/pkg/app/stdout_container.go new file mode 100644 index 000000000..2ba5a28f2 --- /dev/null +++ b/pkg/bufman/pkg/app/stdout_container.go @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package app + +import ( + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/ioextended" +) + +type stdoutContainer struct { + writer io.Writer +} + +func newStdoutContainer(writer io.Writer) *stdoutContainer { + if writer == nil { + writer = io.Discard + } + return &stdoutContainer{ + writer: ioextended.LockedWriter(writer), + } +} + +func (s *stdoutContainer) Stdout() io.Writer { + return s.writer +} diff --git a/pkg/bufman/pkg/bandeps/bandeps.go b/pkg/bufman/pkg/bandeps/bandeps.go new file mode 100644 index 000000000..5983e3c24 --- /dev/null +++ b/pkg/bufman/pkg/bandeps/bandeps.go @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bandeps + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "go.uber.org/zap" +) + +const ( + tracerName = "bufbuild/buf/bandeps" +) + +// Checker is a checker. +type Checker interface { + // Check runs bandeps in the current directory with the configuration. + Check( + ctx context.Context, + envStdioContainer app.EnvStdioContainer, + externalConfig ExternalConfig, + ) ([]Violation, error) +} + +func NewChecker(logger *zap.Logger, runner command.Runner) Checker { + return newChecker(logger, runner) +} + +// Violation is a violation. +type Violation interface { + fmt.Stringer + + Package() string + Dep() string + Note() string + + key() string +} + +// ExternalConfig is an external configuation. +type ExternalConfig struct { + Bans []ExternalBanConfig `json:"bans,omitempty" yaml:"bans,omitempty"` +} + +// ExternalConfig is an external ban configuation. +type ExternalBanConfig struct { + // Packages are the package expressions to get dependencies for. + Packages ExternalPackageConfig `json:"packages,omitempty" yaml:"packages,omitempty"` + // Deps are package expressions that cannot be depended on for Packages. + Deps ExternalPackageConfig `json:"deps,omitempty" yaml:"deps,omitempty"` + // Note is a note to print out regarding why this ban exists. + Note string `json:"note,omitempty" yaml:"note,omitempty"` +} + +type ExternalPackageConfig struct { + // Use are the package expressions to list with go list. + Use []string `json:"use,omitempty" yaml:"use,omitempty"` + // Except are the package expressions that should be excluded from Use. + Except []string `json:"except,omitempty" yaml:"except,omitempty"` +} diff --git a/pkg/bufman/pkg/bandeps/checker.go b/pkg/bufman/pkg/bandeps/checker.go new file mode 100644 index 000000000..3c9f44f11 --- /dev/null +++ b/pkg/bufman/pkg/bandeps/checker.go @@ -0,0 +1,185 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bandeps + +import ( + "context" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.uber.org/zap" +) + +type checker struct { + logger *zap.Logger + runner command.Runner + tracer trace.Tracer +} + +func newChecker(logger *zap.Logger, runner command.Runner) *checker { + return &checker{ + logger: logger, + runner: runner, + tracer: otel.GetTracerProvider().Tracer(tracerName), + } +} + +func (c *checker) Check( + ctx context.Context, + envStdioContainer app.EnvStdioContainer, + externalConfig ExternalConfig, +) ([]Violation, error) { + state := newState(c.logger, envStdioContainer, c.runner) + if err := c.populateState(ctx, state, externalConfig); err != nil { + return nil, err + } + for _, externalBanConfig := range externalConfig.Bans { + if err := c.checkBan(ctx, state, externalBanConfig); err != nil { + return nil, err + } + } + return state.Violations(), nil +} + +func (c *checker) checkBan( + ctx context.Context, + state *state, + externalBanConfig ExternalBanConfig, +) error { + ctx, span := c.tracer.Start(ctx, "checkBan") + defer span.End() + + packages, err := c.getPackages(ctx, state, externalBanConfig.Packages) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + banPackages, err := c.getPackages(ctx, state, externalBanConfig.Deps) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + + for pkg := range packages { + deps, err := state.DepsForPackages(ctx, pkg) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + for dep := range deps { + if _, ok := banPackages[dep]; ok { + state.AddViolation( + newViolation( + pkg, + dep, + externalBanConfig.Note, + ), + ) + } + } + } + + return nil +} + +func (c *checker) getPackages( + ctx context.Context, + state *state, + externalPackageConfig ExternalPackageConfig, +) (map[string]struct{}, error) { + usePackages, err := state.PackagesForPackageExpressions(ctx, externalPackageConfig.Use...) + if err != nil { + return nil, err + } + exceptPackages, err := state.PackagesForPackageExpressions(ctx, externalPackageConfig.Except...) + if err != nil { + return nil, err + } + subtractMaps(usePackages, exceptPackages) + return usePackages, nil +} + +func (c *checker) populateState(ctx context.Context, state *state, externalConfig ExternalConfig) error { + ctx, span := c.tracer.Start(ctx, "populateState") + defer span.End() + + var depPackageExpressions []string + var packageExpressions []string + for _, externalBanConfig := range externalConfig.Bans { + depPackageExpressions = append(depPackageExpressions, externalBanConfig.Packages.Use...) + depPackageExpressions = append(depPackageExpressions, externalBanConfig.Packages.Except...) + packageExpressions = append(packageExpressions, externalBanConfig.Deps.Use...) + packageExpressions = append(packageExpressions, externalBanConfig.Deps.Except...) + } + + depPackages := make(map[string]struct{}) + var lock sync.Mutex + var jobs []func(context.Context) error + for _, packageExpression := range depPackageExpressions { + packageExpression := packageExpression + jobs = append( + jobs, + func(ctx context.Context) error { + pkgs, err := state.PackagesForPackageExpressions(ctx, packageExpression) + if err != nil { + return err + } + lock.Lock() + addMaps(depPackages, pkgs) + lock.Unlock() + return nil + }, + ) + } + for _, packageExpression := range packageExpressions { + packageExpression := packageExpression + jobs = append( + jobs, + func(ctx context.Context) error { + _, err := state.PackagesForPackageExpressions(ctx, packageExpression) + return err + }, + ) + } + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if err := thread.Parallelize(ctx, jobs, thread.ParallelizeWithCancel(cancel)); err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + + jobs = make([]func(context.Context) error, 0) + for pkg := range depPackages { + pkg := pkg + jobs = append( + jobs, + func(ctx context.Context) error { + _, err := state.DepsForPackages(ctx, pkg) + return err + }, + ) + } + return thread.Parallelize(ctx, jobs, thread.ParallelizeWithCancel(cancel)) +} diff --git a/pkg/bufman/pkg/bandeps/cmd/bandeps/main.go b/pkg/bufman/pkg/bandeps/cmd/bandeps/main.go new file mode 100644 index 000000000..9d0f75e1c --- /dev/null +++ b/pkg/bufman/pkg/bandeps/cmd/bandeps/main.go @@ -0,0 +1,114 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "context" + "errors" + "fmt" + "os" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appflag" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/bandeps" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" + "github.com/spf13/cobra" + "github.com/spf13/pflag" +) + +const ( + name = "bandeps" + + configFileFlagName = "config-file" + configFileFlagShortName = "f" + + timeout = 120 * time.Second +) + +func main() { + appcmd.Main(context.Background(), newCommand()) +} + +func newCommand() *appcmd.Command { + builder := appflag.NewBuilder( + name, + appflag.BuilderWithTimeout(timeout), + appflag.BuilderWithTracing(), + ) + flags := newFlags() + return &appcmd.Command{ + Use: name, + Run: builder.NewRunFunc( + func(ctx context.Context, container appflag.Container) error { + return run(ctx, container, flags) + }, + ), + BindPersistentFlags: builder.BindRoot, + BindFlags: flags.Bind, + } +} + +type flags struct { + ConfigFile string +} + +func newFlags() *flags { + return &flags{} +} + +func (f *flags) Bind(flagSet *pflag.FlagSet) { + flagSet.StringVarP( + &f.ConfigFile, + configFileFlagName, + configFileFlagShortName, + "", + "The config file to use.", + ) + _ = cobra.MarkFlagRequired(flagSet, configFileFlagName) +} + +func run(ctx context.Context, container appflag.Container, flags *flags) error { + configData, err := os.ReadFile(flags.ConfigFile) + if err != nil { + return err + } + var externalConfig bandeps.ExternalConfig + if err := encoding.UnmarshalJSONOrYAMLStrict(configData, &externalConfig); err != nil { + return err + } + violations, err := bandeps.NewChecker( + container.Logger(), + command.NewRunner(), + ).Check( + ctx, + container, + externalConfig, + ) + if err != nil { + return err + } + if len(violations) > 0 { + for _, violation := range violations { + if _, err := fmt.Fprintln(container.Stdout(), violation.String()); err != nil { + return err + } + } + return errors.New("") + } + return nil +} diff --git a/pkg/bufman/pkg/bandeps/key_rwlock.go b/pkg/bufman/pkg/bandeps/key_rwlock.go new file mode 100644 index 000000000..eae6af410 --- /dev/null +++ b/pkg/bufman/pkg/bandeps/key_rwlock.go @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bandeps + +import "sync" + +// You can never hold more than one key at a time! We do not enforce lock ordering! + +type keyRWLock struct { + keyToRWLock map[string]*sync.RWMutex + lock sync.Mutex +} + +func newKeyRWLock() *keyRWLock { + return &keyRWLock{ + keyToRWLock: make(map[string]*sync.RWMutex), + } +} + +func (k *keyRWLock) RLock(key string) { + k.getRWLock(key).Lock() +} + +func (k *keyRWLock) RUnlock(key string) { + k.getRWLock(key).Unlock() +} + +func (k *keyRWLock) Lock(key string) { + k.getRWLock(key).Lock() +} + +func (k *keyRWLock) Unlock(key string) { + k.getRWLock(key).Unlock() +} + +func (k *keyRWLock) getRWLock(key string) *sync.RWMutex { + k.lock.Lock() + rwLock, ok := k.keyToRWLock[key] + if !ok { + rwLock = &sync.RWMutex{} + k.keyToRWLock[key] = rwLock + } + k.lock.Unlock() + return rwLock +} diff --git a/pkg/bufman/pkg/bandeps/state.go b/pkg/bufman/pkg/bandeps/state.go new file mode 100644 index 000000000..fb92f56c7 --- /dev/null +++ b/pkg/bufman/pkg/bandeps/state.go @@ -0,0 +1,269 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bandeps + +import ( + "context" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.uber.org/zap" +) + +type state struct { + logger *zap.Logger + envStdioContainer app.EnvStdioContainer + runner command.Runner + violationMap map[string]Violation + // map from ./foo/bar/... to actual packages + packageExpressionToPackages map[string]*packagesResult + packageExpressionToPackagesLock *keyRWLock + // map from packages to dependencies + packageToDeps map[string]*depsResult + packageToDepsLock *keyRWLock + lock sync.RWMutex + calls int + cacheHits int + tracer trace.Tracer +} + +func newState( + logger *zap.Logger, + envStdioContainer app.EnvStdioContainer, + runner command.Runner, +) *state { + return &state{ + logger: logger, + envStdioContainer: envStdioContainer, + runner: runner, + violationMap: make(map[string]Violation), + packageExpressionToPackages: make(map[string]*packagesResult), + packageExpressionToPackagesLock: newKeyRWLock(), + packageToDeps: make(map[string]*depsResult), + packageToDepsLock: newKeyRWLock(), + tracer: otel.GetTracerProvider().Tracer(tracerName), + } +} + +func (s *state) PackagesForPackageExpressions( + ctx context.Context, + packageExpressions ...string, +) (map[string]struct{}, error) { + packages := make(map[string]struct{}) + for _, packageExpression := range packageExpressions { + iPackages, err := s.packagesForPackageExpression(ctx, packageExpression) + if err != nil { + return nil, err + } + addMaps(packages, iPackages) + } + return packages, nil +} + +func (s *state) DepsForPackages( + ctx context.Context, + pkgs ...string, +) (map[string]struct{}, error) { + deps := make(map[string]struct{}) + for _, pkg := range pkgs { + iDeps, err := s.depsForPackage(ctx, pkg) + if err != nil { + return nil, err + } + addMaps(deps, iDeps) + } + return deps, nil +} + +func (s *state) AddViolation(violation Violation) { + violationKey := violation.key() + s.lock.Lock() + if _, ok := s.violationMap[violationKey]; !ok { + s.violationMap[violationKey] = violation + } + s.lock.Unlock() +} + +func (s *state) Violations() []Violation { + s.lock.RLock() + violations := make([]Violation, 0, len(s.violationMap)) + for _, violation := range s.violationMap { + violations = append(violations, violation) + } + s.lock.RUnlock() + sortViolations(violations) + return violations +} + +func (s *state) packagesForPackageExpression( + ctx context.Context, + packageExpression string, +) (map[string]struct{}, error) { + defer func() { + // not worrying about locks + s.logger.Sugar().Debug("cache", zap.Int("calls", s.calls), zap.Int("hits", s.cacheHits)) + }() + + s.packageExpressionToPackagesLock.RLock(packageExpression) + s.lock.RLock() + packageResult, ok := s.packageExpressionToPackages[packageExpression] + s.lock.RUnlock() + s.packageExpressionToPackagesLock.RUnlock(packageExpression) + if ok { + s.lock.Lock() + s.calls++ + s.cacheHits++ + s.lock.Unlock() + return packageResult.Packages, packageResult.Err + } + + s.packageExpressionToPackagesLock.Lock(packageExpression) + defer s.packageExpressionToPackagesLock.Unlock(packageExpression) + + s.lock.RLock() + packageResult, ok = s.packageExpressionToPackages[packageExpression] + s.lock.RUnlock() + if ok { + s.lock.Lock() + s.calls++ + s.cacheHits++ + s.lock.Unlock() + return packageResult.Packages, packageResult.Err + } + packages, err := s.packagesForPackageExpressionUncached(ctx, packageExpression) + // we always hold key lock and then this lock so lock ordering is ok + s.lock.Lock() + s.packageExpressionToPackages[packageExpression] = newPackagesResult(packages, err) + s.calls++ + s.lock.Unlock() + return packages, err +} + +func (s *state) packagesForPackageExpressionUncached( + ctx context.Context, + packageExpression string, +) (map[string]struct{}, error) { + ctx, span := s.tracer.Start(ctx, "packagesForPackageExpressionUncached", trace.WithAttributes( + attribute.Key("packageExpression").String(packageExpression), + )) + defer span.End() + + data, err := command.RunStdout(ctx, s.envStdioContainer, s.runner, `go`, `list`, packageExpression) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return nil, err + } + return stringutil.SliceToMap(getNonEmptyLines(string(data))), nil +} + +func (s *state) depsForPackage( + ctx context.Context, + pkg string, +) (map[string]struct{}, error) { + defer func() { + // not worrying about locks + s.logger.Sugar().Debug("cache", zap.Int("calls", s.calls), zap.Int("hits", s.cacheHits)) + }() + + s.packageToDepsLock.RLock(pkg) + s.lock.RLock() + depResult, ok := s.packageToDeps[pkg] + s.lock.RUnlock() + s.packageToDepsLock.RUnlock(pkg) + if ok { + s.lock.Lock() + s.calls++ + s.cacheHits++ + s.lock.Unlock() + return depResult.Deps, depResult.Err + } + + s.packageToDepsLock.Lock(pkg) + defer s.packageToDepsLock.Unlock(pkg) + + s.lock.RLock() + depResult, ok = s.packageToDeps[pkg] + s.lock.RUnlock() + if ok { + s.lock.Lock() + s.calls++ + s.cacheHits++ + s.lock.Unlock() + return depResult.Deps, depResult.Err + } + deps, err := s.depsForPackageUncached(ctx, pkg) + // we always hold key lock and then this lock so lock ordering is ok + s.lock.Lock() + s.packageToDeps[pkg] = newDepsResult(deps, err) + s.calls++ + s.lock.Unlock() + return deps, err +} + +func (s *state) depsForPackageUncached( + ctx context.Context, + pkg string, +) (map[string]struct{}, error) { + ctx, span := s.tracer.Start(ctx, "depsForPackageUncached", trace.WithAttributes( + attribute.Key("package").String(pkg), + )) + defer span.End() + + data, err := command.RunStdout(ctx, s.envStdioContainer, s.runner, `go`, `list`, `-f`, `{{join .Deps "\n"}}`, pkg) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return nil, err + } + return stringutil.SliceToMap(getNonEmptyLines(string(data))), nil +} + +type packagesResult struct { + Packages map[string]struct{} + Err error +} + +func newPackagesResult( + packages map[string]struct{}, + err error, +) *packagesResult { + return &packagesResult{ + Packages: packages, + Err: err, + } +} + +type depsResult struct { + Deps map[string]struct{} + Err error +} + +func newDepsResult( + deps map[string]struct{}, + err error, +) *depsResult { + return &depsResult{ + Deps: deps, + Err: err, + } +} diff --git a/pkg/bufman/pkg/bandeps/util.go b/pkg/bufman/pkg/bandeps/util.go new file mode 100644 index 000000000..20c8eb2c6 --- /dev/null +++ b/pkg/bufman/pkg/bandeps/util.go @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bandeps + +import ( + "sort" + "strings" +) + +func sortViolations(violations []Violation) { + sort.Slice( + violations, + func(i int, j int) bool { + one := violations[i] + two := violations[j] + if one.Package() < two.Package() { + return true + } + if one.Package() > two.Package() { + return false + } + if one.Dep() < two.Dep() { + return true + } + if one.Dep() > two.Dep() { + return false + } + return one.Note() < two.Note() + }, + ) +} + +func getNonEmptyLines(s string) []string { + var lines []string + for _, line := range strings.Split(s, "\n") { + if line := strings.TrimSpace(line); line != "" { + lines = append(lines, line) + } + } + return lines +} + +func addMaps(base map[string]struct{}, maps ...map[string]struct{}) { + for _, m := range maps { + for k, v := range m { + base[k] = v + } + } +} + +func subtractMaps(base map[string]struct{}, maps ...map[string]struct{}) { + for _, m := range maps { + for k := range m { + delete(base, k) + } + } +} diff --git a/pkg/bufman/pkg/bandeps/violation.go b/pkg/bufman/pkg/bandeps/violation.go new file mode 100644 index 000000000..240fe989a --- /dev/null +++ b/pkg/bufman/pkg/bandeps/violation.go @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bandeps + +import ( + "crypto/sha256" +) + +type violation struct { + pkg string + dep string + note string +} + +func newViolation( + pkg string, + dep string, + note string, +) *violation { + return &violation{ + pkg: pkg, + dep: dep, + note: note, + } +} + +func (v *violation) Package() string { + return v.pkg +} + +func (v *violation) Dep() string { + return v.dep +} + +func (v *violation) Note() string { + return v.note +} + +func (v *violation) String() string { + return v.pkg + ` cannot depend on ` + v.dep + `: ` + v.note + `.` +} + +func (v *violation) key() string { + hash := sha256.New() + _, _ = hash.Write([]byte(v.pkg)) + _, _ = hash.Write([]byte(v.dep)) + _, _ = hash.Write([]byte(v.note)) + return string(hash.Sum(nil)) +} diff --git a/pkg/bufman/pkg/cert/certclient/certclient.go b/pkg/bufman/pkg/cert/certclient/certclient.go new file mode 100644 index 000000000..725d5d985 --- /dev/null +++ b/pkg/bufman/pkg/cert/certclient/certclient.go @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package certclient + +import ( + "crypto/tls" + "fmt" + "path/filepath" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appname" +) + +// ExternalClientTLSConfig allows users to configure TLS on the client side. +type ExternalClientTLSConfig struct { + Use string `json:"use,omitempty" yaml:"use,omitempty"` + RootCertFilePaths []string `json:"root_cert_file_paths,omitempty" yaml:"root_cert_file_paths,omitempty"` +} + +// IsEmpty returns true if the ExternalClientTLSConfig is empty. +func (e ExternalClientTLSConfig) IsEmpty() bool { + return e.Use == "" && len(e.RootCertFilePaths) == 0 +} + +// NewClientTLSConfig creates a new *tls.Config from the ExternalTLSConfig +// +// The default is to use the system TLS config. +func NewClientTLSConfig( + container appname.Container, + externalClientTLSConfig ExternalClientTLSConfig, +) (*tls.Config, error) { + switch t := strings.ToLower(strings.TrimSpace(externalClientTLSConfig.Use)); t { + case "local": + rootCertFilePaths := externalClientTLSConfig.RootCertFilePaths + if len(rootCertFilePaths) == 0 { + rootCertFilePaths = []string{ + filepath.Join( + container.ConfigDirPath(), + "tls", + "root.pem", + ), + } + } + return NewClientTLSConfigFromRootCertFiles(rootCertFilePaths...) + case "", "system": + return newClientSystemTLSConfig(), nil + case "false": + return nil, nil + default: + return nil, fmt.Errorf("unknown tls.use: %q", t) + } +} diff --git a/pkg/bufman/pkg/cert/certclient/util.go b/pkg/bufman/pkg/cert/certclient/util.go new file mode 100644 index 000000000..c9f68a48b --- /dev/null +++ b/pkg/bufman/pkg/cert/certclient/util.go @@ -0,0 +1,69 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package certclient + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "os" +) + +// NewClientTLSConfigFromRootCertFiles creates a new tls.Config from a root certificate files. +func NewClientTLSConfigFromRootCertFiles(rootCertFilePaths ...string) (*tls.Config, error) { + rootCertDatas := make([][]byte, len(rootCertFilePaths)) + for i, rootCertFilePath := range rootCertFilePaths { + rootCertData, err := os.ReadFile(rootCertFilePath) + if err != nil { + return nil, err + } + rootCertDatas[i] = rootCertData + } + return newClientTLSConfigFromRootCertDatas(rootCertDatas...) +} + +// newClientTLSConfigFromRootCertDatas creates a new tls.Config from root certificate datas. +func newClientTLSConfigFromRootCertDatas(rootCertDatas ...[]byte) (*tls.Config, error) { + certPool := x509.NewCertPool() + for _, rootCertData := range rootCertDatas { + if !certPool.AppendCertsFromPEM(rootCertData) { + return nil, errors.New("failed to append root certificate") + } + } + return newClientTLSConfigFromRootCertPool(certPool), nil +} + +// newClientTLSConfigFromRootCertPool creates a new tls.Config from a root certificate pool. +func newClientTLSConfigFromRootCertPool(certPool *x509.CertPool) *tls.Config { + return &tls.Config{ + MinVersion: tls.VersionTLS12, + RootCAs: certPool, + } +} + +// newClientSystemTLSConfig creates a new tls.Config that uses the system cert pool for verifying +// server certificates. +func newClientSystemTLSConfig() *tls.Config { + return &tls.Config{ + MinVersion: tls.VersionTLS12, + // An empty TLS config will use the system certificate pool + // when verifying the servers certificate. This is because + // not setting any RootCAs will set `x509.VerifyOptions.Roots` + // to nil, which triggers the loading of system certs (including + // on Windows somehow) within (*x509.Certificate).Verify. + RootCAs: nil, + } +} diff --git a/pkg/bufman/pkg/command/command.go b/pkg/bufman/pkg/command/command.go new file mode 100644 index 000000000..2b5a7c3db --- /dev/null +++ b/pkg/bufman/pkg/command/command.go @@ -0,0 +1,214 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package command + +import ( + "bytes" + "context" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" +) + +// Process represents a background process. +type Process interface { + // Wait blocks to wait for the process to exit. It will attempt to kill the + // process if the passed context expires. + Wait(ctx context.Context) error +} + +// Runner runs external commands. +// +// A Runner will limit the number of concurrent commands, as well as explicitly +// set stdin, stdout, stderr, and env to nil/empty values if not set with options. +// +// All external commands in buf MUST use command.Runner instead of +// exec.Command, exec.CommandContext. +type Runner interface { + // Run runs the external command. It blocks until the command exits. + // + // This should be used instead of exec.CommandContext(...).Run(). + Run(ctx context.Context, name string, options ...RunOption) error + + // Start runs the external command, returning a [Process] handle to track + // its progress. + // + // This should be used instead of exec.Command(...).Start(). + Start(name string, options ...StartOption) (Process, error) +} + +// RunOption is an option for Run. +type RunOption func(*execOptions) + +// RunWithArgs returns a new RunOption that sets the arguments other +// than the name. +// +// The default is no arguments. +func RunWithArgs(args ...string) RunOption { + return func(execOptions *execOptions) { + execOptions.args = args + } +} + +// RunWithEnv returns a new RunOption that sets the environment variables. +// +// The default is to use the single environment variable __EMPTY_ENV__=1 as we +// cannot explicitly set an empty environment with the exec package. +func RunWithEnv(env map[string]string) RunOption { + return func(execOptions *execOptions) { + execOptions.env = env + } +} + +// RunWithStdin returns a new RunOption that sets the stdin. +// +// The default is ioextended.DiscardReader. +func RunWithStdin(stdin io.Reader) RunOption { + return func(execOptions *execOptions) { + execOptions.stdin = stdin + } +} + +// RunWithStdout returns a new RunOption that sets the stdout. +// +// The default is the null device (os.DevNull). +func RunWithStdout(stdout io.Writer) RunOption { + return func(execOptions *execOptions) { + execOptions.stdout = stdout + } +} + +// RunWithStderr returns a new RunOption that sets the stderr. +// +// The default is the null device (os.DevNull). +func RunWithStderr(stderr io.Writer) RunOption { + return func(execOptions *execOptions) { + execOptions.stderr = stderr + } +} + +// RunWithDir returns a new RunOption that sets the working directory. +// +// The default is the current working directory. +func RunWithDir(dir string) RunOption { + return func(execOptions *execOptions) { + execOptions.dir = dir + } +} + +// StartOption is an option for Start. +type StartOption func(*execOptions) + +// StartWithArgs returns a new RunOption that sets the arguments other +// than the name. +// +// The default is no arguments. +func StartWithArgs(args ...string) StartOption { + return func(execOptions *execOptions) { + execOptions.args = args + } +} + +// StartWithEnv returns a new RunOption that sets the environment variables. +// +// The default is to use the single environment variable __EMPTY_ENV__=1 as we +// cannot explicitly set an empty environment with the exec package. +func StartWithEnv(env map[string]string) StartOption { + return func(execOptions *execOptions) { + execOptions.env = env + } +} + +// StartWithStdin returns a new RunOption that sets the stdin. +// +// The default is ioextended.DiscardReader. +func StartWithStdin(stdin io.Reader) StartOption { + return func(execOptions *execOptions) { + execOptions.stdin = stdin + } +} + +// StartWithStdout returns a new RunOption that sets the stdout. +// +// The default is the null device (os.DevNull). +func StartWithStdout(stdout io.Writer) StartOption { + return func(execOptions *execOptions) { + execOptions.stdout = stdout + } +} + +// StartWithStderr returns a new RunOption that sets the stderr. +// +// The default is the null device (os.DevNull). +func StartWithStderr(stderr io.Writer) StartOption { + return func(execOptions *execOptions) { + execOptions.stderr = stderr + } +} + +// StartWithDir returns a new RunOption that sets the working directory. +// +// The default is the current working directory. +func StartWithDir(dir string) StartOption { + return func(execOptions *execOptions) { + execOptions.dir = dir + } +} + +// NewRunner returns a new Runner. +func NewRunner(options ...RunnerOption) Runner { + return newRunner(options...) +} + +// RunnerOption is an option for a new Runner. +type RunnerOption func(*runner) + +// RunnerWithParallelism returns a new Runner that sets the number of +// external commands that can be run concurrently. +// +// The default is thread.Parallelism(). +func RunnerWithParallelism(parallelism int) RunnerOption { + if parallelism < 1 { + parallelism = 1 + } + return func(runner *runner) { + runner.parallelism = parallelism + } +} + +// RunStdout is a convenience function that attaches the container environment, +// stdin, and stderr, and returns the stdout as a byte slice. +func RunStdout( + ctx context.Context, + container app.EnvStdioContainer, + runner Runner, + name string, + args ...string, +) ([]byte, error) { + buffer := bytes.NewBuffer(nil) + if err := runner.Run( + ctx, + name, + RunWithArgs(args...), + RunWithEnv(app.EnvironMap(container)), + RunWithStdin(container.Stdin()), + RunWithStdout(buffer), + RunWithStderr(container.Stderr()), + ); err != nil { + return nil, err + } + return buffer.Bytes(), nil +} diff --git a/pkg/bufman/pkg/command/process.go b/pkg/bufman/pkg/command/process.go new file mode 100644 index 000000000..e190a7b4d --- /dev/null +++ b/pkg/bufman/pkg/command/process.go @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package command + +import ( + "context" + "errors" + "os/exec" + + "go.uber.org/multierr" +) + +var errWaitAlreadyCalled = errors.New("wait already called on process") + +type process struct { + cmd *exec.Cmd + done func() + waitC chan error +} + +// newProcess wraps an *exec.Cmd and monitors it for exiting. +// When the process exits, done will be called. +// +// This implements the Process interface. +// +// The process is expected to have been started by the caller. +func newProcess(cmd *exec.Cmd, done func()) *process { + return &process{ + cmd: cmd, + done: done, + waitC: make(chan error, 1), + } +} + +// Monitor starts monitoring of the *exec.Cmd. +func (p *process) Monitor() { + go func() { + p.waitC <- p.cmd.Wait() + close(p.waitC) + p.done() + }() +} + +// Wait waits for the process to exit. +func (p *process) Wait(ctx context.Context) error { + select { + case err, ok := <-p.waitC: + // Process exited + if ok { + return err + } + return errWaitAlreadyCalled + case <-ctx.Done(): + // Timed out. Send a kill signal and release our handle to it. + return multierr.Combine(ctx.Err(), p.cmd.Process.Kill()) + } +} diff --git a/pkg/bufman/pkg/command/runner.go b/pkg/bufman/pkg/command/runner.go new file mode 100644 index 000000000..c2f29d30e --- /dev/null +++ b/pkg/bufman/pkg/command/runner.go @@ -0,0 +1,132 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package command + +import ( + "context" + "io" + "os/exec" + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/ioextended" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" +) + +var emptyEnv = envSlice( + map[string]string{ + "__EMPTY_ENV": "1", + }, +) + +type runner struct { + parallelism int + + semaphoreC chan struct{} +} + +func newRunner(options ...RunnerOption) *runner { + runner := &runner{ + parallelism: thread.Parallelism(), + } + for _, option := range options { + option(runner) + } + runner.semaphoreC = make(chan struct{}, runner.parallelism) + return runner +} + +func (r *runner) Run(ctx context.Context, name string, options ...RunOption) error { + execOptions := newExecOptions() + for _, option := range options { + option(execOptions) + } + cmd := exec.CommandContext(ctx, name, execOptions.args...) + execOptions.ApplyToCmd(cmd) + r.increment() + err := cmd.Run() + r.decrement() + return err +} + +func (r *runner) Start(name string, options ...StartOption) (Process, error) { + execOptions := newExecOptions() + for _, option := range options { + option(execOptions) + } + cmd := exec.Command(name, execOptions.args...) + execOptions.ApplyToCmd(cmd) + r.increment() + if err := cmd.Start(); err != nil { + return nil, err + } + process := newProcess(cmd, r.decrement) + process.Monitor() + return process, nil +} + +func (r *runner) increment() { + r.semaphoreC <- struct{}{} +} + +func (r *runner) decrement() { + <-r.semaphoreC +} + +type execOptions struct { + args []string + env map[string]string + stdin io.Reader + stdout io.Writer + stderr io.Writer + dir string +} + +func newExecOptions() *execOptions { + return &execOptions{} +} + +func (e *execOptions) ApplyToCmd(cmd *exec.Cmd) { + // If the user did not specify env vars, we want to make sure + // the command has access to none, as the default is the current env. + if len(e.env) == 0 { + cmd.Env = emptyEnv + } else { + cmd.Env = envSlice(e.env) + } + // If the user did not specify any stdin, we want to make sure + // the command has access to none, as the default is the default stdin. + if e.stdin == nil { + cmd.Stdin = ioextended.DiscardReader + } else { + cmd.Stdin = e.stdin + } + // If Stdout or Stderr are nil, os/exec connects the process output directly + // to the null device. + cmd.Stdout = e.stdout + cmd.Stderr = e.stderr + // The default behavior for dir is what we want already, i.e. the current + // working directory. + cmd.Dir = e.dir +} + +func envSlice(env map[string]string) []string { + var environ []string + for key, value := range env { + environ = append(environ, key+"="+value) + } + sort.Strings(environ) + return environ +} diff --git a/pkg/bufman/pkg/command/runner_unix_test.go b/pkg/bufman/pkg/command/runner_unix_test.go new file mode 100644 index 000000000..421a99555 --- /dev/null +++ b/pkg/bufman/pkg/command/runner_unix_test.go @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package command + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDoubleWait(t *testing.T) { + t.Parallel() + + runner := NewRunner() + process, err := runner.Start("echo") + require.NoError(t, err) + ctx := context.Background() + _ = process.Wait(ctx) + require.Equal(t, process.Wait(ctx), errWaitAlreadyCalled) +} + +func TestNoDeadlock(t *testing.T) { + t.Parallel() + + runner := NewRunner(RunnerWithParallelism(2)) + processes := make([]Process, 4) + for i := 0; i < 4; i++ { + process, err := runner.Start("sleep", StartWithArgs("1")) + require.NoError(t, err) + processes[i] = process + } + ctx := context.Background() + for _, process := range processes { + require.NoError(t, process.Wait(ctx)) + } +} diff --git a/pkg/bufman/pkg/connectclient/connectclient.go b/pkg/bufman/pkg/connectclient/connectclient.go new file mode 100644 index 000000000..108b3cd03 --- /dev/null +++ b/pkg/bufman/pkg/connectclient/connectclient.go @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package connectclient + +import ( + "github.com/bufbuild/connect-go" +) + +// Config holds configuration for creating Connect RPC clients. +type Config struct { + httpClient connect.HTTPClient + addressMapper func(string) string + interceptors []connect.Interceptor + authInterceptorProvider func(string) connect.UnaryInterceptorFunc +} + +// NewConfig creates a new client configuration with the given HTTP client +// and options. +func NewConfig(httpClient connect.HTTPClient, options ...ConfigOption) *Config { + cfg := &Config{ + httpClient: httpClient, + } + for _, opt := range options { + opt(cfg) + } + return cfg +} + +// ConfigOption is an option for customizing a new Config. +type ConfigOption func(*Config) + +// WithAddressMapper maps the address with the given function. +func WithAddressMapper(addressMapper func(string) string) ConfigOption { + return func(cfg *Config) { + cfg.addressMapper = addressMapper + } +} + +// WithInterceptors adds the slice of interceptors to all clients returned from this provider. +func WithInterceptors(interceptors []connect.Interceptor) ConfigOption { + return func(cfg *Config) { + cfg.interceptors = interceptors + } +} + +// WithAuthInterceptorProvider configures a provider that, when invoked, returns an interceptor that can be added +// to a client for setting the auth token +func WithAuthInterceptorProvider(authInterceptorProvider func(string) connect.UnaryInterceptorFunc) ConfigOption { + return func(cfg *Config) { + cfg.authInterceptorProvider = authInterceptorProvider + } +} + +// StubFactory is the type of a generated factory function, for creating Connect client stubs. +type StubFactory[T any] func(connect.HTTPClient, string, ...connect.ClientOption) T + +// Make uses the given generated factory function to create a new connect client. +func Make[T any](cfg *Config, address string, factory StubFactory[T]) T { + interceptors := append([]connect.Interceptor{}, cfg.interceptors...) + if cfg.authInterceptorProvider != nil { + interceptor := cfg.authInterceptorProvider(address) + interceptors = append(interceptors, interceptor) + } + if cfg.addressMapper != nil { + address = cfg.addressMapper(address) + } + return factory(cfg.httpClient, address, connect.WithInterceptors(interceptors...)) +} diff --git a/pkg/bufman/pkg/dag/dag.go b/pkg/bufman/pkg/dag/dag.go new file mode 100644 index 000000000..cdf7a0997 --- /dev/null +++ b/pkg/bufman/pkg/dag/dag.go @@ -0,0 +1,451 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dag + +import ( + "bytes" + "errors" + "fmt" + "strings" +) + +// Largely adopted from https://github.com/stevenle/topsort, with modifications. +// +// Copyright 2013 Steven Le. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// See https://github.com/stevenle/topsort/blob/master/LICENSE. + +// CycleError is an error if the Graph had a cycle. +type CycleError[Key comparable] struct { + Keys []Key +} + +// Error implements error. +func (c *CycleError[Key]) Error() string { + strs := make([]string, len(c.Keys)) + for i, key := range c.Keys { + strs[i] = fmt.Sprintf("%v", key) + } + return fmt.Sprintf("cycle error: %s", strings.Join(strs, " -> ")) +} + +// Graph is a directed acyclic graph structure with comparable keys. +type Graph[Key comparable] struct { + keyToNode map[Key]*node[Key] + // need to store order so that we can create a deterministic CycleError + // in the case of Walk where we have no source nodes, so that we can Walk + // deterministically and find the cycle. + keys []Key +} + +// NewGraph returns a new Graph. +// +// Graphs can also safely be instantiated with &Graph{}. +func NewGraph[Key comparable]() *Graph[Key] { + graph := &Graph[Key]{} + graph.init() + return graph +} + +// AddNode adds a node. +func (g *Graph[Key]) AddNode(key Key) { + g.init() + g.getOrAddNode(key) +} + +// AddEdge adds an edge. +func (g *Graph[Key]) AddEdge(from Key, to Key) { + g.init() + fromNode := g.getOrAddNode(from) + toNode := g.getOrAddNode(to) + fromNode.addOutboundEdge(to) + toNode.addInboundEdge(from) +} + +// ContainsNode returns true if the graph contains the given node. +func (g *Graph[Key]) ContainsNode(key Key) bool { + g.init() + _, ok := g.keyToNode[key] + return ok +} + +// NumNodes returns the number of nodes in the graph. +func (g *Graph[Key]) NumNodes() int { + g.init() + return len(g.keys) +} + +// NumNodes returns the number of edges in the graph. +func (g *Graph[Key]) NumEdges() int { + g.init() + var numEdges int + for _, node := range g.keyToNode { + numEdges += len(node.outboundEdges) + } + return numEdges +} + +// WalkNodes visited each node in the Graph based on insertion order. +// +// f is called for each node. The first argument is the key for the node, +// the second argument is all inbound edges, the third argument +// is all outbound edges. +func (g *Graph[Key]) WalkNodes(f func(Key, []Key, []Key) error) error { + g.init() + for _, key := range g.keys { + node, ok := g.keyToNode[key] + if !ok { + return fmt.Errorf("key not present: %v", key) + } + inboundEdges := make([]Key, len(node.inboundEdges)) + copy(inboundEdges, node.inboundEdges) + outboundEdges := make([]Key, len(node.outboundEdges)) + copy(outboundEdges, node.outboundEdges) + if err := f(key, inboundEdges, outboundEdges); err != nil { + return err + } + } + return nil +} + +// WalkEdges visits each edge in the Graph starting at the source keys. +// +// f is called for each directed edge. The first argument is the source +// node, the second is the destination node. +// +// Returns a *CycleError if there is a cycle in the graph. +func (g *Graph[Key]) WalkEdges(f func(Key, Key) error) error { + g.init() + if g.NumEdges() == 0 { + // No edges, do not walk. + return nil + } + sourceKeys, err := g.getSourceKeys() + if err != nil { + return err + } + switch len(sourceKeys) { + case 0: + // If we have no source nodes, we have a cycle in the graph. To print the cycle, + // we walk starting at all keys We will hit a cycle in this process, however just to check our + // assumptions, we also verify the the walk returns a CycleError, and if not, + // return a system error. + allVisited := make(map[Key]struct{}) + for _, key := range g.keys { + if err := g.edgeVisit( + key, + func(Key, Key) error { return nil }, + newOrderedSet[Key](), + allVisited, + ); err != nil { + return err + } + } + return errors.New("graph had cycle based on source node count being zero, but this was not detected during edge walking") + case 1: + return g.edgeVisit( + sourceKeys[0], + f, + newOrderedSet[Key](), + make(map[Key]struct{}), + ) + default: + allVisited := make(map[Key]struct{}) + for _, key := range sourceKeys { + if err := g.edgeVisit( + key, + f, + newOrderedSet[Key](), + allVisited, + ); err != nil { + return err + } + } + return nil + } +} + +// TopoSort topologically sorts the nodes in the Graph starting at the given key. +// +// Returns a *CycleError if there is a cycle in the graph. +func (g *Graph[Key]) TopoSort(start Key) ([]Key, error) { + g.init() + results := newOrderedSet[Key]() + if err := g.topoVisit(start, results, newOrderedSet[Key]()); err != nil { + return nil, err + } + return results.keys, nil +} + +// DOTString returns a DOT representation of the graph. +// +// keyToString is used to print out the label for each node. +// https://graphviz.org/doc/info/lang.html +func (g *Graph[Key]) DOTString(keyToString func(Key) string) (string, error) { + keyToIndex := make(map[Key]int) + nextIndex := 1 + var nodeStrings []string + var edgeStrings []string + if err := g.WalkEdges( + func(from Key, to Key) error { + fromIndex, ok := keyToIndex[from] + if !ok { + fromIndex = nextIndex + nextIndex++ + keyToIndex[from] = fromIndex + nodeStrings = append( + nodeStrings, + fmt.Sprintf("%d [label=%q]", fromIndex, keyToString(from)), + ) + } + toIndex, ok := keyToIndex[to] + if !ok { + toIndex = nextIndex + nextIndex++ + keyToIndex[to] = toIndex + nodeStrings = append( + nodeStrings, + fmt.Sprintf("%d [label=%q]", toIndex, keyToString(to)), + ) + } + edgeStrings = append( + edgeStrings, + fmt.Sprintf("%d -> %d", fromIndex, toIndex), + ) + return nil + }, + ); err != nil { + return "", err + } + // We also want to pick up any nodes that do not have edges, and display them. + if err := g.WalkNodes( + func(key Key, inboundEdges []Key, outboundEdges []Key) error { + if _, ok := keyToIndex[key]; ok { + return nil + } + if len(inboundEdges) == 0 && len(outboundEdges) == 0 { + nodeStrings = append( + nodeStrings, + fmt.Sprintf("%d [label=%q]", nextIndex, keyToString(key)), + ) + edgeStrings = append( + edgeStrings, + fmt.Sprintf("%d", nextIndex), + ) + nextIndex++ + return nil + } + // This is a system error. + return fmt.Errorf("got node %v with %d inbound edges and %d outbound edges, but this was not processed during WalkEdges", key, len(inboundEdges), len(outboundEdges)) + }, + ); err != nil { + return "", err + } + if len(nodeStrings) == 0 { + return "digraph {}", nil + } + buffer := bytes.NewBuffer(nil) + _, _ = buffer.WriteString("digraph {\n\n") + for _, nodeString := range nodeStrings { + _, _ = buffer.WriteString(" ") + _, _ = buffer.WriteString(nodeString) + _, _ = buffer.WriteString("\n") + } + _, _ = buffer.WriteString("\n") + for _, edgeString := range edgeStrings { + _, _ = buffer.WriteString(" ") + _, _ = buffer.WriteString(edgeString) + _, _ = buffer.WriteString("\n") + } + _, _ = buffer.WriteString("\n}") + return buffer.String(), nil +} + +func (g *Graph[Key]) init() { + if g.keyToNode == nil { + g.keyToNode = make(map[Key]*node[Key]) + } +} + +func (g *Graph[Key]) getOrAddNode(key Key) *node[Key] { + node, ok := g.keyToNode[key] + if !ok { + node = newNode[Key]() + g.keyToNode[key] = node + g.keys = append(g.keys, key) + } + return node +} + +func (g *Graph[Key]) getSourceKeys() ([]Key, error) { + var sourceKeys []Key + // need to get in deterministic order + for _, key := range g.keys { + node, ok := g.keyToNode[key] + if !ok { + return nil, fmt.Errorf("key not present in keyToNode: %v", key) + } + if len(node.inboundEdgeMap) == 0 { + sourceKeys = append(sourceKeys, key) + } + } + return sourceKeys, nil +} + +func (g *Graph[Key]) edgeVisit( + from Key, + f func(Key, Key) error, + thisSourceVisited *orderedSet[Key], + allSourcesVisited map[Key]struct{}, +) error { + // this is based on this source. we want to make sure we don't + // have any cycles based on starting at a single source. + if !thisSourceVisited.add(from) { + index := thisSourceVisited.index(from) + cycle := append(thisSourceVisited.keys[index:], from) + return &CycleError[Key]{Keys: cycle} + } + // If we visited this from all edge visiting from other + // sources, do nothing, we've evaluated all cycles and visited this + // node properly. It's OK to return here, as we've already checked + // for cycles with thisSourceVisited. + if _, ok := allSourcesVisited[from]; ok { + return nil + } + // Add to the map. We'll be needing this for future iterations. + allSourcesVisited[from] = struct{}{} + + fromNode, ok := g.keyToNode[from] + if !ok { + return fmt.Errorf("key not present: %v", from) + } + for _, to := range fromNode.outboundEdges { + if err := f(from, to); err != nil { + return err + } + if err := g.edgeVisit(to, f, thisSourceVisited.copy(), allSourcesVisited); err != nil { + return err + } + } + + return nil +} + +func (g *Graph[Key]) topoVisit( + from Key, + results *orderedSet[Key], + visited *orderedSet[Key], +) error { + if !visited.add(from) { + index := visited.index(from) + cycle := append(visited.keys[index:], from) + return &CycleError[Key]{Keys: cycle} + } + + fromNode, ok := g.keyToNode[from] + if !ok { + return fmt.Errorf("key not present: %v", from) + } + for _, to := range fromNode.outboundEdges { + if err := g.topoVisit(to, results, visited.copy()); err != nil { + return err + } + } + + results.add(from) + return nil +} + +type node[Key comparable] struct { + outboundEdgeMap map[Key]struct{} + // need to store order for deterministic visits + outboundEdges []Key + inboundEdgeMap map[Key]struct{} + // need to store order for deterministic visits + inboundEdges []Key +} + +func newNode[Key comparable]() *node[Key] { + return &node[Key]{ + outboundEdgeMap: make(map[Key]struct{}), + inboundEdgeMap: make(map[Key]struct{}), + } +} + +func (n *node[Key]) addOutboundEdge(key Key) { + if _, ok := n.outboundEdgeMap[key]; !ok { + n.outboundEdgeMap[key] = struct{}{} + n.outboundEdges = append(n.outboundEdges, key) + } +} + +func (n *node[Key]) addInboundEdge(key Key) { + if _, ok := n.inboundEdgeMap[key]; !ok { + n.inboundEdgeMap[key] = struct{}{} + n.inboundEdges = append(n.inboundEdges, key) + } +} + +type orderedSet[Key comparable] struct { + keyToIndex map[Key]int + keys []Key + length int +} + +func newOrderedSet[Key comparable]() *orderedSet[Key] { + return &orderedSet[Key]{ + keyToIndex: make(map[Key]int), + } +} + +// returns false if already added +func (s *orderedSet[Key]) add(key Key) bool { + if _, ok := s.keyToIndex[key]; !ok { + s.keyToIndex[key] = s.length + s.keys = append(s.keys, key) + s.length++ + return true + } + return false +} + +func (s *orderedSet[Key]) copy() *orderedSet[Key] { + clone := newOrderedSet[Key]() + for _, item := range s.keys { + clone.add(item) + } + return clone +} + +func (s *orderedSet[Key]) index(item Key) int { + index, ok := s.keyToIndex[item] + if ok { + return index + } + return -1 +} diff --git a/pkg/bufman/pkg/dag/dag_test.go b/pkg/bufman/pkg/dag/dag_test.go new file mode 100644 index 000000000..4b15e8830 --- /dev/null +++ b/pkg/bufman/pkg/dag/dag_test.go @@ -0,0 +1,502 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dag + +// Largely adopted from https://github.com/stevenle/topsort, with modifications. +// +// Copyright 2013 Steven Le. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// See https://github.com/stevenle/topsort/blob/master/LICENSE. + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestTopoSort(t *testing.T) { + t.Parallel() + testTopoSortSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("b", "c") + }, + "a", + []string{"c", "b", "a"}, + ) +} + +func TestTopoSort2(t *testing.T) { + t.Parallel() + testTopoSortSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "c") + graph.AddEdge("a", "b") + graph.AddEdge("b", "c") + }, + "a", + []string{"c", "b", "a"}, + ) +} + +func TestTopoSort3(t *testing.T) { + t.Parallel() + testTopoSortSuccess( + t, + func(graph *Graph[string]) { + // e -> b not part of traversal to a on purpose + graph.AddEdge("a", "b") + graph.AddEdge("a", "d") + graph.AddEdge("d", "c") + graph.AddEdge("c", "b") + graph.AddEdge("e", "b") + }, + "a", + []string{"b", "c", "d", "a"}, + ) +} + +func TestTopoSortCycleError(t *testing.T) { + t.Parallel() + testTopoSortCycleError( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("b", "a") + }, + "a", + []string{"a", "b", "a"}, + ) +} + +func TestTopoSortCycleError2(t *testing.T) { + t.Parallel() + testTopoSortCycleError( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("b", "c") + graph.AddEdge("c", "a") + }, + "a", + []string{"a", "b", "c", "a"}, + ) +} + +func TestTopoSortCycleError3(t *testing.T) { + t.Parallel() + testTopoSortCycleError( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("b", "c") + graph.AddEdge("c", "b") + }, + "a", + []string{"b", "c", "b"}, + ) +} + +func TestWalkEdges(t *testing.T) { + t.Parallel() + testWalkEdgesSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("b", "c") + graph.AddEdge("a", "c") + graph.AddEdge("a", "b") + }, + []stringEdge{ + { + From: "a", + To: "c", + }, + { + From: "a", + To: "b", + }, + { + From: "b", + To: "c", + }, + }, + ) +} + +func TestWalkEdges2(t *testing.T) { + t.Parallel() + testWalkEdgesSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("a", "d") + graph.AddEdge("b", "c") + graph.AddEdge("c", "d") + }, + []stringEdge{ + { + From: "a", + To: "b", + }, + { + From: "b", + To: "c", + }, + { + From: "c", + To: "d", + }, + { + From: "a", + To: "d", + }, + }, + ) +} + +func TestWalkEdges3(t *testing.T) { + t.Parallel() + testWalkEdgesSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("a", "d") + graph.AddEdge("b", "c") + graph.AddEdge("c", "d") + graph.AddEdge("e", "b") + }, + []stringEdge{ + { + From: "a", + To: "b", + }, + { + From: "b", + To: "c", + }, + { + From: "c", + To: "d", + }, + { + From: "a", + To: "d", + }, + { + From: "e", + To: "b", + }, + }, + ) +} + +func TestWalkEdgesCycleError(t *testing.T) { + t.Parallel() + testWalkEdgesCycleError( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("a", "d") + graph.AddEdge("b", "c") + graph.AddEdge("c", "d") + graph.AddEdge("e", "b") + graph.AddEdge("d", "b") + }, + []string{"b", "c", "d", "b"}, + ) +} + +func TestWalkEdgesCycleError2(t *testing.T) { + t.Parallel() + testWalkEdgesCycleError( + t, + func(graph *Graph[string]) { + // there are no sources + graph.AddEdge("a", "b") + graph.AddEdge("b", "c") + graph.AddEdge("c", "d") + graph.AddEdge("e", "b") + graph.AddEdge("d", "e") + graph.AddEdge("d", "a") + }, + []string{"b", "c", "d", "e", "b"}, + ) +} + +func TestWalkNodes(t *testing.T) { + t.Parallel() + testWalkNodesSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("a", "d") + graph.AddEdge("b", "c") + graph.AddEdge("c", "d") + graph.AddEdge("e", "b") + graph.AddNode("f") + }, + []stringNode{ + { + Key: "a", + Inbound: []string{}, + Outbound: []string{"b", "d"}, + }, + { + Key: "b", + Inbound: []string{"a", "e"}, + Outbound: []string{"c"}, + }, + { + Key: "d", + Inbound: []string{"a", "c"}, + Outbound: []string{}, + }, + { + Key: "c", + Inbound: []string{"b"}, + Outbound: []string{"d"}, + }, + { + Key: "e", + Inbound: []string{}, + Outbound: []string{"b"}, + }, + { + Key: "f", + Inbound: []string{}, + Outbound: []string{}, + }, + }, + ) +} + +func TestNumNodes(t *testing.T) { + t.Parallel() + testNumNodesSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("a", "d") + graph.AddEdge("b", "c") + graph.AddEdge("c", "d") + graph.AddEdge("e", "b") + graph.AddNode("f") + }, + 6, + ) +} + +func TestNumEdges(t *testing.T) { + t.Parallel() + testNumEdgesSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("a", "d") + graph.AddEdge("b", "c") + graph.AddEdge("c", "d") + graph.AddEdge("e", "b") + graph.AddNode("f") + }, + 5, + ) +} + +func TestDOTString(t *testing.T) { + t.Parallel() + testDOTStringSuccess( + t, + func(graph *Graph[string]) { + graph.AddEdge("a", "b") + graph.AddEdge("a", "d") + graph.AddEdge("b", "c") + graph.AddEdge("c", "d") + graph.AddEdge("e", "b") + graph.AddNode("f") + }, + `digraph { + + 1 [label="a"] + 2 [label="b"] + 3 [label="c"] + 4 [label="d"] + 5 [label="e"] + 6 [label="f"] + + 1 -> 2 + 2 -> 3 + 3 -> 4 + 1 -> 4 + 5 -> 2 + 6 + +}`, + ) +} + +func testTopoSortSuccess( + t *testing.T, + setupGraph func(*Graph[string]), + start string, + expected []string, +) { + graph := &Graph[string]{} + setupGraph(graph) + results, err := graph.TopoSort(start) + require.NoError(t, err) + require.Equal(t, expected, results) +} + +func testTopoSortCycleError( + t *testing.T, + setupGraph func(*Graph[string]), + start string, + expectedCycle []string, +) { + graph := &Graph[string]{} + setupGraph(graph) + _, err := graph.TopoSort(start) + require.Equal( + t, + &CycleError[string]{ + Keys: expectedCycle, + }, + err, + ) +} + +func testWalkEdgesSuccess( + t *testing.T, + setupGraph func(*Graph[string]), + expected []stringEdge, +) { + graph := &Graph[string]{} + setupGraph(graph) + var results []stringEdge + err := graph.WalkEdges( + func(from string, to string) error { + results = append( + results, + stringEdge{ + From: from, + To: to, + }, + ) + return nil + }, + ) + require.NoError(t, err) + require.Equal(t, expected, results) +} + +func testWalkEdgesCycleError( + t *testing.T, + setupGraph func(*Graph[string]), + expectedCycle []string, +) { + graph := &Graph[string]{} + setupGraph(graph) + err := graph.WalkEdges(func(string, string) error { return nil }) + require.Equal( + t, + &CycleError[string]{ + Keys: expectedCycle, + }, + err, + ) +} + +func testWalkNodesSuccess( + t *testing.T, + setupGraph func(*Graph[string]), + expected []stringNode, +) { + graph := &Graph[string]{} + setupGraph(graph) + var results []stringNode + err := graph.WalkNodes( + func(key string, inbound []string, outbound []string) error { + results = append( + results, + stringNode{ + Key: key, + Inbound: inbound, + Outbound: outbound, + }, + ) + return nil + }, + ) + require.NoError(t, err) + require.Equal(t, expected, results) +} + +func testNumNodesSuccess( + t *testing.T, + setupGraph func(*Graph[string]), + expected int, +) { + graph := &Graph[string]{} + setupGraph(graph) + require.Equal(t, expected, graph.NumNodes()) +} + +func testNumEdgesSuccess( + t *testing.T, + setupGraph func(*Graph[string]), + expected int, +) { + graph := &Graph[string]{} + setupGraph(graph) + require.Equal(t, expected, graph.NumEdges()) +} + +func testDOTStringSuccess( + t *testing.T, + setupGraph func(*Graph[string]), + expected string, +) { + graph := &Graph[string]{} + setupGraph(graph) + s, err := graph.DOTString(func(key string) string { return key }) + require.NoError(t, err) + require.Equal(t, expected, s) +} + +type stringEdge struct { + From string + To string +} + +type stringNode struct { + Key string + Inbound []string + Outbound []string +} diff --git a/pkg/bufman/pkg/diff/diff.go b/pkg/bufman/pkg/diff/diff.go new file mode 100644 index 000000000..3e5488659 --- /dev/null +++ b/pkg/bufman/pkg/diff/diff.go @@ -0,0 +1,202 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package diff implements diffing. +// +// Should primarily be used for testing. +package diff + +// Largely copied from https://github.com/golang/go/blob/master/src/cmd/gofmt/gofmt.go +// +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// https://github.com/golang/go/blob/master/LICENSE + +import ( + "bytes" + "context" + "fmt" + "os" + "path/filepath" + "runtime" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" +) + +// Diff does a diff. +// +// Returns nil if no diff. +func Diff( + ctx context.Context, + runner command.Runner, + b1 []byte, + b2 []byte, + filename1 string, + filename2 string, + options ...DiffOption, +) ([]byte, error) { + diffOptions := newDiffOptions() + for _, option := range options { + option(diffOptions) + } + return doDiff( + ctx, + runner, + b1, + b2, + filename1, + filename2, + diffOptions.suppressCommands, + diffOptions.suppressTimestamps, + ) +} + +// DiffOption is an option for Diff. +type DiffOption func(*diffOptions) + +// DiffWithSuppressCommands returns a new DiffOption that suppresses printing of commands. +func DiffWithSuppressCommands() DiffOption { + return func(diffOptions *diffOptions) { + diffOptions.suppressCommands = true + } +} + +// DiffWithSuppressCommands returns a new DiffOption that suppresses printing of timestamps. +func DiffWithSuppressTimestamps() DiffOption { + return func(diffOptions *diffOptions) { + diffOptions.suppressTimestamps = true + } +} + +func doDiff( + ctx context.Context, + runner command.Runner, + b1 []byte, + b2 []byte, + filename1 string, + filename2 string, + suppressCommands bool, + suppressTimestamps bool, +) ([]byte, error) { + if bytes.Equal(b1, b2) { + return nil, nil + } + + f1, err := writeTempFile("", "", b1) + if err != nil { + return nil, err + } + defer func() { + _ = os.Remove(f1) + }() + + f2, err := writeTempFile("", "", b2) + if err != nil { + return nil, err + } + defer func() { + _ = os.Remove(f2) + }() + + binaryPath := "diff" + if runtime.GOOS == "plan9" { + binaryPath = "/bin/ape/diff" + } + + buffer := bytes.NewBuffer(nil) + err = runner.Run( + ctx, + binaryPath, + command.RunWithArgs("-u", f1, f2), + command.RunWithStdout(buffer), + command.RunWithStderr(buffer), + ) + data := buffer.Bytes() + if len(data) > 0 { + // diff exits with a non-zero status when the files don't match. + // Ignore that failure as long as we get output. + return tryModifyHeader(data, filename1, filename2, suppressCommands, suppressTimestamps), nil + } + return nil, err +} + +func writeTempFile(dir string, prefix string, data []byte) (string, error) { + file, err := os.CreateTemp(dir, prefix) + if err != nil { + return "", err + } + if len(data) > 0 { + _, err = file.Write(data) + } + if err1 := file.Close(); err == nil { + err = err1 + } + if err != nil { + _ = os.Remove(file.Name()) + return "", err + } + return file.Name(), nil +} + +func tryModifyHeader( + diff []byte, + filename1 string, + filename2 string, + suppressCommands bool, + suppressTimestamps bool, +) []byte { + bs := bytes.SplitN(diff, []byte{'\n'}, 3) + if len(bs) < 3 { + return diff + } + // Preserve timestamps. + var t0, t1 []byte + if !suppressTimestamps { + if i := bytes.LastIndexByte(bs[0], '\t'); i != -1 { + t0 = bs[0][i:] + } + if i := bytes.LastIndexByte(bs[1], '\t'); i != -1 { + t1 = bs[1][i:] + } + } + // Always print filepath with slash separator. + filename1 = filepath.ToSlash(filename1) + filename2 = filepath.ToSlash(filename2) + if filename1 == filename2 { + filename1 = filename1 + ".orig" + } + bs[0] = []byte(fmt.Sprintf("--- %s%s", filename1, t0)) + bs[1] = []byte(fmt.Sprintf("+++ %s%s", filename2, t1)) + if !suppressCommands { + bs = append( + [][]byte{ + []byte(fmt.Sprintf("diff -u %s %s", filename1, filename2)), + }, + bs..., + ) + } + return bytes.Join(bs, []byte{'\n'}) +} + +type diffOptions struct { + suppressCommands bool + suppressTimestamps bool +} + +func newDiffOptions() *diffOptions { + return &diffOptions{} +} diff --git a/pkg/bufman/pkg/diff/diffmyers/diffmyers.go b/pkg/bufman/pkg/diff/diffmyers/diffmyers.go new file mode 100644 index 000000000..354ad7bf8 --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/diffmyers.go @@ -0,0 +1,275 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package diffmyers + +import ( + "bytes" + "errors" + "fmt" +) + +// EditKind is the kind of edit. +type EditKind int + +const ( + // EditKindDelete is a delete. + EditKindDelete EditKind = iota + 1 + // EditKindInsert is an insert. + EditKindInsert +) + +// Edit is an delete or insert operation. +type Edit struct { + // Kind is the kind of edit. It is either an insert or a delete. + Kind EditKind + // FromPosition is the line to edit in the original sequence. + FromPosition int + // ToPosition is the line in the new sequence. It is only valid for + // inserts. + ToPosition int +} + +// Diff does a diff. It returns a [[]Edit] which when applied to the original +// sequence will result in the new sequence. +// +// The algorithm is based on the paper "An O(ND) Difference Algorithm and Its +// Variations" by Eugene W. Myers. The paper is available at https://citeseerx.ist.psu.edu/doc/10.1.1.4.6927. +// +// It implements the linear space refinement of the algorithm described in section 4b. This is the +// same algorithm used by git. +func Diff(from, to [][]byte) []Edit { + return shortestEdits(from, to, 0, 0) +} + +// Print prints the edits in the unified diff format without the header. +// +// Ref: https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html +func Print(from, to [][]byte, edits []Edit) ([]byte, error) { + const contextThreshold = 2 + type printLine struct { + EditKind EditKind + line []byte + hunk bool + } + // If the last line of from is not a newline append one. + if len(from) > 0 && from[len(from)-1] != nil { + last := from[len(from)-1] + if last[len(last)-1] != '\n' { + from[len(from)-1] = append(last, '\n') + } + } + // We preallocate the slice to avoid reallocations. + // + // Each edit is either a delete or an insert so the total number of lines + // in the diff is the number of edits plus the number of lines in the + // original sequence. The worst case for the hunk headers are + // as many edits. + out := make([]*printLine, 0, len(from)+2*len(edits)) + var fromIndex, toIndex, bufferSize int + for i := 0; i < len(edits); i++ { + // Remember the start of the hunk. We add 1 to the indexes because + // we want to print the line number and they start at 1. + hunkOldStart := fromIndex + 1 + hunkNewStart := toIndex + 1 + // Reserve the space for the hunk header. + hunk := &printLine{hunk: true} + out = append(out, hunk) + var ( + insertCount, deleteCount int + printHunk bool + ) + // Print the lines in the edit. + for j := i; j < len(edits); j++ { + // Print the lines before the edit. + var advance int + for _, line := range from[fromIndex:edits[i].FromPosition] { + out = append(out, &printLine{line: line}) + bufferSize += len(line) + 1 + advance++ + } + // Advance the indexes. + toIndex += advance + fromIndex += advance + insertCount += advance + deleteCount += advance + if advance > contextThreshold { + i-- + break + } + printHunk = true + switch edits[j].Kind { + case EditKindDelete: + deleteCount++ + fromIndex++ + out = append(out, &printLine{ + EditKind: EditKindDelete, + line: from[edits[j].FromPosition], + }) + case EditKindInsert: + insertCount++ + toIndex++ + out = append(out, &printLine{ + EditKind: EditKindInsert, + line: to[edits[j].ToPosition], + }) + default: + return nil, errors.New("unknown edit kind") + } + bufferSize += len(out[len(out)-1].line) + 1 + i++ + } + if printHunk { + // Print the hunk header. + hunk.line = []byte(fmt.Sprintf("@@ -%d,%d +%d,%d @@\n", hunkOldStart, deleteCount, hunkNewStart, insertCount)) + bufferSize += len(hunk.line) + 1 + } + } + // Print the lines after the last edit. + for _, line := range from[fromIndex:] { + out = append(out, &printLine{line: line}) + bufferSize += len(line) + 1 + } + var buffer bytes.Buffer + buffer.Grow(bufferSize) + for _, line := range out { + if line.hunk && len(line.line) > 0 { + buffer.Write(line.line) + continue + } + switch line.EditKind { + case EditKindDelete: + buffer.WriteByte('-') + case EditKindInsert: + buffer.WriteByte('+') + default: + buffer.WriteByte(' ') + } + buffer.Write(line.line) + } + return buffer.Bytes(), nil +} + +func shortestEdits(from, to [][]byte, fromOffset, toOffset int) []Edit { + n, m := len(from), len(to) + if m == 0 { // We've reached the end of the 'to' sequence. So delete the rest of the 'from' sequence. + edits := make([]Edit, len(from)) + for i := range from { + edits[i] = Edit{ + Kind: EditKindDelete, + FromPosition: fromOffset + i, + } + } + return edits + } + if n == 0 { // We've reached the end of the 'from' sequence. So insert the rest of the 'to' sequence. + edits := make([]Edit, len(to)) + for i := range to { + edits[i] = Edit{ + Kind: EditKindInsert, + FromPosition: fromOffset, + ToPosition: toOffset + i, + } + } + return edits + } + d, x, y, u, v := findMiddleSnake(from, to) + if d > 1 || x != u && y != v { + return append(shortestEdits(from[:x], to[:y], fromOffset, toOffset), shortestEdits(from[u:], to[v:], fromOffset+u, toOffset+v)...) + } + if m > n { + return shortestEdits(nil, to[n:m], fromOffset+n, toOffset+n) + } + if m < n { + return shortestEdits(from[m:n], nil, fromOffset+m, toOffset+m) + } + return nil +} + +// returns the length, starting and ending points of the middle snake. +// +// This is based on the pseudo code in page 11. This deliberately deviates from +// the style of using descriptive variables names to ease comparison with the +// pseudo code and variable names in the paper. +func findMiddleSnake(from, to [][]byte) (d int, x int, y int, u int, v int) { + n, m := len(from), len(to) + maxD := ceiledHalf(n + m) + // We need to allocate 2*maxD+1 because k can go from -maxD to maxD. + // Wherever we access them we just offset by maxD. + vf := make([]int, 2*maxD+1) + vb := make([]int, 2*maxD+1) + for i := 0; i < len(vf); i++ { + vf[i] = -1 + vb[i] = -1 + } + vf[1+maxD] = 0 + vb[1+maxD] = 0 + delta := n - m + for d := 0; d <= maxD; d++ { + for k := -d; k <= d; k += 2 { // Forward snake + var x int + // We prefer deletions over insertions. + if k == -d || (k != d && vf[k-1+maxD] < vf[k+1+maxD]) { + x = vf[k+1+maxD] + } else { + x = vf[k-1+maxD] + 1 + } + y := x - k + // Initial point + xi := x + yi := y + // Move diagonally as far as possible. + for x < n && y < m && bytes.Equal(from[x], to[y]) { + x++ + y++ + } + vf[k+maxD] = x + if (delta&1 == 1) && -(k-delta) >= -(d-1) && -(k-delta) <= (d-1) && vb[(-(k-delta))+maxD] != -1 { + if x+vb[(-(k-delta))+maxD] >= n { + return 2*d - 1, xi, yi, x, y + } + } + } + for k := -d; k <= d; k += 2 { // Backward snake + var x int + if k == -d || (k != d && vb[k-1+maxD] < vb[k+1+maxD]) { + x = vb[k+1+maxD] + } else { + x = vb[k-1+maxD] + 1 + } + y := x - k + xi := x + yi := y + for x < n && y < m && bytes.Equal(from[n-x-1], to[m-y-1]) { + x++ + y++ + } + vb[k+maxD] = x + if (delta&1 == 0) && -(k-delta) >= -d && -(k-delta) <= d && vf[(-(k-delta))+maxD] != -1 { + if x+vf[(-(k-delta))+maxD] >= n { + return 2 * d, n - x, m - y, n - xi, m - yi + } + } + } + } + return -1, -1, -1, -1, -1 +} + +func ceiledHalf(n int) int { + if n%2 == 0 { + return n / 2 + } + return n/2 + 1 +} diff --git a/pkg/bufman/pkg/diff/diffmyers/diffmyers_test.go b/pkg/bufman/pkg/diff/diffmyers/diffmyers_test.go new file mode 100644 index 000000000..c71cc1b80 --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/diffmyers_test.go @@ -0,0 +1,231 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package diffmyers_test + +import ( + "bytes" + "os" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/diff/diffmyers" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +const writeGoldenFiles = false + +func TestDiff(t *testing.T) { + t.Parallel() + t.Run("delete-and-insert", func(t *testing.T) { + t.Parallel() + const from = "Hello, world!\n" + const to = "Goodbye, world!\n" + edits := diffmyers.Diff( + splitLines(from), + splitLines(to), + ) + assert.Equal(t, edits, []diffmyers.Edit{ + { + Kind: diffmyers.EditKindDelete, + }, + { + Kind: diffmyers.EditKindInsert, + FromPosition: 1, + }, + }) + testPrint(t, from, to, edits, "delete-and-insert") + }) + t.Run("insert-one", func(t *testing.T) { + t.Parallel() + const from = "Hello, world!\n" + const to = "Hello, world!\nGoodbye, world!\n" + edits := diffmyers.Diff( + splitLines(from), + splitLines(to), + ) + assert.Equal(t, edits, []diffmyers.Edit{ + { + Kind: diffmyers.EditKindInsert, + FromPosition: 1, + ToPosition: 1, + }, + }) + testPrint(t, from, to, edits, "insert") + }) + t.Run("delete-one", func(t *testing.T) { + t.Parallel() + const from = "Hello, world!\nGoodbye, world!\n" + const to = "Hello, world!\n" + edits := diffmyers.Diff( + splitLines(from), + splitLines(to), + ) + assert.Equal(t, edits, []diffmyers.Edit{ + { + Kind: diffmyers.EditKindDelete, + FromPosition: 1, + }, + }) + testPrint(t, from, to, edits, "delete") + }) + t.Run("create-file", func(t *testing.T) { + t.Parallel() + const from = "" + const to = "Hello, world!\n" + edits := diffmyers.Diff( + splitLines(from), + splitLines(to), + ) + assert.Equal(t, edits, []diffmyers.Edit{ + { + Kind: diffmyers.EditKindInsert, + FromPosition: 0, + ToPosition: 0, + }, + }) + testPrint(t, from, to, edits, "create") + }) + t.Run("remove", func(t *testing.T) { + t.Parallel() + const from = "Hello, world!\n" + const to = "" + edits := diffmyers.Diff( + splitLines(from), + splitLines(to), + ) + assert.Equal(t, edits, []diffmyers.Edit{ + { + Kind: diffmyers.EditKindDelete, + FromPosition: 0, + }, + }) + testPrint(t, from, to, edits, "remove") + }) + t.Run("equal", func(t *testing.T) { + t.Parallel() + const from = "Hello, world!\n" + const to = "Hello, world!\n" + edits := diffmyers.Diff( + splitLines(from), + splitLines(to), + ) + assert.Len(t, edits, 0) + testPrint(t, from, to, edits, "equal") + }) + // The example from https://www.gnu.org/software/diffutils/manual/html_node/Sample-diff-Input.html + t.Run("lao-tzu", func(t *testing.T) { + t.Parallel() + const lao = `The Way that can be told of is not the eternal Way; +The name that can be named is not the eternal name. +The Nameless is the origin of Heaven and Earth; +The Named is the mother of all things. +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their outcome. +The two are the same, +But after they are produced, + they have different names. +` + const tzu = `The Nameless is the origin of Heaven and Earth; +The named is the mother of all things. + +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their outcome. +The two are the same, +But after they are produced, + they have different names. +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! +` + edits := diffmyers.Diff( + splitLines(lao), + splitLines(tzu), + ) + assert.Equal(t, + []diffmyers.Edit{ + { + Kind: diffmyers.EditKindDelete, + }, + { + Kind: diffmyers.EditKindDelete, + FromPosition: 1, + }, + { + Kind: diffmyers.EditKindDelete, + FromPosition: 3, + }, + { + Kind: diffmyers.EditKindInsert, + FromPosition: 4, + ToPosition: 1, + }, + { + Kind: diffmyers.EditKindInsert, + FromPosition: 4, + ToPosition: 2, + }, + { + Kind: diffmyers.EditKindInsert, + FromPosition: 11, + ToPosition: 10, + }, + { + Kind: diffmyers.EditKindInsert, + FromPosition: 11, + ToPosition: 11, + }, + { + Kind: diffmyers.EditKindInsert, + FromPosition: 11, + ToPosition: 12, + }, + }, + edits, + ) + testPrint(t, lao, tzu, edits, "lao-tzu") + }) +} + +func testPrint(t *testing.T, from, to string, edits []diffmyers.Edit, golden string) { + t.Run("print", func(t *testing.T) { + diff, err := diffmyers.Print( + splitLines(from), + splitLines(to), + edits, + ) + require.NoError(t, err) + goldenFilePath := filepath.Join("testdata", golden) + if writeGoldenFiles { + require.NoError(t, os.WriteFile(goldenFilePath, diff, os.ModePerm)) + } + diffGolden, err := os.ReadFile(goldenFilePath) + require.NoError(t, err) + assert.Equal(t, string(diff), string(diffGolden)) + }) +} + +func splitLines(s string) [][]byte { + lines := bytes.SplitAfter([]byte(s), []byte("\n")) + if len(lines[len(lines)-1]) == 0 { + lines = lines[:len(lines)-1] + } + return lines +} diff --git a/pkg/bufman/pkg/diff/diffmyers/testdata/create b/pkg/bufman/pkg/diff/diffmyers/testdata/create new file mode 100644 index 000000000..cd27e91c8 --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/testdata/create @@ -0,0 +1,2 @@ +@@ -1,0 +1,1 @@ ++Hello, world! diff --git a/pkg/bufman/pkg/diff/diffmyers/testdata/delete b/pkg/bufman/pkg/diff/diffmyers/testdata/delete new file mode 100644 index 000000000..4aa8de452 --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/testdata/delete @@ -0,0 +1,3 @@ +@@ -1,2 +1,1 @@ + Hello, world! +-Goodbye, world! diff --git a/pkg/bufman/pkg/diff/diffmyers/testdata/delete-and-insert b/pkg/bufman/pkg/diff/diffmyers/testdata/delete-and-insert new file mode 100644 index 000000000..f4d5a7261 --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/testdata/delete-and-insert @@ -0,0 +1,3 @@ +@@ -1,1 +1,1 @@ +-Hello, world! ++Goodbye, world! diff --git a/pkg/bufman/pkg/diff/diffmyers/testdata/equal b/pkg/bufman/pkg/diff/diffmyers/testdata/equal new file mode 100644 index 000000000..f0b8c249e --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/testdata/equal @@ -0,0 +1 @@ + Hello, world! diff --git a/pkg/bufman/pkg/diff/diffmyers/testdata/insert b/pkg/bufman/pkg/diff/diffmyers/testdata/insert new file mode 100644 index 000000000..7f45cf7b6 --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/testdata/insert @@ -0,0 +1,3 @@ +@@ -1,1 +1,2 @@ + Hello, world! ++Goodbye, world! diff --git a/pkg/bufman/pkg/diff/diffmyers/testdata/lao-tzu b/pkg/bufman/pkg/diff/diffmyers/testdata/lao-tzu new file mode 100644 index 000000000..2bb72c35b --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/testdata/lao-tzu @@ -0,0 +1,18 @@ +@@ -1,11 +1,10 @@ +-The Way that can be told of is not the eternal Way; +-The name that can be named is not the eternal name. + The Nameless is the origin of Heaven and Earth; +-The Named is the mother of all things. ++The named is the mother of all things. ++ + Therefore let there always be non-being, + so we may see their subtlety, + And let there always be being, + so we may see their outcome. + The two are the same, + But after they are produced, + they have different names. +@@ -12,0 +11,3 @@ ++They both may be called deep and profound. ++Deeper and more profound, ++The door of all subtleties! diff --git a/pkg/bufman/pkg/diff/diffmyers/testdata/remove b/pkg/bufman/pkg/diff/diffmyers/testdata/remove new file mode 100644 index 000000000..70bd784bb --- /dev/null +++ b/pkg/bufman/pkg/diff/diffmyers/testdata/remove @@ -0,0 +1,2 @@ +@@ -1,1 +1,0 @@ +-Hello, world! diff --git a/pkg/bufman/pkg/encoding/encoding.go b/pkg/bufman/pkg/encoding/encoding.go new file mode 100644 index 000000000..f7c025b5d --- /dev/null +++ b/pkg/bufman/pkg/encoding/encoding.go @@ -0,0 +1,203 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package encoding provides encoding utilities. +package encoding + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "strings" + + "go.uber.org/multierr" + "gopkg.in/yaml.v3" +) + +// UnmarshalJSONStrict unmarshals the data as JSON, returning a user error on failure. +// +// If the data length is 0, this is a no-op. +func UnmarshalJSONStrict(data []byte, v interface{}) error { + if len(data) == 0 { + return nil + } + jsonDecoder := json.NewDecoder(bytes.NewReader(data)) + jsonDecoder.DisallowUnknownFields() + if err := jsonDecoder.Decode(v); err != nil { + return fmt.Errorf("could not unmarshal as JSON: %v", err) + } + return nil +} + +// UnmarshalYAMLStrict unmarshals the data as YAML, returning a user error on failure. +// +// If the data length is 0, this is a no-op. +func UnmarshalYAMLStrict(data []byte, v interface{}) error { + if len(data) == 0 { + return nil + } + yamlDecoder := NewYAMLDecoderStrict(bytes.NewReader(data)) + if err := yamlDecoder.Decode(v); err != nil { + return fmt.Errorf("could not unmarshal as YAML: %v", err) + } + return nil +} + +// UnmarshalJSONOrYAMLStrict unmarshals the data as JSON or YAML in order, returning +// a user error with both errors on failure. +// +// If the data length is 0, this is a no-op. +func UnmarshalJSONOrYAMLStrict(data []byte, v interface{}) error { + if len(data) == 0 { + return nil + } + if jsonErr := UnmarshalJSONStrict(data, v); jsonErr != nil { + if yamlErr := UnmarshalYAMLStrict(data, v); yamlErr != nil { + return errors.New(jsonErr.Error() + "\n" + yamlErr.Error()) + } + } + return nil +} + +// UnmarshalJSONNonStrict unmarshals the data as JSON, returning a user error on failure. +// +// If the data length is 0, this is a no-op. +func UnmarshalJSONNonStrict(data []byte, v interface{}) error { + if len(data) == 0 { + return nil + } + jsonDecoder := json.NewDecoder(bytes.NewReader(data)) + if err := jsonDecoder.Decode(v); err != nil { + return fmt.Errorf("could not unmarshal as JSON: %v", err) + } + return nil +} + +// UnmarshalYAMLNonStrict unmarshals the data as YAML, returning a user error on failure. +// +// If the data length is 0, this is a no-op. +func UnmarshalYAMLNonStrict(data []byte, v interface{}) error { + if len(data) == 0 { + return nil + } + yamlDecoder := NewYAMLDecoderNonStrict(bytes.NewReader(data)) + if err := yamlDecoder.Decode(v); err != nil { + return fmt.Errorf("could not unmarshal as YAML: %v", err) + } + return nil +} + +// UnmarshalJSONOrYAMLNonStrict unmarshals the data as JSON or YAML in order, returning +// a user error with both errors on failure. +// +// If the data length is 0, this is a no-op. +func UnmarshalJSONOrYAMLNonStrict(data []byte, v interface{}) error { + if len(data) == 0 { + return nil + } + if jsonErr := UnmarshalJSONNonStrict(data, v); jsonErr != nil { + if yamlErr := UnmarshalYAMLNonStrict(data, v); yamlErr != nil { + return multierr.Append(jsonErr, yamlErr) + } + } + return nil +} + +// GetJSONStringOrStringValue returns the JSON string for the RawMessage if the +// RawMessage is a string, and the raw value as a string otherwise. +// +// If the RawMessage is empty, this returns "". +func GetJSONStringOrStringValue(rawMessage json.RawMessage) string { + if len(rawMessage) == 0 { + return "" + } + var s string + if err := json.Unmarshal(rawMessage, &s); err == nil { + return s + } + return string(rawMessage) +} + +// MarshalYAML marshals the given value into YAML. +func MarshalYAML(v interface{}) (_ []byte, retErr error) { + buffer := bytes.NewBuffer(nil) + yamlEncoder := NewYAMLEncoder(buffer) + defer func() { + retErr = multierr.Append(retErr, yamlEncoder.Close()) + }() + if err := yamlEncoder.Encode(v); err != nil { + return nil, err + } + return buffer.Bytes(), nil +} + +// NewYAMLEncoder creates a new YAML encoder reader from the Writer. +// The encoder must be closed after use. +func NewYAMLEncoder(writer io.Writer) *yaml.Encoder { + yamlEncoder := yaml.NewEncoder(writer) + yamlEncoder.SetIndent(2) + return yamlEncoder +} + +// NewYAMLDecoderStrict creates a new YAML decoder from the reader. +func NewYAMLDecoderStrict(reader io.Reader) *yaml.Decoder { + yamlDecoder := yaml.NewDecoder(reader) + yamlDecoder.KnownFields(true) + return yamlDecoder +} + +// NewYAMLDecoderNonStrict creates a new YAML decoder from the reader. +func NewYAMLDecoderNonStrict(reader io.Reader) *yaml.Decoder { + return yaml.NewDecoder(reader) +} + +// InterfaceSliceOrStringToCommaSepString parses the input as a +// slice or string into a comma separated string. This is commonly +// used with JSON or YAML fields that need to support both string slices +// and string literals. +func InterfaceSliceOrStringToCommaSepString(in interface{}) (string, error) { + values, err := InterfaceSliceOrStringToStringSlice(in) + if err != nil { + return "", err + } + return strings.Join(values, ","), nil +} + +func InterfaceSliceOrStringToStringSlice(in interface{}) ([]string, error) { + if in == nil { + return nil, nil + } + switch t := in.(type) { + case string: + return []string{t}, nil + case []interface{}: + if len(t) == 0 { + return nil, nil + } + res := make([]string, len(t)) + for i, elem := range t { + s, ok := elem.(string) + if !ok { + return nil, fmt.Errorf("could not convert element %T to a string", elem) + } + res[i] = s + } + return res, nil + default: + return nil, fmt.Errorf("could not interpret %T as string or string slice", in) + } +} diff --git a/pkg/bufman/pkg/encoding/encoding_test.go b/pkg/bufman/pkg/encoding/encoding_test.go new file mode 100644 index 000000000..ee0bf1358 --- /dev/null +++ b/pkg/bufman/pkg/encoding/encoding_test.go @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package encoding + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestInterfaceSliceOrStringToCommaSepString(t *testing.T) { + t.Parallel() + testInterfaceSliceOrStringToCommaSepString(t, "mystring", "mystring") + testInterfaceSliceOrStringToCommaSepString( + t, + []interface{}{ + interface{}("mystring"), + interface{}("mystring2"), + }, + "mystring,mystring2", + ) + testInterfaceSliceOrStringToCommaSepString(t, nil, "") + + _, err := InterfaceSliceOrStringToCommaSepString(1) + require.Error(t, err) +} + +func testInterfaceSliceOrStringToCommaSepString(t *testing.T, in interface{}, expected string) { + v, err := InterfaceSliceOrStringToCommaSepString(in) + require.NoError(t, err) + require.Equal(t, expected, v) +} diff --git a/pkg/bufman/pkg/filelock/filelock.go b/pkg/bufman/pkg/filelock/filelock.go new file mode 100644 index 000000000..01a110bc9 --- /dev/null +++ b/pkg/bufman/pkg/filelock/filelock.go @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package filelock + +import ( + "context" + "time" +) + +const ( + // DefaultLockTimeout is the default lock timeout. + DefaultLockTimeout = 3 * time.Second + // DefaultLockRetryDelay is the default lock retry delay. + DefaultLockRetryDelay = 200 * time.Millisecond +) + +// Unlocker unlocks a file lock. +type Unlocker interface { + Unlock() error +} + +// Lock locks a file lock. +// +// Use in cases where you need a lock for a specific system file, such as in testing, +// otherwise use a Locker to manage your file locks. +func Lock(ctx context.Context, filePath string, options ...LockOption) (Unlocker, error) { + return lock(ctx, filePath, options...) +} + +// RLock read-locks a file lock. +// +// Use in cases where you need a lock for a specific system file, such as in testing, +// otherwise use a Locker to manage your file locks. +func RLock(ctx context.Context, filePath string, options ...LockOption) (Unlocker, error) { + return rlock(ctx, filePath, options...) +} + +// Locker provides file locks. +type Locker interface { + // Lock locks a file lock within the root directory of the Locker. + // + // The given path must be normalized and relative. + Lock(ctx context.Context, path string, options ...LockOption) (Unlocker, error) + // RLock read-locks a file lock within the root directory of the Locker. + // + // The given path must be normalized and relative. + RLock(ctx context.Context, path string, options ...LockOption) (Unlocker, error) +} + +// NewLocker returns a new Locker for the given root directory path. +// +// The root directory path should generally be a data directory path. +// The root directory must exist. +func NewLocker(rootDirPath string) (Locker, error) { + return newLocker(rootDirPath) +} + +// LockOption is an option for lock. +type LockOption func(*lockOptions) + +// LockWithTimeout returns a new LockOption that sets the lock timeout. +// +// Lock returns error if the lock cannot be acquired after this amount of time. +// If this is set to 0, the lock will never timeout. +func LockWithTimeout(timeout time.Duration) LockOption { + return func(lockOptions *lockOptions) { + lockOptions.timeout = timeout + } +} + +// LockWithRetryDelay returns a new LockOption that sets the lock retry delay. +// +// Lock will try to lock on this delay up until the lock timeout. +func LockWithRetryDelay(retryDelay time.Duration) LockOption { + return func(lockOptions *lockOptions) { + lockOptions.retryDelay = retryDelay + } +} + +// NewNopLocker returns a new no-op Locker. +func NewNopLocker() Locker { + return newNopLocker() +} diff --git a/pkg/bufman/pkg/filelock/filelock_test.go b/pkg/bufman/pkg/filelock/filelock_test.go new file mode 100644 index 000000000..70b4d5660 --- /dev/null +++ b/pkg/bufman/pkg/filelock/filelock_test.go @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package filelock + +import ( + "context" + "path/filepath" + "runtime" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestGlobalBasic(t *testing.T) { + t.Parallel() + ctx := context.Background() + tempDirPath := t.TempDir() + filePath := filepath.Join(tempDirPath, "path/to/lock") + unlocker, err := Lock(ctx, filePath) + require.NoError(t, err) + _, err = Lock(ctx, filePath, LockWithTimeout(100*time.Millisecond), LockWithRetryDelay(10*time.Millisecond)) + require.Error(t, err) + require.NoError(t, unlocker.Unlock()) + unlocker, err = Lock(ctx, filePath, LockWithTimeout(100*time.Millisecond), LockWithRetryDelay(10*time.Millisecond)) + require.NoError(t, err) + require.NoError(t, unlocker.Unlock()) + unlocker, err = RLock(ctx, filePath) + require.NoError(t, err) + unlocker2, err := RLock(ctx, filePath) + require.NoError(t, err) + _, err = Lock(ctx, filePath, LockWithTimeout(100*time.Millisecond), LockWithRetryDelay(10*time.Millisecond)) + require.Error(t, err) + require.NoError(t, unlocker.Unlock()) + require.NoError(t, unlocker2.Unlock()) +} + +func TestLockerBasic(t *testing.T) { + t.Parallel() + ctx := context.Background() + tempDirPath := t.TempDir() + filePath := "path/to/lock" + locker, err := NewLocker(tempDirPath) + require.NoError(t, err) + unlocker, err := locker.Lock(ctx, filePath) + require.NoError(t, err) + _, err = locker.Lock(ctx, filePath, LockWithTimeout(100*time.Millisecond), LockWithRetryDelay(10*time.Millisecond)) + require.Error(t, err) + require.NoError(t, unlocker.Unlock()) + unlocker, err = locker.Lock(ctx, filePath, LockWithTimeout(100*time.Millisecond), LockWithRetryDelay(10*time.Millisecond)) + require.NoError(t, err) + require.NoError(t, unlocker.Unlock()) + unlocker, err = locker.RLock(ctx, filePath) + require.NoError(t, err) + unlocker2, err := locker.RLock(ctx, filePath) + require.NoError(t, err) + _, err = locker.Lock(ctx, filePath, LockWithTimeout(100*time.Millisecond), LockWithRetryDelay(10*time.Millisecond)) + require.Error(t, err) + require.NoError(t, unlocker.Unlock()) + require.NoError(t, unlocker2.Unlock()) + absolutePath := "/not/normalized/and/validated" + if runtime.GOOS == "windows" { + absolutePath = "C:\\not\\normalized\\and\\validated" + } + _, err = locker.Lock(ctx, absolutePath) + require.Error(t, err) +} diff --git a/pkg/bufman/pkg/filelock/lock.go b/pkg/bufman/pkg/filelock/lock.go new file mode 100644 index 000000000..ab52673a4 --- /dev/null +++ b/pkg/bufman/pkg/filelock/lock.go @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package filelock + +import ( + "context" + "fmt" + "os" + "path/filepath" + "time" + + "github.com/gofrs/flock" +) + +func lock( + ctx context.Context, + filePath string, + options ...LockOption, +) (Unlocker, error) { + return lockForFunc( + ctx, + filePath, + (*flock.Flock).TryLockContext, + options..., + ) +} + +func rlock( + ctx context.Context, + filePath string, + options ...LockOption, +) (Unlocker, error) { + return lockForFunc( + ctx, + filePath, + (*flock.Flock).TryRLockContext, + options..., + ) +} + +func lockForFunc( + ctx context.Context, + filePath string, + tryLockContextFunc func(*flock.Flock, context.Context, time.Duration) (bool, error), + options ...LockOption, +) (Unlocker, error) { + lockOptions := newLockOptions() + for _, option := range options { + option(lockOptions) + } + // mkdir is an atomic operation + if err := os.MkdirAll(filepath.Dir(filePath), 0o755); err != nil { + return nil, err + } + var cancel context.CancelFunc + if lockOptions.timeout != 0 { + ctx, cancel = context.WithTimeout(ctx, lockOptions.timeout) + defer cancel() + } + flock := flock.New(filePath) + locked, err := tryLockContextFunc(flock, ctx, lockOptions.retryDelay) + if err != nil { + return nil, fmt.Errorf("could not get file lock %q: %w", filePath, err) + } + if !locked { + return nil, fmt.Errorf("could not lock %q", filePath) + } + return flock, nil +} + +type lockOptions struct { + timeout time.Duration + retryDelay time.Duration +} + +func newLockOptions() *lockOptions { + return &lockOptions{ + timeout: DefaultLockTimeout, + retryDelay: DefaultLockRetryDelay, + } +} diff --git a/pkg/bufman/pkg/filelock/locker.go b/pkg/bufman/pkg/filelock/locker.go new file mode 100644 index 000000000..9b3deed9e --- /dev/null +++ b/pkg/bufman/pkg/filelock/locker.go @@ -0,0 +1,77 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package filelock + +import ( + "context" + "fmt" + "os" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +type locker struct { + rootDirPath string +} + +func newLocker(rootDirPath string) (*locker, error) { + // allow symlinks + fileInfo, err := os.Stat(normalpath.Unnormalize(rootDirPath)) + if err != nil { + return nil, err + } + if !fileInfo.IsDir() { + return nil, fmt.Errorf("%q is not a directory", rootDirPath) + } + return &locker{ + // do not validate - allow anything including absolute paths and jumping context + rootDirPath: normalpath.Normalize(rootDirPath), + }, nil +} + +func (l *locker) Lock(ctx context.Context, path string, options ...LockOption) (Unlocker, error) { + if err := validatePath(path); err != nil { + return nil, err + } + return lock( + ctx, + normalpath.Unnormalize(normalpath.Join(l.rootDirPath, path)), + options..., + ) +} + +func (l *locker) RLock(ctx context.Context, path string, options ...LockOption) (Unlocker, error) { + if err := validatePath(path); err != nil { + return nil, err + } + return rlock( + ctx, + normalpath.Unnormalize(normalpath.Join(l.rootDirPath, path)), + options..., + ) +} + +func validatePath(path string) error { + normalPath, err := normalpath.NormalizeAndValidate(path) + if err != nil { + return err + } + if path != normalPath { + // just extra safety + return fmt.Errorf("expected file lock path %q to be equal to normalized path %q", path, normalPath) + } + return nil +} diff --git a/pkg/bufman/pkg/filelock/nop_locker.go b/pkg/bufman/pkg/filelock/nop_locker.go new file mode 100644 index 000000000..c4cc0197b --- /dev/null +++ b/pkg/bufman/pkg/filelock/nop_locker.go @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package filelock + +import ( + "context" +) + +type nopLocker struct{} + +func newNopLocker() *nopLocker { + return &nopLocker{} +} + +func (l *nopLocker) Lock(ctx context.Context, path string, options ...LockOption) (Unlocker, error) { + return newNopUnlocker(), nil +} + +func (l *nopLocker) RLock(ctx context.Context, path string, options ...LockOption) (Unlocker, error) { + return newNopUnlocker(), nil +} diff --git a/pkg/bufman/pkg/filelock/nop_unlocker.go b/pkg/bufman/pkg/filelock/nop_unlocker.go new file mode 100644 index 000000000..4a416005f --- /dev/null +++ b/pkg/bufman/pkg/filelock/nop_unlocker.go @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package filelock + +type nopUnlocker struct{} + +func newNopUnlocker() *nopUnlocker { + return &nopUnlocker{} +} + +func (l *nopUnlocker) Unlock() error { + return nil +} diff --git a/pkg/bufman/pkg/filepathextended/filepathextended.go b/pkg/bufman/pkg/filepathextended/filepathextended.go new file mode 100644 index 000000000..c4d4d7a5a --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/filepathextended.go @@ -0,0 +1,221 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package filepathextended provides filepath utilities. +package filepathextended + +// Walking largely copied from https://github.com/golang/go/blob/master/src/path/filepath/path.go +// +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// https://github.com/golang/go/blob/master/LICENSE + +import ( + "os" + "path/filepath" + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/osextended" + "go.uber.org/multierr" +) + +// RealClean does filepath.Clean and filepath.FromSlash, +// but also handles ..'s in relative paths relative to the +// current working directory. +// +// As an example, if we are in proto, and we pass in +// ../proto/foo, RealClean will return foo. +func RealClean(path string) (string, error) { + path = filepath.Clean(filepath.FromSlash(path)) + if !filepath.IsAbs(path) { + absPath, err := filepath.Abs(path) + if err != nil { + return "", err + } + pwd, err := osextended.Getwd() + if err != nil { + return "", err + } + if relPath, err := filepath.Rel(pwd, absPath); err == nil { + return relPath, nil + } + } + return path, nil +} + +// Walk walks the walkPath. +// +// This is analogous to filepath.Walk, but optionally follows symlinks. +func Walk(walkPath string, walkFunc filepath.WalkFunc, options ...WalkOption) (retErr error) { + defer func() { + // If we end up with a SkipDir, this isn't an error. + if retErr == filepath.SkipDir { + retErr = nil + } + }() + walkOptions := newWalkOptions() + for _, option := range options { + option(walkOptions) + } + // os.Lstat does not follow symlinks, while os.Stat does. + fileInfo, err := os.Lstat(walkPath) + if err != nil { + // If we have an error, then we still walk to call walkFunc with the error. + return walkFunc(walkPath, nil, err) + } + resolvedPath, fileInfo, err := optionallyEvaluateSymlink(walkPath, fileInfo, walkOptions.symlinks) + if err != nil { + // If we have an error, then we still walk to call walkFunc with the error. + return walkFunc(walkPath, nil, err) + } + return walk(walkPath, resolvedPath, fileInfo, walkFunc, make(map[string]struct{}), walkOptions.symlinks) +} + +// WalkOption is an option for Walk. +type WalkOption func(*walkOptions) + +// WalkWithSymlinks returns a WalkOption that results in Walk following symlinks. +func WalkWithSymlinks() WalkOption { + return func(walkOptions *walkOptions) { + walkOptions.symlinks = true + } +} + +// walkPath is the path we give to the WalkFunc +// resolvedPath is the potentially-resolved path that we actually read from. +func walk( + walkPath string, + resolvedPath string, + fileInfo os.FileInfo, + walkFunc filepath.WalkFunc, + resolvedPathMap map[string]struct{}, + symlinks bool, +) error { + if symlinks { + if _, ok := resolvedPathMap[resolvedPath]; ok { + // Do not walk down this path. + // We could later make it optional to error in this case. + return nil + } + resolvedPathMap[resolvedPath] = struct{}{} + } + + // If this is not a directory, just call walkFunc on it and we're done. + if !fileInfo.IsDir() { + return walkFunc(walkPath, fileInfo, nil) + } + + // This is a directory, read it. + subNames, readDirErr := readDirNames(resolvedPath) + walkErr := walkFunc(walkPath, fileInfo, readDirErr) + // If readDirErr != nil, walk can't walk into this directory. + // walkErr != nil means walkFunc want walk to skip this directory or stop walking. + // Therefore, if one of readDirErr and walkErr isn't nil, walk will return. + if readDirErr != nil || walkErr != nil { + // The caller's behavior is controlled by the return value, which is decided + // by walkFunc. walkFunc may ignore readDirErr and return nil. + // If walkFunc returns SkipDir, it will be handled by the caller. + // So walk should return whatever walkFunc returns. + return walkErr + } + + for _, subName := range subNames { + // The path we want to pass to walk is the directory walk path plus the name. + subWalkPath := filepath.Join(walkPath, subName) + // The path we want to actually used is the directory resolved path plus the name. + // This is potentially a symlink-evaluated path. + subResolvedPath := filepath.Join(resolvedPath, subName) + subFileInfo, err := os.Lstat(subResolvedPath) + if err != nil { + // If we have an error, still call walkFunc and match filepath.Walk. + if walkErr := walkFunc(subWalkPath, subFileInfo, err); walkErr != nil && walkErr != filepath.SkipDir { + return walkErr + } + // No error, just continue the for loop. + // Note that filepath.Walk does an else block instead, but we want to match + // the same code as in the symlink if statement below. + continue + } + subResolvedPath, subFileInfo, err = optionallyEvaluateSymlink(subResolvedPath, subFileInfo, symlinks) + if err != nil { + // If we have an error, still call walkFunc and match filepath.Walk. + if walkErr := walkFunc(subWalkPath, subFileInfo, err); walkErr != nil && walkErr != filepath.SkipDir { + return walkErr + } + // No error, just continue the for loop. + continue + } + if err := walk(subWalkPath, subResolvedPath, subFileInfo, walkFunc, resolvedPathMap, symlinks); err != nil { + // If not a directory, return the error. + // Else, if the error is filepath.SkipDir, return the error. + // Else, this is a directory and we have filepath.SkipDir, do not return the error and continue. + if !subFileInfo.IsDir() || err != filepath.SkipDir { + return err + } + } + } + + return nil +} + +// readDirNames reads the directory named by dirname and returns +// a sorted list of directory entries. +// +// We need to use this instead of os.ReadDir because we want to do the os.Lstat ourselves +// separately to completely match filepath.Walk. +func readDirNames(dirPath string) (_ []string, retErr error) { + file, err := os.Open(dirPath) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, file.Close()) + }() + dirNames, err := file.Readdirnames(-1) + if err != nil { + return nil, err + } + sort.Strings(dirNames) + return dirNames, nil +} + +type walkOptions struct { + symlinks bool +} + +func newWalkOptions() *walkOptions { + return &walkOptions{} +} + +// returns optionally-resolved path, optionally-resolved os.FileInfo +func optionallyEvaluateSymlink(filePath string, fileInfo os.FileInfo, symlinks bool) (string, os.FileInfo, error) { + if !symlinks { + return filePath, fileInfo, nil + } + if fileInfo.Mode()&os.ModeSymlink != os.ModeSymlink { + return filePath, fileInfo, nil + } + resolvedFilePath, err := filepath.EvalSymlinks(filePath) + if err != nil { + return filePath, fileInfo, err + } + resolvedFileInfo, err := os.Lstat(resolvedFilePath) + if err != nil { + return filePath, fileInfo, err + } + return resolvedFilePath, resolvedFileInfo, nil +} diff --git a/pkg/bufman/pkg/filepathextended/filepathextended_unix_test.go b/pkg/bufman/pkg/filepathextended/filepathextended_unix_test.go new file mode 100644 index 000000000..4e5fd8aeb --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/filepathextended_unix_test.go @@ -0,0 +1,143 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matching the unix-like build tags in the Golang source i.e. https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/file_unix.go#L6 + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package filepathextended + +import ( + "os" + "path/filepath" + "sort" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestRealClean(t *testing.T) { + t.Parallel() + path, err := RealClean("../filepathextended") + assert.NoError(t, err) + assert.Equal(t, ".", path) + path, err = RealClean("../filepathextended/foo") + assert.NoError(t, err) + assert.Equal(t, "foo", path) + path, err = RealClean("/foo") + assert.NoError(t, err) + assert.Equal(t, "/foo", path) + path, err = RealClean("/foo/../bar") + assert.NoError(t, err) + assert.Equal(t, "/bar", path) +} + +func TestWalkSymlinkSuccessNoSymlinks(t *testing.T) { + t.Parallel() + filePaths, err := testWalkGetRegularFilePaths( + filepath.Join("testdata", "symlink_success"), + ) + require.NoError(t, err) + require.Equal( + t, + []string{ + "file.proto", + }, + filePaths, + ) +} + +func TestWalkSymlinkSuccessSymlinks(t *testing.T) { + t.Parallel() + filePaths, err := testWalkGetRegularFilePaths( + filepath.Join("testdata", "symlink_success"), + WalkWithSymlinks(), + ) + require.NoError(t, err) + require.Equal( + t, + []string{ + "1.proto", + "a/b/1.proto", + "a/b/2.proto", + "a/b/2.txt", + "a/bar.yaml", + "a/file.proto", + "ab/1.proto", + "ab/2.proto", + "ab/2.txt", + "file.proto", + }, + filePaths, + ) +} + +func TestWalkSymlinkLoopNoSymlinks(t *testing.T) { + t.Parallel() + filePaths, err := testWalkGetRegularFilePaths( + filepath.Join("testdata", "symlink_loop"), + ) + require.NoError(t, err) + require.Equal( + t, + []string{ + "file.proto", + }, + filePaths, + ) +} + +func TestWalkSymlinkLoopSymlinks(t *testing.T) { + t.Parallel() + filePaths, err := testWalkGetRegularFilePaths( + filepath.Join("testdata", "symlink_loop"), + WalkWithSymlinks(), + ) + require.NoError(t, err) + require.Equal( + t, + []string{ + "file.proto", + }, + filePaths, + ) +} + +func testWalkGetRegularFilePaths(dirPath string, options ...WalkOption) ([]string, error) { + var filePaths []string + if err := Walk( + dirPath, + func(path string, fileInfo os.FileInfo, err error) error { + if err != nil { + return err + } + if fileInfo.Mode().IsRegular() { + relPath, err := filepath.Rel(dirPath, path) + if err != nil { + return err + } + filePaths = append(filePaths, relPath) + } + return nil + }, + options..., + ); err != nil { + return nil, err + } + sort.Strings(filePaths) + return filePaths, nil +} diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/1.proto b/pkg/bufman/pkg/filepathextended/testdata/base/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/base/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/1.proto b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.proto b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.txt b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/a/bar.yaml b/pkg/bufman/pkg/filepathextended/testdata/base/a/bar.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/base/a/bar.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/ab/1.proto b/pkg/bufman/pkg/filepathextended/testdata/base/ab/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/base/ab/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.proto b/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.txt b/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/filepathextended/testdata/link/b b/pkg/bufman/pkg/filepathextended/testdata/link/b new file mode 100644 index 000000000..f7f964f73 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/link/b @@ -0,0 +1 @@ +../base/a/b \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/link/bar.yaml b/pkg/bufman/pkg/filepathextended/testdata/link/bar.yaml new file mode 100644 index 000000000..490a5eb33 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/link/bar.yaml @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +../base/a/bar.yaml \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/link/file.proto b/pkg/bufman/pkg/filepathextended/testdata/link/file.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/link/file.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/a/b b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/a/b new file mode 100644 index 000000000..42532fe13 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/a/b @@ -0,0 +1 @@ +../b \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/b/a b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/b/a new file mode 100644 index 000000000..82f488f26 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/b/a @@ -0,0 +1 @@ +../a \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/file.proto b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/file.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/file.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/1.proto b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/1.proto new file mode 100644 index 000000000..b75f37911 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/1.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +../base/1.proto \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/a b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/a new file mode 100644 index 000000000..f48f654b2 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/a @@ -0,0 +1 @@ +../link \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/ab b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/ab new file mode 100644 index 000000000..d19fa240b --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/ab @@ -0,0 +1 @@ +../base/ab \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/file.proto b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/file.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/file.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/git/annotated_tag.go b/pkg/bufman/pkg/git/annotated_tag.go new file mode 100644 index 000000000..fa413e013 --- /dev/null +++ b/pkg/bufman/pkg/git/annotated_tag.go @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "bytes" + "io" + "strings" +) + +type annotatedTag struct { + hash Hash + commit Hash + name string + tagger Ident + message string +} + +func (t *annotatedTag) Hash() Hash { + return t.hash +} + +func (t *annotatedTag) Commit() Hash { + return t.commit +} + +func (t *annotatedTag) Name() string { + return t.name +} + +func (t *annotatedTag) Tagger() Ident { + return t.tagger +} + +func (t *annotatedTag) Message() string { + return t.message +} + +func parseAnnotatedTag(hash Hash, data []byte) (*annotatedTag, error) { + t := &annotatedTag{ + hash: hash, + } + buffer := bytes.NewBuffer(data) + line, err := buffer.ReadString('\n') + for err != io.EOF && line != "\n" { + header, value, _ := strings.Cut(line, " ") + value = strings.TrimRight(value, "\n") + switch header { + case "object": + if t.commit, err = parseHashFromHex(value); err != nil { + return nil, err + } + case "tagger": + if t.tagger, err = parseIdent([]byte(value)); err != nil { + return nil, err + } + case "tag": + t.name = value + default: + // We do not parse the remaining headers. + } + line, err = buffer.ReadString('\n') + } + t.message = buffer.String() + t.message = strings.TrimRight(t.message, "\n") + return t, err +} diff --git a/pkg/bufman/pkg/git/branch.go b/pkg/bufman/pkg/git/branch.go new file mode 100644 index 000000000..8fbe07eb5 --- /dev/null +++ b/pkg/bufman/pkg/git/branch.go @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +type branch struct { + branch string +} + +func newBranch(name string) *branch { + return &branch{ + branch: name, + } +} + +func (r *branch) cloneBranch() string { + if r == nil { + return "" + } + return r.branch +} + +func (r branch) checkout() string { + return "" +} + +// Used for logging +func (r *branch) MarshalJSON() ([]byte, error) { + return []byte(`"` + r.cloneBranch() + `"`), nil +} + +func (r *branch) String() string { + return r.cloneBranch() +} diff --git a/pkg/bufman/pkg/git/cloner.go b/pkg/bufman/pkg/git/cloner.go new file mode 100644 index 000000000..6ba540bed --- /dev/null +++ b/pkg/bufman/pkg/git/cloner.go @@ -0,0 +1,399 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "bytes" + "context" + "errors" + "fmt" + "strconv" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/tmp" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.uber.org/multierr" + "go.uber.org/zap" +) + +const ( + // bufCloneOrigin is the name for the remote. It helps distinguish the origin of + // the repo we're cloning from the "origin" of our clone (which is the repo + // being cloned). + // We can fetch directly from an origin URL, but without any remote set git LFS + // will fail to fetch so we need to pick something. + bufCloneOrigin = "bufCloneOrigin" + tracerName = "bufbuild/buf/cloner" +) + +type cloner struct { + logger *zap.Logger + storageosProvider storageos.Provider + runner command.Runner + options ClonerOptions + tracer trace.Tracer +} + +func newCloner( + logger *zap.Logger, + storageosProvider storageos.Provider, + runner command.Runner, + options ClonerOptions, +) *cloner { + return &cloner{ + logger: logger, + storageosProvider: storageosProvider, + runner: runner, + options: options, + tracer: otel.GetTracerProvider().Tracer(tracerName), + } +} + +func (c *cloner) CloneToBucket( + ctx context.Context, + envContainer app.EnvContainer, + url string, + depth uint32, + writeBucket storage.WriteBucket, + options CloneToBucketOptions, +) (retErr error) { + ctx, span := c.tracer.Start(ctx, "git_clone_to_bucket") + defer span.End() + defer func() { + if retErr != nil { + span.RecordError(retErr) + span.SetStatus(codes.Error, retErr.Error()) + } + }() + + var err error + switch { + case strings.HasPrefix(url, "http://"), + strings.HasPrefix(url, "https://"), + strings.HasPrefix(url, "ssh://"), + strings.HasPrefix(url, "git://"), + strings.HasPrefix(url, "file://"): + default: + return fmt.Errorf("invalid git url: %q", url) + } + + if depth == 0 { + err := errors.New("depth must be > 0") + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + + depthArg := strconv.Itoa(int(depth)) + + bareDir, err := tmp.NewDir() + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + defer func() { + retErr = multierr.Append(retErr, bareDir.Close()) + }() + worktreeDir, err := tmp.NewDir() + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, worktreeDir.Close()) + }() + + buffer := bytes.NewBuffer(nil) + if err := c.runner.Run( + ctx, + "git", + command.RunWithArgs("init", "--bare"), + command.RunWithEnv(app.EnvironMap(envContainer)), + command.RunWithStderr(buffer), + command.RunWithDir(bareDir.AbsPath()), + ); err != nil { + return newGitCommandError(err, buffer, bareDir) + } + + buffer.Reset() + remoteArgs := []string{ + "--git-dir=" + bareDir.AbsPath(), + "remote", + "add", + bufCloneOrigin, + url, + } + if err := c.runner.Run( + ctx, + "git", + command.RunWithArgs(remoteArgs...), + command.RunWithEnv(app.EnvironMap(envContainer)), + command.RunWithStderr(buffer), + ); err != nil { + return newGitCommandError(err, buffer, bareDir) + } + + var gitConfigAuthArgs []string + if strings.HasPrefix(url, "https://") { + // These extraArgs MUST be first, as the -c flag potentially produced + // is only a flag on the parent git command, not on git fetch. + extraArgs, err := c.getArgsForHTTPSCommand(envContainer) + if err != nil { + return err + } + gitConfigAuthArgs = append(gitConfigAuthArgs, extraArgs...) + } + fetchRef, worktreeRef, checkoutRef := getRefspecsForName(options.Name) + fetchArgs := append( + gitConfigAuthArgs, + "--git-dir="+bareDir.AbsPath(), + "fetch", + "--depth", depthArg, + bufCloneOrigin, + fetchRef, + ) + + if strings.HasPrefix(url, "ssh://") { + envContainer, err = c.getEnvContainerWithGitSSHCommand(envContainer) + if err != nil { + return err + } + } + buffer.Reset() + if err := c.runner.Run( + ctx, + "git", + command.RunWithArgs(fetchArgs...), + command.RunWithEnv(app.EnvironMap(envContainer)), + command.RunWithStderr(buffer), + ); err != nil { + return newGitCommandError(err, buffer, bareDir) + } + + buffer.Reset() + args := append( + gitConfigAuthArgs, + "--git-dir="+bareDir.AbsPath(), + "worktree", + "add", + worktreeDir.AbsPath(), + worktreeRef, + ) + if err := c.runner.Run( + ctx, + "git", + command.RunWithArgs(args...), + command.RunWithEnv(app.EnvironMap(envContainer)), + command.RunWithStderr(buffer), + ); err != nil { + return newGitCommandError(err, buffer, worktreeDir) + } + + if checkoutRef != "" { + buffer.Reset() + args := append( + gitConfigAuthArgs, + "checkout", + checkoutRef, + ) + if err := c.runner.Run( + ctx, + "git", + command.RunWithArgs(args...), + command.RunWithEnv(app.EnvironMap(envContainer)), + command.RunWithStderr(buffer), + command.RunWithDir(worktreeDir.AbsPath()), + ); err != nil { + return newGitCommandError(err, buffer, worktreeDir) + } + } + + if options.RecurseSubmodules { + submoduleArgs := append( + gitConfigAuthArgs, + "submodule", + "update", + "--init", + "--recursive", + "--depth", + depthArg, + ) + buffer.Reset() + if err := c.runner.Run( + ctx, + "git", + command.RunWithArgs(submoduleArgs...), + command.RunWithEnv(app.EnvironMap(envContainer)), + command.RunWithStderr(buffer), + command.RunWithDir(worktreeDir.AbsPath()), + ); err != nil { + // Suppress printing of temp path + return fmt.Errorf("%v\n%v", err, strings.Replace(buffer.String(), worktreeDir.AbsPath(), "", -1)) + } + } + + // we do NOT want to read in symlinks + tmpReadWriteBucket, err := c.storageosProvider.NewReadWriteBucket(worktreeDir.AbsPath()) + if err != nil { + return err + } + var readBucket storage.ReadBucket = tmpReadWriteBucket + if options.Mapper != nil { + readBucket = storage.MapReadBucket(readBucket, options.Mapper) + } + ctx, span2 := c.tracer.Start(ctx, "git_clone_to_bucket_copy") + defer span2.End() + // do NOT copy external paths + _, err = storage.Copy(ctx, readBucket, writeBucket) + if err != nil { + span2.RecordError(err) + span2.SetStatus(codes.Error, err.Error()) + } + return err +} + +func (c *cloner) getArgsForHTTPSCommand(envContainer app.EnvContainer) ([]string, error) { + if c.options.HTTPSUsernameEnvKey == "" || c.options.HTTPSPasswordEnvKey == "" { + return nil, nil + } + httpsUsernameSet := envContainer.Env(c.options.HTTPSUsernameEnvKey) != "" + httpsPasswordSet := envContainer.Env(c.options.HTTPSPasswordEnvKey) != "" + if !httpsUsernameSet { + if httpsPasswordSet { + return nil, fmt.Errorf("%s set but %s not set", c.options.HTTPSPasswordEnvKey, c.options.HTTPSUsernameEnvKey) + } + return nil, nil + } + c.logger.Sugar().Debug("git_credential_helper_override") + return []string{ + "-c", + fmt.Sprintf( + // TODO: is this OK for windows/other platforms? + // we might need an alternate flow where the binary has a sub-command to do this, and calls itself + // + // putting the variable name in this script, NOT the actual variable value + // we do not want to store the variable on disk, ever + // this is especially important if the program dies + // note that this means i.e. HTTPS_PASSWORD=foo invoke_program does not work as + // this variable needs to be in the actual global environment + // TODO this is a mess + "credential.helper=!f(){ echo username=${%s}; echo password=${%s}; };f", + c.options.HTTPSUsernameEnvKey, + c.options.HTTPSPasswordEnvKey, + ), + }, nil +} + +func (c *cloner) getEnvContainerWithGitSSHCommand(envContainer app.EnvContainer) (app.EnvContainer, error) { + gitSSHCommand, err := c.getGitSSHCommand(envContainer) + if err != nil { + return nil, err + } + if gitSSHCommand != "" { + c.logger.Sugar().Debug("git_ssh_command_override") + return app.NewEnvContainerWithOverrides( + envContainer, + map[string]string{ + "GIT_SSH_COMMAND": gitSSHCommand, + }, + ), nil + } + return envContainer, nil +} + +func (c *cloner) getGitSSHCommand(envContainer app.EnvContainer) (string, error) { + sshKeyFilePath := envContainer.Env(c.options.SSHKeyFileEnvKey) + sshKnownHostsFiles := envContainer.Env(c.options.SSHKnownHostsFilesEnvKey) + if sshKeyFilePath == "" { + if sshKnownHostsFiles != "" { + return "", fmt.Errorf("%s set but %s not set", c.options.SSHKnownHostsFilesEnvKey, c.options.SSHKeyFileEnvKey) + } + return "", nil + } + if sshKnownHostsFilePaths := getSSHKnownHostsFilePaths(sshKnownHostsFiles); len(sshKnownHostsFilePaths) > 0 { + return fmt.Sprintf( + `ssh -q -i "%s" -o "IdentitiesOnly=yes" -o "UserKnownHostsFile=%s"`, + sshKeyFilePath, + strings.Join(sshKnownHostsFilePaths, " "), + ), nil + } + // we want to set StrictHostKeyChecking=no because the SSH key file variable was set, so + // there is an ask to override the default ssh settings here + return fmt.Sprintf( + `ssh -q -i "%s" -o "IdentitiesOnly=yes" -o "UserKnownHostsFile=%s" -o "StrictHostKeyChecking=no"`, + sshKeyFilePath, + app.DevNullFilePath, + ), nil +} + +func getSSHKnownHostsFilePaths(sshKnownHostsFiles string) []string { + if sshKnownHostsFiles == "" { + return nil + } + var filePaths []string + for _, filePath := range strings.Split(sshKnownHostsFiles, ":") { + filePath = strings.TrimSpace(filePath) + if filePath != "" { + filePaths = append(filePaths, filePath) + } + } + return filePaths +} + +// getRefspecsForName decides the refspecs to use in the subsequent git fetch, +// git worktree add and git checkout. When checkoutRefspec is empty, Name +// explicitly refer to a named ref and the checkout isn't a necessary step. +func getRefspecsForName(gitName Name) (fetchRefSpec string, worktreeRefSpec string, checkoutRefspec string) { + if gitName == nil { + return "HEAD", "FETCH_HEAD", "" + } + if gitName.cloneBranch() != "" && gitName.checkout() != "" { + // When doing branch/tag clones, make sure we use a + // refspec that creates a local referece in `refs/` even if the ref + // is remote tracking, so that the checkoutRefs may reference it, + // for example: + // branch=origin/main,ref=origin/main~1 + fetchRefSpec := gitName.cloneBranch() + ":" + gitName.cloneBranch() + return fetchRefSpec, "FETCH_HEAD", gitName.checkout() + } else if gitName.cloneBranch() != "" { + return gitName.cloneBranch(), "FETCH_HEAD", "" + } else if gitName.checkout() != "" { + // After fetch we won't have checked out any refs. This + // will cause `refs=` containing "HEAD" to fail, as HEAD + // is a special case that is not fetched into a ref but + // instead refers to the current commit checked out. By + // checking out "FETCH_HEAD" before checking out the + // user supplied ref, we behave similarly to git clone. + return "HEAD", "FETCH_HEAD", gitName.checkout() + } else { + return "HEAD", "FETCH_HEAD", "" + } +} + +func newGitCommandError( + err error, + buffer *bytes.Buffer, + tmpDir tmp.Dir, +) error { + // Suppress printing of temp path + return fmt.Errorf("%v\n%v", err, strings.TrimSpace(strings.Replace(buffer.String(), tmpDir.AbsPath(), "", -1))) +} diff --git a/pkg/bufman/pkg/git/cmd/git-ls-files-unstaged/main.go b/pkg/bufman/pkg/git/cmd/git-ls-files-unstaged/main.go new file mode 100644 index 000000000..f4f966489 --- /dev/null +++ b/pkg/bufman/pkg/git/cmd/git-ls-files-unstaged/main.go @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package main implements a file lister for git that lists unstaged files. +// +// See the documentation for git.Lister for more details. +package main + +import ( + "context" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" +) + +func main() { + app.Main(context.Background(), run) +} + +func run(ctx context.Context, container app.Container) error { + files, err := git.NewLister(command.NewRunner()).ListFilesAndUnstagedFiles( + ctx, + container, + git.ListFilesAndUnstagedFilesOptions{}, + ) + if err != nil { + return err + } + if len(files) > 0 { + if _, err := container.Stdout().Write([]byte(strings.Join(files, "\n") + "\n")); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/pkg/git/commit.go b/pkg/bufman/pkg/git/commit.go new file mode 100644 index 000000000..92a0f7d7c --- /dev/null +++ b/pkg/bufman/pkg/git/commit.go @@ -0,0 +1,97 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "bytes" + "errors" + "io" + "strings" +) + +type commit struct { + hash Hash + tree Hash + parents []Hash + author Ident + committer Ident + message string +} + +func (c *commit) Hash() Hash { + return c.hash +} + +func (c *commit) Tree() Hash { + return c.tree +} + +func (c *commit) Parents() []Hash { + return c.parents +} + +func (c *commit) Author() Ident { + return c.author +} + +func (c *commit) Committer() Ident { + return c.committer +} + +func (c *commit) Message() string { + return c.message +} + +func parseCommit(hash Hash, data []byte) (*commit, error) { + c := &commit{ + hash: hash, + } + buffer := bytes.NewBuffer(data) + line, err := buffer.ReadString('\n') + for err != io.EOF && line != "\n" { + header, value, _ := strings.Cut(line, " ") + value = strings.TrimRight(value, "\n") + switch header { + case "tree": + if c.tree != nil { + return nil, errors.New("too many tree headers") + } + if c.tree, err = parseHashFromHex(value); err != nil { + return nil, err + } + case "parent": + if parent, err := parseHashFromHex(value); err != nil { + return nil, err + } else { + c.parents = append(c.parents, parent) + } + case "author": + if c.author, err = parseIdent([]byte(value)); err != nil { + return nil, err + } + case "committer": + if c.committer, err = parseIdent([]byte(value)); err != nil { + return nil, err + } + default: + // We do not parse the remaining headers. + } + line, err = buffer.ReadString('\n') + } + c.message = buffer.String() + c.message = strings.TrimRight(c.message, "\n") + return c, err +} diff --git a/pkg/bufman/pkg/git/commit_test.go b/pkg/bufman/pkg/git/commit_test.go new file mode 100644 index 000000000..7f4d5a028 --- /dev/null +++ b/pkg/bufman/pkg/git/commit_test.go @@ -0,0 +1,83 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestParseCommit(t *testing.T) { + t.Parallel() + + hash, err := parseHashFromHex("43848150a6f5f6d76eeef6e0f69eb46290eefab6") + require.NoError(t, err) + commit, err := parseCommit( + hash, + []byte(`tree 5edab9f970913225f985d9673ac19d61d36f0942 +parent aa4f1392d3ee58eacc4c34badd506d83239669ca +author Bob 1680571785 -0700 +committer Alice 1680636827 -0700 + +Hello World +`)) + require.NoError(t, err) + assert.Equal(t, + "43848150a6f5f6d76eeef6e0f69eb46290eefab6", + commit.Hash().String(), + ) + assert.Equal(t, + "5edab9f970913225f985d9673ac19d61d36f0942", + commit.Tree().String(), + ) + require.Equal(t, 1, len(commit.Parents())) + assert.Equal(t, + "aa4f1392d3ee58eacc4c34badd506d83239669ca", + commit.Parents()[0].String(), + ) + assert.Equal(t, + "Bob", + commit.Author().Name(), + ) + assert.Equal(t, + "bob@buf.build", + commit.Author().Email(), + ) + assert.Equal(t, + int64(1680571785), + commit.Author().Timestamp().Unix(), + "Bob commit time", + ) + assert.Equal(t, + "Alice", + commit.Committer().Name(), + ) + assert.Equal(t, + "alice@buf.build", + commit.Committer().Email(), + ) + assert.Equal(t, + int64(1680636827), + commit.Committer().Timestamp().Unix(), + "Alice commit time", + ) + assert.Equal(t, + "Hello World", + commit.Message(), + ) +} diff --git a/pkg/bufman/pkg/git/git.go b/pkg/bufman/pkg/git/git.go new file mode 100644 index 000000000..0adfc56fa --- /dev/null +++ b/pkg/bufman/pkg/git/git.go @@ -0,0 +1,320 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "context" + "errors" + "regexp" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/zap" +) + +const ( + // DotGitDir is a relative path to the `.git` directory. + DotGitDir = ".git" + + // ModeUnknown is a mode's zero value. + ModeUnknown ObjectMode = 0 + // ModeFile is a blob that should be written as a plain file. + ModeFile ObjectMode = 0o10_0644 + // ModeExec is a blob that should be written with the executable bit set. + ModeExe ObjectMode = 0o10_0755 + // ModeDir is a tree to be unpacked as a subdirectory in the current + // directory. + ModeDir ObjectMode = 0o04_0000 + // ModeSymlink is a blob with its content being the path linked to. + ModeSymlink ObjectMode = 0o12_0000 + // ModeSubmodule is a commit that the submodule is checked out at. + ModeSubmodule ObjectMode = 0o16_0000 +) + +var ( + // ErrTreeNodeNotFound is an error found in the error chain when + // Tree#Descendant is unable to find the target tree node. + ErrTreeNodeNotFound = errors.New("node not found") + // ErrTreeNodeNotFound is an error found in the error chain when + // ObjectReader is unable to find the target object. + ErrObjectNotFound = errors.New("object not found") +) + +// ObjectMode is how to interpret a tree node's object. See the Mode* constants +// for how to interpret each mode value. +type ObjectMode uint32 + +// Name is a name identifiable by git. +type Name interface { + // If cloneBranch returns a non-empty string, any clones will be performed with --branch set to the value. + cloneBranch() string + // If checkout returns a non-empty string, a checkout of the value will be performed after cloning. + checkout() string +} + +// NewBranchName returns a new Name for the branch. +func NewBranchName(branch string) Name { + return newBranch(branch) +} + +// NewTagName returns a new Name for the tag. +func NewTagName(tag string) Name { + return newBranch(tag) +} + +// NewRefName returns a new Name for the ref. +func NewRefName(ref string) Name { + return newRef(ref) +} + +// NewRefNameWithBranch returns a new Name for the ref while setting branch as the clone target. +func NewRefNameWithBranch(ref string, branch string) Name { + return newRefWithBranch(ref, branch) +} + +// Cloner clones git repositories to buckets. +type Cloner interface { + // CloneToBucket clones the repository to the bucket. + // + // The url must contain the scheme, including file:// if necessary. + // depth must be > 0. + CloneToBucket( + ctx context.Context, + envContainer app.EnvContainer, + url string, + depth uint32, + writeBucket storage.WriteBucket, + options CloneToBucketOptions, + ) error +} + +// CloneToBucketOptions are options for Clone. +type CloneToBucketOptions struct { + Mapper storage.Mapper + Name Name + RecurseSubmodules bool +} + +// NewCloner returns a new Cloner. +func NewCloner( + logger *zap.Logger, + storageosProvider storageos.Provider, + runner command.Runner, + options ClonerOptions, +) Cloner { + return newCloner(logger, storageosProvider, runner, options) +} + +// ClonerOptions are options for a new Cloner. +type ClonerOptions struct { + HTTPSUsernameEnvKey string + HTTPSPasswordEnvKey string + SSHKeyFileEnvKey string + SSHKnownHostsFilesEnvKey string +} + +// Lister lists files in git repositories. +type Lister interface { + // ListFilesAndUnstagedFiles lists all files checked into git except those that + // were deleted, and also lists unstaged files. + // + // This does not list unstaged deleted files + // This does not list unignored files that were not added. + // This ignores regular files. + // + // This is used for situations like license headers where we want all the + // potential git files during development. + // + // The returned paths will be unnormalized. + // + // This is the equivalent of doing: + // + // comm -23 \ + // <(git ls-files --cached --modified --others --no-empty-directory --exclude-standard | sort -u | grep -v -e IGNORE_PATH1 -e IGNORE_PATH2) \ + // <(git ls-files --deleted | sort -u) + ListFilesAndUnstagedFiles( + ctx context.Context, + envContainer app.EnvStdioContainer, + options ListFilesAndUnstagedFilesOptions, + ) ([]string, error) +} + +// NewLister returns a new Lister. +func NewLister(runner command.Runner) Lister { + return newLister(runner) +} + +// ListFilesAndUnstagedFilesOptions are options for ListFilesAndUnstagedFiles. +type ListFilesAndUnstagedFilesOptions struct { + // IgnorePathRegexps are regexes of paths to ignore. + // + // These must be unnormalized in the manner of the local OS that the Lister + // is being applied to. + IgnorePathRegexps []*regexp.Regexp +} + +// Hash represents the hash of a Git object (tree, blob, or commit). +type Hash interface { + // Hex is the hexadecimal representation of this ID. + Hex() string + // String returns the hexadecimal representation of this ID. + String() string +} + +// NewHashFromHex creates a new hash that is validated. +func NewHashFromHex(value string) (Hash, error) { + return parseHashFromHex(value) +} + +// Ident is a git user identifier. These typically represent authors and committers. +type Ident interface { + // Name is the name of the user. + Name() string + // Email is the email of the user. + Email() string + // Timestamp is the time at which this identity was created. For authors it's the + // commit's author time, and for committers it's the commit's commit time. + Timestamp() time.Time +} + +// Commit represents a commit object. +// +// All commits will have a non-nil Tree. All but the root commit will contain >0 parents. +type Commit interface { + // Hash is the Hash for this commit. + Hash() Hash + // Tree is the ID to the git tree for this commit. + Tree() Hash + // Parents is the set of parents for this commit. It may be empty. + // + // By convention, the first parent in a multi-parent commit is the merge target. + Parents() []Hash + // Author is the user who authored the commit. + Author() Ident + // Committer is the user who created the commit. + Committer() Ident + // Message is the commit message. + Message() string +} + +// AnnotatedTag represents an annotated tag object. +type AnnotatedTag interface { + // Hash is the Hash for this tag. + Hash() Hash + // Commit is the ID to the git commit that this tag points to. + Commit() Hash + // Tagger is the user who tagged the commit. + Tagger() Ident + // Name is the value of the tag. + Name() string + // Message is the commit message. + Message() string +} + +// ObjectReader reads objects (commits, trees, blobs, tags) from a `.git` directory. +type ObjectReader interface { + // Blob reads the blob identified by the hash. + Blob(id Hash) ([]byte, error) + // Commit reads the commit identified by the hash. + Commit(id Hash) (Commit, error) + // Tree reads the tree identified by the hash. + Tree(id Hash) (Tree, error) + // Tag reads the tag identified by the hash. + Tag(id Hash) (AnnotatedTag, error) +} + +// Tree is a git tree, which are a manifest of other git objects, including other trees. +type Tree interface { + // Hash is the Hash for this Tree. + Hash() Hash + // Nodes is the set of nodes in this Tree. + Nodes() []TreeNode + // Descendant walks down a tree, following the path specified, + // and returns the terminal Node. If no node is found, it returns + // ErrTreeNodeNotFound. + Descendant(path string, objectReader ObjectReader) (TreeNode, error) +} + +// TreeNode is a reference to an object contained in a tree. These objects have +// a file mode associated with them, which hints at the type of object located +// at ID (tree or blob). +type TreeNode interface { + // Hash is the Hash of the object referenced by this Node. + Hash() Hash + // Name is the name of the object referenced by this Node. + Name() string + // Mode is the file mode of the object referenced by this Node. + Mode() ObjectMode +} + +// Repository is a git repository that is backed by a `.git` directory. +type Repository interface { + // BaseBranch is the base branch of the repository. This is either configured + // via the `OpenRepositoryWithBaseBranch` option, or discovered via the remote + // named `origin`. Therefore, discovery requires that the repository is pushed + // to the remote. + BaseBranch() string + // ForEachBranch ranges over branches in the repository in an undefined order. + // + // Only pushed (i.e., remote) branches are visited. + ForEachBranch(func(branch string, headHash Hash) error) error + // ForEachCommit ranges over commits for the target branch in reverse topological order. + // + // Only commits pushed to the 'origin' remote are visited. + // + // Parents are visited before children, and only left parents are visited (i.e., + // commits from branches merged into the target branch are not visited). + ForEachCommit(branch string, f func(commit Commit) error) error + // ForEachTag ranges over tags in the repository in an undefined order. + // + // All tags are ranged, including local (unpushed) tags. + ForEachTag(func(tag string, commitHash Hash) error) error + // Objects exposes the underlying object reader to read objects directly from the + // `.git` directory. + Objects() ObjectReader + // Close closes the repository. + Close() error +} + +// OpenRepository opens a new Repository from a `.git` directory. The provided path to the +// `.git` dir need not be normalized or cleaned. +// +// Internally, OpenRepository will spawns a new process to communicate with `git-cat-file`, +// so the caller must close the repository to clean up resources. +// +// By default, OpenRepository will attempt to detect the base branch if the repository +// has been pushed. This may fail if the repository is not pushed. In this case, use the +// `OpenRepositoryWithBaseBranch` option. +func OpenRepository(gitDirPath string, runner command.Runner, options ...OpenRepositoryOption) (Repository, error) { + return openGitRepository(gitDirPath, runner, options...) +} + +// OpenRepositoryOption configures the opening of a repository. +type OpenRepositoryOption func(*openRepositoryOpts) error + +// CommitIteratorWithBaseBranch configures the base branch for this iterator. +func OpenRepositoryWithBaseBranch(name string) OpenRepositoryOption { + return func(r *openRepositoryOpts) error { + if name == "" { + return errors.New("base branch cannot be empty") + } + r.baseBranch = name + return nil + } +} diff --git a/pkg/bufman/pkg/git/git_test.go b/pkg/bufman/pkg/git/git_test.go new file mode 100644 index 000000000..79e5ae558 --- /dev/null +++ b/pkg/bufman/pkg/git/git_test.go @@ -0,0 +1,289 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "context" + "errors" + "net/http/cgi" + "net/http/httptest" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +func TestGitCloner(t *testing.T) { + t.Parallel() + ctx := context.Background() + container, err := app.NewContainerForOS() + require.NoError(t, err) + runner := command.NewRunner() + originDir, workDir := createGitDirs(ctx, t, container, runner) + + t.Run("default", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 1, nil, false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 2", string(content), "expected the commit on local-branch to be checked out") + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + _, err = storage.ReadPath(ctx, readBucket, "submodule/test.proto") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("default_submodule", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 1, nil, true) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 2", string(content), "expected the commit on local-branch to be checked out") + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + content, err = storage.ReadPath(ctx, readBucket, "submodule/test.proto") + require.NoError(t, err) + assert.Equal(t, "// submodule", string(content)) + }) + + t.Run("main", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewBranchName("main"), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 1", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("origin/main", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewBranchName("origin/main"), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 3", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("origin/remote-branch", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewBranchName("origin/remote-branch"), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 4", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("remote-tag", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewTagName("remote-tag"), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 4", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("branch_and_main_ref", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 2, NewRefNameWithBranch("HEAD~", "main"), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 0", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("branch_and_ref", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 2, NewRefNameWithBranch("local-branch~", "local-branch"), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 1", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("HEAD", func(t *testing.T) { + t.Parallel() + readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewRefName("HEAD"), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 2", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("commit-local", func(t *testing.T) { + t.Parallel() + revParseBytes, err := command.RunStdout(ctx, container, runner, "git", "-C", workDir, "rev-parse", "HEAD~") + require.NoError(t, err) + readBucket := readBucketForName(ctx, t, runner, workDir, 2, NewRefName(strings.TrimSpace(string(revParseBytes))), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 1", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) + + t.Run("commit-remote", func(t *testing.T) { + t.Parallel() + revParseBytes, err := command.RunStdout(ctx, container, runner, "git", "-C", originDir, "rev-parse", "remote-branch~") + require.NoError(t, err) + readBucket := readBucketForName(ctx, t, runner, workDir, 2, NewRefNameWithBranch(strings.TrimSpace(string(revParseBytes)), "origin/remote-branch"), false) + + content, err := storage.ReadPath(ctx, readBucket, "test.proto") + require.NoError(t, err) + assert.Equal(t, "// commit 3", string(content)) + _, err = readBucket.Stat(ctx, "nonexistent") + assert.True(t, storage.IsNotExist(err)) + }) +} + +func readBucketForName(ctx context.Context, t *testing.T, runner command.Runner, path string, depth uint32, name Name, recurseSubmodules bool) storage.ReadBucket { + t.Helper() + storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) + cloner := NewCloner(zap.NewNop(), storageosProvider, runner, ClonerOptions{}) + envContainer, err := app.NewEnvContainerForOS() + require.NoError(t, err) + + readWriteBucket := storagemem.NewReadWriteBucket() + err = cloner.CloneToBucket( + ctx, + envContainer, + "file://"+filepath.Join(path, ".git"), + depth, + readWriteBucket, + CloneToBucketOptions{ + Mapper: storage.MatchPathExt(".proto"), + Name: name, + RecurseSubmodules: recurseSubmodules, + }, + ) + require.NoError(t, err) + return readWriteBucket +} + +func createGitDirs( + ctx context.Context, + t *testing.T, + container app.EnvStdioContainer, + runner command.Runner, +) (string, string) { + tmpDir := t.TempDir() + + submodulePath := filepath.Join(tmpDir, "submodule") + require.NoError(t, os.MkdirAll(submodulePath, os.ModePerm)) + runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "init") + runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "config", "user.email", "tests@buf.build") + runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "config", "user.name", "Buf go tests") + runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "checkout", "-b", "main") + require.NoError(t, os.WriteFile(filepath.Join(submodulePath, "test.proto"), []byte("// submodule"), 0o600)) + runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "add", "test.proto") + runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "commit", "-m", "commit 0") + + gitExecPath, err := command.RunStdout(ctx, container, runner, "git", "--exec-path") + require.NoError(t, err) + t.Log(filepath.Join(string(gitExecPath), "git-http-backend")) + // https://git-scm.com/docs/git-http-backend#_description + f, err := os.Create(filepath.Join(submodulePath, ".git", "git-daemon-export-ok")) + require.NoError(t, err) + require.NoError(t, f.Close()) + server := httptest.NewServer(&cgi.Handler{ + Path: filepath.Join(strings.TrimSpace(string(gitExecPath)), "git-http-backend"), + Dir: submodulePath, + Env: []string{"GIT_PROJECT_ROOT=" + submodulePath}, + }) + t.Cleanup(server.Close) + submodulePath = server.URL + + originPath := filepath.Join(tmpDir, "origin") + require.NoError(t, os.MkdirAll(originPath, 0o777)) + runCommand(ctx, t, container, runner, "git", "-C", originPath, "init") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "config", "user.email", "tests@buf.build") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "config", "user.name", "Buf go tests") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "checkout", "-b", "main") + require.NoError(t, os.WriteFile(filepath.Join(originPath, "test.proto"), []byte("// commit 0"), 0o600)) + runCommand(ctx, t, container, runner, "git", "-C", originPath, "add", "test.proto") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "commit", "-m", "commit 0") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "submodule", "add", submodulePath, "submodule") + require.NoError(t, os.WriteFile(filepath.Join(originPath, "test.proto"), []byte("// commit 1"), 0o600)) + runCommand(ctx, t, container, runner, "git", "-C", originPath, "add", "test.proto") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "commit", "-m", "commit 1") + + workPath := filepath.Join(tmpDir, "workdir") + runCommand(ctx, t, container, runner, "git", "clone", originPath, workPath) + runCommand(ctx, t, container, runner, "git", "-C", workPath, "config", "user.email", "tests@buf.build") + runCommand(ctx, t, container, runner, "git", "-C", workPath, "config", "user.name", "Buf go tests") + runCommand(ctx, t, container, runner, "git", "-C", workPath, "checkout", "-b", "local-branch") + require.NoError(t, os.WriteFile(filepath.Join(workPath, "test.proto"), []byte("// commit 2"), 0o600)) + runCommand(ctx, t, container, runner, "git", "-C", workPath, "commit", "-a", "-m", "commit 2") + + require.NoError(t, os.WriteFile(filepath.Join(originPath, "test.proto"), []byte("// commit 3"), 0o600)) + runCommand(ctx, t, container, runner, "git", "-C", originPath, "add", "test.proto") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "commit", "-m", "commit 3") + + runCommand(ctx, t, container, runner, "git", "-C", originPath, "checkout", "-b", "remote-branch") + require.NoError(t, os.WriteFile(filepath.Join(originPath, "test.proto"), []byte("// commit 4"), 0o600)) + runCommand(ctx, t, container, runner, "git", "-C", originPath, "add", "test.proto") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "commit", "-m", "commit 4") + runCommand(ctx, t, container, runner, "git", "-C", originPath, "tag", "remote-tag") + + runCommand(ctx, t, container, runner, "git", "-C", workPath, "fetch", "origin") + return originPath, workPath +} + +func runCommand( + ctx context.Context, + t *testing.T, + container app.EnvStdioContainer, + runner command.Runner, + name string, + args ...string, +) { + t.Helper() + output, err := command.RunStdout(ctx, container, runner, name, args...) + if err != nil { + var exitErr *exec.ExitError + var stdErr []byte + if errors.As(err, &exitErr) { + stdErr = exitErr.Stderr + } + assert.FailNow(t, err.Error(), "stdout: %s\nstderr: %s", output, stdErr) + } +} diff --git a/pkg/bufman/pkg/git/gittest/doc.go b/pkg/bufman/pkg/git/gittest/doc.go new file mode 100644 index 000000000..c3d7c5a22 --- /dev/null +++ b/pkg/bufman/pkg/git/gittest/doc.go @@ -0,0 +1,17 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package gittest provides testing utilities for git repositories. +package gittest diff --git a/pkg/bufman/pkg/git/gittest/gittest.go b/pkg/bufman/pkg/git/gittest/gittest.go new file mode 100644 index 000000000..35140d7e4 --- /dev/null +++ b/pkg/bufman/pkg/git/gittest/gittest.go @@ -0,0 +1,161 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gittest + +import ( + "bytes" + "context" + "io" + "os" + "path" + "path/filepath" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" + "github.com/stretchr/testify/require" +) + +const DefaultBranch = "master" + +func ScaffoldGitRepository(t *testing.T) git.Repository { + runner := command.NewRunner() + dir := scaffoldGitRepository(t, runner) + dotGitPath := path.Join(dir, git.DotGitDir) + repo, err := git.OpenRepository(dotGitPath, runner, git.OpenRepositoryWithBaseBranch(DefaultBranch)) + require.NoError(t, err) + t.Cleanup(func() { + require.NoError(t, repo.Close()) + }) + return repo +} + +// the resulting Git repo looks like so: +// +// . +// ├── proto +// │ ├── acme +// │ │ ├── grocerystore +// │ │ │ └── v1 +// │ │ │ ├── c.proto +// │ │ │ ├── d.proto +// │ │ │ ├── g.proto +// │ │ │ └── h.proto +// │ │ └── petstore +// │ │ └── v1 +// │ │ ├── a.proto +// │ │ ├── b.proto +// │ │ ├── e.proto +// │ │ └── f.proto +// │ └── buf.yaml +// └── randomBinary (+x) +func scaffoldGitRepository(t *testing.T, runner command.Runner) string { + dir := t.TempDir() + + // (0) setup local and remote + runInDir(t, runner, dir, "mkdir", "local", "remote") + remote := path.Join(dir, "remote") + runInDir(t, runner, remote, "git", "init", "--bare") + runInDir(t, runner, remote, "git", "config", "user.name", "Buf TestBot") + runInDir(t, runner, remote, "git", "config", "user.email", "testbot@buf.build") + local := path.Join(dir, "local") + runInDir(t, runner, local, "git", "init") + runInDir(t, runner, local, "git", "config", "user.name", "Buf TestBot") + runInDir(t, runner, local, "git", "config", "user.email", "testbot@buf.build") + runInDir(t, runner, local, "git", "remote", "add", "origin", remote) + + // (1) commit in main branch + writeFiles(t, local, map[string]string{ + "randomBinary": "some executable", + "proto/buf.yaml": "some buf.yaml", + "proto/acme/petstore/v1/a.proto": "cats", + "proto/acme/petstore/v1/b.proto": "animals", + "proto/acme/grocerystore/v1/c.proto": "toysrus", + "proto/acme/grocerystore/v1/d.proto": "petsrus", + }) + runInDir(t, runner, local, "chmod", "+x", "randomBinary") + runInDir(t, runner, local, "git", "add", ".") + runInDir(t, runner, local, "git", "commit", "-m", "initial commit") + runInDir(t, runner, local, "git", "tag", "release/v1") + runInDir(t, runner, local, "git", "push", "--follow-tags", "-u", "-f", "origin", DefaultBranch) + + // (2) branch off main and begin work + runInDir(t, runner, local, "git", "checkout", "-b", "smian/branch1") + writeFiles(t, local, map[string]string{ + "proto/acme/petstore/v1/e.proto": "loblaws", + "proto/acme/petstore/v1/f.proto": "merchant of venice", + }) + runInDir(t, runner, local, "git", "add", ".") + runInDir(t, runner, local, "git", "commit", "-m", "branch1") + runInDir(t, runner, local, "git", "tag", "-m", "for testing", "branch/v1") + runInDir(t, runner, local, "git", "push", "--follow-tags", "origin", "smian/branch1") + + // (3) branch off branch and begin work + runInDir(t, runner, local, "git", "checkout", "-b", "smian/branch2") + writeFiles(t, local, map[string]string{ + "proto/acme/grocerystore/v1/g.proto": "hamlet", + "proto/acme/grocerystore/v1/h.proto": "bethoven", + }) + runInDir(t, runner, local, "git", "add", ".") + runInDir(t, runner, local, "git", "commit", "-m", "branch2") + runInDir(t, runner, local, "git", "tag", "-m", "for testing", "branch/v2") + runInDir(t, runner, local, "git", "push", "--follow-tags", "origin", "smian/branch2") + + // (4) merge first branch + runInDir(t, runner, local, "git", "checkout", DefaultBranch) + runInDir(t, runner, local, "git", "merge", "--squash", "smian/branch1") + runInDir(t, runner, local, "git", "commit", "-m", "second commit") + runInDir(t, runner, local, "git", "tag", "v2") + runInDir(t, runner, local, "git", "push", "--follow-tags") + + // (5) pack some refs + runInDir(t, runner, local, "git", "pack-refs", "--all") + runInDir(t, runner, local, "git", "repack") + + // (6) merge second branch + runInDir(t, runner, local, "git", "checkout", DefaultBranch) + runInDir(t, runner, local, "git", "merge", "--squash", "smian/branch2") + runInDir(t, runner, local, "git", "commit", "-m", "third commit") + runInDir(t, runner, local, "git", "tag", "v3.0") + runInDir(t, runner, local, "git", "push", "--follow-tags") + + return local +} + +func runInDir(t *testing.T, runner command.Runner, dir string, cmd string, args ...string) { + stderr := bytes.NewBuffer(nil) + err := runner.Run( + context.Background(), + cmd, + command.RunWithArgs(args...), + command.RunWithDir(dir), + command.RunWithStderr(stderr), + ) + if err != nil { + t.Logf("run %q", strings.Join(append([]string{cmd}, args...), " ")) + _, err := io.Copy(os.Stderr, stderr) + require.NoError(t, err) + } + require.NoError(t, err) +} + +func writeFiles(t *testing.T, dir string, files map[string]string) { + for path, contents := range files { + require.NoError(t, os.MkdirAll(filepath.Join(dir, filepath.Dir(path)), 0o700)) + require.NoError(t, os.WriteFile(filepath.Join(dir, path), []byte(contents), 0o600)) + } +} diff --git a/pkg/bufman/pkg/git/hash.go b/pkg/bufman/pkg/git/hash.go new file mode 100644 index 000000000..c50fe8f16 --- /dev/null +++ b/pkg/bufman/pkg/git/hash.go @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "encoding/hex" + "fmt" +) + +// hashLength is the length, in bytes, of digests/hashes in object format SHA1 +const hashLength = 20 + +// hashHexLength is the length, in hexadecimal characters, of digests/hashes in object format SHA1 +var hashHexLength = hex.EncodedLen(hashLength) + +type hash struct { + raw []byte + hex string +} + +func (i *hash) Raw() []byte { + return i.raw +} + +func (i *hash) Hex() string { + return i.hex +} + +func (i *hash) String() string { + return i.hex +} + +func newHashFromBytes(data []byte) (*hash, error) { + if len(data) != hashLength { + return nil, fmt.Errorf("hash is not %d bytes", hashLength) + } + dst := make([]byte, hex.EncodedLen(len(data))) + hex.Encode(dst, data) + return &hash{ + raw: data, + hex: string(dst), + }, nil +} + +func parseHashFromHex(data string) (*hash, error) { + if len(data) != hashHexLength { + return nil, fmt.Errorf("hash is not %d characters", hashHexLength) + } + raw, err := hex.DecodeString(data) + return &hash{ + raw: raw, + hex: data, + }, err +} diff --git a/pkg/bufman/pkg/git/hash_test.go b/pkg/bufman/pkg/git/hash_test.go new file mode 100644 index 000000000..b6ef845fd --- /dev/null +++ b/pkg/bufman/pkg/git/hash_test.go @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestParseHashFromHex(t *testing.T) { + t.Parallel() + + const hex = "5edab9f970913225f985d9673ac19d61d36f0942" + + id, err := parseHashFromHex(hex) + + require.NoError(t, err) + require.Equal(t, id.Hex(), hex) + require.Equal(t, id.Raw(), []byte{0x5e, 0xda, 0xb9, 0xf9, 0x70, 0x91, 0x32, 0x25, 0xf9, 0x85, 0xd9, 0x67, 0x3a, 0xc1, 0x9d, 0x61, 0xd3, 0x6f, 0x9, 0x42}) +} + +func TestNewHashFromBytes(t *testing.T) { + t.Parallel() + + bytes := []byte{0x5e, 0xda, 0xb9, 0xf9, 0x70, 0x91, 0x32, 0x25, 0xf9, 0x85, 0xd9, 0x67, 0x3a, 0xc1, 0x9d, 0x61, 0xd3, 0x6f, 0x9, 0x42} + + id, err := newHashFromBytes(bytes) + + require.NoError(t, err) + require.Equal(t, id.Hex(), "5edab9f970913225f985d9673ac19d61d36f0942") + require.Equal(t, id.Raw(), bytes) +} diff --git a/pkg/bufman/pkg/git/ident.go b/pkg/bufman/pkg/git/ident.go new file mode 100644 index 000000000..394db7d4f --- /dev/null +++ b/pkg/bufman/pkg/git/ident.go @@ -0,0 +1,90 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "errors" + "fmt" + "strconv" + "strings" + "time" +) + +type ident struct { + name string + email string + timestamp time.Time +} + +func (i *ident) Name() string { + return i.name +} + +func (i *ident) Email() string { + return i.email +} + +func (i *ident) Timestamp() time.Time { + return i.timestamp +} + +func parseIdent(data []byte) (*ident, error) { + var i ident + // Name (optional) + // Many spaces between name and email are allowed. + name, emailAndTime, found := strings.Cut(string(data), "<") + if !found { + // Mail is required. + return nil, errors.New("ident: no email component") + } + i.name = strings.TrimRight(name, " ") + + // Email (required) + idx := strings.LastIndex(emailAndTime, ">") + if idx == -1 { + return nil, errors.New("ident: malformed email component") + } + i.email = emailAndTime[:idx] + + // Timestamp (optional) + // The stamp is in Unix Epoc and the user's UTC offset in [+-]HHMM when the + // time was taken. + timestr := strings.TrimLeft(emailAndTime[idx+1:], " ") + if timestr != "" { + timesecstr, timezonestr, found := strings.Cut(timestr, " ") + if !found { + return nil, errors.New("ident: malformed timestamp: missing UTC offset") + } + timesec, err := strconv.ParseInt(timesecstr, 10, 64) + if err != nil { + return nil, fmt.Errorf("ident: malformed timestamp: %w", err) + } + tzHourStr := timezonestr[:len(timezonestr)-2] + tzHour, err := strconv.ParseInt(tzHourStr, 10, 32) + if err != nil { + return nil, fmt.Errorf("ident: malformed timestamp: %w", err) + } + tzMinStr := timezonestr[len(timezonestr)-2:] + tzMin, err := strconv.ParseInt(tzMinStr, 10, 32) + if err != nil { + return nil, fmt.Errorf("ident: malformed timestamp: %w", err) + } + tzOffset := int(tzHour)*60*60 + int(tzMin)*60 + location := time.FixedZone("UTC"+timezonestr, tzOffset) + i.timestamp = time.Unix(timesec, 0).In(location) + } + return &i, nil +} diff --git a/pkg/bufman/pkg/git/ident_test.go b/pkg/bufman/pkg/git/ident_test.go new file mode 100644 index 000000000..22804de5e --- /dev/null +++ b/pkg/bufman/pkg/git/ident_test.go @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestParseIdent(t *testing.T) { + t.Parallel() + + ident, err := parseIdent([]byte("Foo 1680571785 +0445")) + + require.NoError(t, err) + location := time.FixedZone("UTC+0445", 4*60*60+45*60) + assert.Equal(t, ident.Name(), "Foo") + assert.Equal(t, ident.Email(), "bar@baz") + assert.Equal(t, ident.Timestamp(), time.Unix(1680571785, 0).In(location)) + assert.Equal(t, ident.Timestamp().Unix(), int64(1680571785)) +} diff --git a/pkg/bufman/pkg/git/lister.go b/pkg/bufman/pkg/git/lister.go new file mode 100644 index 000000000..2ec3ca44a --- /dev/null +++ b/pkg/bufman/pkg/git/lister.go @@ -0,0 +1,132 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "context" + "os" + "regexp" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +type lister struct { + runner command.Runner +} + +func newLister(runner command.Runner) *lister { + return &lister{ + runner: runner, + } +} + +func (l *lister) ListFilesAndUnstagedFiles( + ctx context.Context, + container app.EnvStdioContainer, + options ListFilesAndUnstagedFilesOptions, +) ([]string, error) { + allFilesOutput, err := command.RunStdout( + ctx, + container, + l.runner, + "git", + "ls-files", + "--cached", + "--modified", + "--others", + "--exclude-standard", + ) + if err != nil { + return nil, err + } + deletedFilesOutput, err := command.RunStdout( + ctx, + container, + l.runner, + "git", + "ls-files", + "--deleted", + ) + if err != nil { + return nil, err + } + return stringutil.SliceToUniqueSortedSlice( + filterNonRegularFiles( + stringSliceExceptMatches( + stringSliceExcept( + // This may not work in all Windows scenarios as we only split on "\n" but + // this is no worse than we previously had. + stringutil.SplitTrimLinesNoEmpty(string(allFilesOutput)), + stringutil.SplitTrimLinesNoEmpty(string(deletedFilesOutput)), + ), + options.IgnorePathRegexps, + ), + ), + ), nil +} + +// stringSliceExcept returns all elements in source that are not in except. +func stringSliceExcept(source []string, except []string) []string { + exceptMap := stringutil.SliceToMap(except) + result := make([]string, 0, len(source)) + for _, s := range source { + if _, ok := exceptMap[s]; !ok { + result = append(result, s) + } + } + return result +} + +// stringSliceExceptMatches returns all elements in source that do not match +// any of the regexps. +func stringSliceExceptMatches(source []string, regexps []*regexp.Regexp) []string { + if len(regexps) == 0 { + return source + } + result := make([]string, 0, len(source)) + for _, s := range source { + if !matchesAny(s, regexps) { + result = append(result, s) + } + } + return result +} + +// matchesAny returns true if any of regexps match. +func matchesAny(s string, regexps []*regexp.Regexp) bool { + for _, regexp := range regexps { + if regexp.MatchString(s) { + return true + } + } + return false +} + +// filterNonRegularFiles returns all regular files. +// +// This does an os.Stat call, so the files must exist for this to work. +// Given our usage here, this is true by the time this function is called. +func filterNonRegularFiles(files []string) []string { + filteredFiles := make([]string, 0, len(files)) + for _, file := range files { + if fileInfo, err := os.Stat(file); err == nil && fileInfo.Mode().IsRegular() { + filteredFiles = append(filteredFiles, file) + } + } + return filteredFiles +} diff --git a/pkg/bufman/pkg/git/object_reader.go b/pkg/bufman/pkg/git/object_reader.go new file mode 100644 index 000000000..f34d49460 --- /dev/null +++ b/pkg/bufman/pkg/git/object_reader.go @@ -0,0 +1,173 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "bufio" + "context" + "errors" + "fmt" + "io" + "strconv" + "strings" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "go.uber.org/multierr" +) + +const ( + objectTypeBlob = "blob" + objectTypeCommit = "commit" + objectTypeTree = "tree" + objectTypeTag = "tag" +) + +// exitTime is the amount of time we'll wait for git-cat-file(1) to exit. +var ( + exitTime = 5 * time.Second + errObjectTypeMismatch = errors.New("object type mismatch") +) + +type objectReader struct { + rx *bufio.Reader + tx io.WriteCloser + process command.Process +} + +func newObjectReader(gitDirPath string, runner command.Runner) (*objectReader, error) { + rx, stdout := io.Pipe() + stdin, tx := io.Pipe() + process, err := runner.Start( + "git", + command.StartWithArgs("cat-file", "--batch"), + command.StartWithStdin(stdin), + command.StartWithStdout(stdout), + command.StartWithEnv(map[string]string{ + "GIT_DIR": gitDirPath, + }), + ) + if err != nil { + return nil, err + } + return &objectReader{ + rx: bufio.NewReader(rx), + tx: tx, + process: process, + }, nil +} + +func (o *objectReader) close() error { + ctx, cancel := context.WithDeadline( + context.Background(), + time.Now().Add(exitTime), + ) + defer cancel() + return multierr.Combine( + o.tx.Close(), + o.process.Wait(ctx), + ) +} + +func (o *objectReader) Blob(hash Hash) ([]byte, error) { + return o.read(objectTypeBlob, hash) +} + +func (o *objectReader) Commit(hash Hash) (Commit, error) { + data, err := o.read(objectTypeCommit, hash) + if err != nil { + return nil, err + } + return parseCommit(hash, data) +} + +func (o *objectReader) Tree(hash Hash) (Tree, error) { + data, err := o.read(objectTypeTree, hash) + if err != nil { + return nil, err + } + return parseTree(hash, data) +} + +func (o *objectReader) Tag(hash Hash) (AnnotatedTag, error) { + data, err := o.read(objectTypeTag, hash) + if err != nil { + return nil, err + } + return parseAnnotatedTag(hash, data) +} + +func (o *objectReader) read(objectType string, id Hash) ([]byte, error) { + // request + if _, err := fmt.Fprintf(o.tx, "%s\n", id.Hex()); err != nil { + return nil, err + } + // response + header, err := o.rx.ReadBytes('\n') + if err != nil { + return nil, err + } + headerStr := strings.TrimRight(string(header), "\n") + parts := strings.Split(headerStr, " ") + if len(parts) == 2 && parts[1] == "missing" { + return nil, fmt.Errorf( + "git-cat-file: %s: %w", + parts[0], + ErrObjectNotFound, + ) + } + if len(parts) != 3 { + return nil, fmt.Errorf("git-cat-file: malformed header: %q", headerStr) + } + objID, err := parseHashFromHex(parts[0]) + if err != nil { + return nil, err + } + if id.Hex() != objID.Hex() { + return nil, fmt.Errorf("git-cat-file: mismatched object ID: %s, %s", id.Hex(), objID.Hex()) + } + objType := parts[1] + objLenStr := parts[2] + objLen, err := strconv.ParseInt(objLenStr, 10, 64) + if err != nil { + return nil, err + } + objContent := make([]byte, objLen) + if _, err := io.ReadAtLeast(o.rx, objContent, int(objLen)); err != nil { + return nil, err + } + // TODO: We can verify the object content if we move from opaque object IDs + // to ones that know about being hardened SHA1 or SHA256. + trailer, err := o.rx.ReadBytes('\n') + if err != nil { + return nil, err + } + if len(trailer) != 1 { + return nil, errors.New("git-cat-file: unexpected trailer") + } + // Check the response type. It's check here to consume the complete request + // first. + if objType != objectType { + return nil, fmt.Errorf( + "git-cat-file: object %q is a %s, not a %s: %w", + id, + objType, + objectType, + errObjectTypeMismatch, + ) + } + return objContent, nil +} diff --git a/pkg/bufman/pkg/git/packed_refs.go b/pkg/bufman/pkg/git/packed_refs.go new file mode 100644 index 000000000..5709cdf52 --- /dev/null +++ b/pkg/bufman/pkg/git/packed_refs.go @@ -0,0 +1,107 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "strings" +) + +const ( + // packedRefsHeader is the head for the `packed-refs` file + // based on https://github.com/git/git/blob/master/refs/packed-backend.c#LL1084C41-L1084C41 + packedRefsHeader = "# pack-refs with: peeled fully-peeled sorted " + tagRefPrefix = "refs/tags/" + originBranchRefPrefix = "refs/remotes/origin/" + unpeeledRefPrefix = '^' +) + +// parsePackedRefs reads a `packed-refs` file, returning the packed branches and tags +func parsePackedRefs(data []byte) ( + map[string]Hash, // branches + map[string]Hash, // tags + error, +) { + var ( + packedBranches = map[string]Hash{} + packedTags = map[string]Hash{} + ) + /* + data is in the format + \n + repeated: + \n + (optional for tags if unpeeled)^\n + + for branches, the hash is the commit object + for tags, the hash is the tag object; the following line is the commit hash + */ + var lines []string + scanner := bufio.NewScanner(bytes.NewReader(data)) + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + if scanner.Err() != nil { + return nil, nil, scanner.Err() + } + for i := 0; i < len(lines); i++ { + line := lines[i] + if strings.HasPrefix(line, "#") { + // Git tells us the way that these refs are packed. In theory the refs + // may be packed in different ways, but as of today's writing, they are + // always packed fully-peeled. + // + // The comment should match `packedRefsHeader`. We can safely skip this comment if so. + if line != packedRefsHeader { + return nil, nil, fmt.Errorf("unknown packed-refs header: %q", line) + } + continue + } + hashHex, ref, found := strings.Cut(line, " ") + if !found { + return nil, nil, errors.New("invalid packed-refs file") + } + hash, err := parseHashFromHex(hashHex) + if err != nil { + return nil, nil, err + } + if strings.HasPrefix(ref, originBranchRefPrefix) { + branchName := strings.TrimPrefix(ref, originBranchRefPrefix) + packedBranches[branchName] = hash + } else if strings.HasPrefix(ref, tagRefPrefix) { + tagName := strings.TrimPrefix(ref, tagRefPrefix) + // We're looking at a tag. If the tag is annotated, the next line is our actual + // commit hash, prefixed with '^'. If not, the already read hash is our commit hash. + // We need to look ahead to see the next line. + if len(lines) > i+1 && lines[i+1][0] == unpeeledRefPrefix { + // We have an annotated tag that's been peeled. Let's read it. + i++ + nextLine := lines[i] + nextLine = strings.TrimPrefix(nextLine, string(unpeeledRefPrefix)) + hash, err = parseHashFromHex(nextLine) + if err != nil { + return nil, nil, err + } + } + packedTags[tagName] = hash + } + // We ignore all kinds of refs. + } + return packedBranches, packedTags, nil +} diff --git a/pkg/bufman/pkg/git/packed_refs_test.go b/pkg/bufman/pkg/git/packed_refs_test.go new file mode 100644 index 000000000..84089973d --- /dev/null +++ b/pkg/bufman/pkg/git/packed_refs_test.go @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "os" + "path" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestReadPackedRefs(t *testing.T) { + t.Parallel() + + allBytes, err := os.ReadFile(path.Join("testdata", "packed-refs")) + require.NoError(t, err) + + branches, tags, err := parsePackedRefs(allBytes) + + require.NoError(t, err) + hexBranches := map[string]string{} + for branch, hash := range branches { + hexBranches[branch] = hash.Hex() + } + hexTags := map[string]string{} + for tag, hash := range tags { + hexTags[tag] = hash.Hex() + } + assert.Equal(t, hexBranches, map[string]string{ + "main": "45c2edc61040013349e094663e492996e0c044e3", + "paralleltest": "1fddd89116e24df213d43b7d837f5dd29ee9cbf0", + }) + assert.Equal(t, hexTags, map[string]string{ + "v0.1.0": "157c7ae554844ff7ae178536ec10787b5b74b5db", + "v0.2.0": "ace9301f315979bd053b7658c017391fe1af8804", + "v1.10.0": "ebb191e8268db7cee389e3abb0d1edc1852337a3", + }) +} diff --git a/pkg/bufman/pkg/git/ref.go b/pkg/bufman/pkg/git/ref.go new file mode 100644 index 000000000..a5fd83304 --- /dev/null +++ b/pkg/bufman/pkg/git/ref.go @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +type ref struct { + ref string +} + +func newRef(name string) *ref { + return &ref{ + ref: name, + } +} + +func (r *ref) cloneBranch() string { + return "" +} + +func (r *ref) checkout() string { + if r == nil { + return "" + } + return r.ref +} + +// Used for logging +func (r *ref) MarshalJSON() ([]byte, error) { + return []byte(`"` + r.checkout() + `"`), nil +} + +func (r *ref) String() string { + return r.checkout() +} diff --git a/pkg/bufman/pkg/git/ref_branch.go b/pkg/bufman/pkg/git/ref_branch.go new file mode 100644 index 000000000..b6e5a6306 --- /dev/null +++ b/pkg/bufman/pkg/git/ref_branch.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import "encoding/json" + +type refWithBranch struct { + ref string + branch string +} + +func newRefWithBranch(ref string, branch string) *refWithBranch { + return &refWithBranch{ + ref: ref, + branch: branch, + } +} + +func (r *refWithBranch) cloneBranch() string { + if r == nil { + return "" + } + return r.branch +} + +func (r *refWithBranch) checkout() string { + if r == nil { + return "" + } + return r.ref +} + +// Used for logging +func (r *refWithBranch) MarshalJSON() ([]byte, error) { + return json.Marshal(struct { + Ref string + Branch string + }{ + Ref: r.checkout(), + Branch: r.cloneBranch(), + }) +} + +func (r *refWithBranch) String() string { + return r.checkout() +} diff --git a/pkg/bufman/pkg/git/repository.go b/pkg/bufman/pkg/git/repository.go new file mode 100644 index 000000000..0c5f2483d --- /dev/null +++ b/pkg/bufman/pkg/git/repository.go @@ -0,0 +1,327 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "bytes" + "errors" + "fmt" + "io/fs" + "os" + "path" + "path/filepath" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/filepathextended" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +const defaultRemoteName = "origin" + +var baseBranchRefPrefix = []byte("ref: refs/remotes/" + defaultRemoteName + "/") + +type openRepositoryOpts struct { + baseBranch string +} + +type repository struct { + gitDirPath string + baseBranch string + objectReader *objectReader + + // packedOnce controls the fields below related to reading the `packed-refs` file + packedOnce sync.Once + packedReadError error + packedBranches map[string]Hash + packedTags map[string]Hash +} + +func openGitRepository( + gitDirPath string, + runner command.Runner, + options ...OpenRepositoryOption, +) (Repository, error) { + opts := &openRepositoryOpts{} + for _, opt := range options { + if err := opt(opts); err != nil { + return nil, err + } + } + gitDirPath = normalpath.Unnormalize(gitDirPath) + if err := validateDirPathExists(gitDirPath); err != nil { + return nil, err + } + gitDirPath, err := filepath.Abs(gitDirPath) + if err != nil { + return nil, err + } + reader, err := newObjectReader(gitDirPath, runner) + if err != nil { + return nil, err + } + if opts.baseBranch == "" { + opts.baseBranch, err = detectBaseBranch(gitDirPath) + if err != nil { + return nil, fmt.Errorf("automatically determine base branch: %w", err) + } + } + return &repository{ + gitDirPath: gitDirPath, + baseBranch: opts.baseBranch, + objectReader: reader, + }, nil +} + +func (r *repository) Close() error { + return r.objectReader.close() +} + +func (r *repository) Objects() ObjectReader { + return r.objectReader +} + +func (r *repository) ForEachBranch(f func(string, Hash) error) error { + seen := map[string]struct{}{} + // Read unpacked branch refs. + dir := path.Join(r.gitDirPath, "refs", "remotes", defaultRemoteName) + if err := filepathextended.Walk(dir, func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + if info.Name() == "HEAD" || info.IsDir() { + return nil + } + branchName, err := filepath.Rel(dir, path) + if err != nil { + return err + } + branchName = normalpath.Normalize(branchName) + hashBytes, err := os.ReadFile(path) + if err != nil { + return err + } + hashBytes = bytes.TrimSuffix(hashBytes, []byte{'\n'}) + hash, err := parseHashFromHex(string(hashBytes)) + if err != nil { + return err + } + seen[branchName] = struct{}{} + return f(branchName, hash) + }); err != nil { + return err + } + // Read packed branch refs that haven't been seen yet. + if err := r.readPackedRefs(); err != nil { + return err + } + for branchName, hash := range r.packedBranches { + if _, found := seen[branchName]; !found { + if err := f(branchName, hash); err != nil { + return err + } + } + } + return nil +} + +func (r *repository) BaseBranch() string { + return r.baseBranch +} + +func (r *repository) ForEachCommit(branch string, f func(Commit) error) error { + branch = normalpath.Unnormalize(branch) + commit, err := r.resolveBranch(branch) + if err != nil { + return err + } + var commits []Commit + // TODO: this only works for the base branch; for non-base branches, + // we have to be much more careful about not ranging over commits belonging + // to other branches (i.e., running past the origin of our branch). + // In order to do this, we will want to preload the HEADs of all known branches, + // and halt iteration for a given branch when we encounter the head of another branch. + for { + commits = append(commits, commit) + if len(commit.Parents()) == 0 { + // We've reach the root of the graph. + break + } + // When traversing a commit graph, follow only the first parent commit upon seeing a + // merge commit. This allows us to ignore the individual commits brought in to a branch's + // history by such a merge, as those commits are usually updating the state of the target + // branch. + commit, err = r.objectReader.Commit(commit.Parents()[0]) + if err != nil { + return err + } + } + // Visit in reverse order, starting with the root of the graph first. + for i := len(commits) - 1; i >= 0; i-- { + if err := f(commits[i]); err != nil { + return err + } + } + return nil +} + +func (r *repository) ForEachTag(f func(string, Hash) error) error { + seen := map[string]struct{}{} + // Read unpacked tag refs. + dir := path.Join(r.gitDirPath, "refs", "tags") + if err := filepathextended.Walk(dir, func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + if !info.Mode().IsRegular() { + return nil + } + tagName, err := filepath.Rel(dir, path) + if err != nil { + return err + } + tagName = normalpath.Normalize(tagName) + hashBytes, err := os.ReadFile(path) + if err != nil { + return err + } + hashBytes = bytes.TrimSuffix(hashBytes, []byte{'\n'}) + hash, err := parseHashFromHex(string(hashBytes)) + if err != nil { + return err + } + // Tags are either annotated or lightweight. Depending on the type, + // they are stored differently. First, we try to load the tag + // as an annnotated tag. If this fails, we try a commit. + // Finally, we fail. + tag, err := r.objectReader.Tag(hash) + if err == nil { + seen[tagName] = struct{}{} + return f(tagName, tag.Commit()) + } + if !errors.Is(err, errObjectTypeMismatch) { + return err + } + _, err = r.objectReader.Commit(hash) + if err == nil { + seen[tagName] = struct{}{} + return f(tagName, hash) + } + if !errors.Is(err, errObjectTypeMismatch) { + return err + } + return fmt.Errorf( + "failed to determine target of tag %q; it is neither a tag nor a commit", + tagName, + ) + }); err != nil { + return err + } + // Read packed tag refs that haven't been seen yet. + if err := r.readPackedRefs(); err != nil { + return err + } + for tagName, commit := range r.packedTags { + if _, found := seen[tagName]; !found { + if err := f(tagName, commit); err != nil { + return err + } + } + } + return nil +} + +func (r *repository) resolveBranch(branch string) (Commit, error) { + commitBytes, err := os.ReadFile(path.Join(r.gitDirPath, "refs", "remotes", defaultRemoteName, branch)) + if errors.Is(err, fs.ErrNotExist) { + // it may be that the branch ref is packed; let's read the packed refs + if err := r.readPackedRefs(); err != nil { + return nil, err + } + if commitID, ok := r.packedBranches[branch]; ok { + commit, err := r.objectReader.Commit(commitID) + if err != nil { + return nil, err + } + return commit, nil + } + return nil, fmt.Errorf("branch %q not found", branch) + } + if err != nil { + return nil, err + } + commitBytes = bytes.TrimRight(commitBytes, "\n") + commitID, err := NewHashFromHex(string(commitBytes)) + if err != nil { + return nil, err + } + commit, err := r.objectReader.Commit(commitID) + if err != nil { + return nil, err + } + return commit, nil +} + +func (r *repository) readPackedRefs() error { + r.packedOnce.Do(func() { + packedRefsPath := path.Join(r.gitDirPath, "packed-refs") + if _, err := os.Stat(packedRefsPath); err != nil { + if errors.Is(err, os.ErrNotExist) { + r.packedBranches = map[string]Hash{} + r.packedTags = map[string]Hash{} + return + } + r.packedReadError = err + return + } + allBytes, err := os.ReadFile(packedRefsPath) + if err != nil { + r.packedReadError = err + return + } + r.packedBranches, r.packedTags, r.packedReadError = parsePackedRefs(allBytes) + }) + return r.packedReadError +} + +func detectBaseBranch(gitDirPath string) (string, error) { + path := path.Join(gitDirPath, "refs", "remotes", defaultRemoteName, "HEAD") + data, err := os.ReadFile(path) + if err != nil { + return "", err + } + if !bytes.HasPrefix(data, baseBranchRefPrefix) { + return "", errors.New("invalid contents in " + path) + } + data = bytes.TrimPrefix(data, baseBranchRefPrefix) + data = bytes.TrimSuffix(data, []byte("\n")) + return string(data), nil +} + +// validateDirPathExists returns a non-nil error if the given dirPath +// is not a valid directory path. +func validateDirPathExists(dirPath string) error { + var fileInfo os.FileInfo + // We do not follow symlinks + fileInfo, err := os.Lstat(dirPath) + if err != nil { + return err + } + if !fileInfo.IsDir() { + return normalpath.NewError(dirPath, errors.New("not a directory")) + } + return nil +} diff --git a/pkg/bufman/pkg/git/repository_test.go b/pkg/bufman/pkg/git/repository_test.go new file mode 100644 index 000000000..2f60da071 --- /dev/null +++ b/pkg/bufman/pkg/git/repository_test.go @@ -0,0 +1,115 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git_test + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git/gittest" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestTags(t *testing.T) { + t.Parallel() + + repo := gittest.ScaffoldGitRepository(t) + var tags []string + err := repo.ForEachTag(func(tag string, commitHash git.Hash) error { + tags = append(tags, tag) + + commit, err := repo.Objects().Commit(commitHash) + require.NoError(t, err) + switch tag { + case "release/v1": + assert.Equal(t, commit.Message(), "initial commit") + case "branch/v1": + assert.Equal(t, commit.Message(), "branch1") + case "branch/v2": + assert.Equal(t, commit.Message(), "branch2") + case "v2": + assert.Equal(t, commit.Message(), "second commit") + case "v3.0": + assert.Equal(t, commit.Message(), "third commit") + default: + assert.Failf(t, "unknown tag", tag) + } + + return nil + }) + + require.NoError(t, err) + require.ElementsMatch(t, tags, []string{ + "release/v1", + "branch/v1", + "branch/v2", + "v2", + "v3.0", + }) +} + +func TestCommits(t *testing.T) { + t.Parallel() + + repo := gittest.ScaffoldGitRepository(t) + var commits []git.Commit + err := repo.ForEachCommit(gittest.DefaultBranch, func(c git.Commit) error { + commits = append(commits, c) + return nil + }) + + require.NoError(t, err) + require.Len(t, commits, 3) + assert.Empty(t, commits[0].Parents()) + assert.Equal(t, commits[0].Message(), "initial commit") + assert.Contains(t, commits[1].Parents(), commits[0].Hash()) + assert.Equal(t, commits[1].Message(), "second commit") + assert.Contains(t, commits[2].Parents(), commits[1].Hash()) + assert.Equal(t, commits[2].Message(), "third commit") +} + +func TestBranches(t *testing.T) { + t.Parallel() + + repo := gittest.ScaffoldGitRepository(t) + var branches []string + err := repo.ForEachBranch(func(branch string, headHash git.Hash) error { + branches = append(branches, branch) + + commit, err := repo.Objects().Commit(headHash) + require.NoError(t, err) + switch branch { + case "master": + assert.Equal(t, commit.Message(), "third commit") + case "smian/branch1": + assert.Equal(t, commit.Message(), "branch1") + case "smian/branch2": + assert.Equal(t, commit.Message(), "branch2") + default: + assert.Failf(t, "unknown branch", branch) + } + + return nil + }) + + require.NoError(t, err) + require.ElementsMatch(t, branches, []string{ + "master", + "smian/branch1", + "smian/branch2", + }) +} diff --git a/pkg/bufman/pkg/git/testdata/packed-refs b/pkg/bufman/pkg/git/testdata/packed-refs new file mode 100644 index 000000000..d47a72249 --- /dev/null +++ b/pkg/bufman/pkg/git/testdata/packed-refs @@ -0,0 +1,10 @@ +# pack-refs with: peeled fully-peeled sorted +45c2edc61040013349e094663e492996e0c044e3 refs/remotes/origin/main +1fddd89116e24df213d43b7d837f5dd29ee9cbf0 refs/remotes/origin/paralleltest +27523d9000238e0f7fb35d6052d10016852beee3 refs/remotes/otherorigin/main +959e716b38b179bd5a4e7edfc549db2e30df3c8e refs/remotes/otherorigin/paralleltest +4acbbca27c6d7bc0f4027c1897f89da140789e55 refs/tags/v0.1.0 +^157c7ae554844ff7ae178536ec10787b5b74b5db +ebb191e8268db7cee389e3abb0d1edc1852337a3 refs/tags/v1.10.0 +170e69af5a7a768c5d3be15e4734919ea051188d refs/tags/v0.2.0 +^ace9301f315979bd053b7658c017391fe1af8804 diff --git a/pkg/bufman/pkg/git/tree.go b/pkg/bufman/pkg/git/tree.go new file mode 100644 index 000000000..2b70b0b03 --- /dev/null +++ b/pkg/bufman/pkg/git/tree.go @@ -0,0 +1,116 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "bytes" + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +type tree struct { + hash Hash + nodes []TreeNode +} + +func parseTree(hash Hash, data []byte) (*tree, error) { + t := &tree{ + hash: hash, + } + /* + data is in the format + \0 + repeated + */ + for len(data) > 0 { + // We can find the \0 character before the + // and slice to the index of \0 + the length of a hash. + // That gives us a single node. + i := bytes.Index(data, []byte{0}) + if i == -1 { + return nil, errors.New("parse tree") + } + length := i + 1 + hashLength + node, err := parseTreeNode(data[:length]) + if err != nil { + return nil, fmt.Errorf("parse tree: %w", err) + } + t.nodes = append(t.nodes, node) + data = data[length:] + } + return t, nil +} + +func (t *tree) Hash() Hash { + return t.hash +} + +func (t *tree) Nodes() []TreeNode { + return t.nodes +} + +func (t *tree) Descendant(path string, objectReader ObjectReader) (TreeNode, error) { + if path == "" { + return nil, errors.New("empty path") + } + return descendant(objectReader, t, normalpath.Components(path)) +} + +func descendant( + objectReader ObjectReader, + root Tree, + names []string, +) (TreeNode, error) { + // split by the name of the next node we're looking for + // and the names of the descendant nodes + name := names[0] + if len(names) >= 2 { + names = names[1:] + } else { + names = nil + } + // Find node with that name in this tree. + var found TreeNode + for _, node := range root.Nodes() { + if node.Name() == name { + found = node + break + } + } + if found == nil { + // No node with that name in this tree. + return nil, ErrTreeNodeNotFound + } + if len(names) == 0 { + // No more descendants, we've found our terminal node. + return found, nil + } + if found.Mode() != ModeDir { + // This is an intermediate (non-terminal) node, which are expected to be + // directories. This is node is not a directory, so we fail with a non-found + // errror. + return nil, ErrTreeNodeNotFound + } + // TODO: support symlinks (on intermediate dirs) with descendant option + // Descend down and traverse. + tree, err := objectReader.Tree(found.Hash()) + if err != nil { + return nil, err + } + return descendant(objectReader, tree, names) +} diff --git a/pkg/bufman/pkg/git/tree_node.go b/pkg/bufman/pkg/git/tree_node.go new file mode 100644 index 000000000..5e07fa9e1 --- /dev/null +++ b/pkg/bufman/pkg/git/tree_node.go @@ -0,0 +1,87 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "bytes" + "errors" + "fmt" + "strconv" +) + +type treeNode struct { + name string + mode ObjectMode + hash Hash +} + +func parseTreeNode(data []byte) (*treeNode, error) { + /* + data is in the format + \0 + */ + modeAndName, hash, found := bytes.Cut(data, []byte{0}) + if !found { + return nil, errors.New("parse tree node") + } + parsedHash, err := newHashFromBytes(hash) + if err != nil { + return nil, fmt.Errorf("parse tree node hash: %w", err) + } + mode, name, found := bytes.Cut(modeAndName, []byte{' '}) + if !found { + return nil, errors.New("parse tree node") + } + parsedFileMode, err := parseObjectMode(mode) + if err != nil { + return nil, fmt.Errorf("parse tree node object mode: %w", err) + } + return &treeNode{ + hash: parsedHash, + name: string(name), + mode: parsedFileMode, + }, nil +} + +func (e *treeNode) Name() string { + return e.name +} + +func (e *treeNode) Mode() ObjectMode { + return e.mode +} + +func (e *treeNode) Hash() Hash { + return e.hash +} + +// decodes the octal form of a object mode into one of the valid Mode* values. +func parseObjectMode(data []byte) (ObjectMode, error) { + mode, err := strconv.ParseUint(string(data), 8, 32) + if err != nil { + return 0, err + } + switch ObjectMode(mode) { + case ModeFile: + case ModeExe: + case ModeDir: + case ModeSymlink: + case ModeSubmodule: + default: + return 0, fmt.Errorf("unknown object mode: %o", mode) + } + return ObjectMode(mode), nil +} diff --git a/pkg/bufman/pkg/git/tree_node_test.go b/pkg/bufman/pkg/git/tree_node_test.go new file mode 100644 index 000000000..4ab8300c2 --- /dev/null +++ b/pkg/bufman/pkg/git/tree_node_test.go @@ -0,0 +1,77 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestParseFileMode(t *testing.T) { + t.Parallel() + + tests := []struct { + desc string + mode ObjectMode + txt string + expectErr bool + }{ + { + desc: "zero value", + expectErr: true, + }, + { + desc: "file", + mode: ModeFile, + txt: "100644", + }, + { + desc: "exe", + mode: ModeExe, + txt: "100755", + }, + { + desc: "directory", + mode: ModeDir, + txt: "040000", + }, + { + desc: "symlink", + mode: ModeSymlink, + txt: "120000", + }, + { + desc: "submodule", + mode: ModeSubmodule, + txt: "160000", + }, + } + + for i := range tests { + test := tests[i] + t.Run(test.desc, func(t *testing.T) { + t.Parallel() + mode, err := parseObjectMode([]byte(test.txt)) + if test.expectErr { + assert.Error(t, err) + } else { + assert.NoError(t, err) + assert.Equal(t, test.mode, mode) + } + }) + } +} diff --git a/pkg/bufman/pkg/git/tree_test.go b/pkg/bufman/pkg/git/tree_test.go new file mode 100644 index 000000000..8456a8eee --- /dev/null +++ b/pkg/bufman/pkg/git/tree_test.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package git + +import ( + "encoding/base64" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestParseTree(t *testing.T) { + t.Parallel() + + /* + This is generated using the following procedure: + ```sh + ➜ git init + ➜ touch .gitignore a.proto b + ➜ mkdir c && touch c/d.proto + ➜ git add * && git add --chmod +x b + ➜ git commit -m 'initial commit' + ``` + Then simply `git cat-file` the tree at HEAD and encode to base64. + */ + bytes, err := base64.StdEncoding.DecodeString("MTAwNjQ0IGEucHJvdG8A5p3im7LR1kNLiymud1rYwuSMU5ExMDA3NTUgYgDmneKbstHWQ0uLKa53WtjC5IxTkTQwMDAwIGMAXEw7X4b6IGAIGHO/LwaXPdE5gys=") + require.NoError(t, err) + hash, err := parseHashFromHex("43848150a6f5f6d76eeef6e0f69eb46290eefab6") + require.NoError(t, err) + + tree, err := parseTree(hash, bytes) + + assert.NoError(t, err) + assert.Equal(t, tree.Hash(), hash) + assert.Len(t, tree.Nodes(), 3) + assert.Equal(t, tree.Nodes()[0].Hash().Hex(), "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391") + assert.Equal(t, tree.Nodes()[0].Name(), "a.proto") + assert.Equal(t, tree.Nodes()[0].Mode(), ModeFile) + assert.Equal(t, tree.Nodes()[1].Hash().Hex(), "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391") + assert.Equal(t, tree.Nodes()[1].Name(), "b") + assert.Equal(t, tree.Nodes()[1].Mode(), ModeExe) + assert.Equal(t, tree.Nodes()[2].Hash().Hex(), "5c4c3b5f86fa2060081873bf2f06973dd139832b") + assert.Equal(t, tree.Nodes()[2].Name(), "c") + assert.Equal(t, tree.Nodes()[2].Mode(), ModeDir) +} diff --git a/pkg/bufman/pkg/github/githubtesting/archive_reader.go b/pkg/bufman/pkg/github/githubtesting/archive_reader.go new file mode 100644 index 000000000..5537b8d8e --- /dev/null +++ b/pkg/bufman/pkg/github/githubtesting/archive_reader.go @@ -0,0 +1,133 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package githubtesting + +import ( + "compress/gzip" + "context" + "fmt" + "net/http" + "os" + "sync" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/filelock" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagearchive" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/multierr" + "go.uber.org/zap" +) + +// since we are in testing, we care less about making sure this times out early +// we have had some flaky tests based on this being too low, especially when +// using the race detector +const filelockTimeout = 10 * time.Second + +type archiveReader struct { + logger *zap.Logger + storageosProvider storageos.Provider + httpClient *http.Client + lock sync.Mutex +} + +func newArchiveReader( + logger *zap.Logger, + storageosProvider storageos.Provider, + httpClient *http.Client, +) *archiveReader { + return &archiveReader{ + logger: logger.Sugar().Named("githubtesting"), + storageosProvider: storageosProvider, + httpClient: httpClient, + } +} + +func (a *archiveReader) GetArchive( + ctx context.Context, + outputDirPath string, + owner string, + repository string, + ref string, +) (retErr error) { + a.lock.Lock() + defer a.lock.Unlock() + + outputDirPath = normalpath.Unnormalize(outputDirPath) + + // creates a file in the same parent directory as outputDirPath + unlocker, err := filelock.Lock( + ctx, + outputDirPath+".lock", + filelock.LockWithTimeout(filelockTimeout), + ) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, unlocker.Unlock()) + }() + + // check if already exists, if so, do nothing + // OK to use os.Stat here + if fileInfo, err := os.Stat(outputDirPath); err == nil { + if !fileInfo.IsDir() { + return fmt.Errorf("expected %s to be a directory", outputDirPath) + } + return nil + } + request, err := http.NewRequestWithContext( + ctx, + "GET", + fmt.Sprintf("https://github.com/%s/%s/archive/%s.tar.gz", owner, repository, ref), + nil, + ) + if err != nil { + return err + } + response, err := a.httpClient.Do(request) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, response.Body.Close()) + }() + if response.StatusCode != http.StatusOK { + return fmt.Errorf("expected HTTP status code %d to be %d", response.StatusCode, http.StatusOK) + } + gzipReader, err := gzip.NewReader(response.Body) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, gzipReader.Close()) + }() + if err := os.MkdirAll(outputDirPath, 0o755); err != nil { + return err + } + // do NOT want to read in symlinks + readWriteBucket, err := a.storageosProvider.NewReadWriteBucket(normalpath.Normalize(outputDirPath)) + if err != nil { + return err + } + return storagearchive.Untar( + ctx, + gzipReader, + readWriteBucket, + nil, + 1, + ) +} diff --git a/pkg/bufman/pkg/github/githubtesting/githubtesting.go b/pkg/bufman/pkg/github/githubtesting/githubtesting.go new file mode 100644 index 000000000..1872eea77 --- /dev/null +++ b/pkg/bufman/pkg/github/githubtesting/githubtesting.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package githubtesting provides testing functionality for GitHub. +package githubtesting + +import ( + "context" + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "go.uber.org/zap" +) + +// ArchiveReader reads GitHub archives. +type ArchiveReader interface { + // GetArchive gets the GitHub archive and untars it to the output directory path. + // + // The root directory within the tarball is stripped. + // If the directory already exists, this is a no-op. + // + // Uses file locking to make sure the no-op works properly across multiple process invocations, + // which is needed for example with go test. + // This is also thread-safe. + // + // Only use for testing. + GetArchive( + ctx context.Context, + outputDirPath string, + owner string, + repository string, + ref string, + ) error +} + +// NewArchiveReader returns a new ArchiveReader. +func NewArchiveReader( + logger *zap.Logger, + storageosProvider storageos.Provider, + httpClient *http.Client, +) ArchiveReader { + return newArchiveReader( + logger, + storageosProvider, + httpClient, + ) +} diff --git a/pkg/bufman/pkg/httpauth/env_authenticator.go b/pkg/bufman/pkg/httpauth/env_authenticator.go new file mode 100644 index 000000000..8e697e67a --- /dev/null +++ b/pkg/bufman/pkg/httpauth/env_authenticator.go @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpauth + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" +) + +type envAuthenticator struct { + usernameKey string + passwordKey string +} + +func newEnvAuthenticator( + usernameKey string, + passwordKey string, +) *envAuthenticator { + return &envAuthenticator{ + usernameKey: usernameKey, + passwordKey: passwordKey, + } +} + +func (a *envAuthenticator) SetAuth(envContainer app.EnvContainer, request *http.Request) (bool, error) { + return setBasicAuth( + request, + envContainer.Env(a.usernameKey), + envContainer.Env(a.passwordKey), + a.usernameKey, + a.passwordKey, + ) +} diff --git a/pkg/bufman/pkg/httpauth/httpauth.go b/pkg/bufman/pkg/httpauth/httpauth.go new file mode 100644 index 000000000..343041301 --- /dev/null +++ b/pkg/bufman/pkg/httpauth/httpauth.go @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpauth + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" +) + +// Authenticator adds authentication to request. +// +// This could be instead replaced with a http.RoundTripper workflow, however +// this means we have to use the same http.Client, and we generally pass EnvContainers +// to functions right now, and not building objects with EnvContainers, so this would +// not fit in with the rest of this codebase. This should be re-evaluated though. +type Authenticator interface { + // SetAuth sets authentication on the request. + // + // Returns true if authentication successfully set. + // Does nothing and returns false if no authentication available for the given request. + // Does nothing and returns false if the request scheme is not https. + SetAuth(envContainer app.EnvContainer, request *http.Request) (bool, error) +} + +// NewEnvAuthenticator returns a new env Authenticator for the environment. +func NewEnvAuthenticator(usernameKey string, passwordKey string) Authenticator { + return newEnvAuthenticator( + usernameKey, + passwordKey, + ) +} + +// NewNetrcAuthenticator returns a new netrc Authenticator. +func NewNetrcAuthenticator() Authenticator { + return newNetrcAuthenticator() +} + +// NewNopAuthenticator returns a new nop Authenticator. +// +// Always returns false and nil. +func NewNopAuthenticator() Authenticator { + return newNopAuthenticator() +} + +// NewMultiAuthenticator returns a new multi Authenticator. +// +// Stops on first matching SetAuth request. +func NewMultiAuthenticator(authenticators ...Authenticator) Authenticator { + return newMultiAuthenticator(authenticators...) +} diff --git a/pkg/bufman/pkg/httpauth/multi_authenticator.go b/pkg/bufman/pkg/httpauth/multi_authenticator.go new file mode 100644 index 000000000..c062f62fa --- /dev/null +++ b/pkg/bufman/pkg/httpauth/multi_authenticator.go @@ -0,0 +1,52 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpauth + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" +) + +type multiAuthenticator struct { + authenticators []Authenticator +} + +func newMultiAuthenticator(authenticators ...Authenticator) *multiAuthenticator { + return &multiAuthenticator{ + authenticators: authenticators, + } +} + +func (a *multiAuthenticator) SetAuth(envContainer app.EnvContainer, request *http.Request) (bool, error) { + switch len(a.authenticators) { + case 0: + return false, nil + case 1: + return a.authenticators[0].SetAuth(envContainer, request) + default: + for _, authenticator := range a.authenticators { + ok, err := authenticator.SetAuth(envContainer, request) + if err != nil { + return false, err + } + if ok { + return true, nil + } + } + return false, nil + } +} diff --git a/pkg/bufman/pkg/httpauth/netrc_authenticator.go b/pkg/bufman/pkg/httpauth/netrc_authenticator.go new file mode 100644 index 000000000..88aa36513 --- /dev/null +++ b/pkg/bufman/pkg/httpauth/netrc_authenticator.go @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpauth + +import ( + "errors" + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/netrc" +) + +type netrcAuthenticator struct{} + +func newNetrcAuthenticator() *netrcAuthenticator { + return &netrcAuthenticator{} +} + +func (a *netrcAuthenticator) SetAuth(envContainer app.EnvContainer, request *http.Request) (bool, error) { + if request.URL == nil { + return false, errors.New("malformed request: no url") + } + if request.URL.Host == "" { + return false, errors.New("malformed request: no url host") + } + machine, err := netrc.GetMachineForName(envContainer, request.URL.Host) + if err != nil { + return false, err + } + if machine == nil { + return false, nil + } + return setBasicAuth( + request, + machine.Login(), + machine.Password(), + "netrc login for host", + "netrc password for host", + ) +} diff --git a/pkg/bufman/pkg/httpauth/nop_authenticator.go b/pkg/bufman/pkg/httpauth/nop_authenticator.go new file mode 100644 index 000000000..be193939a --- /dev/null +++ b/pkg/bufman/pkg/httpauth/nop_authenticator.go @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpauth + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" +) + +type nopAuthenticator struct{} + +func newNopAuthenticator() *nopAuthenticator { + return &nopAuthenticator{} +} + +func (*nopAuthenticator) SetAuth(app.EnvContainer, *http.Request) (bool, error) { + return false, nil +} diff --git a/pkg/bufman/pkg/httpauth/util.go b/pkg/bufman/pkg/httpauth/util.go new file mode 100644 index 000000000..f0c2be07a --- /dev/null +++ b/pkg/bufman/pkg/httpauth/util.go @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpauth + +import ( + "errors" + "fmt" + "net/http" +) + +func setBasicAuth( + request *http.Request, + username string, + password string, + usernameKey string, + passwordKey string, +) (bool, error) { + if request.URL == nil { + return false, errors.New("malformed request: no url") + } + if request.URL.Scheme == "" { + return false, errors.New("malformed request: no url scheme") + } + if request.URL.Scheme != "https" { + return false, nil + } + if username != "" && password != "" { + request.SetBasicAuth(username, password) + return true, nil + } + if username == "" && password == "" { + return false, nil + } + if password == "" { + return false, fmt.Errorf("%s set but %s not set", usernameKey, passwordKey) + } + return false, fmt.Errorf("%s set but %s not set", passwordKey, usernameKey) +} diff --git a/pkg/bufman/pkg/interrupt/interrupt.go b/pkg/bufman/pkg/interrupt/interrupt.go new file mode 100644 index 000000000..1282f8be6 --- /dev/null +++ b/pkg/bufman/pkg/interrupt/interrupt.go @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package interrupt + +import ( + "context" + "os" + "os/signal" +) + +var signals = append( + []os.Signal{ + os.Interrupt, + }, + extraSignals..., +) + +// WithCancel returns a context that is cancelled if interrupt signals are sent. +func WithCancel(ctx context.Context) (context.Context, context.CancelFunc) { + signalC, closer := NewSignalChannel() + ctx, cancel := context.WithCancel(ctx) + go func() { + <-signalC + closer() + cancel() + }() + return ctx, cancel +} + +// NewSignalChannel returns a new channel for interrupt signals. +// +// Call the returned function to cancel sending to this channel. +func NewSignalChannel() (<-chan os.Signal, func()) { + signalC := make(chan os.Signal, 1) + signal.Notify(signalC, signals...) + return signalC, func() { + signal.Stop(signalC) + close(signalC) + } +} diff --git a/pkg/bufman/pkg/interrupt/interrupt_unix.go b/pkg/bufman/pkg/interrupt/interrupt_unix.go new file mode 100644 index 000000000..137da07e0 --- /dev/null +++ b/pkg/bufman/pkg/interrupt/interrupt_unix.go @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matching the unix-like build tags in the Golang source i.e. https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/file_unix.go#L6 + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package interrupt + +import ( + "os" + "syscall" +) + +// extraSignals are signals beyond os.Interrupt that we want to be handled +// as interrupts. +// +// For unix-like platforms, this adds syscall.SIGTERM, although this is only +// tested on darwin and linux, which buf officially supports. Other unix-like +// platforms should have this as well, however. +var extraSignals = []os.Signal{ + syscall.SIGTERM, +} diff --git a/pkg/bufman/pkg/interrupt/interrupt_windows.go b/pkg/bufman/pkg/interrupt/interrupt_windows.go new file mode 100644 index 000000000..631061513 --- /dev/null +++ b/pkg/bufman/pkg/interrupt/interrupt_windows.go @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package interrupt + +import "os" + +// extraSignals are signals beyond os.Interrupt that we want to be handled +// as interrupts. +// +// For unix-like platforms, this adds syscall.SIGTERM, although this is only +// tested on darwin and linux, which buf officially supports. Other unix-like +// platforms should have this as well, however. +var extraSignals = []os.Signal{} diff --git a/pkg/bufman/pkg/ioextended/ioextended.go b/pkg/bufman/pkg/ioextended/ioextended.go new file mode 100644 index 000000000..aa21edf62 --- /dev/null +++ b/pkg/bufman/pkg/ioextended/ioextended.go @@ -0,0 +1,127 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package ioextended provides io utilities. +package ioextended + +import ( + "bytes" + "io" + "sync" + + "go.uber.org/multierr" +) + +var ( + // DiscardReader is an io.Reader in which all calls return 0 and io.EOF. + DiscardReader io.Reader = discardReader{} + // DiscardReadCloser is an io.ReadCloser in which all calls return 0 and io.EOF. + DiscardReadCloser io.ReadCloser = io.NopCloser(DiscardReader) + // DiscardWriteCloser is a discard io.WriteCloser. + DiscardWriteCloser io.WriteCloser = NopWriteCloser(io.Discard) + // NopCloser is a no-op closer. + NopCloser = nopCloser{} +) + +// NopWriteCloser returns an io.WriteCloser with a no-op Close method wrapping the provided io.Writer. +func NopWriteCloser(writer io.Writer) io.WriteCloser { + return nopWriteCloser{Writer: writer} +} + +// LockedWriter creates a locked Writer. +func LockedWriter(writer io.Writer) io.Writer { + return &lockedWriter{writer: writer} +} + +// CompositeReadCloser returns a io.ReadCloser that is a composite of the Reader and Closer. +func CompositeReadCloser(reader io.Reader, closer io.Closer) io.ReadCloser { + return compositeReadCloser{Reader: reader, Closer: closer} +} + +// CompositeWriteCloser returns a io.WriteCloser that is a composite of the Writer and Closer. +func CompositeWriteCloser(writer io.Writer, closer io.Closer) io.WriteCloser { + return compositeWriteCloser{Writer: writer, Closer: closer} +} + +// ChainCloser chains the closers by calling them in order. +func ChainCloser(closers ...io.Closer) io.Closer { + return chainCloser{closers: closers} +} + +// ReaderAtForReader converts an io.Reader to an io.ReaderAt. +func ReaderAtForReader(reader io.Reader) (io.ReaderAt, error) { + if readerAt, ok := reader.(io.ReaderAt); ok { + return readerAt, nil + } + data, err := io.ReadAll(reader) + if err != nil { + return nil, err + } + return bytes.NewReader(data), nil +} + +type discardReader struct{} + +func (discardReader) Read([]byte) (int, error) { + return 0, io.EOF +} + +type nopWriteCloser struct { + io.Writer +} + +func (nopWriteCloser) Close() error { + return nil +} + +type nopCloser struct{} + +func (nopCloser) Close() error { + return nil +} + +type lockedWriter struct { + writer io.Writer + lock sync.Mutex +} + +func (l *lockedWriter) Write(p []byte) (int, error) { + l.lock.Lock() + n, err := l.writer.Write(p) + l.lock.Unlock() + return n, err +} + +type compositeReadCloser struct { + io.Reader + io.Closer +} + +type compositeWriteCloser struct { + io.Writer + io.Closer +} + +type chainCloser struct { + closers []io.Closer +} + +func (c chainCloser) Close() error { + var err error + for _, closer := range c.closers { + err = multierr.Append(err, closer.Close()) + } + return err +} diff --git a/pkg/bufman/pkg/iotesting/iotesting.go b/pkg/bufman/pkg/iotesting/iotesting.go new file mode 100644 index 000000000..7eab00817 --- /dev/null +++ b/pkg/bufman/pkg/iotesting/iotesting.go @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package iotesting + +import ( + "io" + "strings" + "testing" +) + +// NewWriter returns a new io.Writer that writes +// to a testing logger.Sugar(). +func NewWriter(tb testing.TB) io.Writer { + return &writer{ + tb: tb, + } +} + +type writer struct { + tb testing.TB +} + +func (t *writer) Write(in []byte) (int, error) { + t.tb.Helper() + t.tb.Log(strings.TrimSpace(string(in))) + return len(in), nil +} diff --git a/pkg/bufman/pkg/licenseheader/cmd/license-header/main.go b/pkg/bufman/pkg/licenseheader/cmd/license-header/main.go new file mode 100644 index 000000000..d7ac14677 --- /dev/null +++ b/pkg/bufman/pkg/licenseheader/cmd/license-header/main.go @@ -0,0 +1,221 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "bytes" + "context" + "fmt" + "os" + "regexp" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/diff" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/licenseheader" + "github.com/spf13/cobra" + "github.com/spf13/pflag" +) + +const ( + use = "license-header" + + copyrightHolderFlagName = "copyright-holder" + licenseTypeFlagName = "license-type" + yearRangeFlagName = "year-range" + diffFlagName = "diff" + exitCodeFlagName = "exit-code" + ignoreFlagName = "ignore" + ignoreFlagShortName = "e" +) + +func main() { + appcmd.Main(context.Background(), newCommand()) +} + +func newCommand() *appcmd.Command { + flags := newFlags() + return &appcmd.Command{ + Use: use + " files...", + Run: func(ctx context.Context, container app.Container) error { + return run(ctx, container, flags) + }, + BindFlags: flags.Bind, + } +} + +type flags struct { + LicenseType string + CopyrightHolder string + YearRange string + Diff bool + ExitCode bool + Ignore []string +} + +func newFlags() *flags { + return &flags{} +} + +func (f *flags) Bind(flagSet *pflag.FlagSet) { + flagSet.StringVar( + &f.LicenseType, + licenseTypeFlagName, + "", + "The license type. Must be one of [none,apache,proprietary].", + ) + _ = cobra.MarkFlagRequired(flagSet, licenseTypeFlagName) + flagSet.StringVar( + &f.CopyrightHolder, + copyrightHolderFlagName, + "", + "The copyright holder. Required if license type is not none.", + ) + flagSet.StringVar( + &f.YearRange, + yearRangeFlagName, + "", + "The year range. Required if license type is not none.", + ) + flagSet.BoolVar( + &f.Diff, + diffFlagName, + false, + "Print a diff instead of modifying the files.", + ) + flagSet.BoolVar( + &f.ExitCode, + exitCodeFlagName, + false, + fmt.Sprintf("Exit with a non-zero exit code if a diff is present. Only valid with %s.", diffFlagName), + ) + flagSet.StringSliceVarP( + &f.Ignore, + ignoreFlagName, + ignoreFlagShortName, + nil, + `File paths to ignore. +These are extended regexes in the style of egrep. +If a file matches any of these values, it will be ignored. +Only works if there are no arguments and license-header does its own search for files.`, + ) +} + +func run(ctx context.Context, container app.Container, flags *flags) error { + if flags.ExitCode && !flags.Diff { + return appcmd.NewInvalidArgumentErrorf("cannot specify %s without %s", exitCodeFlagName, diffFlagName) + } + licenseType, err := licenseheader.ParseLicenseType(flags.LicenseType) + if err != nil { + return appcmd.NewInvalidArgumentErrorf("--%s: %v", licenseTypeFlagName, err) + } + if licenseType != licenseheader.LicenseTypeNone { + if flags.CopyrightHolder == "" { + return newRequiredFlagError(copyrightHolderFlagName) + } + if flags.YearRange == "" { + return newRequiredFlagError(yearRangeFlagName) + } + } + runner := command.NewRunner() + filenames, err := getFilenames(ctx, container, runner, flags.Ignore) + if err != nil { + return err + } + for _, filename := range filenames { + data, err := os.ReadFile(filename) + if err != nil { + return err + } + modifiedData, err := licenseheader.Modify( + licenseType, + flags.CopyrightHolder, + flags.YearRange, + filename, + data, + ) + if err != nil { + return err + } + if !bytes.Equal(data, modifiedData) { + if flags.Diff { + diffData, err := diff.Diff( + ctx, + runner, + data, + modifiedData, + filename, + filename, + ) + if err != nil { + return err + } + if len(diffData) > 0 { + if _, err := os.Stdout.Write(diffData); err != nil { + return err + } + if flags.ExitCode { + return app.NewError(100, "") + } + } + } else { + fileInfo, err := os.Stat(filename) + if err != nil { + return err + } + if err := os.WriteFile(filename, modifiedData, fileInfo.Mode().Perm()); err != nil { + return err + } + } + } + } + return nil +} + +func getFilenames( + ctx context.Context, + container app.Container, + runner command.Runner, + ignores []string, +) ([]string, error) { + if container.NumArgs() > 0 { + if len(ignores) > 0 { + return nil, appcmd.NewInvalidArgumentErrorf("cannot use flag %q with any arguments", ignoreFlagName) + } + return app.Args(container), nil + } + ignoreRegexps := make([]*regexp.Regexp, len(ignores)) + for i, ignore := range ignores { + ignoreRegexp, err := regexp.CompilePOSIX(ignore) + if err != nil { + return nil, err + } + ignoreRegexps[i] = ignoreRegexp + } + return git.NewLister(runner).ListFilesAndUnstagedFiles( + ctx, + container, + git.ListFilesAndUnstagedFilesOptions{ + IgnorePathRegexps: ignoreRegexps, + }, + ) +} + +func newRequiredFlagError(flagName string) error { + return appcmd.NewInvalidArgumentErrorf("required flag %q not set", flagName) +} diff --git a/pkg/bufman/pkg/licenseheader/licenseheader.go b/pkg/bufman/pkg/licenseheader/licenseheader.go new file mode 100644 index 000000000..f62982eaf --- /dev/null +++ b/pkg/bufman/pkg/licenseheader/licenseheader.go @@ -0,0 +1,248 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package licenseheader handles license headers. +package licenseheader + +import ( + "bytes" + "errors" + "fmt" + "html/template" + "path" + "path/filepath" + "strconv" + "strings" +) + +const ( + // LicenseTypeNone is the no license type. + LicenseTypeNone LicenseType = iota + 1 + // LicenseTypeApache is the Apache 2.0 license type. + LicenseTypeApache + // LicenseTypeProprietary is the proprietary license type. + LicenseTypeProprietary +) + +var ( + licenseTypeToString = map[LicenseType]string{ + LicenseTypeNone: "none", + LicenseTypeApache: "apache", + LicenseTypeProprietary: "proprietary", + } + stringToLicenseType = map[string]LicenseType{ + "none": LicenseTypeNone, + "apache": LicenseTypeApache, + "proprietary": LicenseTypeProprietary, + } + + // does not include LicenseTypeNone + licenseTypeToTemplateData = map[LicenseType]string{ + LicenseTypeApache: `Copyright {{.YearRange}} {{.CopyrightHolder}} + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.`, + LicenseTypeProprietary: `Copyright {{.YearRange}} {{.CopyrightHolder}} + +All rights reserved.`, + } + + // if a header contains any of these lowercase phrases, we consider it a license + licenseMatchingPhrases = []string{ + "copyright", + } + + extToPrefix = map[string]string{ + ".go": "//", + ".js": "//", + ".proto": "//", + ".sql": "---", + ".ts": "//", + ".tsx": "//", + ".bazel": "#", + ".bzl": "#", + ".kt": "//", + ".swift": "//", + ".java": "//", + ".cc": "//", + ".c": "//", + ".h": "//", + ".py": "#", + ".pyi": "#", + } +) + +// LicenseType is a recognized license type. +type LicenseType int + +// String implements fmt.Stringer. +func (f LicenseType) String() string { + s, ok := licenseTypeToString[f] + if !ok { + return strconv.Itoa(int(f)) + } + return s +} + +// ParseLicenseType parses the LicenseType. +func ParseLicenseType(s string) (LicenseType, error) { + f, ok := stringToLicenseType[s] + if ok { + return f, nil + } + return 0, fmt.Errorf("unknown LicenseType: %q", s) +} + +// Modify modifies the license header for the filename and data. +// +// Returns the modified data, or the unmodified data if no modifications. +// If the filename extension is not handled, returns the unmodified data. +// +// Note this only works with UTF-8 data with lines split by '\n'. +func Modify( + licenseType LicenseType, + copyrightHolder string, + yearRange string, + filename string, + data []byte, +) ([]byte, error) { + prefix, ok := getPrefix(filename) + if !ok { + // if we do not have a prefix, we do not know the filename extension, + // so we just return the unmodified data + return data, nil + } + remainder := getRemainder(string(data), prefix) + licenseHeader, err := getLicenseHeader(licenseType, copyrightHolder, yearRange, prefix) + if err != nil { + return nil, err + } + if licenseHeader == "" { + return []byte(remainder), nil + } + if len(remainder) == 0 { + return []byte(licenseHeader + "\n"), nil + } + return []byte(licenseHeader + "\n\n" + remainder), nil +} + +// getPrefix gets the comment prefix for the filename. +func getPrefix(filename string) (string, bool) { + prefix, ok := extToPrefix[path.Ext(filepath.ToSlash(filename))] + return prefix, ok +} + +// getRemainder gets the remainder of the file beyond the license header. +func getRemainder(data string, prefix string) string { + if len(data) == 0 { + return "" + } + lines := strings.Split(data, "\n") + var headerLines []string + var lastCommentLine int + for i, line := range lines { + if !strings.HasPrefix(line, prefix) { + lastCommentLine = i + break + } + headerLines = append(headerLines, line) + } + // we have reached the first non-comment, check if the header lines represent a license or not + if !doLinesContainALicense(headerLines) { + // if they are not a license, return everything + return data + } + // if they are, return everything but the license and with front newlines stripped + return strings.TrimLeft(strings.Join(lines[lastCommentLine:], "\n"), "\n") +} + +func getLicenseHeader( + licenseType LicenseType, + copyrightHolder string, + yearRange string, + prefix string, +) (string, error) { + if licenseType == LicenseTypeNone { + return "", nil + } + if copyrightHolder == "" { + return "", errors.New("copyrightHolder required if not using LicenseTypeNone") + } + if yearRange == "" { + return "", errors.New("yearRange required if not using LicenseTypeNone") + } + templateData, ok := licenseTypeToTemplateData[licenseType] + if !ok { + return "", fmt.Errorf("unrecognized license type: %q", licenseType) + } + tmpl, err := template.New("tmpl").Parse(templateData) + if err != nil { + return "", err + } + buffer := bytes.NewBuffer(nil) + if err := tmpl.Execute( + buffer, + newLicenseData( + copyrightHolder, + yearRange, + ), + ); err != nil { + return "", err + } + lines := strings.Split(buffer.String(), "\n") + for i, line := range lines { + if line == "" { + lines[i] = prefix + } else { + lines[i] = prefix + " " + line + } + } + return strings.Join(lines, "\n"), nil +} + +func doLinesContainALicense(lines []string) bool { + for _, line := range lines { + for _, matchingPhrase := range licenseMatchingPhrases { + if strings.Contains(strings.ToLower(line), matchingPhrase) { + return true + } + } + } + return false +} + +type licenseData struct { + CopyrightHolder string + YearRange string +} + +func newLicenseData( + copyrightHolder string, + yearRange string, +) *licenseData { + return &licenseData{ + CopyrightHolder: copyrightHolder, + YearRange: yearRange, + } +} diff --git a/pkg/bufman/pkg/licenseheader/licenseheader_test.go b/pkg/bufman/pkg/licenseheader/licenseheader_test.go new file mode 100644 index 000000000..1e253d677 --- /dev/null +++ b/pkg/bufman/pkg/licenseheader/licenseheader_test.go @@ -0,0 +1,119 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package licenseheader + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +const ( + testCopyrightHolder = "Foo Bar, Inc." + testYearRange = "2020-2021" + testApacheGoHeader = `// Copyright 2020-2021 Foo Bar, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License.` + testProprietaryGoHeader = `// Copyright 2020-2021 Foo Bar, Inc. +// +// All rights reserved.` +) + +func TestBasic(t *testing.T) { + t.Parallel() + + modifiedData, err := Modify( + LicenseTypeApache, + testCopyrightHolder, + testYearRange, + "foo/bar.go", + []byte("package foo"), + ) + require.NoError(t, err) + require.Equal( + t, + testApacheGoHeader+"\n\npackage foo", + string(modifiedData), + ) + modifiedData, err = Modify( + LicenseTypeProprietary, + testCopyrightHolder, + testYearRange, + "foo/bar.go", + modifiedData, + ) + require.NoError(t, err) + require.Equal( + t, + testProprietaryGoHeader+"\n\npackage foo", + string(modifiedData), + ) + modifiedData, err = Modify( + LicenseTypeNone, + testCopyrightHolder, + testYearRange, + "foo/bar.go", + modifiedData, + ) + require.NoError(t, err) + require.Equal( + t, + "package foo", + string(modifiedData), + ) + modifiedData, err = Modify( + LicenseTypeApache, + testCopyrightHolder, + testYearRange, + "foo/bar.go", + []byte(`// copyright foo + +package foo`), + ) + require.NoError(t, err) + require.Equal( + t, + testApacheGoHeader+"\n\npackage foo", + string(modifiedData), + ) + modifiedData, err = Modify( + LicenseTypeApache, + testCopyrightHolder, + testYearRange, + "foo/bar.go", + []byte(`// foo +package foo`), + ) + require.NoError(t, err) + require.Equal( + t, + testApacheGoHeader+` + +// foo +package foo`, + string(modifiedData), + ) +} diff --git a/pkg/bufman/pkg/manifest/digest.go b/pkg/bufman/pkg/manifest/digest.go new file mode 100644 index 000000000..b49a90c38 --- /dev/null +++ b/pkg/bufman/pkg/manifest/digest.go @@ -0,0 +1,139 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package manifest + +import ( + "bytes" + "encoding/hex" + "errors" + "fmt" + "io" + "strings" + + "golang.org/x/crypto/sha3" +) + +// DigestType is the type for digests in this package. +type DigestType string + +const ( + DigestTypeShake256 DigestType = "shake256" + + shake256Length = 64 +) + +// Digest represents a hash function's value. +type Digest struct { + dtype DigestType + digest []byte + hexstr string +} + +// NewDigestFromBytes builds a digest from a type and the digest bytes. +func NewDigestFromBytes(dtype DigestType, digest []byte) (*Digest, error) { + if dtype == "" { + return nil, errors.New("digest type cannot be empty") + } + if dtype != DigestTypeShake256 { + return nil, fmt.Errorf("unsupported digest type: %q", dtype) + } + if len(digest) != shake256Length { + return nil, fmt.Errorf( + "invalid digest: got %d bytes, expected %d bytes for type %q", + len(digest), shake256Length, dtype, + ) + } + return &Digest{ + dtype: dtype, + digest: digest, + hexstr: hex.EncodeToString(digest), + }, nil +} + +// NewDigestFromHex builds a digest from a type and the hexadecimal string of +// the bytes. It returns an error if the received string is not a valid hex. +func NewDigestFromHex(dtype DigestType, hexstr string) (*Digest, error) { + digest, err := hex.DecodeString(hexstr) + if err != nil { + return nil, err + } + return NewDigestFromBytes(dtype, digest) +} + +// NewDigestFromString build a digest from a string representation of it. +func NewDigestFromString(typedDigest string) (*Digest, error) { + dtype, hexstr, found := strings.Cut(typedDigest, ":") + if !found { + return nil, errors.New("malformed digest string") + } + return NewDigestFromHex(DigestType(dtype), hexstr) +} + +// String returns the hash in a manifest's string format: ":". +func (d *Digest) String() string { + return string(d.dtype) + ":" + d.hexstr +} + +// Type returns the digest type. +func (d *Digest) Type() DigestType { + return d.dtype +} + +// Bytes returns the digest bytes. +func (d *Digest) Bytes() []byte { + return d.digest +} + +// Hex returns the digest bytes in its hexadecimal string representation. +func (d *Digest) Hex() string { + return d.hexstr +} + +// Equal compares the digest type and bytes with other digest. +func (d *Digest) Equal(other Digest) bool { + return d.dtype == other.dtype && bytes.Equal(d.digest, other.digest) +} + +// Digester is something that can digest a content into a digest. +type Digester interface { + Digest(content io.Reader) (*Digest, error) +} + +type shake256Digester struct { + hash sha3.ShakeHash +} + +// NewDigester returns a digester of the requested type. +func NewDigester(dtype DigestType) (Digester, error) { + if dtype != DigestTypeShake256 { + return nil, fmt.Errorf("not supported digest type %q", dtype) + } + return &shake256Digester{hash: sha3.NewShake256()}, nil +} + +func (d *shake256Digester) Digest(content io.Reader) (*Digest, error) { + d.hash.Reset() + if _, err := io.Copy(d.hash, content); err != nil { + return nil, err + } + digest := make([]byte, shake256Length) + if _, err := d.hash.Read(digest); err != nil { + // sha3.ShakeHash never errors or short reads. Something horribly wrong + // happened if your computer ended up here. + return nil, err + } + return NewDigestFromBytes(DigestTypeShake256, digest) +} diff --git a/pkg/bufman/pkg/manifest/digest_test.go b/pkg/bufman/pkg/manifest/digest_test.go new file mode 100644 index 000000000..f8b81ea07 --- /dev/null +++ b/pkg/bufman/pkg/manifest/digest_test.go @@ -0,0 +1,214 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package manifest_test + +import ( + "bytes" + "errors" + "fmt" + "strings" + "testing" + "testing/iotest" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestNewDigestBytes(t *testing.T) { + t.Parallel() + testInvalidDigestBytes( + t, + "empty", + "", + mustDigestShake256(t, nil).Bytes(), + ) + testInvalidDigestBytes( + t, + "unsupported digest type", + "md5", + mustDigestShake256(t, nil).Bytes(), + ) + testInvalidDigestBytes( + t, + "invalid digest", + manifest.DigestTypeShake256, + nil, + ) + testInvalidDigestBytes( + t, + "invalid digest", + manifest.DigestTypeShake256, + mustDigestShake256(t, nil).Bytes()[:10], + ) +} + +func TestNewDigestHex(t *testing.T) { + t.Parallel() + testInvalidDigestHex( + t, + "empty", + "", + mustDigestShake256(t, nil).Hex(), + ) + testInvalidDigestHex( + t, + "unsupported digest type", + "md5", + mustDigestShake256(t, nil).Hex(), + ) + testInvalidDigestHex( + t, + "invalid digest", + manifest.DigestTypeShake256, + "", + ) + testInvalidDigestHex( + t, + "encoding/hex", + manifest.DigestTypeShake256, + "not-a_hex/string", + ) + testInvalidDigestHex( + t, + "invalid digest", + manifest.DigestTypeShake256, + mustDigestShake256(t, nil).Hex()[:10], + ) +} + +func TestNewDigestString(t *testing.T) { + t.Parallel() + testInvalidDigestString( + t, + "malformed", + "", + ) + testInvalidDigestString( + t, + "malformed", + "foo", + ) + testInvalidDigestString( + t, + "malformed", + "shake256 foo", + ) + testInvalidDigestString( + t, + "encoding/hex", + "shake256:_", + ) + validDigest := mustDigestShake256(t, nil) + testInvalidDigestString( + t, + "invalid digest", + fmt.Sprintf("%s:%s", validDigest.Type(), validDigest.Hex()[:10]), + ) + testInvalidDigestString( + t, + "unsupported digest type", + fmt.Sprintf("md5:%s", validDigest.Hex()), + ) +} + +func TestNewDigester(t *testing.T) { + t.Parallel() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + require.NotNil(t, digester) + digester, err = manifest.NewDigester("some unrecognized digest type") + require.Error(t, err) + require.Nil(t, digester) +} + +func TestDigesterDigest(t *testing.T) { + t.Parallel() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + digest, err := digester.Digest(strings.NewReader("some content")) + require.NoError(t, err) + assert.Equal(t, manifest.DigestTypeShake256, digest.Type()) + assert.NotEmpty(t, digest.Bytes()) + assert.NotEmpty(t, digest.String()) + + // failing digesting content + expectedErr := errors.New("testing error") + digest, err = digester.Digest(iotest.ErrReader(expectedErr)) + assert.ErrorIs(t, err, expectedErr) + assert.Nil(t, digest) +} + +func TestEqualDigests(t *testing.T) { + t.Parallel() + const fileContent = "one line\nanother line\nyet another one\n" + d1 := mustDigestShake256(t, []byte(fileContent)) + d2 := mustDigestShake256(t, []byte(fileContent)) + d3 := mustDigestShake256(t, []byte("some other content")) + assert.True(t, d1.Equal(*d2)) + assert.True(t, d2.Equal(*d1)) + assert.False(t, d1.Equal(*d3)) +} + +func mustDigestShake256(t *testing.T, content []byte) *manifest.Digest { + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + require.NotNil(t, digester) + digest, err := digester.Digest(bytes.NewReader(content)) + require.NoError(t, err) + return digest +} + +func testInvalidDigestString( + t *testing.T, + desc string, + digest string, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + _, err := manifest.NewDigestFromString(digest) + assert.ErrorContains(t, err, desc) + }) +} + +func testInvalidDigestHex( + t *testing.T, + desc string, + dtype manifest.DigestType, + hexstr string, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + _, err := manifest.NewDigestFromHex(dtype, hexstr) + assert.ErrorContains(t, err, desc) + }) +} + +func testInvalidDigestBytes( + t *testing.T, + desc string, + dtype manifest.DigestType, + digest []byte, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + _, err := manifest.NewDigestFromBytes(dtype, digest) + assert.ErrorContains(t, err, desc) + }) +} diff --git a/pkg/bufman/pkg/manifest/manifest.go b/pkg/bufman/pkg/manifest/manifest.go new file mode 100644 index 000000000..90756292b --- /dev/null +++ b/pkg/bufman/pkg/manifest/manifest.go @@ -0,0 +1,255 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// A manifest is a file containing a list of paths and their hash digests, +// canonically ordered by path in increasing lexicographical order. Manifests +// are encoded as: +// +// :[SP][SP][LF] +// +// "shake256" is the only supported digest type. The digest is 64 bytes of hex +// encoded output of SHAKE256. See golang.org/x/crypto/sha3 and FIPS 202 for +// details on the SHAKE hash. +// +// [Manifest] can read and write manifest files. Canonical form is produced +// when serialized ([Manifest.MarshalText]). Non-canonical form is a valid +// manifest and will not produce errors when deserializing. +// +// Interacting with a manifest is typically by path ([Manifest.Paths], +// [Manifest.DigestFor]) or by a [Digest] ([Manifest.PathsFor]). +// +// [Blob] represents file content and its digest. [BlobSet] collects related +// blobs together into a set. [NewMemoryBlob] provides an in-memory +// implementation. A manifest, being a file, is also a blob ([Manifest.Blob]). +// +// Blobs are anonymous files and a manifest gives names to anonymous files. +// It's possible to view a manifest and its associated blobs as a file system. +// [NewBucket] creates a storage bucket from a manifest and blob set. +// [NewFromBucket] does the inverse: the creation of a manifest and blob set +// from a storage bucket. +package manifest + +import ( + "bufio" + "bytes" + "encoding" + "errors" + "fmt" + "io" + "sort" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +var errNoFinalNewline = errors.New("partial record: missing newline") + +func newError(lineno int, msg string) error { + return fmt.Errorf("invalid manifest: %d: %s", lineno, msg) +} + +func newErrorWrapped(lineno int, err error) error { + return fmt.Errorf("invalid manifest: %d: %w", lineno, err) +} + +// Manifest represents a list of paths and their digests. +type Manifest struct { + pathToDigest map[string]Digest + digestToPaths map[string][]string +} + +var ( + _ encoding.TextMarshaler = (*Manifest)(nil) + _ encoding.TextUnmarshaler = (*Manifest)(nil) +) + +// NewFromReader builds a manifest from an encoded manifest, like one produced +// by [Manifest.MarshalText]. +func NewFromReader(manifest io.Reader) (*Manifest, error) { + var m Manifest + scanner := bufio.NewScanner(manifest) + scanner.Split(splitManifest) + lineno := 0 + for scanner.Scan() { + lineno++ + encodedDigest, path, found := strings.Cut(scanner.Text(), " ") + if !found { + return nil, newError(lineno, "invalid entry") + } + digest, err := NewDigestFromString(encodedDigest) + if err != nil { + return nil, newErrorWrapped(lineno, err) + } + if err := m.AddEntry(path, *digest); err != nil { + return nil, newErrorWrapped(lineno, err) + } + } + if err := scanner.Err(); err != nil { + if err == errNoFinalNewline { + return nil, newError(lineno, "partial record") + } + return nil, err + } + return &m, nil +} + +// AddEntry adds an entry to the manifest with a path and its digest. It fails +// if the path already exists in the manifest with a different digest. +func (m *Manifest) AddEntry(path string, digest Digest) error { + if path == "" { + return errors.New("empty path") + } + path, err := normalpath.NormalizeAndValidate(path) + if err != nil { + return fmt.Errorf("invalid path: %w", err) + } + if digest.Type() == "" || digest.Hex() == "" { + return errors.New("invalid digest") + } + if existingDigest, exists := m.pathToDigest[path]; exists { + if existingDigest.Equal(digest) { + return nil // same entry already in the manifest, nothing to do + } + return fmt.Errorf( + "cannot add digest %q for path %q (already associated to digest %q)", + digest.String(), path, existingDigest.String(), + ) + } + if m.pathToDigest == nil { + m.pathToDigest = make(map[string]Digest) + } + m.pathToDigest[path] = digest + key := digest.String() + if m.digestToPaths == nil { + m.digestToPaths = make(map[string][]string) + } + m.digestToPaths[key] = append(m.digestToPaths[key], path) + return nil +} + +// Paths returns all unique paths in the manifest, order not guaranteed. If you want to iterate the +// paths and their digests, consider using `Range` instead. +func (m *Manifest) Paths() []string { + paths := make([]string, 0, len(m.pathToDigest)) + for path := range m.pathToDigest { + paths = append(paths, path) + } + return paths +} + +// Digests returns all unique digests in the manifest, order not guaranteed. If you want to iterate +// the paths and their digests, consider using `Range` instead. +func (m *Manifest) Digests() []Digest { + digests := make([]Digest, 0, len(m.digestToPaths)) + addedDigests := make(map[string]struct{}, len(m.digestToPaths)) + // iterating over `pathToDigest` instead of `digestToPaths` to avoid handling/returning/panic on + // error if string -> digest parsing fails. It shouldn't. + for _, digest := range m.pathToDigest { + if _, alreadyAdded := addedDigests[digest.String()]; alreadyAdded { + continue + } + addedDigests[digest.String()] = struct{}{} + digests = append(digests, digest) + } + return digests +} + +// Range invokes a function for all the paths in the manifest, passing the path and its digest. The +// order in which the paths are iterated is not guaranteed. This func will stop iterating if an +// error is returned. +func (m *Manifest) Range(f func(path string, digest Digest) error) error { + for path, digest := range m.pathToDigest { + if err := f(path, digest); err != nil { + return err + } + } + return nil +} + +// PathsFor returns one or more matching path for a given digest. The digest is +// expected to be a lower-case hex encoded value. Returned paths are unordered. +// Paths is nil and ok is false if no paths are found. +func (m *Manifest) PathsFor(digest string) ([]string, bool) { + paths, ok := m.digestToPaths[digest] + if !ok || len(paths) == 0 { + return nil, false + } + return paths, true +} + +// DigestFor returns the matching digest for the given path. The path must be an +// exact match. Digest is nil and ok is false if no digest is found. +func (m *Manifest) DigestFor(path string) (*Digest, bool) { + digest, ok := m.pathToDigest[path] + if !ok { + return nil, false + } + return &digest, true +} + +// MarshalText encodes the manifest into its canonical form. +func (m *Manifest) MarshalText() ([]byte, error) { + var coded bytes.Buffer + paths := m.Paths() + sort.Strings(paths) + for _, path := range paths { + digest := m.pathToDigest[path] + if _, err := fmt.Fprintf(&coded, "%s %s\n", &digest, path); err != nil { + return nil, err + } + } + return coded.Bytes(), nil +} + +// UnmarshalText decodes a manifest from text. +// +// See [NewFromReader] if your manifest is available in an io.Reader. +func (m *Manifest) UnmarshalText(text []byte) error { + newm, err := NewFromReader(bytes.NewReader(text)) + if err != nil { + return err + } + m.pathToDigest = newm.pathToDigest + m.digestToPaths = newm.digestToPaths + return nil +} + +// Blob returns the manifest as a blob. +func (m *Manifest) Blob() (Blob, error) { + manifestText, err := m.MarshalText() + if err != nil { + return nil, err + } + return NewMemoryBlobFromReader(bytes.NewReader(manifestText)) +} + +// Empty returns true if the manifest has no entries. +func (m *Manifest) Empty() bool { + return len(m.pathToDigest) == 0 && len(m.digestToPaths) == 0 +} + +func splitManifest(data []byte, atEOF bool) (int, []byte, error) { + // Return a line without LF. + if i := bytes.IndexByte(data, '\n'); i >= 0 { + return i + 1, data[0:i], nil + } + + // EOF occurred with a partial line. + if atEOF && len(data) != 0 { + return 0, nil, errNoFinalNewline + } + + return 0, nil, nil +} diff --git a/pkg/bufman/pkg/manifest/manifest_test.go b/pkg/bufman/pkg/manifest/manifest_test.go new file mode 100644 index 000000000..10589d21b --- /dev/null +++ b/pkg/bufman/pkg/manifest/manifest_test.go @@ -0,0 +1,280 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package manifest_test + +import ( + "bytes" + "context" + "errors" + "fmt" + "strings" + "testing" + "testing/iotest" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func Example() { + ctx := context.Background() + bucket, _ := storagemem.NewReadBucket( + map[string][]byte{ + "foo": []byte("bar"), + }, + ) + m, _, _ := manifest.NewFromBucket(ctx, bucket) + digest, _ := m.DigestFor("foo") + fmt.Printf("digest[:16]: %s\n", digest.Hex()[:16]) + path, _ := m.PathsFor(digest.String()) + fmt.Printf("path at digest: %s\n", path[0]) + // Output: + // digest[:16]: a15163728ed24e1c + // path at digest: foo +} + +func TestRoundTripManifest(t *testing.T) { + t.Parallel() + // read a manifest using the unmarshaling method + null := mustDigestShake256(t, []byte{}) + var manifestBuilder bytes.Buffer + for i := 0; i < 2; i++ { + fmt.Fprintf( + &manifestBuilder, + "%s:%s null%d\n", + null.Type(), + null.Hex(), + i, + ) + } + manifestContent := manifestBuilder.Bytes() + var m manifest.Manifest + err := m.UnmarshalText(manifestContent) + require.NoError(t, err) + + // marshaling the manifest back should produce an identical result + retContent, err := m.MarshalText() + require.NoError(t, err) + assert.Equal(t, manifestContent, retContent, "round trip failed") +} + +func TestEmptyManifest(t *testing.T) { + t.Parallel() + content, err := new(manifest.Manifest).MarshalText() + assert.NoError(t, err) + assert.Equal(t, 0, len(content)) +} + +func TestAddEntry(t *testing.T) { + t.Parallel() + var m manifest.Manifest + fileDigest := mustDigestShake256(t, nil) + const filePath = "my/path" + require.NoError(t, m.AddEntry(filePath, *fileDigest)) + require.NoError(t, m.AddEntry(filePath, *fileDigest)) // adding the same entry twice is fine + + require.Error(t, m.AddEntry("", *fileDigest)) + require.Error(t, m.AddEntry("other/path", manifest.Digest{})) + require.Error(t, m.AddEntry(filePath, *mustDigestShake256(t, []byte("other content")))) + + expect := fmt.Sprintf("%s %s\n", fileDigest, filePath) + retContent, err := m.MarshalText() + require.NoError(t, err) + assert.Equal(t, expect, string(retContent)) + + t.Run("clean-up-paths", func(t *testing.T) { + t.Parallel() + var m manifest.Manifest + validDigest := mustDigestShake256(t, nil) + // adding same entry many times, should be cleaned up. + assert.NoError(t, m.AddEntry("./my/valid/path", *validDigest)) + assert.NoError(t, m.AddEntry("my///valid///path", *validDigest)) + assert.NoError(t, m.AddEntry("././my/valid/path", *validDigest)) + assert.NoError(t, m.AddEntry("./my/./valid/./path", *validDigest)) + assert.NoError(t, m.AddEntry("./my/valid/../../my/valid/path", *validDigest)) + assert.NoError(t, m.AddEntry("foo/../my/valid/path", *validDigest)) + paths := m.Paths() + require.Len(t, paths, 1) + assert.Equal(t, paths[0], "my/valid/path") + }) + t.Run("invalid-paths", func(t *testing.T) { + t.Parallel() + var m manifest.Manifest + validDigest := mustDigestShake256(t, nil) + assert.Error(t, m.AddEntry("/invalid/absolute/path", *validDigest)) + assert.Error(t, m.AddEntry("../invalid/outer/path", *validDigest)) + assert.Error(t, m.AddEntry("invalid/../../outer/path", *validDigest)) + assert.Empty(t, m.Paths()) + }) +} + +func TestInvalidManifests(t *testing.T) { + t.Parallel() + testInvalidManifest( + t, + "invalid entry", + "\n", + ) + testInvalidManifest( + t, + "invalid entry", + "whoops\n", + ) + testInvalidManifest( + t, + "invalid digest", + "shake256:1234 foo\n", + ) + testInvalidManifest( + t, + "unsupported digest type", + "md5:d41d8cd98f00b204e9800998ecf8427e foo\n", + ) + testInvalidManifest( + t, + "malformed digest string", + "bar foo\n", + ) + testInvalidManifest( + t, + "encoding/hex", + "shake256:_ foo\n", + ) + testInvalidManifest( + t, + "partial record", + fmt.Sprintf("%s null", mustDigestShake256(t, nil)), + ) +} + +func TestBrokenRead(t *testing.T) { + t.Parallel() + expected := errors.New("testing error") + _, err := manifest.NewFromReader(iotest.ErrReader(expected)) + assert.ErrorIs(t, err, expected) +} + +func TestUnmarshalBrokenManifest(t *testing.T) { + t.Parallel() + var m manifest.Manifest + err := m.UnmarshalText([]byte("foo")) + assert.Error(t, err) +} + +func TestDigestPaths(t *testing.T) { + t.Parallel() + var m manifest.Manifest + sharedDigest := mustDigestShake256(t, nil) + err := m.AddEntry("path/one", *sharedDigest) + require.NoError(t, err) + err = m.AddEntry("path/two", *sharedDigest) + require.NoError(t, err) + paths, ok := m.PathsFor(sharedDigest.String()) + assert.True(t, ok) + assert.ElementsMatch(t, []string{"path/one", "path/two"}, paths) + paths, ok = m.PathsFor(mustDigestShake256(t, []byte{0}).String()) + assert.False(t, ok) + assert.Empty(t, paths) +} + +func TestPathDigest(t *testing.T) { + t.Parallel() + var m manifest.Manifest + digest := mustDigestShake256(t, nil) + err := m.AddEntry("my/path", *digest) + require.NoError(t, err) + retDigest, ok := m.DigestFor("my/path") + assert.True(t, ok) + assert.Equal(t, digest, retDigest) + retDigest, ok = m.DigestFor("foo") + assert.False(t, ok) + assert.Empty(t, retDigest) +} + +func testInvalidManifest( + t *testing.T, + desc string, + line string, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + _, err := manifest.NewFromReader(strings.NewReader(line)) + assert.ErrorContains(t, err, desc) + }) +} + +func TestPathsDigestsRange(t *testing.T) { + t.Parallel() + var ( + m manifest.Manifest + addedPaths []string + nilDigest = mustDigestShake256(t, nil) + ) + for i := 0; i < 20; i++ { + path := fmt.Sprintf("path/to/file%0d", i) + require.NoError(t, m.AddEntry(path, *nilDigest)) // all of the paths have the same digest/content + addedPaths = append(addedPaths, path) + } + t.Run("AllPaths", func(t *testing.T) { + t.Parallel() + allPaths := m.Paths() + assert.Equal(t, len(addedPaths), len(allPaths)) + assert.ElementsMatch(t, addedPaths, allPaths) + }) + t.Run("AllDigests", func(t *testing.T) { + t.Parallel() + allDigests := m.Digests() + require.Equal(t, 1, len(allDigests)) + assert.True(t, nilDigest.Equal(allDigests[0])) + }) + t.Run("Range", func(t *testing.T) { + t.Parallel() + var iteratedPaths []string + require.NoError(t, m.Range(func(path string, digest manifest.Digest) error { + iteratedPaths = append(iteratedPaths, path) + assert.True(t, digest.Equal(*nilDigest)) + return nil + })) + assert.ElementsMatch(t, addedPaths, iteratedPaths) + }) +} + +func TestManifestZeroValue(t *testing.T) { + t.Parallel() + var m manifest.Manifest + blob, err := m.Blob() + require.NoError(t, err) + assert.NotEmpty(t, blob.Digest().Hex()) + assert.True(t, m.Empty()) + assert.Empty(t, m.Paths()) + paths, ok := m.PathsFor("anything") + assert.Empty(t, paths) + assert.False(t, ok) + digest, ok := m.DigestFor("anything") + assert.Nil(t, digest) + assert.False(t, ok) + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + emptyDigest, err := digester.Digest(bytes.NewReader(nil)) + require.NoError(t, err) + require.NoError(t, m.AddEntry("a", *emptyDigest)) + digest, ok = m.DigestFor("a") + assert.True(t, ok) + assert.Equal(t, emptyDigest.Hex(), digest.Hex()) + assert.False(t, m.Empty()) +} diff --git a/pkg/bufman/pkg/manifest/module.go b/pkg/bufman/pkg/manifest/module.go new file mode 100644 index 000000000..9eda1a9d5 --- /dev/null +++ b/pkg/bufman/pkg/manifest/module.go @@ -0,0 +1,276 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package manifest + +import ( + "bytes" + "context" + "fmt" + "io" + "os" + + "go.uber.org/multierr" +) + +// Blob is an anonymous file associated with a digest. +type Blob interface { + Digest() *Digest + Open(context.Context) (io.ReadCloser, error) +} + +type memoryBlob struct { + digest Digest + content []byte +} + +var _ Blob = (*memoryBlob)(nil) + +type memoryBlobOptions struct { + validateDigest bool +} + +// MemoryBlobOption are options passed when creating a new memory blob. +type MemoryBlobOption func(*memoryBlobOptions) + +// MemoryBlobWithDigestValidation checks that the passed content and digest match. +func MemoryBlobWithDigestValidation() MemoryBlobOption { + return func(opts *memoryBlobOptions) { + opts.validateDigest = true + } +} + +// NewMemoryBlob takes a digest and a content, and turns it into an in-memory +// representation of a blob, which returns the digest and an io.ReadCloser for +// its content. +func NewMemoryBlob(digest Digest, content []byte, opts ...MemoryBlobOption) (Blob, error) { + var config memoryBlobOptions + for _, option := range opts { + option(&config) + } + if config.validateDigest { + digester, err := NewDigester(digest.Type()) + if err != nil { + return nil, err + } + contentDigest, err := digester.Digest(bytes.NewReader(content)) + if err != nil { + return nil, err + } + if !digest.Equal(*contentDigest) { + return nil, fmt.Errorf("digest and content mismatch") + } + } + return &memoryBlob{ + digest: digest, + content: content, + }, nil +} + +func (b *memoryBlob) Digest() *Digest { + if b == nil { + return nil + } + return &b.digest +} + +func (b *memoryBlob) Open(context.Context) (io.ReadCloser, error) { + if b == nil { + return nil, os.ErrNotExist + } + return io.NopCloser(bytes.NewReader(b.content)), nil +} + +// BlobSet represents a set of deduplicated blobs by their digests. +type BlobSet struct { + digestToBlob map[string]Blob +} + +type blobSetOptions struct { + validateContent bool + skipNilBlobs bool +} + +// BlobSetOption are options passed when creating a new blob set. +type BlobSetOption func(*blobSetOptions) + +// BlobSetWithContentValidation turns on content validation for all the blobs +// when creating a new BlobSet. If this option is on, blobs with the same digest +// must have the same content (in case blobs with the same digest are sent). If +// this option is not passed, then the latest duplicated blob digest content +// will prevail in the set. +func BlobSetWithContentValidation() BlobSetOption { + return func(opts *blobSetOptions) { + opts.validateContent = true + } +} + +// BlobSetWithSkipNilBlobs allows passing nil blobs in the slice of blobs. The default behavior is +// that if you pass a nil blob in the slice, you'll get an error from the `NewBlobSet` constructor. +// If you pass this option, any nil blob will be skipped and the blob set will be built only from +// the non-nil ones. +func BlobSetWithSkipNilBlobs() BlobSetOption { + return func(opts *blobSetOptions) { + opts.skipNilBlobs = true + } +} + +// NewBlobSet receives a slice of blobs, and de-duplicates them into a BlobSet. +func NewBlobSet(ctx context.Context, blobs []Blob, opts ...BlobSetOption) (*BlobSet, error) { + var config blobSetOptions + for _, option := range opts { + option(&config) + } + digestToBlobs := make(map[string]Blob, len(blobs)) + for i, b := range blobs { + if b == nil { + if config.skipNilBlobs { + continue + } + return nil, fmt.Errorf("blobs[%d]: nil blob", i) + } + digestStr := b.Digest().String() + if config.validateContent { + existingBlob, alreadyPresent := digestToBlobs[digestStr] + if alreadyPresent { + equalContent, err := BlobEqual(ctx, b, existingBlob) + if err != nil { + return nil, fmt.Errorf("compare duplicated blobs with digest %q: %w", digestStr, err) + } + if !equalContent { + return nil, fmt.Errorf("duplicated blobs with digest %q have different contents", digestStr) + } + } + } + digestToBlobs[digestStr] = b + } + return &BlobSet{digestToBlob: digestToBlobs}, nil +} + +// BlobFor returns the blob for the passed digest string, or nil, ok=false if +// the digest has no blob in the set. +func (s *BlobSet) BlobFor(digest string) (Blob, bool) { + blob, ok := s.digestToBlob[digest] + if !ok { + return nil, false + } + return blob, true +} + +// Blobs returns a slice of the blobs in the set. +func (s *BlobSet) Blobs() []Blob { + blobs := make([]Blob, 0, len(s.digestToBlob)) + for _, b := range s.digestToBlob { + blobs = append(blobs, b) + } + return blobs +} + +// NewMemoryBlobFromReader creates a memory blob from content, which is read +// until completion. The returned blob contains all bytes read. If you are using +// this in a loop, you might better use NewMemoryBlobFromReaderWithDigester so +// you can reuse your digester. +func NewMemoryBlobFromReader(content io.Reader) (Blob, error) { + digester, err := NewDigester(DigestTypeShake256) + if err != nil { + return nil, err + } + return NewMemoryBlobFromReaderWithDigester(content, digester) +} + +// NewMemoryBlobFromReaderWithDigester creates a memory blob from content with +// the passed digester. The content is read until completion. The returned blob +// contains all bytes read. +func NewMemoryBlobFromReaderWithDigester(content io.Reader, digester Digester) (Blob, error) { + var contentInMemory bytes.Buffer + tee := io.TeeReader(content, &contentInMemory) + digest, err := digester.Digest(tee) + if err != nil { + return nil, err + } + return &memoryBlob{ + digest: *digest, + content: contentInMemory.Bytes(), + }, nil +} + +// BlobEqual returns true if blob a is the same as blob b. The digest is +// checked for equality and the content bytes compared. +// +// An error is returned if an unexpected I/O error occurred when opening, +// reading, or closing either blob. +func BlobEqual(ctx context.Context, a, b Blob) (_ bool, retErr error) { + const blockSize = 4096 + if !a.Digest().Equal(*b.Digest()) { + // digests don't match + return false, nil + } + aFile, err := a.Open(ctx) + if err != nil { + return false, err + } + defer func() { retErr = multierr.Append(retErr, aFile.Close()) }() + bFile, err := b.Open(ctx) + if err != nil { + return false, err + } + defer func() { retErr = multierr.Append(retErr, bFile.Close()) }() + // Read blockSize from a, then from b, and compare. + aBlock := make([]byte, blockSize) + bBlock := make([]byte, blockSize) + for { + aN, aErr := aFile.Read(aBlock) + bN, bErr := io.ReadAtLeast(bFile, bBlock[:aN], aN) // exactly aN bytes + // We're running unexpected error processing (not EOF) before comparing + // bytes because it doesn't matter if the returned bytes match if an + // error occurred before an expected EOF. + if bErr == io.ErrUnexpectedEOF { + // b is shorter; we can error early + return false, nil + } + if aErr != nil && aErr != io.EOF { + // unexpected read error + return false, aErr + } + if bErr != nil && bErr != io.EOF { + // unexpected read error + return false, bErr + } + if !bytes.Equal(aBlock[:aN], bBlock[:bN]) { + // Read content doesn't match. + return false, nil + } + if aErr == io.EOF || bErr == io.EOF { + // EOF + break + } + } + aN, aErr := aFile.Read(aBlock[:1]) + bN, bErr := bFile.Read(bBlock[:1]) + if aN == 0 && bN == 0 && aErr == io.EOF && bErr == io.EOF { + // a and b are at EOF with no more data for us + return true, nil + } + // either a or b are longer + return false, multierr.Append(nilEOF(aErr), nilEOF(bErr)) +} + +// nilEOF maps io.EOF to nil +func nilEOF(err error) error { + if err == io.EOF { + return nil + } + return err +} diff --git a/pkg/bufman/pkg/manifest/module_test.go b/pkg/bufman/pkg/manifest/module_test.go new file mode 100644 index 000000000..148056994 --- /dev/null +++ b/pkg/bufman/pkg/manifest/module_test.go @@ -0,0 +1,374 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package manifest_test + +import ( + "context" + "errors" + "fmt" + "io" + "strings" + "testing" + "testing/iotest" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestNewMemoryBlob(t *testing.T) { + t.Parallel() + const content = "some file content" + digest := mustDigestShake256(t, []byte(content)) + blob, err := manifest.NewMemoryBlob( + *digest, + []byte(content), + manifest.MemoryBlobWithDigestValidation(), + ) + require.NoError(t, err) + assert.True(t, blob.Digest().Equal(*digest)) + file, err := blob.Open(context.Background()) + require.NoError(t, err) + blobContent, err := io.ReadAll(file) + require.NoError(t, err) + assert.Equal(t, []byte(content), blobContent) +} + +func TestInvalidMemoryBlob(t *testing.T) { + t.Parallel() + const content = "some file content" + digest := mustDigestShake256(t, []byte(content)) + + t.Run("NoValidateDigest", func(t *testing.T) { + t.Parallel() + _, err := manifest.NewMemoryBlob(*digest, []byte("different content")) + assert.NoError(t, err) + }) + t.Run("ValidatingDigest", func(t *testing.T) { + t.Parallel() + _, err := manifest.NewMemoryBlob( + *digest, + []byte("different content"), + manifest.MemoryBlobWithDigestValidation(), + ) + assert.Error(t, err) + }) +} + +func TestNewBlobSet(t *testing.T) { + t.Parallel() + blobSet, err := manifest.NewBlobSet( + context.Background(), + newBlobsArray(t), + manifest.BlobSetWithContentValidation(), + ) + require.NoError(t, err) + assert.NotNil(t, blobSet) +} + +func TestNewBlobValidDuplicates(t *testing.T) { + t.Parallel() + blobs := newBlobsArray(t) + blobSet, err := manifest.NewBlobSet( + context.Background(), + append(blobs, blobs[0]), // send the first blob twice + manifest.BlobSetWithContentValidation(), + ) + require.NoError(t, err) + assert.NotNil(t, blobSet) +} + +func TestNewBlobSetWithNilBlobs(t *testing.T) { + t.Parallel() + blobsWithNil := append(newBlobsArray(t), nil) + t.Run("DefaultRejectNils", func(t *testing.T) { + t.Parallel() + _, err := manifest.NewBlobSet( + context.Background(), + blobsWithNil, + ) + require.Error(t, err) + }) + t.Run("AllowNils", func(t *testing.T) { + t.Parallel() + blobSet, err := manifest.NewBlobSet( + context.Background(), + blobsWithNil, + manifest.BlobSetWithSkipNilBlobs(), + ) + require.NoError(t, err) + assert.NotNil(t, blobSet) + }) +} + +func TestNewBlobInvalidDuplicates(t *testing.T) { + t.Parallel() + blobs := newBlobsArray(t) + incorrectBlob, err := manifest.NewMemoryBlob( + *blobs[0].Digest(), + []byte("not blobs[0] content"), + ) + require.NoError(t, err) + require.NotNil(t, incorrectBlob) + _, err = manifest.NewBlobSet( + context.Background(), + append(blobs, incorrectBlob), // send first digest twice, with diff content + manifest.BlobSetWithContentValidation(), + ) + require.Error(t, err) +} + +func TestAllBlobs(t *testing.T) { + t.Parallel() + blobs := newBlobsArray(t) + set, err := manifest.NewBlobSet(context.Background(), blobs) + require.NoError(t, err) + retBlobs := set.Blobs() + assertBlobsAreEqual(t, blobs, retBlobs) +} + +type mockBlob struct { + digest *manifest.Digest + content io.Reader + openErr bool +} + +func (mb *mockBlob) Digest() *manifest.Digest { return mb.digest } +func (mb *mockBlob) Open(_ context.Context) (io.ReadCloser, error) { + if mb.openErr { + return nil, errors.New("open error") + } + return io.NopCloser(mb.content), nil +} + +type errAtEndReader struct{ reader io.Reader } + +func (e *errAtEndReader) Read(p []byte) (int, error) { + n, err := e.reader.Read(p) + if err == io.EOF { + return n, errors.New("test erroring at EOF") + } + return n, err +} + +func TestBlobEqual(t *testing.T) { + t.Parallel() + testBlobEqual( + t, + "does equal", + strings.NewReader("foo"), + strings.NewReader("foo"), + true, + false, + ) + testBlobEqual( + t, + "equal with differing length reads", + strings.NewReader("foo"), + iotest.OneByteReader(strings.NewReader("foo")), + true, + false, + ) + testBlobEqual( + t, + "mismatched equal-length content", + strings.NewReader("foo"), + strings.NewReader("bar"), + false, + false, + ) + testBlobEqual( + t, + "mismatched equal-length content data with error", + iotest.DataErrReader(strings.NewReader("foo")), + iotest.DataErrReader(strings.NewReader("bar")), + false, + false, + ) + testBlobEqual( + t, + "mismatched longer left content", + strings.NewReader("foofoo"), + strings.NewReader("foo"), + false, + false, + ) + testBlobEqual( + t, + "mismatched longer right content", + strings.NewReader("foo"), + strings.NewReader("foofoo"), + false, + false, + ) + testBlobEqual( + t, + "fast error left read", + iotest.ErrReader(errors.New("testing error")), + strings.NewReader("foo"), + false, + true, + ) + testBlobEqual( + t, + "fast error right read", + strings.NewReader("foo"), + iotest.ErrReader(errors.New("testing error")), + false, + true, + ) + testBlobEqual( + t, + "late error left read", + &errAtEndReader{reader: strings.NewReader("foo")}, + strings.NewReader("foo"), + false, + true, + ) + testBlobEqual( + t, + "late error right read", + strings.NewReader("foo"), + + &errAtEndReader{reader: strings.NewReader("foo")}, + false, + true, + ) + testBlobEqual( + t, + "middle error left read", + iotest.TimeoutReader(iotest.OneByteReader(strings.NewReader("foo"))), + strings.NewReader("foo"), + false, + true, + ) + testBlobEqual( + t, + "middle error right read", + strings.NewReader("foo"), + iotest.TimeoutReader(iotest.OneByteReader(strings.NewReader("foo"))), + false, + true, + ) +} + +func TestBlobEqualDigestMismatch(t *testing.T) { + t.Parallel() + ctx := context.Background() + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + const foo = "foo" + const bar = "bar" + aDigest, err := digester.Digest(strings.NewReader(foo)) + require.NoError(t, err) + bDigest, err := digester.Digest(strings.NewReader(bar)) + require.NoError(t, err) + aBlob := &mockBlob{ + digest: aDigest, + content: strings.NewReader(foo), + } + bBlob := &mockBlob{ + digest: bDigest, + content: strings.NewReader(""), + } + equal, err := manifest.BlobEqual(ctx, aBlob, bBlob) + assert.False(t, equal) + assert.NoError(t, err) +} + +func TestBlobEqualOpenError(t *testing.T) { + t.Parallel() + ctx := context.Background() + aBlob := &mockBlob{ + digest: &manifest.Digest{}, + openErr: true, + } + bBlob := &mockBlob{ + digest: &manifest.Digest{}, + } + equal, err := manifest.BlobEqual(ctx, aBlob, bBlob) + assert.False(t, equal) + assert.Error(t, err) + aBlob = &mockBlob{ + digest: &manifest.Digest{}, + } + bBlob = &mockBlob{ + digest: &manifest.Digest{}, + openErr: true, + } + equal, err = manifest.BlobEqual(ctx, aBlob, bBlob) + assert.False(t, equal) + assert.Error(t, err) +} + +func testBlobEqual( + t *testing.T, + desc string, + a, b io.Reader, + isEqual bool, + isError bool, +) { + t.Helper() + t.Run(desc, func(t *testing.T) { + t.Parallel() + ctx := context.Background() + digest := &manifest.Digest{} // Avoid digest equality test. + aBlob := &mockBlob{ + digest: digest, + content: a, + } + bBlob := &mockBlob{ + digest: digest, + content: b, + } + equal, err := manifest.BlobEqual(ctx, aBlob, bBlob) + assert.Equal(t, isEqual, equal) + if isError { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + }) +} + +func newBlobsArray(t *testing.T) []manifest.Blob { + var blobs []manifest.Blob + for i := 0; i < 10; i++ { + content := fmt.Sprintf("some content %d", i) + digest := mustDigestShake256(t, []byte(content)) + blob, err := manifest.NewMemoryBlob( + *digest, []byte(content), + manifest.MemoryBlobWithDigestValidation(), + ) + require.NoError(t, err) + blobs = append(blobs, blob) + } + return blobs +} + +// assertBlobsAreEqual makes sure all the blobs digests in the array are the +// same (assuming they're correctly built), ignoring order in the blobs arrays. +func assertBlobsAreEqual(t *testing.T, expectedBlobs []manifest.Blob, actualBlobs []manifest.Blob) { + expectedDigests := make(map[string]struct{}, len(expectedBlobs)) + for _, expectedBlob := range expectedBlobs { + expectedDigests[expectedBlob.Digest().String()] = struct{}{} + } + actualDigests := make(map[string]struct{}, len(actualBlobs)) + for _, actualBlob := range actualBlobs { + actualDigests[actualBlob.Digest().String()] = struct{}{} + } + assert.Equal(t, expectedDigests, actualDigests) +} diff --git a/pkg/bufman/pkg/manifest/storage.go b/pkg/bufman/pkg/manifest/storage.go new file mode 100644 index 000000000..f5c4d6efe --- /dev/null +++ b/pkg/bufman/pkg/manifest/storage.go @@ -0,0 +1,194 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package manifest + +import ( + "context" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" + "go.uber.org/multierr" +) + +// manifestBucket is a storage.ReadBucket implementation from a manifest and an +// array of blobs. +type manifestBucket struct { + manifest Manifest + blobs BlobSet +} + +type manifestBucketObject struct { + path string + file io.ReadCloser +} + +func (o *manifestBucketObject) Path() string { return o.path } +func (o *manifestBucketObject) ExternalPath() string { return o.path } +func (o *manifestBucketObject) Read(p []byte) (int, error) { return o.file.Read(p) } +func (o *manifestBucketObject) Close() error { return o.file.Close() } + +// NewFromBucket creates a manifest and blob set from the bucket's files. Blobs +// in the blob set use the [DigestTypeShake256] digest. +func NewFromBucket( + ctx context.Context, + bucket storage.ReadBucket, +) (*Manifest, *BlobSet, error) { + var m Manifest + digester, err := NewDigester(DigestTypeShake256) + if err != nil { + return nil, nil, err + } + var blobs []Blob + if walkErr := bucket.Walk(ctx, "", func(info storage.ObjectInfo) (retErr error) { + path := info.Path() + obj, err := bucket.Get(ctx, path) + if err != nil { + return err + } + defer func() { retErr = multierr.Append(retErr, obj.Close()) }() + blob, err := NewMemoryBlobFromReaderWithDigester(obj, digester) + if err != nil { + return err + } + blobs = append(blobs, blob) + return m.AddEntry(path, *blob.Digest()) + }); walkErr != nil { + return nil, nil, walkErr + } + blobSet, err := NewBlobSet(ctx, blobs) // no need to pass validation options, we're building and digesting the blobs + if err != nil { + return nil, nil, err + } + return &m, blobSet, nil +} + +type bucketOptions struct { + allManifestBlobs bool + noExtraBlobs bool +} + +// BucketOption are options passed when creating a new manifest bucket. +type BucketOption func(*bucketOptions) + +// BucketWithAllManifestBlobsValidation validates that all manifest digests +// have a corresponding blob in the blob set. If this option is not passed, then +// buckets with partial/incomplete blobs are allowed. +func BucketWithAllManifestBlobsValidation() BucketOption { + return func(opts *bucketOptions) { + opts.allManifestBlobs = true + } +} + +// BucketWithNoExtraBlobsValidation validates that the passed blob set has no +// additional blobs beyond the ones in the manifest. +func BucketWithNoExtraBlobsValidation() BucketOption { + return func(opts *bucketOptions) { + opts.noExtraBlobs = true + } +} + +// NewBucket takes a manifest and a blob set and builds a readable storage +// bucket that contains the files in the manifest. +func NewBucket(m Manifest, blobs BlobSet, opts ...BucketOption) (storage.ReadBucket, error) { + var config bucketOptions + for _, option := range opts { + option(&config) + } + if config.allManifestBlobs { + if err := m.Range(func(path string, digest Digest) error { + if _, ok := blobs.BlobFor(digest.String()); !ok { + return fmt.Errorf("manifest path %q with digest %q has no associated blob", path, digest.String()) + } + return nil + }); err != nil { + return nil, err + } + } + if config.noExtraBlobs { + for digestStr := range blobs.digestToBlob { + if _, ok := m.PathsFor(digestStr); !ok { + return nil, fmt.Errorf("blob with digest %q is not present in the manifest", digestStr) + } + } + } + return &manifestBucket{ + manifest: m, + blobs: blobs, + }, nil +} + +// blobFor returns a blob for a given path. It returns the blob if found, or nil +// and ok=false if the path has no digest in the manifest, or if the blob for +// that digest is not present. +func (m *manifestBucket) blobFor(path string) (_ Blob, ok bool) { + digest, ok := m.manifest.DigestFor(path) + if !ok { + return nil, false + } + blob, ok := m.blobs.BlobFor(digest.String()) + if !ok { + return nil, false + } + return blob, true +} + +func (m *manifestBucket) Get(ctx context.Context, path string) (storage.ReadObjectCloser, error) { + blob, ok := m.blobFor(path) + if !ok { + return nil, storage.NewErrNotExist(path) + } + file, err := blob.Open(ctx) + if err != nil { + return nil, err + } + return &manifestBucketObject{ + path: path, + file: file, + }, nil +} + +func (m *manifestBucket) Stat(ctx context.Context, path string) (storage.ObjectInfo, error) { + if _, ok := m.blobFor(path); !ok { + return nil, storage.NewErrNotExist(path) + } + // storage.ObjectInfo only requires path + return &manifestBucketObject{path: path}, nil +} + +func (m *manifestBucket) Walk(ctx context.Context, prefix string, f func(storage.ObjectInfo) error) error { + prefix, err := storageutil.ValidatePrefix(prefix) + if err != nil { + return err + } + // walk order is not guaranteed + for _, path := range m.manifest.Paths() { + if !normalpath.EqualsOrContainsPath(prefix, path, normalpath.Relative) { + continue + } + if _, ok := m.blobFor(path); !ok { + // this could happen if the bucket was built with partial blobs + continue + } + // storage.ObjectInfo only requires path + if err := f(&manifestBucketObject{path: path}); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/pkg/manifest/storage_test.go b/pkg/bufman/pkg/manifest/storage_test.go new file mode 100644 index 000000000..8fe863762 --- /dev/null +++ b/pkg/bufman/pkg/manifest/storage_test.go @@ -0,0 +1,209 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package manifest_test + +import ( + "bytes" + "context" + "fmt" + "io" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestFromBucket(t *testing.T) { + t.Parallel() + ctx := context.Background() + bucket, err := storagemem.NewReadBucket( + map[string][]byte{ + "null": nil, + "foo": []byte("bar"), + }) + require.NoError(t, err) + m, blobSet, err := manifest.NewFromBucket(ctx, bucket) + require.NoError(t, err) + // sorted by paths + var ( + fooDigest = mustDigestShake256(t, []byte("bar")) + nullDigest = mustDigestShake256(t, nil) + ) + expected := fmt.Sprintf("%s foo\n", fooDigest) + expected += fmt.Sprintf("%s null\n", nullDigest) + retContent, err := m.MarshalText() + assert.NoError(t, err) + assert.Equal(t, expected, string(retContent)) + // blobs + fooBlob, ok := blobSet.BlobFor(fooDigest.String()) + require.True(t, ok) + assert.True(t, fooDigest.Equal(*fooBlob.Digest())) + nullBlob, ok := blobSet.BlobFor(nullDigest.String()) + require.True(t, ok) + assert.True(t, nullDigest.Equal(*nullBlob.Digest())) +} + +func TestNewBucket(t *testing.T) { + t.Parallel() + files := map[string][]byte{ + "some_empty_file": {}, + "buf.yaml": []byte("buf yaml contents"), + "buf.lock": []byte("buf lock contents"), + "mypkg/v1/foo.proto": []byte("repeated proto content"), + "mypkg/v1/bar.proto": []byte("repeated proto content"), + // same "mypkg" prefix for `Walk` test purposes + "mypkglongername/v1/baz.proto": []byte("repeated proto content"), + } + var m manifest.Manifest + var blobs []manifest.Blob + digester, err := manifest.NewDigester(manifest.DigestTypeShake256) + require.NoError(t, err) + for path, content := range files { + digest, err := digester.Digest(bytes.NewReader(content)) + require.NoError(t, err) + require.NoError(t, m.AddEntry(path, *digest)) + blob, err := manifest.NewMemoryBlob( + *digest, + content, + manifest.MemoryBlobWithDigestValidation(), + ) + require.NoError(t, err) + blobs = append(blobs, blob) + } + blobSet, err := manifest.NewBlobSet( + context.Background(), + blobs, + manifest.BlobSetWithContentValidation(), + ) + require.NoError(t, err) + + t.Run("BucketWithAllManifestBlobsValidation", func(t *testing.T) { + t.Parallel() + // only send 3 blobs: there are 6 files with 4 different contents, + // regardless of which blobs are sent, there will always be missing at least + // one. + const blobsToSend = 3 + incompleteBlobSet, err := manifest.NewBlobSet( + context.Background(), + blobs[:blobsToSend], + ) + require.NoError(t, err) + + _, err = manifest.NewBucket( + m, *incompleteBlobSet, + manifest.BucketWithAllManifestBlobsValidation(), + ) + assert.Error(t, err) + + bucket, err := manifest.NewBucket(m, *incompleteBlobSet) + assert.NoError(t, err) + assert.NotNil(t, bucket) + var bucketFilesCount int + require.NoError(t, bucket.Walk(context.Background(), "", func(obj storage.ObjectInfo) error { + bucketFilesCount++ + return nil + })) + assert.Less(t, bucketFilesCount, len(files)) // incomplete bucket + }) + + t.Run("BucketWithNoExtraBlobsValidation", func(t *testing.T) { + t.Parallel() + const content = "some other file contents" + digest := mustDigestShake256(t, []byte(content)) + orphanBlob, err := manifest.NewMemoryBlob(*digest, []byte(content)) + require.NoError(t, err) + tooLargeBlobSet, err := manifest.NewBlobSet( + context.Background(), + append(blobs, orphanBlob), + ) + require.NoError(t, err) + _, err = manifest.NewBucket( + m, *tooLargeBlobSet, + manifest.BucketWithNoExtraBlobsValidation(), + ) + assert.Error(t, err) + }) + + t.Run("Valid", func(t *testing.T) { + t.Parallel() + bucket, err := manifest.NewBucket( + m, *blobSet, + manifest.BucketWithAllManifestBlobsValidation(), + manifest.BucketWithNoExtraBlobsValidation(), + ) + require.NoError(t, err) + + t.Run("BucketGet", func(t *testing.T) { + t.Parallel() + // make sure all files are present and have the right content + for path, content := range files { + obj, err := bucket.Get(context.Background(), path) + require.NoError(t, err) + retContent, err := io.ReadAll(obj) + require.NoError(t, err) + assert.Equal(t, content, retContent) + assert.NoError(t, obj.Close()) + } + // non existent files + _, err = bucket.Get(context.Background(), "path/not/present") + assert.Error(t, err) + }) + + t.Run("BucketWalk", func(t *testing.T) { + t.Parallel() + // make sure there are no extra files in the bucket + require.NoError(t, bucket.Walk(context.Background(), "", func(obj storage.ObjectInfo) error { + _, presentInOriginalFiles := files[obj.Path()] + require.True(t, presentInOriginalFiles, "path %q in bucket is not present in original files", obj.Path()) + return nil + })) + // walking a non existent dir + assert.NoError(t, bucket.Walk(context.Background(), "nonexistentpkg", func(obj storage.ObjectInfo) error { + require.Fail(t, "unexpected file %q in the bucket", obj.Path()) + return nil + })) + // walking a valid dir + const prefix = "mypkg" + expectedPaths := make(map[string]struct{}, 0) + for path := range files { + if strings.HasPrefix(path, prefix+"/") { + expectedPaths[path] = struct{}{} + } + } + assert.NoError(t, bucket.Walk(context.Background(), prefix, func(obj storage.ObjectInfo) error { + _, expected := expectedPaths[obj.Path()] + require.True(t, expected, "walking path %q was not expected", obj.Path()) + return nil + })) + }) + }) +} + +func TestToBucketEmpty(t *testing.T) { + t.Parallel() + var m manifest.Manifest + bucket, err := manifest.NewBucket(m, manifest.BlobSet{}) + require.NoError(t, err) + // make sure there are no files in the bucket + require.NoError(t, bucket.Walk(context.Background(), "", func(obj storage.ObjectInfo) error { + require.Fail(t, "unexpected file %q in the bucket", obj.Path()) + return nil + })) +} diff --git a/pkg/bufman/pkg/netextended/netextended.go b/pkg/bufman/pkg/netextended/netextended.go new file mode 100644 index 000000000..a4277cc35 --- /dev/null +++ b/pkg/bufman/pkg/netextended/netextended.go @@ -0,0 +1,105 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package netextended + +import ( + "errors" + "fmt" + "net" +) + +const ( + domainNameMinLength = 2 + domainNameMaxLength = 254 + maxSegmentLength = 63 +) + +// ValidateHostname verifies the given hostname is a well-formed IP address +// or domain name, optionally including a port, and returns the hostname part. +func ValidateHostname(hostname string) (string, error) { + if len(hostname) == 0 { + return "", errors.New("must not be empty") + } + if len(hostname) < domainNameMinLength || len(hostname) > domainNameMaxLength { + return "", fmt.Errorf("must be at least %d and at most %d characters", domainNameMinLength, domainNameMaxLength) + } + + parsedHost := hostname + if host, _, err := net.SplitHostPort(hostname); err == nil { + parsedHost = host + } + if net.ParseIP(parsedHost) != nil { + // hostname is a valid IP address + return hostname, nil + } + if err := isValidDomainName(parsedHost); err != nil { + return "", fmt.Errorf("must either be a valid IP address or domain name: invalid domain name %q, %w", hostname, err) + } + return hostname, nil +} + +// isValidDomainName validates a hostname according to the requirements set for +// domain names internally in the Go standard library's net package, see +// golang.org/issue/12421. +// +// Adapted from https://github.com/golang/go/blob/f4e7a6b905ce60448e506a3f6578d01b60602cdd/src/net/dnsclient.go#L73-L128 +// See https://github.com/golang/go/blob/f4e7a6b905ce60448e506a3f6578d01b60602cdd/LICENSE for the license. +func isValidDomainName(hostname string) error { + previous := rune('.') + nonNumeric := false + segmentLen := 0 + for _, char := range hostname { + switch { + case '0' <= char && char <= '9': + segmentLen++ + case 'a' <= char && char <= 'z' || 'A' <= char && char <= 'Z' || char == '_': + nonNumeric = true + segmentLen++ + case char == '-': + if previous == '.' { + return fmt.Errorf("cannot begin a segment after a period (.) with a hyphen (-)") + } + nonNumeric = true + segmentLen++ + case char == '.': + if previous == '.' { + return fmt.Errorf("cannot contain two periods (.) in a row") + } + if previous == '-' { + return fmt.Errorf("cannot have a hyphen (-) immediately before a period (.)") + } + if segmentLen > maxSegmentLength { + return fmt.Errorf("cannot have segments greater than %v characters between periods (.)", maxSegmentLength) + } + segmentLen = 0 + default: + return fmt.Errorf("included invalid character %q, must only contain letters, digits, periods (.), hyphens (-), or underscores (_)", char) + } + previous = char + } + + if previous == '-' { + return fmt.Errorf("cannot have a hyphen (-) as the final character") + } + if segmentLen > maxSegmentLength { + return fmt.Errorf("cannot have segments greater than %v characters between periods (.)", maxSegmentLength) + } + if !nonNumeric { + return errors.New("must have at least one non-numeric character") + } + + return nil +} diff --git a/pkg/bufman/pkg/netextended/netextended_test.go b/pkg/bufman/pkg/netextended/netextended_test.go new file mode 100644 index 000000000..edbf2fc6c --- /dev/null +++ b/pkg/bufman/pkg/netextended/netextended_test.go @@ -0,0 +1,116 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package netextended + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestValidateHostname(t *testing.T) { + t.Parallel() + tests := []struct { + description string + hostname string + isValid bool + }{ + { + description: "localhost is valid", + hostname: "localhost", + isValid: true, + }, + { + description: "foo.com is valid", + hostname: "foo.com", + isValid: true, + }, + { + description: "foo.bar.com is valid", + hostname: "foo.bar.com", + isValid: true, + }, + { + description: "domain name with port is valid", + hostname: "localhost:3000", + isValid: true, + }, + { + description: "IPV4 is valid", + hostname: "10.40.210.253", + isValid: true, + }, + { + description: "IPV4 with port is valid", + hostname: "0.0.0.0:64514", + isValid: true, + }, + { + description: "IPV6 is valid", + hostname: "2001:0db8:85a3:0000:0000:8a2e:0370:7334", + isValid: true, + }, + { + description: "IPV6 with port is valid", + hostname: "[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:64514", + isValid: true, + }, + { + description: "0.0.0.0 is valid", + hostname: "0.0.0.0", + isValid: true, + }, + { + description: "127.0.0.1 is valid", + hostname: "127.0.0.1", + isValid: true, + }, + { + description: "malformed IP is invalid", + hostname: "127.0.0.256", + isValid: false, + }, + { + description: "malformed domain name is invalid", + hostname: "this-domain-name-has-too-many-characters-in-a-segment-to-be-considered-valid.com", + isValid: false, + }, + { + description: "does not allow invalid characters", + hostname: "is.this.a.valid.domain?", + isValid: false, + }, + { + description: "hostname must be set", + hostname: "", + isValid: false, + }, + } + + for _, test := range tests { + tt := test + t.Run(tt.description, func(t *testing.T) { + t.Parallel() + hostname, err := ValidateHostname(tt.hostname) + if tt.isValid { + assert.Equal(t, tt.hostname, hostname) + assert.NoError(t, err) + } else { + assert.Error(t, err) + } + }) + } +} diff --git a/pkg/bufman/pkg/netrc/machine.go b/pkg/bufman/pkg/netrc/machine.go new file mode 100644 index 000000000..783f3fdd6 --- /dev/null +++ b/pkg/bufman/pkg/netrc/machine.go @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package netrc + +type machine struct { + name string + login string + password string +} + +func newMachine( + name string, + login string, + password string, +) *machine { + return &machine{ + name: name, + login: login, + password: password, + } +} + +func (m *machine) Name() string { + return m.name +} + +func (m *machine) Login() string { + return m.login +} + +func (m *machine) Password() string { + return m.password +} diff --git a/pkg/bufman/pkg/netrc/netrc.go b/pkg/bufman/pkg/netrc/netrc.go new file mode 100644 index 000000000..e0f38467a --- /dev/null +++ b/pkg/bufman/pkg/netrc/netrc.go @@ -0,0 +1,178 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netrc contains functionality to work with netrc. +package netrc + +import ( + "io/fs" + "os" + "path/filepath" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/jdxcode/netrc" +) + +// Filename exposes the netrc filename based on the current operating system. +const Filename = netrcFilename + +// Machine is a machine. +type Machine interface { + // Empty for default machine. + Name() string + Login() string + Password() string +} + +// NewMachine creates a new Machine. +func NewMachine( + name string, + login string, + password string, +) Machine { + return newMachine(name, login, password) +} + +// GetMachineForName returns the Machine for the given name. +// +// Returns nil if no such Machine. +func GetMachineForName(envContainer app.EnvContainer, name string) (_ Machine, retErr error) { + filePath, err := GetFilePath(envContainer) + if err != nil { + return nil, err + } + return GetMachineForNameAndFilePath(name, filePath) +} + +// PutMachines adds the given Machines to the configured netrc file. +func PutMachines(envContainer app.EnvContainer, machines ...Machine) error { + filePath, err := GetFilePath(envContainer) + if err != nil { + return err + } + return putMachinesForFilePath(machines, filePath) +} + +// DeleteMachineForName deletes the Machine for the given name, if set. +// +// Returns false if there was no Machine for the given name. +func DeleteMachineForName(envContainer app.EnvContainer, name string) (bool, error) { + filePath, err := GetFilePath(envContainer) + if err != nil { + return false, err + } + return deleteMachineForFilePath(name, filePath) +} + +// GetFilePath gets the netrc file path for the given environment. +func GetFilePath(envContainer app.EnvContainer) (string, error) { + if netrcFilePath := envContainer.Env("NETRC"); netrcFilePath != "" { + return netrcFilePath, nil + } + homeDirPath, err := app.HomeDirPath(envContainer) + if err != nil { + return "", err + } + return filepath.Join(homeDirPath, netrcFilename), nil +} + +// GetMachineForNameAndFilePath returns the Machine for the given name from the +// file at the given path. +// +// Returns nil if no such Machine or no such file. +func GetMachineForNameAndFilePath(name string, filePath string) (_ Machine, retErr error) { + if _, err := os.Stat(filePath); err != nil { + if os.IsNotExist(err) { + return nil, nil + } + return nil, err + } + netrcStruct, err := netrc.Parse(filePath) + if err != nil { + return nil, err + } + netrcMachine := netrcStruct.Machine(name) + if netrcMachine == nil { + netrcMachine = netrcStruct.Machine("default") + if netrcMachine == nil { + return nil, nil + } + } + // We take the name from the read Machine just in case there's some case-insensitivity weirdness + machineName := netrcMachine.Name + if machineName == "default" { + machineName = "" + } + return newMachine( + machineName, + netrcMachine.Get("login"), + netrcMachine.Get("password"), + ), nil +} + +func putMachinesForFilePath(machines []Machine, filePath string) (retErr error) { + var netrcStruct *netrc.Netrc + fileInfo, err := os.Stat(filePath) + var fileMode fs.FileMode + if err != nil { + if os.IsNotExist(err) { + netrcStruct = &netrc.Netrc{} + fileMode = 0o600 + } else { + return err + } + } else { + netrcStruct, err = netrc.Parse(filePath) + if err != nil { + return err + } + fileMode = fileInfo.Mode() + } + for _, machine := range machines { + if foundMachine := netrcStruct.Machine(machine.Name()); foundMachine != nil { + netrcStruct.RemoveMachine(machine.Name()) + } + netrcStruct.AddMachine( + machine.Name(), + machine.Login(), + machine.Password(), + ) + } + return os.WriteFile(filePath, []byte(netrcStruct.Render()), fileMode) +} + +func deleteMachineForFilePath(name string, filePath string) (_ bool, retErr error) { + fileInfo, err := os.Stat(filePath) + if err != nil { + if os.IsNotExist(err) { + // If a netrc file does not already exist, there's nothing to be done. + return false, nil + } + return false, err + } + netrcStruct, err := netrc.Parse(filePath) + if err != nil { + return false, err + } + if netrcStruct.Machine(name) == nil { + // Machine is not set, there is nothing to be done. + return false, nil + } + netrcStruct.RemoveMachine(name) + if err := os.WriteFile(filePath, []byte(netrcStruct.Render()), fileInfo.Mode()); err != nil { + return false, err + } + return true, nil +} diff --git a/pkg/bufman/pkg/netrc/netrc_unix.go b/pkg/bufman/pkg/netrc/netrc_unix.go new file mode 100644 index 000000000..30a7ce704 --- /dev/null +++ b/pkg/bufman/pkg/netrc/netrc_unix.go @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matching the unix-like build tags in the Golang source i.e. https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/file_unix.go#L6 + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package netrc + +// netrcFilename is the netrc filename. +// +// This will be .netrc for unix-like platforms including darwin. +// This will be _netrc for windows. +const netrcFilename = ".netrc" diff --git a/pkg/bufman/pkg/netrc/netrc_unix_test.go b/pkg/bufman/pkg/netrc/netrc_unix_test.go new file mode 100644 index 000000000..e2a126569 --- /dev/null +++ b/pkg/bufman/pkg/netrc/netrc_unix_test.go @@ -0,0 +1,290 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matching the unix-like build tags in the Golang source i.e. https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/file_unix.go#L6 + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package netrc + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGetMachineForName(t *testing.T) { + t.Parallel() + testGetMachineForNameSuccess( + t, + "foo.com", + "testdata/unix/home1", + "foo.com", + "bar", + "baz", + ) + testGetMachineForNameNil( + t, + "api.foo.com", + "testdata/unix/home1", + ) + testGetMachineForNameNil( + t, + "bar.com", + "testdata/unix/home1", + ) + testGetMachineForNameSuccess( + t, + "foo.com", + "testdata/unix/home2", + "", + "bar", + "baz", + ) + testGetMachineForNameSuccess( + t, + "api.foo.com", + "testdata/unix/home2", + "", + "bar", + "baz", + ) + testGetMachineForNameSuccess( + t, + "bar.com", + "testdata/unix/home2", + "", + "bar", + "baz", + ) + testGetMachineForNameNil( + t, + "foo.com", + "testdata/unix/home3", + ) + testGetMachineForNameNil( + t, + "api.foo.com", + "testdata/unix/home3", + ) + testGetMachineForNameNil( + t, + "bar.com", + "testdata/unix/home1", + ) +} + +func TestPutMachines(t *testing.T) { + t.Parallel() + testPutMachinesSuccess( + t, + false, + NewMachine( + "foo.com", + "test@foo.com", + "password", + ), + ) + testPutMachinesSuccess( + t, + true, + NewMachine( + "foo.com", + "test@foo.com", + "password", + ), + ) + testPutMachinesSuccess( + t, + false, + NewMachine( + "bar.com", + "test@bar.com", + "password", + ), + NewMachine( + "baz.com", + "test@baz.com", + "password", + ), + ) +} + +// https://github.com/ProtobufMan/bufman-cli/issues/611 +func TestPutLotsOfBigMachinesSingleLineFiles(t *testing.T) { + t.Parallel() + size := 10 + password := strings.Repeat("abcdefghijklmnopqrstuvwxyz", size) + machines := make([]Machine, 0, size) + buffer := bytes.NewBuffer(nil) + for i := 0; i < size; i++ { + // Write the file manually in single-line format as this is where the failure happens. + _, _ = buffer.WriteString(fmt.Sprintf("machine foo%d login bar%d password %s\n", i, i, password)) + machines = append( + machines, + NewMachine( + fmt.Sprintf("foo%d", i), + fmt.Sprintf("bar%d", i), + password, + ), + ) + } + filePath := filepath.Join(t.TempDir(), netrcFilename) + err := os.WriteFile(filePath, buffer.Bytes(), 0o600) + require.NoError(t, err) + + envContainer := app.NewEnvContainer(map[string]string{"NETRC": filePath}) + for _, machine := range machines { + // Make sure the existing file can be parsed. + actualMachine, err := GetMachineForName(envContainer, machine.Name()) + require.NoError(t, err) + require.Equal(t, machine, actualMachine) + } + + // Now, modify the file with an extra machine. This is when the file got corrupted. + extraMachine := NewMachine( + "baz.com", + "test@baz.com", + "password", + ) + err = PutMachines(envContainer, extraMachine) + require.NoError(t, err) + machines = append(machines, extraMachine) + for _, machine := range machines { + // Verify all the machines work. This failed previously. + actualMachine, err := GetMachineForName(envContainer, machine.Name()) + require.NoError(t, err) + require.Equal(t, machine, actualMachine) + } + + // Modify some of the existing machines. + machines = make([]Machine, 0, size) + for i := 0; i < size; i++ { + modifiedPassword := password + if i%2 == 0 { + modifiedPassword = modifiedPassword + "Z" + } + machine := NewMachine( + fmt.Sprintf("foo%d", i), + fmt.Sprintf("bar%d", i), + modifiedPassword, + ) + machines = append(machines, machine) + if i%2 == 0 { + err = PutMachines(envContainer, machine) + require.NoError(t, err) + } + } + machines = append(machines, extraMachine) + for _, machine := range machines { + actualMachine, err := GetMachineForName(envContainer, machine.Name()) + require.NoError(t, err) + require.Equal(t, machine, actualMachine) + } +} + +func TestDeleteMachineForName(t *testing.T) { + t.Parallel() + filePath := filepath.Join(t.TempDir(), netrcFilename) + envContainer := app.NewEnvContainer(map[string]string{"NETRC": filePath}) + err := PutMachines( + envContainer, + NewMachine( + "bar.com", + "test@bar.com", + "password", + ), + NewMachine( + "baz.com", + "test@baz.com", + "password", + ), + ) + require.NoError(t, err) + exists, err := DeleteMachineForName(envContainer, "bar.com") + require.NoError(t, err) + require.True(t, exists) + machine, err := GetMachineForName(envContainer, "bar.com") + require.NoError(t, err) + assert.Nil(t, machine) + machine, err = GetMachineForName(envContainer, "baz.com") + require.NoError(t, err) + assert.NotNil(t, machine) + exists, err = DeleteMachineForName(envContainer, "bar.com") + require.NoError(t, err) + require.False(t, exists) +} + +func testPutMachinesSuccess( + t *testing.T, + createNetrcBeforePut bool, + machines ...Machine, +) { + filePath := filepath.Join(t.TempDir(), netrcFilename) + envContainer := app.NewEnvContainer(map[string]string{"NETRC": filePath}) + for _, machine := range machines { + machine, err := GetMachineForName(envContainer, machine.Name()) + require.NoError(t, err) + require.Nil(t, machine) + } + + if createNetrcBeforePut { + _, err := os.Create(filePath) + require.NoError(t, err) + } + + err := PutMachines(envContainer, machines...) + require.NoError(t, err) + + for _, machine := range machines { + actualMachine, err := GetMachineForName(envContainer, machine.Name()) + require.NoError(t, err) + assert.Equal(t, machine, actualMachine) + } +} + +func testGetMachineForNameSuccess( + t *testing.T, + name string, + homeDirPath string, + expectedName string, + expectedLogin string, + expectedPassword string, +) { + machine, err := GetMachineForName(app.NewEnvContainer(map[string]string{"HOME": homeDirPath}), name) + require.NoError(t, err) + require.NotNil(t, machine) + assert.Equal(t, expectedName, machine.Name()) + assert.Equal(t, expectedLogin, machine.Login()) + assert.Equal(t, expectedPassword, machine.Password()) +} + +func testGetMachineForNameNil( + t *testing.T, + name string, + homeDirPath string, +) { + machine, err := GetMachineForName(app.NewEnvContainer(map[string]string{"HOME": homeDirPath}), name) + require.NoError(t, err) + require.Nil(t, machine) +} diff --git a/pkg/bufman/pkg/netrc/netrc_windows.go b/pkg/bufman/pkg/netrc/netrc_windows.go new file mode 100644 index 000000000..02cd17d25 --- /dev/null +++ b/pkg/bufman/pkg/netrc/netrc_windows.go @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package netrc + +// netrcFilename is the netrc filename. +// +// This will be .netrc for darwin and linux. +// This will be _netrc for windows. +const netrcFilename = "_netrc" diff --git a/pkg/bufman/pkg/netrc/testdata/unix/home1/.netrc b/pkg/bufman/pkg/netrc/testdata/unix/home1/.netrc new file mode 100644 index 000000000..b920e5d49 --- /dev/null +++ b/pkg/bufman/pkg/netrc/testdata/unix/home1/.netrc @@ -0,0 +1,4 @@ +machine foo.com +login bar +password baz +account bat diff --git a/pkg/bufman/pkg/netrc/testdata/unix/home2/.netrc b/pkg/bufman/pkg/netrc/testdata/unix/home2/.netrc new file mode 100644 index 000000000..f97cb8a8a --- /dev/null +++ b/pkg/bufman/pkg/netrc/testdata/unix/home2/.netrc @@ -0,0 +1,3 @@ +default +login bar +password baz diff --git a/pkg/bufman/pkg/netrc/testdata/unix/home3/.netrcc b/pkg/bufman/pkg/netrc/testdata/unix/home3/.netrcc new file mode 100644 index 000000000..f97cb8a8a --- /dev/null +++ b/pkg/bufman/pkg/netrc/testdata/unix/home3/.netrcc @@ -0,0 +1,3 @@ +default +login bar +password baz diff --git a/pkg/bufman/pkg/normalpath/normalpath.go b/pkg/bufman/pkg/normalpath/normalpath.go new file mode 100644 index 000000000..c52d74019 --- /dev/null +++ b/pkg/bufman/pkg/normalpath/normalpath.go @@ -0,0 +1,374 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package normalpath provides functions similar to filepath. +// +// A normalized path is a cleaned and to-slash'ed path. +// A validated path validates that a path is relative and does not jump context. +package normalpath + +import ( + "errors" + "fmt" + "net/url" + "os" + "path/filepath" + "sort" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" +) + +const ( + // Relative is the PathType for normalized and validated paths. + Relative PathType = 1 + // Absolute is the PathType for normalized and absolute paths. + Absolute PathType = 2 + + stringOSPathSeparator = string(os.PathSeparator) + // This has to be with "/" instead of os.PathSeparator as we use this on normalized paths + normalizedRelPathJumpContextPrefix = "../" +) + +var ( + // errNotRelative is the error returned if the path is not relative. + errNotRelative = errors.New("expected to be relative") + // errOutsideContextDir is the error returned if the path is outside the context directory. + errOutsideContextDir = errors.New("is outside the context directory") +) + +// PathType is a terminate type for path comparisons. +type PathType int + +// Separator gets the string value of the separator. +// +// TODO: rename to Terminator if we keep this +// TODO: we should probably refactor so we never need to use absolute paths at all +// this could be accomplished if we could for ExternalPathToRelPath on buckets +func (t PathType) Separator() string { + switch t { + case Relative: + return "." + case Absolute: + return "/" + default: + return "" + } +} + +// Error is a path error. +type Error struct { + Path string + Err error +} + +// NewError returns a new Error. +func NewError(path string, err error) *Error { + return &Error{ + Path: path, + Err: err, + } +} + +// Error implements error. +func (e *Error) Error() string { + errString := "" + if e.Err != nil { + errString = e.Err.Error() + } + if errString == "" { + errString = "error" + } + return e.Path + ": " + errString +} + +// Unwrap implements errors.Unwrap for Error. +func (e *Error) Unwrap() error { + if e == nil { + return nil + } + return e.Err +} + +// Normalize normalizes the given path. +// +// This calls filepath.Clean and filepath.ToSlash on the path. +// If the path is "" or ".", this returns ".". +func Normalize(path string) string { + return filepath.ToSlash(filepath.Clean(path)) +} + +// NormalizeAndAbsolute normalizes the path and makes it absolute. +func NormalizeAndAbsolute(path string) (string, error) { + absPath, err := filepath.Abs(Unnormalize(path)) + if err != nil { + return "", err + } + return Normalize(absPath), nil +} + +// NormalizeAndTransformForPathType calls NormalizeAndValidate for relative +// paths, and NormalizeAndAbsolute for absolute paths. +func NormalizeAndTransformForPathType(path string, pathType PathType) (string, error) { + switch pathType { + case Relative: + return NormalizeAndValidate(path) + case Absolute: + return NormalizeAndAbsolute(path) + default: + return "", fmt.Errorf("unknown PathType: %v", pathType) + } +} + +// Unnormalize unnormalizes the given path. +// +// This calls filepath.FromSlash on the path. +// If the path is "", this returns "". +func Unnormalize(path string) string { + return filepath.FromSlash(path) +} + +// Base is equivalent to filepath.Base. +// +// Normalizes before returning. +func Base(path string) string { + return Normalize(filepath.Base(Unnormalize(path))) +} + +// Dir is equivalent to filepath.Dir. +// +// Normalizes before returning. +func Dir(path string) string { + return Normalize(filepath.Dir(Unnormalize(path))) +} + +// Ext is equivalent to filepath.Ext. +// +// Can return empty string. +func Ext(path string) string { + return filepath.Ext(Unnormalize(path)) +} + +// Join is equivalent to filepath.Join. +// +// Empty strings are ignored, +// Can return empty string. +// +// Normalizes before returning otherwise. +func Join(paths ...string) string { + unnormalized := make([]string, len(paths)) + for i, path := range paths { + unnormalized[i] = Unnormalize(path) + } + value := filepath.Join(unnormalized...) + if value == "" { + return "" + } + return Normalize(value) +} + +// Rel is equivalent to filepath.Rel. +// +// Can return empty string, especially on error. +// +// Normalizes before returning otherwise. +func Rel(basepath string, targpath string) (string, error) { + path, err := filepath.Rel(Unnormalize(basepath), Unnormalize(targpath)) + if path == "" { + return "", err + } + return Normalize(path), err +} + +// ByDir maps the paths into a map from directory via Dir to the original paths. +// +// The paths for each value slice will be sorted. +// +// The path is expected to be normalized. +func ByDir(paths ...string) map[string][]string { + m := make(map[string][]string) + for _, path := range paths { + path = Normalize(path) + dir := filepath.Dir(path) + m[dir] = append(m[dir], path) + } + for _, dirPaths := range m { + sort.Strings(dirPaths) + } + return m +} + +// ChunkByDir splits paths into chunks of around the suggestedChunkSize while keeping +// directory affinity, i.e. paths in the same directory will be in the same chunk. +// +// Paths are expected to be normalized. +// If paths is nil or empty, returns empty. +// If suggestedChunkSize is <=0, returns [][]string{paths}. +func ChunkByDir(paths []string, suggestedChunkSize int) [][]string { + var chunks [][]string + if len(paths) == 0 { + return chunks + } + if suggestedChunkSize <= 0 { + return [][]string{paths} + } + + dirToPaths := ByDir(paths...) + // Get the keys and sort them to keep the output of this stable + dirs := make([]string, 0, len(dirToPaths)) + for dir := range dirToPaths { + dirs = append(dirs, dir) + } + sort.Strings(dirs) + // Create a slice of the per-directory path slices + pathsByDir := make([][]string, 0, len(dirToPaths)) + for _, dir := range dirs { + pathsByDir = append(pathsByDir, dirToPaths[dir]) + } + // Sort the per-directory path slices by length, from greatest to smallest + // We do greatest to smallest because we pop the greatest off first, and + // This will approximate keeping things in alphabetical order given that + // pathsByDir is in alphabetical order of directories. + sort.SliceStable( + pathsByDir, + func(i int, j int) bool { + return len(pathsByDir[i]) > len(pathsByDir[j]) + }, + ) + + for len(pathsByDir) > 0 { + // Take the largest set of paths and remove from pathsByDir + chunk := pathsByDir[0] + pathsByDir = pathsByDir[1:] + // While our current chunk is less than the suggestedChunkSize, take the smallest + // set of paths and append them to the chunk, and then remove them from pathsByDir + // + // This will mean that sometimes we have chunks larger than suggestedChunkSize, but + // this is best effort. We could likely use more-complicated algorithms here that + // smartly combine per-directory path sets that minimize the distance from + // suggestedChunkSize, as there are adversary cases to this algorithm, but we + // are not diving into that at the moment unless there is a need. + for len(chunk) < suggestedChunkSize && len(pathsByDir) > 0 { + chunk = append(chunk, pathsByDir[len(pathsByDir)-1]...) + pathsByDir = pathsByDir[:len(pathsByDir)-1] + } + // Append the chunk to the list of chunks + chunks = append(chunks, chunk) + } + + return chunks +} + +// ContainsPath returns true if the dirPath contains the path. +// +// The path and value are expected to be normalized and validated if Relative is used. +// The path and value are expected to be normalized and absolute if Absolute is used. +// +// For a given dirPath: +// +// - If path == PathType, dirPath does not contain the path. +// - If dirPath == PathType, the dirPath contains the path. +// - If dirPath is a directory that contains path, this returns true. +func ContainsPath(dirPath string, path string, pathType PathType) bool { + if dirPath == path { + return false + } + return EqualsOrContainsPath(dirPath, Dir(path), pathType) +} + +// MapAllEqualOrContainingPaths returns the matching paths in the map in a sorted slice. +// +// The path and keys in m are expected to be normalized and validated if Relative is used. +// The path and keys in m are expected to be normalized and absolute if Absolute is used. +// +// If the map is empty, returns nil. +func MapAllEqualOrContainingPaths(m map[string]struct{}, path string, pathType PathType) []string { + if len(m) == 0 { + return nil + } + return stringutil.MapToSortedSlice(MapAllEqualOrContainingPathMap(m, path, pathType)) +} + +// StripComponents strips the specified number of components. +// +// Path expected to be normalized. +// Returns false if the path does not have more than the specified number of components. +func StripComponents(path string, countUint32 uint32) (string, bool) { + count := int(countUint32) + if count == 0 { + return path, true + } + components := Components(path) + if len(components) <= count { + return "", false + } + return Join(components[count:]...), true +} + +// ValidatePathComponent validates that the string is a valid +// component of a path, e.g. it can be Joined and form a valid path. +func ValidatePathComponent(component string) error { + if component == "" { + return errors.New("path component must not be empty") + } + if strings.ContainsRune(component, '/') { + return errors.New(`path component must not contain "/" `) + } + if strings.Contains(component, "..") { + return errors.New(`path component must not contain ".."`) + } + if url.PathEscape(component) != component { + return fmt.Errorf( + "path component must match its URL escaped version: %q did not match %q", + component, + url.PathEscape(component), + ) + } + return nil +} + +// ValidatePathComponents validates that all the strings are valid +// components of a path, e.g. they can be Joined and form a valid path. +func ValidatePathComponents(components ...string) error { + for _, component := range components { + if err := ValidatePathComponent(component); err != nil { + return err + } + } + return nil +} + +// ValidatePathsNormalizedValidatedUnique validates the file or diretory paths are normalized +// and validated, and not duplicated. +func ValidatePathsNormalizedValidatedUnique(paths []string) error { + pathMap := make(map[string]struct{}, len(paths)) + for _, path := range paths { + if path == "" { + return errors.New("path is empty") + } + normalized, err := NormalizeAndValidate(path) + if err != nil { + return fmt.Errorf("path had normalization error: %w", err) + } + if path != normalized { + return fmt.Errorf("path %s was not normalized to %s", path, normalized) + } + if _, ok := pathMap[path]; ok { + return fmt.Errorf("duplicate path: %s", path) + } + pathMap[path] = struct{}{} + } + return nil +} diff --git a/pkg/bufman/pkg/normalpath/normalpath_test.go b/pkg/bufman/pkg/normalpath/normalpath_test.go new file mode 100644 index 000000000..b7c1c40a2 --- /dev/null +++ b/pkg/bufman/pkg/normalpath/normalpath_test.go @@ -0,0 +1,200 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package normalpath + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestChunkByDir(t *testing.T) { + t.Parallel() + testChunkByDir( + t, + nil, + 0, + ) + testChunkByDir( + t, + nil, + 5, + ) + testChunkByDir( + t, + []string{}, + 0, + ) + testChunkByDir( + t, + []string{}, + 5, + ) + testChunkByDir( + t, + []string{"a/a.proto"}, + 1, + []string{"a/a.proto"}, + ) + testChunkByDir( + t, + []string{"a/a.proto"}, + 2, + []string{"a/a.proto"}, + ) + testChunkByDir( + t, + []string{ + "a/a.proto", + "b/b.proto", + }, + 1, + []string{"a/a.proto"}, + []string{"b/b.proto"}, + ) + testChunkByDir( + t, + []string{ + "a/a.proto", + "a/b.proto", + "b/b.proto", + }, + 1, + []string{ + "a/a.proto", + "a/b.proto", + }, + []string{"b/b.proto"}, + ) + testChunkByDir( + t, + []string{ + "a/a.proto", + "a/b.proto", + "b/b.proto", + }, + 2, + []string{ + "a/a.proto", + "a/b.proto", + }, + []string{"b/b.proto"}, + ) + testChunkByDir( + t, + []string{ + "a/a.proto", + "a/b.proto", + "b/b.proto", + }, + 3, + []string{ + "a/a.proto", + "a/b.proto", + "b/b.proto", + }, + ) + testChunkByDir( + t, + []string{ + "a/a.proto", + "a/b.proto", + "a/c.proto", + "a/d.proto", + "a/e.proto", + "b/a.proto", + "b/b.proto", + "b/c.proto", + "b/d.proto", + "c/a.proto", + "c/b.proto", + "c/c.proto", + "d/a.proto", + "d/b.proto", + "e/a.proto", + }, + 5, + []string{ + "a/a.proto", + "a/b.proto", + "a/c.proto", + "a/d.proto", + "a/e.proto", + }, + []string{ + "b/a.proto", + "b/b.proto", + "b/c.proto", + "b/d.proto", + "e/a.proto", + }, + []string{ + "c/a.proto", + "c/b.proto", + "c/c.proto", + "d/a.proto", + "d/b.proto", + }, + ) + testChunkByDir( + t, + []string{ + "a/a.proto", + "a/b.proto", + "a/c.proto", + "a/d.proto", + "a/e.proto", + "b/a.proto", + "b/b.proto", + "b/c.proto", + "b/d.proto", + "c/a.proto", + "c/b.proto", + "c/c.proto", + "d/a.proto", + "d/b.proto", + "e/a.proto", + }, + 6, + []string{ + "a/a.proto", + "a/b.proto", + "a/c.proto", + "a/d.proto", + "a/e.proto", + "e/a.proto", + }, + []string{ + "b/a.proto", + "b/b.proto", + "b/c.proto", + "b/d.proto", + "d/a.proto", + "d/b.proto", + }, + []string{ + "c/a.proto", + "c/b.proto", + "c/c.proto", + }, + ) +} + +func testChunkByDir(t *testing.T, paths []string, suggestedChunkSize int, expected ...[]string) { + // This is testing the implementation unfortunately, so if we change to a different + // algorithm, our expectations will change. + assert.Equal(t, expected, ChunkByDir(paths, suggestedChunkSize)) +} diff --git a/pkg/bufman/pkg/normalpath/normalpath_unix.go b/pkg/bufman/pkg/normalpath/normalpath_unix.go new file mode 100644 index 000000000..e43494233 --- /dev/null +++ b/pkg/bufman/pkg/normalpath/normalpath_unix.go @@ -0,0 +1,162 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matching the unix-like build tags in the Golang standard library based on the dependency +// on "path/filepath", i.e. https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/path/filepath/path_unix.go;l=5-6 + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package normalpath + +import ( + "path/filepath" + "strings" +) + +// NormalizeAndValidate normalizes and validates the given path. +// +// This calls Normalize on the path. +// Returns Error if the path is not relative or jumps context. +// This can be used to validate that paths are valid to use with Buckets. +// The error message is safe to pass to users. +func NormalizeAndValidate(path string) (string, error) { + normalizedPath := Normalize(path) + if filepath.IsAbs(normalizedPath) { + return "", NewError(path, errNotRelative) + } + // https://github.com/ProtobufMan/bufman-cli/issues/51 + if strings.HasPrefix(normalizedPath, normalizedRelPathJumpContextPrefix) { + return "", NewError(path, errOutsideContextDir) + } + return normalizedPath, nil +} + +// EqualsOrContainsPath returns true if the value is equal to or contains the path. +// +// The path and value are expected to be normalized and validated if Relative is used. +// The path and value are expected to be normalized and absolute if Absolute is used. +func EqualsOrContainsPath(value string, path string, pathType PathType) bool { + pathRoot := stringOSPathSeparator + if pathType == Relative { + pathRoot = "." + } + + if value == pathRoot { + return true + } + + // Walk up the path and compare at each directory level until there is a + // match or the path reaches its root (either `/` or `.`). + for curPath := path; curPath != pathRoot; curPath = Dir(curPath) { + if value == curPath { + return true + } + } + return false +} + +// MapHasEqualOrContainingPath returns true if the path matches any file or directory in the map. +// +// The path and keys in m are expected to be normalized and validated if Relative is used. +// The path and keys in m are expected to be normalized and absolute if Absolute is used. +// +// If the map is empty, returns false. +func MapHasEqualOrContainingPath(m map[string]struct{}, path string, pathType PathType) bool { + if len(m) == 0 { + return false + } + + pathRoot := stringOSPathSeparator + if pathType == Relative { + pathRoot = "." + } + + if _, ok := m[pathRoot]; ok { + return true + } + for curPath := path; curPath != pathRoot; curPath = Dir(curPath) { + if _, ok := m[curPath]; ok { + return true + } + } + return false +} + +// MapAllEqualOrContainingPathMap returns the paths in m that are equal to, or contain +// path, in a new map. +// +// The path and keys in m are expected to be normalized and validated if Relative is used. +// The path and keys in m are expected to be normalized and absolute if Absolute is used. +// +// If the map is empty, returns nil. +func MapAllEqualOrContainingPathMap(m map[string]struct{}, path string, pathType PathType) map[string]struct{} { + if len(m) == 0 { + return nil + } + + pathRoot := stringOSPathSeparator + if pathType == Relative { + pathRoot = "." + } + + n := make(map[string]struct{}) + if _, ok := m[pathRoot]; ok { + // also covers if path == separator. + n[pathRoot] = struct{}{} + } + for potentialMatch := range m { + for curPath := path; curPath != pathRoot; curPath = Dir(curPath) { + if potentialMatch == curPath { + n[potentialMatch] = struct{}{} + break + } + } + } + return n +} + +// Components splits the path into it's components. +// +// This calls filepath.Split repeatedly. +// +// The path is expected to be normalized. +func Components(path string) []string { + var components []string + dir := Unnormalize(path) + for { + var file string + dir, file = filepath.Split(dir) + // puts in reverse + components = append(components, file) + if dir == stringOSPathSeparator { + components = append(components, dir) + break + } + dir = strings.TrimSuffix(dir, stringOSPathSeparator) + if dir == "" { + break + } + } + // https://github.com/golang/go/wiki/SliceTricks#reversing + for i := len(components)/2 - 1; i >= 0; i-- { + opp := len(components) - 1 - i + components[i], components[opp] = components[opp], components[i] + } + for i, component := range components { + components[i] = Normalize(component) + } + return components +} diff --git a/pkg/bufman/pkg/normalpath/normalpath_unix_test.go b/pkg/bufman/pkg/normalpath/normalpath_unix_test.go new file mode 100644 index 000000000..455755de5 --- /dev/null +++ b/pkg/bufman/pkg/normalpath/normalpath_unix_test.go @@ -0,0 +1,455 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !windows +// +build !windows + +package normalpath + +import ( + "fmt" + "os" + "path/filepath" + "sort" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "github.com/stretchr/testify/assert" +) + +func TestNormalizeAndValidate(t *testing.T) { + t.Parallel() + path, err := NormalizeAndValidate("") + assert.NoError(t, err) + assert.Equal(t, ".", path) + path, err = NormalizeAndValidate(".") + assert.NoError(t, err) + assert.Equal(t, ".", path) + path, err = NormalizeAndValidate("./.") + assert.NoError(t, err) + assert.Equal(t, ".", path) + path, err = NormalizeAndValidate("./foo") + assert.NoError(t, err) + assert.Equal(t, "foo", path) + + _, err = NormalizeAndValidate("/foo") + assert.Error(t, err) + + _, err = NormalizeAndValidate("../foo") + assert.Error(t, err) +} + +func TestNormalize(t *testing.T) { + t.Parallel() + assert.Equal(t, ".", Normalize("")) + assert.Equal(t, ".", Normalize(".")) + assert.Equal(t, ".", Normalize("./.")) + assert.Equal(t, "foo", Normalize("./foo")) + assert.Equal(t, "../foo", Normalize("../foo")) + assert.Equal(t, "../foo", Normalize("../foo")) + assert.Equal(t, "foo", Normalize("foo/")) + assert.Equal(t, "foo", Normalize("./foo/")) + assert.Equal(t, "/foo", Normalize("/foo")) + assert.Equal(t, "/foo", Normalize("/foo/")) + assert.Equal(t, "/foo/bar", Normalize("/foo/../foo/bar")) +} + +func TestUnnormalize(t *testing.T) { + t.Parallel() + assert.Equal(t, "", Unnormalize("")) + assert.Equal(t, ".", Unnormalize(".")) + assert.Equal(t, "/foo", Unnormalize("/foo")) +} + +func TestBase(t *testing.T) { + t.Parallel() + testBase(t, ".", ".") + testBase(t, ".", ".") + testBase(t, ".", "./.") + testBase(t, "foo", "./foo") + testBase(t, "bar", "./foo/bar") + testBase(t, "bar", "../foo/bar") + testBase(t, "foo", "/foo") + testBase(t, "bar", "/foo/bar") +} + +func testBase(t *testing.T, expected string, input string) { + if os.PathSeparator == '/' { + assert.Equal(t, expected, filepath.Base(input)) + } + assert.Equal(t, expected, Base(input)) +} + +func TestDir(t *testing.T) { + t.Parallel() + testDir(t, ".", "") + testDir(t, ".", ".") + testDir(t, "/", "/") + testDir(t, ".", "./") + testDir(t, ".", "./.") + testDir(t, ".", "foo") + testDir(t, ".", "./foo") + testDir(t, "foo", "./foo/bar") + testDir(t, "../foo", "../foo/bar") + testDir(t, "../foo", "../foo/bar/../..") + testDir(t, "/foo", "/foo/bar") + testDir(t, "/", "/foo") +} + +func testDir(t *testing.T, expected string, input string) { + if os.PathSeparator == '/' { + assert.Equal(t, expected, filepath.Dir(input)) + } + assert.Equal(t, expected, Dir(input)) +} + +func TestExt(t *testing.T) { + t.Parallel() + testExt(t, "", "") + testExt(t, ".", ".") + testExt(t, ".txt", ".txt") + testExt(t, ".txt", ".js.txt") + testExt(t, "", "foo") + testExt(t, ".txt", "foo.txt") + testExt(t, ".txt", "foo.js.txt") + testExt(t, "", "./foo") + testExt(t, ".txt", "./foo.txt") + testExt(t, ".txt", "./foo.js.txt") + testExt(t, "", "./foo/bar") + testExt(t, ".txt", "./foo/bar.txt") + testExt(t, ".txt", "./foo/bar.txt") + testExt(t, ".txt", "./foo/bar.js.txt") + testExt(t, "", "../foo/bar") + testExt(t, ".txt", "../foo/bar.txt") + testExt(t, ".txt", "../foo/bar.js.txt") +} + +func testExt(t *testing.T, expected string, input string) { + if os.PathSeparator == '/' { + assert.Equal(t, expected, filepath.Ext(input)) + } + assert.Equal(t, expected, Ext(input)) +} + +func TestJoin(t *testing.T) { + t.Parallel() + testJoin(t, "", "") + testJoin(t, "", "", "") + testJoin(t, ".", ".", ".") + testJoin(t, ".", "", ".", "") + testJoin(t, "foo/bar", "foo", "./bar") + testJoin(t, "foo", "foo", "./bar", "..") + testJoin(t, "/foo/bar", "/foo", "./bar") + testJoin(t, "/foo", "/foo", "./bar", "..") + testJoin(t, "bar", ".", "bar") +} + +func testJoin(t *testing.T, expected string, input ...string) { + if os.PathSeparator == '/' { + assert.Equal(t, expected, filepath.Join(input...)) + } + assert.Equal(t, expected, Join(input...)) +} + +func TestRel(t *testing.T) { + t.Parallel() + testRel(t, ".", "", "") + testRel(t, ".", "", ".") + testRel(t, ".", ".", "") + testRel(t, ".", ".", ".") + testRel(t, ".", "foo", "foo") + testRel(t, "foo", ".", "foo") + testRel(t, "foo", ".", "./foo") + testRel(t, "foo/bar", ".", "foo/bar") + testRel(t, "bar", "/foo", "/foo/bar") + testRel(t, "bar", "foo", "foo/bar") + testRel(t, "baz", "/foo/./bar", "/foo/bar/baz") + testRel(t, "baz", "foo/./bar", "foo/bar/baz") + testRelError(t, "", "..", "foo/bar") +} + +func testRel(t *testing.T, expected string, basepath string, targpath string) { + if os.PathSeparator == '/' { + rel, err := filepath.Rel(basepath, targpath) + assert.NoError(t, err) + assert.Equal(t, expected, rel) + } + rel, err := Rel(basepath, targpath) + assert.NoError(t, err) + assert.Equal(t, expected, rel) +} + +func testRelError(t *testing.T, expected string, basepath string, targpath string) { + if os.PathSeparator == '/' { + rel, err := filepath.Rel(basepath, targpath) + assert.Error(t, err) + assert.Equal(t, expected, rel) + } + rel, err := Rel(basepath, targpath) + assert.Error(t, err) + assert.Equal(t, expected, rel) +} + +func TestComponents(t *testing.T) { + t.Parallel() + testComponents(t, "", ".") + testComponents(t, ".", ".") + testComponents(t, "foo", "foo") + testComponents(t, "foo/bar", "foo", "bar") + testComponents(t, "foo/bar/../baz", "foo", "bar", "..", "baz") + testComponents(t, "/foo/bar", "/", "foo", "bar") + testComponents(t, "./foo/bar", ".", "foo", "bar") + testComponents(t, "../foo/bar", "..", "foo", "bar") +} + +func testComponents(t *testing.T, path string, expected ...string) { + assert.Equal(t, expected, Components(path)) +} + +func TestStripComponents(t *testing.T) { + t.Parallel() + testStripComponents(t, 0, "", true, "") + testStripComponents(t, 0, "foo", true, "foo") + testStripComponents(t, 0, "foo", true, "foo") + testStripComponents(t, 1, "", false, "foo") + testStripComponents(t, 1, "bar", true, "foo/bar") + testStripComponents(t, 1, "bar/baz", true, "foo/bar/baz") + testStripComponents(t, 2, "baz", true, "foo/bar/baz") + testStripComponents(t, 1, "bar/baz/bat", true, "foo/bar/baz/bat") + testStripComponents(t, 2, "baz/bat", true, "foo/bar/baz/bat") + testStripComponents(t, 3, "bat", true, "foo/bar/baz/bat") + testStripComponents(t, 4, "", false, "foo/bar/baz/bat") + testStripComponents(t, 5, "", false, "foo/bar/baz/bat") +} + +func testStripComponents(t *testing.T, count int, expected string, expectedOK bool, path string) { + actual, ok := StripComponents(path, uint32(count)) + assert.Equal(t, expectedOK, ok) + assert.Equal(t, expected, actual) +} + +func TestByDir(t *testing.T) { + t.Parallel() + assert.Equal( + t, + map[string][]string{ + "one": { + "one/1.txt", + "one/2.txt", + "one/3.txt", + }, + "two": { + "two/1.txt", + "two/2.txt", + "two/3.txt", + }, + }, + ByDir( + "one/2.txt", + "one/1.txt", + "two/2.txt", + "one/3.txt", + "two/1.txt", + "two/3.txt", + ), + ) + assert.Equal( + t, + map[string][]string{ + ".": { + "1.txt", + "2.txt", + "3.txt", + }, + "two": { + "two/1.txt", + "two/2.txt", + "two/3.txt", + }, + }, + ByDir( + "2.txt", + "1.txt", + "3.txt", + "two/3.txt", + "two/2.txt", + "two/1.txt", + ), + ) +} + +func TestContainsPath(t *testing.T) { + t.Parallel() + testContainsPath(t, false, "a.proto", "a.proto") + testContainsPath(t, true, ".", "a.proto") + testContainsPath(t, false, "a.proto", ".") + testContainsPath(t, false, ".", ".") + testContainsPath(t, true, ".", "a/b.proto") + testContainsPath(t, true, ".", "a/b") + testContainsPath(t, false, "a", "ab/c") + testContainsPath(t, true, "a", "a/b/c") + testContainsPath(t, false, "b", "a/b/c") + testContainsPath(t, true, "b", "b/b/c") + testContainsPath(t, true, "b", "b/a/c") +} + +func testContainsPath(t *testing.T, expected bool, value string, path string) { + assert.Equal(t, expected, ContainsPath(value, path, Relative), fmt.Sprintf("%s %s", value, path)) +} + +func TestEqualsOrContainsPath(t *testing.T) { + t.Parallel() + testEqualsOrContainsPath(t, true, "a.proto", "a.proto") + testEqualsOrContainsPath(t, true, ".", "a.proto") + testEqualsOrContainsPath(t, false, "a.proto", ".") + testEqualsOrContainsPath(t, true, ".", "a/b.proto") + testEqualsOrContainsPath(t, true, ".", "a/b") + testEqualsOrContainsPath(t, false, "a", "ab/c") + testEqualsOrContainsPath(t, true, "a", "a/b/c") + testEqualsOrContainsPath(t, false, "b", "a/b/c") + testEqualsOrContainsPath(t, true, "b", "b/b/c") + testEqualsOrContainsPath(t, true, "b", "b/a/c") +} + +func testEqualsOrContainsPath(t *testing.T, expected bool, value string, path string) { + assert.Equal(t, expected, EqualsOrContainsPath(value, path, Relative), fmt.Sprintf("%s %s", value, path)) +} + +func TestMapHasEqualOrContainingPath(t *testing.T) { + t.Parallel() + testMapHasEqualOrContainingPath(t, true, "a.proto", "a.proto") + testMapHasEqualOrContainingPath(t, false, ".", "a.proto") + testMapHasEqualOrContainingPath(t, true, "a.proto", ".") + testMapHasEqualOrContainingPath(t, true, "a/b.proto", ".") + testMapHasEqualOrContainingPath(t, true, "a/b", ".") + testMapHasEqualOrContainingPath(t, false, "ab/c", "a", "b") + testMapHasEqualOrContainingPath(t, true, "a/b/c", "a", "b") + testMapHasEqualOrContainingPath(t, false, "a/b/c", "b") + testMapHasEqualOrContainingPath(t, true, "b/b/c", "b") + testMapHasEqualOrContainingPath(t, true, "b/a/c", "b") + testMapHasEqualOrContainingPath(t, true, "b/b/c", "b", ".") +} + +func testMapHasEqualOrContainingPath(t *testing.T, expected bool, path string, keys ...string) { + keyMap := stringutil.SliceToMap(keys) + assert.Equal(t, expected, MapHasEqualOrContainingPath(keyMap, path, Relative), fmt.Sprintf("%s %v", path, keys)) +} + +func TestMapAllEqualOrContainingPaths(t *testing.T) { + t.Parallel() + testMapAllEqualOrContainingPaths(t, []string{"a.proto"}, "a.proto", "a.proto") + testMapAllEqualOrContainingPaths(t, nil, ".", "a.proto") + testMapAllEqualOrContainingPaths(t, []string{"."}, "a.proto", ".") + testMapAllEqualOrContainingPaths(t, []string{"."}, "a/b.proto", ".") + testMapAllEqualOrContainingPaths(t, []string{"."}, "a/b", ".") + testMapAllEqualOrContainingPaths(t, nil, "ab/c", "a", "b") + testMapAllEqualOrContainingPaths(t, []string{"a"}, "a/b/c", "a", "b") + testMapAllEqualOrContainingPaths(t, nil, "a/b/c", "b") + testMapAllEqualOrContainingPaths(t, []string{"b"}, "b/b/c", "b") + testMapAllEqualOrContainingPaths(t, []string{"b"}, "b/a/c", "b") + testMapAllEqualOrContainingPaths(t, []string{"b", "."}, "b/b/c", "b", ".") + testMapAllEqualOrContainingPaths(t, []string{"b", "b/b", "."}, "b/b/c", "b", "b/b", ".") +} + +func testMapAllEqualOrContainingPaths(t *testing.T, expected []string, path string, keys ...string) { + if expected == nil { + expected = make([]string, 0) + } + sort.Strings(expected) + keyMap := stringutil.SliceToMap(keys) + assert.Equal(t, expected, MapAllEqualOrContainingPaths(keyMap, path, Relative), fmt.Sprintf("%s %v", path, keys)) +} + +func TestContainsPathAbs(t *testing.T) { + t.Parallel() + testContainsPathAbs(t, false, "/a.proto", "/a.proto") + testContainsPathAbs(t, true, "/", "/a.proto") + testContainsPathAbs(t, false, "/a.proto", "/") + testContainsPathAbs(t, false, "/", "/") + testContainsPathAbs(t, true, "/", "/a/b.proto") + testContainsPathAbs(t, true, "/", "/a/b") + testContainsPathAbs(t, false, "/a", "/ab/c") + testContainsPathAbs(t, true, "/a", "/a/b/c") + testContainsPathAbs(t, false, "/b", "/a/b/c") + testContainsPathAbs(t, true, "/b", "/b/b/c") + testContainsPathAbs(t, true, "/b", "/b/a/c") +} + +func testContainsPathAbs(t *testing.T, expected bool, value string, path string) { + assert.Equal(t, expected, ContainsPath(value, path, Absolute), fmt.Sprintf("%s %s", value, path)) +} + +func TestEqualsOrContainsPathAbs(t *testing.T) { + t.Parallel() + testEqualsOrContainsPathAbs(t, true, "/a.proto", "/a.proto") + testEqualsOrContainsPathAbs(t, true, "/", "/a.proto") + testEqualsOrContainsPathAbs(t, false, "a.proto", "/") + testEqualsOrContainsPathAbs(t, true, "/", "/a/b.proto") + testEqualsOrContainsPathAbs(t, true, "/", "/a/b") + testEqualsOrContainsPathAbs(t, false, "/a", "/ab/c") + testEqualsOrContainsPathAbs(t, true, "/a", "/a/b/c") + testEqualsOrContainsPathAbs(t, false, "/b", "/a/b/c") + testEqualsOrContainsPathAbs(t, true, "/b", "/b/b/c") + testEqualsOrContainsPathAbs(t, true, "/b", "/b/a/c") +} + +func testEqualsOrContainsPathAbs(t *testing.T, expected bool, value string, path string) { + assert.Equal(t, expected, EqualsOrContainsPath(value, path, Absolute), fmt.Sprintf("%s %s", value, path)) +} + +func TestMapHasEqualOrContainingPathAbs(t *testing.T) { + t.Parallel() + testMapHasEqualOrContainingPathAbs(t, true, "/a.proto", "/a.proto") + testMapHasEqualOrContainingPathAbs(t, false, "/", "/a.proto") + testMapHasEqualOrContainingPathAbs(t, true, "/a.proto", "/") + testMapHasEqualOrContainingPathAbs(t, true, "/a/b.proto", "/") + testMapHasEqualOrContainingPathAbs(t, true, "/a/b", "/") + testMapHasEqualOrContainingPathAbs(t, false, "/ab/c", "/a", "/b") + testMapHasEqualOrContainingPathAbs(t, true, "/a/b/c", "/a", "/b") + testMapHasEqualOrContainingPathAbs(t, false, "/a/b/c", "/b") + testMapHasEqualOrContainingPathAbs(t, true, "/b/b/c", "/b") + testMapHasEqualOrContainingPathAbs(t, true, "/b/a/c", "/b") + testMapHasEqualOrContainingPathAbs(t, true, "/b/b/c", "/b", "/") +} + +func testMapHasEqualOrContainingPathAbs(t *testing.T, expected bool, path string, keys ...string) { + keyMap := stringutil.SliceToMap(keys) + assert.Equal(t, expected, MapHasEqualOrContainingPath(keyMap, path, Absolute), fmt.Sprintf("%s %v", path, keys)) +} + +func TestMapAllEqualOrContainingPathsAbs(t *testing.T) { + t.Parallel() + testMapAllEqualOrContainingPathsAbs(t, []string{"/a.proto"}, "/a.proto", "/a.proto") + testMapAllEqualOrContainingPathsAbs(t, nil, "/", "/a.proto") + testMapAllEqualOrContainingPathsAbs(t, []string{"/"}, "/a.proto", "/") + testMapAllEqualOrContainingPathsAbs(t, []string{"/"}, "/a/b.proto", "/") + testMapAllEqualOrContainingPathsAbs(t, []string{"/"}, "/a/b", "/") + testMapAllEqualOrContainingPathsAbs(t, nil, "/ab/c", "/a", "/b") + testMapAllEqualOrContainingPathsAbs(t, []string{"/a"}, "/a/b/c", "/a", "/b") + testMapAllEqualOrContainingPathsAbs(t, nil, "/a/b/c", "/b") + testMapAllEqualOrContainingPathsAbs(t, []string{"/b"}, "/b/b/c", "/b") + testMapAllEqualOrContainingPathsAbs(t, []string{"/b"}, "/b/a/c", "/b") + testMapAllEqualOrContainingPathsAbs(t, []string{"/b", "/"}, "/b/b/c", "/b", "/") + testMapAllEqualOrContainingPathsAbs(t, []string{"/b", "/b/b", "/"}, "/b/b/c", "/b", "/b/b", "/") +} + +func testMapAllEqualOrContainingPathsAbs(t *testing.T, expected []string, path string, keys ...string) { + if expected == nil { + expected = make([]string, 0) + } + sort.Strings(expected) + keyMap := stringutil.SliceToMap(keys) + assert.Equal(t, expected, MapAllEqualOrContainingPaths(keyMap, path, Absolute), fmt.Sprintf("%s %v", path, keys)) +} diff --git a/pkg/bufman/pkg/normalpath/normalpath_windows.go b/pkg/bufman/pkg/normalpath/normalpath_windows.go new file mode 100644 index 000000000..ab9c24917 --- /dev/null +++ b/pkg/bufman/pkg/normalpath/normalpath_windows.go @@ -0,0 +1,182 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package normalpath + +import ( + "os" + "path/filepath" + "strings" +) + +// NormalizeAndValidate normalizes and validates the given path. +// +// This calls Normalize on the path. +// Returns Error if the path is not relative or jumps context. +// This can be used to validate that paths are valid to use with Buckets. +// The error message is safe to pass to users. +func NormalizeAndValidate(path string) (string, error) { + normalizedPath := Normalize(path) + if filepath.IsAbs(normalizedPath) || (len(normalizedPath) > 0 && normalizedPath[0] == '/') { + // the stdlib implementation of `IsAbs` assumes that a volume name is required for a path to + // be absolute, however Windows treats a `/` (normalized) rooted path as absolute _within_ the current volume. + // In the context of validating that a path is _not_ relative, we need to reject a path that begins + // with `/`. + return "", NewError(path, errNotRelative) + } + // https://github.com/ProtobufMan/bufman-cli/issues/51 + if strings.HasPrefix(normalizedPath, normalizedRelPathJumpContextPrefix) { + return "", NewError(path, errOutsideContextDir) + } + return normalizedPath, nil +} + +// EqualsOrContainsPath returns true if the value is equal to or contains the path. +// path is compared at each directory level to value for equivalency under simple unicode +// codepoint folding. This means it is context and locale independent. This matching +// will not support the few rare cases, primarily in Turkish and Lithuanian, noted +// in the caseless matching section of Unicode 13.0 https://www.unicode.org/versions/Unicode13.0.0/ch05.pdf#page=47. +// +// The path and value are expected to be normalized and validated if Relative is used. +// The path and value are expected to be normalized and absolute if Absolute is used. +func EqualsOrContainsPath(value string, path string, pathType PathType) bool { + curPath := path + var lastSeen string + for { + if strings.EqualFold(value, curPath) { + return true + } + curPath = Dir(curPath) + if lastSeen == curPath { + break + } + lastSeen = curPath + } + return false +} + +// MapHasEqualOrContainingPath returns true if the path matches any file or directory in the map. +// +// The path and keys in m are expected to be normalized and validated if Relative is used. +// The path and keys in m are expected to be normalized and absolute if Absolute is used. +// +// If the map is empty, returns false. +func MapHasEqualOrContainingPath(m map[string]struct{}, path string, pathType PathType) bool { + if len(m) == 0 { + return false + } + + for value := range m { + if EqualsOrContainsPath(value, path, pathType) { + return true + } + } + + return false +} + +// MapAllEqualOrContainingPathMap returns the paths in m that are equal to, or contain +// path, in a new map. +// +// The path and keys in m are expected to be normalized and validated if Relative is used. +// The path and keys in m are expected to be normalized and absolute if Absolute is used. +// +// If the map is empty, returns nil. +func MapAllEqualOrContainingPathMap(m map[string]struct{}, path string, pathType PathType) map[string]struct{} { + if len(m) == 0 { + return nil + } + + n := make(map[string]struct{}) + + for potentialMatch := range m { + if EqualsOrContainsPath(potentialMatch, path, pathType) { + n[potentialMatch] = struct{}{} + } + } + return n +} + +// Components splits the path into its components. +// +// This calls filepath.Split repeatedly. +// +// The path is expected to be normalized. +func Components(path string) []string { + var components []string + + if len(path) < 1 { + return []string{"."} + } + + dir := Unnormalize(path) + + volumeComponent := filepath.VolumeName(dir) + if len(volumeComponent) > 0 { + // On Windows the volume of an absolute path could be one of the following 3 forms + // c.f. https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN#fully-qualified-vs-relative-paths + // * A disk designator: `C:\` + // * A UNC Path: `\\servername\share\` + // c.f. https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dfsc/149a3039-98ce-491a-9268-2f5ddef08192 + // * A "current volume absolute path" `\` + // This refers to the root of the current volume + // + // We do not support paths with string parsing disabled such as + // `\\?\path` + // + // If we did extract a volume name, we need to add a path separator to turn it into + // a path component. Volume Names without path separators have an implied "current directory" + // when performing a join operation, or using them as a path directly, which is not the + // intention of `Split` so we ensure they always mean "the root of this volume". + volumeComponent = volumeComponent + stringOSPathSeparator + } + if len(volumeComponent) < 1 && dir[0] == os.PathSeparator { + // If we didn't extract a volume name then the path is either + // absolute and starts with an os.PathSeparator (it must be exactly 1 + // otherwise its a UNC path and we would have found a volume above) or it is relative. + // If it is absolute, we set the expected volume component to os.PathSeparator. + // otherwise we leave it as an empty string. + volumeComponent = stringOSPathSeparator + } + for { + var file string + dir, file = filepath.Split(dir) + // puts in reverse + components = append(components, file) + + if dir == volumeComponent { + if volumeComponent != "" { + components = append(components, dir) + } + break + } + + dir = strings.TrimSuffix(dir, stringOSPathSeparator) + } + + // https://github.com/golang/go/wiki/SliceTricks#reversing + for i := len(components)/2 - 1; i >= 0; i-- { + opp := len(components) - 1 - i + components[i], components[opp] = components[opp], components[i] + } + for i, component := range components { + components[i] = Normalize(component) + } + + return components +} diff --git a/pkg/bufman/pkg/normalpath/normalpath_windows_test.go b/pkg/bufman/pkg/normalpath/normalpath_windows_test.go new file mode 100644 index 000000000..f0af5f05b --- /dev/null +++ b/pkg/bufman/pkg/normalpath/normalpath_windows_test.go @@ -0,0 +1,532 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package normalpath + +import ( + "fmt" + "os" + "path/filepath" + "sort" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "github.com/stretchr/testify/assert" +) + +func TestNormalizeAndValidate(t *testing.T) { + t.Parallel() + path, err := NormalizeAndValidate("") + assert.NoError(t, err) + assert.Equal(t, ".", path) + path, err = NormalizeAndValidate(".") + assert.NoError(t, err) + assert.Equal(t, ".", path) + path, err = NormalizeAndValidate("./.") + assert.NoError(t, err) + assert.Equal(t, ".", path) + path, err = NormalizeAndValidate("./foo") + assert.NoError(t, err) + assert.Equal(t, "foo", path) + + // Drive letter path + _, err = NormalizeAndValidate("c:\\foo") + assert.Error(t, err) + + // Network Drive UNC path + _, err = NormalizeAndValidate("\\\\127.0.0.1\\$c\\") + assert.Error(t, err) + + // Absolute path on current drive + _, err = NormalizeAndValidate("\\root\\path") + assert.Error(t, err) + + _, err = NormalizeAndValidate("../foo") + assert.Error(t, err) +} + +func TestNormalize(t *testing.T) { + t.Parallel() + assert.Equal(t, ".", Normalize("")) + assert.Equal(t, ".", Normalize(".")) + assert.Equal(t, ".", Normalize(".\\.")) + assert.Equal(t, "foo", Normalize(".\\foo")) + assert.Equal(t, "../foo", Normalize("..\\foo")) + assert.Equal(t, "../Foo", Normalize("..\\Foo")) + assert.Equal(t, "foo", Normalize("foo\\")) + assert.Equal(t, "foo", Normalize(".\\foo\\")) + assert.Equal(t, "c:/foo", Normalize("c:\\foo")) + assert.Equal(t, "C:/foo", Normalize("C:\\foo\\")) + assert.Equal(t, "c:/foo/bar", Normalize("c:\\foo\\..\\foo\\bar\\")) + assert.Equal(t, "//127.0.0.1/$c/foo/bar", Normalize("\\\\127.0.0.1\\$c\\foo\\bar\\")) + assert.Equal(t, "c:/", Normalize("c:\\")) + assert.Equal(t, "//127.0.0.1/$c/", Normalize("\\\\127.0.0.1\\$c\\")) +} + +func TestUnnormalize(t *testing.T) { + t.Parallel() + assert.Equal(t, "", Unnormalize("")) + assert.Equal(t, ".", Unnormalize(".")) + assert.Equal(t, ".\\foo\\bar", Unnormalize("./foo/bar")) + assert.Equal(t, "c:\\foo\\bar", Unnormalize("c:/foo/bar")) + assert.Equal(t, "\\foo\\bar", Unnormalize("/foo/bar")) + assert.Equal(t, "\\\\127.0.0.1\\$c\\foo\\bar", Unnormalize("//127.0.0.1/$c/foo/bar")) +} + +func TestBase(t *testing.T) { + t.Parallel() + testBase(t, ".", ".") + testBase(t, ".", ".") + testBase(t, ".", "./.") + testBase(t, "foo", "./foo") + testBase(t, "bar", "./foo/bar") + testBase(t, "bar", "../foo/bar") + testBase(t, "foo", "/foo") + testBase(t, "bar", "/foo/bar") + testBase(t, "baz", "c:/foo/bar/baz") + testBase(t, "baz", "//127.0.0.1/$D/foo/bar/baz") + + // Base doesn't specify the input is normalized. + testBase(t, "bar", "c:\\foo\\bar") + testBase(t, "baz", "\\\\127.0.0.1\\$c\\foo\\bar\\baz") +} + +func testBase(t *testing.T, expected string, input string) { + assert.Equal(t, expected, Base(input)) +} + +func TestDir(t *testing.T) { + t.Parallel() + testDir(t, ".", "") + testDir(t, ".", ".") + testDir(t, "c:/", "c:\\") + testDir(t, ".", ".\\") + testDir(t, ".", ".\\.") + testDir(t, ".", "foo") + testDir(t, ".", ".\\foo") + testDir(t, "foo", ".\\foo\\bar") + testDir(t, "../foo", "..\\foo\\bar") + testDir(t, "../foo", "..\\foo\\bar\\..\\..") + testDir(t, "c:/foo", "c:\\foo\\bar") + testDir(t, "//127.0.0.1/$c/", "\\\\127.0.0.1\\$c\\foo") + testDir(t, "/foo", "\\foo\\bar") +} + +func testDir(t *testing.T, expected string, input string) { + assert.Equal(t, expected, Dir(input)) +} + +func TestExt(t *testing.T) { + t.Parallel() + testExt(t, "", "") + testExt(t, ".", ".") + testExt(t, ".txt", ".txt") + testExt(t, ".txt", ".js.txt") + testExt(t, "", "foo") + testExt(t, ".txt", "foo.txt") + testExt(t, ".txt", "foo.js.txt") + testExt(t, "", ".\\foo") + testExt(t, ".txt", ".\\foo.txt") + testExt(t, ".txt", ".\\foo.js.txt") + testExt(t, "", ".\\foo\\bar") + testExt(t, ".txt", ".\\foo\\bar.txt") + testExt(t, ".txt", ".\\foo\\bar.txt") + testExt(t, ".txt", ".\\foo\\bar.js.txt") + testExt(t, "", "..\\foo\\bar") + testExt(t, ".txt", "..\\foo\\bar.txt") + testExt(t, ".txt", "..\\foo\\bar.js.txt") + testExt(t, ".txt", "\\\\127.0.0.1\\$d\\foo.txt") + testExt(t, ".txt", "c:\\foo.txt") +} + +func testExt(t *testing.T, expected string, input string) { + assert.Equal(t, expected, Ext(input)) +} + +func TestJoin(t *testing.T) { + t.Parallel() + testJoin(t, "", "") + testJoin(t, "", "", "") + testJoin(t, ".", ".", ".") + testJoin(t, ".", "", ".", "") + testJoin(t, "foo/bar", "foo", ".\\bar") + testJoin(t, "foo", "foo", ".\\bar", "..") + testJoin(t, "c:/foo/bar", "c:\\", "foo", ".\\bar") + testJoin(t, "//127.0.0.1/$c/foo", "\\\\127.0.0.1\\$c\\", "foo", ".\\bar", "..") + testJoin(t, "bar", ".", "bar") + testJoin(t, "/foo/bar", "\\foo", ".", ".", ".", "baz", "..", "bar") +} + +func testJoin(t *testing.T, expected string, input ...string) { + assert.Equal(t, expected, Join(input...)) +} + +func TestRel(t *testing.T) { + t.Parallel() + testRel(t, ".", "", "") + testRel(t, ".", "", ".") + testRel(t, ".", ".", "") + testRel(t, ".", ".", ".") + testRel(t, ".", "foo", "foo") + testRel(t, "foo", ".", "foo") + testRel(t, "foo", ".", "./foo") + testRel(t, "foo/bar", ".", "foo/bar") + testRel(t, "bar", "c:\\foo", "c:\\foo\\bar") + testRel(t, "bar", "foo", "foo/bar") + testRel(t, "baz", "c:\\foo/./bar", "c:\\foo\\bar\\baz") + testRel(t, "baz", "foo/./bar", "foo/bar/baz") + + // This would require querying the current directory to know what + // Drive `\` refers to. + testRelError(t, "", "\\foo\\bar", "c:\\foo\\bar") + + testRelError(t, "", "..", "foo/bar") + testRelError(t, "", "c:\\foo", "d:\\bar") + testRelError(t, "", "\\\\127.0.0.1\\$c\\foo", "\\\\127.0.0.1\\$d\\foo") +} + +func testRel(t *testing.T, expected string, basepath string, targpath string) { + rel, err := Rel(basepath, targpath) + assert.NoError(t, err) + assert.Equal(t, expected, rel) +} + +func testRelError(t *testing.T, expected string, basepath string, targpath string) { + if os.PathSeparator == '/' { + rel, err := filepath.Rel(basepath, targpath) + assert.Error(t, err) + assert.Equal(t, expected, rel) + } + rel, err := Rel(basepath, targpath) + assert.Error(t, err) + assert.Equal(t, expected, rel) +} + +func TestComponents(t *testing.T) { + t.Parallel() + testComponents(t, "", ".") + testComponents(t, ".", ".") + testComponents(t, "foo", "foo") + testComponents(t, "foo/bar", "foo", "bar") + testComponents(t, "foo/bar/../baz", "foo", "bar", "..", "baz") + testComponents(t, "c:/foo/bar", "c:/", "foo", "bar") + testComponents(t, "//127.0.0.1/$c/foo/bar", "//127.0.0.1/$c/", "foo", "bar") + testComponents(t, "./foo/bar", ".", "foo", "bar") + testComponents(t, "../foo/bar", "..", "foo", "bar") + testComponents(t, "/foo/bar", "/", "foo", "bar") +} + +func testComponents(t *testing.T, path string, expected ...string) { + assert.Equal(t, expected, Components(path)) +} + +func TestStripComponents(t *testing.T) { + t.Parallel() + testStripComponents(t, 0, "", true, "") + testStripComponents(t, 0, "foo", true, "foo") + testStripComponents(t, 0, "foo", true, "foo") + testStripComponents(t, 1, "", false, "foo") + testStripComponents(t, 1, "bar", true, "foo/bar") + testStripComponents(t, 1, "bar/baz", true, "foo/bar/baz") + testStripComponents(t, 2, "baz", true, "foo/bar/baz") + testStripComponents(t, 1, "bar/baz/BAT", true, "foo/bar/baz/BAT") + testStripComponents(t, 2, "baz/BAT", true, "foo/bar/baz/BAT") + testStripComponents(t, 3, "BAT", true, "foo/bar/baz/BAT") + testStripComponents(t, 4, "", false, "foo/bar/baz/BAT") + testStripComponents(t, 5, "", false, "foo/bar/baz/BAT") + + // Volume names contain separators but they are a single component + testStripComponents(t, 1, "foo", true, "//127.0.0.1/$c/foo") + testStripComponents(t, 2, "", false, "//127.0.0.1/$c/foo") + testStripComponents(t, 1, "foo", true, "c:/foo") + testStripComponents(t, 2, "", false, "c:/foo") +} + +func testStripComponents(t *testing.T, count int, expected string, expectedOK bool, path string) { + actual, ok := StripComponents(path, uint32(count)) + assert.Equal(t, expectedOK, ok) + assert.Equal(t, expected, actual) +} + +func TestByDir(t *testing.T) { + t.Parallel() + assert.Equal( + t, + map[string][]string{ + "one": { + "one/1.txt", + "one/2.txt", + "one/3.txt", + }, + "two": { + "two/1.txt", + "two/2.txt", + "two/3.txt", + }, + }, + ByDir( + "one/2.txt", + "one/1.txt", + "two/2.txt", + "one/3.txt", + "two/1.txt", + "two/3.txt", + ), + ) + assert.Equal( + t, + map[string][]string{ + ".": { + "1.txt", + "2.txt", + "3.txt", + }, + "two": { + "two/1.txt", + "two/2.txt", + "two/3.txt", + }, + }, + ByDir( + "2.txt", + "1.txt", + "3.txt", + "two/3.txt", + "two/2.txt", + "two/1.txt", + ), + ) +} + +func TestContainsPath(t *testing.T) { + testContainsPath(t, false, "a.proto", "a.proto") + testContainsPath(t, true, ".", "a.proto") + testContainsPath(t, false, "a.proto", ".") + testContainsPath(t, false, ".", ".") + testContainsPath(t, true, ".", "a/b.proto") + testContainsPath(t, true, ".", "a/b") + testContainsPath(t, false, "a", "ab/c") + testContainsPath(t, true, "a", "a/b/c") + testContainsPath(t, false, "b", "a/b/c") + testContainsPath(t, true, "b", "b/b/c") + testContainsPath(t, true, "b", "b/a/c") +} + +func testContainsPath(t *testing.T, expected bool, value string, path string) { + assert.Equal(t, expected, ContainsPath(value, path, Relative), fmt.Sprintf("%s %s", value, path)) +} + +func TestEqualsOrContainsPath(t *testing.T) { + testEqualsOrContainsPath(t, true, "a.proto", "a.proto") + testEqualsOrContainsPath(t, true, ".", "a.proto") + testEqualsOrContainsPath(t, false, "a.proto", ".") + testEqualsOrContainsPath(t, true, ".", "a/b.proto") + testEqualsOrContainsPath(t, true, ".", "a/b") + testEqualsOrContainsPath(t, false, "a", "ab/c") + testEqualsOrContainsPath(t, true, "a", "a/b/c") + testEqualsOrContainsPath(t, false, "b", "a/b/c") + testEqualsOrContainsPath(t, true, "b", "b/b/c") + testEqualsOrContainsPath(t, true, "b", "b/a/c") +} + +func testEqualsOrContainsPath(t *testing.T, expected bool, value string, path string) { + assert.Equal(t, expected, EqualsOrContainsPath(value, path, Relative), fmt.Sprintf("%s %s", value, path)) +} + +func TestMapHasEqualOrContainingPath(t *testing.T) { + testMapHasEqualOrContainingPath(t, true, "a.proto", "a.proto") + testMapHasEqualOrContainingPath(t, false, ".", "a.proto") + testMapHasEqualOrContainingPath(t, true, "a.proto", ".") + testMapHasEqualOrContainingPath(t, true, "a/b.proto", ".") + testMapHasEqualOrContainingPath(t, true, "a/b", ".") + testMapHasEqualOrContainingPath(t, false, "ab/c", "a", "b") + testMapHasEqualOrContainingPath(t, true, "a/b/c", "a", "b") + testMapHasEqualOrContainingPath(t, false, "a/b/c", "b") + testMapHasEqualOrContainingPath(t, true, "b/b/c", "b") + testMapHasEqualOrContainingPath(t, true, "b/a/c", "b") + testMapHasEqualOrContainingPath(t, true, "b/b/c", "b", ".") +} + +func testMapHasEqualOrContainingPath(t *testing.T, expected bool, path string, keys ...string) { + keyMap := stringutil.SliceToMap(keys) + assert.Equal(t, expected, MapHasEqualOrContainingPath(keyMap, path, Relative), fmt.Sprintf("%s %v", path, keys)) +} + +func TestMapAllEqualOrContainingPaths(t *testing.T) { + testMapAllEqualOrContainingPaths(t, []string{"a.proto"}, "a.proto", "a.proto") + testMapAllEqualOrContainingPaths(t, nil, ".", "a.proto") + testMapAllEqualOrContainingPaths(t, []string{"."}, "a.proto", ".") + testMapAllEqualOrContainingPaths(t, []string{"."}, "a/b.proto", ".") + testMapAllEqualOrContainingPaths(t, []string{"."}, "a/b", ".") + testMapAllEqualOrContainingPaths(t, nil, "ab/c", "a", "b") + testMapAllEqualOrContainingPaths(t, []string{"a"}, "a/b/c", "a", "b") + testMapAllEqualOrContainingPaths(t, nil, "a/b/c", "b") + testMapAllEqualOrContainingPaths(t, []string{"b"}, "b/b/c", "b") + testMapAllEqualOrContainingPaths(t, []string{"b"}, "b/a/c", "b") + testMapAllEqualOrContainingPaths(t, []string{"b", "."}, "b/b/c", "b", ".") + testMapAllEqualOrContainingPaths(t, []string{"b", "b/b", "."}, "b/b/c", "b", "b/b", ".") +} + +func testMapAllEqualOrContainingPaths(t *testing.T, expected []string, path string, keys ...string) { + if expected == nil { + expected = make([]string, 0) + } + sort.Strings(expected) + keyMap := stringutil.SliceToMap(keys) + assert.Equal(t, expected, MapAllEqualOrContainingPaths(keyMap, path, Relative), fmt.Sprintf("%s %v", path, keys)) +} + +func TestContainsPathAbs(t *testing.T) { + testContainsPathAbs(t, false, "/a.proto", "/a.proto") + testContainsPathAbs(t, true, "/", "/a.proto") + testContainsPathAbs(t, false, "/a.proto", "/") + testContainsPathAbs(t, false, "/", "/") + testContainsPathAbs(t, true, "/", "/a/b.proto") + testContainsPathAbs(t, true, "/", "/a/b") + testContainsPathAbs(t, false, "/a", "/ab/c") + testContainsPathAbs(t, true, "/a", "/a/b/c") + testContainsPathAbs(t, false, "/b", "/a/b/c") + testContainsPathAbs(t, true, "/b", "/b/b/c") + testContainsPathAbs(t, true, "/b", "/b/a/c") + + testContainsPathAbs(t, true, "c:/", "c:/a.proto") + testContainsPathAbs(t, false, "c:/", "c:/") + testContainsPathAbs(t, false, "c:/", "d:/") + // Can't be known without knowing current directory to detect drive + testContainsPathAbs(t, false, "c:/", "/") + + testContainsPathAbs(t, true, "//127.0.0.1/$c/", "//127.0.0.1/$c/a.proto") + testContainsPathAbs(t, false, "//127.0.0.1/$c/", "//127.0.0.1/$c/") + testContainsPathAbs(t, false, "//127.0.0.1/$c/", "//127.0.0.1/$d/a.proto") + // Can't be known without knowing current directory to detect drive + testContainsPathAbs(t, false, "//127.0.0.1/$c/", "/") +} + +func testContainsPathAbs(t *testing.T, expected bool, value string, path string) { + assert.Equal(t, expected, ContainsPath(value, path, Absolute), fmt.Sprintf("%s %s", value, path)) +} + +func TestEqualsOrContainsPathAbs(t *testing.T) { + testEqualsOrContainsPathAbs(t, true, "/a.proto", "/a.proto") + testEqualsOrContainsPathAbs(t, true, "/", "/a.proto") + testEqualsOrContainsPathAbs(t, false, "a.proto", "/") + testEqualsOrContainsPathAbs(t, true, "/", "/a/b.proto") + testEqualsOrContainsPathAbs(t, true, "/", "/a/b") + testEqualsOrContainsPathAbs(t, false, "/a", "/ab/c") + testEqualsOrContainsPathAbs(t, true, "/a", "/a/b/c") + testEqualsOrContainsPathAbs(t, false, "/b", "/a/b/c") + testEqualsOrContainsPathAbs(t, true, "/b", "/b/b/c") + testEqualsOrContainsPathAbs(t, true, "/b", "/b/a/c") + + testEqualsOrContainsPathAbs(t, true, "c:/", "c:/a.proto") + testEqualsOrContainsPathAbs(t, true, "c:/", "c:/") + testEqualsOrContainsPathAbs(t, false, "c:/", "d:/") + // Can't be known without knowing current directory to detect drive + testEqualsOrContainsPathAbs(t, false, "c:/", "/") + + testEqualsOrContainsPathAbs(t, true, "//127.0.0.1/$c/", "//127.0.0.1/$c/a.proto") + testEqualsOrContainsPathAbs(t, true, "//127.0.0.1/$c/", "//127.0.0.1/$c/") + testEqualsOrContainsPathAbs(t, false, "//127.0.0.1/$c/", "//127.0.0.1/$d/a.proto") + // Can't be known without knowing current directory to detect drive + testEqualsOrContainsPathAbs(t, false, "//127.0.0.1/$c/", "/") + + // Case Folding tests + // c.f. https://www.unicode.org/versions/Unicode13.0.0/ch05.pdf#page=44 + // We are not trying to test all code point folding, only a few specific + // cases. We defer to the golang implementation of case folding and retesting + // that is not a goal. + + // \u212a is the kelvin symbol (K) which looks like a capital K + // The capital K is the kelvin symbol U+212A + testEqualsOrContainsPathAbs(t, true, "c:/k", "c:/\u212a") + + // In Turkish, a lower case i maps to a capital I with a dot (İ) U+0130 + // a lower case i with no dot ı U+0131 maps to a capital I + // In all other languages a lower case i maps to a capital I + // We explicitly do not support this special case (its 2 codepoints total) as + // it is locale dependent. + testEqualsOrContainsPathAbs(t, true, "c:/i", "c:/I") + // TODO: The Go stdlib unicode tables seem to fold \u0131 to \u0131 which + // doesn't seem spec compliant, but not important enough right now to warrant + // further research, or further complicating this module. + testEqualsOrContainsPathAbs(t, false, "c:/\u0131", "c:/I") + testEqualsOrContainsPathAbs(t, false, "c:/i", "c:/\u0130") +} + +func testEqualsOrContainsPathAbs(t *testing.T, expected bool, value string, path string) { + assert.Equal(t, expected, EqualsOrContainsPath(value, path, Absolute), fmt.Sprintf("%s %s", value, path)) +} + +func TestMapHasEqualOrContainingPathAbs(t *testing.T) { + testMapHasEqualOrContainingPathAbs(t, true, "/a.proto", "/a.proto") + testMapHasEqualOrContainingPathAbs(t, false, "/", "/a.proto") + testMapHasEqualOrContainingPathAbs(t, true, "/a.proto", "/") + testMapHasEqualOrContainingPathAbs(t, true, "/a/b.proto", "/") + testMapHasEqualOrContainingPathAbs(t, true, "/a/b", "/") + testMapHasEqualOrContainingPathAbs(t, false, "/ab/c", "/a", "/b") + testMapHasEqualOrContainingPathAbs(t, true, "/a/b/c", "/a", "/b") + testMapHasEqualOrContainingPathAbs(t, false, "/a/b/c", "/b") + testMapHasEqualOrContainingPathAbs(t, true, "/b/b/c", "/b") + testMapHasEqualOrContainingPathAbs(t, true, "/b/a/c", "/b") + testMapHasEqualOrContainingPathAbs(t, true, "/b/b/c", "/b", "/") + + testMapHasEqualOrContainingPathAbs(t, true, "c:/a.proto", "d:/", "c:/") + testMapHasEqualOrContainingPathAbs(t, false, "c:/", "d:/", "c:/a.proto") + // Can't be known without knowing current directory + testMapHasEqualOrContainingPathAbs(t, false, "c:/", "/") + + testMapHasEqualOrContainingPathAbs(t, true, "//127.0.0.1/$c/a.proto", "d:/", "//127.0.0.1/$c/") + testMapHasEqualOrContainingPathAbs(t, false, "//127.0.0.1/$c/", "d:/", "//127.0.0.1/$c/a.proto") + // Can't be known without knowing current directory + testMapHasEqualOrContainingPathAbs(t, false, "//127.0.0.1/$c/", "/") +} + +func testMapHasEqualOrContainingPathAbs(t *testing.T, expected bool, path string, keys ...string) { + keyMap := stringutil.SliceToMap(keys) + assert.Equal(t, expected, MapHasEqualOrContainingPath(keyMap, path, Absolute), fmt.Sprintf("%s %v", path, keys)) +} + +func TestMapAllEqualOrContainingPathsAbs(t *testing.T) { + testMapAllEqualOrContainingPathsAbs(t, []string{"/a.proto"}, "/a.proto", "/a.proto") + testMapAllEqualOrContainingPathsAbs(t, nil, "/", "/a.proto") + testMapAllEqualOrContainingPathsAbs(t, []string{"/"}, "/a.proto", "/") + testMapAllEqualOrContainingPathsAbs(t, []string{"/"}, "/a/b.proto", "/") + testMapAllEqualOrContainingPathsAbs(t, []string{"/"}, "/a/b", "/") + testMapAllEqualOrContainingPathsAbs(t, nil, "/ab/c", "/a", "/b") + testMapAllEqualOrContainingPathsAbs(t, []string{"/a"}, "/a/b/c", "/a", "/b") + testMapAllEqualOrContainingPathsAbs(t, nil, "/a/b/c", "/b") + testMapAllEqualOrContainingPathsAbs(t, []string{"/b"}, "/b/b/c", "/b") + testMapAllEqualOrContainingPathsAbs(t, []string{"/b"}, "/b/a/c", "/b") + testMapAllEqualOrContainingPathsAbs(t, []string{"/b", "/"}, "/b/b/c", "/b", "/") + testMapAllEqualOrContainingPathsAbs(t, []string{"/b", "/b/b", "/"}, "/b/b/c", "/b", "/b/b", "/") + + testMapAllEqualOrContainingPathsAbs(t, []string{"c:/"}, "c:/a.proto", "d:/", "c:/", "/") + testMapAllEqualOrContainingPathsAbs(t, nil, "c:/", "d:/", "c:/a.proto") + + testMapAllEqualOrContainingPathsAbs(t, []string{"//127.0.0.1/$c/"}, "//127.0.0.1/$c/a.proto", "d:/", "//127.0.0.1/$c/", "//127.0.0.1/$d/", "/") + testMapAllEqualOrContainingPathsAbs(t, nil, "//127.0.0.1/$c/", "d:/", "//127.0.0.1/$c/a.proto") +} + +func testMapAllEqualOrContainingPathsAbs(t *testing.T, expected []string, path string, keys ...string) { + if expected == nil { + expected = make([]string, 0) + } + sort.Strings(expected) + keyMap := stringutil.SliceToMap(keys) + assert.Equal(t, expected, MapAllEqualOrContainingPaths(keyMap, path, Absolute), fmt.Sprintf("%s %v", path, keys)) +} diff --git a/pkg/bufman/pkg/observabilityzap/observabilityzap.go b/pkg/bufman/pkg/observabilityzap/observabilityzap.go new file mode 100644 index 000000000..40bcbcc68 --- /dev/null +++ b/pkg/bufman/pkg/observabilityzap/observabilityzap.go @@ -0,0 +1,46 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package observabilityzap + +import ( + "io" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/propagation" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/trace" + "go.uber.org/zap" +) + +// TracerProviderCloser is used to wrap a trace.TracerProvider with an io.Closer to use on shutdown. +type TracerProviderCloser interface { + trace.TracerProvider + io.Closer +} + +// Start creates a Zap logging exporter for Opentelemetry traces and returns +// the exporter. The exporter implements io.Closer for clean-up. +func Start(logger *zap.Logger) TracerProviderCloser { + exporter := newZapExporter(logger) + tracerProviderOptions := []sdktrace.TracerProviderOption{ + sdktrace.WithSampler(sdktrace.AlwaysSample()), + sdktrace.WithSpanProcessor(sdktrace.NewBatchSpanProcessor(exporter)), + } + tracerProvider := newTracerProviderCloser(sdktrace.NewTracerProvider(tracerProviderOptions...)) + otel.SetTracerProvider(tracerProvider) + otel.SetTextMapPropagator(propagation.TraceContext{}) + return tracerProvider +} diff --git a/pkg/bufman/pkg/observabilityzap/tracer_provider_closer.go b/pkg/bufman/pkg/observabilityzap/tracer_provider_closer.go new file mode 100644 index 000000000..629a0a7d1 --- /dev/null +++ b/pkg/bufman/pkg/observabilityzap/tracer_provider_closer.go @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package observabilityzap + +import ( + "context" + "io" + + sdktrace "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/trace" +) + +var ( + _ trace.TracerProvider = &tracerProviderCloser{} + _ io.Closer = &tracerProviderCloser{} +) + +type tracerProviderCloser struct { + tracerProvider *sdktrace.TracerProvider +} + +func newTracerProviderCloser(tracerProvider *sdktrace.TracerProvider) *tracerProviderCloser { + return &tracerProviderCloser{ + tracerProvider: tracerProvider, + } +} + +func (t *tracerProviderCloser) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + return t.tracerProvider.Tracer(name, opts...) +} + +func (t *tracerProviderCloser) Close() error { + return t.tracerProvider.Shutdown(context.Background()) +} diff --git a/pkg/bufman/pkg/observabilityzap/zapexporter.go b/pkg/bufman/pkg/observabilityzap/zapexporter.go new file mode 100644 index 000000000..d7564b4e6 --- /dev/null +++ b/pkg/bufman/pkg/observabilityzap/zapexporter.go @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package observabilityzap + +import ( + "context" + + "go.opentelemetry.io/otel/sdk/trace" + "go.uber.org/zap" +) + +var _ trace.SpanExporter = &zapExporter{} + +type zapExporter struct { + logger *zap.Logger +} + +func newZapExporter(logger *zap.Logger) *zapExporter { + return &zapExporter{ + logger: logger, + } +} + +func (z *zapExporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { + for _, span := range spans { + if !span.SpanContext().IsSampled() { + continue + } + if checkedEntry := z.logger.Sugar().Check(zap.DebugLevel, span.Name()); checkedEntry != nil { + fields := []zap.Field{ + zap.Duration("duration", span.EndTime().Sub(span.StartTime())), + } + for _, attribute := range span.Attributes() { + fields = append(fields, zap.Any(string(attribute.Key), attribute.Value.AsInterface())) + } + checkedEntry.Write(fields...) + } + } + return nil +} + +func (z *zapExporter) Shutdown(ctx context.Context) error { + return nil +} diff --git a/pkg/bufman/pkg/osextended/osextended.go b/pkg/bufman/pkg/osextended/osextended.go new file mode 100644 index 000000000..92ef2c0f2 --- /dev/null +++ b/pkg/bufman/pkg/osextended/osextended.go @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package osextended provides os utilities. +package osextended + +import ( + "errors" + "os" + "sync" +) + +var ( + workDirPath string + workDirPathErr error + once sync.Once + + errOSGetwdEmpty = errors.New("os.Getwd returned empty and no error") +) + +// Getwd replaces os.Getwd and caches the result. +func Getwd() (string, error) { + once.Do(func() { + workDirPath, workDirPathErr = getwdUncached() + }) + return workDirPath, workDirPathErr +} + +func getwdUncached() (string, error) { + currentWorkDirPath, currentWorkDirPathErr := os.Getwd() + if currentWorkDirPath == "" && currentWorkDirPathErr == nil { + return "", errOSGetwdEmpty + } + return currentWorkDirPath, currentWorkDirPathErr +} diff --git a/pkg/bufman/pkg/protodescriptor/protodescriptor.go b/pkg/bufman/pkg/protodescriptor/protodescriptor.go new file mode 100644 index 000000000..7cfe0cd37 --- /dev/null +++ b/pkg/bufman/pkg/protodescriptor/protodescriptor.go @@ -0,0 +1,289 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protodescriptor + +import ( + "errors" + "fmt" + "strconv" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +// FileDescriptor is an interface that matches the methods on a *descriptorpb.FileDescriptorProto. +// +// Note that a FileDescriptor is not necessarily validated, unlike other interfaces in buf. +type FileDescriptor interface { + proto.Message + GetName() string + GetPackage() string + GetDependency() []string + GetPublicDependency() []int32 + GetWeakDependency() []int32 + GetMessageType() []*descriptorpb.DescriptorProto + GetEnumType() []*descriptorpb.EnumDescriptorProto + GetService() []*descriptorpb.ServiceDescriptorProto + GetExtension() []*descriptorpb.FieldDescriptorProto + GetOptions() *descriptorpb.FileOptions + GetSourceCodeInfo() *descriptorpb.SourceCodeInfo + GetSyntax() string + GetEdition() string +} + +// FileDescriptorsForFileDescriptorProtos is a convenience function since Go does not have generics. +func FileDescriptorsForFileDescriptorProtos(fileDescriptorProtos ...*descriptorpb.FileDescriptorProto) []FileDescriptor { + fileDescriptors := make([]FileDescriptor, len(fileDescriptorProtos)) + for i, fileDescriptorProto := range fileDescriptorProtos { + fileDescriptors[i] = fileDescriptorProto + } + return fileDescriptors +} + +// FileDescriptorsForFileDescriptorSet is a convenience function since Go does not have generics. +func FileDescriptorsForFileDescriptorSet(fileDescriptorSet *descriptorpb.FileDescriptorSet) []FileDescriptor { + return FileDescriptorsForFileDescriptorProtos(fileDescriptorSet.File...) +} + +// FileDescriptorProtoForFileDescriptor creates a new *descriptorpb.FileDescriptorProto for the fileDescriptor. +// +// If the FileDescriptor is already a *descriptorpb.FileDescriptorProto, this returns the input value. +// +// Note that this will not round trip exactly. If a *descriptorpb.FileDescriptorProto is turned into another +// object that is a FileDescriptor, and then passed to this function, the return value will not be equal +// if name, package, or syntax are set but empty. Instead, the return value will have these values unset. +// For our/most purposes, this is fine. +func FileDescriptorProtoForFileDescriptor(fileDescriptor FileDescriptor) *descriptorpb.FileDescriptorProto { + if fileDescriptorProto, ok := fileDescriptor.(*descriptorpb.FileDescriptorProto); ok { + return fileDescriptorProto + } + fileDescriptorProto := &descriptorpb.FileDescriptorProto{ + Dependency: fileDescriptor.GetDependency(), + PublicDependency: fileDescriptor.GetPublicDependency(), + WeakDependency: fileDescriptor.GetWeakDependency(), + MessageType: fileDescriptor.GetMessageType(), + EnumType: fileDescriptor.GetEnumType(), + Service: fileDescriptor.GetService(), + Extension: fileDescriptor.GetExtension(), + Options: fileDescriptor.GetOptions(), + SourceCodeInfo: fileDescriptor.GetSourceCodeInfo(), + } + // Note that if a *descriptorpb.FileDescriptorProto has a set but empty name, package, + // or syntax, this won't be an exact round trip. But for our use, we say this is fine. + if name := fileDescriptor.GetName(); name != "" { + fileDescriptorProto.Name = proto.String(name) + } + if pkg := fileDescriptor.GetPackage(); pkg != "" { + fileDescriptorProto.Package = proto.String(pkg) + } + if syntax := fileDescriptor.GetSyntax(); syntax != "" { + fileDescriptorProto.Syntax = proto.String(syntax) + } + if edition := fileDescriptor.GetEdition(); edition != "" { + fileDescriptorProto.Edition = proto.String(edition) + } + fileDescriptorProto.ProtoReflect().SetUnknown(fileDescriptor.ProtoReflect().GetUnknown()) + return fileDescriptorProto +} + +// FileDescriptorProtosForFileDescriptors is a convenience function since Go does not have generics. +// +// Note that this will not round trip exactly. If a *descriptorpb.FileDescriptorProto is turned into another +// object that is a FileDescriptor, and then passed to this function, the return value will not be equal +// if name, package, or syntax are set but empty. Instead, the return value will have these values unset. +// For our/most purposes, this is fine. +func FileDescriptorProtosForFileDescriptors(fileDescriptors ...FileDescriptor) []*descriptorpb.FileDescriptorProto { + fileDescriptorProtos := make([]*descriptorpb.FileDescriptorProto, len(fileDescriptors)) + for i, fileDescriptor := range fileDescriptors { + fileDescriptorProtos[i] = FileDescriptorProtoForFileDescriptor(fileDescriptor) + } + return fileDescriptorProtos +} + +// FileDescriptorSetForFileDescriptors returns a new *descriptorpb.FileDescriptorSet for the given FileDescriptors. +// +// Note that this will not round trip exactly. If a *descriptorpb.FileDescriptorProto is turned into another +// object that is a FileDescriptor, and then passed to this function, the return value will not be equal +// if name, package, or syntax are set but empty. Instead, the return value will have these values unset. +// For our/most purposes, this is fine. +func FileDescriptorSetForFileDescriptors(fileDescriptors ...FileDescriptor) *descriptorpb.FileDescriptorSet { + return &descriptorpb.FileDescriptorSet{ + File: FileDescriptorProtosForFileDescriptors(fileDescriptors...), + } +} + +// ValidateFileDescriptor validates the FileDescriptor. +// +// A *descriptorpb.FileDescriptorProto can be passed to this. +func ValidateFileDescriptor(fileDescriptor FileDescriptor) error { + if fileDescriptor == nil { + return errors.New("nil FileDescriptor") + } + if err := ValidateProtoPath("FileDescriptor.Name", fileDescriptor.GetName()); err != nil { + return err + } + if err := ValidateProtoPaths("FileDescriptor.Dependency", fileDescriptor.GetDependency()); err != nil { + return err + } + return nil +} + +// ValidateCodeGeneratorRequest validates the CodeGeneratorRequest. +func ValidateCodeGeneratorRequest(request *pluginpb.CodeGeneratorRequest) error { + if err := ValidateCodeGeneratorRequestExceptFileDescriptorProtos(request); err != nil { + return err + } + for _, fileDescriptorProto := range request.ProtoFile { + if err := ValidateFileDescriptor(fileDescriptorProto); err != nil { + return err + } + } + return nil +} + +// ValidateCodeGeneratorRequestExceptFileDescriptorProtos validates the CodeGeneratorRequest +// minus the FileDescriptorProtos. +func ValidateCodeGeneratorRequestExceptFileDescriptorProtos(request *pluginpb.CodeGeneratorRequest) error { + if request == nil { + return errors.New("nil CodeGeneratorRequest") + } + if len(request.ProtoFile) == 0 { + return errors.New("empty CodeGeneratorRequest.ProtoFile") + } + if len(request.FileToGenerate) == 0 { + return errors.New("empty CodeGeneratorRequest.FileToGenerate") + } + if err := ValidateProtoPaths("CodeGeneratorRequest.FileToGenerate", request.FileToGenerate); err != nil { + return err + } + return nil +} + +// ValidateCodeGeneratorResponse validates the CodeGeneratorResponse. +// +// This validates that names are set. +// +// It is actually OK per the plugin.proto specs to not have the name set, and +// if this is empty, the content should be combined with the previous file. +// However, for our handlers, we do not support this, and for our +// binary handlers, we combine CodeGeneratorResponse.File contents. +// +// https://github.com/protocolbuffers/protobuf/blob/b99994d994e399174fe688a5efbcb6d91f36952a/src/google/protobuf/compiler/plugin.proto#L127 +func ValidateCodeGeneratorResponse(response *pluginpb.CodeGeneratorResponse) error { + if response == nil { + return errors.New("nil CodeGeneratorResponse") + } + for _, file := range response.File { + if file.GetName() == "" { + return errors.New("empty CodeGeneratorResponse.File.Name") + } + } + return nil +} + +// ValidateProtoPath validates the proto path. +// +// This checks that the path is normalized and ends in .proto. +func ValidateProtoPath(name string, path string) error { + if path == "" { + return fmt.Errorf("%s is empty", name) + } + normalized, err := normalpath.NormalizeAndValidate(path) + if err != nil { + return fmt.Errorf("%s had normalization error: %w", name, err) + } + if path != normalized { + return fmt.Errorf("%s %s was not normalized to %s", name, path, normalized) + } + if normalpath.Ext(path) != ".proto" { + return fmt.Errorf("%s %s does not have a .proto extension", name, path) + } + return nil +} + +// ValidateProtoPaths validates the proto paths. +// +// This checks that the paths are normalized and end in .proto. +func ValidateProtoPaths(name string, paths []string) error { + for _, path := range paths { + if err := ValidateProtoPath(name, path); err != nil { + return err + } + } + return nil +} + +// FieldDescriptorProtoTypePrettyString prints a pretty string +// representation of the FieldDescriptorProto_Type. +func FieldDescriptorProtoTypePrettyString(t descriptorpb.FieldDescriptorProto_Type) string { + switch t { + case descriptorpb.FieldDescriptorProto_TYPE_DOUBLE: + return "double" + case descriptorpb.FieldDescriptorProto_TYPE_FLOAT: + return "float" + case descriptorpb.FieldDescriptorProto_TYPE_INT64: + return "int64" + case descriptorpb.FieldDescriptorProto_TYPE_UINT64: + return "uint64" + case descriptorpb.FieldDescriptorProto_TYPE_INT32: + return "int32" + case descriptorpb.FieldDescriptorProto_TYPE_FIXED64: + return "fixed64" + case descriptorpb.FieldDescriptorProto_TYPE_FIXED32: + return "fixed32" + case descriptorpb.FieldDescriptorProto_TYPE_BOOL: + return "bool" + case descriptorpb.FieldDescriptorProto_TYPE_STRING: + return "string" + case descriptorpb.FieldDescriptorProto_TYPE_GROUP: + return "group" + case descriptorpb.FieldDescriptorProto_TYPE_MESSAGE: + return "message" + case descriptorpb.FieldDescriptorProto_TYPE_BYTES: + return "bytes" + case descriptorpb.FieldDescriptorProto_TYPE_UINT32: + return "uint32" + case descriptorpb.FieldDescriptorProto_TYPE_ENUM: + return "enum" + case descriptorpb.FieldDescriptorProto_TYPE_SFIXED32: + return "sfixed32" + case descriptorpb.FieldDescriptorProto_TYPE_SFIXED64: + return "sfixed64" + case descriptorpb.FieldDescriptorProto_TYPE_SINT32: + return "sint32" + case descriptorpb.FieldDescriptorProto_TYPE_SINT64: + return "sint64" + default: + return strconv.Itoa(int(t)) + } +} + +// FieldDescriptorProtoLabelPrettyString prints a pretty string +// representation of the FieldDescriptorProto_Label. +func FieldDescriptorProtoLabelPrettyString(l descriptorpb.FieldDescriptorProto_Label) string { + switch l { + case descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL: + return "optional" + case descriptorpb.FieldDescriptorProto_LABEL_REQUIRED: + return "required" + case descriptorpb.FieldDescriptorProto_LABEL_REPEATED: + return "repeated" + default: + return strconv.Itoa(int(l)) + } +} diff --git a/pkg/bufman/pkg/protoencoding/json_marshaler.go b/pkg/bufman/pkg/protoencoding/json_marshaler.go new file mode 100644 index 000000000..b48ff83d1 --- /dev/null +++ b/pkg/bufman/pkg/protoencoding/json_marshaler.go @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoencoding + +import ( + "bytes" + "encoding/json" + + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" +) + +type jsonMarshaler struct { + resolver Resolver + indent string + useProtoNames bool + emitUnpopulated bool +} + +func newJSONMarshaler(resolver Resolver, options ...JSONMarshalerOption) Marshaler { + jsonMarshaler := &jsonMarshaler{ + resolver: resolver, + } + for _, option := range options { + option(jsonMarshaler) + } + return jsonMarshaler +} + +func (m *jsonMarshaler) Marshal(message proto.Message) ([]byte, error) { + if err := ReparseUnrecognized(m.resolver, message.ProtoReflect()); err != nil { + return nil, err + } + options := protojson.MarshalOptions{ + Resolver: m.resolver, + UseProtoNames: m.useProtoNames, + EmitUnpopulated: m.emitUnpopulated, + } + data, err := options.Marshal(message) + if err != nil { + return nil, err + } + // This is needed due to the instability of protojson output. + // + // https://github.com/golang/protobuf/issues/1121 + // https://go-review.googlesource.com/c/protobuf/+/151340 + // https://developers.google.com/protocol-buffers/docs/reference/go/faq#unstable-json + // + // We may need to do a full encoding/json encode/decode in the future if protojson + // produces non-deterministic output. + buffer := bytes.NewBuffer(nil) + if m.indent != "" { + if err := json.Indent(buffer, data, "", m.indent); err != nil { + return nil, err + } + } else { + if err := json.Compact(buffer, data); err != nil { + return nil, err + } + } + return buffer.Bytes(), nil +} diff --git a/pkg/bufman/pkg/protoencoding/json_unmarshaler.go b/pkg/bufman/pkg/protoencoding/json_unmarshaler.go new file mode 100644 index 000000000..ae0130ef4 --- /dev/null +++ b/pkg/bufman/pkg/protoencoding/json_unmarshaler.go @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoencoding + +import ( + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" +) + +type jsonUnmarshaler struct { + resolver Resolver +} + +func newJSONUnmarshaler(resolver Resolver) Unmarshaler { + return &jsonUnmarshaler{ + resolver: resolver, + } +} + +func (m *jsonUnmarshaler) Unmarshal(data []byte, message proto.Message) error { + options := protojson.UnmarshalOptions{ + Resolver: m.resolver, + // TODO: make this an option + DiscardUnknown: true, + } + return options.Unmarshal(data, message) +} diff --git a/pkg/bufman/pkg/protoencoding/protoencoding.go b/pkg/bufman/pkg/protoencoding/protoencoding.go new file mode 100644 index 000000000..bc4c5c86f --- /dev/null +++ b/pkg/bufman/pkg/protoencoding/protoencoding.go @@ -0,0 +1,116 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoencoding + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" +) + +// Resolver can resolve files, messages, enums, and extensions. +type Resolver interface { + protodesc.Resolver + protoregistryv1alpha1.ExtensionTypeResolver + protoregistryv1alpha1.MessageTypeResolver + FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) +} + +// NewResolver creates a new Resolver. +// +// If the input slice is empty, this returns nil +// The given FileDescriptors must be self-contained, that is they must contain all imports. +// This can NOT be guaranteed for FileDescriptorSets given over the wire, and can only be guaranteed from builds. +func NewResolver(fileDescriptors ...protodescriptor.FileDescriptor) (Resolver, error) { + return newResolver(fileDescriptors...) +} + +// NewLazyResolver creates a new Resolver that is constructed from the given +// descriptors only as needed, if invoked. +// +// If there is an error when constructing the resolver, it will be returned by all +// method calls of the returned resolver. +func NewLazyResolver(fileDescriptors ...protodescriptor.FileDescriptor) Resolver { + return &lazyResolver{fn: func() (Resolver, error) { + return newResolver(fileDescriptors...) + }} +} + +// Marshaler marshals Messages. +type Marshaler interface { + Marshal(message proto.Message) ([]byte, error) +} + +// NewWireMarshaler returns a new Marshaler for wire. +// +// See https://godoc.org/google.golang.org/protobuf/proto#MarshalOptions for a discussion on stability. +// This has the potential to be unstable over time. +func NewWireMarshaler() Marshaler { + return newWireMarshaler() +} + +// NewJSONMarshaler returns a new Marshaler for JSON. +// +// This has the potential to be unstable over time. +// resolver can be nil if unknown and are only needed for extensions. +func NewJSONMarshaler(resolver Resolver, options ...JSONMarshalerOption) Marshaler { + return newJSONMarshaler(resolver, options...) +} + +// JSONMarshalerOption is an option for a new JSONMarshaler. +type JSONMarshalerOption func(*jsonMarshaler) + +// JSONMarshalerWithIndent says to use an indent of two spaces. +func JSONMarshalerWithIndent() JSONMarshalerOption { + return func(jsonMarshaler *jsonMarshaler) { + jsonMarshaler.indent = " " + } +} + +// JSONMarshalerWithUseProtoNames says to use an use proto names. +func JSONMarshalerWithUseProtoNames() JSONMarshalerOption { + return func(jsonMarshaler *jsonMarshaler) { + jsonMarshaler.useProtoNames = true + } +} + +// JSONMarshalerWithEmitUnpopulated says to emit unpopulated values +func JSONMarshalerWithEmitUnpopulated() JSONMarshalerOption { + return func(jsonMarshaler *jsonMarshaler) { + jsonMarshaler.emitUnpopulated = true + } +} + +// Unmarshaler unmarshals Messages. +type Unmarshaler interface { + Unmarshal(data []byte, message proto.Message) error +} + +// NewWireUnmarshaler returns a new Unmarshaler for wire. +// +// resolver can be nil if unknown and are only needed for extensions. +func NewWireUnmarshaler(resolver Resolver) Unmarshaler { + return newWireUnmarshaler(resolver) +} + +// NewJSONUnmarshaler returns a new Unmarshaler for json. +// +// resolver can be nil if unknown and are only needed for extensions. +func NewJSONUnmarshaler(resolver Resolver) Unmarshaler { + return newJSONUnmarshaler(resolver) +} diff --git a/pkg/bufman/pkg/protoencoding/reparse_unrecognized.go b/pkg/bufman/pkg/protoencoding/reparse_unrecognized.go new file mode 100644 index 000000000..dd67ca665 --- /dev/null +++ b/pkg/bufman/pkg/protoencoding/reparse_unrecognized.go @@ -0,0 +1,77 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoencoding + +import ( + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" +) + +// ReparseUnrecognized uses the given resolver to parse any unrecognized fields in the +// given reflectMessage. It does so recursively, resolving any unrecognized fields in +// nested messages. +func ReparseUnrecognized(resolver Resolver, reflectMessage protoreflect.Message) error { + if resolver == nil { + return nil + } + unknown := reflectMessage.GetUnknown() + if len(unknown) > 0 { + reflectMessage.SetUnknown(nil) + options := proto.UnmarshalOptions{ + Resolver: resolver, + Merge: true, + } + if err := options.Unmarshal(unknown, reflectMessage.Interface()); err != nil { + return err + } + } + var err error + reflectMessage.Range(func(fieldDescriptor protoreflect.FieldDescriptor, value protoreflect.Value) bool { + err = reparseUnrecognizedInField(resolver, fieldDescriptor, value) + return err == nil + }) + return err +} + +func reparseUnrecognizedInField(resolver Resolver, fieldDescriptor protoreflect.FieldDescriptor, value protoreflect.Value) error { + if fieldDescriptor.IsMap() { + valDesc := fieldDescriptor.MapValue() + if valDesc.Kind() != protoreflect.MessageKind && valDesc.Kind() != protoreflect.GroupKind { + // nothing to reparse + return nil + } + var err error + value.Map().Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { + err = ReparseUnrecognized(resolver, v.Message()) + return err == nil + }) + return err + } + if fieldDescriptor.Kind() != protoreflect.MessageKind && fieldDescriptor.Kind() != protoreflect.GroupKind { + // nothing to reparse + return nil + } + if fieldDescriptor.IsList() { + list := value.List() + for i := 0; i < list.Len(); i++ { + if err := ReparseUnrecognized(resolver, list.Get(i).Message()); err != nil { + return err + } + } + return nil + } + return ReparseUnrecognized(resolver, value.Message()) +} diff --git a/pkg/bufman/pkg/protoencoding/resolver.go b/pkg/bufman/pkg/protoencoding/resolver.go new file mode 100644 index 000000000..b81d6720c --- /dev/null +++ b/pkg/bufman/pkg/protoencoding/resolver.go @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoencoding + +import ( + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/types/dynamicpb" +) + +func newResolver(fileDescriptors ...protodescriptor.FileDescriptor) (Resolver, error) { + if len(fileDescriptors) == 0 { + return nil, nil + } + // TODO: handle if resolvable + files, err := protodesc.FileOptions{ + AllowUnresolvable: true, + }.NewFiles( + protodescriptor.FileDescriptorSetForFileDescriptors(fileDescriptors...), + ) + if err != nil { + return nil, err + } + types := &protoregistryv1alpha1.Types{} + var rangeErr error + files.RangeFiles(func(fileDescriptor protoreflect.FileDescriptor) bool { + if err := registerDescriptors(types, fileDescriptor); err != nil { + rangeErr = err + return false + } + return true + }) + if rangeErr != nil { + return nil, rangeErr + } + return &resolver{Files: files, Types: types}, nil +} + +type resolver struct { + *protoregistryv1alpha1.Files + *protoregistryv1alpha1.Types +} + +type descriptorContainer interface { + Messages() protoreflect.MessageDescriptors + Enums() protoreflect.EnumDescriptors + Extensions() protoreflect.ExtensionDescriptors +} + +func registerDescriptors(types *protoregistryv1alpha1.Types, container descriptorContainer) error { + messageDescriptors := container.Messages() + for i, messagesLen := 0, messageDescriptors.Len(); i < messagesLen; i++ { + messageDescriptor := messageDescriptors.Get(i) + if err := types.RegisterMessage(dynamicpb.NewMessageType(messageDescriptor)); err != nil { + return err + } + // nested types, too + if err := registerDescriptors(types, messageDescriptor); err != nil { + return err + } + } + + enumDescriptors := container.Enums() + for i, enumsLen := 0, enumDescriptors.Len(); i < enumsLen; i++ { + enumDescriptor := enumDescriptors.Get(i) + if err := types.RegisterEnum(dynamicpb.NewEnumType(enumDescriptor)); err != nil { + return err + } + } + + extensionDescriptors := container.Extensions() + for i, extensionsLen := 0, extensionDescriptors.Len(); i < extensionsLen; i++ { + extensionDescriptor := extensionDescriptors.Get(i) + if err := types.RegisterExtension(dynamicpb.NewExtensionType(extensionDescriptor)); err != nil { + return err + } + } + + return nil +} + +type lazyResolver struct { + fn func() (Resolver, error) + init sync.Once + resolver Resolver + err error +} + +func (l *lazyResolver) maybeInit() error { + l.init.Do(func() { + l.resolver, l.err = l.fn() + }) + return l.err +} + +func (l *lazyResolver) FindFileByPath(path string) (protoreflect.FileDescriptor, error) { + if err := l.maybeInit(); err != nil { + return nil, err + } + return l.resolver.FindFileByPath(path) +} + +func (l *lazyResolver) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) { + if err := l.maybeInit(); err != nil { + return nil, err + } + return l.resolver.FindDescriptorByName(name) +} + +func (l *lazyResolver) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) { + if err := l.maybeInit(); err != nil { + return nil, err + } + return l.resolver.FindEnumByName(enum) +} + +func (l *lazyResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { + if err := l.maybeInit(); err != nil { + return nil, err + } + return l.resolver.FindExtensionByName(field) +} + +func (l *lazyResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { + if err := l.maybeInit(); err != nil { + return nil, err + } + return l.resolver.FindExtensionByNumber(message, field) +} + +func (l *lazyResolver) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) { + if err := l.maybeInit(); err != nil { + return nil, err + } + return l.resolver.FindMessageByName(message) +} + +func (l *lazyResolver) FindMessageByURL(url string) (protoreflect.MessageType, error) { + if err := l.maybeInit(); err != nil { + return nil, err + } + return l.resolver.FindMessageByURL(url) +} diff --git a/pkg/bufman/pkg/protoencoding/wire_marshaler.go b/pkg/bufman/pkg/protoencoding/wire_marshaler.go new file mode 100644 index 000000000..849d798df --- /dev/null +++ b/pkg/bufman/pkg/protoencoding/wire_marshaler.go @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoencoding + +import ( + "google.golang.org/protobuf/proto" +) + +type wireMarshaler struct{} + +func newWireMarshaler() Marshaler { + return &wireMarshaler{} +} + +func (m *wireMarshaler) Marshal(message proto.Message) ([]byte, error) { + options := proto.MarshalOptions{ + Deterministic: true, + } + return options.Marshal(message) +} diff --git a/pkg/bufman/pkg/protoencoding/wire_unmarshaler.go b/pkg/bufman/pkg/protoencoding/wire_unmarshaler.go new file mode 100644 index 000000000..80f7839bf --- /dev/null +++ b/pkg/bufman/pkg/protoencoding/wire_unmarshaler.go @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoencoding + +import ( + "google.golang.org/protobuf/proto" +) + +type wireUnmarshaler struct { + resolver Resolver +} + +func newWireUnmarshaler(resolver Resolver) Unmarshaler { + return &wireUnmarshaler{ + resolver: resolver, + } +} + +func (m *wireUnmarshaler) Unmarshal(data []byte, message proto.Message) error { + options := proto.UnmarshalOptions{ + Resolver: m.resolver, + } + return options.Unmarshal(data, message) +} diff --git a/pkg/bufman/pkg/protogenutil/named_helper.go b/pkg/bufman/pkg/protogenutil/named_helper.go new file mode 100644 index 000000000..4e89f1298 --- /dev/null +++ b/pkg/bufman/pkg/protogenutil/named_helper.go @@ -0,0 +1,177 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protogenutil + +import ( + "fmt" + "path" + "strings" + + "google.golang.org/protobuf/compiler/protogen" +) + +const namedHelperGoPackageOptionKey = "named_go_package" + +type namedHelper struct { + pluginNameToGoPackage map[string]string +} + +func newNamedHelper() *namedHelper { + return &namedHelper{ + pluginNameToGoPackage: make(map[string]string), + } +} + +func (h *namedHelper) NewGoPackageName( + baseGoPackageName protogen.GoPackageName, + pluginName string, +) protogen.GoPackageName { + return protogen.GoPackageName(string(baseGoPackageName) + pluginName) +} + +func (h *namedHelper) NewGoImportPath( + file *protogen.File, + pluginName string, +) (protogen.GoImportPath, error) { + return h.newGoImportPath( + path.Dir(file.GeneratedFilenamePrefix), + file.GoPackageName, + pluginName, + ) +} + +func (h *namedHelper) NewPackageGoImportPath( + goPackageFileSet *GoPackageFileSet, + pluginName string, +) (protogen.GoImportPath, error) { + return h.newGoImportPath( + goPackageFileSet.GeneratedDir, + goPackageFileSet.GoPackageName, + pluginName, + ) +} + +func (h *namedHelper) NewGlobalGoImportPath( + pluginName string, +) (protogen.GoImportPath, error) { + goPackage, ok := h.pluginNameToGoPackage[pluginName] + if !ok { + return "", fmt.Errorf("no %s specified for plugin %s", namedHelperGoPackageOptionKey, pluginName) + } + return protogen.GoImportPath(goPackage), nil +} + +func (h *namedHelper) NewGeneratedFile( + plugin *protogen.Plugin, + file *protogen.File, + pluginName string, +) (*protogen.GeneratedFile, error) { + goImportPath, err := h.NewGoImportPath(file, pluginName) + if err != nil { + return nil, err + } + goPackageName := h.NewGoPackageName(file.GoPackageName, pluginName) + generatedFilePath := path.Dir(file.GeneratedFilenamePrefix) + + "/" + string(goPackageName) + + "/" + path.Base(file.GeneratedFilenamePrefix) + + ".pb.go" + + generatedFile := plugin.NewGeneratedFile(generatedFilePath, goImportPath) + printGeneratedFileNamedHelperHeader(generatedFile, goPackageName, pluginName) + return generatedFile, nil +} + +func (h *namedHelper) NewPackageGeneratedFile( + plugin *protogen.Plugin, + goPackageFileSet *GoPackageFileSet, + pluginName string, +) (*protogen.GeneratedFile, error) { + goImportPath, err := h.NewPackageGoImportPath(goPackageFileSet, pluginName) + if err != nil { + return nil, err + } + goPackageName := h.NewGoPackageName(goPackageFileSet.GoPackageName, pluginName) + fileBaseName := string(goPackageName) + // make sure this file name would not overlap with any actual file name + for _, file := range goPackageFileSet.Files { + if path.Base(file.GeneratedFilenamePrefix) == fileBaseName { + fileBaseName = fileBaseName + "_pkg" + // do not break, just for the malicious case, where there is a file + // packagename_pkg.proto, packagename_pkg_pkg.proto, etc + } + } + generatedFilePath := goPackageFileSet.GeneratedDir + + "/" + string(goPackageName) + + "/" + fileBaseName + + ".pb.go" + + generatedFile := plugin.NewGeneratedFile(generatedFilePath, goImportPath) + printGeneratedFileNamedHelperHeader(generatedFile, goPackageName, pluginName) + return generatedFile, nil +} + +func (h *namedHelper) NewGlobalGeneratedFile( + plugin *protogen.Plugin, + pluginName string, +) (*protogen.GeneratedFile, error) { + goImportPath, err := h.NewGlobalGoImportPath(pluginName) + if err != nil { + return nil, err + } + goPackageName := h.NewGoPackageName("", pluginName) + generatedFilePath := string(goPackageName) + ".pb.go" + + generatedFile := plugin.NewGeneratedFile(generatedFilePath, goImportPath) + printGeneratedFileNamedHelperHeader(generatedFile, goPackageName, pluginName) + return generatedFile, nil +} + +func (h *namedHelper) newGoImportPath( + generatedDir string, + baseGoPackageName protogen.GoPackageName, + pluginName string, +) (protogen.GoImportPath, error) { + goPackage, ok := h.pluginNameToGoPackage[pluginName] + if !ok { + return "", fmt.Errorf("no %s specified for plugin %s", namedHelperGoPackageOptionKey, pluginName) + } + return protogen.GoImportPath(goPackage + + "/" + generatedDir + + "/" + string(h.NewGoPackageName(baseGoPackageName, pluginName))), nil +} + +func (h *namedHelper) handleOption(key string, value string) error { + if key != namedHelperGoPackageOptionKey { + return nil + } + split := strings.Split(value, "=") + if len(split) != 2 { + return fmt.Errorf("unknown value for %s: %s", namedHelperGoPackageOptionKey, value) + } + h.pluginNameToGoPackage[split[0]] = split[1] + return nil +} + +func printGeneratedFileNamedHelperHeader( + generatedFile *protogen.GeneratedFile, + goPackageName protogen.GoPackageName, + pluginName string, +) { + generatedFile.P("// Code generated by protoc-gen-go-", pluginName, ". DO NOT EDIT.") + generatedFile.P() + generatedFile.P("package ", goPackageName) + generatedFile.P() +} diff --git a/pkg/bufman/pkg/protogenutil/protogenutil.go b/pkg/bufman/pkg/protogenutil/protogenutil.go new file mode 100644 index 000000000..2b8fcab5d --- /dev/null +++ b/pkg/bufman/pkg/protogenutil/protogenutil.go @@ -0,0 +1,561 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package protogenutil provides support for protoc plugin development with the +// appproto and protogen packages. +package protogenutil + +import ( + "context" + "fmt" + "path" + "sort" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appproto" + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/pluginpb" +) + +// NewHandler returns a new appproto.Handler for the protogen.Plugin function. +func NewHandler(f func(*protogen.Plugin) error, options ...HandlerOption) appproto.Handler { + handlerOptions := newHandlerOptions() + for _, option := range options { + option(handlerOptions) + } + return appproto.HandlerFunc( + func( + ctx context.Context, + container app.EnvStderrContainer, + responseWriter appproto.ResponseBuilder, + request *pluginpb.CodeGeneratorRequest, + ) error { + plugin, err := protogen.Options{ + ParamFunc: handlerOptions.optionHandler, + }.New(request) + if err != nil { + return err + } + if err := f(plugin); err != nil { + plugin.Error(err) + } + response := plugin.Response() + for _, file := range response.File { + if err := responseWriter.AddFile(file); err != nil { + return err + } + } + // plugin.proto specifies that only non-empty errors are considered errors. + // This is also consistent with protoc's behavior. + // Ref: https://github.com/protocolbuffers/protobuf/blob/069f989b483e63005f87ab309de130677718bbec/src/google/protobuf/compiler/plugin.proto#L100-L108. + if response.GetError() != "" { + responseWriter.AddError(response.GetError()) + } + responseWriter.SetFeatureProto3Optional() + return nil + }, + ) +} + +// NewFileHandler returns a newHandler for the protogen file function. +// +// This will invoke f with every file marked for generation. +func NewFileHandler(f func(*protogen.Plugin, []*protogen.File) error, options ...HandlerOption) appproto.Handler { + return NewHandler( + func(plugin *protogen.Plugin) error { + generateFiles := make([]*protogen.File, 0, len(plugin.Files)) + for _, file := range plugin.Files { + if file.Generate { + generateFiles = append(generateFiles, file) + } + } + sort.Slice( + generateFiles, + func(i int, j int) bool { + return generateFiles[i].Proto.GetName() < generateFiles[j].Proto.GetName() + }, + ) + return f(plugin, generateFiles) + }, + options..., + ) +} + +// NewPerFileHandler returns a newHandler for the protogen per-file function. +// +// This will invoke f for every file marked for generation. +func NewPerFileHandler(f func(*protogen.Plugin, *protogen.File) error, options ...HandlerOption) appproto.Handler { + return NewFileHandler( + func(plugin *protogen.Plugin, files []*protogen.File) error { + for _, file := range files { + if err := f(plugin, file); err != nil { + return err + } + } + return nil + }, + options..., + ) +} + +// NewGoPackageHandler returns a newHandler for the protogen package function. +// +// This validates that all files marked for generation that would be generated to +// the same directory also have the same go package and go import path. +// +// This will invoke f with every file marked for generation. +func NewGoPackageHandler(f func(*protogen.Plugin, []*GoPackageFileSet) error, options ...HandlerOption) appproto.Handler { + return NewHandler( + func(plugin *protogen.Plugin) error { + generatedDirToGoPackageFileSet := make(map[string]*GoPackageFileSet) + for _, file := range plugin.Files { + if file.Generate { + generatedDir := path.Dir(file.GeneratedFilenamePrefix) + goPackageFileSet, ok := generatedDirToGoPackageFileSet[generatedDir] + if !ok { + generatedDirToGoPackageFileSet[generatedDir] = &GoPackageFileSet{ + GeneratedDir: generatedDir, + GoImportPath: file.GoImportPath, + GoPackageName: file.GoPackageName, + ProtoPackage: file.Proto.GetPackage(), + Files: []*protogen.File{file}, + } + } else { + if goPackageFileSet.GoImportPath != file.GoImportPath { + return fmt.Errorf( + "mismatched go import paths for generated directory %q: %q %q", + generatedDir, + string(goPackageFileSet.GoImportPath), + string(file.GoImportPath), + ) + } + if goPackageFileSet.GoPackageName != file.GoPackageName { + return fmt.Errorf( + "mismatched go package names for generated directory %q: %q %q", + generatedDir, + string(goPackageFileSet.GoPackageName), + string(file.GoPackageName), + ) + } + if goPackageFileSet.ProtoPackage != file.Proto.GetPackage() { + return fmt.Errorf( + "mismatched proto package names for generated directory %q: %q %q", + generatedDir, + goPackageFileSet.ProtoPackage, + file.Proto.GetPackage(), + ) + } + goPackageFileSet.Files = append(goPackageFileSet.Files, file) + } + } + } + goPackageFileSets := make([]*GoPackageFileSet, 0, len(generatedDirToGoPackageFileSet)) + for _, goPackageFileSet := range generatedDirToGoPackageFileSet { + goPackageFileSets = append(goPackageFileSets, goPackageFileSet) + } + sort.Slice( + goPackageFileSets, + func(i int, j int) bool { + return goPackageFileSets[i].ProtoPackage < goPackageFileSets[j].ProtoPackage + }, + ) + return f(plugin, goPackageFileSets) + }, + options..., + ) +} + +// NewPerGoPackageHandler returns a newHandler for the protogen per-package function. +// +// This validates that all files marked for generation that would be generated to +// the same directory also have the same go package and go import path. +// +// This will invoke f for every file marked for generation. +func NewPerGoPackageHandler(f func(*protogen.Plugin, *GoPackageFileSet) error, options ...HandlerOption) appproto.Handler { + return NewGoPackageHandler( + func(plugin *protogen.Plugin, goPackageFileSets []*GoPackageFileSet) error { + for _, goPackageFileSet := range goPackageFileSets { + if err := f(plugin, goPackageFileSet); err != nil { + return err + } + } + return nil + }, + options..., + ) +} + +// HandlerOption is an option for a new Handler. +type HandlerOption func(*handlerOptions) + +// HandlerWithOptionHandler returns a new HandlerOption that sets the given param function. +// +// This parses options given on the command line. +func HandlerWithOptionHandler(optionHandler func(string, string) error) HandlerOption { + return func(handlerOptions *handlerOptions) { + handlerOptions.optionHandler = optionHandler + } +} + +// GoPackageFileSet are files within a single Go package. +type GoPackageFileSet struct { + // The directory the golang/protobuf files would be generated to. + GeneratedDir string + // The Go import path the golang/protobuf files would be generated to. + GoImportPath protogen.GoImportPath + // The Go package name the golang/protobuf files would be generated to. + GoPackageName protogen.GoPackageName + // ProtoPackage is the proto package for all files. + ProtoPackage string + // The files within this package that are marked for generate. + Files []*protogen.File +} + +// Services returns all the services in this Go package sorted by Go name. +func (g *GoPackageFileSet) Services() []*protogen.Service { + var services []*protogen.Service + for _, file := range g.Files { + services = append(services, file.Services...) + } + sort.Slice( + services, + func(i int, j int) bool { + return services[i].GoName < services[j].GoName + }, + ) + return services +} + +// NamedHelper is a helper to deal with named golang plugins. +// +// Named plugins should be named in the form protoc-gen-go-foobar, where the plugin +// name is consiered to be "foobar". The plugin name must be lowercase. +type NamedHelper interface { + // NewGoPackageName gets the helper GoPackageName for the pluginName. + NewGoPackageName( + baseGoPackageName protogen.GoPackageName, + pluginName string, + ) protogen.GoPackageName + // NewGoImportPath gets the helper GoImportPath for the pluginName. + NewGoImportPath( + file *protogen.File, + pluginName string, + ) (protogen.GoImportPath, error) + // NewPackageGoImportPath gets the helper GoImportPath for the pluginName. + NewPackageGoImportPath( + goPackageFileSet *GoPackageFileSet, + pluginName string, + ) (protogen.GoImportPath, error) + // NewGlobalImportPath gets the helper GoImportPath for the pluginName. + NewGlobalGoImportPath( + pluginName string, + ) (protogen.GoImportPath, error) + // NewGeneratedFile returns a new individual GeneratedFile for a named plugin. + // + // This should be used for named plugins that have a 1-1 mapping between Protobuf files + // and generated files. + // + // This also prints the file header and package. + NewGeneratedFile( + plugin *protogen.Plugin, + file *protogen.File, + pluginName string, + ) (*protogen.GeneratedFile, error) + // NewPackageGeneratedFile returns a new individual GeneratedFile for a named plugin. + // + // This should be used for named plugins that have a 1-1 mapping between Protobuf files + // and generated files. The generated file name will not overlap with the base name + // of any .proto file in the package. + // + // This also prints the file header and package. + NewPackageGeneratedFile( + plugin *protogen.Plugin, + goPackageFileSet *GoPackageFileSet, + pluginName string, + ) (*protogen.GeneratedFile, error) + // NewGlobalGeneratedFile returns a new global GeneratedFile for a named plugin. + // + // This also prints the file header and package. + NewGlobalGeneratedFile( + plugin *protogen.Plugin, + pluginName string, + ) (*protogen.GeneratedFile, error) +} + +// NewNamedFileHandler returns a new file handler for a named plugin. +func NewNamedFileHandler(f func(NamedHelper, *protogen.Plugin, []*protogen.File) error) appproto.Handler { + namedHelper := newNamedHelper() + return NewFileHandler( + func(plugin *protogen.Plugin, files []*protogen.File) error { + return f(namedHelper, plugin, files) + }, + HandlerWithOptionHandler( + namedHelper.handleOption, + ), + ) +} + +// NewNamedPerFileHandler returns a new per-file handler for a named plugin. +func NewNamedPerFileHandler(f func(NamedHelper, *protogen.Plugin, *protogen.File) error) appproto.Handler { + namedHelper := newNamedHelper() + return NewPerFileHandler( + func(plugin *protogen.Plugin, file *protogen.File) error { + return f(namedHelper, plugin, file) + }, + HandlerWithOptionHandler( + namedHelper.handleOption, + ), + ) +} + +// NewNamedGoPackageHandler returns a new go package handler for a named plugin. +func NewNamedGoPackageHandler(f func(NamedHelper, *protogen.Plugin, []*GoPackageFileSet) error) appproto.Handler { + namedHelper := newNamedHelper() + return NewGoPackageHandler( + func(plugin *protogen.Plugin, goPackageFileSets []*GoPackageFileSet) error { + return f(namedHelper, plugin, goPackageFileSets) + }, + HandlerWithOptionHandler( + namedHelper.handleOption, + ), + ) +} + +// NewNamedPerGoPackageHandler returns a new per-go-package handler for a named plugin. +func NewNamedPerGoPackageHandler(f func(NamedHelper, *protogen.Plugin, *GoPackageFileSet) error) appproto.Handler { + namedHelper := newNamedHelper() + return NewPerGoPackageHandler( + func(plugin *protogen.Plugin, goPackageFileSet *GoPackageFileSet) error { + return f(namedHelper, plugin, goPackageFileSet) + }, + HandlerWithOptionHandler( + namedHelper.handleOption, + ), + ) +} + +// ValidateMethodUnary validates that the method is unary. +func ValidateMethodUnary(method *protogen.Method) error { + if method.Desc.IsStreamingClient() || method.Desc.IsStreamingServer() { + return fmt.Errorf("plugin does not allow streaming methods: %v", method.GoName) + } + return nil +} + +// ValidateFieldNotOneof validates that the field is not a oneof. +func ValidateFieldNotOneof(field *protogen.Field) error { + if oneof := field.Oneof; oneof != nil && !oneof.Desc.IsSynthetic() { + return fmt.Errorf("plugin does not allow oneofs for request fields: %v", field.GoName) + } + return nil +} + +// ValidateFieldNotMap validates that the field is not a map. +func ValidateFieldNotMap(field *protogen.Field) error { + if field.Desc.IsMap() { + return fmt.Errorf("plugin does not allow maps for request fields: %v", field.GoName) + } + return nil +} + +// GetUnexportGoName returns a new unexported type for the go name. +// +// This makes the first character lowercase. +// If the goName is empty, this returns empty. +func GetUnexportGoName(goName string) string { + if goName == "" { + return "" + } + return strings.ToLower(goName[:1]) + goName[1:] +} + +// GetRequestAndResponseParameterStrings gets the parameters for the given request and response fields. +func GetRequestAndResponseParameterStrings( + generatedFile *protogen.GeneratedFile, + requestFields []*protogen.Field, + responseFields []*protogen.Field, +) (requestParameterStrings []string, responseParameterStrings []string, _ error) { + requestParameterStrings = make([]string, len(requestFields)) + responseParameterStrings = make([]string, len(responseFields)) + fieldNames := make(map[string]struct{}) + for i, field := range requestFields { + if err := ValidateFieldNotOneof(field); err != nil { + return nil, nil, err + } + fieldGoType, err := GetFieldGoType(generatedFile, field) + if err != nil { + return nil, nil, err + } + fieldName := GetUnexportGoName(field.GoName) + fieldNames[fieldName] = struct{}{} + requestParameterStrings[i] = fieldName + ` ` + fieldGoType + } + for i, field := range responseFields { + if err := ValidateFieldNotOneof(field); err != nil { + return nil, nil, err + } + fieldGoType, err := GetFieldGoType(generatedFile, field) + if err != nil { + return nil, nil, err + } + fieldName := GetUnexportGoName(field.GoName) + for { + if _, ok := fieldNames[fieldName]; !ok { + break + } + fieldName = fieldName + "Response" + } + fieldNames[fieldName] = struct{}{} + responseParameterStrings[i] = fieldName + ` ` + fieldGoType + } + return requestParameterStrings, responseParameterStrings, nil +} + +// GetParameterErrorReturnString gets the return string for an error for a method. +func GetParameterErrorReturnString( + generatedFile *protogen.GeneratedFile, + fields []*protogen.Field, + errorVarName string, +) (string, error) { + varStrings := make([]string, len(fields)+1) + for i, field := range fields { + if err := ValidateFieldNotOneof(field); err != nil { + return "", err + } + fieldGoZeroValue, err := GetFieldGoZeroValue(generatedFile, field) + if err != nil { + return "", err + } + varStrings[i] = fieldGoZeroValue + } + varStrings[len(varStrings)-1] = errorVarName + return "return " + strings.Join(varStrings, ", "), nil +} + +// GetFieldGoType returns the Go type used for a field. +// +// Adapted from https://github.com/protocolbuffers/protobuf-go/blob/81d297c66c9b1e0606eee19a9ee718dcf149276d/cmd/protoc-gen-go/internal_gengo/main.go#L640 +// See https://github.com/protocolbuffers/protobuf-go/blob/81d297c66c9b1e0606eee19a9ee718dcf149276d/LICENSE for the license. +func GetFieldGoType( + generatedFile *protogen.GeneratedFile, + field *protogen.Field, +) (string, error) { + if field.Desc.IsWeak() { + return "struct{}", nil + } + var goType string + pointer := field.Desc.HasPresence() + switch field.Desc.Kind() { + case protoreflect.BoolKind: + goType = "bool" + case protoreflect.EnumKind: + goType = generatedFile.QualifiedGoIdent(field.Enum.GoIdent) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + goType = "int32" + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + goType = "uint32" + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + goType = "int64" + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + goType = "uint64" + case protoreflect.FloatKind: + goType = "float32" + case protoreflect.DoubleKind: + goType = "float64" + case protoreflect.StringKind: + goType = "string" + case protoreflect.BytesKind: + goType = "[]byte" + pointer = false // rely on nullability of slices for presence + case protoreflect.MessageKind, protoreflect.GroupKind: + goType = "*" + generatedFile.QualifiedGoIdent(field.Message.GoIdent) + pointer = false // pointer captured as part of the type + default: + return "", fmt.Errorf("unknown Kind: %T", field.Desc.Kind()) + } + switch { + case field.Desc.IsList(): + return "[]" + goType, nil + case field.Desc.IsMap(): + keyType, err := GetFieldGoType(generatedFile, field.Message.Fields[0]) + if err != nil { + return "", err + } + valType, err := GetFieldGoType(generatedFile, field.Message.Fields[1]) + if err != nil { + return "", err + } + return fmt.Sprintf("map[%v]%v", keyType, valType), nil + } + if pointer { + goType = "*" + goType + } + return goType, nil +} + +// GetFieldGoZeroValue returns the go zero value for a field. +func GetFieldGoZeroValue( + generatedFile *protogen.GeneratedFile, + field *protogen.Field, +) (string, error) { + if field.Desc.IsWeak() { + return "struct{}", nil + } + if field.Desc.HasPresence() { + return "nil", nil + } + if field.Desc.IsList() { + return "nil", nil + } + if field.Desc.IsMap() { + return "nil", nil + } + switch field.Desc.Kind() { + case protoreflect.BoolKind: + return "false", nil + case protoreflect.EnumKind: + return generatedFile.QualifiedGoIdent(field.Enum.GoIdent) + "(0)", nil + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + return "0", nil + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + return "0", nil + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + return "0", nil + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + return "0", nil + case protoreflect.FloatKind: + return "0", nil + case protoreflect.DoubleKind: + return "0", nil + case protoreflect.StringKind: + return `""`, nil + case protoreflect.BytesKind: + return "nil", nil + case protoreflect.MessageKind, protoreflect.GroupKind: + return "nil", nil + default: + return "", fmt.Errorf("unknown Kind: %T", field.Desc.Kind()) + } +} + +type handlerOptions struct { + optionHandler func(string, string) error +} + +func newHandlerOptions() *handlerOptions { + return &handlerOptions{} +} diff --git a/pkg/bufman/pkg/protosource/descriptor.go b/pkg/bufman/pkg/protosource/descriptor.go new file mode 100644 index 000000000..dc07dd083 --- /dev/null +++ b/pkg/bufman/pkg/protosource/descriptor.go @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +type descriptor struct { + file File + locationStore *locationStore +} + +func newDescriptor( + file File, + locationStore *locationStore, +) descriptor { + return descriptor{ + file: file, + locationStore: locationStore, + } +} + +func (d *descriptor) File() File { + return d.file +} + +func (d *descriptor) getLocation(path []int32) Location { + if d.locationStore == nil || len(path) == 0 { + return nil + } + return d.locationStore.getLocation(path) +} + +func (d *descriptor) getLocationByPathKey(pathKey string) Location { + if d.locationStore == nil || pathKey == "" { + return nil + } + return d.locationStore.getLocationByPathKey(pathKey) +} diff --git a/pkg/bufman/pkg/protosource/enum.go b/pkg/bufman/pkg/protosource/enum.go new file mode 100644 index 000000000..399dcad96 --- /dev/null +++ b/pkg/bufman/pkg/protosource/enum.go @@ -0,0 +1,102 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +type enum struct { + namedDescriptor + optionExtensionDescriptor + + values []EnumValue + allowAlias bool + deprecatedLegacyJSONFieldConflicts bool + deprecated bool + allowAliasPath []int32 + reservedEnumRanges []EnumRange + reservedNames []ReservedName + parent Message +} + +func newEnum( + namedDescriptor namedDescriptor, + optionExtensionDescriptor optionExtensionDescriptor, + allowAlias bool, + deprecatedLegacyJSONFieldConflicts bool, + deprecated bool, + allowAliasPath []int32, + parent Message, +) *enum { + return &enum{ + namedDescriptor: namedDescriptor, + optionExtensionDescriptor: optionExtensionDescriptor, + allowAlias: allowAlias, + deprecatedLegacyJSONFieldConflicts: deprecatedLegacyJSONFieldConflicts, + deprecated: deprecated, + allowAliasPath: allowAliasPath, + parent: parent, + } +} + +func (e *enum) Values() []EnumValue { + return e.values +} + +func (e *enum) AllowAlias() bool { + return e.allowAlias +} + +func (e *enum) DeprecatedLegacyJSONFieldConflicts() bool { + return e.deprecatedLegacyJSONFieldConflicts +} + +func (e *enum) Deprecated() bool { + return e.deprecated +} + +func (e *enum) AllowAliasLocation() Location { + return e.getLocation(e.allowAliasPath) +} + +func (e *enum) ReservedEnumRanges() []EnumRange { + return e.reservedEnumRanges +} + +func (e *enum) ReservedTagRanges() []TagRange { + tagRanges := make([]TagRange, len(e.reservedEnumRanges)) + for i, reservedEnumRange := range e.reservedEnumRanges { + tagRanges[i] = reservedEnumRange + } + return tagRanges +} + +func (e *enum) ReservedNames() []ReservedName { + return e.reservedNames +} + +func (e *enum) Parent() Message { + return e.parent +} + +func (e *enum) addValue(value EnumValue) { + e.values = append(e.values, value) +} + +func (e *enum) addReservedEnumRange(reservedEnumRange EnumRange) { + e.reservedEnumRanges = append(e.reservedEnumRanges, reservedEnumRange) +} + +func (e *enum) addReservedName(reservedName ReservedName) { + e.reservedNames = append(e.reservedNames, reservedName) +} diff --git a/pkg/bufman/pkg/protosource/enum_range.go b/pkg/bufman/pkg/protosource/enum_range.go new file mode 100644 index 000000000..8edf6e57d --- /dev/null +++ b/pkg/bufman/pkg/protosource/enum_range.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +const ( + enumRangeInclusiveMax = 2147483647 +) + +type enumRange struct { + locationDescriptor + + enum Enum + start int + end int +} + +func newEnumRange( + locationDescriptor locationDescriptor, + enum Enum, + start int, + // end is inclusive for enums + end int, +) *enumRange { + return &enumRange{ + locationDescriptor: locationDescriptor, + enum: enum, + start: start, + end: end, + } +} + +func (r *enumRange) Enum() Enum { + return r.enum +} + +func (r *enumRange) Start() int { + return r.start +} + +func (r *enumRange) End() int { + return r.end +} + +func (r *enumRange) Max() bool { + return r.end == enumRangeInclusiveMax +} diff --git a/pkg/bufman/pkg/protosource/enum_value.go b/pkg/bufman/pkg/protosource/enum_value.go new file mode 100644 index 000000000..6bcd7a7eb --- /dev/null +++ b/pkg/bufman/pkg/protosource/enum_value.go @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +type enumValue struct { + namedDescriptor + optionExtensionDescriptor + + enum Enum + number int + deprecated bool + numberPath []int32 +} + +func newEnumValue( + namedDescriptor namedDescriptor, + optionExtensionDescriptor optionExtensionDescriptor, + enum Enum, + number int, + deprecated bool, + numberPath []int32, +) *enumValue { + return &enumValue{ + namedDescriptor: namedDescriptor, + optionExtensionDescriptor: optionExtensionDescriptor, + enum: enum, + number: number, + deprecated: deprecated, + numberPath: numberPath, + } +} + +func (e *enumValue) Enum() Enum { + return e.enum +} + +func (e *enumValue) Number() int { + return e.number +} + +func (e *enumValue) Deprecated() bool { + return e.deprecated +} + +func (e *enumValue) NumberLocation() Location { + return e.getLocation(e.numberPath) +} diff --git a/pkg/bufman/pkg/protosource/field.go b/pkg/bufman/pkg/protosource/field.go new file mode 100644 index 000000000..a8e99f0b3 --- /dev/null +++ b/pkg/bufman/pkg/protosource/field.go @@ -0,0 +1,210 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import "google.golang.org/protobuf/types/descriptorpb" + +type field struct { + namedDescriptor + optionExtensionDescriptor + + message Message + number int + label descriptorpb.FieldDescriptorProto_Label + typ descriptorpb.FieldDescriptorProto_Type + typeName string + // if the field is an extension, this is the type being extended + extendee string + // this has to be the pointer to the private struct or you have the bug where the + // interface is nil but value == nil is false + oneof *oneof + proto3Optional bool + jsonName string + jsType descriptorpb.FieldOptions_JSType + cType descriptorpb.FieldOptions_CType + retention descriptorpb.FieldOptions_OptionRetention + targets []descriptorpb.FieldOptions_OptionTargetType + debugRedact bool + packed *bool + deprecated bool + numberPath []int32 + typePath []int32 + typeNamePath []int32 + jsonNamePath []int32 + jsTypePath []int32 + cTypePath []int32 + packedPath []int32 + extendeePath []int32 +} + +func newField( + namedDescriptor namedDescriptor, + optionExtensionDescriptor optionExtensionDescriptor, + message Message, + number int, + label descriptorpb.FieldDescriptorProto_Label, + typ descriptorpb.FieldDescriptorProto_Type, + typeName string, + extendee string, + oneof *oneof, + proto3Optional bool, + jsonName string, + jsType descriptorpb.FieldOptions_JSType, + cType descriptorpb.FieldOptions_CType, + retention descriptorpb.FieldOptions_OptionRetention, + targets []descriptorpb.FieldOptions_OptionTargetType, + debugRedact bool, + packed *bool, + deprecated bool, + numberPath []int32, + typePath []int32, + typeNamePath []int32, + jsonNamePath []int32, + jsTypePath []int32, + cTypePath []int32, + packedPath []int32, + extendeePath []int32, +) *field { + return &field{ + namedDescriptor: namedDescriptor, + optionExtensionDescriptor: optionExtensionDescriptor, + message: message, + number: number, + label: label, + typ: typ, + typeName: typeName, + extendee: extendee, + oneof: oneof, + proto3Optional: proto3Optional, + jsonName: jsonName, + jsType: jsType, + cType: cType, + retention: retention, + targets: targets, + debugRedact: debugRedact, + packed: packed, + deprecated: deprecated, + numberPath: numberPath, + typePath: typePath, + typeNamePath: typeNamePath, + jsonNamePath: jsonNamePath, + jsTypePath: jsTypePath, + cTypePath: cTypePath, + packedPath: packedPath, + extendeePath: extendeePath, + } +} + +func (f *field) Message() Message { + return f.message +} + +func (f *field) Number() int { + return f.number +} + +func (f *field) Label() descriptorpb.FieldDescriptorProto_Label { + return f.label +} + +func (f *field) Type() descriptorpb.FieldDescriptorProto_Type { + return f.typ +} + +func (f *field) TypeName() string { + return f.typeName +} + +func (f *field) Extendee() string { + return f.extendee +} + +func (f *field) Oneof() Oneof { + // this has to be done or you have the bug where the interface is nil + // but value == nil is false + if f.oneof == nil { + return nil + } + return f.oneof +} + +func (f *field) Proto3Optional() bool { + return f.proto3Optional +} + +func (f *field) JSONName() string { + return f.jsonName +} + +func (f *field) JSType() descriptorpb.FieldOptions_JSType { + return f.jsType +} + +func (f *field) CType() descriptorpb.FieldOptions_CType { + return f.cType +} + +func (f *field) Retention() descriptorpb.FieldOptions_OptionRetention { + return f.retention +} + +func (f *field) Targets() []descriptorpb.FieldOptions_OptionTargetType { + return f.targets +} + +func (f *field) DebugRedact() bool { + return f.debugRedact +} + +func (f *field) Packed() *bool { + return f.packed +} + +func (f *field) Deprecated() bool { + return f.deprecated +} + +func (f *field) NumberLocation() Location { + return f.getLocation(f.numberPath) +} + +func (f *field) TypeLocation() Location { + return f.getLocation(f.typePath) +} + +func (f *field) TypeNameLocation() Location { + return f.getLocation(f.typeNamePath) +} + +func (f *field) JSONNameLocation() Location { + return f.getLocation(f.jsonNamePath) +} + +func (f *field) JSTypeLocation() Location { + return f.getLocation(f.jsTypePath) +} + +func (f *field) CTypeLocation() Location { + return f.getLocation(f.cTypePath) +} + +func (f *field) PackedLocation() Location { + return f.getLocation(f.packedPath) +} + +func (f *field) ExtendeeLocation() Location { + return f.getLocation(f.extendeePath) +} diff --git a/pkg/bufman/pkg/protosource/file.go b/pkg/bufman/pkg/protosource/file.go new file mode 100644 index 000000000..4e9e7bd06 --- /dev/null +++ b/pkg/bufman/pkg/protosource/file.go @@ -0,0 +1,838 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import ( + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "google.golang.org/protobuf/types/descriptorpb" +) + +type file struct { + FileInfo + descriptor + optionExtensionDescriptor + + fileDescriptor protodescriptor.FileDescriptor + syntax Syntax + fileImports []FileImport + messages []Message + enums []Enum + services []Service + extensions []Field + edition string + optimizeMode descriptorpb.FileOptions_OptimizeMode +} + +func (f *file) Syntax() Syntax { + return f.syntax +} + +func (f *file) Package() string { + return f.fileDescriptor.GetPackage() +} + +func (f *file) FileImports() []FileImport { + return f.fileImports +} + +func (f *file) Messages() []Message { + return f.messages +} + +func (f *file) Enums() []Enum { + return f.enums +} + +func (f *file) Services() []Service { + return f.services +} + +func (f *file) Extensions() []Field { + return f.extensions +} + +func (f *file) Edition() string { + return f.edition +} + +func (f *file) CsharpNamespace() string { + return f.fileDescriptor.GetOptions().GetCsharpNamespace() +} + +func (f *file) Deprecated() bool { + return f.fileDescriptor.GetOptions().GetDeprecated() +} + +func (f *file) GoPackage() string { + return f.fileDescriptor.GetOptions().GetGoPackage() +} + +func (f *file) JavaMultipleFiles() bool { + return f.fileDescriptor.GetOptions().GetJavaMultipleFiles() +} + +func (f *file) JavaOuterClassname() string { + return f.fileDescriptor.GetOptions().GetJavaOuterClassname() +} + +func (f *file) JavaPackage() string { + return f.fileDescriptor.GetOptions().GetJavaPackage() +} + +func (f *file) JavaStringCheckUtf8() bool { + return f.fileDescriptor.GetOptions().GetJavaStringCheckUtf8() +} + +func (f *file) ObjcClassPrefix() string { + return f.fileDescriptor.GetOptions().GetObjcClassPrefix() +} + +func (f *file) PhpClassPrefix() string { + return f.fileDescriptor.GetOptions().GetPhpClassPrefix() +} + +func (f *file) PhpNamespace() string { + return f.fileDescriptor.GetOptions().GetPhpNamespace() +} + +func (f *file) PhpMetadataNamespace() string { + return f.fileDescriptor.GetOptions().GetPhpMetadataNamespace() +} + +func (f *file) RubyPackage() string { + return f.fileDescriptor.GetOptions().GetRubyPackage() +} + +func (f *file) SwiftPrefix() string { + return f.fileDescriptor.GetOptions().GetSwiftPrefix() +} + +func (f *file) OptimizeFor() descriptorpb.FileOptions_OptimizeMode { + return f.optimizeMode +} + +func (f *file) CcGenericServices() bool { + return f.fileDescriptor.GetOptions().GetCcGenericServices() +} + +func (f *file) JavaGenericServices() bool { + return f.fileDescriptor.GetOptions().GetJavaGenericServices() +} + +func (f *file) PyGenericServices() bool { + return f.fileDescriptor.GetOptions().GetPyGenericServices() +} + +func (f *file) PhpGenericServices() bool { + return f.fileDescriptor.GetOptions().GetPhpGenericServices() +} + +func (f *file) CcEnableArenas() bool { + return f.fileDescriptor.GetOptions().GetCcEnableArenas() +} + +func (f *file) PackageLocation() Location { + return f.getLocationByPathKey(packagePathKey) +} + +func (f *file) CsharpNamespaceLocation() Location { + return f.getLocationByPathKey(csharpNamespacePathKey) +} + +func (f *file) GoPackageLocation() Location { + return f.getLocationByPathKey(goPackagePathKey) +} + +func (f *file) JavaMultipleFilesLocation() Location { + return f.getLocationByPathKey(javaMultipleFilesPathKey) +} + +func (f *file) JavaOuterClassnameLocation() Location { + return f.getLocationByPathKey(javaOuterClassnamePathKey) +} + +func (f *file) JavaPackageLocation() Location { + return f.getLocationByPathKey(javaPackagePathKey) +} + +func (f *file) JavaStringCheckUtf8Location() Location { + return f.getLocationByPathKey(javaStringCheckUtf8PathKey) +} + +func (f *file) ObjcClassPrefixLocation() Location { + return f.getLocationByPathKey(objcClassPrefixPathKey) +} + +func (f *file) PhpClassPrefixLocation() Location { + return f.getLocationByPathKey(phpClassPrefixPathKey) +} + +func (f *file) PhpNamespaceLocation() Location { + return f.getLocationByPathKey(phpNamespacePathKey) +} + +func (f *file) PhpMetadataNamespaceLocation() Location { + return f.getLocationByPathKey(phpMetadataNamespacePathKey) +} + +func (f *file) RubyPackageLocation() Location { + return f.getLocationByPathKey(rubyPackagePathKey) +} + +func (f *file) SwiftPrefixLocation() Location { + return f.getLocationByPathKey(swiftPrefixPathKey) +} + +func (f *file) OptimizeForLocation() Location { + return f.getLocationByPathKey(optimizeForPathKey) +} + +func (f *file) CcGenericServicesLocation() Location { + return f.getLocationByPathKey(ccGenericServicesPathKey) +} + +func (f *file) JavaGenericServicesLocation() Location { + return f.getLocationByPathKey(javaGenericServicesPathKey) +} + +func (f *file) PyGenericServicesLocation() Location { + return f.getLocationByPathKey(pyGenericServicesPathKey) +} + +func (f *file) PhpGenericServicesLocation() Location { + return f.getLocationByPathKey(phpGenericServicesPathKey) +} + +func (f *file) CcEnableArenasLocation() Location { + return f.getLocationByPathKey(ccEnableArenasPathKey) +} + +func (f *file) SyntaxLocation() Location { + return f.getLocationByPathKey(syntaxPathKey) +} + +// does not validation of the fileDescriptorProto - this is assumed to be done elsewhere +// does no duplicate checking by name - could just have maps ie importToFileImport, enumNameToEnum, etc +func newFile(inputFile InputFile) (*file, error) { + locationStore := newLocationStore(inputFile.FileDescriptor().GetSourceCodeInfo().GetLocation()) + f := &file{ + FileInfo: inputFile, + fileDescriptor: inputFile.FileDescriptor(), + optionExtensionDescriptor: newOptionExtensionDescriptor( + inputFile.FileDescriptor().GetOptions(), + []int32{8}, + locationStore, + ), + edition: inputFile.FileDescriptor().GetEdition(), + } + descriptor := newDescriptor( + f, + locationStore, + ) + f.descriptor = descriptor + + if inputFile.IsSyntaxUnspecified() { + // if the syntax is "proto2", protoc and buf will not set the syntax + // field even if it was explicitly set, this is why we have + // IsSyntaxUnspecified + f.syntax = SyntaxUnspecified + } else { + switch syntaxString := f.fileDescriptor.GetSyntax(); syntaxString { + case "", "proto2": + f.syntax = SyntaxProto2 + case "proto3": + f.syntax = SyntaxProto3 + case "editions": + f.syntax = SyntaxEditions + default: + return nil, fmt.Errorf("unknown syntax: %q", syntaxString) + } + } + + for dependencyIndex, dependency := range f.fileDescriptor.GetDependency() { + fileImport, err := newFileImport( + f.descriptor, + dependency, + getDependencyPath(dependencyIndex), + ) + if err != nil { + return nil, err + } + f.fileImports = append(f.fileImports, fileImport) + } + for _, dependencyIndex := range f.fileDescriptor.GetPublicDependency() { + if int(dependencyIndex) < 0 || len(f.fileImports) <= int(dependencyIndex) { + return nil, fmt.Errorf("got dependency index of %d but length of imports is %d", dependencyIndex, len(f.fileImports)) + } + fileImport, ok := f.fileImports[dependencyIndex].(*fileImport) + if !ok { + return nil, fmt.Errorf("could not cast %T to a *fileImport", f.fileImports[dependencyIndex]) + } + fileImport.setIsPublic() + } + for _, dependencyIndex := range f.fileDescriptor.GetWeakDependency() { + if int(dependencyIndex) < 0 || len(f.fileImports) <= int(dependencyIndex) { + return nil, fmt.Errorf("got dependency index of %d but length of imports is %d", dependencyIndex, len(f.fileImports)) + } + fileImport, ok := f.fileImports[dependencyIndex].(*fileImport) + if !ok { + return nil, fmt.Errorf("could not cast %T to a *fileImport", f.fileImports[dependencyIndex]) + } + fileImport.setIsWeak() + } + for _, dependencyIndex := range inputFile.UnusedDependencyIndexes() { + if int(dependencyIndex) < 0 || len(f.fileImports) <= int(dependencyIndex) { + return nil, fmt.Errorf("got dependency index of %d but length of imports is %d", dependencyIndex, len(f.fileImports)) + } + fileImport, ok := f.fileImports[dependencyIndex].(*fileImport) + if !ok { + return nil, fmt.Errorf("could not cast %T to a *fileImport", f.fileImports[dependencyIndex]) + } + fileImport.setIsUnused() + } + for enumIndex, enumDescriptorProto := range f.fileDescriptor.GetEnumType() { + enum, err := f.populateEnum( + enumDescriptorProto, + enumIndex, + nil, + nil, + nil, + ) + if err != nil { + return nil, err + } + f.enums = append(f.enums, enum) + } + for messageIndex, descriptorProto := range f.fileDescriptor.GetMessageType() { + message, err := f.populateMessage( + descriptorProto, + messageIndex, + nil, + nil, + nil, + ) + if err != nil { + return nil, err + } + f.messages = append(f.messages, message) + } + for serviceIndex, serviceDescriptorProto := range f.fileDescriptor.GetService() { + service, err := f.populateService( + serviceDescriptorProto, + serviceIndex, + ) + if err != nil { + return nil, err + } + f.services = append(f.services, service) + } + for extensionIndex, extensionDescriptorProto := range f.fileDescriptor.GetExtension() { + extension, err := f.populateExtension( + extensionDescriptorProto, + extensionIndex, + ) + if err != nil { + return nil, err + } + f.extensions = append(f.extensions, extension) + } + f.optimizeMode = f.fileDescriptor.GetOptions().GetOptimizeFor() + return f, nil +} + +func (f *file) populateEnum( + enumDescriptorProto *descriptorpb.EnumDescriptorProto, + enumIndex int, + // all message indexes leading to this enum + nestedMessageIndexes []int, + // all message names leading to this enum + nestedMessageNames []string, + parent Message, +) (Enum, error) { + enumNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getEnumPath(enumIndex, nestedMessageIndexes...), + ), + enumDescriptorProto.GetName(), + getEnumNamePath(enumIndex, nestedMessageIndexes...), + nestedMessageNames, + ) + if err != nil { + return nil, err + } + enum := newEnum( + enumNamedDescriptor, + newOptionExtensionDescriptor( + enumDescriptorProto.GetOptions(), + getEnumOptionsPath(enumIndex, nestedMessageIndexes...), + f.descriptor.locationStore, + ), + enumDescriptorProto.GetOptions().GetAllowAlias(), + enumDescriptorProto.GetOptions().GetDeprecatedLegacyJsonFieldConflicts(), + enumDescriptorProto.GetOptions().GetDeprecated(), + getEnumAllowAliasPath(enumIndex, nestedMessageIndexes...), + parent, + ) + + for enumValueIndex, enumValueDescriptorProto := range enumDescriptorProto.GetValue() { + enumValueNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getEnumValuePath(enumIndex, enumValueIndex, nestedMessageIndexes...), + ), + enumValueDescriptorProto.GetName(), + getEnumValueNamePath(enumIndex, enumValueIndex, nestedMessageIndexes...), + append(nestedMessageNames, enum.Name()), + ) + if err != nil { + return nil, err + } + enumValue := newEnumValue( + enumValueNamedDescriptor, + newOptionExtensionDescriptor( + enumValueDescriptorProto.GetOptions(), + getEnumValueOptionsPath(enumIndex, enumValueIndex, nestedMessageIndexes...), + f.descriptor.locationStore, + ), + enum, + int(enumValueDescriptorProto.GetNumber()), + enumValueDescriptorProto.GetOptions().GetDeprecated(), + getEnumValueNumberPath(enumIndex, enumValueIndex, nestedMessageIndexes...), + ) + enum.addValue(enumValue) + } + + for reservedRangeIndex, reservedRangeDescriptorProto := range enumDescriptorProto.GetReservedRange() { + reservedRangeLocationDescriptor := newLocationDescriptor( + f.descriptor, + getEnumReservedRangePath(enumIndex, reservedRangeIndex, nestedMessageIndexes...), + ) + reservedEnumRange := newEnumRange( + reservedRangeLocationDescriptor, + enum, + int(reservedRangeDescriptorProto.GetStart()), + int(reservedRangeDescriptorProto.GetEnd()), + ) + enum.addReservedEnumRange(reservedEnumRange) + } + for reservedNameIndex, reservedNameValue := range enumDescriptorProto.GetReservedName() { + reservedNameLocationDescriptor := newLocationDescriptor( + f.descriptor, + getEnumReservedNamePath(enumIndex, reservedNameIndex, nestedMessageIndexes...), + ) + reservedName, err := newReservedName( + reservedNameLocationDescriptor, + reservedNameValue, + ) + if err != nil { + return nil, err + } + enum.addReservedName(reservedName) + } + return enum, nil +} + +func (f *file) populateMessage( + descriptorProto *descriptorpb.DescriptorProto, + // always stays the same on every recursive call + topLevelMessageIndex int, + // includes descriptorProto index + nestedMessageIndexes []int, + // does NOT include descriptorProto.GetName() + nestedMessageNames []string, + parent Message, +) (Message, error) { + messageNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getMessagePath(topLevelMessageIndex, nestedMessageIndexes...), + ), + descriptorProto.GetName(), + getMessageNamePath(topLevelMessageIndex, nestedMessageIndexes...), + nestedMessageNames, + ) + if err != nil { + return nil, err + } + message := newMessage( + messageNamedDescriptor, + newOptionExtensionDescriptor( + descriptorProto.GetOptions(), + getMessageOptionsPath(topLevelMessageIndex, nestedMessageIndexes...), + f.descriptor.locationStore, + ), + parent, + descriptorProto.GetOptions().GetMapEntry(), + descriptorProto.GetOptions().GetMessageSetWireFormat(), + descriptorProto.GetOptions().GetNoStandardDescriptorAccessor(), + descriptorProto.GetOptions().GetDeprecatedLegacyJsonFieldConflicts(), + descriptorProto.GetOptions().GetDeprecated(), + getMessageMessageSetWireFormatPath(topLevelMessageIndex, nestedMessageIndexes...), + getMessageNoStandardDescriptorAccessorPath(topLevelMessageIndex, nestedMessageIndexes...), + ) + oneofIndexToOneof := make(map[int]*oneof) + for oneofIndex, oneofDescriptorProto := range descriptorProto.GetOneofDecl() { + oneofNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getMessageOneofPath(oneofIndex, topLevelMessageIndex, nestedMessageIndexes...), + ), + oneofDescriptorProto.GetName(), + getMessageOneofNamePath(oneofIndex, topLevelMessageIndex, nestedMessageIndexes...), + append(nestedMessageNames, message.Name()), + ) + if err != nil { + return nil, err + } + oneof := newOneof( + oneofNamedDescriptor, + newOptionExtensionDescriptor( + oneofDescriptorProto.GetOptions(), + getMessageOneofOptionsPath(oneofIndex, topLevelMessageIndex, nestedMessageIndexes...), + f.descriptor.locationStore, + ), + message, + ) + message.addOneof(oneof) + oneofIndexToOneof[oneofIndex] = oneof + } + for fieldIndex, fieldDescriptorProto := range descriptorProto.GetField() { + // TODO: not working for map entries + fieldNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + ), + fieldDescriptorProto.GetName(), + getMessageFieldNamePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + append(nestedMessageNames, message.Name()), + ) + if err != nil { + return nil, err + } + var packed *bool + if fieldDescriptorProto.Options != nil { + packed = fieldDescriptorProto.GetOptions().Packed + } + var oneof *oneof + var ok bool + if fieldDescriptorProto.OneofIndex != nil { + oneofIndex := int(*fieldDescriptorProto.OneofIndex) + oneof, ok = oneofIndexToOneof[oneofIndex] + if !ok { + return nil, fmt.Errorf("no oneof for index %d", oneofIndex) + } + } + field := newField( + fieldNamedDescriptor, + newOptionExtensionDescriptor( + fieldDescriptorProto.GetOptions(), + getMessageFieldOptionsPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + f.descriptor.locationStore, + ), + message, + int(fieldDescriptorProto.GetNumber()), + fieldDescriptorProto.GetLabel(), + fieldDescriptorProto.GetType(), + strings.TrimPrefix(fieldDescriptorProto.GetTypeName(), "."), + strings.TrimPrefix(fieldDescriptorProto.GetExtendee(), "."), + oneof, + fieldDescriptorProto.GetProto3Optional(), + fieldDescriptorProto.GetJsonName(), + fieldDescriptorProto.GetOptions().GetJstype(), + fieldDescriptorProto.GetOptions().GetCtype(), + fieldDescriptorProto.GetOptions().GetRetention(), + fieldDescriptorProto.GetOptions().GetTargets(), + fieldDescriptorProto.GetOptions().GetDebugRedact(), + packed, + fieldDescriptorProto.GetOptions().GetDeprecated(), + getMessageFieldNumberPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageFieldTypePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageFieldTypeNamePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageFieldJSONNamePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageFieldJSTypePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageFieldCTypePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageFieldPackedPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageFieldExtendeePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + ) + message.addField(field) + if oneof != nil { + oneof.addField(field) + } + } + for fieldIndex, fieldDescriptorProto := range descriptorProto.GetExtension() { + fieldNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getMessageExtensionPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + ), + fieldDescriptorProto.GetName(), + getMessageExtensionNamePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + append(nestedMessageNames, message.Name()), + ) + if err != nil { + return nil, err + } + var packed *bool + if fieldDescriptorProto.Options != nil { + packed = fieldDescriptorProto.GetOptions().Packed + } + var oneof *oneof + var ok bool + if fieldDescriptorProto.OneofIndex != nil { + oneofIndex := int(*fieldDescriptorProto.OneofIndex) + oneof, ok = oneofIndexToOneof[oneofIndex] + if !ok { + return nil, fmt.Errorf("no oneof for index %d", oneofIndex) + } + } + field := newField( + fieldNamedDescriptor, + newOptionExtensionDescriptor( + fieldDescriptorProto.GetOptions(), + getMessageExtensionOptionsPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + f.descriptor.locationStore, + ), + message, + int(fieldDescriptorProto.GetNumber()), + fieldDescriptorProto.GetLabel(), + fieldDescriptorProto.GetType(), + strings.TrimPrefix(fieldDescriptorProto.GetTypeName(), "."), + strings.TrimPrefix(fieldDescriptorProto.GetExtendee(), "."), + oneof, + fieldDescriptorProto.GetProto3Optional(), + fieldDescriptorProto.GetJsonName(), + fieldDescriptorProto.GetOptions().GetJstype(), + fieldDescriptorProto.GetOptions().GetCtype(), + fieldDescriptorProto.GetOptions().GetRetention(), + fieldDescriptorProto.GetOptions().GetTargets(), + fieldDescriptorProto.GetOptions().GetDebugRedact(), + packed, + fieldDescriptorProto.GetOptions().GetDeprecated(), + getMessageExtensionNumberPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageExtensionTypePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageExtensionTypeNamePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageExtensionJSONNamePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageExtensionJSTypePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageExtensionCTypePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageExtensionPackedPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + getMessageExtensionExtendeePath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), + ) + if err != nil { + return nil, err + } + message.addExtension(field) + if oneof != nil { + oneof.addField(field) + } + } + for reservedRangeIndex, reservedRangeDescriptorProto := range descriptorProto.GetReservedRange() { + reservedRangeLocationDescriptor := newLocationDescriptor( + f.descriptor, + getMessageReservedRangePath(reservedRangeIndex, topLevelMessageIndex, nestedMessageIndexes...), + ) + reservedMessageRange := newMessageRange( + reservedRangeLocationDescriptor, + message, + int(reservedRangeDescriptorProto.GetStart()), + int(reservedRangeDescriptorProto.GetEnd()), + ) + message.addReservedMessageRange(reservedMessageRange) + } + for reservedNameIndex, reservedNameValue := range descriptorProto.GetReservedName() { + reservedNameLocationDescriptor := newLocationDescriptor( + f.descriptor, + getMessageReservedNamePath(reservedNameIndex, topLevelMessageIndex, nestedMessageIndexes...), + ) + reservedName, err := newReservedName( + reservedNameLocationDescriptor, + reservedNameValue, + ) + if err != nil { + return nil, err + } + message.addReservedName(reservedName) + } + for extensionRangeIndex, extensionRangeDescriptorProto := range descriptorProto.GetExtensionRange() { + extensionRangeLocationDescriptor := newLocationDescriptor( + f.descriptor, + getMessageExtensionRangePath(extensionRangeIndex, topLevelMessageIndex, nestedMessageIndexes...), + ) + extensionMessageRange := newExtensionRange( + extensionRangeLocationDescriptor, + message, + int(extensionRangeDescriptorProto.GetStart()), + int(extensionRangeDescriptorProto.GetEnd()), + newOptionExtensionDescriptor( + extensionRangeDescriptorProto.GetOptions(), + getMessageExtensionRangeOptionsPath(extensionRangeIndex, topLevelMessageIndex, nestedMessageIndexes...), + f.descriptor.locationStore, + ), + ) + message.addExtensionRange(extensionMessageRange) + } + for enumIndex, enumDescriptorProto := range descriptorProto.GetEnumType() { + nestedEnum, err := f.populateEnum( + enumDescriptorProto, + enumIndex, + // this is all of the message indexes including this one + // TODO we should refactor get.*Path messages to be more consistent + append([]int{topLevelMessageIndex}, nestedMessageIndexes...), + append(nestedMessageNames, message.Name()), + message, + ) + if err != nil { + return nil, err + } + message.addNestedEnum(nestedEnum) + } + for nestedMessageIndex, nestedMessageDescriptorProto := range descriptorProto.GetNestedType() { + nestedMessage, err := f.populateMessage( + nestedMessageDescriptorProto, + topLevelMessageIndex, + append(nestedMessageIndexes, nestedMessageIndex), + append(nestedMessageNames, message.Name()), + message, + ) + if err != nil { + return nil, err + } + message.addNestedMessage(nestedMessage) + } + return message, nil +} + +func (f *file) populateService( + serviceDescriptorProto *descriptorpb.ServiceDescriptorProto, + serviceIndex int, +) (Service, error) { + serviceNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getServicePath(serviceIndex), + ), + serviceDescriptorProto.GetName(), + getServiceNamePath(serviceIndex), + nil, + ) + if err != nil { + return nil, err + } + service := newService( + serviceNamedDescriptor, + newOptionExtensionDescriptor( + serviceDescriptorProto.GetOptions(), + getServiceOptionsPath(serviceIndex), + f.descriptor.locationStore, + ), + serviceDescriptorProto.GetOptions().GetDeprecated(), + ) + for methodIndex, methodDescriptorProto := range serviceDescriptorProto.GetMethod() { + methodNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getMethodPath(serviceIndex, methodIndex), + ), + methodDescriptorProto.GetName(), + getMethodNamePath(serviceIndex, methodIndex), + []string{service.Name()}, + ) + if err != nil { + return nil, err + } + method, err := newMethod( + methodNamedDescriptor, + newOptionExtensionDescriptor( + methodDescriptorProto.GetOptions(), + getMethodOptionsPath(serviceIndex, methodIndex), + f.descriptor.locationStore, + ), + service, + strings.TrimPrefix(methodDescriptorProto.GetInputType(), "."), + strings.TrimPrefix(methodDescriptorProto.GetOutputType(), "."), + methodDescriptorProto.GetClientStreaming(), + methodDescriptorProto.GetServerStreaming(), + methodDescriptorProto.GetOptions().GetDeprecated(), + getMethodInputTypePath(serviceIndex, methodIndex), + getMethodOutputTypePath(serviceIndex, methodIndex), + methodDescriptorProto.GetOptions().GetIdempotencyLevel(), + getMethodIdempotencyLevelPath(serviceIndex, methodIndex), + ) + if err != nil { + return nil, err + } + service.addMethod(method) + } + return service, nil +} + +func (f *file) populateExtension( + fieldDescriptorProto *descriptorpb.FieldDescriptorProto, + fieldIndex int, +) (Field, error) { + fieldNamedDescriptor, err := newNamedDescriptor( + newLocationDescriptor( + f.descriptor, + getFileExtensionPath(fieldIndex), + ), + fieldDescriptorProto.GetName(), + getFileExtensionNamePath(fieldIndex), + nil, + ) + if err != nil { + return nil, err + } + var packed *bool + if fieldDescriptorProto.Options != nil { + packed = fieldDescriptorProto.GetOptions().Packed + } + return newField( + fieldNamedDescriptor, + newOptionExtensionDescriptor( + fieldDescriptorProto.GetOptions(), + getFileExtensionOptionsPath(fieldIndex), + f.descriptor.locationStore, + ), + nil, + int(fieldDescriptorProto.GetNumber()), + fieldDescriptorProto.GetLabel(), + fieldDescriptorProto.GetType(), + strings.TrimPrefix(fieldDescriptorProto.GetTypeName(), "."), + strings.TrimPrefix(fieldDescriptorProto.GetExtendee(), "."), + nil, + fieldDescriptorProto.GetProto3Optional(), + fieldDescriptorProto.GetJsonName(), + fieldDescriptorProto.GetOptions().GetJstype(), + fieldDescriptorProto.GetOptions().GetCtype(), + fieldDescriptorProto.GetOptions().GetRetention(), + fieldDescriptorProto.GetOptions().GetTargets(), + fieldDescriptorProto.GetOptions().GetDebugRedact(), + packed, + fieldDescriptorProto.GetOptions().GetDeprecated(), + getFileExtensionNumberPath(fieldIndex), + getFileExtensionTypePath(fieldIndex), + getFileExtensionTypeNamePath(fieldIndex), + getFileExtensionJSONNamePath(fieldIndex), + getFileExtensionJSTypePath(fieldIndex), + getFileExtensionCTypePath(fieldIndex), + getFileExtensionPackedPath(fieldIndex), + getFileExtensionExtendeePath(fieldIndex), + ), nil +} diff --git a/pkg/bufman/pkg/protosource/file_import.go b/pkg/bufman/pkg/protosource/file_import.go new file mode 100644 index 000000000..e898af018 --- /dev/null +++ b/pkg/bufman/pkg/protosource/file_import.go @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import "fmt" + +type fileImport struct { + descriptor + + imp string + isPublic bool + isWeak bool + isUnused bool + path []int32 +} + +func newFileImport( + descriptor descriptor, + imp string, + path []int32, +) (*fileImport, error) { + if imp == "" { + return nil, fmt.Errorf("no dependency value in %q", descriptor.File().Path()) + } + return &fileImport{ + descriptor: descriptor, + imp: imp, + path: path, + }, nil +} + +func (f *fileImport) Import() string { + return f.imp +} + +func (f *fileImport) IsPublic() bool { + return f.isPublic +} + +func (f *fileImport) IsWeak() bool { + return f.isWeak +} + +func (f *fileImport) IsUnused() bool { + return f.isUnused +} + +func (f *fileImport) Location() Location { + return f.getLocation(f.path) +} + +func (f *fileImport) setIsPublic() { + f.isPublic = true +} + +func (f *fileImport) setIsWeak() { + f.isWeak = true +} + +func (f *fileImport) setIsUnused() { + f.isUnused = true +} diff --git a/pkg/bufman/pkg/protosource/files.go b/pkg/bufman/pkg/protosource/files.go new file mode 100644 index 000000000..5766b8f11 --- /dev/null +++ b/pkg/bufman/pkg/protosource/files.go @@ -0,0 +1,106 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" + "go.uber.org/multierr" +) + +const defaultChunkSizeThreshold = 8 + +func newFilesUnstable(ctx context.Context, inputFiles ...InputFile) ([]File, error) { + if len(inputFiles) == 0 { + return nil, nil + } + + chunkSize := len(inputFiles) / thread.Parallelism() + if defaultChunkSizeThreshold != 0 && chunkSize < defaultChunkSizeThreshold { + files := make([]File, 0, len(inputFiles)) + for _, inputFile := range inputFiles { + file, err := NewFile(inputFile) + if err != nil { + return nil, err + } + files = append(files, file) + } + return files, nil + } + + chunks := inputFilesToChunks(inputFiles, chunkSize) + resultC := make(chan *result, len(chunks)) + for _, inputFileChunk := range chunks { + inputFileChunk := inputFileChunk + go func() { + files := make([]File, 0, len(inputFileChunk)) + for _, inputFile := range inputFileChunk { + file, err := NewFile(inputFile) + if err != nil { + resultC <- newResult(nil, err) + return + } + files = append(files, file) + } + resultC <- newResult(files, nil) + }() + } + files := make([]File, 0, len(inputFiles)) + var err error + for i := 0; i < len(chunks); i++ { + select { + case <-ctx.Done(): + return nil, ctx.Err() + case result := <-resultC: + files = append(files, result.Files...) + err = multierr.Append(err, result.Err) + } + } + if err != nil { + return nil, err + } + return files, nil +} + +func inputFilesToChunks(s []InputFile, chunkSize int) [][]InputFile { + var chunks [][]InputFile + if len(s) == 0 { + return chunks + } + if chunkSize <= 0 { + return [][]InputFile{s} + } + c := make([]InputFile, len(s)) + copy(c, s) + // https://github.com/golang/go/wiki/SliceTricks#batching-with-minimal-allocation + for chunkSize < len(c) { + c, chunks = c[chunkSize:], append(chunks, c[0:chunkSize:chunkSize]) + } + return append(chunks, c) +} + +type result struct { + Files []File + Err error +} + +func newResult(files []File, err error) *result { + return &result{ + Files: files, + Err: err, + } +} diff --git a/pkg/bufman/pkg/protosource/location.go b/pkg/bufman/pkg/protosource/location.go new file mode 100644 index 000000000..97abacd0b --- /dev/null +++ b/pkg/bufman/pkg/protosource/location.go @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import "google.golang.org/protobuf/types/descriptorpb" + +type location struct { + sourceCodeInfoLocation *descriptorpb.SourceCodeInfo_Location +} + +func newLocation(sourceCodeInfoLocation *descriptorpb.SourceCodeInfo_Location) *location { + return &location{ + sourceCodeInfoLocation: sourceCodeInfoLocation, + } +} + +func (l *location) StartLine() int { + switch len(l.sourceCodeInfoLocation.Span) { + case 3, 4: + return int(l.sourceCodeInfoLocation.Span[0]) + 1 + default: + // since we are not erroring, making this and others 1 so that other code isn't messed up by assuming + // this is >= 1 + return 1 + } +} + +func (l *location) StartColumn() int { + switch len(l.sourceCodeInfoLocation.Span) { + case 3, 4: + return int(l.sourceCodeInfoLocation.Span[1]) + 1 + default: + // since we are not erroring, making this and others 1 so that other code isn't messed up by assuming + // this is >= 1 + return 1 + } +} + +func (l *location) EndLine() int { + switch len(l.sourceCodeInfoLocation.Span) { + case 3: + return int(l.sourceCodeInfoLocation.Span[0]) + 1 + case 4: + return int(l.sourceCodeInfoLocation.Span[2]) + 1 + default: + // since we are not erroring, making this and others 1 so that other code isn't messed up by assuming + // this is >= 1 + return 1 + } +} + +func (l *location) EndColumn() int { + switch len(l.sourceCodeInfoLocation.Span) { + case 3: + return int(l.sourceCodeInfoLocation.Span[2]) + 1 + case 4: + return int(l.sourceCodeInfoLocation.Span[3]) + 1 + default: + // since we are not erroring, making this and others 1 so that other code isn't messed up by assuming + // this is >= 1 + return 1 + } +} + +func (l *location) LeadingComments() string { + if l.sourceCodeInfoLocation.LeadingComments == nil { + return "" + } + return *l.sourceCodeInfoLocation.LeadingComments +} + +func (l *location) TrailingComments() string { + if l.sourceCodeInfoLocation.TrailingComments == nil { + return "" + } + return *l.sourceCodeInfoLocation.TrailingComments +} + +func (l *location) LeadingDetachedComments() []string { + return l.sourceCodeInfoLocation.LeadingDetachedComments +} diff --git a/pkg/bufman/pkg/protosource/location_descriptor.go b/pkg/bufman/pkg/protosource/location_descriptor.go new file mode 100644 index 000000000..2653e7197 --- /dev/null +++ b/pkg/bufman/pkg/protosource/location_descriptor.go @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +type locationDescriptor struct { + descriptor + + path []int32 +} + +func newLocationDescriptor( + descriptor descriptor, + path []int32, +) locationDescriptor { + return locationDescriptor{ + descriptor: descriptor, + path: path, + } +} + +func (l *locationDescriptor) Location() Location { + return l.getLocation(l.path) +} diff --git a/pkg/bufman/pkg/protosource/location_store.go b/pkg/bufman/pkg/protosource/location_store.go new file mode 100644 index 000000000..638e7c596 --- /dev/null +++ b/pkg/bufman/pkg/protosource/location_store.go @@ -0,0 +1,72 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import ( + "sync" + + "google.golang.org/protobuf/types/descriptorpb" +) + +type locationStore struct { + sourceCodeInfoLocations []*descriptorpb.SourceCodeInfo_Location + + initLocations sync.Once + pathToLocation map[string]Location +} + +func newLocationStore(sourceCodeInfoLocations []*descriptorpb.SourceCodeInfo_Location) *locationStore { + return &locationStore{ + sourceCodeInfoLocations: sourceCodeInfoLocations, + pathToLocation: make(map[string]Location), + } +} + +func (l *locationStore) getLocation(path []int32) Location { + return l.getLocationByPathKey(getPathKey(path)) +} + +func (l *locationStore) getLocationByPathKey(pathKey string) Location { + l.initLocations.Do(func() { + pathToLocation := make(map[string]Location) + for _, sourceCodeInfoLocation := range l.sourceCodeInfoLocations { + pathKey := getPathKey(sourceCodeInfoLocation.Path) + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + if _, ok := pathToLocation[pathKey]; !ok { + pathToLocation[pathKey] = newLocation(sourceCodeInfoLocation) + } + } + l.pathToLocation = pathToLocation + }) + + return l.pathToLocation[pathKey] +} + +func getPathKey(path []int32) string { + key := make([]byte, len(path)*4) + j := 0 + for _, elem := range path { + key[j] = byte(elem) + key[j+1] = byte(elem >> 8) + key[j+2] = byte(elem >> 16) + key[j+3] = byte(elem >> 24) + j += 4 + } + return string(key) +} diff --git a/pkg/bufman/pkg/protosource/merge_comment_location.go b/pkg/bufman/pkg/protosource/merge_comment_location.go new file mode 100644 index 000000000..9bceec262 --- /dev/null +++ b/pkg/bufman/pkg/protosource/merge_comment_location.go @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +type mergeCommentLocation struct { + base Location + delegate Location + baseHasComments bool +} + +func newMergeCommentLocation(base Location, delegate Location) *mergeCommentLocation { + return &mergeCommentLocation{ + base: base, + delegate: delegate, + baseHasComments: base.LeadingComments() != "" || base.TrailingComments() != "" || len(base.LeadingDetachedComments()) > 0, + } +} + +func (l *mergeCommentLocation) StartLine() int { + return l.base.StartLine() +} + +func (l *mergeCommentLocation) StartColumn() int { + return l.base.StartColumn() +} + +func (l *mergeCommentLocation) EndLine() int { + return l.base.EndLine() +} + +func (l *mergeCommentLocation) EndColumn() int { + return l.base.EndColumn() +} + +func (l *mergeCommentLocation) LeadingComments() string { + if l.baseHasComments { + return l.base.LeadingComments() + } + return l.delegate.LeadingComments() +} + +func (l *mergeCommentLocation) TrailingComments() string { + if l.baseHasComments { + return l.base.TrailingComments() + } + return l.delegate.TrailingComments() +} + +func (l *mergeCommentLocation) LeadingDetachedComments() []string { + if l.baseHasComments { + return l.base.LeadingDetachedComments() + } + return l.delegate.LeadingDetachedComments() +} diff --git a/pkg/bufman/pkg/protosource/message.go b/pkg/bufman/pkg/protosource/message.go new file mode 100644 index 000000000..d592260fd --- /dev/null +++ b/pkg/bufman/pkg/protosource/message.go @@ -0,0 +1,176 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +type message struct { + namedDescriptor + optionExtensionDescriptor + + fields []Field + extensions []Field + nestedMessages []Message + nestedEnums []Enum + oneofs []Oneof + reservedMessageRanges []MessageRange + reservedNames []ReservedName + extensionRanges []ExtensionRange + parent Message + isMapEntry bool + messageSetWireFormat bool + noStandardDescriptorAccessor bool + deprecatedLegacyJSONFieldConflicts bool + deprecated bool + messageSetWireFormatPath []int32 + noStandardDescriptorAccessorPath []int32 +} + +func newMessage( + namedDescriptor namedDescriptor, + optionExtensionDescriptor optionExtensionDescriptor, + parent Message, + isMapEntry bool, + messageSetWireFormat bool, + noStandardDescriptorAccessor bool, + deprecatedLegacyJSONFieldConflicts bool, + deprecated bool, + messageSetWireFormatPath []int32, + noStandardDescriptorAccessorPath []int32, +) *message { + return &message{ + namedDescriptor: namedDescriptor, + optionExtensionDescriptor: optionExtensionDescriptor, + parent: parent, + isMapEntry: isMapEntry, + messageSetWireFormat: messageSetWireFormat, + noStandardDescriptorAccessor: noStandardDescriptorAccessor, + deprecatedLegacyJSONFieldConflicts: deprecatedLegacyJSONFieldConflicts, + deprecated: deprecated, + messageSetWireFormatPath: messageSetWireFormatPath, + noStandardDescriptorAccessorPath: noStandardDescriptorAccessorPath, + } +} + +func (m *message) Fields() []Field { + return m.fields +} + +func (m *message) Extensions() []Field { + return m.extensions +} + +func (m *message) Messages() []Message { + return m.nestedMessages +} + +func (m *message) Enums() []Enum { + return m.nestedEnums +} + +func (m *message) Oneofs() []Oneof { + return m.oneofs +} + +func (m *message) ReservedMessageRanges() []MessageRange { + return m.reservedMessageRanges +} + +func (m *message) ReservedTagRanges() []TagRange { + tagRanges := make([]TagRange, len(m.reservedMessageRanges)) + for i, reservedMessageRange := range m.reservedMessageRanges { + tagRanges[i] = reservedMessageRange + } + return tagRanges +} + +func (m *message) ReservedNames() []ReservedName { + return m.reservedNames +} + +func (m *message) ExtensionRanges() []ExtensionRange { + return m.extensionRanges +} + +func (m *message) ExtensionMessageRanges() []MessageRange { + extMsgRanges := make([]MessageRange, len(m.extensionRanges)) + for i, extensionRange := range m.extensionRanges { + extMsgRanges[i] = extensionRange + } + return extMsgRanges +} + +func (m *message) Parent() Message { + return m.parent +} + +func (m *message) IsMapEntry() bool { + return m.isMapEntry +} + +func (m *message) MessageSetWireFormat() bool { + return m.messageSetWireFormat +} + +func (m *message) NoStandardDescriptorAccessor() bool { + return m.noStandardDescriptorAccessor +} + +func (m *message) DeprecatedLegacyJSONFieldConflicts() bool { + return m.deprecatedLegacyJSONFieldConflicts +} + +func (m *message) Deprecated() bool { + return m.deprecated +} + +func (m *message) MessageSetWireFormatLocation() Location { + return m.getLocation(m.messageSetWireFormatPath) +} + +func (m *message) NoStandardDescriptorAccessorLocation() Location { + return m.getLocation(m.noStandardDescriptorAccessorPath) +} + +func (m *message) addField(field Field) { + m.fields = append(m.fields, field) +} + +func (m *message) addExtension(extension Field) { + m.extensions = append(m.extensions, extension) +} + +func (m *message) addNestedMessage(nestedMessage Message) { + m.nestedMessages = append(m.nestedMessages, nestedMessage) +} + +func (m *message) addNestedEnum(nestedEnum Enum) { + m.nestedEnums = append(m.nestedEnums, nestedEnum) +} + +func (m *message) addOneof(oneof Oneof) { + m.oneofs = append(m.oneofs, oneof) +} + +func (m *message) addReservedMessageRange(reservedMessageRange MessageRange) { + m.reservedMessageRanges = append(m.reservedMessageRanges, reservedMessageRange) +} + +func (m *message) addReservedName(reservedName ReservedName) { + m.reservedNames = append(m.reservedNames, reservedName) +} + +func (m *message) addExtensionRange(extensionRange ExtensionRange) { + m.extensionRanges = append(m.extensionRanges, extensionRange) +} diff --git a/pkg/bufman/pkg/protosource/message_range.go b/pkg/bufman/pkg/protosource/message_range.go new file mode 100644 index 000000000..d87c994d9 --- /dev/null +++ b/pkg/bufman/pkg/protosource/message_range.go @@ -0,0 +1,95 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +const ( + messageRangeInclusiveMax = 536870911 +) + +type messageRange struct { + locationDescriptor + + message Message + start int + end int +} + +func newMessageRange( + locationDescriptor locationDescriptor, + message Message, + start int, + end int, +) *messageRange { + return &messageRange{ + locationDescriptor: locationDescriptor, + message: message, + start: start, + // end is exclusive for messages + end: end - 1, + } +} + +func newFreeMessageRange(message Message, start int, endInclusive int) MessageRange { + return newMessageRange( + newLocationDescriptor( + newDescriptor( + message.File(), + nil, + ), + nil, + ), + message, + start, + // we expect exclusive for newMessageRange + endInclusive+1, + ) +} + +func (r *messageRange) Message() Message { + return r.message +} + +func (r *messageRange) Start() int { + return r.start +} + +func (r *messageRange) End() int { + return r.end +} + +func (r *messageRange) Max() bool { + return r.end == messageRangeInclusiveMax +} + +type extensionRange struct { + *messageRange + optionExtensionDescriptor +} + +func newExtensionRange( + locationDescriptor locationDescriptor, + message Message, + start int, + end int, + opts optionExtensionDescriptor, +) *extensionRange { + return &extensionRange{ + messageRange: newMessageRange( + locationDescriptor, message, start, end, + ), + optionExtensionDescriptor: opts, + } +} diff --git a/pkg/bufman/pkg/protosource/method.go b/pkg/bufman/pkg/protosource/method.go new file mode 100644 index 000000000..04509eb62 --- /dev/null +++ b/pkg/bufman/pkg/protosource/method.go @@ -0,0 +1,114 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import ( + "fmt" + + "google.golang.org/protobuf/types/descriptorpb" +) + +type method struct { + namedDescriptor + optionExtensionDescriptor + + service Service + inputTypeName string + outputTypeName string + clientStreaming bool + serverStreaming bool + deprecated bool + inputTypePath []int32 + outputTypePath []int32 + idempotencyLevel descriptorpb.MethodOptions_IdempotencyLevel + idempotencyLevelPath []int32 +} + +func newMethod( + namedDescriptor namedDescriptor, + optionExtensionDescriptor optionExtensionDescriptor, + service Service, + inputTypeName string, + outputTypeName string, + clientStreaming bool, + serverStreaming bool, + deprecated bool, + inputTypePath []int32, + outputTypePath []int32, + idempotencyLevel descriptorpb.MethodOptions_IdempotencyLevel, + idempotencyLevelPath []int32, +) (*method, error) { + if inputTypeName == "" { + return nil, fmt.Errorf("no inputTypeName on %q", namedDescriptor.name) + } + if outputTypeName == "" { + return nil, fmt.Errorf("no outputTypeName on %q", namedDescriptor.name) + } + return &method{ + namedDescriptor: namedDescriptor, + optionExtensionDescriptor: optionExtensionDescriptor, + service: service, + inputTypeName: inputTypeName, + outputTypeName: outputTypeName, + clientStreaming: clientStreaming, + serverStreaming: serverStreaming, + deprecated: deprecated, + inputTypePath: inputTypePath, + outputTypePath: outputTypePath, + idempotencyLevel: idempotencyLevel, + idempotencyLevelPath: idempotencyLevelPath, + }, nil +} + +func (m *method) Service() Service { + return m.service +} + +func (m *method) InputTypeName() string { + return m.inputTypeName +} + +func (m *method) OutputTypeName() string { + return m.outputTypeName +} + +func (m *method) ClientStreaming() bool { + return m.clientStreaming +} + +func (m *method) ServerStreaming() bool { + return m.serverStreaming +} + +func (m *method) Deprecated() bool { + return m.deprecated +} + +func (m *method) InputTypeLocation() Location { + return m.getLocation(m.inputTypePath) +} + +func (m *method) OutputTypeLocation() Location { + return m.getLocation(m.outputTypePath) +} + +func (m *method) IdempotencyLevel() descriptorpb.MethodOptions_IdempotencyLevel { + return m.idempotencyLevel +} + +func (m *method) IdempotencyLevelLocation() Location { + return m.getLocation(m.idempotencyLevelPath) +} diff --git a/pkg/bufman/pkg/protosource/named_descriptor.go b/pkg/bufman/pkg/protosource/named_descriptor.go new file mode 100644 index 000000000..edeeaf7ec --- /dev/null +++ b/pkg/bufman/pkg/protosource/named_descriptor.go @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import ( + "fmt" + "strings" +) + +type namedDescriptor struct { + locationDescriptor + + name string + namePath []int32 + nestedNames []string +} + +func newNamedDescriptor( + locationDescriptor locationDescriptor, + name string, + namePath []int32, + nestedNames []string, +) (namedDescriptor, error) { + if name == "" { + return namedDescriptor{}, fmt.Errorf("no name in %q", locationDescriptor.File().Path()) + } + return namedDescriptor{ + locationDescriptor: locationDescriptor, + name: name, + namePath: namePath, + nestedNames: nestedNames, + }, nil +} + +func (n *namedDescriptor) FullName() string { + if n.File().Package() != "" { + return n.File().Package() + "." + n.NestedName() + } + return n.NestedName() +} + +func (n *namedDescriptor) NestedName() string { + if len(n.nestedNames) == 0 { + return n.Name() + } + return strings.Join(n.nestedNames, ".") + "." + n.Name() +} + +func (n *namedDescriptor) Name() string { + return n.name +} + +func (n *namedDescriptor) NameLocation() Location { + nameLocation := n.getLocation(n.namePath) + location := n.getLocation(n.path) + if nameLocation != nil { + if location != nil { + return newMergeCommentLocation(nameLocation, location) + } + return nameLocation + } + return location +} diff --git a/pkg/bufman/pkg/protosource/oneof.go b/pkg/bufman/pkg/protosource/oneof.go new file mode 100644 index 000000000..8cc67bccb --- /dev/null +++ b/pkg/bufman/pkg/protosource/oneof.go @@ -0,0 +1,48 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +type oneof struct { + namedDescriptor + optionExtensionDescriptor + + message Message + fields []Field +} + +func newOneof( + namedDescriptor namedDescriptor, + optionExtensionDescriptor optionExtensionDescriptor, + message Message, +) *oneof { + return &oneof{ + namedDescriptor: namedDescriptor, + optionExtensionDescriptor: optionExtensionDescriptor, + message: message, + } +} + +func (o *oneof) Message() Message { + return o.message +} + +func (o *oneof) Fields() []Field { + return o.fields +} + +func (o *oneof) addField(field Field) { + o.fields = append(o.fields, field) +} diff --git a/pkg/bufman/pkg/protosource/option_extension_descriptor.go b/pkg/bufman/pkg/protosource/option_extension_descriptor.go new file mode 100644 index 000000000..49e1d110e --- /dev/null +++ b/pkg/bufman/pkg/protosource/option_extension_descriptor.go @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import ( + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" +) + +type optionExtensionDescriptor struct { + message proto.Message + optionsPath []int32 + locationStore *locationStore +} + +func newOptionExtensionDescriptor(message proto.Message, optionsPath []int32, locationStore *locationStore) optionExtensionDescriptor { + return optionExtensionDescriptor{ + message: message, + optionsPath: optionsPath, + locationStore: locationStore, + } +} + +func (o *optionExtensionDescriptor) OptionExtension(extensionType protoreflect.ExtensionType) (interface{}, bool) { + if extensionType.TypeDescriptor().ContainingMessage().FullName() != o.message.ProtoReflect().Descriptor().FullName() { + return nil, false + } + if !proto.HasExtension(o.message, extensionType) { + return nil, false + } + return proto.GetExtension(o.message, extensionType), true +} + +func (o *optionExtensionDescriptor) OptionExtensionLocation(extensionType protoreflect.ExtensionType, extraPath ...int32) Location { + if extensionType.TypeDescriptor().ContainingMessage().FullName() != o.message.ProtoReflect().Descriptor().FullName() { + return nil + } + if o.locationStore == nil { + return nil + } + path := make([]int32, len(o.optionsPath), len(o.optionsPath)+1+len(extraPath)) + copy(path, o.optionsPath) + path = append(path, int32(extensionType.TypeDescriptor().Number())) + extensionPathLen := len(path) // length of path to extension (without extraPath) + path = append(path, extraPath...) + loc := o.locationStore.getLocation(path) + if loc != nil { + // Found an exact match! + return loc + } + // "Fuzzy" search: find a location whose path is at least extensionPathLen long, + // preferring the longest matching ancestor path (i.e. as many extraPath elements + // as can be found). If we find a *sub*path (a descendant path, that points INTO + // the path we are trying to find), use the first such one encountered. + var bestMatch *descriptorpb.SourceCodeInfo_Location + var bestMatchPathLen int + for _, loc := range o.locationStore.sourceCodeInfoLocations { + if len(loc.Path) >= extensionPathLen && isDescendantPath(path, loc.Path) && len(loc.Path) > bestMatchPathLen { + bestMatch = loc + bestMatchPathLen = len(loc.Path) + } else if isDescendantPath(loc.Path, path) { + return newLocation(loc) + } + } + if bestMatch != nil { + return newLocation(bestMatch) + } + return nil +} + +func (o *optionExtensionDescriptor) PresentExtensionNumbers() []int32 { + fieldNumbersSet := map[int32]struct{}{} + var fieldNumbers []int32 + addFieldNumber := func(fieldNo int32) { + if _, ok := fieldNumbersSet[fieldNo]; !ok { + fieldNumbersSet[fieldNo] = struct{}{} + fieldNumbers = append(fieldNumbers, fieldNo) + } + } + msg := o.message.ProtoReflect() + extensionRanges := msg.Descriptor().ExtensionRanges() + for b := msg.GetUnknown(); len(b) > 0; { + fieldNo, _, n := protowire.ConsumeField(b) + if extensionRanges.Has(fieldNo) { + addFieldNumber(int32(fieldNo)) + } + b = b[n:] + } + // Extensions for google.protobuf.*Options are a bit of a special case + // as the extensions in a FileDescriptorSet message may differ with + // the extensions defined in the proto with which buf is compiled. + // + // Also loop through known extensions here to get extension numbers. + msg.Range(func(fieldDescriptor protoreflect.FieldDescriptor, _ protoreflect.Value) bool { + if fieldDescriptor.IsExtension() { + addFieldNumber(int32(fieldDescriptor.Number())) + } + return true + }) + + return fieldNumbers +} + +func isDescendantPath(descendant, ancestor []int32) bool { + if len(descendant) < len(ancestor) { + return false + } + for i := range ancestor { + if descendant[i] != ancestor[i] { + return false + } + } + return true +} diff --git a/pkg/bufman/pkg/protosource/option_extension_descriptor_test.go b/pkg/bufman/pkg/protosource/option_extension_descriptor_test.go new file mode 100644 index 000000000..df32322e2 --- /dev/null +++ b/pkg/bufman/pkg/protosource/option_extension_descriptor_test.go @@ -0,0 +1,145 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/dynamicpb" +) + +func TestOptionExtensionLocation(t *testing.T) { + t.Parallel() + locations := []*descriptorpb.SourceCodeInfo_Location{ + { + Path: []int32{1, 2, 3, 4, 5, 1099, 100, 101, 102}, + Span: []int32{99, 100, 101}, + LeadingComments: proto.String("inside custom option 1099 (100)"), + }, + { + Path: []int32{1, 2, 3, 4, 5, 1099, 100, 102, 103}, + Span: []int32{99, 100, 102}, + LeadingComments: proto.String("inside custom option 1099 (100 again)"), + }, + { + Path: []int32{1, 2, 3, 4, 5, 1099, 200}, + Span: []int32{99, 200, 201}, + LeadingComments: proto.String("inside custom option 1099 (200)"), + }, + { + Path: []int32{1, 2, 3, 4, 5, 1089}, + Span: []int32{89, 1, 2}, + LeadingComments: proto.String("custom option 1089"), + }, + { + Path: []int32{1, 2, 3, 4, 5, 1079}, + Span: []int32{79, 1, 2}, + LeadingComments: proto.String("custom option 1079"), + }, + { + Path: []int32{1, 2, 3, 4, 5, 1079}, + Span: []int32{79, 11, 12}, + LeadingComments: proto.String("custom option 1079 (again)"), + }, + { + Path: []int32{1, 2, 3, 4, 5}, + Span: []int32{5, 1, 2}, + LeadingComments: proto.String("options"), + }, + } + locationStore := newLocationStore(locations) + descriptor := newOptionExtensionDescriptor(&descriptorpb.MessageOptions{}, []int32{1, 2, 3, 4, 5}, locationStore) + customOption1079 := makeCustomOption(t, 1079) + customOption1089 := makeCustomOption(t, 1089) + customOption1099 := makeCustomOption(t, 1099) + customOption1109 := makeCustomOption(t, 1109) + + assert.Nil(t, descriptor.OptionExtensionLocation(customOption1109)) + assert.Nil(t, descriptor.OptionExtensionLocation(customOption1099, 100, 103)) + assert.Nil(t, descriptor.OptionExtensionLocation(customOption1099, 300)) + + loc := descriptor.OptionExtensionLocation(customOption1099) + checkLocation(t, loc, locations[0]) + loc = descriptor.OptionExtensionLocation(customOption1099, 100) + checkLocation(t, loc, locations[0]) + loc = descriptor.OptionExtensionLocation(customOption1099, 100, 101) + checkLocation(t, loc, locations[0]) + loc = descriptor.OptionExtensionLocation(customOption1099, 100, 101, 102) + checkLocation(t, loc, locations[0]) + loc = descriptor.OptionExtensionLocation(customOption1099, 100, 101, 102, 103) + checkLocation(t, loc, locations[0]) + + loc = descriptor.OptionExtensionLocation(customOption1099, 100, 102) + checkLocation(t, loc, locations[1]) + loc = descriptor.OptionExtensionLocation(customOption1099, 100, 102, 103) + checkLocation(t, loc, locations[1]) + loc = descriptor.OptionExtensionLocation(customOption1099, 100, 102, 103, 1, 2, 3, 4) + checkLocation(t, loc, locations[1]) + + loc = descriptor.OptionExtensionLocation(customOption1099, 200) + checkLocation(t, loc, locations[2]) + loc = descriptor.OptionExtensionLocation(customOption1099, 200, 0) + checkLocation(t, loc, locations[2]) + + loc = descriptor.OptionExtensionLocation(customOption1089) + checkLocation(t, loc, locations[3]) + loc = descriptor.OptionExtensionLocation(customOption1089, 10) + checkLocation(t, loc, locations[3]) + + loc = descriptor.OptionExtensionLocation(customOption1079) + checkLocation(t, loc, locations[4]) + loc = descriptor.OptionExtensionLocation(customOption1079, 1, 2, 3) + checkLocation(t, loc, locations[4]) +} + +func checkLocation(t *testing.T, loc Location, sourceCodeInfoLoc *descriptorpb.SourceCodeInfo_Location) { + t.Helper() + assert.Equal(t, sourceCodeInfoLoc.GetLeadingComments(), loc.LeadingComments()) + span := []int32{int32(loc.StartLine() - 1), int32(loc.StartColumn() - 1)} + if loc.EndLine() != loc.StartLine() { + span = append(span, int32(loc.EndLine()-1)) + } + span = append(span, int32(loc.EndColumn()-1)) + assert.Equal(t, sourceCodeInfoLoc.Span, span) +} + +func makeCustomOption(t *testing.T, tag int32) protoreflect.ExtensionType { + t.Helper() + fileDescriptorProto := &descriptorpb.FileDescriptorProto{ + Name: proto.String("test.proto"), + Syntax: proto.String("proto2"), + Dependency: []string{"google/protobuf/descriptor.proto"}, + Extension: []*descriptorpb.FieldDescriptorProto{ + { + Name: proto.String("test"), + Number: proto.Int32(tag), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Extendee: proto.String(".google.protobuf.MessageOptions"), + }, + }, + } + fileDescriptor, err := protodesc.NewFile(fileDescriptorProto, protoregistryv1alpha1.GlobalFiles) + require.NoError(t, err) + return dynamicpb.NewExtensionType(fileDescriptor.Extensions().Get(0)) +} diff --git a/pkg/bufman/pkg/protosource/paths.go b/pkg/bufman/pkg/protosource/paths.go new file mode 100644 index 000000000..5b0dacd02 --- /dev/null +++ b/pkg/bufman/pkg/protosource/paths.go @@ -0,0 +1,310 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +var ( + csharpNamespacePathKey = getPathKey([]int32{8, 37}) + goPackagePathKey = getPathKey([]int32{8, 11}) + javaMultipleFilesPathKey = getPathKey([]int32{8, 10}) + javaOuterClassnamePathKey = getPathKey([]int32{8, 8}) + javaPackagePathKey = getPathKey([]int32{8, 1}) + javaStringCheckUtf8PathKey = getPathKey([]int32{8, 27}) + objcClassPrefixPathKey = getPathKey([]int32{8, 36}) + packagePathKey = getPathKey([]int32{2}) + phpClassPrefixPathKey = getPathKey([]int32{8, 40}) + phpNamespacePathKey = getPathKey([]int32{8, 41}) + phpMetadataNamespacePathKey = getPathKey([]int32{8, 44}) + rubyPackagePathKey = getPathKey([]int32{8, 45}) + swiftPrefixPathKey = getPathKey([]int32{8, 39}) + optimizeForPathKey = getPathKey([]int32{8, 9}) + ccGenericServicesPathKey = getPathKey([]int32{8, 16}) + javaGenericServicesPathKey = getPathKey([]int32{8, 17}) + pyGenericServicesPathKey = getPathKey([]int32{8, 18}) + phpGenericServicesPathKey = getPathKey([]int32{8, 42}) + ccEnableArenasPathKey = getPathKey([]int32{8, 31}) + syntaxPathKey = getPathKey([]int32{12}) +) + +func getDependencyPath(dependencyIndex int) []int32 { + return []int32{3, int32(dependencyIndex)} +} + +func getMessagePath(topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + path := []int32{4, int32(topLevelMessageIndex)} + for _, nestedMessageIndex := range nestedMessageIndexes { + path = append(path, 3, int32(nestedMessageIndex)) + } + return path +} + +func getMessageNamePath(messageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(messageIndex, nestedMessageIndexes...), 1) +} + +func getMessageOptionsPath(messageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(messageIndex, nestedMessageIndexes...), 7) +} + +func getMessageMessageSetWireFormatPath(messageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(messageIndex, nestedMessageIndexes...), 7, 1) +} + +func getMessageNoStandardDescriptorAccessorPath(messageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(messageIndex, nestedMessageIndexes...), 7, 2) +} + +func getMessageFieldPath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(topLevelMessageIndex, nestedMessageIndexes...), 2, int32(fieldIndex)) +} + +func getMessageFieldNamePath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 1) +} + +func getMessageFieldNumberPath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 3) +} + +func getMessageFieldTypePath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 5) +} + +func getMessageFieldTypeNamePath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 6) +} + +func getMessageFieldJSONNamePath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 10) +} + +func getMessageFieldOptionsPath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 8) +} + +func getMessageFieldJSTypePath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 8, 6) +} + +func getMessageFieldCTypePath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 8, 1) +} + +func getMessageFieldPackedPath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 8, 2) +} + +func getMessageFieldExtendeePath(fieldIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageFieldPath(fieldIndex, topLevelMessageIndex, nestedMessageIndexes...), 2) +} + +func getMessageExtensionPath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(topLevelMessageIndex, nestedMessageIndexes...), 6, int32(extensionIndex)) +} + +func getMessageExtensionNamePath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 1) +} + +func getMessageExtensionNumberPath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 3) +} + +func getMessageExtensionTypePath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 5) +} + +func getMessageExtensionTypeNamePath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 6) +} + +func getMessageExtensionJSONNamePath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 10) +} + +func getMessageExtensionOptionsPath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 8) +} + +func getMessageExtensionJSTypePath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 8, 6) +} + +func getMessageExtensionCTypePath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 8, 1) +} + +func getMessageExtensionPackedPath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 8, 2) +} + +func getMessageExtensionExtendeePath(extensionIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageExtensionPath(extensionIndex, topLevelMessageIndex, nestedMessageIndexes...), 2) +} + +func getMessageOneofPath(oneofIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(topLevelMessageIndex, nestedMessageIndexes...), 8, int32(oneofIndex)) +} + +func getMessageOneofNamePath(oneofIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageOneofPath(oneofIndex, topLevelMessageIndex, nestedMessageIndexes...), 1) +} + +func getMessageOneofOptionsPath(oneofIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessageOneofPath(oneofIndex, topLevelMessageIndex, nestedMessageIndexes...), 2) +} + +func getMessageReservedRangePath(reservedRangeIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(topLevelMessageIndex, nestedMessageIndexes...), 9, int32(reservedRangeIndex)) +} + +func getMessageReservedNamePath(reservedNameIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(topLevelMessageIndex, nestedMessageIndexes...), 10, int32(reservedNameIndex)) +} + +func getMessageExtensionRangePath(extensionRangeIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(topLevelMessageIndex, nestedMessageIndexes...), 5, int32(extensionRangeIndex)) +} + +func getMessageExtensionRangeOptionsPath(extensionRangeIndex int, topLevelMessageIndex int, nestedMessageIndexes ...int) []int32 { + return append(getMessagePath(topLevelMessageIndex, nestedMessageIndexes...), 5, int32(extensionRangeIndex), 3) +} + +func getEnumPath(enumIndex int, nestedMessageIndexes ...int) []int32 { + if len(nestedMessageIndexes) == 0 { + return []int32{5, int32(enumIndex)} + } + path := []int32{4, int32(nestedMessageIndexes[0])} + for _, nestedMessageIndex := range nestedMessageIndexes[1:] { + path = append(path, 3, int32(nestedMessageIndex)) + } + return append(path, 4, int32(enumIndex)) +} + +func getEnumNamePath(enumIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumPath(enumIndex, nestedMessageIndexes...), 1) +} + +func getEnumOptionsPath(enumIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumPath(enumIndex, nestedMessageIndexes...), 3) +} + +func getEnumAllowAliasPath(enumIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumPath(enumIndex, nestedMessageIndexes...), 3, 2) +} + +func getEnumValuePath(enumIndex int, enumValueIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumPath(enumIndex, nestedMessageIndexes...), 2, int32(enumValueIndex)) +} + +func getEnumValueNamePath(enumIndex int, enumValueIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumValuePath(enumIndex, enumValueIndex, nestedMessageIndexes...), 1) +} + +func getEnumValueNumberPath(enumIndex int, enumValueIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumValuePath(enumIndex, enumValueIndex, nestedMessageIndexes...), 2) +} + +func getEnumValueOptionsPath(enumIndex int, enumValueIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumValuePath(enumIndex, enumValueIndex, nestedMessageIndexes...), 3) +} + +func getEnumReservedRangePath(enumIndex int, reservedRangeIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumPath(enumIndex, nestedMessageIndexes...), 4, int32(reservedRangeIndex)) +} + +func getEnumReservedNamePath(enumIndex int, reservedNameIndex int, nestedMessageIndexes ...int) []int32 { + return append(getEnumPath(enumIndex, nestedMessageIndexes...), 5, int32(reservedNameIndex)) +} + +func getServicePath(serviceIndex int) []int32 { + return []int32{6, int32(serviceIndex)} +} + +func getServiceNamePath(serviceIndex int) []int32 { + return append(getServicePath(serviceIndex), 1) +} + +func getServiceOptionsPath(serviceIndex int) []int32 { + return append(getServicePath(serviceIndex), 3) +} + +func getMethodPath(serviceIndex int, methodIndex int) []int32 { + return []int32{6, int32(serviceIndex), 2, int32(methodIndex)} +} + +func getMethodNamePath(serviceIndex int, methodIndex int) []int32 { + return append(getMethodPath(serviceIndex, methodIndex), 1) +} + +func getMethodInputTypePath(serviceIndex int, methodIndex int) []int32 { + return append(getMethodPath(serviceIndex, methodIndex), 2) +} + +func getMethodOutputTypePath(serviceIndex int, methodIndex int) []int32 { + return append(getMethodPath(serviceIndex, methodIndex), 3) +} + +func getMethodOptionsPath(serviceIndex int, methodIndex int) []int32 { + return append(getMethodPath(serviceIndex, methodIndex), 4) +} + +func getMethodIdempotencyLevelPath(serviceIndex int, methodIndex int) []int32 { + return append(getMethodPath(serviceIndex, methodIndex), 4, 34) +} + +func getFileExtensionPath(fieldIndex int) []int32 { + return []int32{7, int32(fieldIndex)} +} + +func getFileExtensionNamePath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 1) +} + +func getFileExtensionNumberPath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 3) +} + +func getFileExtensionTypePath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 5) +} + +func getFileExtensionTypeNamePath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 6) +} + +func getFileExtensionJSONNamePath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 10) +} + +func getFileExtensionOptionsPath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 8) +} + +func getFileExtensionJSTypePath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 8, 6) +} + +func getFileExtensionCTypePath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 8, 1) +} + +func getFileExtensionPackedPath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 8, 2) +} + +func getFileExtensionExtendeePath(fieldIndex int) []int32 { + return append(getFileExtensionPath(fieldIndex), 2) +} diff --git a/pkg/bufman/pkg/protosource/protosource.go b/pkg/bufman/pkg/protosource/protosource.go new file mode 100644 index 000000000..41f2b873a --- /dev/null +++ b/pkg/bufman/pkg/protosource/protosource.go @@ -0,0 +1,1253 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package protosource defines minimal interfaces for Protobuf descriptor types. +// +// This is done so that the backing package can be swapped out easily. +// +// All values that return SourceLocation can be nil. +// +// Testing is currently implicitly done through the bufcheck packages, however +// if this were to be split out into a separate library, it would need a separate +// testing suite. +package protosource + +import ( + "context" + "fmt" + "sort" + "strconv" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + // SyntaxUnspecified represents no syntax being specified. + // + // This is functionally equivalent to SyntaxProto2. + SyntaxUnspecified Syntax = iota + 1 + // SyntaxProto2 represents the proto2 syntax. + SyntaxProto2 + // SyntaxProto3 represents the proto3 syntax. + SyntaxProto3 + // SyntaxEditions represents the editions syntax. + SyntaxEditions +) + +// Syntax is the syntax of a file. +type Syntax int + +// String returns the string representation of s +func (s Syntax) String() string { + switch s { + case SyntaxUnspecified: + return "unspecified" + case SyntaxProto2: + return "proto2" + case SyntaxProto3: + return "proto3" + case SyntaxEditions: + return "editions" + default: + return strconv.Itoa(int(s)) + } +} + +// Descriptor is the base interface for a descriptor type. +type Descriptor interface { + // File returns the associated File. + // + // Always non-nil. + File() File +} + +// LocationDescriptor is the base interface for a descriptor type with a location. +type LocationDescriptor interface { + Descriptor + + // Location returns the location of the entire descriptor. + // + // Can return nil, although will generally not be nil. + Location() Location +} + +// NamedDescriptor is the base interface for a named descriptor type. +type NamedDescriptor interface { + LocationDescriptor + + // FullName returns the fully-qualified name, i.e. some.pkg.Nested.Message.FooEnum.ENUM_VALUE. + // + // Always non-empty. + FullName() string + // NestedName returns the full nested name without the package, i.e. Nested.Message.FooEnum + // or Nested.Message.FooEnum.ENUM_VALUE. + // + // Always non-empty. + NestedName() string + // Name returns the short name, or the name of a value or field, i.e. FooEnum or ENUM_VALUE. + // + // Always non-empty. + Name() string + // NameLocation returns the location of the name of the descriptor. + // + // If the backing descriptor does not have name-level resolution, this will + // attempt to return a location of the entire descriptor. + // + // If the backing descriptor has comments for the entire descriptor, these + // will be added to the named location. + // + // Can return nil. + NameLocation() Location +} + +// ContainerDescriptor contains Enums and Messages. +type ContainerDescriptor interface { + Enums() []Enum + Messages() []Message +} + +// OptionExtensionDescriptor contains option extensions. +type OptionExtensionDescriptor interface { + // OptionExtension returns the value for an options extension field. + // + // Returns false if the extension is not set. + // + // See https://pkg.go.dev/google.golang.org/protobuf/proto#HasExtension + // See https://pkg.go.dev/google.golang.org/protobuf/proto#GetExtension + OptionExtension(extensionType protoreflect.ExtensionType) (interface{}, bool) + + // OptionExtensionLocation returns the source location where the given extension + // field value is defined. The extra path can be additional path elements, for + // getting the location of specific elements inside the extension, for message + // and repeated values. + // + // If a precise location cannot be found, but a general one can be, the general + // location will be returned. For example, if a specific field inside a message + // extension is requested but the source code info only includes information + // about the message itself (and not that particular field), the location of the + // message value is returned. Conversely, if a message location is requested but + // the source code info only has information about specific fields inside that + // message, the first such location is returned. Similarly, if multiple locations + // are in source code info for the requested value, the first one is returned. + // + // If no relevant location is found in source code info, this returns nil. + OptionExtensionLocation(extensionType protoreflect.ExtensionType, extraPath ...int32) Location + + // PresentExtensionNumbers returns field numbers for all options that + // have a set value on this descriptor. + PresentExtensionNumbers() []int32 +} + +// Location defines source code info location information. +// +// May be extended in the future to include comments. +// +// Note that unlike SourceCodeInfo_Location, these are not zero-indexed. +type Location interface { + StartLine() int + StartColumn() int + EndLine() int + EndColumn() int + LeadingComments() string + TrailingComments() string + // NOT a copy. Do not modify. + LeadingDetachedComments() []string +} + +// ModuleIdentity is a module identity. +type ModuleIdentity interface { + Remote() string + Owner() string + Repository() string +} + +// FileInfo contains Protobuf file info. +type FileInfo interface { + // Path is the path of the file relative to the root it is contained within. + // This will be normalized, validated and never empty, + // This will be unique within a given Image. + Path() string + // ExternalPath returns the path that identifies this file externally. + // + // This will be unnormalized. + // Never empty. Falls back to Path if there is not an external path. + // + // Example: + // Assume we had the input path /foo/bar which is a local directory. + + // Path: one/one.proto + // RootDirPath: proto + // ExternalPath: /foo/bar/proto/one/one.proto + ExternalPath() string + // ModuleIdentity is the module that this file came from. + // + // Note this *can* be nil if we did not build from a named module. + // All code must assume this can be nil. + // Note that nil checking should work since the backing type is always a pointer. + ModuleIdentity() ModuleIdentity + // Commit is the commit for the module that this file came from. + // + // This will only be set if ModuleIdentity is set, but may not be set + // even if ModuleIdentity is set, that is commit is optional information + // even if we know what module this file came from. + Commit() string +} + +// File is a file descriptor. +type File interface { + Descriptor + FileInfo + + // Top-level only. + ContainerDescriptor + OptionExtensionDescriptor + + Syntax() Syntax + Package() string + FileImports() []FileImport + Services() []Service + Extensions() []Field + Edition() string + + CsharpNamespace() string + GoPackage() string + JavaMultipleFiles() bool + JavaOuterClassname() string + JavaPackage() string + JavaStringCheckUtf8() bool + ObjcClassPrefix() string + PhpClassPrefix() string + PhpNamespace() string + PhpMetadataNamespace() string + RubyPackage() string + SwiftPrefix() string + Deprecated() bool + + OptimizeFor() descriptorpb.FileOptions_OptimizeMode + CcGenericServices() bool + JavaGenericServices() bool + PyGenericServices() bool + PhpGenericServices() bool + CcEnableArenas() bool + + SyntaxLocation() Location + PackageLocation() Location + CsharpNamespaceLocation() Location + GoPackageLocation() Location + JavaMultipleFilesLocation() Location + JavaOuterClassnameLocation() Location + JavaPackageLocation() Location + JavaStringCheckUtf8Location() Location + ObjcClassPrefixLocation() Location + PhpClassPrefixLocation() Location + PhpNamespaceLocation() Location + PhpMetadataNamespaceLocation() Location + RubyPackageLocation() Location + SwiftPrefixLocation() Location + + OptimizeForLocation() Location + CcGenericServicesLocation() Location + JavaGenericServicesLocation() Location + PyGenericServicesLocation() Location + PhpGenericServicesLocation() Location + CcEnableArenasLocation() Location +} + +// FileImport is a file import descriptor. +type FileImport interface { + LocationDescriptor + + Import() string + IsPublic() bool + IsWeak() bool + IsUnused() bool +} + +// TagRange is a tag range from start to end. +type TagRange interface { + LocationDescriptor + + // Start is the start of the range. + Start() int + // End is the end of the range. + // Inclusive. + End() int + // Max says that the End is the max. + Max() bool +} + +// ReservedName is a reserved name for an enum or message. +type ReservedName interface { + LocationDescriptor + + Value() string +} + +// ReservedDescriptor has reserved ranges and names. +type ReservedDescriptor interface { + ReservedTagRanges() []TagRange + ReservedNames() []ReservedName +} + +// EnumRange is a TagRange for Enums. +type EnumRange interface { + TagRange + + Enum() Enum +} + +// MessageRange is a TagRange for Messages. +type MessageRange interface { + TagRange + + Message() Message +} + +// ExtensionRange represents an extension range in Messages. +type ExtensionRange interface { + MessageRange + OptionExtensionDescriptor +} + +// Enum is an enum descriptor. +type Enum interface { + NamedDescriptor + ReservedDescriptor + OptionExtensionDescriptor + + Values() []EnumValue + ReservedEnumRanges() []EnumRange + + AllowAlias() bool + DeprecatedLegacyJSONFieldConflicts() bool + Deprecated() bool + AllowAliasLocation() Location + + // Will return nil if this is a top-level Enum + Parent() Message +} + +// EnumValue is an enum value descriptor. +type EnumValue interface { + NamedDescriptor + OptionExtensionDescriptor + + Enum() Enum + Number() int + + Deprecated() bool + NumberLocation() Location +} + +// Message is a message descriptor. +type Message interface { + NamedDescriptor + // Only those directly nested under this message. + ContainerDescriptor + ReservedDescriptor + OptionExtensionDescriptor + + // Includes fields in oneofs. + Fields() []Field + Extensions() []Field + Oneofs() []Oneof + ExtensionRanges() []ExtensionRange + ExtensionMessageRanges() []MessageRange + ReservedMessageRanges() []MessageRange + + // Will return nil if this is a top-level message + Parent() Message + IsMapEntry() bool + + MessageSetWireFormat() bool + NoStandardDescriptorAccessor() bool + DeprecatedLegacyJSONFieldConflicts() bool + Deprecated() bool + MessageSetWireFormatLocation() Location + NoStandardDescriptorAccessorLocation() Location +} + +// Field is a field descriptor. +type Field interface { + NamedDescriptor + OptionExtensionDescriptor + + // May be nil if this is attached to a file. + Message() Message + Number() int + Label() descriptorpb.FieldDescriptorProto_Label + Type() descriptorpb.FieldDescriptorProto_Type + TypeName() string + // may be nil + Oneof() Oneof + Proto3Optional() bool + JSONName() string + JSType() descriptorpb.FieldOptions_JSType + CType() descriptorpb.FieldOptions_CType + Retention() descriptorpb.FieldOptions_OptionRetention + Targets() []descriptorpb.FieldOptions_OptionTargetType + DebugRedact() bool + // Set vs unset matters for packed + // See the comments on descriptor.proto + Packed() *bool + Deprecated() bool + // Empty string unless the field is part of an extension + Extendee() string + + NumberLocation() Location + TypeLocation() Location + TypeNameLocation() Location + JSONNameLocation() Location + JSTypeLocation() Location + CTypeLocation() Location + PackedLocation() Location + ExtendeeLocation() Location +} + +// Oneof is a oneof descriptor. +type Oneof interface { + NamedDescriptor + OptionExtensionDescriptor + + Message() Message + Fields() []Field +} + +// Service is a service descriptor. +type Service interface { + NamedDescriptor + OptionExtensionDescriptor + + Methods() []Method + Deprecated() bool +} + +// Method is a method descriptor. +type Method interface { + NamedDescriptor + OptionExtensionDescriptor + + Service() Service + InputTypeName() string + OutputTypeName() string + ClientStreaming() bool + ServerStreaming() bool + InputTypeLocation() Location + OutputTypeLocation() Location + + Deprecated() bool + IdempotencyLevel() descriptorpb.MethodOptions_IdempotencyLevel + IdempotencyLevelLocation() Location +} + +// InputFile is an input file for NewFile. +type InputFile interface { + FileInfo + // FileDescriptor is the backing FileDescriptor for this File. + // + // This will never be nil. + // The value Path() is equal to FileDescriptor().GetName() . + FileDescriptor() protodescriptor.FileDescriptor + // IsSyntaxUnspecified will be true if the syntax was not explicitly specified. + IsSyntaxUnspecified() bool + // UnusedDependencyIndexes returns the indexes of the unused dependencies within + // FileDescriptor.GetDependency(). + // + // All indexes will be valid. + // Will return nil if empty. + UnusedDependencyIndexes() []int32 +} + +// NewFile returns a new File. +func NewFile(inputFile InputFile) (File, error) { + return newFile(inputFile) +} + +// NewFilesUnstable converts the input Files into Files. +// +// This may be done concurrently and the returned Files may not be in the same +// order as the input FileDescriptors. If ordering matters, use NewFile. +func NewFilesUnstable(ctx context.Context, inputFiles ...InputFile) ([]File, error) { + return newFilesUnstable(ctx, inputFiles...) +} + +// SortFiles sorts the Files by FilePath. +func SortFiles(files []File) { + sort.Slice(files, func(i int, j int) bool { return files[i].Path() < files[j].Path() }) +} + +// FilePathToFile maps the Files to a map from Path() to File. +// +// Returns error if file paths are not unique. +func FilePathToFile(files ...File) (map[string]File, error) { + filePathToFile := make(map[string]File, len(files)) + for _, file := range files { + filePath := file.Path() + if _, ok := filePathToFile[filePath]; ok { + return nil, fmt.Errorf("duplicate filePath: %q", filePath) + } + filePathToFile[filePath] = file + } + return filePathToFile, nil +} + +// DirPathToFiles maps the Files to a map from directory +// to the slice of Files in that directory. +// +// Returns error if file paths are not unique. +// Directories are normalized. +// +// Files will be sorted by FilePath. +func DirPathToFiles(files ...File) (map[string][]File, error) { + return mapFiles(files, func(file File) string { return normalpath.Dir(file.Path()) }) +} + +// PackageToFiles maps the Files to a map from Protobuf package +// to the slice of Files in that package. +// +// Returns error if file paths are not unique. +// +// Files will be sorted by Path. +func PackageToFiles(files ...File) (map[string][]File, error) { + // works for no package since "" is a valid map key + return mapFiles(files, File.Package) +} + +// ForEachEnum calls f on each Enum in the given ContainerDescriptor, including nested Enums. +// +// Returns error and stops iterating if f returns error +// Never returns error unless f returns error. +func ForEachEnum(f func(Enum) error, containerDescriptor ContainerDescriptor) error { + for _, enum := range containerDescriptor.Enums() { + if err := f(enum); err != nil { + return err + } + } + for _, message := range containerDescriptor.Messages() { + if err := ForEachEnum(f, message); err != nil { + return err + } + } + return nil +} + +// ForEachMessage calls f on each Message in the given ContainerDescriptor, including nested Messages. +// +// Returns error and stops iterating if f returns error +// Never returns error unless f returns error. +func ForEachMessage(f func(Message) error, containerDescriptor ContainerDescriptor) error { + for _, message := range containerDescriptor.Messages() { + if err := f(message); err != nil { + return err + } + if err := ForEachMessage(f, message); err != nil { + return err + } + } + return nil +} + +// NestedNameToEnum maps the Enums in the ContainerDescriptor to a map from +// nested name to Enum. +// +// Returns error if Enums do not have unique nested names within the ContainerDescriptor, +// which should generally never happen for properly-formed ContainerDescriptors. +func NestedNameToEnum(containerDescriptor ContainerDescriptor) (map[string]Enum, error) { + nestedNameToEnum := make(map[string]Enum) + if err := ForEachEnum( + func(enum Enum) error { + nestedName := enum.NestedName() + if _, ok := nestedNameToEnum[nestedName]; ok { + return fmt.Errorf("duplicate enum: %q", nestedName) + } + nestedNameToEnum[nestedName] = enum + return nil + }, + containerDescriptor, + ); err != nil { + return nil, err + } + return nestedNameToEnum, nil +} + +// FullNameToEnum maps the Enums in the Files to a map from full name to enum. +// +// Returns error if the Enums do not have unique full names within the Files, +// which should generally never happen for properly-formed Files. +func FullNameToEnum(files ...File) (map[string]Enum, error) { + fullNameToEnum := make(map[string]Enum) + for _, file := range files { + if err := ForEachEnum( + func(enum Enum) error { + fullName := enum.FullName() + if _, ok := fullNameToEnum[fullName]; ok { + return fmt.Errorf("duplicate enum: %q", fullName) + } + fullNameToEnum[fullName] = enum + return nil + }, + file, + ); err != nil { + return nil, err + } + } + return fullNameToEnum, nil +} + +// PackageToNestedNameToEnum maps the Enums in the Files to a map from +// package to nested name to Enum. +// +// Returns error if the Enums do not have unique nested names within the packages, +// which should generally never happen for properly-formed Files. +func PackageToNestedNameToEnum(files ...File) (map[string]map[string]Enum, error) { + packageToNestedNameToEnum := make(map[string]map[string]Enum) + for _, file := range files { + if err := ForEachEnum( + func(enum Enum) error { + pkg := enum.File().Package() + nestedName := enum.NestedName() + nestedNameToEnum, ok := packageToNestedNameToEnum[pkg] + if !ok { + nestedNameToEnum = make(map[string]Enum) + packageToNestedNameToEnum[pkg] = nestedNameToEnum + } + if _, ok := nestedNameToEnum[nestedName]; ok { + return fmt.Errorf("duplicate enum in package %q: %q", pkg, nestedName) + } + nestedNameToEnum[nestedName] = enum + return nil + }, + file, + ); err != nil { + return nil, err + } + } + return packageToNestedNameToEnum, nil +} + +// NameToEnumValue maps the EnumValues in the Enum to a map from name to EnumValue. +// +// Returns error if the EnumValues do not have unique names within the Enum, +// which should generally never happen for properly-formed Enums. +func NameToEnumValue(enum Enum) (map[string]EnumValue, error) { + nameToEnumValue := make(map[string]EnumValue) + for _, enumValue := range enum.Values() { + name := enumValue.Name() + if _, ok := nameToEnumValue[name]; ok { + return nil, fmt.Errorf("duplicate enum value name for enum %q: %q", enum.NestedName(), name) + } + nameToEnumValue[name] = enumValue + } + return nameToEnumValue, nil +} + +// NumberToNameToEnumValue maps the EnumValues in the Enum to a map from number to name to EnumValue. +// +// Duplicates by number may occur if allow_alias = true. +// +// Returns error if the EnumValues do not have unique names within the Enum for a given number, +// which should generally never happen for properly-formed Enums. +func NumberToNameToEnumValue(enum Enum) (map[int]map[string]EnumValue, error) { + numberToNameToEnumValue := make(map[int]map[string]EnumValue) + for _, enumValue := range enum.Values() { + number := enumValue.Number() + nameToEnumValue, ok := numberToNameToEnumValue[number] + if !ok { + nameToEnumValue = make(map[string]EnumValue) + numberToNameToEnumValue[number] = nameToEnumValue + } + name := enumValue.Name() + if _, ok := nameToEnumValue[name]; ok { + return nil, fmt.Errorf("duplicate enum value name for enum %q: %q", enum.NestedName(), name) + } + nameToEnumValue[name] = enumValue + } + return numberToNameToEnumValue, nil +} + +// NestedNameToMessage maps the Messages in the ContainerDescriptor to a map from +// nested name to Message. +// +// Returns error if Messages do not have unique nested names within the ContainerDescriptor, +// which should generally never happen for properly-formed files. +func NestedNameToMessage(containerDescriptor ContainerDescriptor) (map[string]Message, error) { + nestedNameToMessage := make(map[string]Message) + if err := ForEachMessage( + func(message Message) error { + nestedName := message.NestedName() + if _, ok := nestedNameToMessage[nestedName]; ok { + return fmt.Errorf("duplicate message: %q", nestedName) + } + nestedNameToMessage[nestedName] = message + return nil + }, + containerDescriptor, + ); err != nil { + return nil, err + } + return nestedNameToMessage, nil +} + +// FullNameToMessage maps the Messages in the Files to a map from full name to message. +// +// Returns error if the Messages do not have unique full names within the Files, +// which should generally never happen for properly-formed Files. +func FullNameToMessage(files ...File) (map[string]Message, error) { + fullNameToMessage := make(map[string]Message) + for _, file := range files { + if err := ForEachMessage( + func(message Message) error { + fullName := message.FullName() + if _, ok := fullNameToMessage[fullName]; ok { + return fmt.Errorf("duplicate message: %q", fullName) + } + fullNameToMessage[fullName] = message + return nil + }, + file, + ); err != nil { + return nil, err + } + } + return fullNameToMessage, nil +} + +// PackageToNestedNameToMessage maps the Messages in the Files to a map from +// package to nested name to Message. +// +// Returns error if the Messages do not have unique nested names within the packages, +// which should generally never happen for properly-formed Files. +func PackageToNestedNameToMessage(files ...File) (map[string]map[string]Message, error) { + packageToNestedNameToMessage := make(map[string]map[string]Message) + for _, file := range files { + if err := ForEachMessage( + func(message Message) error { + pkg := message.File().Package() + nestedName := message.NestedName() + nestedNameToMessage, ok := packageToNestedNameToMessage[pkg] + if !ok { + nestedNameToMessage = make(map[string]Message) + packageToNestedNameToMessage[pkg] = nestedNameToMessage + } + if _, ok := nestedNameToMessage[nestedName]; ok { + return fmt.Errorf("duplicate message in package %q: %q", pkg, nestedName) + } + nestedNameToMessage[nestedName] = message + return nil + }, + file, + ); err != nil { + return nil, err + } + } + return packageToNestedNameToMessage, nil +} + +// NumberToMessageField maps the Fields in the Message to a map from number to Field. +// +// TODO: is this right? +// Includes extensions. +// +// Returns error if the Fields do not have unique numbers within the Message, +// which should generally never happen for properly-formed Messages. +func NumberToMessageField(message Message) (map[int]Field, error) { + numberToMessageField := make(map[int]Field) + for _, messageField := range message.Fields() { + number := messageField.Number() + if _, ok := numberToMessageField[number]; ok { + return nil, fmt.Errorf("duplicate message field: %d", number) + } + numberToMessageField[number] = messageField + } + for _, messageField := range message.Extensions() { + if messageField.Extendee() != message.FullName() { + // TODO: ideally we want this field to be returned when + // the Extendee message is passed into some function, + // need to investigate what index is necessary for that. + continue + } + number := messageField.Number() + if _, ok := numberToMessageField[number]; ok { + return nil, fmt.Errorf("duplicate message field: %d", number) + } + numberToMessageField[number] = messageField + } + return numberToMessageField, nil +} + +// NumberToMessageFieldForLabel maps the Fields with the given label in the message +// to a map from number to Field. +// +// TODO: is this right? +// Includes extensions. +// +// Returns error if the Fields do not have unique numbers within the Message, +// which should generally never happen for properly-formed Messages. +func NumberToMessageFieldForLabel(message Message, label descriptorpb.FieldDescriptorProto_Label) (map[int]Field, error) { + numberToField, err := NumberToMessageField(message) + if err != nil { + return nil, err + } + for number, field := range numberToField { + if field.Label() != label { + delete(numberToField, number) + } + } + return numberToField, nil +} + +// NameToMessageOneof maps the Oneofs in the Message to a map from name to Oneof. +// +// Returns error if the Oneofs do not have unique names within the Message, +// which should generally never happen for properly-formed Messages. +func NameToMessageOneof(message Message) (map[string]Oneof, error) { + nameToMessageOneof := make(map[string]Oneof) + for _, messageOneof := range message.Oneofs() { + name := messageOneof.Name() + if _, ok := nameToMessageOneof[name]; ok { + return nil, fmt.Errorf("duplicate message oneof: %q", name) + } + nameToMessageOneof[name] = messageOneof + } + return nameToMessageOneof, nil +} + +// NameToService maps the Services in the File to a map from name to Service. +// +// Returns error if Services do not have unique names within the File, which should +// generally never happen for properly-formed Files. +func NameToService(file File) (map[string]Service, error) { + nameToService := make(map[string]Service) + for _, service := range file.Services() { + name := service.Name() + if _, ok := nameToService[name]; ok { + return nil, fmt.Errorf("duplicate service: %q", name) + } + nameToService[name] = service + } + return nameToService, nil +} + +// FullNameToService maps the Services in the Files to a map from full name to Service. +// +// Returns error if Services do not have unique full names within the Files, which should +// generally never happen for properly-formed Files. +func FullNameToService(files ...File) (map[string]Service, error) { + fullNameToService := make(map[string]Service) + for _, file := range files { + for _, service := range file.Services() { + fullName := service.FullName() + if _, ok := fullNameToService[fullName]; ok { + return nil, fmt.Errorf("duplicate service: %q", fullName) + } + fullNameToService[fullName] = service + } + } + return fullNameToService, nil +} + +// PackageToNameToService maps the Services in the Files to a map from +// package to name to Service. +// +// Returns error if the Services do not have unique names within the packages, +// which should generally never happen for properly-formed Files. +func PackageToNameToService(files ...File) (map[string]map[string]Service, error) { + packageToNameToService := make(map[string]map[string]Service) + for _, file := range files { + pkg := file.Package() + nameToService, ok := packageToNameToService[pkg] + if !ok { + nameToService = make(map[string]Service) + packageToNameToService[pkg] = nameToService + } + for _, service := range file.Services() { + name := service.Name() + if _, ok := nameToService[name]; ok { + return nil, fmt.Errorf("duplicate service in package %q: %q", pkg, name) + } + nameToService[name] = service + } + } + return packageToNameToService, nil +} + +// PackageToDirectlyImportedPackageToFileImports maps packages to directly imported packages +// to the FileImports that import this package. +// +// For example, if package a imports package b via c/d.proto and c/e.proto, this will have +// a -> b -> [c/d.proto, c/e.proto]. +// +// A directly imported package will not be equal to the package, i.e. there will be no a -> a. +// +// Files with no packages are included with key "" to be consistent with other functions. +func PackageToDirectlyImportedPackageToFileImports(files ...File) (map[string]map[string][]FileImport, error) { + filePathToFile, err := FilePathToFile(files...) + if err != nil { + return nil, err + } + packageToDirectlyImportedPackageToFileImports := make(map[string]map[string][]FileImport) + for _, file := range files { + pkg := file.Package() + directlyImportedPackageToFileImports, ok := packageToDirectlyImportedPackageToFileImports[pkg] + if !ok { + directlyImportedPackageToFileImports = make(map[string][]FileImport) + packageToDirectlyImportedPackageToFileImports[pkg] = directlyImportedPackageToFileImports + } + for _, fileImport := range file.FileImports() { + if importedFile, ok := filePathToFile[fileImport.Import()]; ok { + importedPkg := importedFile.Package() + if importedPkg != pkg { + directlyImportedPackageToFileImports[importedFile.Package()] = append( + directlyImportedPackageToFileImports[importedPkg], + fileImport, + ) + } + } + } + } + return packageToDirectlyImportedPackageToFileImports, nil +} + +// NameToMethod maps the Methods in the Service to a map from name to Method. +// +// Returns error if Methods do not have unique names within the Service, which should +// generally never happen for properly-formed Services. +func NameToMethod(service Service) (map[string]Method, error) { + nameToMethod := make(map[string]Method) + for _, method := range service.Methods() { + name := method.Name() + if _, ok := nameToMethod[name]; ok { + return nil, fmt.Errorf("duplicate method: %q", name) + } + nameToMethod[name] = method + } + return nameToMethod, nil +} + +// FullNameToMethod maps the Methods in the Files to a map from full name to Method. +// +// Returns error if Methods do not have unique full names within the Files, which should +// generally never happen for properly-formed Files. +func FullNameToMethod(files ...File) (map[string]Method, error) { + fullNameToMethod := make(map[string]Method) + for _, file := range files { + for _, service := range file.Services() { + for _, method := range service.Methods() { + fullName := method.FullName() + if _, ok := fullNameToMethod[fullName]; ok { + return nil, fmt.Errorf("duplicate method: %q", fullName) + } + fullNameToMethod[fullName] = method + } + } + } + return fullNameToMethod, nil +} + +// StringToReservedTagRange maps the ReservedTagRanges in the ReservedDescriptor to a map +// from string string to reserved TagRange. +// +// Ignores duplicates. +func StringToReservedTagRange(reservedDescriptor ReservedDescriptor) map[string]TagRange { + stringToReservedTagRange := make(map[string]TagRange) + for _, reservedTagRange := range reservedDescriptor.ReservedTagRanges() { + stringToReservedTagRange[TagRangeString(reservedTagRange)] = reservedTagRange + } + return stringToReservedTagRange +} + +// ValueToReservedName maps the ReservedNames in the ReservedDescriptor to a map +// from string value to ReservedName. +// +// Ignores duplicates. +func ValueToReservedName(reservedDescriptor ReservedDescriptor) map[string]ReservedName { + valueToReservedName := make(map[string]ReservedName) + for _, reservedName := range reservedDescriptor.ReservedNames() { + valueToReservedName[reservedName.Value()] = reservedName + } + return valueToReservedName +} + +// StringToExtensionMessageRange maps the ExtensionMessageRanges in the Message to a map +// from string string to ExtensionMessageRange. +// +// Ignores duplicates. +func StringToExtensionMessageRange(message Message) map[string]MessageRange { + stringToExtensionMessageRange := make(map[string]MessageRange) + for _, extensionMessageRange := range message.ExtensionMessageRanges() { + stringToExtensionMessageRange[TagRangeString(extensionMessageRange)] = extensionMessageRange + } + return stringToExtensionMessageRange +} + +// NumberInReservedRanges returns true if the number is in one of the Ranges. +func NumberInReservedRanges(number int, reservedRanges ...TagRange) bool { + for _, reservedRange := range reservedRanges { + start := reservedRange.Start() + end := reservedRange.End() + if number >= start && number <= end { + return true + } + } + return false +} + +// NameInReservedNames returns true if the name is in one of the ReservedNames. +func NameInReservedNames(name string, reservedNames ...ReservedName) bool { + for _, reservedName := range reservedNames { + if name == reservedName.Value() { + return true + } + } + return false +} + +// EnumIsSubset checks if subsetEnum is a subset of supersetEnum. +func EnumIsSubset(supersetEnum Enum, subsetEnum Enum) (bool, error) { + supersetNameToEnumValue, err := NameToEnumValue(supersetEnum) + if err != nil { + return false, err + } + subsetNameToEnumValue, err := NameToEnumValue(subsetEnum) + if err != nil { + return false, err + } + for subsetName, subsetEnumValue := range subsetNameToEnumValue { + supersetEnumValue, ok := supersetNameToEnumValue[subsetName] + if !ok { + // The enum value does not exist by name, this is not a superset. + return false, nil + } + if subsetEnumValue.Number() != supersetEnumValue.Number() { + // The enum values are not equal, this is not a superset. + return false, nil + } + } + // All enum values by name exist in the superset and have the same number, + // subsetEnum is a subset of supersetEnum. + return true, nil +} + +// TagRangeString returns the string representation of the range. +func TagRangeString(tagRange TagRange) string { + start := tagRange.Start() + end := tagRange.End() + if start == end { + return fmt.Sprintf("[%d]", start) + } + if tagRange.Max() { + return fmt.Sprintf("[%d,max]", start) + } + return fmt.Sprintf("[%d,%d]", start, end) +} + +// FreeMessageRangeString returns the string representation of the free ranges for the message. +func FreeMessageRangeString(message Message) string { + freeRanges := FreeMessageRanges(message) + if len(freeRanges) == 0 { + return "" + } + suffixes := make([]string, len(freeRanges)) + for i, freeRange := range freeRanges { + suffixes[i] = freeMessageRangeStringSuffix(freeRange) + } + return fmt.Sprintf( + "%- 35s free: %s", + freeRanges[0].Message().FullName(), + strings.Join(suffixes, " "), + ) +} + +// FreeMessageRanges returns the free message ranges for the given message. +// +// Not recursive. +func FreeMessageRanges(message Message) []MessageRange { + used := append( + message.ReservedMessageRanges(), + message.ExtensionMessageRanges()..., + ) + for _, field := range message.Fields() { + used = append( + used, + newFreeMessageRange(message, field.Number(), field.Number()), + ) + } + sort.Slice(used, func(i, j int) bool { + return used[i].Start() < used[j].Start() + }) + // now compute the inverse (unused ranges) + unused := make([]MessageRange, 0, len(used)+1) + last := 0 + for _, r := range used { + if r.Start() <= last+1 { + last = r.End() + continue + } + unused = append( + unused, + newFreeMessageRange(message, last+1, r.Start()-1), + ) + last = r.End() + } + if last < messageRangeInclusiveMax { + unused = append( + unused, + newFreeMessageRange(message, last+1, messageRangeInclusiveMax), + ) + } + return unused +} + +// CheckTagRangeIsSubset checks if supersetRanges is a superset of subsetRanges. +// If so, it returns true and nil. If not, it returns false with a slice of failing ranges from subsetRanges. +func CheckTagRangeIsSubset(supersetRanges []TagRange, subsetRanges []TagRange) (bool, []TagRange) { + if len(subsetRanges) == 0 { + return true, nil + } + + if len(supersetRanges) == 0 { + return false, subsetRanges + } + + supersetTagRangeGroups := groupAdjacentTagRanges(supersetRanges) + subsetTagRanges := sortTagRanges(subsetRanges) + missingTagRanges := []TagRange{} + + for i, j := 0, 0; j < len(subsetTagRanges); j++ { + for supersetTagRangeGroups[i].end < subsetTagRanges[j].Start() { + if i++; i == len(supersetTagRangeGroups) { + missingTagRanges = append(missingTagRanges, subsetTagRanges[j:]...) + return false, missingTagRanges + } + } + if supersetTagRangeGroups[i].start > subsetTagRanges[j].Start() || + supersetTagRangeGroups[i].end < subsetTagRanges[j].End() { + missingTagRanges = append(missingTagRanges, subsetTagRanges[j]) + } + } + + if len(missingTagRanges) != 0 { + return false, missingTagRanges + } + + return true, nil +} + +// groupAdjacentTagRanges sorts and groups adjacent tag ranges. +func groupAdjacentTagRanges(ranges []TagRange) []tagRangeGroup { + if len(ranges) == 0 { + return []tagRangeGroup{} + } + + sortedTagRanges := sortTagRanges(ranges) + + j := 0 + groupedTagRanges := make([]tagRangeGroup, 1, len(ranges)) + groupedTagRanges[j] = tagRangeGroup{ + ranges: sortedTagRanges[0:1], + start: sortedTagRanges[0].Start(), + end: sortedTagRanges[0].End(), + } + + for i := 1; i < len(sortedTagRanges); i++ { + if sortedTagRanges[i].Start() <= sortedTagRanges[i-1].End()+1 { + if sortedTagRanges[i].End() > groupedTagRanges[j].end { + groupedTagRanges[j].end = sortedTagRanges[i].End() + } + groupedTagRanges[j].ranges = groupedTagRanges[j].ranges[0 : len(groupedTagRanges[j].ranges)+1] + } else { + groupedTagRanges = append(groupedTagRanges, tagRangeGroup{ + ranges: sortedTagRanges[i : i+1], + start: sortedTagRanges[i].Start(), + end: sortedTagRanges[i].End(), + }) + j++ + } + } + + return groupedTagRanges +} + +// sortTagRanges sorts tag ranges by their start, end components. +func sortTagRanges(ranges []TagRange) []TagRange { + rangesCopy := make([]TagRange, len(ranges)) + copy(rangesCopy, ranges) + + sort.Slice(rangesCopy, func(i, j int) bool { + return rangesCopy[i].Start() < rangesCopy[j].Start() || + (rangesCopy[i].Start() == rangesCopy[j].Start() && + rangesCopy[i].End() < rangesCopy[j].End()) + }) + + return rangesCopy +} + +func freeMessageRangeStringSuffix(freeRange MessageRange) string { + start := freeRange.Start() + end := freeRange.End() + if start == end { + return fmt.Sprintf("%d", start) + } + if freeRange.Max() { + return fmt.Sprintf("%d-INF", start) + } + return fmt.Sprintf("%d-%d", start, end) +} + +func mapFiles(files []File, getKey func(File) string) (map[string][]File, error) { + keyToFilePathToFile := make(map[string]map[string]File) + for _, file := range files { + if err := addUniqueFileToMap(keyToFilePathToFile, getKey(file), file); err != nil { + return nil, err + } + } + return mapToSortedFiles(keyToFilePathToFile), nil +} + +func addUniqueFileToMap(keyToFilePathToFile map[string]map[string]File, key string, file File) error { + filePathToFile, ok := keyToFilePathToFile[key] + if !ok { + filePathToFile = make(map[string]File) + keyToFilePathToFile[key] = filePathToFile + } + if _, ok := filePathToFile[file.Path()]; ok { + return fmt.Errorf("duplicate file: %s", file.Path()) + } + filePathToFile[file.Path()] = file + return nil +} + +func mapToSortedFiles(keyToFileMap map[string]map[string]File) map[string][]File { + keyToSortedFiles := make(map[string][]File, len(keyToFileMap)) + for key, fileMap := range keyToFileMap { + files := make([]File, 0, len(fileMap)) + for _, file := range fileMap { + files = append(files, file) + } + SortFiles(files) + keyToSortedFiles[key] = files + } + return keyToSortedFiles +} + +type tagRangeGroup struct { + ranges []TagRange + start int + end int +} diff --git a/pkg/bufman/pkg/protosource/reserved_name.go b/pkg/bufman/pkg/protosource/reserved_name.go new file mode 100644 index 000000000..72448a503 --- /dev/null +++ b/pkg/bufman/pkg/protosource/reserved_name.go @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import "fmt" + +type reservedName struct { + locationDescriptor + + value string +} + +func newReservedName( + locationDescriptor locationDescriptor, + value string, +) (*reservedName, error) { + if value == "" { + return nil, fmt.Errorf("no value for reserved name in %q", locationDescriptor.File().Path()) + } + return &reservedName{ + locationDescriptor: locationDescriptor, + value: value, + }, nil +} + +func (r *reservedName) Value() string { + return r.value +} diff --git a/pkg/bufman/pkg/protosource/service.go b/pkg/bufman/pkg/protosource/service.go new file mode 100644 index 000000000..1abc56c03 --- /dev/null +++ b/pkg/bufman/pkg/protosource/service.go @@ -0,0 +1,48 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +type service struct { + namedDescriptor + optionExtensionDescriptor + + methods []Method + deprecated bool +} + +func newService( + namedDescriptor namedDescriptor, + optionExtensionDescriptor optionExtensionDescriptor, + deprecated bool, +) *service { + return &service{ + namedDescriptor: namedDescriptor, + optionExtensionDescriptor: optionExtensionDescriptor, + deprecated: deprecated, + } +} + +func (m *service) Methods() []Method { + return m.methods +} + +func (m *service) addMethod(method Method) { + m.methods = append(m.methods, method) +} + +func (m *service) Deprecated() bool { + return m.deprecated +} diff --git a/pkg/bufman/pkg/protosource/tag_range_test.go b/pkg/bufman/pkg/protosource/tag_range_test.go new file mode 100644 index 000000000..53feb13ec --- /dev/null +++ b/pkg/bufman/pkg/protosource/tag_range_test.go @@ -0,0 +1,104 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protosource + +import ( + "fmt" + "strconv" + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestCheckTagRangeIsSubset(t *testing.T) { + t.Parallel() + testExpectedSubset(t, "1", "1", "") + testExpectedSubset(t, "1-2", "1", "") + testExpectedSubset(t, "1", "1-2", "1-2") + testExpectedSubset(t, "5,4,3,2,1", "1-5", "") + testExpectedSubset(t, "1-5", "1,2,4,5,3", "") + testExpectedSubset(t, "90-199,200", "100-200", "") + testExpectedSubset(t, "100-200", "90-199,200", "90-199") + testExpectedSubset(t, "1-5,200,1000-1001,2000", "1-3,5,1001,3000", "3000") + testExpectedSubset(t, "1-92,93-95,96-99,100", "1-93,3-100,5-200", "5-200") + testExpectedSubset(t, "1-92,3-50,5-75,10-90,15-30", "1-20,5-10,30-75,91,92,93", "93") +} + +func testExpectedSubset( + t *testing.T, + supersetRangesString string, + subsetRangesString string, + expectedMissingString string, +) { + supersetRanges := stringToTestRanges(supersetRangesString) + subsetRanges := stringToTestRanges(subsetRangesString) + expectedMissing := stringToTestRanges(expectedMissingString) + isSubset, actualMissing := CheckTagRangeIsSubset(supersetRanges, subsetRanges) + + if isSubset && len(actualMissing) > 0 { + t.Error("Subset flag should be cleared when missing ranges are found") + } else if !isSubset && len(actualMissing) == 0 { + t.Error("Subset flag should be set when missing ranges aren't found") + } + + assert.Equal(t, len(expectedMissing), len(actualMissing), fmt.Sprint(actualMissing)) + if len(expectedMissing) == len(actualMissing) { + for i := range actualMissing { + assert.Equal(t, expectedMissing[i], actualMissing[i]) + } + } +} + +// Parses a string like 5-10,12 into test ranges. +func stringToTestRanges(rangesString string) []TagRange { + results := []TagRange{} + if rangesString == "" { + return results + } + rangeStrings := strings.Split(rangesString, ",") + for _, rangeString := range rangeStrings { + beginString, endString, hasEnd := strings.Cut(rangeString, "-") + if !hasEnd { + endString = beginString + } + begin, err := strconv.Atoi(beginString) + if err != nil { + panic(err) + } + end, err := strconv.Atoi(endString) + if err != nil { + panic(err) + } + results = append(results, testTagRange{begin, end}) + } + return results +} + +// Implementation of TagRange for testing. +type testTagRange struct { + start, end int +} + +func (testTagRange) File() File { return nil } + +func (testTagRange) Location() Location { return nil } + +func (r testTagRange) Start() int { return r.start } + +func (r testTagRange) End() int { return r.end } + +func (testTagRange) Max() bool { return false } diff --git a/pkg/bufman/pkg/protostat/protostat.go b/pkg/bufman/pkg/protostat/protostat.go new file mode 100644 index 000000000..d0ac94b9c --- /dev/null +++ b/pkg/bufman/pkg/protostat/protostat.go @@ -0,0 +1,197 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protostat + +import ( + "context" + "io" + + "github.com/bufbuild/protocompile/ast" + "github.com/bufbuild/protocompile/parser" + "github.com/bufbuild/protocompile/reporter" +) + +// Stats represents some statistics about one or more Protobuf files. +// +// Note that as opposed to most structs in this codebase, we do not omitempty for +// the fields for JSON or YAML. +type Stats struct { + NumFiles int `json:"num_files" yaml:"num_files"` + NumPackages int `json:"num_packages" yaml:"num_packages"` + NumFilesWithSyntaxErrors int `json:"num_files_with_syntax_errors" yaml:"num_files_with_syntax_errors"` + NumMessages int `json:"num_messages" yaml:"num_messages"` + NumFields int `json:"num_fields" yaml:"num_fields"` + NumEnums int `json:"num_enums" yaml:"num_enums"` + NumEnumValues int `json:"num_enum_values" yaml:"num_enum_values"` + NumExtensions int `json:"num_extensions" yaml:"num_extensions"` + NumServices int `json:"num_services" yaml:"num_services"` + NumMethods int `json:"num_methods" yaml:"num_methods"` +} + +// FileWalker goes through all .proto files for GetStats. +type FileWalker interface { + // Walk will invoke f for all .proto files for GetStats. + Walk(ctx context.Context, f func(io.Reader) error) error +} + +// GetStats gathers some simple statistics about a set of Protobuf files. +// +// See the packages protostatos and protostatstorage for helpers for the +// os and storage packages. +func GetStats(ctx context.Context, fileWalker FileWalker) (*Stats, error) { + handler := reporter.NewHandler( + reporter.NewReporter( + func(reporter.ErrorWithPos) error { + // never aborts + return nil + }, + nil, + ), + ) + statsBuilder := newStatsBuilder() + if err := fileWalker.Walk( + ctx, + func(file io.Reader) error { + // This can return an error and non-nil AST. + // We do not need the filePath because we do not report errors. + astRoot, err := parser.Parse("", file, handler) + if astRoot == nil { + // No AST implies an I/O error trying to read the + // file contents. No stats to collect. + return err + } + if err != nil { + // There was a syntax error, but we still have a partial + // AST we can examine. + statsBuilder.NumFilesWithSyntaxErrors++ + } + examineFile(statsBuilder, astRoot) + return nil + }, + ); err != nil { + return nil, err + } + statsBuilder.NumPackages = len(statsBuilder.packages) + return statsBuilder.Stats, nil +} + +// MergeStats merged multiple stats objects into one single Stats object. +// +// A new object is returned. +func MergeStats(statsSlice ...*Stats) *Stats { + resultStats := &Stats{} + for _, stats := range statsSlice { + resultStats.NumFiles += stats.NumFiles + resultStats.NumPackages += stats.NumPackages + resultStats.NumFilesWithSyntaxErrors += stats.NumFilesWithSyntaxErrors + resultStats.NumMessages += stats.NumMessages + resultStats.NumFields += stats.NumFields + resultStats.NumEnums += stats.NumEnums + resultStats.NumEnumValues += stats.NumEnumValues + resultStats.NumExtensions += stats.NumExtensions + resultStats.NumServices += stats.NumServices + resultStats.NumMethods += stats.NumMethods + } + return resultStats +} + +type statsBuilder struct { + *Stats + + packages map[ast.Identifier]struct{} +} + +func newStatsBuilder() *statsBuilder { + return &statsBuilder{ + Stats: &Stats{}, + packages: make(map[ast.Identifier]struct{}), + } +} + +func examineFile(statsBuilder *statsBuilder, fileNode *ast.FileNode) { + statsBuilder.NumFiles++ + for _, decl := range fileNode.Decls { + switch decl := decl.(type) { + case *ast.PackageNode: + statsBuilder.packages[decl.Name.AsIdentifier()] = struct{}{} + case *ast.MessageNode: + examineMessage(statsBuilder, &decl.MessageBody) + case *ast.EnumNode: + examineEnum(statsBuilder, decl) + case *ast.ExtendNode: + examineExtend(statsBuilder, decl) + case *ast.ServiceNode: + statsBuilder.NumServices++ + for _, decl := range decl.Decls { + _, ok := decl.(*ast.RPCNode) + if ok { + statsBuilder.NumMethods++ + } + } + } + } +} + +func examineMessage(statsBuilder *statsBuilder, messageBody *ast.MessageBody) { + statsBuilder.NumMessages++ + for _, decl := range messageBody.Decls { + switch decl := decl.(type) { + case *ast.FieldNode, *ast.MapFieldNode: + statsBuilder.NumFields++ + case *ast.GroupNode: + statsBuilder.NumFields++ + examineMessage(statsBuilder, &decl.MessageBody) + case *ast.OneOfNode: + for _, ooDecl := range decl.Decls { + switch ooDecl := ooDecl.(type) { + case *ast.FieldNode: + statsBuilder.NumFields++ + case *ast.GroupNode: + statsBuilder.NumFields++ + examineMessage(statsBuilder, &ooDecl.MessageBody) + } + } + case *ast.MessageNode: + examineMessage(statsBuilder, &decl.MessageBody) + case *ast.EnumNode: + examineEnum(statsBuilder, decl) + case *ast.ExtendNode: + examineExtend(statsBuilder, decl) + } + } +} + +func examineEnum(statsBuilder *statsBuilder, enumNode *ast.EnumNode) { + statsBuilder.NumEnums++ + for _, decl := range enumNode.Decls { + _, ok := decl.(*ast.EnumValueNode) + if ok { + statsBuilder.NumEnumValues++ + } + } +} + +func examineExtend(statsBuilder *statsBuilder, extendNode *ast.ExtendNode) { + for _, decl := range extendNode.Decls { + switch decl := decl.(type) { + case *ast.FieldNode: + statsBuilder.NumExtensions++ + case *ast.GroupNode: + statsBuilder.NumExtensions++ + examineMessage(statsBuilder, &decl.MessageBody) + } + } +} diff --git a/pkg/bufman/pkg/protostat/protostatos/file_walker.go b/pkg/bufman/pkg/protostat/protostatos/file_walker.go new file mode 100644 index 000000000..c8a987a42 --- /dev/null +++ b/pkg/bufman/pkg/protostat/protostatos/file_walker.go @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protostatos + +import ( + "context" + "io" + "os" + "path/filepath" + + "go.uber.org/multierr" +) + +type fileWalker struct { + filenames []string +} + +func newFileWalker(filenames []string) *fileWalker { + return &fileWalker{ + filenames: filenames, + } +} + +func (f *fileWalker) Walk(ctx context.Context, fu func(io.Reader) error) error { + for _, filename := range f.filenames { + if filepath.Ext(filename) != ".proto" { + continue + } + file, err := os.Open(filename) + if err != nil { + return err + } + if err := fu(file); err != nil { + return multierr.Append(err, file.Close()) + } + if err := file.Close(); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/pkg/protostat/protostatos/protostatos.go b/pkg/bufman/pkg/protostat/protostatos/protostatos.go new file mode 100644 index 000000000..8656f880b --- /dev/null +++ b/pkg/bufman/pkg/protostat/protostatos/protostatos.go @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protostatos + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protostat" + +// NewFileWalker returns a new FileWalker for the given filenames. +// +// Anything without the .proto extension will be excluded. +func NewFileWalker(filenames ...string) protostat.FileWalker { + return newFileWalker(filenames) +} diff --git a/pkg/bufman/pkg/protostat/protostatstorage/file_walker.go b/pkg/bufman/pkg/protostat/protostatstorage/file_walker.go new file mode 100644 index 000000000..1f89def40 --- /dev/null +++ b/pkg/bufman/pkg/protostat/protostatstorage/file_walker.go @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protostatstorage + +import ( + "context" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "go.uber.org/multierr" +) + +type fileWalker struct { + readBucket storage.ReadBucket +} + +func newFileWalker(readBucket storage.ReadBucket) *fileWalker { + return &fileWalker{ + readBucket: storage.MapReadBucket( + readBucket, + storage.MatchPathExt(".proto"), + ), + } +} + +func (f *fileWalker) Walk(ctx context.Context, fu func(io.Reader) error) error { + return f.readBucket.Walk( + ctx, + "", + func(objectInfo storage.ObjectInfo) (retErr error) { + readObjectCloser, err := f.readBucket.Get(ctx, objectInfo.Path()) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, readObjectCloser.Close()) + }() + return fu(readObjectCloser) + }, + ) +} diff --git a/pkg/bufman/pkg/protostat/protostatstorage/protostatstorage.go b/pkg/bufman/pkg/protostat/protostatstorage/protostatstorage.go new file mode 100644 index 000000000..4756c94fb --- /dev/null +++ b/pkg/bufman/pkg/protostat/protostatstorage/protostatstorage.go @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protostatstorage + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protostat" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +// NewFileWalker returns a new FileWalker for the given ReadBucket. +// +// Anything without the .proto extension will be excluded. +func NewFileWalker(readBucket storage.ReadBucket) protostat.FileWalker { + return newFileWalker(readBucket) +} diff --git a/pkg/bufman/pkg/prototesting/prototesting.go b/pkg/bufman/pkg/prototesting/prototesting.go new file mode 100644 index 000000000..f28c20c1e --- /dev/null +++ b/pkg/bufman/pkg/prototesting/prototesting.go @@ -0,0 +1,262 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prototesting + +import ( + "bytes" + "context" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/diff" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "go.uber.org/multierr" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/descriptorpb" +) + +// GetProtocFileDescriptorSet gets the validated FileDescriptorSet using +// protoc and the Well-Known Types on the current PATH. +// +// Only use for testing. +func GetProtocFileDescriptorSet( + ctx context.Context, + runner command.Runner, + roots []string, + realFilePaths []string, + includeImports bool, + includeSourceInfo bool, +) (_ *descriptorpb.FileDescriptorSet, retErr error) { + tempFile, err := os.CreateTemp("", "") + if err != nil { + return nil, err + } + tempFilePath := tempFile.Name() + defer func() { + if err := tempFile.Close(); err != nil { + retErr = multierr.Append(retErr, err) + } + if err := os.Remove(tempFilePath); err != nil { + retErr = multierr.Append(retErr, err) + } + }() + + if err := RunProtoc( + ctx, + runner, + roots, + realFilePaths, + includeImports, + includeSourceInfo, + nil, + nil, + fmt.Sprintf("--descriptor_set_out=%s", tempFilePath), + ); err != nil { + return nil, err + } + + data, err := os.ReadFile(tempFilePath) + if err != nil { + return nil, err + } + firstFileDescriptorSet := &descriptorpb.FileDescriptorSet{} + if err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(data, firstFileDescriptorSet); err != nil { + return nil, err + } + resolver, err := protoencoding.NewResolver(protodescriptor.FileDescriptorsForFileDescriptorSet(firstFileDescriptorSet)...) + if err != nil { + return nil, err + } + fileDescriptorSet := &descriptorpb.FileDescriptorSet{} + if err := protoencoding.NewWireUnmarshaler(resolver).Unmarshal(data, fileDescriptorSet); err != nil { + return nil, err + } + return fileDescriptorSet, nil +} + +// GetProtocVersion runs protoc --version with RunProtoc and returns the output sans the "libprotoc" prefix +func GetProtocVersion(ctx context.Context) (string, error) { + var stdout bytes.Buffer + runner := command.NewRunner() + if err := RunProtoc(ctx, runner, nil, nil, false, false, nil, &stdout, "--version"); err != nil { + return "", err + } + return strings.TrimSpace(strings.TrimPrefix(stdout.String(), "libprotoc")), nil +} + +// RunProtoc runs protoc. +func RunProtoc( + ctx context.Context, + runner command.Runner, + roots []string, + realFilePaths []string, + includeImports bool, + includeSourceInfo bool, + env map[string]string, + stdout io.Writer, + extraFlags ...string, +) error { + protocBinPath, err := getProtocBinPath() + if err != nil { + return err + } + if resolved, err := filepath.EvalSymlinks(protocBinPath); err == nil { + protocBinPath = resolved + } + protocIncludePath, err := getProtocIncludePath(protocBinPath) + if err != nil { + return err + } + args := []string{"-I", protocIncludePath} + for _, root := range roots { + args = append(args, "-I", root) + } + if includeImports { + args = append(args, "--include_imports") + } + if includeSourceInfo { + args = append(args, "--include_source_info") + } + args = append(args, extraFlags...) + args = append(args, realFilePaths...) + + stderr := bytes.NewBuffer(nil) + if stdout == nil { + stdout = stderr + } + if err := runner.Run( + ctx, + protocBinPath, + command.RunWithArgs(args...), + command.RunWithEnv(env), + command.RunWithStdout(stdout), + command.RunWithStderr(stderr), + ); err != nil { + return fmt.Errorf("%s returned error: %v %v", protocBinPath, err, stderr.String()) + } + return nil +} + +// DiffFileDescriptorSetsWire diffs the two FileDescriptorSets using proto.MarshalWire. +func DiffFileDescriptorSetsWire( + ctx context.Context, + runner command.Runner, + one *descriptorpb.FileDescriptorSet, + two *descriptorpb.FileDescriptorSet, + oneName string, + twoName string, +) (string, error) { + oneData, err := protoencoding.NewWireMarshaler().Marshal(one) + if err != nil { + return "", err + } + twoData, err := protoencoding.NewWireMarshaler().Marshal(two) + if err != nil { + return "", err + } + output, err := diff.Diff(ctx, runner, oneData, twoData, oneName, twoName) + if err != nil { + return "", err + } + return string(output), nil +} + +// DiffFileDescriptorSetsJSON diffs the two FileDescriptorSets using JSON. +func DiffFileDescriptorSetsJSON( + ctx context.Context, + runner command.Runner, + one *descriptorpb.FileDescriptorSet, + two *descriptorpb.FileDescriptorSet, + oneName string, + twoName string, +) (string, error) { + oneResolver, err := protoencoding.NewResolver(protodescriptor.FileDescriptorsForFileDescriptorSet(one)...) + if err != nil { + return "", err + } + oneData, err := protoencoding.NewJSONMarshaler(oneResolver, protoencoding.JSONMarshalerWithIndent()).Marshal(one) + if err != nil { + return "", err + } + twoResolver, err := protoencoding.NewResolver(protodescriptor.FileDescriptorsForFileDescriptorSet(two)...) + if err != nil { + return "", err + } + twoData, err := protoencoding.NewJSONMarshaler(twoResolver, protoencoding.JSONMarshalerWithIndent()).Marshal(two) + if err != nil { + return "", err + } + output, err := diff.Diff(ctx, runner, oneData, twoData, oneName, twoName) + if err != nil { + return "", err + } + return string(output), nil +} + +// DiffFileDescriptorSetsCompare diffs the two FileDescriptorSets using the cmp package. +func DiffFileDescriptorSetsCompare( + one *descriptorpb.FileDescriptorSet, + two *descriptorpb.FileDescriptorSet, +) string { + return cmp.Diff(one, two, protocmp.Transform()) +} + +// AssertFileDescriptorSetsEqual asserts that the FileDescriptorSet are equal for +// JSON and compare. +func AssertFileDescriptorSetsEqual( + t *testing.T, + runner command.Runner, + one *descriptorpb.FileDescriptorSet, + two *descriptorpb.FileDescriptorSet, +) { + diff, err := DiffFileDescriptorSetsJSON(context.Background(), runner, one, two, "buf", "protoc") + assert.NoError(t, err) + assert.Empty(t, diff) + diff = DiffFileDescriptorSetsCompare(one, two) + assert.Empty(t, diff) +} + +// getProtocBinPath gets the os-specific path for the protoc binary on disk. +func getProtocBinPath() (string, error) { + protocBinPath, err := exec.LookPath("protoc") + if err != nil { + return "", err + } + return filepath.Abs(protocBinPath) +} + +// checkWKT checks that the well-known types are in included in the protoc libraries and returns an error if +// they are not present. +func checkWKT(protocIncludePath string) error { + // OK to use os.Stat here + wktFileInfo, err := os.Stat(filepath.Join(protocIncludePath, "google", "protobuf", "any.proto")) + if err != nil { + return err + } + if !wktFileInfo.Mode().IsRegular() { + return fmt.Errorf("could not find google/protobuf/any.proto in %s", protocIncludePath) + } + return nil +} diff --git a/pkg/bufman/pkg/prototesting/prototesting_unix.go b/pkg/bufman/pkg/prototesting/prototesting_unix.go new file mode 100644 index 000000000..34ae73e7a --- /dev/null +++ b/pkg/bufman/pkg/prototesting/prototesting_unix.go @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris + +package prototesting + +import ( + "path/filepath" +) + +func getProtocIncludePath(protocBinPath string) (string, error) { + protocIncludePath, err := filepath.Abs(filepath.Join(filepath.Dir(protocBinPath), "..", "include")) + if err != nil { + return "", err + } + if err := checkWKT(protocIncludePath); err != nil { + return "", err + } + return protocIncludePath, nil +} diff --git a/pkg/bufman/pkg/prototesting/prototesting_windows.go b/pkg/bufman/pkg/prototesting/prototesting_windows.go new file mode 100644 index 000000000..5d6f6d016 --- /dev/null +++ b/pkg/bufman/pkg/prototesting/prototesting_windows.go @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package prototesting + +import ( + "path/filepath" +) + +func getProtocIncludePath(protocBinPath string) (string, error) { + protocIncludePath, err := filepath.Abs( + filepath.Join(filepath.Dir(protocBinPath), + "..", + "lib", + "include", + )) + if err != nil { + return "", err + } + if err := checkWKT(protocIncludePath); err != nil { + return "", err + } + return protocIncludePath, nil +} diff --git a/pkg/bufman/pkg/prototime/prototime.go b/pkg/bufman/pkg/prototime/prototime.go new file mode 100644 index 000000000..c65aab342 --- /dev/null +++ b/pkg/bufman/pkg/prototime/prototime.go @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prototime + +import ( + "time" + + "google.golang.org/protobuf/types/known/timestamppb" +) + +// NewTimestamp creates a new proto WKT timestamp from a time.Time. +// It runs CheckValid() on the timestamp before returning. +func NewTimestamp(t time.Time) (*timestamppb.Timestamp, error) { + timestamp := timestamppb.New(t) + if err := timestamp.CheckValid(); err != nil { + return nil, err + } + return timestamp, nil +} diff --git a/pkg/bufman/pkg/protoversion/package_version.go b/pkg/bufman/pkg/protoversion/package_version.go new file mode 100644 index 000000000..ce3dc047a --- /dev/null +++ b/pkg/bufman/pkg/protoversion/package_version.go @@ -0,0 +1,205 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoversion + +import ( + "strconv" + "strings" +) + +var _ PackageVersion = &packageVersion{} + +type packageVersion struct { + major int + stabilityLevel StabilityLevel + minor int + patch int + suffix string +} + +func newPackageVersionForPackage(pkg string) (*packageVersion, bool) { + if pkg == "" { + return nil, false + } + parts := strings.Split(pkg, ".") + if len(parts) < 2 { + return nil, false + } + lastPart := parts[len(parts)-1] + // must at least contain 'v' and a number + if len(lastPart) < 2 { + return nil, false + } + if lastPart[0] != 'v' { + return nil, false + } + + // v1beta1 -> 1beta1 + // v1testfoo -> 1testfoo + // v1p1alpha1 -> p1alpha1 + version := lastPart[1:] + + if strings.Contains(version, "test") { + // 1testfoo -> [1, foo] + split := strings.SplitN(version, "test", 2) + if len(split) != 2 { + return nil, false + } + major, ok := positiveNumber(split[0]) + if !ok { + return nil, false + } + return newPackageVersion(major, StabilityLevelTest, 0, 0, split[1]), true + } + + var stabilityLevel StabilityLevel + containsAlpha := strings.Contains(version, "alpha") + containsBeta := strings.Contains(version, "beta") + switch { + case !containsAlpha && !containsBeta: + stabilityLevel = StabilityLevelStable + case containsAlpha && !containsBeta: + stabilityLevel = StabilityLevelAlpha + case !containsAlpha && containsBeta: + stabilityLevel = StabilityLevelBeta + case containsAlpha && containsBeta: + return nil, false + } + if stabilityLevel != StabilityLevelStable { + // 1alpha1 -> [1, 1] + // 1p1alpha1 ->[1p1, 1] + // 1alpha -> [1, ""] + split := strings.SplitN(version, stabilityLevel.String(), 2) + if len(split) != 2 { + return nil, false + } + minor := 0 + var ok bool + if split[1] != "" { + minor, ok = positiveNumber(split[1]) + if !ok { + return nil, false + } + } + major, patch, ok := getAlphaBetaMajorPatch(split[0]) + if !ok { + return nil, false + } + return newPackageVersion(major, stabilityLevel, minor, patch, ""), true + } + + // no suffix that is valid, make sure we just have a number + major, ok := positiveNumber(version) + if !ok { + return nil, false + } + return newPackageVersion(major, StabilityLevelStable, 0, 0, ""), true +} + +func newPackageVersion( + major int, + stabilityLevel StabilityLevel, + minor int, + patch int, + suffix string, +) *packageVersion { + return &packageVersion{ + major: major, + stabilityLevel: stabilityLevel, + minor: minor, + patch: patch, + suffix: suffix, + } +} + +func (p *packageVersion) Major() int { + return p.major +} + +func (p *packageVersion) StabilityLevel() StabilityLevel { + return p.stabilityLevel +} + +func (p *packageVersion) Minor() int { + return p.minor +} + +func (p *packageVersion) Patch() int { + return p.patch +} + +func (p *packageVersion) Suffix() string { + return p.suffix +} + +func (p *packageVersion) String() string { + var builder strings.Builder + builder.WriteRune('v') + builder.WriteString(strconv.Itoa(p.major)) + if p.patch > 0 { + builder.WriteRune('p') + builder.WriteString(strconv.Itoa(p.patch)) + } + builder.WriteString(p.stabilityLevel.String()) + if p.minor > 0 { + builder.WriteString(strconv.Itoa(p.minor)) + } + if p.suffix != "" { + builder.WriteString(p.suffix) + } + return builder.String() +} + +func (p *packageVersion) isPackageVersion() {} + +func getAlphaBetaMajorPatch(remainder string) (int, int, bool) { + if strings.Contains(remainder, "p") { + // 1p1 -> [1, 1] + patchSplit := strings.SplitN(remainder, "p", 2) + if len(patchSplit) != 2 { + return 0, 0, false + } + major, ok := positiveNumber(patchSplit[0]) + if !ok { + return 0, 0, false + } + patch, ok := positiveNumber(patchSplit[1]) + if !ok { + return 0, 0, false + } + return major, patch, true + } + // no patch, make sure just a number + major, ok := positiveNumber(remainder) + if !ok { + return 0, 0, false + } + return major, 0, true +} + +func positiveNumber(s string) (int, bool) { + if s == "" { + return 0, false + } + value, err := strconv.ParseInt(s, 10, 32) + if err != nil { + return 0, false + } + if value < 1 { + return 0, false + } + return int(value), true +} diff --git a/pkg/bufman/pkg/protoversion/protoversion.go b/pkg/bufman/pkg/protoversion/protoversion.go new file mode 100644 index 000000000..c6fe938d0 --- /dev/null +++ b/pkg/bufman/pkg/protoversion/protoversion.go @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoversion + +import ( + "fmt" + "strconv" +) + +const ( + // StabilityLevelStable is stable. + StabilityLevelStable StabilityLevel = iota + 1 + // StabilityLevelAlpha is alpha stability. + StabilityLevelAlpha + // StabilityLevelBeta is beta stability. + StabilityLevelBeta + // StabilityLevelTest is test stability. + StabilityLevelTest +) + +var stabilityLevelToString = map[StabilityLevel]string{ + StabilityLevelStable: "", + StabilityLevelAlpha: "alpha", + StabilityLevelBeta: "beta", + StabilityLevelTest: "test", +} + +// StabilityLevel is the stability level. +type StabilityLevel int + +// String implements fmt.Stringer. +func (s StabilityLevel) String() string { + value, ok := stabilityLevelToString[s] + if ok { + return value + } + return strconv.Itoa(int(s)) +} + +// PackageVersion is a package version. +// +// A package has a version if the last component is a version of the form +// v\d+, v\d+test.*, v\d+(alpha|beta)\d*, or v\d+p\d+(alpha|beta)\d* +// where numbers are >=1. +// +// See https://cloud.google.com/apis/design/versioning#channel-based_versioning +// See https://cloud.google.com/apis/design/versioning#release-based_versioning +type PackageVersion interface { + fmt.Stringer + + // Required. + // Will always be >=1. + Major() int + // Required. + StabilityLevel() StabilityLevel + // Optional. + // Only potentially set if the stability level is alpha or beta. + // Will always be >=1. + Minor() int + // Optional. + // Only potentially set if the stability level is alpha or beta. + // Will always be >=1. + Patch() int + // Optional. + // Only potentially set if the stability level is test. + Suffix() string + + isPackageVersion() +} + +// NewPackageVersionForPackage returns the PackageVersion for the package. +// +// Returns false if the package has no package version per the specifications. +func NewPackageVersionForPackage(pkg string) (PackageVersion, bool) { + return newPackageVersionForPackage(pkg) +} diff --git a/pkg/bufman/pkg/protoversion/protoversion_test.go b/pkg/bufman/pkg/protoversion/protoversion_test.go new file mode 100644 index 000000000..ff97752f3 --- /dev/null +++ b/pkg/bufman/pkg/protoversion/protoversion_test.go @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protoversion + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestPackageHasPackageVersion(t *testing.T) { + t.Parallel() + // note we allow this in the linter as we check this in PACKAGE_DEFINED + // however, for the purposes of packageHasPackageVersion, this does not + testNewPackageVersionForPackage(t, nil, false, "") + testNewPackageVersionForPackage(t, nil, false, "foo") + testNewPackageVersionForPackage(t, nil, false, "foo.bar") + testNewPackageVersionForPackage(t, nil, false, "foo.v1.bar") + testNewPackageVersionForPackage(t, nil, false, "v1") + testNewPackageVersionForPackage(t, nil, false, "v1beta1") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelStable, 0, 0, ""), true, "foo.v1") + testNewPackageVersionForPackage(t, newPackageVersion(2, StabilityLevelStable, 0, 0, ""), true, "foo.v2") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelStable, 0, 0, ""), true, "foo.bar.v1") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelAlpha, 1, 0, ""), true, "foo.bar.v1alpha1") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelAlpha, 2, 0, ""), true, "foo.bar.v1alpha2") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelBeta, 1, 0, ""), true, "foo.bar.v1beta1") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelBeta, 2, 0, ""), true, "foo.bar.v1beta2") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelAlpha, 1, 1, ""), true, "foo.bar.v1p1alpha1") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelAlpha, 2, 1, ""), true, "foo.bar.v1p1alpha2") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelBeta, 1, 1, ""), true, "foo.bar.v1p1beta1") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelBeta, 2, 1, ""), true, "foo.bar.v1p1beta2") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelTest, 0, 0, ""), true, "foo.bar.v1test") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelTest, 0, 0, "foo"), true, "foo.bar.v1testfoo") + testNewPackageVersionForPackage(t, newPackageVersion(4, StabilityLevelTest, 0, 0, ""), true, "foo.bar.v4test") + testNewPackageVersionForPackage(t, newPackageVersion(4, StabilityLevelTest, 0, 0, "foo"), true, "foo.bar.v4testfoo") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelAlpha, 0, 0, ""), true, "foo.bar.v1alpha") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelAlpha, 0, 1, ""), true, "foo.bar.v1p1alpha") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelBeta, 0, 0, ""), true, "foo.bar.v1beta") + testNewPackageVersionForPackage(t, newPackageVersion(1, StabilityLevelBeta, 0, 1, ""), true, "foo.bar.v1p1beta") + testNewPackageVersionForPackage(t, nil, false, "foo.v0") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0alpha1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0alpha2") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0beta1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0beta2") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0p1alpha1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0p1alpha2") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0p1beta1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0p1beta2") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0test") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v0testfoo") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1alpha0") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1beta0") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1p1alpha0") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1p1beta0") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1p0alpha1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1p0beta1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1alpha1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1alpha2") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1beta1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1beta2") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1p1alpha1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1p1alpha2") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1p1beta1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1p1beta2") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1test") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.vv1testfoo") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1aalpha1") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1p1test") + testNewPackageVersionForPackage(t, nil, false, "foo.bar.v1p1testfoo") +} + +func testNewPackageVersionForPackage(t *testing.T, expectedPackageVersion PackageVersion, expectedOK bool, pkg string) { + packageVersion, ok := NewPackageVersionForPackage(pkg) + assert.Equal(t, expectedOK, ok, pkg) + if expectedOK { + assert.Equal(t, expectedPackageVersion, packageVersion, pkg) + split := strings.Split(pkg, ".") + assert.Equal(t, split[len(split)-1], packageVersion.String(), pkg) + } else { + assert.Nil(t, packageVersion) + } +} diff --git a/pkg/bufman/pkg/spdx/cmd/spdx-go-data/main.go b/pkg/bufman/pkg/spdx/cmd/spdx-go-data/main.go new file mode 100644 index 000000000..5b0f70a60 --- /dev/null +++ b/pkg/bufman/pkg/spdx/cmd/spdx-go-data/main.go @@ -0,0 +1,134 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "bytes" + "context" + "go/format" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/spdx" + "github.com/spf13/cobra" + "github.com/spf13/pflag" +) + +const ( + programName = "spdx-go-data" + + pkgFlagName = "package" +) + +func main() { + appcmd.Main(context.Background(), newCommand()) +} + +func newCommand() *appcmd.Command { + flags := newFlags() + return &appcmd.Command{ + Use: programName, + Args: cobra.NoArgs, + Run: func(ctx context.Context, container app.Container) error { + return run(ctx, container, flags) + }, + BindFlags: flags.Bind, + } +} + +type flags struct { + Pkg string +} + +func newFlags() *flags { + return &flags{} +} + +func (f *flags) Bind(flagSet *pflag.FlagSet) { + flagSet.StringVar( + &f.Pkg, + pkgFlagName, + "", + "The name of the generated package.", + ) + _ = cobra.MarkFlagRequired(flagSet, pkgFlagName) +} + +func run(ctx context.Context, container app.Container, flags *flags) error { + licenseInfos, err := spdx.GetLicenseInfos(ctx) + if err != nil { + return err + } + data, err := getGolangFileData(ctx, flags.Pkg, licenseInfos) + if err != nil { + return err + } + _, err = container.Stdout().Write(data) + return err +} + +func getGolangFileData( + ctx context.Context, + pkg string, + licenseInfos []*spdx.LicenseInfo, +) ([]byte, error) { + buffer := bytes.NewBuffer(nil) + _, _ = buffer.WriteString(`// Code generated by ` + programName + `. DO NOT EDIT. + +package ` + pkg + ` + +import "strings" + +// LicenseInfo is SPDX license information. +// +// See https://spdx.org/licenses. +type LicenseInfo interface { + // The SPDX identifier. + // + // Case-sensitive. + ID() string +} + +// GetLicenseInfo gets the LicenseInfo for the id. +// +// The parameter id is not case-sensitive. +func GetLicenseInfo(id string) (LicenseInfo, bool) { + licenseInfo, ok := lowercaseIDToLicenseInfo[strings.ToLower(id)] + return licenseInfo, ok +} + +var lowercaseIDToLicenseInfo = map[string]*licenseInfo{ +`) + + for _, licenseInfo := range licenseInfos { + _, _ = buffer.WriteString(`"` + strings.ToLower(licenseInfo.ID) + `": &licenseInfo{ +id: "` + licenseInfo.ID + `", +}, +`) + } + + _, _ = buffer.WriteString(`} + +type licenseInfo struct { + id string +} + +func (l *licenseInfo) ID() string { + return l.id +}`) + return format.Source(buffer.Bytes()) +} diff --git a/pkg/bufman/pkg/spdx/cmd/spdx-ts-data/main.go b/pkg/bufman/pkg/spdx/cmd/spdx-ts-data/main.go new file mode 100644 index 000000000..3acdfc42b --- /dev/null +++ b/pkg/bufman/pkg/spdx/cmd/spdx-ts-data/main.go @@ -0,0 +1,146 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "bytes" + "context" + "encoding/json" + "regexp" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/spdx" + "github.com/spf13/cobra" +) + +const ( + programName = "spdx-ts-data" +) + +var ( + numberRegexp = regexp.MustCompile(`^(?:\d+|\d+\.\d+)$`) + identifierRegexp = regexp.MustCompile(`^[a-zA-Z$_][a-zA-Z0-9$_]*$`) +) + +func main() { + appcmd.Main(context.Background(), newCommand()) +} + +func newCommand() *appcmd.Command { + return &appcmd.Command{ + Use: programName, + Args: cobra.NoArgs, + Run: run, + } +} + +func run(ctx context.Context, container app.Container) error { + licenseInfos, err := spdx.GetLicenseInfos(ctx) + if err != nil { + return err + } + data, err := getTSFileData(licenseInfos) + if err != nil { + return err + } + _, err = container.Stdout().Write(data) + return err +} + +func getTSFileData(licenseInfos []*spdx.LicenseInfo) ([]byte, error) { + buffer := bytes.NewBuffer(nil) + _, _ = buffer.WriteString(`// Code generated by ` + programName + `. DO NOT EDIT. + +export const LICENSES = { +`) + + for _, licenseInfo := range licenseInfos { + id, err := formatString(licenseInfo.ID) + if err != nil { + return nil, err + } + name, err := formatString(licenseInfo.Name) + if err != nil { + return nil, err + } + propName := strings.ToLower(licenseInfo.ID) + if shouldQuotePropertyName(propName) { + quoted, err := json.Marshal(propName) + if err != nil { + return nil, err + } + propName = string(quoted) + } + _, _ = buffer.WriteString(` ` + propName + `: { + ID: ` + id + ` as const, + name: ` + name + ` as const, + }, +`) + } + + _, _ = buffer.WriteString(`}; +`) + return buffer.Bytes(), nil +} + +// formatsString matches https://prettier.io/docs/en/options.html#quotes default behavior. +func formatString(str string) (string, error) { + var numDoubleQuotes, numSingleQuotes int + for _, r := range str { + switch r { + case '"': + numDoubleQuotes++ + case '\'': + numSingleQuotes++ + } + } + b, err := json.Marshal(str) + if err != nil { + return "", err + } + if numDoubleQuotes <= numSingleQuotes { + return string(b), nil + } + var inEscape bool + var sb strings.Builder + sb.WriteByte('\'') + for _, r := range str { + if inEscape { + inEscape = false + if r != '"' { + sb.WriteRune('\\') + } + sb.WriteRune(r) + } else if r == '\\' { + inEscape = true + } else { + sb.WriteRune(r) + } + } + sb.WriteByte('\'') + return sb.String(), nil +} + +// shouldQuotePropertyName returns where the name should be quoted as a property key. +// This follows the rules for 'as-needed' here: https://prettier.io/docs/en/options.html#quote-props +func shouldQuotePropertyName(name string) bool { + if numberRegexp.MatchString(name) || identifierRegexp.MatchString(name) { + return false + } + return true +} diff --git a/pkg/bufman/pkg/spdx/spdx.go b/pkg/bufman/pkg/spdx/spdx.go new file mode 100644 index 000000000..e83ceec48 --- /dev/null +++ b/pkg/bufman/pkg/spdx/spdx.go @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spdx + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "sort" + "strings" + + "go.uber.org/multierr" +) + +const ( + licenseListURL = "https://raw.githubusercontent.com/spdx/license-list-data/v3.18/json/licenses.json" +) + +var ( + httpClient = &http.Client{} + + bannedLowercaseIDs = []string{ + "custom", + "none", + } +) + +// GetLicenseInfos get the SPDX license information, +// sorted by lowercase of ID and bans "custom", "none" +func GetLicenseInfos(ctx context.Context) (_ []*LicenseInfo, retErr error) { + request, err := http.NewRequestWithContext(ctx, "GET", licenseListURL, nil) + if err != nil { + return nil, err + } + response, err := httpClient.Do(request) + if err != nil { + return nil, err + } + defer func() { + retErr = multierr.Append(retErr, response.Body.Close()) + }() + if response.StatusCode != http.StatusOK { + return nil, fmt.Errorf("expected HTTP status code %d to be %d", response.StatusCode, http.StatusOK) + } + data, err := io.ReadAll(response.Body) + if err != nil { + return nil, err + } + licenseInfoList := &licenseInfoList{} + if err := json.Unmarshal(data, licenseInfoList); err != nil { + return nil, err + } + lowercaseIDMap := make(map[string]struct{}) + for _, licenseInfo := range licenseInfoList.LicenseInfos { + lowercaseID := strings.ToLower(licenseInfo.ID) + if _, ok := lowercaseIDMap[lowercaseID]; ok { + return nil, fmt.Errorf("duplicate lowercase ID: %q", lowercaseID) + } + lowercaseIDMap[lowercaseID] = struct{}{} + } + for _, bannedLowercaseID := range bannedLowercaseIDs { + if _, ok := lowercaseIDMap[bannedLowercaseID]; ok { + return nil, fmt.Errorf("banned lowercase ID: %q", bannedLowercaseID) + } + } + sort.Slice( + licenseInfoList.LicenseInfos, + func(i int, j int) bool { + return strings.ToLower(licenseInfoList.LicenseInfos[i].ID) < + strings.ToLower(licenseInfoList.LicenseInfos[j].ID) + }, + ) + return licenseInfoList.LicenseInfos, nil +} + +type licenseInfoList struct { + LicenseInfos []*LicenseInfo `json:"licenses,omitempty" yaml:"licenses,omitempty"` +} + +type LicenseInfo struct { + ID string `json:"licenseId,omitempty" yaml:"licenseId,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` +} diff --git a/pkg/bufman/pkg/storage/bucket.go b/pkg/bufman/pkg/storage/bucket.go new file mode 100644 index 000000000..efac935ee --- /dev/null +++ b/pkg/bufman/pkg/storage/bucket.go @@ -0,0 +1,250 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + "io" +) + +// ReadBucket is a simple read-only bucket. +// +// All paths are regular files - Buckets do not handle directories. +// All paths must be relative. +// All paths are cleaned and ToSlash'ed by each function. +// Paths must not jump the bucket context, that is after clean, they +// cannot contain "..". +type ReadBucket interface { + // Get gets the path. + // + // The behavior of concurrently Getting and Putting an object is undefined. + // The returned ReadObjectCloser is not thread-safe. + // + // Returns ErrNotExist if the path does not exist, other error + // if there is a system error. + Get(ctx context.Context, path string) (ReadObjectCloser, error) + // Stat gets info in the object. + // + // Returns ErrNotExist if the path does not exist, other error + // if there is a system error. + Stat(ctx context.Context, path string) (ObjectInfo, error) + // Walk walks the bucket with the prefix, calling f on each path. + // If the prefix doesn't exist, this is a no-op. + // + // Note that foo/barbaz will not be called for foo/bar, but will + // be called for foo/bar/baz. + // + // All paths given to f are normalized and validated. + // If f returns error, Walk will stop short and return this error. + // Returns other error on system error. + Walk(ctx context.Context, prefix string, f func(ObjectInfo) error) error +} + +// PutOptions are the possible options that can be passed to a Put operation. +type PutOptions struct { + CustomChunkSize bool + ChunkSize int64 // measured in bytes + Atomic bool +} + +// PutOption are options passed when putting an object in a bucket. +type PutOption func(*PutOptions) + +// PutWithChunkSize sets the passed size in bytes to `ChunkSize` and +// `CustomChunkSize` to true. Some implementations of `storage.WriteBucket.Put` +// allow multi-part upload, and allow customizing the chunk size of each part +// upload, or even disabling multi-part upload. This is a suggested chunk size, +// implementations may choose to ignore this option. +func PutWithChunkSize(sizeInBytes int64) PutOption { + return func(opts *PutOptions) { + opts.CustomChunkSize = true + opts.ChunkSize = sizeInBytes + } +} + +// PutWithAtomic ensures that the Put fully writes the file before making it +// available to readers. This happens by default for some implementations, +// while others may need to perform a sequence of operations to ensure +// atomic writes. +// +// The Put operation is complete and the path will be readable once the +// returned WriteObjectCloser is written and closed (without an error). +// Any errors will cause the Put to be skipped (no path will be created). +func PutWithAtomic() PutOption { + return func(opts *PutOptions) { + opts.Atomic = true + } +} + +// WriteBucket is a write-only bucket. +type WriteBucket interface { + // Put returns a WriteObjectCloser to write to the path. + // + // The path is truncated on close. + // The behavior of concurrently Getting and Putting an object is undefined. + // The returned WriteObjectCloser is not thread-safe. + // + // Returns error on system error. + Put(ctx context.Context, path string, opts ...PutOption) (WriteObjectCloser, error) + // Delete deletes the object at the path. + // + // Returns ErrNotExist if the path does not exist, other error + // if there is a system error. + Delete(ctx context.Context, path string) error + // DeleteAll deletes all objects with the prefix. + // If the prefix doesn't exist, this is a no-op. + // + // Note that the prefix is used as a filepath prefix, and + // NOT a string prefix. For example, the prefix "foo/bar" + // will delete "foo/bar/baz", but NOT "foo/barbaz". + DeleteAll(ctx context.Context, prefix string) error + // SetExternalPathSupported returns true if SetExternalPath is supported. + // + // For example, in-memory buckets may choose to return true so that object sources + // are preserved, but filesystem buckets may choose to return false as they have + // their own external paths. + SetExternalPathSupported() bool +} + +// ReadWriteBucket is a simple read/write bucket. +type ReadWriteBucket interface { + ReadBucket + WriteBucket +} + +// ReadBucketCloser is a read-only bucket that must be closed. +type ReadBucketCloser interface { + io.Closer + ReadBucket +} + +// NopReadBucketCloser returns a ReadBucketCloser for the ReadBucket. +func NopReadBucketCloser(readBucket ReadBucket) ReadBucketCloser { + return nopReadBucketCloser{readBucket} +} + +// WriteBucketCloser is a write-only bucket that must be closed. +type WriteBucketCloser interface { + io.Closer + WriteBucket +} + +// NopWriteBucketCloser returns a WriteBucketCloser for the WriteBucket. +func NopWriteBucketCloser(writeBucket WriteBucket) WriteBucketCloser { + return nopWriteBucketCloser{writeBucket} +} + +// ReadWriteBucketCloser is a read/write bucket that must be closed. +type ReadWriteBucketCloser interface { + io.Closer + ReadWriteBucket +} + +// NopReadWriteBucketCloser returns a ReadWriteBucketCloser for the ReadWriteBucket. +func NopReadWriteBucketCloser(readWriteBucket ReadWriteBucket) ReadWriteBucketCloser { + return nopReadWriteBucketCloser{readWriteBucket} +} + +// ObjectInfo contains object info. +type ObjectInfo interface { + // Path is the path of the object. + // + // This will always correspond to a path within the Bucket. For sub-buckets, this is the sub-path, but the + // external path will include the sub-bucket path. + // + // This path will always be normalized, validated, and non-empty. + Path() string + // ExternalPath is the path that identifies the object externally. + // + // This path is not necessarily a file path, and should only be used to + // uniquely identify this file as compared to other assets, to for display + // to users. + // + // The path will be unnormalized, if it is a file path. + // The path will never be empty. If a given implementation has no external path, this falls back to path. + // + // Example: + // Directory: /foo/bar + // Path: baz/bat.proto + // ExternalPath: /foo/bar/baz/bat.proto + // + // Example: + // Directory: . + // Path: baz/bat.proto + // ExternalPath: baz/bat.proto + // + // Example: + // S3 Bucket: https://s3.amazonaws.com/foo + // Path: baz/bat.proto + // ExternalPath: s3://foo/baz/bat.proto + ExternalPath() string +} + +// ReadObject is an object read from a bucket. +type ReadObject interface { + ObjectInfo + io.Reader +} + +// ReadObjectCloser is a ReadObject with a closer. +// +// It must be closed when done. +type ReadObjectCloser interface { + ReadObject + io.Closer +} + +// WriteObject object written to a bucket. +type WriteObject interface { + io.Writer + + // ExternalPath attempts to explicitly set the external path for the new object. + // + // If SetExternalPathSupported returns false, this returns error. + SetExternalPath(externalPath string) error +} + +// WriteObjectCloser is a WriteObject with a closer. +// +// It must be closed when done. +type WriteObjectCloser interface { + WriteObject + io.Closer +} + +type nopReadBucketCloser struct { + ReadBucket +} + +func (nopReadBucketCloser) Close() error { + return nil +} + +type nopWriteBucketCloser struct { + WriteBucket +} + +func (nopWriteBucketCloser) Close() error { + return nil +} + +type nopReadWriteBucketCloser struct { + ReadWriteBucket +} + +func (nopReadWriteBucketCloser) Close() error { + return nil +} diff --git a/pkg/bufman/pkg/storage/cmd/ddiff/main.go b/pkg/bufman/pkg/storage/cmd/ddiff/main.go new file mode 100644 index 000000000..6be35a60b --- /dev/null +++ b/pkg/bufman/pkg/storage/cmd/ddiff/main.go @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package main implements the ddiff command that diffs two directories. +package main + +import ( + "context" + "os" + "path/filepath" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/spf13/cobra" +) + +const ( + use = "ddiff" +) + +func main() { + appcmd.Main(context.Background(), newCommand()) +} + +func newCommand() *appcmd.Command { + return &appcmd.Command{ + Use: use + " dir1 dir2", + Args: cobra.ExactArgs(2), + Run: run, + } +} + +func run(ctx context.Context, container app.Container) error { + oneDirPath := filepath.Clean(container.Arg(0)) + twoDirPath := filepath.Clean(container.Arg(1)) + oneReadWriteBucket, err := storageos.NewProvider(storageos.ProviderWithSymlinks()).NewReadWriteBucket(oneDirPath) + if err != nil { + return err + } + twoReadWriteBucket, err := storageos.NewProvider(storageos.ProviderWithSymlinks()).NewReadWriteBucket(twoDirPath) + if err != nil { + return err + } + var oneExternalPathPrefix string + if oneDirPath != "." { + oneExternalPathPrefix = oneDirPath + string(os.PathSeparator) + } + var twoExternalPathPrefix string + if twoDirPath != "." { + twoExternalPathPrefix = twoDirPath + string(os.PathSeparator) + } + return storage.Diff( + ctx, + command.NewRunner(), + container.Stdout(), + oneReadWriteBucket, + twoReadWriteBucket, + storage.DiffWithExternalPaths(), + storage.DiffWithExternalPathPrefixes( + oneExternalPathPrefix, + twoExternalPathPrefix, + ), + ) +} diff --git a/pkg/bufman/pkg/storage/cmd/storage-go-data/main.go b/pkg/bufman/pkg/storage/cmd/storage-go-data/main.go new file mode 100644 index 000000000..f55b6fbb7 --- /dev/null +++ b/pkg/bufman/pkg/storage/cmd/storage-go-data/main.go @@ -0,0 +1,191 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "bytes" + "context" + "fmt" + "go/format" + "io" + "math" + "path/filepath" + "sort" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app/appcmd" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/spf13/cobra" + "github.com/spf13/pflag" +) + +const ( + programName = "storage-go-data" + + pkgFlagName = "package" + + sliceLength = math.MaxInt64 +) + +func main() { + appcmd.Main(context.Background(), newCommand()) +} + +func newCommand() *appcmd.Command { + flags := newFlags() + return &appcmd.Command{ + Use: fmt.Sprintf("%s path/to/dir", programName), + Args: cobra.ExactArgs(1), + Run: func(ctx context.Context, container app.Container) error { + return run(ctx, container, flags) + }, + BindFlags: flags.Bind, + } +} + +type flags struct { + Pkg string +} + +func newFlags() *flags { + return &flags{} +} + +func (f *flags) Bind(flagSet *pflag.FlagSet) { + flagSet.StringVar( + &f.Pkg, + pkgFlagName, + "", + "The name of the generated package.", + ) +} + +func run(ctx context.Context, container app.Container, flags *flags) error { + dirPath := container.Arg(0) + packageName := flags.Pkg + if packageName == "" { + packageName = filepath.Base(dirPath) + } + pathToData, err := getPathToData(ctx, dirPath) + if err != nil { + return err + } + golangFileData, err := getGolangFileData(pathToData, packageName) + if err != nil { + return err + } + _, err = container.Stdout().Write(golangFileData) + return err +} + +func getPathToData(ctx context.Context, dirPath string) (map[string][]byte, error) { + readWriteBucket, err := storageos.NewProvider(storageos.ProviderWithSymlinks()).NewReadWriteBucket(dirPath) + if err != nil { + return nil, err + } + pathToData := make(map[string][]byte) + if err := storage.WalkReadObjects( + ctx, + readWriteBucket, + "", + func(readObject storage.ReadObject) error { + data, err := io.ReadAll(readObject) + if err != nil { + return err + } + pathToData[readObject.Path()] = data + return nil + }, + ); err != nil { + return nil, err + } + return pathToData, nil +} + +func getGolangFileData(pathToData map[string][]byte, packageName string) ([]byte, error) { + buffer := bytes.NewBuffer(nil) + _, _ = buffer.WriteString(`// Code generated by `) + _, _ = buffer.WriteString(programName) + _, _ = buffer.WriteString(`. DO NOT EDIT. + +package `) + _, _ = buffer.WriteString(packageName) + _, _ = buffer.WriteString(` + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +var ( + // ReadBucket is the storage.ReadBucket with the static data generated for this package. + ReadBucket storage.ReadBucket + + pathToData = map[string][]byte{ +`) + + paths := make([]string, 0, len(pathToData)) + for path := range pathToData { + paths = append(paths, path) + } + sort.Strings(paths) + + for _, path := range paths { + _, _ = buffer.WriteString(`"`) + _, _ = buffer.WriteString(path) + _, _ = buffer.WriteString(`": { +`) + data := pathToData[path] + for len(data) > 0 { + n := sliceLength + if n > len(data) { + n = len(data) + } + accum := "" + for _, elem := range data[:n] { + accum += fmt.Sprintf("0x%02x,", elem) + } + _, _ = buffer.WriteString(accum) + _, _ = buffer.WriteString("\n") + data = data[n:] + } + _, _ = buffer.WriteString(`}, +`) + } + _, _ = buffer.WriteString(`} +) + +func init() { + readBucket, err := storagemem.NewReadBucket(pathToData) + if err != nil { + panic(err.Error()) + } + ReadBucket = readBucket +} + +// Exists returns true if the given path exists in the static data. +// +// The path is normalized within this function. +func Exists(path string) bool { + _, ok := pathToData[normalpath.Normalize(path)] + return ok +} +`) + + return format.Source(buffer.Bytes()) +} diff --git a/pkg/bufman/pkg/storage/copy.go b/pkg/bufman/pkg/storage/copy.go new file mode 100644 index 000000000..e4f13ba94 --- /dev/null +++ b/pkg/bufman/pkg/storage/copy.go @@ -0,0 +1,175 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + "io" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" + "go.uber.org/multierr" +) + +// Copy copies the bucket at from to the bucket at to. +// +// Copies done concurrently. +// Returns the number of files copied. +func Copy( + ctx context.Context, + from ReadBucket, + to WriteBucket, + options ...CopyOption, +) (int, error) { + copyOptions := newCopyOptions() + for _, option := range options { + option(copyOptions) + } + return copyPaths( + ctx, + from, + to, + copyOptions.externalPaths, + ) +} + +// CopyReadObject copies the contents of the ReadObject into the WriteBucket at the path. +func CopyReadObject( + ctx context.Context, + writeBucket WriteBucket, + readObject ReadObject, + options ...CopyOption, +) (retErr error) { + copyOptions := newCopyOptions() + for _, option := range options { + option(copyOptions) + } + return copyReadObject( + ctx, + writeBucket, + readObject, + copyOptions.externalPaths, + ) +} + +// CopyReader copies the contents of the Reader into the WriteBucket at the path. +func CopyReader( + ctx context.Context, + writeBucket WriteBucket, + reader io.Reader, + path string, +) (retErr error) { + writeObjectCloser, err := writeBucket.Put(ctx, path) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, writeObjectCloser.Close()) + }() + _, err = io.Copy(writeObjectCloser, reader) + return err +} + +// CopyOption is an option for Copy. +type CopyOption func(*copyOptions) + +// CopyWithExternalPaths returns a new CopyOption that says to copy external paths. +// +// The to WriteBucket must support setting external paths. +func CopyWithExternalPaths() CopyOption { + return func(copyOptions *copyOptions) { + copyOptions.externalPaths = true + } +} + +func copyPaths( + ctx context.Context, + from ReadBucket, + to WriteBucket, + copyExternalPaths bool, +) (int, error) { + paths, err := AllPaths(ctx, from, "") + if err != nil { + return 0, err + } + var count int + var lock sync.Mutex + jobs := make([]func(context.Context) error, len(paths)) + for i, path := range paths { + path := path + jobs[i] = func(ctx context.Context) error { + if err := copyPath(ctx, from, to, path, copyExternalPaths); err != nil { + return err + } + lock.Lock() + count++ + lock.Unlock() + return nil + } + } + err = thread.Parallelize(ctx, jobs) + return count, err +} + +// copyPath copies the path from the bucket at from to the bucket at to using the given paths. +// +// Paths will be normalized within this function. +func copyPath( + ctx context.Context, + from ReadBucket, + to WriteBucket, + path string, + copyExternalPaths bool, +) (retErr error) { + readObjectCloser, err := from.Get(ctx, path) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(err, readObjectCloser.Close()) + }() + return copyReadObject(ctx, to, readObjectCloser, copyExternalPaths) +} + +func copyReadObject( + ctx context.Context, + writeBucket WriteBucket, + readObject ReadObject, + copyExternalPaths bool, +) (retErr error) { + writeObjectCloser, err := writeBucket.Put(ctx, readObject.Path()) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, writeObjectCloser.Close()) + }() + if copyExternalPaths { + if err := writeObjectCloser.SetExternalPath(readObject.ExternalPath()); err != nil { + return err + } + } + _, err = io.Copy(writeObjectCloser, readObject) + return err +} + +type copyOptions struct { + externalPaths bool +} + +func newCopyOptions() *copyOptions { + return ©Options{} +} diff --git a/pkg/bufman/pkg/storage/diff.go b/pkg/bufman/pkg/storage/diff.go new file mode 100644 index 000000000..155cf685a --- /dev/null +++ b/pkg/bufman/pkg/storage/diff.go @@ -0,0 +1,321 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "bytes" + "context" + "fmt" + "io" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/diff" +) + +// DiffOption is an option for Diff. +type DiffOption func(*diffOptions) + +// DiffWithSuppressCommands returns a new DiffOption that suppresses printing of commands. +func DiffWithSuppressCommands() DiffOption { + return func(diffOptions *diffOptions) { + diffOptions.suppressCommands = true + } +} + +// DiffWithSuppressCommands returns a new DiffOption that suppresses printing of timestamps. +func DiffWithSuppressTimestamps() DiffOption { + return func(diffOptions *diffOptions) { + diffOptions.suppressTimestamps = true + } +} + +// DiffWithExternalPaths returns a new DiffOption that prints diffs with external paths +// instead of paths. +func DiffWithExternalPaths() DiffOption { + return func(diffOptions *diffOptions) { + diffOptions.externalPaths = true + } +} + +// DiffWithExternalPathPrefixes returns a new DiffOption that sets the external path prefixes for the buckets. +// +// If a file is in one bucket but not the other, it will be assumed that the file begins +// with the given prefix, and this prefix should be substituted for the other prefix. +// +// For example, if diffing the directories "test/a" and "test/b", use "test/a/" and "test/b/", +// and a file that is in one with path "test/a/foo.txt" will be shown as not +// existing as "test/b/foo.txt" in two. +// +// Note that the prefixes are directly concatenated, so "/" should be included generally. +// +// This option has no effect if DiffWithExternalPaths is not set. +// This option is not required if the prefixes are equal. +func DiffWithExternalPathPrefixes( + oneExternalPathPrefix string, + twoExternalPathPrefix string, +) DiffOption { + return func(diffOptions *diffOptions) { + if oneExternalPathPrefix != twoExternalPathPrefix { + // we don't know if external paths are file paths or not + // so we just operate on pure string-prefix paths + // this comes up with for example s3:// + diffOptions.oneExternalPathPrefix = oneExternalPathPrefix + diffOptions.twoExternalPathPrefix = twoExternalPathPrefix + } + } +} + +// DiffWithTransform returns a DiffOption that adds a transform function. The transform function will be run on each +// file being compared before it is diffed. transform takes the arguments: +// +// side: one or two whether it is the first or second item in the diff +// filename: the filename including path +// content: the file content. +// +// transform returns a string that is the transformed content of filename. +// +// TODO: this needs to be refactored or removed, especially the implicit side enum. +// Perhaps provide a transform function for a given bucket and apply it there. +func DiffWithTransform( + transform func(side string, filename string, content []byte) []byte, +) DiffOption { + return func(diffOptions *diffOptions) { + diffOptions.transforms = append(diffOptions.transforms, transform) + } +} + +// DiffBytes does a diff of the ReadBuckets. +func DiffBytes( + ctx context.Context, + runner command.Runner, + one ReadBucket, + two ReadBucket, + options ...DiffOption, +) ([]byte, error) { + buffer := bytes.NewBuffer(nil) + if err := Diff(ctx, runner, buffer, one, two, options...); err != nil { + return nil, err + } + return buffer.Bytes(), nil +} + +// Diff writes a diff of the ReadBuckets to the Writer. +func Diff( + ctx context.Context, + runner command.Runner, + writer io.Writer, + one ReadBucket, + two ReadBucket, + options ...DiffOption, +) error { + diffOptions := newDiffOptions() + for _, option := range options { + option(diffOptions) + } + externalPaths := diffOptions.externalPaths + oneExternalPathPrefix := diffOptions.oneExternalPathPrefix + twoExternalPathPrefix := diffOptions.twoExternalPathPrefix + + oneObjectInfos, err := allObjectInfos(ctx, one, "") + if err != nil { + return err + } + twoObjectInfos, err := allObjectInfos(ctx, two, "") + if err != nil { + return err + } + sortObjectInfos(oneObjectInfos) + sortObjectInfos(twoObjectInfos) + onePathToObjectInfo := pathToObjectInfo(oneObjectInfos) + twoPathToObjectInfo := pathToObjectInfo(twoObjectInfos) + + for _, oneObjectInfo := range oneObjectInfos { + path := oneObjectInfo.Path() + oneDiffPath, err := getDiffPathForObjectInfo( + oneObjectInfo, + externalPaths, + oneExternalPathPrefix, + ) + if err != nil { + return err + } + oneData, err := ReadPath(ctx, one, path) + if err != nil { + return err + } + var twoData []byte + var twoDiffPath string + if twoObjectInfo, ok := twoPathToObjectInfo[path]; ok { + twoData, err = ReadPath(ctx, two, path) + if err != nil { + return err + } + twoDiffPath, err = getDiffPathForObjectInfo( + twoObjectInfo, + externalPaths, + twoExternalPathPrefix, + ) + if err != nil { + return err + } + } else { + twoDiffPath, err = getDiffPathForNotFound( + oneObjectInfo, + externalPaths, + oneExternalPathPrefix, + twoExternalPathPrefix, + ) + if err != nil { + return err + } + } + for _, transform := range diffOptions.transforms { + oneData = transform("one", oneDiffPath, oneData) + twoData = transform("two", twoDiffPath, twoData) + } + diffData, err := diff.Diff( + ctx, + runner, + oneData, + twoData, + oneDiffPath, + twoDiffPath, + diffOptions.toDiffPackageOptions()..., + ) + if err != nil { + return err + } + if len(diffData) > 0 { + if _, err := writer.Write(diffData); err != nil { + return err + } + } + } + for _, twoObjectInfo := range twoObjectInfos { + path := twoObjectInfo.Path() + if _, ok := onePathToObjectInfo[path]; !ok { + twoData, err := ReadPath(ctx, two, path) + if err != nil { + return err + } + oneDiffPath, err := getDiffPathForNotFound( + twoObjectInfo, + externalPaths, + twoExternalPathPrefix, + oneExternalPathPrefix, + ) + if err != nil { + return err + } + twoDiffPath, err := getDiffPathForObjectInfo( + twoObjectInfo, + externalPaths, + twoExternalPathPrefix, + ) + if err != nil { + return err + } + diffData, err := diff.Diff( + ctx, + runner, + nil, + twoData, + oneDiffPath, + twoDiffPath, + diffOptions.toDiffPackageOptions()..., + ) + if err != nil { + return err + } + if len(diffData) > 0 { + if _, err := writer.Write(diffData); err != nil { + return err + } + } + } + } + return nil +} + +func getDiffPathForObjectInfo( + objectInfo ObjectInfo, + externalPaths bool, + externalPathPrefix string, +) (string, error) { + if !externalPaths { + return objectInfo.Path(), nil + } + externalPath := objectInfo.ExternalPath() + if externalPathPrefix == "" { + return externalPath, nil + } + if !strings.HasPrefix(externalPath, externalPathPrefix) { + return "", fmt.Errorf("diff: expected %s to have prefix %s", externalPath, externalPathPrefix) + } + return externalPath, nil +} + +func getDiffPathForNotFound( + foundObjectInfo ObjectInfo, + externalPaths bool, + foundExternalPathPrefix string, + notFoundExternalPathPrefix string, +) (string, error) { + if !externalPaths { + return foundObjectInfo.Path(), nil + } + externalPath := foundObjectInfo.ExternalPath() + switch { + case foundExternalPathPrefix == "" && notFoundExternalPathPrefix == "": + // no prefix, just return external path + return externalPath, nil + case foundExternalPathPrefix == "" && notFoundExternalPathPrefix != "": + // the not-found side has a prefix, append the external path to this prefix, and we're done + return notFoundExternalPathPrefix + externalPath, nil + default: + // foundExternalPathPrefix != "" && notFoundExternalPathPrefix == "" + // foundExternalPathPrefix != "" && notFoundExternalPathPrefix != "" + if !strings.HasPrefix(externalPath, foundExternalPathPrefix) { + return "", fmt.Errorf("diff: expected %s to have prefix %s", externalPath, foundExternalPathPrefix) + } + return notFoundExternalPathPrefix + strings.TrimPrefix(externalPath, foundExternalPathPrefix), nil + } +} + +type diffOptions struct { + suppressCommands bool + suppressTimestamps bool + externalPaths bool + oneExternalPathPrefix string + twoExternalPathPrefix string + transforms []func(side string, filename string, content []byte) []byte +} + +func newDiffOptions() *diffOptions { + return &diffOptions{} +} + +func (d *diffOptions) toDiffPackageOptions() []diff.DiffOption { + var diffPackageOptions []diff.DiffOption + if d.suppressCommands { + diffPackageOptions = append(diffPackageOptions, diff.DiffWithSuppressCommands()) + } + if d.suppressTimestamps { + diffPackageOptions = append(diffPackageOptions, diff.DiffWithSuppressTimestamps()) + } + return diffPackageOptions +} diff --git a/pkg/bufman/pkg/storage/errors.go b/pkg/bufman/pkg/storage/errors.go new file mode 100644 index 000000000..ff85422f4 --- /dev/null +++ b/pkg/bufman/pkg/storage/errors.go @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "errors" + "fmt" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +var ( + // ErrClosed is the error returned if a bucket or object is already closed. + ErrClosed = errors.New("already closed") + // ErrSetExternalPathUnsupported is the error returned if a bucket does not support SetExternalPath. + ErrSetExternalPathUnsupported = errors.New("setting the external path is unsupported for this bucket") + + // errNotExist is the error returned if a path does not exist. + errNotExist = errors.New("does not exist") +) + +// NewErrNotExist returns a new error for a path not existing. +func NewErrNotExist(path string) error { + return normalpath.NewError(path, errNotExist) +} + +// IsNotExist returns true for a error that is for a path not existing. +func IsNotExist(err error) bool { + return errors.Is(err, errNotExist) +} + +// NewErrExistsMultipleLocations returns a new error if a path exists in multiple locations. +func NewErrExistsMultipleLocations(path string, externalPaths ...string) error { + return &errorExistsMultipleLocations{ + Path: path, + ExternalPaths: externalPaths, + } +} + +// IsExistsMultipleLocations returns true if the error is for a path existing in multiple locations. +func IsExistsMultipleLocations(err error) bool { + if err == nil { + return false + } + asErr := &errorExistsMultipleLocations{} + return errors.As(err, &asErr) +} + +// IsWriteLimitReached returns true if the error is of writes exceeding the limit of the bucket. +func IsWriteLimitReached(err error) bool { + if err == nil { + return false + } + asErr := &errWriteLimitReached{} + return errors.As(err, &asErr) +} + +// errorExistsMultipleLocations is the error returned if a path exists in multiple locations. +type errorExistsMultipleLocations struct { + Path string + ExternalPaths []string +} + +// Error implements error. +func (e *errorExistsMultipleLocations) Error() string { + return e.Path + " exists in multiple locations: " + strings.Join(e.ExternalPaths, " ") +} + +// errWriteLimitReached is the error returned if the write limit is reached. +// +// See [LimitWriteBucket]. +type errWriteLimitReached struct { + Limit int64 + ExceedingBy int64 +} + +// Error implements error. +func (e *errWriteLimitReached) Error() string { + return fmt.Sprintf("write limit reached: limit: %d, exceeding by: %d", e.Limit, e.ExceedingBy) +} diff --git a/pkg/bufman/pkg/storage/external_paths.go b/pkg/bufman/pkg/storage/external_paths.go new file mode 100644 index 000000000..34d8164f3 --- /dev/null +++ b/pkg/bufman/pkg/storage/external_paths.go @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" +) + +// NoExternalPathReadBucket disables the external paths for the ReadBucket. +// +// This results in ExternalPath just calling Path. +func NoExternalPathReadBucket(readBucket ReadBucket) ReadBucket { + return newNoExternalPathReadBucket(readBucket) +} + +type noExternalPathReadBucket struct { + delegate ReadBucket +} + +func newNoExternalPathReadBucket( + delegate ReadBucket, +) *noExternalPathReadBucket { + return &noExternalPathReadBucket{ + delegate: delegate, + } +} + +func (r *noExternalPathReadBucket) Get(ctx context.Context, path string) (ReadObjectCloser, error) { + readObjectCloser, err := r.delegate.Get(ctx, path) + // TODO: if this is a path error, we should replace the path + if err != nil { + return nil, err + } + return disableReadObjectCloserExternalPath(readObjectCloser), nil +} + +func (r *noExternalPathReadBucket) Stat(ctx context.Context, path string) (ObjectInfo, error) { + objectInfo, err := r.delegate.Stat(ctx, path) + // TODO: if this is a path error, we should replace the path + if err != nil { + return nil, err + } + return disableObjectInfoExternalPath(objectInfo), nil +} + +func (r *noExternalPathReadBucket) Walk(ctx context.Context, prefix string, f func(ObjectInfo) error) error { + return r.delegate.Walk( + ctx, + prefix, + func(objectInfo ObjectInfo) error { + return f(disableObjectInfoExternalPath(objectInfo)) + }, + ) +} + +func disableObjectInfoExternalPath(objectInfo ObjectInfo) ObjectInfo { + return storageutil.NewObjectInfo( + objectInfo.Path(), + objectInfo.Path(), + ) +} + +func disableReadObjectCloserExternalPath(readObjectCloser ReadObjectCloser) ReadObjectCloser { + return compositeReadObjectCloser{disableObjectInfoExternalPath(readObjectCloser), readObjectCloser} +} diff --git a/pkg/bufman/pkg/storage/limit.go b/pkg/bufman/pkg/storage/limit.go new file mode 100644 index 000000000..b5e5a0f02 --- /dev/null +++ b/pkg/bufman/pkg/storage/limit.go @@ -0,0 +1,93 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + + "go.uber.org/atomic" +) + +// LimitWriteBucket returns a [WriteBucket] that writes to [writeBucket] +// but stops with an error after [limit] bytes are written. +// +// The error can be checked using [IsWriteLimitReached]. +// +// A negative [limit] is same as 0 limit. +func LimitWriteBucket(writeBucket WriteBucket, limit int) WriteBucket { + if limit < 0 { + limit = 0 + } + return newLimitedWriteBucket(writeBucket, int64(limit)) +} + +type limitedWriteBucket struct { + WriteBucket + currentSize *atomic.Int64 + limit int64 +} + +func newLimitedWriteBucket(bucket WriteBucket, limit int64) *limitedWriteBucket { + return &limitedWriteBucket{ + WriteBucket: bucket, + currentSize: atomic.NewInt64(0), + limit: limit, + } +} + +func (w *limitedWriteBucket) Put(ctx context.Context, path string, opts ...PutOption) (WriteObjectCloser, error) { + writeObjectCloser, err := w.WriteBucket.Put(ctx, path, opts...) + if err != nil { + return nil, err + } + return newLimitedWriteObjectCloser(writeObjectCloser, w.currentSize, w.limit), nil +} + +type limitedWriteObjectCloser struct { + WriteObjectCloser + + bucketSize *atomic.Int64 + limit int64 +} + +func newLimitedWriteObjectCloser( + writeObjectCloser WriteObjectCloser, + bucketSize *atomic.Int64, + limit int64, +) *limitedWriteObjectCloser { + return &limitedWriteObjectCloser{ + WriteObjectCloser: writeObjectCloser, + bucketSize: bucketSize, + limit: limit, + } +} + +func (o *limitedWriteObjectCloser) Write(p []byte) (int, error) { + writeSize := int64(len(p)) + newBucketSize := o.bucketSize.Add(writeSize) + if newBucketSize > o.limit { + o.bucketSize.Sub(writeSize) + return 0, &errWriteLimitReached{ + Limit: o.limit, + ExceedingBy: newBucketSize - o.limit, + } + } + writtenSize, err := o.WriteObjectCloser.Write(p) + if int64(writtenSize) < writeSize { + o.bucketSize.Sub(writeSize - int64(writtenSize)) + } + return writtenSize, err +} diff --git a/pkg/bufman/pkg/storage/map.go b/pkg/bufman/pkg/storage/map.go new file mode 100644 index 000000000..673d7c175 --- /dev/null +++ b/pkg/bufman/pkg/storage/map.go @@ -0,0 +1,254 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + "errors" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" +) + +// MapReadBucket maps the ReadBucket. +// +// If the Mappers are empty, the original ReadBucket is returned. +// If there is more than one Mapper, the Mappers are called in order +// for UnmapFullPath, with the order reversed for MapPath and MapPrefix. +// +// That is, order these assuming you are starting with a full path and +// working to a path. +func MapReadBucket(readBucket ReadBucket, mappers ...Mapper) ReadBucket { + if len(mappers) == 0 { + return readBucket + } + return newMapReadBucket(readBucket, MapChain(mappers...)) +} + +// MapWriteBucket maps the WriteBucket. +// +// If the Mappers are empty, the original WriteBucket is returned. +// If there is more than one Mapper, the Mappers are called in order +// for UnmapFullPath, with the order reversed for MapPath and MapPrefix. +// +// That is, order these assuming you are starting with a full path and +// working to a path. +// +// If a path that does not match is called for Put, an error is returned. +func MapWriteBucket(writeBucket WriteBucket, mappers ...Mapper) WriteBucket { + if len(mappers) == 0 { + return writeBucket + } + return newMapWriteBucket(writeBucket, MapChain(mappers...)) +} + +// MapReadWriteBucket maps the ReadWriteBucket. +// +// If the Mappers are empty, the original ReadWriteBucket is returned. +// If there is more than one Mapper, the Mappers are called in order +// for UnmapFullPath, with the order reversed for MapPath and MapPrefix. +// +// That is, order these assuming you are starting with a full path and +// working to a path. +func MapReadWriteBucket(readWriteBucket ReadWriteBucket, mappers ...Mapper) ReadWriteBucket { + if len(mappers) == 0 { + return readWriteBucket + } + mapper := MapChain(mappers...) + return compositeReadWriteBucket{ + newMapReadBucket(readWriteBucket, mapper), + newMapWriteBucket(readWriteBucket, mapper), + } +} + +type mapReadBucket struct { + delegate ReadBucket + mapper Mapper +} + +func newMapReadBucket( + delegate ReadBucket, + mapper Mapper, +) *mapReadBucket { + return &mapReadBucket{ + delegate: delegate, + mapper: mapper, + } +} + +func (r *mapReadBucket) Get(ctx context.Context, path string) (ReadObjectCloser, error) { + fullPath, err := r.getFullPath(path) + if err != nil { + return nil, err + } + readObjectCloser, err := r.delegate.Get(ctx, fullPath) + // TODO: if this is a path error, we should replace the path + if err != nil { + return nil, err + } + return replaceReadObjectCloserPath(readObjectCloser, path), nil +} + +func (r *mapReadBucket) Stat(ctx context.Context, path string) (ObjectInfo, error) { + fullPath, err := r.getFullPath(path) + if err != nil { + return nil, err + } + objectInfo, err := r.delegate.Stat(ctx, fullPath) + // TODO: if this is a path error, we should replace the path + if err != nil { + return nil, err + } + return replaceObjectInfoPath(objectInfo, path), nil +} + +func (r *mapReadBucket) Walk(ctx context.Context, prefix string, f func(ObjectInfo) error) error { + prefix, err := normalpath.NormalizeAndValidate(prefix) + if err != nil { + return err + } + fullPrefix, matches := r.mapper.MapPrefix(prefix) + if !matches { + return nil + } + return r.delegate.Walk( + ctx, + fullPrefix, + func(objectInfo ObjectInfo) error { + path, matches, err := r.mapper.UnmapFullPath(objectInfo.Path()) + if err != nil { + return err + } + if !matches { + return nil + } + return f(replaceObjectInfoPath(objectInfo, path)) + }, + ) +} + +func (r *mapReadBucket) getFullPath(path string) (string, error) { + path, err := normalpath.NormalizeAndValidate(path) + if err != nil { + return "", err + } + if path == "." { + return "", errors.New("cannot get root") + } + fullPath, matches := r.mapper.MapPath(path) + if !matches { + return "", NewErrNotExist(path) + } + return fullPath, nil +} + +type mapWriteBucket struct { + delegate WriteBucket + mapper Mapper +} + +func newMapWriteBucket( + delegate WriteBucket, + mapper Mapper, +) *mapWriteBucket { + return &mapWriteBucket{ + delegate: delegate, + mapper: mapper, + } +} + +func (w *mapWriteBucket) Put(ctx context.Context, path string, opts ...PutOption) (WriteObjectCloser, error) { + fullPath, err := w.getFullPath(path) + if err != nil { + return nil, err + } + writeObjectCloser, err := w.delegate.Put(ctx, fullPath, opts...) + // TODO: if this is a path error, we should replace the path + if err != nil { + return nil, err + } + return replaceWriteObjectCloserExternalPathNotSupported(writeObjectCloser), nil +} + +func (w *mapWriteBucket) Delete(ctx context.Context, path string) error { + fullPath, err := w.getFullPath(path) + if err != nil { + return err + } + return w.delegate.Delete(ctx, fullPath) +} + +func (w *mapWriteBucket) DeleteAll(ctx context.Context, prefix string) error { + prefix, err := normalpath.NormalizeAndValidate(prefix) + if err != nil { + return err + } + fullPrefix, matches := w.mapper.MapPrefix(prefix) + if !matches { + return nil + } + return w.delegate.DeleteAll(ctx, fullPrefix) +} + +func (*mapWriteBucket) SetExternalPathSupported() bool { + return false +} + +func (w *mapWriteBucket) getFullPath(path string) (string, error) { + path, err := normalpath.NormalizeAndValidate(path) + if err != nil { + return "", err + } + if path == "." { + return "", errors.New("cannot get root") + } + fullPath, matches := w.mapper.MapPath(path) + if !matches { + return "", fmt.Errorf("path does not match: %s", path) + } + return fullPath, nil +} + +func replaceObjectInfoPath(objectInfo ObjectInfo, path string) ObjectInfo { + if objectInfo.Path() == path { + return objectInfo + } + return storageutil.NewObjectInfo( + path, + objectInfo.ExternalPath(), + ) +} + +func replaceReadObjectCloserPath(readObjectCloser ReadObjectCloser, path string) ReadObjectCloser { + if readObjectCloser.Path() == path { + return readObjectCloser + } + return compositeReadObjectCloser{replaceObjectInfoPath(readObjectCloser, path), readObjectCloser} +} + +func replaceWriteObjectCloserExternalPathNotSupported(writeObjectCloser WriteObjectCloser) WriteObjectCloser { + return writeObjectCloserExternalPathNotSuppoted{writeObjectCloser} +} + +type writeObjectCloserExternalPathNotSuppoted struct { + io.WriteCloser +} + +func (writeObjectCloserExternalPathNotSuppoted) SetExternalPath(string) error { + return ErrSetExternalPathUnsupported +} diff --git a/pkg/bufman/pkg/storage/mapper.go b/pkg/bufman/pkg/storage/mapper.go new file mode 100644 index 000000000..c2155d09b --- /dev/null +++ b/pkg/bufman/pkg/storage/mapper.go @@ -0,0 +1,164 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +// Mapper is a path mapper. +// +// This will cause a Bucket to operate as if the Mapper has all paths mapped. +type Mapper interface { + // Map maps the path to the full path. + // + // The path is expected to be normalized and validated. + // The returned path is expected to be normalized and validated. + // If the path cannot be mapped, this returns false. + MapPath(path string) (string, bool) + // Map maps the prefix to the full prefix. + // + // The path is expected to be normalized and validated. + // The returned path is expected to be normalized and validated. + // If the path cannot be mapped, this returns false. + MapPrefix(prefix string) (string, bool) + // UnmapFullPath maps the full path to the path. + // + // Returns false if the full path does not apply. + // The path is expected to be normalized and validated. + // The returned path is expected to be normalized and validated. + UnmapFullPath(fullPath string) (string, bool, error) + isMapper() +} + +// MapOnPrefix returns a Mapper that will map the Bucket as if it was created on the given prefix. +// +// The prefix is expected to be normalized and validated. +func MapOnPrefix(prefix string) Mapper { + return prefixMapper{prefix} +} + +// MapChain chains the mappers. +// +// If any mapper does not match, this stops checking Mappers and returns +// an empty path and false. This is as opposed to MatchAnd, that runs +// every Matcher and returns the path regardless. +// +// If the Mappers are empty, a no-op Mapper is returned. +// If there is more than one Mapper, the Mappers are called in order +// for UnmapFullPath, with the order reversed for MapPath and MapPrefix. +// +// That is, order these assuming you are starting with a full path and +// working to a path. +func MapChain(mappers ...Mapper) Mapper { + switch len(mappers) { + case 0: + return nopMapper{} + case 1: + return mappers[0] + default: + return chainMapper{mappers} + } +} + +// ***** private ***** + +type prefixMapper struct { + prefix string +} + +func (p prefixMapper) MapPath(path string) (string, bool) { + return normalpath.Join(p.prefix, path), true +} + +func (p prefixMapper) MapPrefix(prefix string) (string, bool) { + return normalpath.Join(p.prefix, prefix), true +} + +func (p prefixMapper) UnmapFullPath(fullPath string) (string, bool, error) { + if !normalpath.EqualsOrContainsPath(p.prefix, fullPath, normalpath.Relative) { + return "", false, nil + } + path, err := normalpath.Rel(p.prefix, fullPath) + if err != nil { + return "", false, err + } + return path, true, nil +} + +func (prefixMapper) isMapper() {} + +type chainMapper struct { + mappers []Mapper +} + +func (c chainMapper) MapPath(path string) (string, bool) { + return c.mapFunc(path, Mapper.MapPath) +} + +func (c chainMapper) MapPrefix(prefix string) (string, bool) { + return c.mapFunc(prefix, Mapper.MapPrefix) +} + +func (c chainMapper) UnmapFullPath(fullPath string) (string, bool, error) { + path := fullPath + var matches bool + var err error + for _, mapper := range c.mappers { + path, matches, err = mapper.UnmapFullPath(path) + if err != nil { + return "", false, err + } + if !matches { + return "", false, nil + } + } + return path, true, nil +} + +func (c chainMapper) mapFunc( + pathOrPrefix string, + f func(Mapper, string) (string, bool), +) (string, bool) { + fullPathOrPrefix := pathOrPrefix + var matches bool + for i := len(c.mappers) - 1; i >= 0; i-- { + mapper := c.mappers[i] + fullPathOrPrefix, matches = f(mapper, fullPathOrPrefix) + if !matches { + return "", false + } + } + return fullPathOrPrefix, true +} + +func (chainMapper) isMapper() {} + +type nopMapper struct{} + +func (n nopMapper) MapPath(path string) (string, bool) { + return path, true +} + +func (n nopMapper) MapPrefix(prefix string) (string, bool) { + return prefix, true +} + +func (nopMapper) UnmapFullPath(fullPath string) (string, bool, error) { + return fullPath, true, nil +} + +func (nopMapper) isMapper() {} diff --git a/pkg/bufman/pkg/storage/matcher.go b/pkg/bufman/pkg/storage/matcher.go new file mode 100644 index 000000000..c2d2f0fd0 --- /dev/null +++ b/pkg/bufman/pkg/storage/matcher.go @@ -0,0 +1,205 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +// Matcher is a path matcher. +// +// This will cause a Bucket to operate as if it only contains matching paths. +type Matcher interface { + Mapper + isMatcher() +} + +// MatchPathExt returns a Matcher for the extension. +func MatchPathExt(ext string) Matcher { + return pathMatcherFunc(func(path string) bool { + return normalpath.Ext(path) == ext + }) +} + +// MatchPathBase returns a Matcher for the base. +func MatchPathBase(base string) Matcher { + return pathMatcherFunc(func(path string) bool { + return normalpath.Base(path) == base + }) +} + +// MatchPathEqual returns a Matcher for the path. +func MatchPathEqual(equalPath string) Matcher { + return pathMatcherFunc(func(path string) bool { + return path == equalPath + }) +} + +// MatchPathEqualOrContained returns a Matcher for the path that matches +// on paths equal or contained by equalOrContainingPath. +func MatchPathEqualOrContained(equalOrContainingPath string) Matcher { + return pathMatcherFunc(func(path string) bool { + return normalpath.EqualsOrContainsPath(equalOrContainingPath, path, normalpath.Relative) + }) +} + +// MatchPathContained returns a Matcher for the directory that matches +// on paths by contained by containingDir. +func MatchPathContained(containingDir string) Matcher { + return pathMatcherFunc(func(path string) bool { + return normalpath.ContainsPath(containingDir, path, normalpath.Relative) + }) +} + +// MatchOr returns an Or of the Matchers. +func MatchOr(matchers ...Matcher) Matcher { + return orMatcher(matchers) +} + +// MatchAnd returns an And of the Matchers. +func MatchAnd(matchers ...Matcher) Matcher { + return andMatcher(matchers) +} + +// MatchNot returns an Not of the Matcher. +func MatchNot(matcher Matcher) Matcher { + return notMatcher{matcher} +} + +// ***** private ***** + +// We limit or/and/not to Matchers as composite logic must assume +// the the input path is not modified, so that we can always return it +// +// We might want to just remove Matcher implementing Mapper for simplification, +// and just have a Matches function, then handle chaining them separately. + +type pathMatcherFunc func(string) bool + +func (f pathMatcherFunc) MapPath(path string) (string, bool) { + matches := f(path) + return path, matches +} + +func (f pathMatcherFunc) MapPrefix(prefix string) (string, bool) { + // always returns true, path matchers do not check prefixes + return prefix, true +} + +func (f pathMatcherFunc) UnmapFullPath(fullPath string) (string, bool, error) { + matches := f(fullPath) + return fullPath, matches, nil +} + +func (pathMatcherFunc) isMatcher() {} +func (pathMatcherFunc) isMapper() {} + +type orMatcher []Matcher + +func (o orMatcher) MapPath(path string) (string, bool) { + for _, matcher := range o { + if _, matches := matcher.MapPath(path); matches { + return path, true + } + } + return "", false +} + +func (o orMatcher) MapPrefix(prefix string) (string, bool) { + for _, matcher := range o { + if _, matches := matcher.MapPrefix(prefix); matches { + return prefix, true + } + } + return "", false +} + +func (o orMatcher) UnmapFullPath(fullPath string) (string, bool, error) { + for _, matcher := range o { + _, matches, err := matcher.UnmapFullPath(fullPath) + if err != nil { + return "", false, err + } + if matches { + return fullPath, true, nil + } + } + return fullPath, false, nil +} + +func (orMatcher) isMatcher() {} +func (orMatcher) isMapper() {} + +type andMatcher []Matcher + +func (a andMatcher) MapPath(path string) (string, bool) { + for _, matcher := range a { + if _, matches := matcher.MapPath(path); !matches { + return path, false + } + } + return path, true +} + +func (a andMatcher) MapPrefix(prefix string) (string, bool) { + for _, matcher := range a { + if _, matches := matcher.MapPrefix(prefix); !matches { + return prefix, false + } + } + return prefix, true +} + +func (a andMatcher) UnmapFullPath(fullPath string) (string, bool, error) { + for _, matcher := range a { + _, matches, err := matcher.UnmapFullPath(fullPath) + if err != nil { + return "", false, err + } + if !matches { + return fullPath, false, nil + } + } + return fullPath, true, nil +} + +func (andMatcher) isMatcher() {} +func (andMatcher) isMapper() {} + +type notMatcher struct { + delegate Matcher +} + +func (n notMatcher) MapPath(path string) (string, bool) { + _, matches := n.delegate.MapPath(path) + return path, !matches +} + +func (n notMatcher) MapPrefix(prefix string) (string, bool) { + _, matches := n.delegate.MapPath(prefix) + return prefix, !matches +} + +func (n notMatcher) UnmapFullPath(fullPath string) (string, bool, error) { + _, matches, err := n.delegate.UnmapFullPath(fullPath) + if err != nil { + return "", false, err + } + return fullPath, !matches, nil +} + +func (notMatcher) isMatcher() {} +func (notMatcher) isMapper() {} diff --git a/pkg/bufman/pkg/storage/multi.go b/pkg/bufman/pkg/storage/multi.go new file mode 100644 index 000000000..fda8ae5ea --- /dev/null +++ b/pkg/bufman/pkg/storage/multi.go @@ -0,0 +1,145 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" +) + +// MultiReadBucket takes the union of the ReadBuckets. +// +// If no readBuckets are given, this returns a no-op ReadBucket. +// If one readBucket is given, this returns the original ReadBucket. +// Otherwise, this returns a ReadBucket that will get from all buckets. +// +// This expects and validates that no paths overlap between the ReadBuckets. +// This assumes that buckets are logically unique. +func MultiReadBucket(readBuckets ...ReadBucket) ReadBucket { + switch len(readBuckets) { + case 0: + return nopReadBucket{} + case 1: + return readBuckets[0] + default: + return newMultiReadBucket(readBuckets) + } +} + +type multiReadBucket struct { + delegates []ReadBucket +} + +func newMultiReadBucket( + delegates []ReadBucket, +) *multiReadBucket { + return &multiReadBucket{ + delegates: delegates, + } +} + +func (m *multiReadBucket) Get(ctx context.Context, path string) (ReadObjectCloser, error) { + _, delegateIndex, err := m.getObjectInfoAndDelegateIndex(ctx, path) + if err != nil { + return nil, err + } + return m.delegates[delegateIndex].Get(ctx, path) +} + +func (m *multiReadBucket) Stat(ctx context.Context, path string) (ObjectInfo, error) { + objectInfo, _, err := m.getObjectInfoAndDelegateIndex(ctx, path) + return objectInfo, err +} + +func (m *multiReadBucket) Walk(ctx context.Context, prefix string, f func(ObjectInfo) error) error { + seenPathToExternalPath := make(map[string]string) + for _, delegate := range m.delegates { + if err := delegate.Walk( + ctx, + prefix, + func(objectInfo ObjectInfo) error { + path := objectInfo.Path() + externalPath := objectInfo.ExternalPath() + if existingExternalPath, ok := seenPathToExternalPath[path]; ok { + // this does not return all paths that are matching, unlike Get and Stat + // we do not want to continue iterating, as calling Walk on the same path could cause errors downstream + // as callers expect a single call per path. + return NewErrExistsMultipleLocations(path, existingExternalPath, externalPath) + } + seenPathToExternalPath[path] = externalPath + return f(objectInfo) + }, + ); err != nil { + return err + } + } + return nil +} + +func (m *multiReadBucket) getObjectInfoAndDelegateIndex( + ctx context.Context, + path string, +) (ObjectInfo, int, error) { + var objectInfos []ObjectInfo + var delegateIndices []int + for i, delegate := range m.delegates { + objectInfo, err := delegate.Stat(ctx, path) + if err != nil { + if IsNotExist(err) { + continue + } + return nil, 0, err + } + objectInfos = append(objectInfos, objectInfo) + delegateIndices = append(delegateIndices, i) + } + switch len(objectInfos) { + case 0: + return nil, 0, NewErrNotExist(path) + case 1: + return objectInfos[0], delegateIndices[0], nil + default: + externalPaths := make([]string, len(objectInfos)) + for i, objectInfo := range objectInfos { + externalPaths[i] = objectInfo.ExternalPath() + } + return nil, 0, NewErrExistsMultipleLocations(path, externalPaths...) + } +} + +type nopReadBucket struct{} + +func (nopReadBucket) Get(ctx context.Context, path string) (ReadObjectCloser, error) { + return nil, nopGetStat(path) +} + +func (nopReadBucket) Stat(ctx context.Context, path string) (ObjectInfo, error) { + return nil, nopGetStat(path) +} + +func (nopReadBucket) Walk(ctx context.Context, prefix string, f func(ObjectInfo) error) error { + _, err := storageutil.ValidatePrefix(prefix) + return err +} + +func nopGetStat(path string) error { + path, err := storageutil.ValidatePath(path) + if err != nil { + return err + } + return NewErrNotExist(path) +} diff --git a/pkg/bufman/pkg/storage/storage.go b/pkg/bufman/pkg/storage/storage.go new file mode 100644 index 000000000..e53698e5a --- /dev/null +++ b/pkg/bufman/pkg/storage/storage.go @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package storage implements a simple storage abstraction. +// +// This is meant to abstract filesystem calls, as well as be a wrapper +// for in-memory or remote storage. It also provides a smaller attack +// vector as implementations can do verifications as to what is accessed +// and what is not. +package storage diff --git a/pkg/bufman/pkg/storage/storagearchive/storagearchive.go b/pkg/bufman/pkg/storage/storagearchive/storagearchive.go new file mode 100644 index 000000000..e0d331164 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagearchive/storagearchive.go @@ -0,0 +1,260 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package storagearchive implements archive utilities. +package storagearchive + +import ( + "archive/tar" + "context" + "errors" + "fmt" + "io" + "math" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" + "github.com/klauspost/compress/zip" + "go.uber.org/multierr" +) + +// ErrFileSizeLimit is returned when file read limit is reached. +// +// See [WithMaxFileSizeUntarOption] +var ErrFileSizeLimit = errors.New("file size exceeded read limit") + +// Tar tars the given bucket to the writer. +// +// Only regular files are added to the writer. +// All files are written as 0644. +func Tar( + ctx context.Context, + readBucket storage.ReadBucket, + writer io.Writer, +) (retErr error) { + tarWriter := tar.NewWriter(writer) + defer func() { + retErr = multierr.Append(retErr, tarWriter.Close()) + }() + return storage.WalkReadObjects( + ctx, + readBucket, + "", + func(readObject storage.ReadObject) error { + data, err := io.ReadAll(readObject) + if err != nil { + return err + } + if err := tarWriter.WriteHeader( + &tar.Header{ + Typeflag: tar.TypeReg, + Name: readObject.Path(), + Size: int64(len(data)), + // If we ever use this outside of testing, we will want to do something about this + Mode: 0o644, + }, + ); err != nil { + return err + } + _, err = tarWriter.Write(data) + return err + }, + ) +} + +// Untar untars the given tar archive from the reader into the bucket. +// +// Only regular files are added to the bucket. +// +// Paths from the tar archive will be mapped before adding to the bucket. +// Mapper can be nil. +// StripComponents happens before the mapper. +func Untar( + ctx context.Context, + reader io.Reader, + writeBucket storage.WriteBucket, + mapper storage.Mapper, + stripComponentCount uint32, + opts ...UntarOption, +) error { + options := &untarOptions{ + maxFileSize: math.MaxInt64, + } + for _, opt := range opts { + opt.applyUntar(options) + } + tarReader := tar.NewReader(reader) + walkChecker := storageutil.NewWalkChecker() + for tarHeader, err := tarReader.Next(); err != io.EOF; tarHeader, err = tarReader.Next() { + if err != nil { + return err + } + if err := walkChecker.Check(ctx); err != nil { + return err + } + if tarHeader.Size < 0 { + return fmt.Errorf("invalid size for tar file %s: %d", tarHeader.Name, tarHeader.Size) + } + path, ok, err := unmapArchivePath(tarHeader.Name, mapper, stripComponentCount) + if err != nil { + return err + } + if !ok || !tarHeader.FileInfo().Mode().IsRegular() { + continue + } + if tarHeader.Size > options.maxFileSize { + return fmt.Errorf("%w %s:%d", ErrFileSizeLimit, tarHeader.Name, tarHeader.Size) + } + if err := storage.CopyReader(ctx, writeBucket, tarReader, path); err != nil { + return err + } + } + return nil +} + +// UntarOption is an option for [Untar]. +type UntarOption interface { + applyUntar(*untarOptions) +} + +// WithMaxFileSizeUntarOption returns an option that limits the maximum size +func WithMaxFileSizeUntarOption(size int) UntarOption { + return &withMaxFileSizeUntarOption{maxFileSize: int64(size)} +} + +// Zip zips the given bucket to the writer. +// +// Only regular files are added to the writer. +func Zip( + ctx context.Context, + readBucket storage.ReadBucket, + writer io.Writer, + compressed bool, +) (retErr error) { + zipWriter := zip.NewWriter(writer) + defer func() { + retErr = multierr.Append(retErr, zipWriter.Close()) + }() + return storage.WalkReadObjects( + ctx, + readBucket, + "", + func(readObject storage.ReadObject) error { + method := zip.Store + if compressed { + method = zip.Deflate + } + header := &zip.FileHeader{ + Name: readObject.Path(), + Method: method, + } + writer, err := zipWriter.CreateHeader(header) + if err != nil { + return err + } + _, err = io.Copy(writer, readObject) + return err + }, + ) +} + +// Unzip unzips the given zip archive from the reader into the bucket. +// +// Only regular files are added to the bucket. +// +// Paths from the zip archive will be mapped before adding to the bucket. +// Mapper can be nil. +// StripComponents happens before the mapper. +func Unzip( + ctx context.Context, + readerAt io.ReaderAt, + size int64, + writeBucket storage.WriteBucket, + mapper storage.Mapper, + stripComponentCount uint32, +) error { + if size < 0 { + return fmt.Errorf("unknown size to unzip: %d", int(size)) + } + if size == 0 { + return nil + } + zipReader, err := zip.NewReader(readerAt, size) + if err != nil { + return err + } + walkChecker := storageutil.NewWalkChecker() + // reads can be done concurrently in the future + for _, zipFile := range zipReader.File { + if err := walkChecker.Check(ctx); err != nil { + return err + } + path, ok, err := unmapArchivePath(zipFile.Name, mapper, stripComponentCount) + if err != nil { + return err + } + if !ok { + continue + } + if zipFile.FileInfo().Mode().IsRegular() { + if err := copyZipFile(ctx, writeBucket, zipFile, path); err != nil { + return err + } + } + } + return nil +} + +func copyZipFile( + ctx context.Context, + writeBucket storage.WriteBucket, + zipFile *zip.File, + path string, +) (retErr error) { + readCloser, err := zipFile.Open() + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, readCloser.Close()) + }() + return storage.CopyReader(ctx, writeBucket, readCloser, path) +} + +func unmapArchivePath( + archivePath string, + mapper storage.Mapper, + stripComponentCount uint32, +) (string, bool, error) { + if archivePath == "" { + return "", false, errors.New("empty archive file name") + } + fullPath, err := normalpath.NormalizeAndValidate(archivePath) + if err != nil { + return "", false, err + } + if fullPath == "." { + return "", false, nil + } + fullPath, ok := normalpath.StripComponents(fullPath, stripComponentCount) + if !ok { + return "", false, nil + } + if mapper != nil { + return mapper.UnmapFullPath(fullPath) + } + return fullPath, true, nil +} diff --git a/pkg/bufman/pkg/storage/storagearchive/untar_options.go b/pkg/bufman/pkg/storage/storagearchive/untar_options.go new file mode 100644 index 000000000..c2052704c --- /dev/null +++ b/pkg/bufman/pkg/storage/storagearchive/untar_options.go @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagearchive + +type untarOptions struct { + maxFileSize int64 +} + +type withMaxFileSizeUntarOption struct { + maxFileSize int64 +} + +func (o *withMaxFileSizeUntarOption) applyUntar(options *untarOptions) { + options.maxFileSize = o.maxFileSize +} diff --git a/pkg/bufman/pkg/storage/storagegit/bucket.go b/pkg/bufman/pkg/storage/storagegit/bucket.go new file mode 100644 index 000000000..ff543900b --- /dev/null +++ b/pkg/bufman/pkg/storage/storagegit/bucket.go @@ -0,0 +1,212 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagegit + +import ( + "bytes" + "context" + "errors" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" +) + +type bucket struct { + objectReader git.ObjectReader + symlinks bool + root git.Tree +} + +func newBucket( + objectReader git.ObjectReader, + symlinksIfSupported bool, + root git.Tree, +) (storage.ReadBucket, error) { + return &bucket{ + objectReader: objectReader, + symlinks: symlinksIfSupported, + root: root, + }, nil +} + +func (b *bucket) Get(ctx context.Context, path string) (storage.ReadObjectCloser, error) { + node, err := b.root.Descendant(path, b.objectReader) + if err != nil { + if errors.Is(err, git.ErrTreeNodeNotFound) { + return nil, storage.NewErrNotExist(path) + } + return nil, err + } + switch node.Mode() { + case git.ModeFile, git.ModeExe: + data, err := b.objectReader.Blob(node.Hash()) + if err != nil { + return nil, err + } + return &namedReader{ + info: b.newObjectInfo(path), + reader: bytes.NewReader(data), + }, nil + case git.ModeSymlink: + if !b.symlinks { + return nil, storage.NewErrNotExist(path) + } + // Symlinks are stored as blobs that reference the target path as a relative + // path. We can follow this symlink trivially. + data, err := b.objectReader.Blob(node.Hash()) + if err != nil { + return nil, err + } + path, err := normalpath.NormalizeAndValidate( + normalpath.Join( + normalpath.Base(path), + normalpath.Normalize(string(data)), + ), + ) + if err != nil { + return nil, fmt.Errorf("invalid path %q: %w", path, err) + } + return b.Get(ctx, path) + default: + return nil, storage.NewErrNotExist(path) + } +} + +func (b *bucket) Stat(ctx context.Context, path string) (storage.ObjectInfo, error) { + node, err := b.root.Descendant(path, b.objectReader) + if err != nil { + if errors.Is(err, git.ErrTreeNodeNotFound) { + return nil, storage.NewErrNotExist(path) + } + return nil, err + } + switch node.Mode() { + case git.ModeFile, git.ModeExe: + return b.newObjectInfo(path), nil + case git.ModeSymlink: + if !b.symlinks { + return nil, storage.NewErrNotExist(path) + } + return b.newObjectInfo(path), nil + default: + return nil, storage.NewErrNotExist(path) + } +} + +func (b *bucket) Walk(ctx context.Context, prefix string, f func(storage.ObjectInfo) error) error { + walkChecker := storageutil.NewWalkChecker() + return b.walk(b.root, b.objectReader, prefix, func(path string) error { + if err := walkChecker.Check(ctx); err != nil { + return err + } + return f(b.newObjectInfo(path)) + }) +} + +func (b *bucket) walk( + parent git.Tree, + objectReader git.ObjectReader, + prefix string, + walkFn func(string) error, +) error { + prefix = normalpath.Normalize(prefix) + if prefix != "." { + node, err := parent.Descendant(prefix, b.objectReader) + if err != nil { + if errors.Is(err, git.ErrTreeNodeNotFound) { + return storage.NewErrNotExist(prefix) + } + return err + } + if node.Mode() != git.ModeDir { + return errors.New("prefix is not a directory") + } + subTree, err := b.objectReader.Tree(node.Hash()) + if err != nil { + return err + } + parent = subTree + } + return b.walkTree(parent, objectReader, prefix, walkFn) +} + +func (b *bucket) walkTree( + parent git.Tree, + objectReader git.ObjectReader, + prefix string, + walkFn func(string) error, +) error { + for _, node := range parent.Nodes() { + path := normalpath.Join(prefix, node.Name()) + switch node.Mode() { + case git.ModeFile, git.ModeExe: + if err := walkFn(path); err != nil { + return err + } + case git.ModeSymlink: + if b.symlinks { + if err := walkFn(path); err != nil { + return err + } + } + case git.ModeDir: + subTree, err := objectReader.Tree(node.Hash()) + if err != nil { + return err + } + if err := b.walkTree(subTree, objectReader, path, walkFn); err != nil { + return err + } + default: + // ignored + } + } + return nil +} + +func (b *bucket) newObjectInfo(path string) storage.ObjectInfo { + return storageutil.NewObjectInfo( + normalpath.Normalize(path), + normalpath.Unnormalize(path), + ) +} + +type namedReader struct { + info storage.ObjectInfo + reader io.Reader +} + +var _ storage.ReadObjectCloser = (*namedReader)(nil) + +func (br *namedReader) Path() string { + return br.info.Path() +} + +func (br *namedReader) ExternalPath() string { + return br.info.ExternalPath() +} + +func (br *namedReader) Read(p []byte) (n int, err error) { + return br.reader.Read(p) +} + +func (br *namedReader) Close() error { + return nil +} diff --git a/pkg/bufman/pkg/storage/storagegit/doc.go b/pkg/bufman/pkg/storage/storagegit/doc.go new file mode 100644 index 000000000..93a6c40f0 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagegit/doc.go @@ -0,0 +1,17 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package storagegit implements a storage abstraction for Git repositories. +package storagegit diff --git a/pkg/bufman/pkg/storage/storagegit/provider.go b/pkg/bufman/pkg/storage/storagegit/provider.go new file mode 100644 index 000000000..942fd22c1 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagegit/provider.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagegit + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +type provider struct { + objectReader git.ObjectReader + symlinks bool +} + +func newProvider(objectReader git.ObjectReader, opts ...ProviderOption) *provider { + p := &provider{ + objectReader: objectReader, + } + for _, opt := range opts { + opt(p) + } + return p +} + +func (p *provider) NewReadBucket(treeHash git.Hash, options ...ReadBucketOption) (storage.ReadBucket, error) { + var opts readBucketOptions + for _, opt := range options { + opt(&opts) + } + tree, err := p.objectReader.Tree(treeHash) + if err != nil { + return nil, err + } + return newBucket( + p.objectReader, + p.symlinks && opts.symlinksIfSupported, + tree, + ) +} + +// doing this as a separate struct so that it's clear this is resolved +// as a combination of the provider options and read write bucket options +// so there's no potential issues in newBucket +type readBucketOptions struct { + symlinksIfSupported bool +} diff --git a/pkg/bufman/pkg/storage/storagegit/storagegit.go b/pkg/bufman/pkg/storage/storagegit/storagegit.go new file mode 100644 index 000000000..568ce8a98 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagegit/storagegit.go @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagegit + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +// Provider provides storage buckets for a git repository. +type Provider interface { + // NewReadBucket returns a new ReadBucket that represents + // the state of the working tree at the particular tree. + // + // Typically, callers will want to source the tree from a commit, but + // they can also use a subtree of another tree. + NewReadBucket(hash git.Hash, options ...ReadBucketOption) (storage.ReadBucket, error) +} + +// ProviderOption is an option for a new Provider. +type ProviderOption func(*provider) + +// ProviderWithSymlinks returns a ProviderOption that results in symlink support. +// +// Note that ReadBucketWithSymlinksIfSupported still needs to be passed for a given +// ReadBucket to have symlinks followed. +func ProviderWithSymlinks() ProviderOption { + return func(provider *provider) { + provider.symlinks = true + } +} + +// ReadBucketOption is an option for a new ReadBucket. +type ReadBucketOption func(*readBucketOptions) + +// ReadBucketWithSymlinksIfSupported returns a ReadBucketOption that results +// in symlink support being enabled for this bucket. If the Provider did not have symlink +// support, this is a no-op. +func ReadBucketWithSymlinksIfSupported() ReadBucketOption { + return func(b *readBucketOptions) { + b.symlinksIfSupported = true + } +} + +// NewProvider creates a new Provider for a git repository. +func NewProvider(objectReader git.ObjectReader, options ...ProviderOption) Provider { + return newProvider(objectReader, options...) +} diff --git a/pkg/bufman/pkg/storage/storagegit/storagegit_test.go b/pkg/bufman/pkg/storage/storagegit/storagegit_test.go new file mode 100644 index 000000000..952aaa473 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagegit/storagegit_test.go @@ -0,0 +1,82 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagegit + +import ( + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git/gittest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagetesting" + "github.com/stretchr/testify/require" +) + +func TestNewBucketAtTreeHash(t *testing.T) { + t.Parallel() + + repo := gittest.ScaffoldGitRepository(t) + provider := NewProvider(repo.Objects()) + // get last commit + var commit git.Commit + require.NoError(t, repo.ForEachCommit(repo.BaseBranch(), func(c git.Commit) error { + commit = c + return nil + })) + require.NotNil(t, commit) + bucket, err := provider.NewReadBucket(commit.Tree()) + require.NoError(t, err) + + storagetesting.AssertPaths( + t, + bucket, + "", + "proto/acme/grocerystore/v1/c.proto", + "proto/acme/grocerystore/v1/d.proto", + "proto/acme/grocerystore/v1/g.proto", + "proto/acme/grocerystore/v1/h.proto", + "proto/acme/petstore/v1/a.proto", + "proto/acme/petstore/v1/b.proto", + "proto/acme/petstore/v1/e.proto", + "proto/acme/petstore/v1/f.proto", + "proto/buf.yaml", + "randomBinary", + ) + storagetesting.AssertObjectInfo( + t, + bucket, + "proto/acme/grocerystore/v1/c.proto", + normalpath.Unnormalize("proto/acme/grocerystore/v1/c.proto"), + ) + storagetesting.AssertNotExist(t, bucket, "random-path") + storagetesting.AssertPathToContent( + t, + bucket, + "", + map[string]string{ + "proto/acme/grocerystore/v1/c.proto": "toysrus", + "proto/acme/grocerystore/v1/d.proto": "petsrus", + "proto/acme/grocerystore/v1/g.proto": "hamlet", + "proto/acme/grocerystore/v1/h.proto": "bethoven", + "proto/acme/petstore/v1/a.proto": "cats", + "proto/acme/petstore/v1/b.proto": "animals", + "proto/acme/petstore/v1/e.proto": "loblaws", + "proto/acme/petstore/v1/f.proto": "merchant of venice", + "proto/buf.yaml": "some buf.yaml", + "randomBinary": "some executable", + }, + ) +} diff --git a/pkg/bufman/pkg/storage/storagemem/bucket.go b/pkg/bufman/pkg/storage/storagemem/bucket.go new file mode 100644 index 000000000..d107fa174 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagemem/bucket.go @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagemem + +import ( + "context" + "fmt" + "sort" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" +) + +type bucket struct { + pathToImmutableObject map[string]*internal.ImmutableObject + lock sync.RWMutex +} + +func newBucket(pathToImmutableObject map[string]*internal.ImmutableObject) *bucket { + if pathToImmutableObject == nil { + pathToImmutableObject = make(map[string]*internal.ImmutableObject) + } + return &bucket{ + pathToImmutableObject: pathToImmutableObject, + } +} + +func (b *bucket) Get(ctx context.Context, path string) (storage.ReadObjectCloser, error) { + immutableObject, err := b.readLockAndGetImmutableObject(ctx, path) + if err != nil { + return nil, err + } + return newReadObjectCloser(immutableObject), nil +} + +func (b *bucket) Stat(ctx context.Context, path string) (storage.ObjectInfo, error) { + return b.readLockAndGetImmutableObject(ctx, path) +} + +func (b *bucket) Walk(ctx context.Context, prefix string, f func(storage.ObjectInfo) error) error { + prefix, err := storageutil.ValidatePrefix(prefix) + if err != nil { + return err + } + walkChecker := storageutil.NewWalkChecker() + b.lock.RLock() + defer b.lock.RUnlock() + // To ensure same iteration order. + // We could create this in-place during puts with an insertion sort if this + // gets to be time prohibitive. + paths := make([]string, 0, len(b.pathToImmutableObject)) + for path := range b.pathToImmutableObject { + paths = append(paths, path) + } + sort.Strings(paths) + for _, path := range paths { + immutableObject, ok := b.pathToImmutableObject[path] + if !ok { + // this is a system error + return fmt.Errorf("path %q not in pathToObject", path) + } + if err := walkChecker.Check(ctx); err != nil { + return err + } + if !normalpath.EqualsOrContainsPath(prefix, path, normalpath.Relative) { + continue + } + if err := f(immutableObject); err != nil { + return err + } + } + return nil +} + +func (b *bucket) Put(ctx context.Context, path string, _ ...storage.PutOption) (storage.WriteObjectCloser, error) { + // No need to lock as we do no modifications until close + path, err := storageutil.ValidatePath(path) + if err != nil { + return nil, err + } + // storagemem writes are already atomic - don't need special handling for PutWithAtomic. + return newWriteObjectCloser(b, path), nil +} + +func (b *bucket) Delete(ctx context.Context, path string) error { + path, err := storageutil.ValidatePath(path) + if err != nil { + return err + } + b.lock.Lock() + defer b.lock.Unlock() + if _, ok := b.pathToImmutableObject[path]; !ok { + return storage.NewErrNotExist(path) + } + // Note that if there is an existing reader for an object of the same path, + // that reader will continue to read the original file, but we accept this + // as no less consistent than os mechanics. + delete(b.pathToImmutableObject, path) + return nil +} + +func (b *bucket) DeleteAll(ctx context.Context, prefix string) error { + prefix, err := storageutil.ValidatePrefix(prefix) + if err != nil { + return err + } + b.lock.Lock() + defer b.lock.Unlock() + for path := range b.pathToImmutableObject { + if normalpath.EqualsOrContainsPath(prefix, path, normalpath.Relative) { + // Note that if there is an existing reader for an object of the same path, + // that reader will continue to read the original file, but we accept this + // as no less consistent than os mechanics. + delete(b.pathToImmutableObject, path) + } + } + return nil +} + +func (*bucket) SetExternalPathSupported() bool { + return true +} + +func (b *bucket) ToReadBucket() (storage.ReadBucket, error) { + return b, nil +} + +func (b *bucket) readLockAndGetImmutableObject(ctx context.Context, path string) (*internal.ImmutableObject, error) { + path, err := storageutil.ValidatePath(path) + if err != nil { + return nil, err + } + b.lock.RLock() + defer b.lock.RUnlock() + immutableObject, ok := b.pathToImmutableObject[path] + if !ok { + // it would be nice if this was external path for every bucket + // the issue is here: we don't know the external path for memory buckets + // because we store external paths individually, so if we do not have + // an object, we do not have an external path + return nil, storage.NewErrNotExist(path) + } + return immutableObject, nil +} diff --git a/pkg/bufman/pkg/storage/storagemem/internal/immutable_object.go b/pkg/bufman/pkg/storage/storagemem/internal/immutable_object.go new file mode 100644 index 000000000..433e4396c --- /dev/null +++ b/pkg/bufman/pkg/storage/storagemem/internal/immutable_object.go @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package internal splits out ImmutableObject into a separate package from storagemem +// to make it impossible to modify ImmutableObject via direct field access. +package internal + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" +) + +// ImmutableObject is an object that contains a path, external path, +// and data that is never modified. +// +// We make this a struct so there is no weirdness with returning a nil interface. +type ImmutableObject struct { + storageutil.ObjectInfo + + data []byte +} + +// NewImmutableObject returns a new ImmutableObject. +// +// path is expected to always be non-empty. +// If externalPath is empty, normalpath.Unnormalize(path) is used. +func NewImmutableObject( + path string, + externalPath string, + data []byte, +) *ImmutableObject { + if externalPath == "" { + externalPath = normalpath.Unnormalize(path) + } + return &ImmutableObject{ + ObjectInfo: storageutil.NewObjectInfo(path, externalPath), + data: data, + } +} + +// Data returns the data. +// +// DO NOT MODIFY. +func (i *ImmutableObject) Data() []byte { + return i.data +} diff --git a/pkg/bufman/pkg/storage/storagemem/read_object_closer.go b/pkg/bufman/pkg/storage/storagemem/read_object_closer.go new file mode 100644 index 000000000..5c02e55f2 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagemem/read_object_closer.go @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagemem + +import ( + "bytes" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" +) + +type readObjectCloser struct { + storageutil.ObjectInfo + + reader *bytes.Reader + closed bool +} + +func newReadObjectCloser(immutableObject *internal.ImmutableObject) *readObjectCloser { + return &readObjectCloser{ + ObjectInfo: immutableObject.ObjectInfo, + reader: bytes.NewReader(immutableObject.Data()), + } +} + +func (r *readObjectCloser) Read(p []byte) (int, error) { + if r.closed { + return 0, storage.ErrClosed + } + return r.reader.Read(p) +} + +func (r *readObjectCloser) Close() error { + if r.closed { + return storage.ErrClosed + } + r.closed = true + return nil +} diff --git a/pkg/bufman/pkg/storage/storagemem/storagemem.go b/pkg/bufman/pkg/storage/storagemem/storagemem.go new file mode 100644 index 000000000..57355832e --- /dev/null +++ b/pkg/bufman/pkg/storage/storagemem/storagemem.go @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package storagemem implements an in-memory storage Bucket. +package storagemem + +import ( + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem/internal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" +) + +var errDuplicatePath = errors.New("duplicate path") + +// NewReadWriteBucket returns a new in-memory ReadWriteBucket. +func NewReadWriteBucket() storage.ReadWriteBucket { + return newBucket(nil) +} + +// NewReadBucket returns a new ReadBucket. +func NewReadBucket(pathToData map[string][]byte) (storage.ReadBucket, error) { + pathToImmutableObject := make(map[string]*internal.ImmutableObject, len(pathToData)) + for path, data := range pathToData { + path, err := storageutil.ValidatePath(path) + if err != nil { + return nil, err + } + // This could happen if two paths normalize to the same path. + if _, ok := pathToImmutableObject[path]; ok { + return nil, errDuplicatePath + } + pathToImmutableObject[path] = internal.NewImmutableObject(path, "", data) + } + return newBucket(pathToImmutableObject), nil +} diff --git a/pkg/bufman/pkg/storage/storagemem/storagemem_test.go b/pkg/bufman/pkg/storage/storagemem/storagemem_test.go new file mode 100644 index 000000000..070fd793c --- /dev/null +++ b/pkg/bufman/pkg/storage/storagemem/storagemem_test.go @@ -0,0 +1,73 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagemem_test + +import ( + "context" + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagetesting" + "github.com/stretchr/testify/require" +) + +var storagetestingDirPath = filepath.Join("..", "storagetesting") + +func TestMem(t *testing.T) { + t.Parallel() + storagetesting.RunTestSuite( + t, + storagetestingDirPath, + testNewReadBucket, + testNewWriteBucket, + testWriteBucketToReadBucket, + ) +} + +func testNewReadBucket(t *testing.T, dirPath string, storageosProvider storageos.Provider) (storage.ReadBucket, storagetesting.GetExternalPathFunc) { + osBucket, err := storageosProvider.NewReadWriteBucket( + dirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + readWriteBucket := storagemem.NewReadWriteBucket() + _, err = storage.Copy( + context.Background(), + osBucket, + readWriteBucket, + storage.CopyWithExternalPaths(), + ) + require.NoError(t, err) + return readWriteBucket, func(t *testing.T, rootPath string, path string) string { + // Join calls Clean + return normalpath.Unnormalize(normalpath.Join(rootPath, path)) + } +} + +func testNewWriteBucket(*testing.T, storageos.Provider) storage.WriteBucket { + return storagemem.NewReadWriteBucket() +} + +func testWriteBucketToReadBucket(t *testing.T, writeBucket storage.WriteBucket) storage.ReadBucket { + // hacky + readWriteBucket, ok := writeBucket.(storage.ReadWriteBucket) + require.True(t, ok) + return readWriteBucket +} diff --git a/pkg/bufman/pkg/storage/storagemem/write_object_closer.go b/pkg/bufman/pkg/storage/storagemem/write_object_closer.go new file mode 100644 index 000000000..89e0bb071 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagemem/write_object_closer.go @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storagemem + +import ( + "bytes" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem/internal" +) + +type writeObjectCloser struct { + bucket *bucket + path string + externalPath string + buffer *bytes.Buffer + closed bool +} + +func newWriteObjectCloser( + bucket *bucket, + path string, +) *writeObjectCloser { + return &writeObjectCloser{ + bucket: bucket, + path: path, + buffer: bytes.NewBuffer(nil), + } +} + +func (w *writeObjectCloser) Write(p []byte) (int, error) { + if w.closed { + return 0, storage.ErrClosed + } + return w.buffer.Write(p) +} + +func (w *writeObjectCloser) SetExternalPath(externalPath string) error { + if w.externalPath != "" { + return fmt.Errorf("external path already set: %q", w.externalPath) + } + w.externalPath = externalPath + return nil +} + +func (w *writeObjectCloser) Close() error { + if w.closed { + return storage.ErrClosed + } + w.closed = true + // overwrites anything existing + // this is the same behavior as storageos + w.bucket.lock.Lock() + defer w.bucket.lock.Unlock() + // Note that if there is an existing reader for an object of the same path, + // that reader will continue to read the original file, but we accept this + // as no less consistent than os mechanics. + w.bucket.pathToImmutableObject[w.path] = internal.NewImmutableObject( + w.path, + w.externalPath, + w.buffer.Bytes(), + ) + return nil +} diff --git a/pkg/bufman/pkg/storage/storageos/bucket.go b/pkg/bufman/pkg/storage/storageos/bucket.go new file mode 100644 index 000000000..3f0201158 --- /dev/null +++ b/pkg/bufman/pkg/storage/storageos/bucket.go @@ -0,0 +1,439 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storageos + +import ( + "context" + "errors" + "os" + "path/filepath" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/filepathextended" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" + "go.uber.org/atomic" + "go.uber.org/multierr" +) + +// errNotDir is the error returned if a path is not a directory. +var errNotDir = errors.New("not a directory") + +type bucket struct { + rootPath string + absoluteRootPath string + symlinks bool +} + +func newBucket(rootPath string, symlinks bool) (*bucket, error) { + rootPath = normalpath.Unnormalize(rootPath) + if err := validateDirPathExists(rootPath, symlinks); err != nil { + return nil, err + } + absoluteRootPath, err := filepath.Abs(rootPath) + if err != nil { + return nil, err + } + // do not validate - allow anything with OS buckets including + // absolute paths and jumping context + rootPath = normalpath.Normalize(rootPath) + return &bucket{ + rootPath: rootPath, + absoluteRootPath: absoluteRootPath, + symlinks: symlinks, + }, nil +} + +func (b *bucket) Get(ctx context.Context, path string) (storage.ReadObjectCloser, error) { + externalPath, err := b.getExternalPath(path) + if err != nil { + return nil, err + } + if err := b.validateExternalPath(path, externalPath); err != nil { + return nil, err + } + resolvedPath := externalPath + if b.symlinks { + resolvedPath, err = filepath.EvalSymlinks(externalPath) + if err != nil { + return nil, err + } + } + file, err := os.Open(resolvedPath) + if err != nil { + return nil, err + } + // we could use fileInfo.Name() however we might as well use the externalPath + return newReadObjectCloser( + path, + externalPath, + file, + ), nil +} + +func (b *bucket) Stat(ctx context.Context, path string) (storage.ObjectInfo, error) { + externalPath, err := b.getExternalPath(path) + if err != nil { + return nil, err + } + if err := b.validateExternalPath(path, externalPath); err != nil { + return nil, err + } + // we could use fileInfo.Name() however we might as well use the externalPath + return storageutil.NewObjectInfo( + path, + externalPath, + ), nil +} + +func (b *bucket) Walk( + ctx context.Context, + prefix string, + f func(storage.ObjectInfo) error, +) error { + externalPrefix, err := b.getExternalPrefix(prefix) + if err != nil { + return err + } + walkChecker := storageutil.NewWalkChecker() + var walkOptions []filepathextended.WalkOption + if b.symlinks { + walkOptions = append(walkOptions, filepathextended.WalkWithSymlinks()) + } + if err := filepathextended.Walk( + externalPrefix, + func(externalPath string, fileInfo os.FileInfo, err error) error { + if err != nil { + // this can happen if a symlink is broken + // in this case, we just want to continue the walk + if b.symlinks && os.IsNotExist(err) { + return nil + } + return err + } + if err := walkChecker.Check(ctx); err != nil { + return err + } + absoluteExternalPath, err := filepath.Abs(externalPath) + if err != nil { + return err + } + if fileInfo.Mode().IsRegular() { + path, err := normalpath.Rel(b.absoluteRootPath, absoluteExternalPath) + if err != nil { + return err + } + // just in case + path, err = normalpath.NormalizeAndValidate(path) + if err != nil { + return err + } + if err := f( + storageutil.NewObjectInfo( + path, + externalPath, + ), + ); err != nil { + return err + } + } + return nil + }, + walkOptions..., + ); err != nil { + if os.IsNotExist(err) { + // Should be a no-op according to the spec. + return nil + } + return err + } + return nil +} + +func (b *bucket) Put(ctx context.Context, path string, opts ...storage.PutOption) (storage.WriteObjectCloser, error) { + var putOptions storage.PutOptions + for _, opt := range opts { + opt(&putOptions) + } + externalPath, err := b.getExternalPath(path) + if err != nil { + return nil, err + } + externalDir := filepath.Dir(externalPath) + var fileInfo os.FileInfo + if b.symlinks { + fileInfo, err = os.Stat(externalDir) + } else { + fileInfo, err = os.Lstat(externalDir) + } + if err != nil { + if os.IsNotExist(err) { + if err := os.MkdirAll(externalDir, 0o755); err != nil { + return nil, err + } + } else { + return nil, err + } + } else if !fileInfo.IsDir() { + return nil, newErrNotDir(externalDir) + } + var file *os.File + var finalPath string + if putOptions.Atomic { + file, err = os.CreateTemp(externalDir, ".tmp"+filepath.Base(externalPath)+"*") + finalPath = externalPath + } else { + file, err = os.Create(externalPath) + } + if err != nil { + return nil, err + } + return newWriteObjectCloser( + file, + finalPath, + ), nil +} + +func (b *bucket) Delete(ctx context.Context, path string) error { + externalPath, err := b.getExternalPath(path) + if err != nil { + return err + } + // Note: this deletes the file at the path, but it may + // leave orphan parent directories around that were + // created by the MkdirAll in Put. + if err := os.Remove(externalPath); err != nil { + if os.IsNotExist(err) { + return storage.NewErrNotExist(path) + } + return err + } + return nil +} + +func (b *bucket) DeleteAll(ctx context.Context, prefix string) error { + externalPrefix, err := b.getExternalPrefix(prefix) + if err != nil { + return err + } + if err := os.RemoveAll(externalPrefix); err != nil { + // this is a no-nop per the documentation + if os.IsNotExist(err) { + return nil + } + return err + } + return nil +} + +func (*bucket) SetExternalPathSupported() bool { + return false +} + +func (b *bucket) getExternalPath(path string) (string, error) { + path, err := storageutil.ValidatePath(path) + if err != nil { + return "", err + } + realClean, err := filepathextended.RealClean(normalpath.Join(b.rootPath, path)) + if err != nil { + return "", err + } + return normalpath.Unnormalize(realClean), nil +} + +func (b *bucket) validateExternalPath(path string, externalPath string) error { + // this is potentially introducing two calls to a file + // instead of one, ie we do both Stat and Open as opposed to just Open + // we do this to make sure we are only reading regular files + var fileInfo os.FileInfo + var err error + if b.symlinks { + fileInfo, err = os.Stat(externalPath) + } else { + fileInfo, err = os.Lstat(externalPath) + } + if err != nil { + if os.IsNotExist(err) { + return storage.NewErrNotExist(path) + } + // The path might have a regular file in one of its + // elements (e.g. 'foo/bar/baz.proto' where 'bar' is a + // regular file). + // + // In this case, the standard library will return an + // os.PathError, but there isn't an exported error value + // to check against (i.e. os.Is*). But we can still discover + // whether or not this is the case by checking if any of the + // path components represents a regular file (e.g. 'foo/bar'). + // + // It's important that we detect these cases so that + // multi buckets don't unnecessarily fail when one of + // its delegates actually defines the path. + elements := strings.Split(normalpath.Normalize(externalPath), "/") + if len(elements) == 1 { + // The path is a single element, so there aren't + // any other files to check. + return err + } + for i := len(elements) - 1; i >= 0; i-- { + parentFileInfo, err := os.Stat(filepath.Join(elements[:i]...)) + if err != nil { + continue + } + if parentFileInfo.Mode().IsRegular() { + // This error primarily serves as a sentinel error, + // but we preserve the original path argument so that + // the error still makes sense to the user. + return storage.NewErrNotExist(path) + } + } + return err + } + if !fileInfo.Mode().IsRegular() { + // making this a user error as any access means this was generally requested + // by the user, since we only call the function for Walk on regular files + return storage.NewErrNotExist(path) + } + return nil +} + +func (b *bucket) getExternalPrefix(prefix string) (string, error) { + prefix, err := storageutil.ValidatePrefix(prefix) + if err != nil { + return "", err + } + realClean, err := filepathextended.RealClean(normalpath.Join(b.rootPath, prefix)) + if err != nil { + return "", err + } + return normalpath.Unnormalize(realClean), nil +} + +type readObjectCloser struct { + // we use ObjectInfo for Path, ExternalPath, etc to make sure this is static + // we put ObjectInfos in maps in other places so we do not want this to change + // this could be a problem if the underlying file is concurrently moved or resized however + storageutil.ObjectInfo + + file *os.File +} + +func newReadObjectCloser( + path string, + externalPath string, + file *os.File, +) *readObjectCloser { + return &readObjectCloser{ + ObjectInfo: storageutil.NewObjectInfo( + path, + externalPath, + ), + file: file, + } +} + +func (r *readObjectCloser) Read(p []byte) (int, error) { + n, err := r.file.Read(p) + return n, toStorageError(err) +} + +func (r *readObjectCloser) Close() error { + return toStorageError(r.file.Close()) +} + +type writeObjectCloser struct { + file *os.File + // path is set during atomic writes to the final path where the file should be created. + // If set, the file is a temp file that needs to be renamed to this path if Write/Close are successful. + path string + // writeErr contains the first non-nil error caught by a call to Write. + // This is returned in Close for atomic writes to prevent writing an incomplete file. + writeErr atomic.Error +} + +func newWriteObjectCloser( + file *os.File, + path string, +) *writeObjectCloser { + return &writeObjectCloser{ + file: file, + path: path, + } +} + +func (w *writeObjectCloser) Write(p []byte) (int, error) { + n, err := w.file.Write(p) + if err != nil { + w.writeErr.CompareAndSwap(nil, err) + } + return n, toStorageError(err) +} + +func (w *writeObjectCloser) SetExternalPath(string) error { + return storage.ErrSetExternalPathUnsupported +} + +func (w *writeObjectCloser) Close() error { + err := toStorageError(w.file.Close()) + // This is an atomic write operation - we need to rename to the final path + if w.path != "" { + atomicWriteErr := multierr.Append(w.writeErr.Load(), err) + // Failed during Write or Close - remove temporary file without rename + if atomicWriteErr != nil { + return toStorageError(multierr.Append(atomicWriteErr, os.Remove(w.file.Name()))) + } + if err := os.Rename(w.file.Name(), w.path); err != nil { + return toStorageError(multierr.Append(err, os.Remove(w.file.Name()))) + } + } + return err +} + +// newErrNotDir returns a new Error for a path not being a directory. +func newErrNotDir(path string) *normalpath.Error { + return normalpath.NewError(path, errNotDir) +} + +func toStorageError(err error) error { + if errors.Is(err, os.ErrClosed) { + return storage.ErrClosed + } + return err +} + +// validateDirPathExists returns a non-nil error if the given dirPath +// is not a valid directory path. +func validateDirPathExists(dirPath string, symlinks bool) error { + var fileInfo os.FileInfo + var err error + if symlinks { + fileInfo, err = os.Stat(dirPath) + } else { + fileInfo, err = os.Lstat(dirPath) + } + if err != nil { + if os.IsNotExist(err) { + return storage.NewErrNotExist(dirPath) + } + return err + } + if !fileInfo.IsDir() { + return newErrNotDir(dirPath) + } + return nil +} diff --git a/pkg/bufman/pkg/storage/storageos/provider.go b/pkg/bufman/pkg/storage/storageos/provider.go new file mode 100644 index 000000000..35c458c25 --- /dev/null +++ b/pkg/bufman/pkg/storage/storageos/provider.go @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storageos + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + +type provider struct { + symlinks bool +} + +func newProvider(options ...ProviderOption) *provider { + provider := &provider{} + for _, option := range options { + option(provider) + } + return provider +} + +func (p *provider) NewReadWriteBucket(rootPath string, options ...ReadWriteBucketOption) (storage.ReadWriteBucket, error) { + readWriteBucketOptions := newReadWriteBucketOptions() + for _, option := range options { + option(readWriteBucketOptions) + } + // need both options for symlinks to be enabled + return newBucket( + rootPath, + p.symlinks && readWriteBucketOptions.symlinksIfSupported, + ) +} + +// doing this as a separate struct so that it's clear this is resolved +// as a combination of the provider options and read write bucket options +// so there's no potential issues in newBucket +type readWriteBucketOptions struct { + symlinksIfSupported bool +} + +func newReadWriteBucketOptions() *readWriteBucketOptions { + return &readWriteBucketOptions{} +} diff --git a/pkg/bufman/pkg/storage/storageos/storageos.go b/pkg/bufman/pkg/storage/storageos/storageos.go new file mode 100644 index 000000000..6c37aff25 --- /dev/null +++ b/pkg/bufman/pkg/storage/storageos/storageos.go @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package storageos implements an os-backed storage Bucket. +package storageos + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" +) + +// Provider provides new ReadWriteBuckets. +type Provider interface { + // NewReadWriteBucket returns a new OS bucket. + // + // Only regular files are handled, that is Exists should only be called + // for regular files, Get and Put only work for regular files, Put + // automatically calls Mkdir, and Walk only calls f on regular files. + // + // The root path is expected to be normalized, however the root path + // can be absolute or jump context. + // + // Not thread-safe. + NewReadWriteBucket(rootPath string, options ...ReadWriteBucketOption) (storage.ReadWriteBucket, error) +} + +// NewProvider returns a new Provider. +func NewProvider(options ...ProviderOption) Provider { + return newProvider(options...) +} + +// ProviderOption is an option for a new Provider. +type ProviderOption func(*provider) + +// ReadWriteBucketOption is an option for a new ReadWriteBucket. +type ReadWriteBucketOption func(*readWriteBucketOptions) + +// ReadWriteBucketWithSymlinksIfSupported returns a ReadWriteBucketOption that results +// in symlink support being enabled for this bucket. If the Provider did not have symlink +// support, this is a no-op. +func ReadWriteBucketWithSymlinksIfSupported() ReadWriteBucketOption { + return func(readWriteBucketOptions *readWriteBucketOptions) { + readWriteBucketOptions.symlinksIfSupported = true + } +} + +// ProviderWithSymlinks returns a ProviderOption that results in symlink support. +// +// Note that ReadWriteBucketWithSymlinksIfSupported still needs to be passed for a given +// ReadWriteBucket to have symlinks followed. +func ProviderWithSymlinks() ProviderOption { + return func(provider *provider) { + provider.symlinks = true + } +} diff --git a/pkg/bufman/pkg/storage/storageos/storageos_test.go b/pkg/bufman/pkg/storage/storageos/storageos_test.go new file mode 100644 index 000000000..e081b4be4 --- /dev/null +++ b/pkg/bufman/pkg/storage/storageos/storageos_test.go @@ -0,0 +1,69 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storageos_test + +import ( + "path/filepath" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagetesting" + "github.com/stretchr/testify/require" +) + +var storagetestingDirPath = filepath.Join("..", "storagetesting") + +func TestOS(t *testing.T) { + t.Parallel() + storagetesting.RunTestSuite( + t, + storagetestingDirPath, + testNewReadBucket, + testNewWriteBucket, + testWriteBucketToReadBucket, + ) +} + +func testNewReadBucket(t *testing.T, dirPath string, storageosProvider storageos.Provider) (storage.ReadBucket, storagetesting.GetExternalPathFunc) { + osBucket, err := storageosProvider.NewReadWriteBucket( + dirPath, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + return osBucket, func(t *testing.T, rootPath string, path string) string { + // Join calls Clean + return normalpath.Unnormalize(normalpath.Join(rootPath, path)) + } +} + +func testNewWriteBucket(t *testing.T, storageosProvider storageos.Provider) storage.WriteBucket { + tmpDir := t.TempDir() + osBucket, err := storageosProvider.NewReadWriteBucket( + tmpDir, + storageos.ReadWriteBucketWithSymlinksIfSupported(), + ) + require.NoError(t, err) + return osBucket +} + +func testWriteBucketToReadBucket(t *testing.T, writeBucket storage.WriteBucket) storage.ReadBucket { + // hacky + readWriteBucket, ok := writeBucket.(storage.ReadWriteBucket) + require.True(t, ok) + return readWriteBucket +} diff --git a/pkg/bufman/pkg/storage/storagetesting/storagetesting.go b/pkg/bufman/pkg/storage/storagetesting/storagetesting.go new file mode 100644 index 000000000..c6145e619 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/storagetesting.go @@ -0,0 +1,1521 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package storagetesting implements testing utilities and integration tests for storage. +package storagetesting + +import ( + "bytes" + "context" + "fmt" + "io" + "os" + "path/filepath" + "runtime" + "sort" + "strconv" + "sync" + "testing" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagearchive" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/tmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" +) + +const ( + // testProtoContent is the content of every .proto file in the testing directory. + testProtoContent = `syntax = "proto3"; + +package foo; +` + // testTxtContent is the content of every .txt file in the testing directory. + testTxtContent = `foo +` + // testYAMLContent is the content of every .yaml file in the testing directory. + testYAMLContent = `` +) + +// AssertNotExist asserts the path has the expected ObjectInfo. +func AssertNotExist( + t *testing.T, + readBucket storage.ReadBucket, + path string, +) { + _, err := readBucket.Stat(context.Background(), path) + assert.Error(t, err) + assert.True(t, storage.IsNotExist(err)) +} + +// AssertObjectInfo asserts the path has the expected ObjectInfo. +func AssertObjectInfo( + t *testing.T, + readBucket storage.ReadBucket, + path string, + externalPath string, +) { + objectInfo, err := readBucket.Stat(context.Background(), path) + require.NoError(t, err) + AssertObjectInfoEqual( + t, + storageutil.NewObjectInfo( + path, + externalPath, + ), + objectInfo, + ) +} + +// AssertObjectInfoEqual asserts the two ObjectInfos are equal. +func AssertObjectInfoEqual( + t *testing.T, + expected storage.ObjectInfo, + actual storage.ObjectInfo, +) { + assert.Equal(t, expected.Path(), actual.Path()) + assert.Equal(t, expected.ExternalPath(), actual.ExternalPath()) +} + +// AssertPathToContent asserts the content. +func AssertPathToContent( + t *testing.T, + readBucket storage.ReadBucket, + walkPrefix string, + expectedPathToContent map[string]string, +) { + var paths []string + require.NoError(t, readBucket.Walk( + context.Background(), + walkPrefix, + func(objectInfo storage.ObjectInfo) error { + paths = append(paths, objectInfo.Path()) + return nil + }, + )) + require.Equal(t, len(paths), len(stringutil.SliceToUniqueSortedSlice(paths))) + assert.Equal(t, len(expectedPathToContent), len(paths), paths) + for _, path := range paths { + expectedContent, ok := expectedPathToContent[path] + assert.True(t, ok, path) + _, err := readBucket.Stat(context.Background(), path) + require.NoError(t, err, path) + readObjectCloser, err := readBucket.Get(context.Background(), path) + require.NoError(t, err, path) + data, err := io.ReadAll(readObjectCloser) + assert.NoError(t, err, path) + assert.NoError(t, readObjectCloser.Close()) + assert.Equal(t, expectedContent, string(data)) + } +} + +// AssertPaths asserts the paths. +func AssertPaths( + t *testing.T, + readBucket storage.ReadBucket, + walkPrefix string, + expectedPaths ...string, +) { + var paths []string + require.NoError(t, readBucket.Walk( + context.Background(), + walkPrefix, + func(objectInfo storage.ObjectInfo) error { + paths = append(paths, objectInfo.Path()) + return nil + }, + )) + sort.Strings(paths) + assert.Equal(t, stringutil.SliceToUniqueSortedSlice(expectedPaths), paths) +} + +// GetExternalPathFunc can be used to get the external path of +// a path given the root path. +type GetExternalPathFunc func(*testing.T, string, string) string + +// RunTestSuite runs the test suite. +// +// storagetestingDirPath is the path to this directory. +// newReadBucket takes a path to a directory. +func RunTestSuite( + t *testing.T, + storagetestingDirPath string, + newReadBucket func(*testing.T, string, storageos.Provider) (storage.ReadBucket, GetExternalPathFunc), + newWriteBucket func(*testing.T, storageos.Provider) storage.WriteBucket, + writeBucketToReadBucket func(*testing.T, storage.WriteBucket) storage.ReadBucket, +) { + oneDirPath := filepath.Join(storagetestingDirPath, "testdata", "one") + twoDirPath := filepath.Join(storagetestingDirPath, "testdata", "two") + threeDirPath := filepath.Join(storagetestingDirPath, "testdata", "three") + fourDirPath := filepath.Join(storagetestingDirPath, "testdata", "four") + fiveDirPath := filepath.Join(storagetestingDirPath, "testdata", "five") + symlinkSuccessDirPath := filepath.Join(storagetestingDirPath, "testdata", "symlink_success") + symlinkLoopDirPath := filepath.Join(storagetestingDirPath, "testdata", "symlink_loop") + defaultProvider := storageos.NewProvider() + runner := command.NewRunner() + + for _, prefix := range []string{ + "", + ".", + "./", + } { + prefix := prefix + t.Run(fmt.Sprintf("root-%q", prefix), func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + AssertPathToContent( + t, + readBucket, + prefix, + map[string]string{ + "root/a/b/1.proto": testProtoContent, + "root/a/b/2.proto": testProtoContent, + "root/a/b/2.txt": testTxtContent, + "root/ab/1.proto": testProtoContent, + "root/ab/2.proto": testProtoContent, + "root/ab/2.txt": testTxtContent, + "root/a/1.proto": testProtoContent, + "root/a/1.txt": testTxtContent, + "root/a/bar.yaml": testYAMLContent, + "root/c/1.proto": testProtoContent, + "root/1.proto": testProtoContent, + "root/foo.yaml": testYAMLContent, + }, + ) + }) + } + + t.Run("map-1", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + readBucket = storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root"), + ) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "a/b/1.proto": testProtoContent, + "a/b/2.proto": testProtoContent, + "a/b/2.txt": testTxtContent, + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "ab/2.txt": testTxtContent, + "a/1.proto": testProtoContent, + "a/bar.yaml": testYAMLContent, + "a/1.txt": testTxtContent, + "c/1.proto": testProtoContent, + "1.proto": testProtoContent, + "foo.yaml": testYAMLContent, + }, + ) + }) + + t.Run("map-2", func(t *testing.T) { + t.Parallel() + readBucket, getExternalPathFunc := newReadBucket(t, oneDirPath, defaultProvider) + readBucket = storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root/a"), + ) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "b/1.proto": testProtoContent, + "b/2.proto": testProtoContent, + "b/2.txt": testTxtContent, + "1.proto": testProtoContent, + "bar.yaml": testYAMLContent, + "1.txt": testTxtContent, + }, + ) + AssertObjectInfo( + t, + readBucket, + "1.proto", + getExternalPathFunc(t, oneDirPath, filepath.Join("root", "a", "1.proto")), + ) + readBucket = storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("b"), + ) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "1.proto": testProtoContent, + "2.proto": testProtoContent, + "2.txt": testTxtContent, + }, + ) + AssertObjectInfo( + t, + readBucket, + "1.proto", + getExternalPathFunc(t, oneDirPath, filepath.Join("root", "a", "b", "1.proto")), + ) + }) + + t.Run("map-3", func(t *testing.T) { + t.Parallel() + readBucket, getExternalPathFunc := newReadBucket(t, oneDirPath, defaultProvider) + readBucket = storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root/ab"), + ) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "1.proto": testProtoContent, + "2.proto": testProtoContent, + "2.txt": testTxtContent, + }, + ) + AssertObjectInfo( + t, + readBucket, + "1.proto", + getExternalPathFunc(t, oneDirPath, filepath.Join("root", "ab", "1.proto")), + ) + readBucket = storage.MapReadBucket( + readBucket, + storage.MatchOr( + storage.MatchPathExt(".txt"), + storage.MatchPathEqual("2.proto"), + ), + ) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "2.proto": testProtoContent, + "2.txt": testTxtContent, + }, + ) + AssertObjectInfo( + t, + readBucket, + "2.proto", + getExternalPathFunc(t, oneDirPath, filepath.Join("root", "ab", "2.proto")), + ) + }) + + t.Run("multi-all", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) + readBucketMulti := storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root1"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root2"), + ), + ) + AssertPathToContent( + t, + readBucketMulti, + "", + map[string]string{ + // root1 + "a/b/1.proto": testProtoContent, + "a/b/2.proto": testProtoContent, + "a/b/2.txt": testTxtContent, + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "ab/2.txt": testTxtContent, + "a/1.proto": testProtoContent, + "a/1.txt": testTxtContent, + "a/bar.yaml": testYAMLContent, + "c/1.proto": testProtoContent, + "1.proto": testProtoContent, + "foo.yaml": testYAMLContent, + // root2 + "a/b/3.proto": testProtoContent, + "a/b/4.proto": testProtoContent, + "a/b/4.txt": testTxtContent, + "ab/3.proto": testProtoContent, + "ab/4.proto": testProtoContent, + "ab/4.txt": testTxtContent, + "a/2.proto": testProtoContent, + "a/2.txt": testTxtContent, + "a/bat.yaml": testYAMLContent, + "c/3.proto": testProtoContent, + "2.proto": testProtoContent, + "baz.yaml": testYAMLContent, + }, + ) + }) + + t.Run("multi-overlapping-files-error", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) + readBucketMulti := storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root1"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("rootoverlap"), + ), + ) + _, err := readBucketMulti.Get( + context.Background(), + "a/b/1.proto", + ) + assert.Error(t, err) + assert.True(t, storage.IsExistsMultipleLocations(err)) + _, err = readBucketMulti.Stat( + context.Background(), + "a/b/1.proto", + ) + assert.Error(t, err) + assert.True(t, storage.IsExistsMultipleLocations(err)) + err = readBucketMulti.Walk( + context.Background(), + "", + func(storage.ObjectInfo) error { + return nil + }, + ) + assert.Error(t, err) + assert.True(t, storage.IsExistsMultipleLocations(err)) + }) + + // this is testing that if we have i.e. protoc -I root/a -I root + // that even if this is an error in our world, this is not a problem + // in terms of storage buckets + t.Run("multi-overlapping-dirs-success", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, fourDirPath, defaultProvider) + readBucketMulti := storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root/a"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root"), + ), + ) + AssertPathToContent( + t, + readBucketMulti, + "", + map[string]string{ + "a/b/1.proto": testProtoContent, + "a/b/2.proto": testProtoContent, + "a/3.proto": testProtoContent, + "b/1.proto": testProtoContent, + "b/2.proto": testProtoContent, + "3.proto": testProtoContent, + }, + ) + }) + + // this is testing that two roots can have a file with the same + // name, but one could be a directory and the other could be a + // regular file. + t.Run("multi-dir-file-collision", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, fiveDirPath, defaultProvider) + readBucketMulti := storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root1"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root2"), + ), + ) + AssertPathToContent( + t, + readBucketMulti, + "", + map[string]string{ + // root1 + "foo": testProtoContent, + // root2 + "foo/bar.proto": testProtoContent, + }, + ) + }) + + for _, testCase := range []struct { + name string + prefix string + stripComponentCount uint32 + newReadBucketFunc func(*testing.T) storage.ReadBucket + mappers []storage.Mapper + expectedPathToContent map[string]string + }{ + { + name: "proto-and-single-file", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + mappers: []storage.Mapper{ + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqual("root/foo.yaml"), + ), + }, + expectedPathToContent: map[string]string{ + "root/a/b/1.proto": testProtoContent, + "root/a/b/2.proto": testProtoContent, + "root/ab/1.proto": testProtoContent, + "root/ab/2.proto": testProtoContent, + "root/a/1.proto": testProtoContent, + "root/c/1.proto": testProtoContent, + "root/1.proto": testProtoContent, + "root/foo.yaml": testYAMLContent, + }, + }, + { + name: "proto-and-single-file-walk-prefix-root-a", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + prefix: "root/a", + mappers: []storage.Mapper{ + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqual("foo.yaml"), + ), + }, + expectedPathToContent: map[string]string{ + "root/a/b/1.proto": testProtoContent, + "root/a/b/2.proto": testProtoContent, + "root/a/1.proto": testProtoContent, + }, + }, + { + name: "proto-and-single-file-walk-prefix-root-a-2", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + prefix: "./root/a", + mappers: []storage.Mapper{ + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqual("foo.yaml"), + ), + }, + expectedPathToContent: map[string]string{ + "root/a/b/1.proto": testProtoContent, + "root/a/b/2.proto": testProtoContent, + "root/a/1.proto": testProtoContent, + }, + }, + { + name: "proto-and-single-file-strip-components", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + stripComponentCount: 1, + mappers: []storage.Mapper{ + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqual("a/bar.yaml"), + ), + }, + expectedPathToContent: map[string]string{ + "a/b/1.proto": testProtoContent, + "a/b/2.proto": testProtoContent, + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "a/1.proto": testProtoContent, + "c/1.proto": testProtoContent, + "1.proto": testProtoContent, + "a/bar.yaml": testYAMLContent, + }, + }, + { + name: "proto-and-single-file-map-prefix-root-a", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + mappers: []storage.Mapper{ + storage.MapOnPrefix("root/a"), + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqual("bar.yaml"), + ), + }, + expectedPathToContent: map[string]string{ + "b/1.proto": testProtoContent, + "b/2.proto": testProtoContent, + "1.proto": testProtoContent, + "bar.yaml": testYAMLContent, + }, + }, + { + name: "proto-and-single-file-map-prefix-a-strip-components", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + stripComponentCount: 1, + mappers: []storage.Mapper{ + storage.MapOnPrefix("a"), + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqual("bar.yaml"), + ), + }, + expectedPathToContent: map[string]string{ + "b/1.proto": testProtoContent, + "b/2.proto": testProtoContent, + "1.proto": testProtoContent, + "bar.yaml": testYAMLContent, + }, + }, + { + name: "all", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + mappers: []storage.Mapper{ + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathExt(".txt"), + storage.MatchPathExt(".yaml"), + ), + }, + expectedPathToContent: map[string]string{ + "root/a/b/1.proto": testProtoContent, + "root/a/b/2.proto": testProtoContent, + "root/a/b/2.txt": testTxtContent, + "root/ab/1.proto": testProtoContent, + "root/ab/2.proto": testProtoContent, + "root/ab/2.txt": testTxtContent, + "root/a/1.proto": testProtoContent, + "root/a/1.txt": testTxtContent, + "root/a/bar.yaml": testYAMLContent, + "root/c/1.proto": testProtoContent, + "root/1.proto": testProtoContent, + "root/foo.yaml": testYAMLContent, + }, + }, + { + name: "proto-and-single-file-not-equal-or-contained-map-prefix", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + mappers: []storage.Mapper{ + storage.MapOnPrefix("root"), + storage.MatchNot( + storage.MatchPathContained("a"), + ), + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqualOrContained("foo.yaml"), + ), + }, + expectedPathToContent: map[string]string{ + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "c/1.proto": testProtoContent, + "1.proto": testProtoContent, + "foo.yaml": testYAMLContent, + }, + }, + { + name: "proto-and-single-file-not-equal-or-contained-map-prefix-and", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + mappers: []storage.Mapper{ + storage.MapOnPrefix("root"), + storage.MatchAnd( + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqualOrContained("foo.yaml"), + ), + storage.MatchNot( + storage.MatchPathContained("a"), + ), + ), + }, + expectedPathToContent: map[string]string{ + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "c/1.proto": testProtoContent, + "1.proto": testProtoContent, + "foo.yaml": testYAMLContent, + }, + }, + { + name: "proto-and-single-file-not-equal-or-contained-map-prefix-and-2", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + mappers: []storage.Mapper{ + storage.MapOnPrefix("root"), + storage.MatchAnd( + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqual("foo.yaml"), + ), + storage.MatchNot( + storage.MatchOr( + storage.MatchPathEqualOrContained("a"), + storage.MatchPathEqualOrContained("c"), + ), + ), + ), + }, + expectedPathToContent: map[string]string{ + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "1.proto": testProtoContent, + "foo.yaml": testYAMLContent, + }, + }, + { + name: "proto-and-single-file-not-equal-or-contained-map-prefix-and-3", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + mappers: []storage.Mapper{ + storage.MapOnPrefix("root"), + storage.MatchAnd( + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathEqual("foo.yaml"), + ), + storage.MatchNot( + storage.MatchPathEqualOrContained("a"), + ), + storage.MatchNot( + storage.MatchPathEqualOrContained("c"), + ), + ), + }, + expectedPathToContent: map[string]string{ + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "1.proto": testProtoContent, + "foo.yaml": testYAMLContent, + }, + }, + { + name: "proto-and-single-file-not-equal-or-contained-map-prefix-chained", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + return readBucket + }, + mappers: []storage.Mapper{ + storage.MapOnPrefix("root"), + storage.MapOnPrefix("ab"), + storage.MatchPathExt(".proto"), + }, + expectedPathToContent: map[string]string{ + "1.proto": testProtoContent, + "2.proto": testProtoContent, + }, + }, + { + name: "multi-all", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) + return storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root1"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root2"), + ), + ) + }, + mappers: []storage.Mapper{ + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathExt(".txt"), + storage.MatchPathExt(".yaml"), + ), + }, + expectedPathToContent: map[string]string{ + // root1 + "a/b/1.proto": testProtoContent, + "a/b/2.proto": testProtoContent, + "a/b/2.txt": testTxtContent, + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "ab/2.txt": testTxtContent, + "a/1.proto": testProtoContent, + "a/1.txt": testTxtContent, + "a/bar.yaml": testYAMLContent, + "c/1.proto": testProtoContent, + "1.proto": testProtoContent, + "foo.yaml": testYAMLContent, + // root2 + "a/b/3.proto": testProtoContent, + "a/b/4.proto": testProtoContent, + "a/b/4.txt": testTxtContent, + "ab/3.proto": testProtoContent, + "ab/4.proto": testProtoContent, + "ab/4.txt": testTxtContent, + "a/2.proto": testProtoContent, + "a/2.txt": testTxtContent, + "a/bat.yaml": testYAMLContent, + "c/3.proto": testProtoContent, + "2.proto": testProtoContent, + "baz.yaml": testYAMLContent, + }, + }, + { + name: "multi-map-on-prefix", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) + return storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root1"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root2"), + ), + ) + }, + mappers: []storage.Mapper{ + storage.MapOnPrefix("a"), + }, + expectedPathToContent: map[string]string{ + // root1 + "b/1.proto": testProtoContent, + "b/2.proto": testProtoContent, + "b/2.txt": testTxtContent, + "1.proto": testProtoContent, + "1.txt": testTxtContent, + "bar.yaml": testYAMLContent, + // root2 + "b/3.proto": testProtoContent, + "b/4.proto": testProtoContent, + "b/4.txt": testTxtContent, + "2.proto": testProtoContent, + "2.txt": testTxtContent, + "bat.yaml": testYAMLContent, + }, + }, + { + name: "multi-map-on-prefix-filter", + newReadBucketFunc: func(t *testing.T) storage.ReadBucket { + readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) + return storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root1"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root2"), + ), + ) + }, + mappers: []storage.Mapper{ + storage.MapOnPrefix("a"), + storage.MatchOr( + storage.MatchPathExt(".proto"), + storage.MatchPathExt(".txt"), + ), + }, + expectedPathToContent: map[string]string{ + // root1 + "b/1.proto": testProtoContent, + "b/2.proto": testProtoContent, + "b/2.txt": testTxtContent, + "1.proto": testProtoContent, + "1.txt": testTxtContent, + // root2 + "b/3.proto": testProtoContent, + "b/4.proto": testProtoContent, + "b/4.txt": testTxtContent, + "2.proto": testProtoContent, + "2.txt": testTxtContent, + }, + }, + } { + testCase := testCase + if testCase.stripComponentCount == 0 { + t.Run(fmt.Sprintf("copy-%s", testCase.name), func(t *testing.T) { + t.Parallel() + readBucket := testCase.newReadBucketFunc(t) + readBucket = storage.MapReadBucket(readBucket, testCase.mappers...) + writeBucket := newWriteBucket(t, defaultProvider) + _, err := storage.Copy( + context.Background(), + readBucket, + writeBucket, + ) + require.NoError(t, err) + readBucket = writeBucketToReadBucket(t, writeBucket) + AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) + }) + t.Run(fmt.Sprintf("tar-mapper-read-%s", testCase.name), func(t *testing.T) { + t.Parallel() + readBucket := testCase.newReadBucketFunc(t) + readBucket = storage.MapReadBucket(readBucket, testCase.mappers...) + writeBucket := newWriteBucket(t, defaultProvider) + buffer := bytes.NewBuffer(nil) + require.NoError(t, storagearchive.Tar( + context.Background(), + readBucket, + buffer, + )) + require.NoError(t, storagearchive.Untar( + context.Background(), + buffer, + writeBucket, + nil, + testCase.stripComponentCount, + )) + readBucket = writeBucketToReadBucket(t, writeBucket) + AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) + }) + t.Run(fmt.Sprintf("zip-mapper-read-%s", testCase.name), func(t *testing.T) { + t.Parallel() + readBucket := testCase.newReadBucketFunc(t) + readBucket = storage.MapReadBucket(readBucket, testCase.mappers...) + writeBucket := newWriteBucket(t, defaultProvider) + buffer := bytes.NewBuffer(nil) + require.NoError(t, storagearchive.Zip( + context.Background(), + readBucket, + buffer, + true, + )) + data := buffer.Bytes() + require.NoError(t, storagearchive.Unzip( + context.Background(), + bytes.NewReader(data), + int64(len(data)), + writeBucket, + nil, + testCase.stripComponentCount, + )) + readBucket = writeBucketToReadBucket(t, writeBucket) + AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) + }) + } + t.Run(fmt.Sprintf("tar-mapper-write-%s", testCase.name), func(t *testing.T) { + t.Parallel() + readBucket := testCase.newReadBucketFunc(t) + writeBucket := newWriteBucket(t, defaultProvider) + buffer := bytes.NewBuffer(nil) + require.NoError(t, storagearchive.Tar( + context.Background(), + readBucket, + buffer, + )) + require.NoError(t, storagearchive.Untar( + context.Background(), + buffer, + writeBucket, + storage.MapChain(testCase.mappers...), + testCase.stripComponentCount, + )) + readBucket = writeBucketToReadBucket(t, writeBucket) + AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) + }) + t.Run(fmt.Sprintf("zip-mapper-write%s", testCase.name), func(t *testing.T) { + t.Parallel() + readBucket := testCase.newReadBucketFunc(t) + writeBucket := newWriteBucket(t, defaultProvider) + buffer := bytes.NewBuffer(nil) + require.NoError(t, storagearchive.Zip( + context.Background(), + readBucket, + buffer, + true, + )) + data := buffer.Bytes() + require.NoError(t, storagearchive.Unzip( + context.Background(), + bytes.NewReader(data), + int64(len(data)), + writeBucket, + storage.MapChain(testCase.mappers...), + testCase.stripComponentCount, + )) + readBucket = writeBucketToReadBucket(t, writeBucket) + AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) + }) + } + + t.Run("diff", func(t *testing.T) { + t.Parallel() + diffDirPathA := filepath.Join(storagetestingDirPath, "testdata", "diff", "a") + diffDirPathB := filepath.Join(storagetestingDirPath, "testdata", "diff", "b") + readBucketA, getExternalPathFuncA := newReadBucket(t, diffDirPathA, defaultProvider) + readBucketB, getExternalPathFuncB := newReadBucket(t, diffDirPathB, defaultProvider) + readBucketA = storage.MapReadBucket(readBucketA, storage.MapOnPrefix("prefix")) + readBucketB = storage.MapReadBucket(readBucketB, storage.MapOnPrefix("prefix")) + externalPathPrefixA := getExternalPathFuncA(t, diffDirPathA, "prefix") + string(os.PathSeparator) + externalPathPrefixB := getExternalPathFuncB(t, diffDirPathB, "prefix") + string(os.PathSeparator) + a1TxtPath := filepath.ToSlash(externalPathPrefixA + "1.txt") + b1TxtPath := filepath.ToSlash(externalPathPrefixB + "1.txt") + a2TxtPath := filepath.ToSlash(externalPathPrefixA + "2.txt") + b2TxtPath := filepath.ToSlash(externalPathPrefixB + "2.txt") + + diff, err := storage.DiffBytes( + context.Background(), + runner, + readBucketA, + readBucketB, + storage.DiffWithSuppressTimestamps(), + storage.DiffWithExternalPaths(), + storage.DiffWithExternalPathPrefixes( + externalPathPrefixA, + externalPathPrefixB, + ), + ) + + // This isn't great, but it tests the exact behavior of the diff + // functionality. Headers are always "ToSlash" paths and `\n`. The + // contents of the diff are platform dependent. + diff1 := `@@ -1,2 +1,2 @@ +-aaaa + bbbb ++cccc +` + diff2 := `@@ -1 +0,0 @@ +-dddd +` + expectDiff := fmt.Sprintf( + `diff -u %s %s +--- %s ++++ %s +%sdiff -u %s %s +--- %s ++++ %s +%s`, + a1TxtPath, + b1TxtPath, + a1TxtPath, + b1TxtPath, + diff1, + a2TxtPath, + b2TxtPath, + a2TxtPath, + b2TxtPath, + diff2, + ) + + require.NoError(t, err) + assert.Equal( + t, + expectDiff, + string(diff), + ) + }) + + t.Run("overlap-success", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, threeDirPath, defaultProvider) + readBucket = storage.MapReadBucket(readBucket, storage.MatchPathExt(".proto")) + readBucket = storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("a"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("b"), + ), + ) + allPaths, err := storage.AllPaths( + context.Background(), + readBucket, + "", + ) + require.NoError(t, err) + assert.Equal( + t, + []string{ + "one.proto", + "two.proto", + }, + allPaths, + ) + }) + + t.Run("overlap-error", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, threeDirPath, defaultProvider) + readBucket = storage.MapReadBucket( + storage.MultiReadBucket( + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("a"), + ), + storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("b"), + ), + ), + storage.MatchPathExt(".proto"), + ) + _, err := storage.AllPaths( + context.Background(), + readBucket, + "", + ) + assert.True(t, storage.IsExistsMultipleLocations(err)) + }) + + t.Run("map-write-bucket", func(t *testing.T) { + t.Parallel() + writeBucket := newWriteBucket(t, defaultProvider) + mapWriteBucket := storage.MapWriteBucket( + writeBucket, + storage.MapOnPrefix("a/b/c"), + ) + writeObjectCloser, err := mapWriteBucket.Put( + context.Background(), + "hello", + ) + require.NoError(t, err) + _, err = writeObjectCloser.Write([]byte("abcd")) + require.NoError(t, err) + require.NoError(t, writeObjectCloser.Close()) + readBucket := writeBucketToReadBucket(t, writeBucket) + data, err := storage.ReadPath( + context.Background(), + readBucket, + "a/b/c/hello", + ) + require.NoError(t, err) + require.Equal(t, "abcd", string(data)) + }) + + t.Run("absolute-path-read-error", func(t *testing.T) { + t.Parallel() + + absolutePath := "/absolute/path" + if runtime.GOOS == "windows" { + absolutePath = "C:\\Fake\\Absolute\\Path" + } + expectErr := fmt.Sprintf("%s: expected to be relative", absolutePath) + + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + _, err := readBucket.Get(context.Background(), absolutePath) + require.EqualError(t, err, expectErr, "should be using storageutil.ValidatePath on Get") + _, err = readBucket.Stat(context.Background(), absolutePath) + require.EqualError(t, err, expectErr, "should be using storageutil.ValidatePath on Stat") + err = readBucket.Walk(context.Background(), absolutePath, nil) + require.EqualError(t, err, expectErr, "should be using storageutil.ValidatePrefix on Walk") + }) + + t.Run("absolute-path-write-error", func(t *testing.T) { + t.Parallel() + + absolutePath := "/absolute/path" + if runtime.GOOS == "windows" { + absolutePath = "C:\\Fake\\Absolute\\Path" + } + expectErr := fmt.Sprintf("%s: expected to be relative", absolutePath) + + writeBucket := newWriteBucket(t, defaultProvider) + _, err := writeBucket.Put(context.Background(), absolutePath) + require.EqualError(t, err, expectErr, "should be using normalize.NormalizeAndValidate on Put") + err = writeBucket.Delete(context.Background(), absolutePath) + require.EqualError(t, err, expectErr, "should be using normalize.NormalizeAndValidate on Delete") + }) + + t.Run("root-path-error", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + _, err := readBucket.Get(context.Background(), ".") + require.EqualError(t, err, "cannot use root", "should be using storageutil.ValidatePath on Get") + _, err = readBucket.Stat(context.Background(), ".") + require.EqualError(t, err, "cannot use root", "should be using storageutil.ValidatePath on Stat") + }) + + t.Run("write-bucket-put-delete", func(t *testing.T) { + t.Parallel() + writeBucket := newWriteBucket(t, defaultProvider) + err := writeBucket.Delete(context.Background(), "hello") + require.True(t, storage.IsNotExist(err)) + writeObjectCloser, err := writeBucket.Put( + context.Background(), + "hello", + ) + require.NoError(t, err) + _, err = writeObjectCloser.Write([]byte("abcd")) + require.NoError(t, err) + require.NoError(t, writeObjectCloser.Close()) + err = writeBucket.Delete(context.Background(), "hello") + require.NoError(t, err) + err = writeBucket.Delete(context.Background(), "hello") + require.True(t, storage.IsNotExist(err)) + writeObjectCloser, err = writeBucket.Put( + context.Background(), + "hello", + ) + require.NoError(t, err) + _, err = writeObjectCloser.Write([]byte("abcd")) + require.NoError(t, err) + require.NoError(t, writeObjectCloser.Close()) + err = writeBucket.Delete(context.Background(), "hello") + require.NoError(t, err) + err = writeBucket.Delete(context.Background(), "hello") + require.True(t, storage.IsNotExist(err)) + }) + + t.Run("write-bucket-put-delete-all", func(t *testing.T) { + t.Parallel() + ctx := context.Background() + writeBucket := newWriteBucket(t, defaultProvider) + // this test starts with this data in the bucket, and then + // deletes it over time in different ways + pathToData := map[string]string{ + "a.txt": testTxtContent, + "b/d.txt": testTxtContent, + "b/d/e.txt": testTxtContent, + "b/d/f.txt": testTxtContent, + "c.d/e.txt": testTxtContent, + "c.de/f.txt": testTxtContent, + "g.txt": testTxtContent, + } + for path, data := range pathToData { + err := storage.PutPath(ctx, writeBucket, path, []byte(data)) + require.NoError(t, err) + } + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err := writeBucket.DeleteAll(ctx, "h") + require.NoError(t, err) + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err = writeBucket.DeleteAll(ctx, "b/d/e.txt") + require.NoError(t, err) + delete(pathToData, "b/d/e.txt") + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err = writeBucket.DeleteAll(ctx, "b/d") + require.NoError(t, err) + delete(pathToData, "b/d/f.txt") + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err = writeBucket.DeleteAll(ctx, "b") + require.NoError(t, err) + delete(pathToData, "b/d.txt") + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err = writeBucket.DeleteAll(ctx, "a.txt") + require.NoError(t, err) + delete(pathToData, "a.txt") + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err = writeBucket.DeleteAll(ctx, "c.d") + require.NoError(t, err) + delete(pathToData, "c.d/e.txt") + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err = writeBucket.DeleteAll(ctx, "c.d") + require.NoError(t, err) + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err = writeBucket.DeleteAll(ctx, "c.de") + require.NoError(t, err) + delete(pathToData, "c.de/f.txt") + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + err = writeBucket.DeleteAll(ctx, "") + require.NoError(t, err) + delete(pathToData, "g.txt") + AssertPathToContent( + t, + writeBucketToReadBucket(t, writeBucket), + "", + pathToData, + ) + }) + + t.Run("walk-prefixed-bucket-should-not-error", func(t *testing.T) { + t.Parallel() + writeBucket := newWriteBucket(t, defaultProvider) + readBucket := writeBucketToReadBucket(t, writeBucket) + mappedReadBucket := storage.MapReadBucket(readBucket, storage.MapOnPrefix("prefix")) + err := mappedReadBucket.Walk(context.Background(), "", func(_ storage.ObjectInfo) error { + return nil + }) + require.NoError(t, err) + }) + + t.Run("symlink_success_no_symlinks", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, symlinkSuccessDirPath, defaultProvider) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "file.proto": testProtoContent, + }, + ) + }) + t.Run("symlink_success_follow_symlinks", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket( + t, + symlinkSuccessDirPath, + storageos.NewProvider( + storageos.ProviderWithSymlinks(), + ), + ) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "1.proto": testProtoContent, + "a/b/1.proto": testProtoContent, + "a/b/2.proto": testProtoContent, + "a/b/2.txt": testTxtContent, + "a/bar.yaml": testYAMLContent, + "a/file.proto": testProtoContent, + "ab/1.proto": testProtoContent, + "ab/2.proto": testProtoContent, + "ab/2.txt": testTxtContent, + "file.proto": testProtoContent, + }, + ) + }) + t.Run("symlink_loop_no_symlinks", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket(t, symlinkLoopDirPath, defaultProvider) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "file.proto": testProtoContent, + }, + ) + }) + t.Run("symlink_loop_follow_symlinks", func(t *testing.T) { + t.Parallel() + readBucket, _ := newReadBucket( + t, + symlinkLoopDirPath, + storageos.NewProvider( + storageos.ProviderWithSymlinks(), + ), + ) + AssertPathToContent( + t, + readBucket, + "", + map[string]string{ + "file.proto": testProtoContent, + }, + ) + }) + t.Run("is_empty", func(t *testing.T) { + t.Parallel() + ctx := context.Background() + + readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) + isEmpty, err := storage.IsEmpty(ctx, readBucket, "") + require.NoError(t, err) + require.False(t, isEmpty) + isEmpty, err = storage.IsEmpty(ctx, readBucket, "root/a") + require.NoError(t, err) + require.False(t, isEmpty) + + tmpDir, err := tmp.NewDir() + require.NoError(t, err) + readBucket, _ = newReadBucket(t, tmpDir.AbsPath(), defaultProvider) + isEmpty, err = storage.IsEmpty(ctx, readBucket, "") + require.NoError(t, err) + require.True(t, isEmpty) + err = os.WriteFile(filepath.Join(tmpDir.AbsPath(), "foo.txt"), []byte("foo"), 0o600) + require.NoError(t, err) + // need to make a new readBucket since the old one won't necessarily have the foo.txt + // file in it, ie in-memory buckets + readBucket, _ = newReadBucket(t, tmpDir.AbsPath(), defaultProvider) + isEmpty, err = storage.IsEmpty(ctx, readBucket, "") + require.NoError(t, err) + require.False(t, isEmpty) + isEmpty, err = storage.IsEmpty( + ctx, + storage.MapReadBucket(readBucket, storage.MatchPathExt(".proto")), + "", + ) + require.NoError(t, err) + require.True(t, isEmpty) + require.NoError(t, tmpDir.Close()) + }) + t.Run("no-external-path", func(t *testing.T) { + t.Parallel() + readBucket, getExternalPathFunc := newReadBucket(t, oneDirPath, defaultProvider) + readBucket = storage.MapReadBucket( + readBucket, + storage.MapOnPrefix("root/a"), + ) + AssertObjectInfo( + t, + readBucket, + "1.proto", + getExternalPathFunc(t, oneDirPath, filepath.Join("root", "a", "1.proto")), + ) + readBucket = storage.NoExternalPathReadBucket(readBucket) + AssertObjectInfo( + t, + readBucket, + "1.proto", + "1.proto", + ) + }) + t.Run("limit-write-bucket", func(t *testing.T) { + t.Parallel() + writeBucket := newWriteBucket(t, defaultProvider) + readBucket := writeBucketToReadBucket(t, writeBucket) + const limit = 2048 + limitedWriteBucket := storage.LimitWriteBucket(writeBucket, limit) + var ( + wg sync.WaitGroup + writtenBytes atomic.Int64 + triedBytes atomic.Int64 + ) + for i := 0; i < 10; i++ { + wg.Add(1) + go func(i int) { + defer wg.Done() + data := bytes.Repeat([]byte("b"), i*100) + path := strconv.Itoa(i) + triedBytes.Add(int64(len(data))) + err := storage.PutPath(context.Background(), limitedWriteBucket, path, data) + if err != nil { + assert.True(t, storage.IsWriteLimitReached(err)) + return + } + readData, err := storage.ReadPath(context.Background(), readBucket, path) + assert.NoError(t, err) + assert.Equal(t, readData, data) + writtenBytes.Add(int64(len(data))) + }(i) + } + wg.Wait() + require.Greater(t, triedBytes.Load(), int64(limit)) + assert.LessOrEqual(t, writtenBytes.Load(), int64(limit)) + }) + t.Run("limit-untar-file-size", func(t *testing.T) { + t.Parallel() + writeBucket := newWriteBucket(t, defaultProvider) + const limit = 2048 + files := map[string][]byte{ + "within": bytes.Repeat([]byte{0}, limit-1), + "at": bytes.Repeat([]byte{0}, limit), + "exceeds": bytes.Repeat([]byte{0}, limit+1), + "match-file": bytes.Repeat([]byte{0}, limit-1), + } + for path, data := range files { + err := storage.PutPath(context.Background(), writeBucket, path, data) + require.NoError(t, err) + } + var buffer bytes.Buffer + err := storagearchive.Tar(context.Background(), writeBucketToReadBucket(t, writeBucket), &buffer) + require.NoError(t, err) + writeBucket = newWriteBucket(t, defaultProvider) + tarball := bytes.NewReader(buffer.Bytes()) + err = storagearchive.Untar(context.Background(), tarball, writeBucket, nil, 0, storagearchive.WithMaxFileSizeUntarOption(limit)) + assert.ErrorIs(t, err, storagearchive.ErrFileSizeLimit) + _, err = tarball.Seek(0, io.SeekStart) + require.NoError(t, err) + err = storagearchive.Untar(context.Background(), tarball, writeBucket, nil, 0) + assert.NoError(t, err) + _, err = tarball.Seek(0, io.SeekStart) + require.NoError(t, err) + err = storagearchive.Untar(context.Background(), tarball, writeBucket, nil, 0, storagearchive.WithMaxFileSizeUntarOption(limit+1)) + assert.NoError(t, err) + err = storagearchive.Untar( + context.Background(), + tarball, + writeBucket, + storage.MatchPathEqual("match-file"), + 0, + storagearchive.WithMaxFileSizeUntarOption(limit), + ) + assert.NoError(t, err) + }) +} diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/base/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/bar.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/bar.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/1.txt new file mode 100644 index 000000000..64e09eead --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/1.txt @@ -0,0 +1,2 @@ +aaaa +bbbb diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/2.txt new file mode 100644 index 000000000..b9a1dd099 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/2.txt @@ -0,0 +1 @@ +dddd diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/1.txt new file mode 100644 index 000000000..223badc7e --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/1.txt @@ -0,0 +1,2 @@ +bbbb +cccc diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/3.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/3.txt new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/five/root1/foo b/pkg/bufman/pkg/storage/storagetesting/testdata/five/root1/foo new file mode 100644 index 000000000..69605d73a --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/five/root1/foo @@ -0,0 +1,3 @@ +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/five/root2/foo/bar.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/five/root2/foo/bar.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/five/root2/foo/bar.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/3.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/3.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/3.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/link/b b/pkg/bufman/pkg/storage/storagetesting/testdata/link/b new file mode 100644 index 000000000..f7f964f73 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/link/b @@ -0,0 +1 @@ +../base/a/b \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/link/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/link/bar.yaml new file mode 100644 index 000000000..490a5eb33 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/link/bar.yaml @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +../base/a/bar.yaml \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/link/file.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/link/file.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/link/file.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/bar.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/bar.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/c/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/c/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/c/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/foo.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/foo.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/foo.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/a/b b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/a/b new file mode 100644 index 000000000..42532fe13 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/a/b @@ -0,0 +1 @@ +../b \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/b/a b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/b/a new file mode 100644 index 000000000..82f488f26 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/b/a @@ -0,0 +1 @@ +../a \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/file.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/file.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/file.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/1.proto new file mode 100644 index 000000000..b75f37911 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/1.proto @@ -0,0 +1,16 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +../base/1.proto \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/a b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/a new file mode 100644 index 000000000..f48f654b2 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/a @@ -0,0 +1 @@ +../link \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/ab b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/ab new file mode 100644 index 000000000..d19fa240b --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/ab @@ -0,0 +1 @@ +../base/ab \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/file.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/file.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/file.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.txt new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/one.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/one.txt new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/two.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/two.proto new file mode 100644 index 000000000..12bf8a0cd --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/two.proto @@ -0,0 +1,15 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/foo.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/foo.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/foo.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/bar.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/bar.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/c/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/c/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/c/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/foo.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/foo.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/foo.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/3.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/3.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/3.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/bat.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/bat.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/bat.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/3.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/3.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/3.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/baz.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/baz.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/baz.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/c/3.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/c/3.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/c/3.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/bar.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/bar.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.txt new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.txt @@ -0,0 +1 @@ +foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/c/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/c/1.proto new file mode 100644 index 000000000..ef220af48 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/c/1.proto @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/foo.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/foo.yaml new file mode 100644 index 000000000..8eece6f60 --- /dev/null +++ b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/foo.yaml @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/pkg/bufman/pkg/storage/storageutil/storageutil.go b/pkg/bufman/pkg/storage/storageutil/storageutil.go new file mode 100644 index 000000000..9c53c7dfb --- /dev/null +++ b/pkg/bufman/pkg/storage/storageutil/storageutil.go @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package storageutil provides helpers for storage implementations. +package storageutil + +import ( + "context" + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" +) + +// ObjectInfo is an embeddable ObjectInfo. +// +// This is intentially static and should not be modifiable. +// If constructing an object, do not use an ObjectInfo to build it. +type ObjectInfo struct { + path string + externalPath string +} + +// NewObjectInfo returns a new ObjectInfo. +func NewObjectInfo( + path string, + externalPath string, +) ObjectInfo { + return ObjectInfo{ + path: path, + externalPath: externalPath, + } +} + +// Path implements ObjectInfo. +func (o ObjectInfo) Path() string { + return o.path +} + +// ExternalPath implements ObjectInfo. +func (o ObjectInfo) ExternalPath() string { + return o.externalPath +} + +// ValidatePath validates a path. +func ValidatePath(path string) (string, error) { + path, err := normalpath.NormalizeAndValidate(path) + if err != nil { + return "", err + } + if path == "." { + return "", errors.New("cannot use root") + } + return path, nil +} + +// ValidatePrefix validates a prefix. +func ValidatePrefix(prefix string) (string, error) { + return normalpath.NormalizeAndValidate(prefix) +} + +// WalkChecker does validation for every step of a walk. +type WalkChecker interface { + Check(ctx context.Context) error +} + +// NewWalkChecker returns a new WalkChecker. +func NewWalkChecker() WalkChecker { + return &walkChecker{} +} + +type walkChecker struct { + count int +} + +func (w *walkChecker) Check(ctx context.Context) error { + w.count++ + select { + case <-ctx.Done(): + err := ctx.Err() + if err == context.DeadlineExceeded { + return fmt.Errorf("timed out after %d files: %v", w.count, err) + } + return err + default: + return nil + } +} diff --git a/pkg/bufman/pkg/storage/util.go b/pkg/bufman/pkg/storage/util.go new file mode 100644 index 000000000..7c2de4e41 --- /dev/null +++ b/pkg/bufman/pkg/storage/util.go @@ -0,0 +1,172 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + "errors" + "io" + "sort" + + "go.uber.org/multierr" +) + +// errIsNotEmpty is used to break out of the Walk function early in IsEmpty. +// +// If errors.Is(err, errIsNotEmpty), the Walk function found a file. +var errIsNotEmpty = errors.New("__is_not_empty__") + +// ReadPath is analogous to os.ReadFile. +// +// Returns an error that fufills IsNotExist if the path does not exist. +func ReadPath(ctx context.Context, readBucket ReadBucket, path string) (_ []byte, retErr error) { + readObject, err := readBucket.Get(ctx, path) + if err != nil { + return nil, err + } + defer func() { + if err := readObject.Close(); err != nil && retErr == nil { + retErr = err + } + }() + return io.ReadAll(readObject) +} + +// PutPath puts the data at the path. +func PutPath(ctx context.Context, writeBucket WriteBucket, path string, data []byte) (retErr error) { + writeObject, err := writeBucket.Put(ctx, path) + if err != nil { + return err + } + defer func() { + retErr = multierr.Append(retErr, writeObject.Close()) + }() + _, err = writeObject.Write(data) + return err +} + +// WalkReadObjects walks the bucket and calls get on each, closing the resulting ReadObjectCloser +// when done. +func WalkReadObjects( + ctx context.Context, + readBucket ReadBucket, + prefix string, + f func(ReadObject) error, +) error { + return readBucket.Walk( + ctx, + prefix, + func(objectInfo ObjectInfo) error { + readObjectCloser, err := readBucket.Get(ctx, objectInfo.Path()) + if err != nil { + return err + } + return multierr.Append(f(readObjectCloser), readObjectCloser.Close()) + }, + ) +} + +// AllPaths walks the bucket and gets all the paths. +func AllPaths(ctx context.Context, readBucket ReadBucket, prefix string) ([]string, error) { + var allPaths []string + if err := readBucket.Walk( + ctx, + prefix, + func(objectInfo ObjectInfo) error { + allPaths = append(allPaths, objectInfo.Path()) + return nil + }, + ); err != nil { + return nil, err + } + return allPaths, nil +} + +// Exists returns true if the path exists, false otherwise. +// +// Returns error on system error. +func Exists(ctx context.Context, readBucket ReadBucket, path string) (bool, error) { + _, err := readBucket.Stat(ctx, path) + if err != nil { + if IsNotExist(err) { + return false, nil + } + return false, err + } + return true, nil +} + +// IsEmpty returns true if the bucket is empty under the prefix. +// +// A prefix of "" or "." will check if the entire bucket is empty. +func IsEmpty(ctx context.Context, readBucket ReadBucket, prefix string) (bool, error) { + if err := readBucket.Walk( + ctx, + prefix, + func(ObjectInfo) error { + return errIsNotEmpty + }, + ); err != nil { + if errors.Is(err, errIsNotEmpty) { + return false, nil + } + return false, err + } + return true, nil +} + +// allObjectInfos walks the bucket and gets all the ObjectInfos. +func allObjectInfos(ctx context.Context, readBucket ReadBucket, prefix string) ([]ObjectInfo, error) { + var allObjectInfos []ObjectInfo + if err := readBucket.Walk( + ctx, + prefix, + func(objectInfo ObjectInfo) error { + allObjectInfos = append(allObjectInfos, objectInfo) + return nil + }, + ); err != nil { + return nil, err + } + return allObjectInfos, nil +} + +func pathToObjectInfo(objectInfos []ObjectInfo) map[string]ObjectInfo { + m := make(map[string]ObjectInfo, len(objectInfos)) + for _, objectInfo := range objectInfos { + m[objectInfo.Path()] = objectInfo + } + return m +} + +func sortObjectInfos(objectInfos []ObjectInfo) { + sort.Slice( + objectInfos, + func(i int, j int) bool { + return objectInfos[i].Path() < objectInfos[j].Path() + }, + ) +} + +type compositeReadObjectCloser struct { + ObjectInfo + io.ReadCloser +} + +type compositeReadWriteBucket struct { + ReadBucket + WriteBucket +} diff --git a/pkg/bufman/pkg/stringjson/stringjson.go b/pkg/bufman/pkg/stringjson/stringjson.go new file mode 100644 index 000000000..7587871ce --- /dev/null +++ b/pkg/bufman/pkg/stringjson/stringjson.go @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stringjson + +import ( + "encoding/json" + "fmt" + "io" +) + +var newline = []byte{'\n'} + +// Object is an object that can either be marshaled to string or JSON. +type Object interface { + fmt.Stringer + json.Marshaler +} + +// Print prints the object. +func Print(writer io.Writer, object Object, asJSON bool) error { + return printInternal(writer, object, asJSON, nil) +} + +// Println prints the object with a newline. +func Println(writer io.Writer, object Object, asJSON bool) error { + return printInternal(writer, object, asJSON, newline) +} + +func printInternal(writer io.Writer, object Object, asJSON bool, extra []byte) error { + if object == nil { + return nil + } + var data []byte + var err error + if asJSON { + data, err = object.MarshalJSON() + if err != nil { + return err + } + } else { + data = []byte(object.String()) + } + if len(data) > 0 { + if len(extra) > 0 { + data = append(data, extra...) + } + if _, err := writer.Write(data); err != nil { + return err + } + } + return nil +} diff --git a/pkg/bufman/pkg/stringutil/stringutil.go b/pkg/bufman/pkg/stringutil/stringutil.go new file mode 100644 index 000000000..0d5593be0 --- /dev/null +++ b/pkg/bufman/pkg/stringutil/stringutil.go @@ -0,0 +1,333 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package stringutil implements string utilities. +package stringutil + +import ( + "sort" + "strings" + "unicode" +) + +// TrimLines splits the output into individual lines and trims the spaces from each line. +// +// This also trims the start and end spaces from the original output. +func TrimLines(output string) string { + return strings.TrimSpace(strings.Join(SplitTrimLines(output), "\n")) +} + +// SplitTrimLines splits the output into individual lines and trims the spaces from each line. +func SplitTrimLines(output string) []string { + // this should work for windows as well as \r will be trimmed + split := strings.Split(output, "\n") + lines := make([]string, len(split)) + for i, line := range split { + lines[i] = strings.TrimSpace(line) + } + return lines +} + +// SplitTrimLinesNoEmpty splits the output into individual lines and trims the spaces from each line. +// +// This removes any empty lines. +func SplitTrimLinesNoEmpty(output string) []string { + // this should work for windows as well as \r will be trimmed + split := strings.Split(output, "\n") + lines := make([]string, 0, len(split)) + for _, line := range split { + line = strings.TrimSpace(line) + if line != "" { + lines = append(lines, line) + } + } + return lines +} + +// MapToSortedSlice transforms m to a sorted slice. +func MapToSortedSlice(m map[string]struct{}) []string { + s := MapToSlice(m) + sort.Strings(s) + return s +} + +// MapToSlice transforms m to a slice. +func MapToSlice(m map[string]struct{}) []string { + s := make([]string, 0, len(m)) + for e := range m { + s = append(s, e) + } + return s +} + +// SliceToMap transforms s to a map. +func SliceToMap(s []string) map[string]struct{} { + m := make(map[string]struct{}, len(s)) + for _, e := range s { + m[e] = struct{}{} + } + return m +} + +// SliceToUniqueSortedSlice returns a sorted copy of s with no duplicates. +func SliceToUniqueSortedSlice(s []string) []string { + return MapToSortedSlice(SliceToMap(s)) +} + +// SliceToUniqueSortedSliceFilterEmptyStrings returns a sorted copy of s with no duplicates and no empty strings. +// +// Strings with only spaces are considered empty. +func SliceToUniqueSortedSliceFilterEmptyStrings(s []string) []string { + m := SliceToMap(s) + for key := range m { + if strings.TrimSpace(key) == "" { + delete(m, key) + } + } + return MapToSortedSlice(m) +} + +// SliceToChunks splits s into chunks of the given chunk size. +// +// If s is nil or empty, returns empty. +// If chunkSize is <=0, returns [][]string{s}. +func SliceToChunks(s []string, chunkSize int) [][]string { + var chunks [][]string + if len(s) == 0 { + return chunks + } + if chunkSize <= 0 { + return [][]string{s} + } + c := make([]string, len(s)) + copy(c, s) + // https://github.com/golang/go/wiki/SliceTricks#batching-with-minimal-allocation + for chunkSize < len(c) { + c, chunks = c[chunkSize:], append(chunks, c[0:chunkSize:chunkSize]) + } + return append(chunks, c) +} + +// SliceElementsEqual returns true if the two slices have equal elements. +// +// Nil and empty slices are treated as equals. +func SliceElementsEqual(one []string, two []string) bool { + if len(one) != len(two) { + return false + } + for i, elem := range one { + if two[i] != elem { + return false + } + } + return true +} + +// SliceElementsContained returns true if superset contains subset. +// +// Nil and empty slices are treated as equals. +func SliceElementsContained(superset []string, subset []string) bool { + m := SliceToMap(superset) + for _, elem := range subset { + if _, ok := m[elem]; !ok { + return false + } + } + return true +} + +// JoinSliceQuoted joins the slice with quotes. +func JoinSliceQuoted(s []string, sep string) string { + if len(s) == 0 { + return "" + } + return `"` + strings.Join(s, `"`+sep+`"`) + `"` +} + +// SliceToString prints the slice as [e1,e2]. +func SliceToString(s []string) string { + if len(s) == 0 { + return "" + } + return "[" + strings.Join(s, ",") + "]" +} + +// SliceToHumanString prints the slice as "e1, e2, and e3". +func SliceToHumanString(s []string) string { + switch len(s) { + case 0: + return "" + case 1: + return s[0] + case 2: + return s[0] + " and " + s[1] + default: + return strings.Join(s[:len(s)-1], ", ") + ", and " + s[len(s)-1] + } +} + +// SliceToHumanStringQuoted prints the slice as `"e1", "e2", and "e3"`. +func SliceToHumanStringQuoted(s []string) string { + switch len(s) { + case 0: + return "" + case 1: + return `"` + s[0] + `"` + case 2: + return `"` + s[0] + `" and "` + s[1] + `"` + default: + return `"` + strings.Join(s[:len(s)-1], `", "`) + `", and "` + s[len(s)-1] + `"` + } +} + +// SliceToHumanStringOr prints the slice as "e1, e2, or e3". +func SliceToHumanStringOr(s []string) string { + switch len(s) { + case 0: + return "" + case 1: + return s[0] + case 2: + return s[0] + " or " + s[1] + default: + return strings.Join(s[:len(s)-1], ", ") + ", or " + s[len(s)-1] + } +} + +// SliceToHumanStringOrQuoted prints the slice as `"e1", "e2", or "e3"`. +func SliceToHumanStringOrQuoted(s []string) string { + switch len(s) { + case 0: + return "" + case 1: + return `"` + s[0] + `"` + case 2: + return `"` + s[0] + `" or "` + s[1] + `"` + default: + return `"` + strings.Join(s[:len(s)-1], `", "`) + `", or "` + s[len(s)-1] + `"` + } +} + +// SnakeCaseOption is an option for snake_case conversions. +type SnakeCaseOption func(*snakeCaseOptions) + +// SnakeCaseWithNewWordOnDigits is a SnakeCaseOption that signifies +// to split on digits, ie foo_bar_1 instead of foo_bar1. +func SnakeCaseWithNewWordOnDigits() SnakeCaseOption { + return func(snakeCaseOptions *snakeCaseOptions) { + snakeCaseOptions.newWordOnDigits = true + } +} + +// ToLowerSnakeCase transforms s to lower_snake_case. +func ToLowerSnakeCase(s string, options ...SnakeCaseOption) string { + return strings.ToLower(toSnakeCase(s, options...)) +} + +// ToUpperSnakeCase transforms s to UPPER_SNAKE_CASE. +func ToUpperSnakeCase(s string, options ...SnakeCaseOption) string { + return strings.ToUpper(toSnakeCase(s, options...)) +} + +// ToPascalCase converts s to PascalCase. +// +// Splits on '-', '_', ' ', '\t', '\n', '\r'. +// Uppercase letters will stay uppercase, +func ToPascalCase(s string) string { + output := "" + var previous rune + for i, c := range strings.TrimSpace(s) { + if !isDelimiter(c) { + if i == 0 || isDelimiter(previous) || unicode.IsUpper(c) { + output += string(unicode.ToUpper(c)) + } else { + output += string(unicode.ToLower(c)) + } + } + previous = c + } + return output +} + +// IsAlphanumeric returns true for [0-9a-zA-Z]. +func IsAlphanumeric(r rune) bool { + return IsNumeric(r) || IsAlpha(r) +} + +// IsAlpha returns true for [a-zA-Z]. +func IsAlpha(r rune) bool { + return IsLowerAlpha(r) || IsUpperAlpha(r) +} + +// IsLowerAlpha returns true for [a-z]. +func IsLowerAlpha(r rune) bool { + return 'a' <= r && r <= 'z' +} + +// IsUpperAlpha returns true for [A-Z]. +func IsUpperAlpha(r rune) bool { + return 'A' <= r && r <= 'Z' +} + +// IsNumeric returns true for [0-9]. +func IsNumeric(r rune) bool { + return '0' <= r && r <= '9' +} + +// IsLowerAlphanumeric returns true for [0-9a-z]. +func IsLowerAlphanumeric(r rune) bool { + return IsNumeric(r) || IsLowerAlpha(r) +} + +func toSnakeCase(s string, options ...SnakeCaseOption) string { + snakeCaseOptions := &snakeCaseOptions{} + for _, option := range options { + option(snakeCaseOptions) + } + output := "" + s = strings.TrimFunc(s, isDelimiter) + for i, c := range s { + if isDelimiter(c) { + c = '_' + } + if i == 0 { + output += string(c) + } else if isSnakeCaseNewWord(c, snakeCaseOptions.newWordOnDigits) && + output[len(output)-1] != '_' && + ((i < len(s)-1 && !isSnakeCaseNewWord(rune(s[i+1]), true) && !isDelimiter(rune(s[i+1]))) || + (snakeCaseOptions.newWordOnDigits && unicode.IsDigit(c)) || + (unicode.IsLower(rune(s[i-1])))) { + output += "_" + string(c) + } else if !(isDelimiter(c) && output[len(output)-1] == '_') { + output += string(c) + } + } + return output +} + +func isSnakeCaseNewWord(r rune, newWordOnDigits bool) bool { + if newWordOnDigits { + return unicode.IsUpper(r) || unicode.IsDigit(r) + } + return unicode.IsUpper(r) +} + +func isDelimiter(r rune) bool { + return r == '.' || r == '-' || r == '_' || r == ' ' || r == '\t' || r == '\n' || r == '\r' +} + +type snakeCaseOptions struct { + newWordOnDigits bool +} diff --git a/pkg/bufman/pkg/stringutil/stringutil_test.go b/pkg/bufman/pkg/stringutil/stringutil_test.go new file mode 100644 index 000000000..b94502bf3 --- /dev/null +++ b/pkg/bufman/pkg/stringutil/stringutil_test.go @@ -0,0 +1,377 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stringutil + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestToLowerSnakeCase(t *testing.T) { + t.Parallel() + assert.Equal(t, "", ToLowerSnakeCase("")) + assert.Equal(t, "", ToLowerSnakeCase(" ")) + assert.Equal(t, "", ToLowerSnakeCase("_")) + assert.Equal(t, "", ToLowerSnakeCase("__")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("PascalCase")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase(" PascalCase")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("PascalCase ")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("pascalCase")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("PascalCase_")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("_PascalCase")) + assert.Equal(t, "pascal_case_hello", ToLowerSnakeCase("PascalCase__Hello")) + assert.Equal(t, "json_pascal", ToLowerSnakeCase("JSONPascal")) + assert.Equal(t, "foo_json_pascal", ToLowerSnakeCase("FooJSONPascal")) + assert.Equal(t, "json_pascal_json", ToLowerSnakeCase("JSONPascalJSON")) + assert.Equal(t, "v1", ToLowerSnakeCase("v1")) + assert.Equal(t, "v1beta1", ToLowerSnakeCase("v1beta1")) + assert.Equal(t, "v1beta_1", ToLowerSnakeCase("v1beta_1")) + assert.Equal(t, "v_1", ToLowerSnakeCase("v1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "v_1beta_1", ToLowerSnakeCase("v1beta1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "pascal_case1", ToLowerSnakeCase("PascalCase1")) + assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("PascalCase_1")) + assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("PascalCase1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "foo_json1_pascal", ToLowerSnakeCase("FooJSON1Pascal")) + assert.Equal(t, "foo_json_1_pascal", ToLowerSnakeCase("FooJSON_1Pascal")) + assert.Equal(t, "foo_json_1_pascal", ToLowerSnakeCase("FooJSON1Pascal", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "pascal_case1", ToLowerSnakeCase("pascal_case1")) + assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("pascal_case_1")) + assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("pascal_case1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("pascal_case_1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase("foo_bar_baz")) + assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase("_foo_bar_baz_")) + assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase("foo_bar__baz")) + assert.Equal(t, "pascal_case_hello", ToLowerSnakeCase("PascalCase--Hello")) + assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase("_foo-bar-baz_")) + assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase(" Foo Bar _Baz")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("pascal_case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("pascalCase")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase(" pascal_case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase(" pascal_case ")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("pascal_case ")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("Pascal_case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("__Pascal___case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("__Pascal___case__")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("Pascal___case__")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("Pascal-case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("Pascal case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase(" Pascal case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("PASCAL_case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("__PASCAL___case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("__PASCAL___case__")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("PASCAL___case__")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("PASCAL-case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase("PASCAL case")) + assert.Equal(t, "pascal_case", ToLowerSnakeCase(" PASCAL case")) +} + +func TestToUpperSnakeCase(t *testing.T) { + t.Parallel() + assert.Equal(t, "", ToUpperSnakeCase("")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PascalCase")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("pascalCase")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PascalCase_")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("_PascalCase")) + assert.Equal(t, "PASCAL_CASE_HELLO", ToUpperSnakeCase("PascalCase__Hello")) + assert.Equal(t, "JSON_PASCAL", ToUpperSnakeCase("JSONPascal")) + assert.Equal(t, "FOO_JSON_PASCAL", ToUpperSnakeCase("FooJSONPascal")) + assert.Equal(t, "PASCAL_CASE1", ToUpperSnakeCase("PascalCase1")) + assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PascalCase_1")) + assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PascalCase1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "FOO_JSON1_PASCAL", ToUpperSnakeCase("FooJSON1Pascal")) + assert.Equal(t, "FOO_JSON_1_PASCAL", ToUpperSnakeCase("FooJSON_1Pascal")) + assert.Equal(t, "FOO_JSON_1_PASCAL", ToUpperSnakeCase("FooJSON1Pascal", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "PASCAL_CASE1", ToUpperSnakeCase("pascal_case1")) + assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("pascal_case_1")) + assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("pascal_case1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("pascal_case_1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "PASCAL_CASE1", ToUpperSnakeCase("PASCAL_CASE1")) + assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PASCAL_CASE_1")) + assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PASCAL_CASE1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PASCAL_CASE_1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "V1", ToUpperSnakeCase("v1")) + assert.Equal(t, "V1BETA1", ToUpperSnakeCase("v1beta1")) + assert.Equal(t, "V_1", ToUpperSnakeCase("v1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "V_1BETA_1", ToUpperSnakeCase("v1beta1", SnakeCaseWithNewWordOnDigits())) + assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase("foo_bar_baz")) + assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase("_foo_bar_baz_")) + assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase("foo_bar__baz")) + assert.Equal(t, "PASCAL_CASE_HELLO", ToUpperSnakeCase("PascalCase--Hello")) + assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase("_foo-bar-baz_")) + assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase(" Foo Bar _Baz")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("pascal_case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("pascalCase")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase(" pascal_case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase(" pascal_case ")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("pascal_case ")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("Pascal_case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("__Pascal___case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("__Pascal___case__")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("Pascal___case__")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("Pascal-case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("Pascal case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase(" Pascal case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL_case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("__PASCAL___case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("__PASCAL___case__")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL___case__")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL-case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase(" PASCAL case")) + assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL_case")) +} + +func TestToPascalCase(t *testing.T) { + t.Parallel() + assert.Equal(t, "", ToPascalCase("")) + assert.Equal(t, "", ToPascalCase(" ")) + assert.Equal(t, "PascalCase", ToPascalCase("pascal_case")) + assert.Equal(t, "PascalCase", ToPascalCase("pascalCase")) + assert.Equal(t, "PascalCase", ToPascalCase(" pascal_case")) + assert.Equal(t, "PascalCase", ToPascalCase(" pascal_case ")) + assert.Equal(t, "PascalCase", ToPascalCase("pascal_case ")) + assert.Equal(t, "PascalCase", ToPascalCase("Pascal_case")) + assert.Equal(t, "PascalCase", ToPascalCase("__Pascal___case")) + assert.Equal(t, "PascalCase", ToPascalCase("__Pascal___case__")) + assert.Equal(t, "PascalCase", ToPascalCase("Pascal___case__")) + assert.Equal(t, "PascalCase", ToPascalCase("Pascal-case")) + assert.Equal(t, "PascalCase", ToPascalCase("Pascal case")) + assert.Equal(t, "PascalCase", ToPascalCase(" Pascal case")) + assert.Equal(t, "PASCALCase", ToPascalCase("PASCAL_case")) + assert.Equal(t, "PASCALCase", ToPascalCase("__PASCAL___case")) + assert.Equal(t, "PASCALCase", ToPascalCase("__PASCAL___case__")) + assert.Equal(t, "PASCALCase", ToPascalCase("PASCAL___case__")) + assert.Equal(t, "PASCALCase", ToPascalCase("PASCAL-case")) + assert.Equal(t, "PASCALCase", ToPascalCase("PASCAL case")) + assert.Equal(t, "PASCALCase", ToPascalCase(" PASCAL case")) + assert.Equal(t, "PascalCase", ToPascalCase("PascalCase")) + assert.Equal(t, "PascalCase", ToPascalCase("pascalCase")) + assert.Equal(t, "PascalCase", ToPascalCase("PascalCase_")) + assert.Equal(t, "PascalCase", ToPascalCase("_PascalCase")) + assert.Equal(t, "PascalCaseHello", ToPascalCase("PascalCase__Hello")) + assert.Equal(t, "JSONPascal", ToPascalCase("JSONPascal")) + assert.Equal(t, "FooJSONPascal", ToPascalCase("FooJSONPascal")) + assert.Equal(t, "PascalCase1", ToPascalCase("PascalCase1")) + assert.Equal(t, "FooJSON1Pascal", ToPascalCase("FooJSON1Pascal")) + assert.Equal(t, "FooBarBaz", ToPascalCase("foo_bar_baz")) + assert.Equal(t, "FooBarBaz", ToPascalCase("_foo_bar_baz_")) + assert.Equal(t, "FooBarBaz", ToPascalCase("foo_bar__baz")) + assert.Equal(t, "PascalCaseHello", ToPascalCase("PascalCase--Hello")) + assert.Equal(t, "FooBarBaz", ToPascalCase("_foo-bar-baz_")) + assert.Equal(t, "FooBarBaz", ToPascalCase(" Foo Bar _Baz")) + assert.Equal(t, "FooBarBaz", ToPascalCase(" Foo.Bar.Baz")) + assert.Equal(t, "FooBarBaz", ToPascalCase("foo_bar.baz")) +} + +func TestJoinSliceQuoted(t *testing.T) { + t.Parallel() + assert.Equal(t, ``, JoinSliceQuoted(nil, ", ")) + assert.Equal(t, ``, JoinSliceQuoted([]string{}, ", ")) + assert.Equal(t, `"a"`, JoinSliceQuoted([]string{"a"}, ", ")) + assert.Equal(t, `"a", "b"`, JoinSliceQuoted([]string{"a", "b"}, ", ")) + assert.Equal(t, `"a", "b", "c"`, JoinSliceQuoted([]string{"a", "b", "c"}, ", ")) +} + +func TestSliceToHumanString(t *testing.T) { + t.Parallel() + assert.Equal(t, ``, SliceToHumanString(nil)) + assert.Equal(t, ``, SliceToHumanString([]string{})) + assert.Equal(t, `a`, SliceToHumanString([]string{"a"})) + assert.Equal(t, `a and b`, SliceToHumanString([]string{"a", "b"})) + assert.Equal(t, `a, b, and c`, SliceToHumanString([]string{"a", "b", "c"})) +} + +func TestSliceToHumanStringQuoted(t *testing.T) { + t.Parallel() + assert.Equal(t, ``, SliceToHumanStringQuoted(nil)) + assert.Equal(t, ``, SliceToHumanStringQuoted([]string{})) + assert.Equal(t, `"a"`, SliceToHumanStringQuoted([]string{"a"})) + assert.Equal(t, `"a" and "b"`, SliceToHumanStringQuoted([]string{"a", "b"})) + assert.Equal(t, `"a", "b", and "c"`, SliceToHumanStringQuoted([]string{"a", "b", "c"})) +} + +func TestSliceToHumanStringOr(t *testing.T) { + t.Parallel() + assert.Equal(t, ``, SliceToHumanStringOr(nil)) + assert.Equal(t, ``, SliceToHumanStringOr([]string{})) + assert.Equal(t, `a`, SliceToHumanStringOr([]string{"a"})) + assert.Equal(t, `a or b`, SliceToHumanStringOr([]string{"a", "b"})) + assert.Equal(t, `a, b, or c`, SliceToHumanStringOr([]string{"a", "b", "c"})) +} + +func TestSliceToHumanStringOrQuoted(t *testing.T) { + t.Parallel() + assert.Equal(t, ``, SliceToHumanStringOrQuoted(nil)) + assert.Equal(t, ``, SliceToHumanStringOrQuoted([]string{})) + assert.Equal(t, `"a"`, SliceToHumanStringOrQuoted([]string{"a"})) + assert.Equal(t, `"a" or "b"`, SliceToHumanStringOrQuoted([]string{"a", "b"})) + assert.Equal(t, `"a", "b", or "c"`, SliceToHumanStringOrQuoted([]string{"a", "b", "c"})) +} + +func TestSliceToUniqueSortedSlice(t *testing.T) { + t.Parallel() + assert.Equal(t, []string{}, SliceToUniqueSortedSlice(nil)) + assert.Equal(t, []string{}, SliceToUniqueSortedSlice([]string{})) + assert.Equal(t, []string{"Are", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats"})) + assert.Equal(t, []string{"Are", "are", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats", "are"})) + assert.Equal(t, []string{"Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats", "Are", "Bats"})) + assert.Equal(t, []string{"", "Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats", "", "Are", "Bats", ""})) + assert.Equal(t, []string{"", " ", "Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats", "", "Are", "Bats", "", " "})) + assert.Equal(t, []string{""}, SliceToUniqueSortedSlice([]string{"", ""})) + assert.Equal(t, []string{""}, SliceToUniqueSortedSlice([]string{""})) +} + +func TestSliceToUniqueSortedSliceFilterEmptyStrings(t *testing.T) { + t.Parallel() + assert.Equal(t, []string{}, SliceToUniqueSortedSliceFilterEmptyStrings(nil)) + assert.Equal(t, []string{}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{})) + assert.Equal(t, []string{"Are", "bats", "cats"}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"bats", "Are", "cats"})) + assert.Equal(t, []string{"Are", "are", "bats", "cats"}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"bats", "Are", "cats", "are"})) + assert.Equal(t, []string{"Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"bats", "Are", "cats", "Are", "Bats"})) + assert.Equal(t, []string{"Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"bats", "Are", "cats", "", "Are", "Bats", ""})) + assert.Equal(t, []string{}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"", "", " "})) + assert.Equal(t, []string{}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{""})) +} + +func TestSliceElementsContained(t *testing.T) { + t.Parallel() + assert.True(t, SliceElementsContained(nil, nil)) + assert.True(t, SliceElementsContained([]string{}, []string{})) + assert.True(t, SliceElementsContained(nil, []string{})) + assert.True(t, SliceElementsContained([]string{}, nil)) + assert.True(t, SliceElementsContained([]string{"one"}, []string{"one"})) + assert.True(t, SliceElementsContained([]string{"one", "two"}, []string{"one"})) + assert.True(t, SliceElementsContained([]string{"one", "two"}, []string{"two"})) + assert.True(t, SliceElementsContained([]string{"one", "two"}, []string{"one", "two"})) + assert.True(t, SliceElementsContained([]string{"one", "two"}, []string{"two", "one"})) + assert.False(t, SliceElementsContained([]string{"one", "two"}, []string{"three"})) + assert.False(t, SliceElementsContained([]string{}, []string{"three"})) + assert.False(t, SliceElementsContained([]string{"one"}, []string{"one", "two"})) + assert.False(t, SliceElementsContained([]string{"two"}, []string{"one", "two"})) +} + +func TestSliceToChunks(t *testing.T) { + t.Parallel() + testSliceToChunks( + t, + []string{"are"}, + 1, + []string{"are"}, + ) + testSliceToChunks( + t, + []string{"are", "bats", "cats", "do", "eagle"}, + 1, + []string{"are"}, + []string{"bats"}, + []string{"cats"}, + []string{"do"}, + []string{"eagle"}, + ) + testSliceToChunks( + t, + []string{"are", "bats", "cats", "do", "eagle"}, + 2, + []string{"are", "bats"}, + []string{"cats", "do"}, + []string{"eagle"}, + ) + testSliceToChunks( + t, + []string{"are", "bats", "cats", "do", "eagle"}, + 3, + []string{"are", "bats", "cats"}, + []string{"do", "eagle"}, + ) + testSliceToChunks( + t, + []string{"are", "bats", "cats", "do", "eagle"}, + 6, + []string{"are", "bats", "cats", "do", "eagle"}, + ) + testSliceToChunks( + t, + nil, + 0, + ) +} + +func testSliceToChunks(t *testing.T, input []string, chunkSize int, expected ...[]string) { + assert.Equal(t, expected, SliceToChunks(input, chunkSize)) +} + +func TestAlphanumeric(t *testing.T) { + t.Parallel() + assert.True(t, IsAlphanumeric('0')) + assert.False(t, IsAlphanumeric('.')) +} + +func TestIsAlpha(t *testing.T) { + t.Parallel() + assert.True(t, IsAlpha('r')) + assert.True(t, IsAlpha('A')) + assert.True(t, IsAlpha('Z')) + assert.True(t, IsAlpha('a')) + assert.True(t, IsAlpha('z')) + assert.False(t, IsAlpha('.')) + assert.False(t, IsAlpha('0')) + assert.False(t, IsAlpha('9')) + assert.False(t, IsAlpha('!')) +} + +func TestIsLowerAlpha(t *testing.T) { + t.Parallel() + assert.True(t, IsLowerAlpha('r')) + assert.False(t, IsLowerAlpha('R')) +} + +func TestIsUpperAlpha(t *testing.T) { + t.Parallel() + assert.True(t, IsUpperAlpha('R')) + assert.False(t, IsUpperAlpha('r')) +} + +func TestIsNumeric(t *testing.T) { + t.Parallel() + assert.True(t, IsNumeric('0')) + assert.False(t, IsNumeric('r')) +} + +func TestIsLowerAlphanumeric(t *testing.T) { + t.Parallel() + assert.True(t, IsLowerAlphanumeric('0')) + assert.True(t, IsLowerAlphanumeric('r')) + assert.True(t, IsLowerAlphanumeric('a')) + assert.True(t, IsLowerAlphanumeric('z')) + assert.True(t, IsLowerAlphanumeric('9')) + assert.False(t, IsLowerAlphanumeric('R')) + assert.False(t, IsLowerAlphanumeric('A')) + assert.False(t, IsLowerAlphanumeric('Z')) + assert.False(t, IsLowerAlphanumeric('!')) +} + +func TestIsAlphanumeric(t *testing.T) { + t.Parallel() + require.True(t, IsAlphanumeric('A')) + require.True(t, IsAlphanumeric('Z')) + require.True(t, IsAlphanumeric('a')) + require.True(t, IsAlphanumeric('z')) + require.True(t, IsAlphanumeric('0')) + require.True(t, IsAlphanumeric('9')) + require.False(t, IsAlphanumeric('!')) +} diff --git a/pkg/bufman/pkg/testingextended/testingextended.go b/pkg/bufman/pkg/testingextended/testingextended.go new file mode 100644 index 000000000..1608e9cd1 --- /dev/null +++ b/pkg/bufman/pkg/testingextended/testingextended.go @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package testingextended + +import ( + "testing" + "time" +) + +// SkipIfShort skips the test if testing.short is set. +func SkipIfShort(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } +} + +// GetTestTimeout returns the time remaining until the test times out or 10m if the test is not set to timeout. +func GetTestTimeout(t *testing.T) time.Duration { + if deadline, ok := t.Deadline(); ok && !deadline.IsZero() { + return time.Until(deadline) + } + return 10 * time.Minute +} diff --git a/pkg/bufman/pkg/thread/thread.go b/pkg/bufman/pkg/thread/thread.go new file mode 100644 index 000000000..b7ea646a9 --- /dev/null +++ b/pkg/bufman/pkg/thread/thread.go @@ -0,0 +1,148 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package thread + +import ( + "context" + "runtime" + "sync" + + "go.uber.org/multierr" +) + +var ( + globalParallelism = runtime.GOMAXPROCS(0) + globalLock sync.RWMutex +) + +// Parallelism returns the current parellism. +// +// This defaults to the number of CPUs. +func Parallelism() int { + globalLock.RLock() + parallelism := globalParallelism + globalLock.RUnlock() + return parallelism +} + +// SetParallelism sets the parallelism. +// +// If parallelism < 1, this sets the parallelism to 1. +func SetParallelism(parallelism int) { + if parallelism < 1 { + parallelism = 1 + } + globalLock.Lock() + globalParallelism = parallelism + globalLock.Unlock() +} + +// Parallelize runs the jobs in parallel. +// +// A max of Parallelism jobs will be run at once. +// Returns the combined error from the jobs. +func Parallelize(ctx context.Context, jobs []func(context.Context) error, options ...ParallelizeOption) error { + parallelizeOptions := newParallelizeOptions() + for _, option := range options { + option(parallelizeOptions) + } + switch len(jobs) { + case 0: + return nil + case 1: + return jobs[0](ctx) + } + multiplier := parallelizeOptions.multiplier + if multiplier < 1 { + multiplier = 1 + } + semaphoreC := make(chan struct{}, Parallelism()*multiplier) + var retErr error + var wg sync.WaitGroup + var lock sync.Mutex + var stop bool + for _, job := range jobs { + if stop { + break + } + // We always want context cancellation/deadline expiration to take + // precedence over the semaphore unblocking, but select statements choose + // among the unblocked non-default cases pseudorandomly. To correctly + // enforce precedence, use a similar pattern to the check-lock-check + // pattern common with sync.RWMutex: check the context twice, and only do + // the semaphore-protected work in the innermost default case. + select { + case <-ctx.Done(): + stop = true + retErr = multierr.Append(retErr, ctx.Err()) + case semaphoreC <- struct{}{}: + select { + case <-ctx.Done(): + stop = true + retErr = multierr.Append(retErr, ctx.Err()) + default: + job := job + wg.Add(1) + go func() { + if err := job(ctx); err != nil { + lock.Lock() + retErr = multierr.Append(retErr, err) + lock.Unlock() + if parallelizeOptions.cancel != nil { + parallelizeOptions.cancel() + } + } + // This will never block. + <-semaphoreC + wg.Done() + }() + } + } + } + wg.Wait() + return retErr +} + +// ParallelizeOption is an option to Parallelize. +type ParallelizeOption func(*parallelizeOptions) + +// ParallelizeWithMultiplier returns a new ParallelizeOption that will use a multiple +// of Parallelism() for the number of jobs that can be run at once. +// +// The default is to only do Parallelism() number of jobs. +// A multiplier of <1 has no meaning. +func ParallelizeWithMultiplier(multiplier int) ParallelizeOption { + return func(parallelizeOptions *parallelizeOptions) { + parallelizeOptions.multiplier = multiplier + } +} + +// ParallelizeWithCancel returns a new ParallelizeOption that will call the +// given context.CancelFunc if any job fails. +func ParallelizeWithCancel(cancel context.CancelFunc) ParallelizeOption { + return func(parallelizeOptions *parallelizeOptions) { + parallelizeOptions.cancel = cancel + } +} + +type parallelizeOptions struct { + multiplier int + cancel context.CancelFunc +} + +func newParallelizeOptions() *parallelizeOptions { + return ¶llelizeOptions{} +} diff --git a/pkg/bufman/pkg/thread/thread_test.go b/pkg/bufman/pkg/thread/thread_test.go new file mode 100644 index 000000000..d1dab4207 --- /dev/null +++ b/pkg/bufman/pkg/thread/thread_test.go @@ -0,0 +1,63 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package thread + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.uber.org/atomic" +) + +func TestParallelizeWithImmediateCancellation(t *testing.T) { + t.Parallel() + // The bulk of the code relies on subtle timing that's difficult to + // reproduce, but we can test the most basic use case. + t.Run("RegularRun", func(t *testing.T) { + t.Parallel() + const jobsToExecute = 10 + var ( + executed atomic.Int64 + jobs = make([]func(context.Context) error, 0, jobsToExecute) + ) + for i := 0; i < jobsToExecute; i++ { + jobs = append(jobs, func(_ context.Context) error { + executed.Inc() + return nil + }) + } + err := Parallelize(context.Background(), jobs) + assert.NoError(t, err) + assert.Equal(t, int64(jobsToExecute), executed.Load(), "jobs executed") + }) + t.Run("WithCtxCancellation", func(t *testing.T) { + t.Parallel() + var executed atomic.Int64 + var jobs []func(context.Context) error + for i := 0; i < 10; i++ { + jobs = append(jobs, func(_ context.Context) error { + executed.Inc() + return nil + }) + } + ctx, cancel := context.WithCancel(context.Background()) + cancel() + err := Parallelize(ctx, jobs) + assert.Error(t, err) + assert.Equal(t, int64(0), executed.Load(), "jobs executed") + }) +} diff --git a/pkg/bufman/pkg/tmp/tmp.go b/pkg/bufman/pkg/tmp/tmp.go new file mode 100644 index 000000000..b85f2c9fb --- /dev/null +++ b/pkg/bufman/pkg/tmp/tmp.go @@ -0,0 +1,180 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package tmp provides temporary files and directories. +// +// Usage of this package requires eng approval - ask before using. +package tmp + +import ( + "io" + "os" + "path/filepath" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/interrupt" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/uuidutil" + "go.uber.org/multierr" +) + +// File is a temporary file +// +// It must be closed when done. +type File interface { + io.Closer + + AbsPath() string +} + +// NewFileWithData returns a new temporary file with the given data. +// +// It must be closed when done. +// This file will be deleted on interrupt signals. +// +// Usage of this function requires eng approval - ask before using. +func NewFileWithData(data []byte) (File, error) { + id, err := uuidutil.New() + if err != nil { + return nil, err + } + file, err := os.CreateTemp("", id.String()) + if err != nil { + return nil, err + } + path := file.Name() + // just in case + absPath, err := filepath.Abs(filepath.Clean(path)) + if err != nil { + return nil, err + } + signalC, closer := interrupt.NewSignalChannel() + go func() { + <-signalC + _ = os.Remove(absPath) + }() + _, err = file.Write(data) + err = multierr.Append(err, file.Close()) + if err != nil { + err = multierr.Append(err, os.Remove(absPath)) + closer() + return nil, err + } + return newFile(absPath, closer), nil +} + +// Dir is a temporary directory. +// +// It must be closed when done. +type Dir interface { + io.Closer + + AbsPath() string +} + +// NewDir returns a new temporary directory. +// +// It must be closed when done. +// This file will be deleted on interrupt signals. +// +// Usage of this function requires eng approval - ask before using. +func NewDir(options ...DirOption) (Dir, error) { + dirOptions := newDirOptions() + for _, option := range options { + option(dirOptions) + } + id, err := uuidutil.New() + if err != nil { + return nil, err + } + path, err := os.MkdirTemp(dirOptions.basePath, id.String()) + if err != nil { + return nil, err + } + // just in case + absPath, err := filepath.Abs(filepath.Clean(path)) + if err != nil { + return nil, err + } + signalC, closer := interrupt.NewSignalChannel() + go func() { + <-signalC + _ = os.RemoveAll(absPath) + }() + return newDir(absPath, closer), nil +} + +// DirOption is an option for NewDir. +type DirOption func(*dirOptions) + +// DirWithBasePath returns a new DirOption that sets the base path to create +// the temporary directory in. +// +// The default is to use os.TempDir(). +func DirWithBasePath(basePath string) DirOption { + return func(dirOptions *dirOptions) { + dirOptions.basePath = basePath + } +} + +type file struct { + absPath string + closer func() +} + +func newFile(absPath string, closer func()) *file { + return &file{ + absPath: absPath, + closer: closer, + } +} + +func (f *file) AbsPath() string { + return f.absPath +} + +func (f *file) Close() error { + err := os.Remove(f.absPath) + f.closer() + return err +} + +type dir struct { + absPath string + closer func() +} + +func newDir(absPath string, closer func()) *dir { + return &dir{ + absPath: absPath, + closer: closer, + } +} + +func (d *dir) AbsPath() string { + return d.absPath +} + +func (d *dir) Close() error { + err := os.RemoveAll(d.absPath) + d.closer() + return err +} + +type dirOptions struct { + basePath string +} + +func newDirOptions() *dirOptions { + return &dirOptions{} +} diff --git a/pkg/bufman/pkg/tmp/tmp_test.go b/pkg/bufman/pkg/tmp/tmp_test.go new file mode 100644 index 000000000..1490d227f --- /dev/null +++ b/pkg/bufman/pkg/tmp/tmp_test.go @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tmp + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestFile(t *testing.T) { + t.Parallel() + tmpFile, err := NewFileWithData([]byte("foo")) + require.NoError(t, err) + assert.True(t, filepath.IsAbs(tmpFile.AbsPath())) + data, err := os.ReadFile(tmpFile.AbsPath()) + assert.NoError(t, err) + assert.Equal(t, "foo", string(data)) + assert.NoError(t, tmpFile.Close()) + _, err = os.ReadFile(tmpFile.AbsPath()) + assert.Error(t, err) +} + +func TestDir(t *testing.T) { + t.Parallel() + tmpDir, err := NewDir() + require.NoError(t, err) + assert.True(t, filepath.IsAbs(tmpDir.AbsPath())) + fileInfo, err := os.Lstat(tmpDir.AbsPath()) + assert.NoError(t, err) + assert.True(t, fileInfo.IsDir()) + assert.NoError(t, tmpDir.Close()) + _, err = os.Lstat(tmpDir.AbsPath()) + assert.Error(t, err) +} diff --git a/pkg/bufman/pkg/transport/http/httpclient/client.go b/pkg/bufman/pkg/transport/http/httpclient/client.go new file mode 100644 index 000000000..e1adb3765 --- /dev/null +++ b/pkg/bufman/pkg/transport/http/httpclient/client.go @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpclient + +import ( + "crypto/tls" + "net/http" +) + +func newClient(clientTLSConfig *tls.Config) *http.Client { + return &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: clientTLSConfig, + Proxy: http.ProxyFromEnvironment, + }, + } +} diff --git a/pkg/bufman/pkg/transport/http/httpclient/httpclient.go b/pkg/bufman/pkg/transport/http/httpclient/httpclient.go new file mode 100644 index 000000000..224499556 --- /dev/null +++ b/pkg/bufman/pkg/transport/http/httpclient/httpclient.go @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpclient + +import ( + "crypto/tls" + "net/http" +) + +// NewClient returns a new Client. +func NewClient(clientTLSConfig *tls.Config) *http.Client { + return newClient(clientTLSConfig) +} diff --git a/pkg/bufman/pkg/transport/http/httpserver/httpserver.go b/pkg/bufman/pkg/transport/http/httpserver/httpserver.go new file mode 100644 index 000000000..d136496f3 --- /dev/null +++ b/pkg/bufman/pkg/transport/http/httpserver/httpserver.go @@ -0,0 +1,177 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package httpserver + +import ( + "context" + "crypto/tls" + "net" + "net/http" + "time" + + "github.com/go-chi/chi/v5" + "go.uber.org/zap" + "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" + "golang.org/x/sync/errgroup" +) + +const ( + // DefaultShutdownTimeout is the default shutdown timeout. + DefaultShutdownTimeout = 10 * time.Second + // DefaultReadHeaderTimeout is the default read header timeout. + DefaultReadHeaderTimeout = 30 * time.Second + // DefaultIdleTimeout is the amount of time an HTTP/2 connection can be idle. + DefaultIdleTimeout = 3 * time.Minute +) + +type runner struct { + shutdownTimeout time.Duration + readHeaderTimeout time.Duration + tlsConfig *tls.Config + walkFunc chi.WalkFunc + disableH2C bool +} + +// RunOption is an option for a new Run. +type RunOption func(*runner) + +// RunWithShutdownTimeout returns a new RunOption that uses the given shutdown timeout. +// +// The default is to use DefaultShutdownTimeout. +// If shutdownTimeout is 0, no graceful shutdown will be performed. +func RunWithShutdownTimeout(shutdownTimeout time.Duration) RunOption { + return func(runner *runner) { + runner.shutdownTimeout = shutdownTimeout + } +} + +// RunWithReadHeaderTimeout returns a new RunOption that uses the given read header timeout. +// +// The default is to use DefaultReadHeaderTimeout. +// If readHeaderTimeout is 0, no read header timeout will be used. +func RunWithReadHeaderTimeout(readHeaderTimeout time.Duration) RunOption { + return func(runner *runner) { + runner.readHeaderTimeout = readHeaderTimeout + } +} + +// RunWithTLSConfig returns a new RunOption that uses the given tls.Config. +// +// The default is to use no TLS. +func RunWithTLSConfig(tlsConfig *tls.Config) RunOption { + return func(runner *runner) { + runner.tlsConfig = tlsConfig + } +} + +// RunWithWalkFunc returns a new RunOption that runs chi.Walk to walk the +// handler after all middlewares and routes have been mounted, but before the +// server is started. +// The walkFunc will only be called if the handler passed to Run is a +// chi.Routes. +func RunWithWalkFunc(walkFunc chi.WalkFunc) RunOption { + return func(runner *runner) { + runner.walkFunc = walkFunc + } +} + +// RunWithoutH2C disables use of H2C (used when RunWithTLSConfig is not called). +func RunWithoutH2C() RunOption { + return func(runner *runner) { + runner.disableH2C = true + } +} + +// Run will start a HTTP server listening on the provided listener and +// serving the provided handler. This call is blocking and the run +// is cancelled when the input context is cancelled, the listener is +// closed upon return. +// +// The Run function can be configured further by passing a variety of options. +func Run( + ctx context.Context, + logger *zap.Logger, + listener net.Listener, + handler http.Handler, + options ...RunOption, +) error { + s := &runner{ + shutdownTimeout: DefaultShutdownTimeout, + readHeaderTimeout: DefaultReadHeaderTimeout, + } + for _, option := range options { + option(s) + } + stdLogger, err := zap.NewStdLogAt(logger.Sugar().Named("httpserver"), zap.ErrorLevel) + if err != nil { + return err + } + httpServer := &http.Server{ + Handler: handler, + ReadHeaderTimeout: s.readHeaderTimeout, + ErrorLog: stdLogger, + TLSConfig: s.tlsConfig, + } + if s.tlsConfig == nil && !s.disableH2C { + httpServer.Handler = h2c.NewHandler(handler, &http2.Server{ + IdleTimeout: DefaultIdleTimeout, + }) + } + if s.walkFunc != nil { + routes, ok := handler.(chi.Routes) + if ok { + if err := chi.Walk(routes, s.walkFunc); err != nil { + return err + } + } + } + + eg, ctx := errgroup.WithContext(ctx) + eg.Go(func() error { + return httpServe(httpServer, listener) + }) + eg.Go(func() error { + <-ctx.Done() + start := time.Now() + logger.Sugar().Info("shutdown_starting", zap.Duration("shutdown_timeout", s.shutdownTimeout)) + defer logger.Sugar().Info("shutdown_finished", zap.Duration("duration", time.Since(start))) + if s.shutdownTimeout != 0 { + ctx, cancel := context.WithTimeout(context.Background(), s.shutdownTimeout) + defer cancel() + return httpServer.Shutdown(ctx) + } + return httpServer.Close() + }) + + logger.Sugar().Info( + "starting", + zap.String("address", listener.Addr().String()), + zap.Duration("shutdown_timeout", s.shutdownTimeout), + zap.Bool("tls", s.tlsConfig != nil), + ) + if err := eg.Wait(); err != http.ErrServerClosed { + return err + } + return nil +} + +func httpServe(httpServer *http.Server, listener net.Listener) error { + if httpServer.TLSConfig != nil { + return httpServer.ServeTLS(listener, "", "") + } + return httpServer.Serve(listener) +} diff --git a/pkg/bufman/pkg/uuidutil/uuidutil.go b/pkg/bufman/pkg/uuidutil/uuidutil.go new file mode 100644 index 000000000..a6fcab095 --- /dev/null +++ b/pkg/bufman/pkg/uuidutil/uuidutil.go @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package uuidutil + +import ( + "fmt" + + "github.com/gofrs/uuid/v5" +) + +// New returns a new random UUIDv4. +func New() (uuid.UUID, error) { + id, err := uuid.NewV4() + if err != nil { + return uuid.Nil, err + } + return id, nil +} + +// ToDashless returns the uuid without dashes. +func ToDashless(id uuid.UUID) (string, error) { + s := id.String() + if s[8] != '-' { + return "", fmt.Errorf("expected - at char 9: %q", s) + } + if s[13] != '-' { + return "", fmt.Errorf("expected - at char 14: %q", s) + } + if s[18] != '-' { + return "", fmt.Errorf("expected - at char 19: %q", s) + } + if s[23] != '-' { + return "", fmt.Errorf("expected - at char 24: %q", s) + } + return s[0:8] + s[9:13] + s[14:18] + s[19:23] + s[24:], nil +} + +// FromString returns the uuid from the string. +// +// As opposed to uuid.FromString, this only accepts uuids with dashes. +// Always use this instead of uuid.FromString. +func FromString(s string) (uuid.UUID, error) { + if len(s) != 36 { + return uuid.Nil, fmt.Errorf("expected uuid to be of length 36 but was %d: %s", len(s), s) + } + return uuid.FromString(s) +} + +// FromDashless returns the dashless uuid with dashes. +func FromDashless(dashless string) (uuid.UUID, error) { + if len(dashless) != 32 { + return uuid.Nil, fmt.Errorf("expected dashless uuid to be of length 32 but was %d: %s", len(dashless), dashless) + } + // FromString accepts both dashless and regular, we do this because we need to add our own FromString that does not accept dashless + return FromString(dashless[0:8] + "-" + dashless[8:12] + "-" + dashless[12:16] + "-" + dashless[16:20] + "-" + dashless[20:]) +} + +// Validate determines if the given UUID string is valid. +func Validate(s string) error { + _, err := FromString(s) + return err +} + +// ValidateDashless validates the dashless uuid is valid. +func ValidateDashless(dashless string) error { + _, err := FromDashless(dashless) + return err +} + +// FromStringSlice returns a slice of uuids from the string slice. +// +// This only accepts uuids with dashes. +func FromStringSlice(s []string) ([]uuid.UUID, error) { + var parsedUUIDS []uuid.UUID + for _, stringID := range s { + parsed, err := FromString(stringID) + if err != nil { + return nil, err + } + parsedUUIDS = append(parsedUUIDS, parsed) + } + return parsedUUIDS, nil +} diff --git a/pkg/bufman/pkg/uuidutil/uuidutil_test.go b/pkg/bufman/pkg/uuidutil/uuidutil_test.go new file mode 100644 index 000000000..6de6d5898 --- /dev/null +++ b/pkg/bufman/pkg/uuidutil/uuidutil_test.go @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package uuidutil + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestRoundTrip(t *testing.T) { + t.Parallel() + for i := 0; i < 100; i++ { + id, err := New() + require.NoError(t, err) + dashless, err := ToDashless(id) + require.NoError(t, err) + roundTripID, err := FromDashless(dashless) + require.NoError(t, err) + require.Equal(t, id, roundTripID) + } +} + +func TestFromStringFailsWithDashless(t *testing.T) { + t.Parallel() + id, err := New() + require.NoError(t, err) + dashless, err := ToDashless(id) + require.NoError(t, err) + _, err = FromString(dashless) + require.Error(t, err) +} + +func TestFromDashlessFailsWithUUID(t *testing.T) { + t.Parallel() + id, err := New() + require.NoError(t, err) + _, err = FromDashless(id.String()) + require.Error(t, err) +} + +func TestValidateFailsWithDashless(t *testing.T) { + t.Parallel() + id, err := New() + require.NoError(t, err) + dashless, err := ToDashless(id) + require.NoError(t, err) + err = Validate(dashless) + require.Error(t, err) +} + +func TestValidateDashlessFailsWithUUID(t *testing.T) { + t.Parallel() + id, err := New() + require.NoError(t, err) + err = ValidateDashless(id.String()) + require.Error(t, err) +} + +func TestFromStringSliceFailsWithDashless(t *testing.T) { + t.Parallel() + id1, err := New() + require.NoError(t, err) + id2, err := New() + require.NoError(t, err) + dashless1, err := ToDashless(id1) + require.NoError(t, err) + dashless2, err := ToDashless(id2) + require.NoError(t, err) + dashless := []string{dashless1, dashless2} + _, err = FromStringSlice(dashless) + require.Error(t, err) +} + +func TestFromStringSlice(t *testing.T) { + t.Parallel() + id1, err := New() + require.NoError(t, err) + id2, err := New() + require.NoError(t, err) + ids := []string{id1.String(), id2.String()} + uuids, err := FromStringSlice(ids) + require.NoError(t, err) + require.Equal(t, 2, len(uuids)) + require.Equal(t, id1, uuids[0]) + require.Equal(t, id2, uuids[1]) +} diff --git a/pkg/bufman/pkg/verbose/verbose.go b/pkg/bufman/pkg/verbose/verbose.go new file mode 100644 index 000000000..2aca35734 --- /dev/null +++ b/pkg/bufman/pkg/verbose/verbose.go @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package verbose + +import ( + "fmt" + "io" + "strings" +) + +// NopPrinter is a no-op printer. +// +// This generally aligns with the --verbose flag not being set. +var NopPrinter = nopPrinter{} + +// Printer prints verbose messages. +type Printer interface { + // Printf prints a new verbose message. + // + // Leading and trailing newlines are not respected. + // + // Callers should not rely on the print calls being reliable, i.e. errors to + // a backing Writer will be ignored. + Printf(format string, args ...interface{}) +} + +// NewWritePrinter returns a new Printer using the given Writer. +// +// The trimmed prefix is printed with a : before each line. +// +// This generally aligns with the --verbose flag being set and writer being stderr. +func NewWritePrinter(writer io.Writer, prefix string) Printer { + return newWritePrinter(writer, prefix) +} + +type nopPrinter struct{} + +func (nopPrinter) Printf(string, ...interface{}) {} + +type writePrinter struct { + writer io.Writer + prefix string +} + +func newWritePrinter(writer io.Writer, prefix string) *writePrinter { + prefix = strings.TrimSpace(prefix) + if prefix != "" { + prefix = prefix + ": " + } + return &writePrinter{ + writer: writer, + prefix: prefix, + } +} + +func (w *writePrinter) Printf(format string, args ...interface{}) { + if value := strings.TrimSpace(fmt.Sprintf(format, args...)); value != "" { + // Errors are ignored per the interface spec. + _, _ = w.writer.Write([]byte(w.prefix + value + "\n")) + } +} diff --git a/pkg/bufman/pkg/zaputil/vars.go b/pkg/bufman/pkg/zaputil/vars.go new file mode 100644 index 000000000..f32a4d299 --- /dev/null +++ b/pkg/bufman/pkg/zaputil/vars.go @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package zaputil + +import ( + "go.uber.org/zap/zapcore" +) + +var ( + textEncoderConfig = zapcore.EncoderConfig{ + MessageKey: "M", + LevelKey: "L", + // TimeKey: "T", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.CapitalLevelEncoder, + // EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.StringDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + EncodeName: zapcore.FullNameEncoder, + } + + colortextEncoderConfig = zapcore.EncoderConfig{ + MessageKey: "M", + LevelKey: "L", + // TimeKey: "T", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.CapitalColorLevelEncoder, + // EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.StringDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + EncodeName: zapcore.FullNameEncoder, + } + + jsonEncoderConfig = zapcore.EncoderConfig{ + MessageKey: "message", + LevelKey: "level", + TimeKey: "time", + NameKey: "logger", + CallerKey: "caller", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.LowercaseLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.SecondsDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + EncodeName: zapcore.FullNameEncoder, + } +) diff --git a/pkg/bufman/pkg/zaputil/zaputil.go b/pkg/bufman/pkg/zaputil/zaputil.go new file mode 100644 index 000000000..9f0f58ce5 --- /dev/null +++ b/pkg/bufman/pkg/zaputil/zaputil.go @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package zaputil implements utilities for zap. +package zaputil + +import ( + "io" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// NewLogger returns a new logger.Sugar(). +func NewLogger( + writer io.Writer, + level zapcore.Level, + encoder zapcore.Encoder, +) *zap.Logger { + return zap.New( + zapcore.NewCore( + encoder, + zapcore.Lock(zapcore.AddSync(writer)), + zap.NewAtomicLevelAt(level), + ), + ) +} + +// NewTextEncoder returns a new text Encoder. +func NewTextEncoder() zapcore.Encoder { + return zapcore.NewConsoleEncoder(textEncoderConfig) +} + +// NewColortextEncoder returns a new colortext Encoder. +func NewColortextEncoder() zapcore.Encoder { + return zapcore.NewConsoleEncoder(colortextEncoderConfig) +} + +// NewJSONEncoder returns a new JSON encoder. +func NewJSONEncoder() zapcore.Encoder { + return zapcore.NewJSONEncoder(jsonEncoderConfig) +} From 289d1d872079839070f18ffe2505b5441bb1a59b Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:32:33 +0800 Subject: [PATCH 07/18] add bufman config --- pkg/config/app/dubbo-cp/config.go | 13 ++++++ pkg/config/bufman/config.go | 68 +++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 pkg/config/bufman/config.go diff --git a/pkg/config/app/dubbo-cp/config.go b/pkg/config/app/dubbo-cp/config.go index 51c3e3453..5933a2a91 100644 --- a/pkg/config/app/dubbo-cp/config.go +++ b/pkg/config/app/dubbo-cp/config.go @@ -20,6 +20,7 @@ package dubbo_cp import ( "time" + "github.com/apache/dubbo-kubernetes/pkg/config/bufman" "github.com/apache/dubbo-kubernetes/pkg/config/dds/debounce" "github.com/apache/dubbo-kubernetes/pkg/config/webhook" @@ -37,6 +38,7 @@ import ( type Config struct { Admin admin.Admin `yaml:"admin"` + Bufman bufman.Bufman `yaml:"bufman"` GrpcServer server.ServerConfig `yaml:"grpcServer"` Security security.SecurityConfig `yaml:"security"` KubeConfig kube.KubeConfig `yaml:"kubeConfig"` @@ -101,6 +103,17 @@ var DefaultConfig = func() Config { Address: "127.0.0.1:93030", }, }, + Bufman: bufman.Bufman{ + OpenBufman: false, + Server: bufman.Server{ + ServerHost: "bufman", + HTTPPort: 39080, + GrpcPlainPort: 39091, + GrpcSecurePort: 39092, + PageTokenExpireTime: time.Hour, + PageTokenSecret: "12345678", + }, + }, GrpcServer: server.ServerConfig{ PlainServerPort: 30060, SecureServerPort: 30062, diff --git a/pkg/config/bufman/config.go b/pkg/config/bufman/config.go new file mode 100644 index 000000000..bbd3c8646 --- /dev/null +++ b/pkg/config/bufman/config.go @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bufman + +import ( + "time" +) + +type Bufman struct { + OpenBufman bool `yaml:"open_bufman"` + Server Server `yaml:"server"` + MySQL MySQL `yaml:"mysql"` +} + +func (bufman *Bufman) Sanitize() { +} + +func (bufman *Bufman) Validate() error { + // TODO Validate bufman + return nil +} + +type Server struct { + ServerHost string `yaml:"server_host"` + HTTPPort int `yaml:"port"` + GrpcPlainPort int `yaml:"grpc_plain_port"` + GrpcSecurePort int `yaml:"grpc_secure_port"` + + PageTokenExpireTime time.Duration `yaml:"page_token_expire_time"` + PageTokenSecret string `yaml:"page_token_secret"` +} + +func (s *Server) Sanitize() { +} + +func (s *Server) Validate() error { + // TODO Validate server + return nil +} + +type MySQL struct { + MysqlDsn string `yaml:"mysql_dsn"` + MaxOpenConnections int `yaml:"max_open_connections"` + MaxIdleConnections int `yaml:"max_idle_connections"` + MaxLifeTime time.Duration `yaml:"max_life_time"` + MaxIdleTime time.Duration `yaml:"max_idle_time"` +} + +func (mysql *MySQL) Sanitize() { +} + +func (mysql *MySQL) Validate() error { + // TODO Validate mysql + return nil +} From 4711e7ffe63c3566336995678978b11b5e570894 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:33:45 +0800 Subject: [PATCH 08/18] bufman http and grpc server --- pkg/bufman/bootstrap.go | 78 ++ pkg/bufman/config/config.go | 26 + pkg/bufman/constant/const.go | 75 ++ pkg/bufman/controllers/authn.go | 52 ++ pkg/bufman/controllers/commit.go | 188 +++++ pkg/bufman/controllers/doc.go | 164 +++++ pkg/bufman/controllers/repository.go | 409 +++++++++++ pkg/bufman/controllers/tag.go | 127 ++++ pkg/bufman/controllers/token.go | 131 ++++ pkg/bufman/controllers/user.go | 138 ++++ pkg/bufman/core/parser/document_generator.go | 485 +++++++++++++ pkg/bufman/core/parser/proto_parser.go | 171 +++++ pkg/bufman/core/resolve/resolve.go | 246 +++++++ pkg/bufman/core/security/page_token.go | 84 +++ pkg/bufman/core/security/security.go | 59 ++ pkg/bufman/core/storage/disk_storage.go | 131 ++++ pkg/bufman/core/storage/storage.go | 250 +++++++ pkg/bufman/core/validity/viliditor.go | 196 +++++ pkg/bufman/dal/commits.gen.go | 668 ++++++++++++++++++ pkg/bufman/dal/file_blobs.gen.go | 392 ++++++++++ pkg/bufman/dal/file_manifests.gen.go | 388 ++++++++++ pkg/bufman/dal/gen.go | 151 ++++ pkg/bufman/dal/repositories.gen.go | 606 ++++++++++++++++ pkg/bufman/dal/tags.gen.go | 412 +++++++++++ pkg/bufman/dal/tokens.gen.go | 404 +++++++++++ pkg/bufman/dal/users.gen.go | 416 +++++++++++ pkg/bufman/e/base_error.go | 70 ++ pkg/bufman/e/errors.go | 90 +++ pkg/bufman/gorm_gen/gorm_gen.go | 49 ++ pkg/bufman/handlers/grpc_handlers/authn.go | 45 ++ pkg/bufman/handlers/grpc_handlers/commit.go | 72 ++ pkg/bufman/handlers/grpc_handlers/docs.go | 80 +++ pkg/bufman/handlers/grpc_handlers/download.go | 74 ++ pkg/bufman/handlers/grpc_handlers/push.go | 185 +++++ .../handlers/grpc_handlers/repository.go | 142 ++++ pkg/bufman/handlers/grpc_handlers/resolve.go | 122 ++++ pkg/bufman/handlers/grpc_handlers/tag.go | 57 ++ pkg/bufman/handlers/grpc_handlers/token.go | 70 ++ pkg/bufman/handlers/grpc_handlers/user.go | 72 ++ pkg/bufman/handlers/http_handlers/authn.go | 44 ++ pkg/bufman/handlers/http_handlers/commit.go | 114 +++ pkg/bufman/handlers/http_handlers/common.go | 45 ++ pkg/bufman/handlers/http_handlers/doc.go | 122 ++++ .../handlers/http_handlers/repository.go | 216 ++++++ pkg/bufman/handlers/http_handlers/tag.go | 68 ++ pkg/bufman/handlers/http_handlers/token.go | 104 +++ pkg/bufman/handlers/http_handlers/user.go | 88 +++ pkg/bufman/interceptors/auth.go | 64 ++ pkg/bufman/interceptors/init.go | 30 + pkg/bufman/mapper/commit_mapper.go | 331 +++++++++ pkg/bufman/mapper/file_mapper.go | 41 ++ pkg/bufman/mapper/repository_mapper.go | 159 +++++ pkg/bufman/mapper/tag_mapper.go | 56 ++ pkg/bufman/mapper/token_mapper.go | 62 ++ pkg/bufman/mapper/user_mapper.go | 63 ++ pkg/bufman/model/commit.go | 144 ++++ pkg/bufman/model/file.go | 122 ++++ pkg/bufman/model/init.go | 62 ++ pkg/bufman/model/repository.go | 98 +++ pkg/bufman/model/tag.go | 67 ++ pkg/bufman/model/token.go | 63 ++ pkg/bufman/model/user.go | 70 ++ pkg/bufman/router/grpc_router.go | 159 +++++ pkg/bufman/router/http_router.go | 138 ++++ pkg/bufman/services/authz_service.go | 153 ++++ pkg/bufman/services/commit_service.go | 98 +++ pkg/bufman/services/docs_service.go | 354 ++++++++++ pkg/bufman/services/download_service.go | 80 +++ pkg/bufman/services/push_service.go | 335 +++++++++ pkg/bufman/services/repository_service.go | 219 ++++++ pkg/bufman/services/tag_service.go | 85 +++ pkg/bufman/services/token_service.go | 128 ++++ pkg/bufman/services/user_service.go | 100 +++ pkg/bufman/setup.go | 45 ++ 74 files changed, 11702 insertions(+) create mode 100644 pkg/bufman/bootstrap.go create mode 100644 pkg/bufman/config/config.go create mode 100644 pkg/bufman/constant/const.go create mode 100644 pkg/bufman/controllers/authn.go create mode 100644 pkg/bufman/controllers/commit.go create mode 100644 pkg/bufman/controllers/doc.go create mode 100644 pkg/bufman/controllers/repository.go create mode 100644 pkg/bufman/controllers/tag.go create mode 100644 pkg/bufman/controllers/token.go create mode 100644 pkg/bufman/controllers/user.go create mode 100644 pkg/bufman/core/parser/document_generator.go create mode 100644 pkg/bufman/core/parser/proto_parser.go create mode 100644 pkg/bufman/core/resolve/resolve.go create mode 100644 pkg/bufman/core/security/page_token.go create mode 100644 pkg/bufman/core/security/security.go create mode 100644 pkg/bufman/core/storage/disk_storage.go create mode 100644 pkg/bufman/core/storage/storage.go create mode 100644 pkg/bufman/core/validity/viliditor.go create mode 100644 pkg/bufman/dal/commits.gen.go create mode 100644 pkg/bufman/dal/file_blobs.gen.go create mode 100644 pkg/bufman/dal/file_manifests.gen.go create mode 100644 pkg/bufman/dal/gen.go create mode 100644 pkg/bufman/dal/repositories.gen.go create mode 100644 pkg/bufman/dal/tags.gen.go create mode 100644 pkg/bufman/dal/tokens.gen.go create mode 100644 pkg/bufman/dal/users.gen.go create mode 100644 pkg/bufman/e/base_error.go create mode 100644 pkg/bufman/e/errors.go create mode 100644 pkg/bufman/gorm_gen/gorm_gen.go create mode 100644 pkg/bufman/handlers/grpc_handlers/authn.go create mode 100644 pkg/bufman/handlers/grpc_handlers/commit.go create mode 100644 pkg/bufman/handlers/grpc_handlers/docs.go create mode 100644 pkg/bufman/handlers/grpc_handlers/download.go create mode 100644 pkg/bufman/handlers/grpc_handlers/push.go create mode 100644 pkg/bufman/handlers/grpc_handlers/repository.go create mode 100644 pkg/bufman/handlers/grpc_handlers/resolve.go create mode 100644 pkg/bufman/handlers/grpc_handlers/tag.go create mode 100644 pkg/bufman/handlers/grpc_handlers/token.go create mode 100644 pkg/bufman/handlers/grpc_handlers/user.go create mode 100644 pkg/bufman/handlers/http_handlers/authn.go create mode 100644 pkg/bufman/handlers/http_handlers/commit.go create mode 100644 pkg/bufman/handlers/http_handlers/common.go create mode 100644 pkg/bufman/handlers/http_handlers/doc.go create mode 100644 pkg/bufman/handlers/http_handlers/repository.go create mode 100644 pkg/bufman/handlers/http_handlers/tag.go create mode 100644 pkg/bufman/handlers/http_handlers/token.go create mode 100644 pkg/bufman/handlers/http_handlers/user.go create mode 100644 pkg/bufman/interceptors/auth.go create mode 100644 pkg/bufman/interceptors/init.go create mode 100644 pkg/bufman/mapper/commit_mapper.go create mode 100644 pkg/bufman/mapper/file_mapper.go create mode 100644 pkg/bufman/mapper/repository_mapper.go create mode 100644 pkg/bufman/mapper/tag_mapper.go create mode 100644 pkg/bufman/mapper/token_mapper.go create mode 100644 pkg/bufman/mapper/user_mapper.go create mode 100644 pkg/bufman/model/commit.go create mode 100644 pkg/bufman/model/file.go create mode 100644 pkg/bufman/model/init.go create mode 100644 pkg/bufman/model/repository.go create mode 100644 pkg/bufman/model/tag.go create mode 100644 pkg/bufman/model/token.go create mode 100644 pkg/bufman/model/user.go create mode 100644 pkg/bufman/router/grpc_router.go create mode 100644 pkg/bufman/router/http_router.go create mode 100644 pkg/bufman/services/authz_service.go create mode 100644 pkg/bufman/services/commit_service.go create mode 100644 pkg/bufman/services/docs_service.go create mode 100644 pkg/bufman/services/download_service.go create mode 100644 pkg/bufman/services/push_service.go create mode 100644 pkg/bufman/services/repository_service.go create mode 100644 pkg/bufman/services/tag_service.go create mode 100644 pkg/bufman/services/token_service.go create mode 100644 pkg/bufman/services/user_service.go create mode 100644 pkg/bufman/setup.go diff --git a/pkg/bufman/bootstrap.go b/pkg/bufman/bootstrap.go new file mode 100644 index 000000000..31b6a7d6c --- /dev/null +++ b/pkg/bufman/bootstrap.go @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package bufman + +import ( + "gorm.io/driver/mysql" + "gorm.io/driver/sqlite" + "gorm.io/gorm" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/config" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + core_runtime "github.com/apache/dubbo-kubernetes/pkg/core/runtime" + + _ "github.com/apache/dubbo-kubernetes/pkg/admin/cache/registry/kube" + _ "github.com/apache/dubbo-kubernetes/pkg/admin/cache/registry/universal" +) + +func InitConfig(rt core_runtime.Runtime) error { + config.Properties = &rt.Config().Bufman + + return nil +} + +func RegisterDatabase(rt core_runtime.Runtime) error { + dsn := rt.Config().Bufman.MySQL.MysqlDsn + var db *gorm.DB + var err error + if dsn == "" { + db, err = gorm.Open(sqlite.Open(":memory:"), &gorm.Config{}) + } else { + db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{}) + } + if err != nil { + return err + } else { + config.DataBase = db + // init table + initErr := db.AutoMigrate( + &model.Repository{}, + &model.Commit{}, + &model.Tag{}, + &model.User{}, + &model.Token{}, + &model.FileManifest{}, + &model.FileBlob{}, + ) + if initErr != nil { + return initErr + } + } + + rawDB, err := config.DataBase.DB() + if err != nil { + return err + } + + rawDB.SetMaxOpenConns(config.Properties.MySQL.MaxOpenConnections) + rawDB.SetMaxIdleConns(config.Properties.MySQL.MaxIdleConnections) + rawDB.SetConnMaxLifetime(config.Properties.MySQL.MaxLifeTime) + rawDB.SetConnMaxIdleTime(config.Properties.MySQL.MaxIdleTime) + + return nil +} diff --git a/pkg/bufman/config/config.go b/pkg/bufman/config/config.go new file mode 100644 index 000000000..0c3377458 --- /dev/null +++ b/pkg/bufman/config/config.go @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config + +import ( + "github.com/apache/dubbo-kubernetes/pkg/config/bufman" + "gorm.io/gorm" +) + +var ( + Properties *bufman.Bufman + DataBase *gorm.DB +) diff --git a/pkg/bufman/constant/const.go b/pkg/bufman/constant/const.go new file mode 100644 index 000000000..2a630b69a --- /dev/null +++ b/pkg/bufman/constant/const.go @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package constant + +/* +!! Warning +!! Warning +!! Warning +!! Warning + +Constant can not be changed!!! +*/ + +const ( + AuthHeader = "Authorization" + AuthPrefix = "Bearer" + TokenLength = 16 + CommitLength = 32 + UserIDKey = "user_id" + DefaultBranch = "main" +) + +const ( + FileSavaDir = "blobs" +) + +const ( + MinUserNameLength = 1 + MaxUserNameLength = 200 + UserNamePattern = "^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9]$" + + MinPasswordLength = 6 + MaxPasswordLength = 50 + PasswordPattern = "[a-zA-Z0-9~!@&%#_]" + + MinRepositoryNameLength = 1 + MaxRepositoryNameLength = 200 + RepositoryNamePattern = "^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9]$" + + MinDraftLength = 1 + MaxDraftLength = 20 + DraftPattern = "^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9]$" + + MinTagLength = 1 + MaxTagLength = 20 + TagPattern = "^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9]$" + + MinPluginLength = 1 + MaxPluginLength = 200 + PluginNamePattern = "^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9]$" + + MinPageSize = 1 + MaxPageSize = 50 + + MinDockerRepoNameLength = 1 + MaxDockerRepoNameLength = 200 + DockerRepoNamePattern = "^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9]$" + + MinQueryLength = 1 + MaxQueryLength = 200 + QueryPattern = ".*" +) diff --git a/pkg/bufman/controllers/authn.go b/pkg/bufman/controllers/authn.go new file mode 100644 index 000000000..71f203e43 --- /dev/null +++ b/pkg/bufman/controllers/authn.go @@ -0,0 +1,52 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type AuthnController struct { + userService services.UserService +} + +func NewAuthnController() *AuthnController { + return &AuthnController{ + userService: services.NewUserService(), + } +} + +func (controller *AuthnController) GetCurrentUser(ctx context.Context, _ *registryv1alpha1.GetCurrentUserRequest) (*registryv1alpha1.GetCurrentUserResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // get user by id + user, err := controller.userService.GetUser(ctx, userID) + if err != nil { + logger.Sugar().Errorf("Error Get User: %v\n", err.Error()) + return nil, err + } + + resp := ®istryv1alpha1.GetCurrentUserResponse{ + User: user.ToProtoUser(), + } + return resp, nil +} diff --git a/pkg/bufman/controllers/commit.go b/pkg/bufman/controllers/commit.go new file mode 100644 index 000000000..06cdffab4 --- /dev/null +++ b/pkg/bufman/controllers/commit.go @@ -0,0 +1,188 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type CommitController struct { + commitService services.CommitService + authorizationService services.AuthorizationService + validator validity.Validator +} + +func NewCommitController() *CommitController { + return &CommitController{ + commitService: services.NewCommitService(), + authorizationService: services.NewAuthorizationService(), + validator: validity.NewValidator(), + } +} + +func (controller *CommitController) ListRepositoryCommitsByReference(ctx context.Context, req *registryv1alpha1.ListRepositoryCommitsByReferenceRequest) (*registryv1alpha1.ListRepositoryCommitsByReferenceResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Sugar().Errorf("Error Check Args: %v\n", argErr.Error()) + return nil, argErr + } + + // 尝试获取user ID + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + repository, permissionErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetRepositoryOwner(), req.GetRepositoryName()) + if permissionErr != nil { + logger.Sugar().Errorf("Error Check Permission: %v\n", permissionErr.Error()) + return nil, permissionErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Sugar().Errorf("Error Parse Page Token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + // 查询 + commits, respErr := controller.commitService.ListRepositoryCommitsByReference(ctx, repository.RepositoryID, req.GetReference(), pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if respErr != nil { + logger.Sugar().Errorf("Error list repository commits: %v\n", respErr.Error()) + return nil, respErr + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(commits)) + if err != nil { + logger.Sugar().Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.ListRepositoryCommitsByReferenceResponse{ + RepositoryCommits: commits.ToProtoRepositoryCommits(), + NextPageToken: nextPageToken, + } + return resp, nil +} + +func (controller *CommitController) GetRepositoryCommitByReference(ctx context.Context, req *registryv1alpha1.GetRepositoryCommitByReferenceRequest) (*registryv1alpha1.GetRepositoryCommitByReferenceResponse, e.ResponseError) { + // 尝试获取user ID + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + repository, permissionErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetRepositoryOwner(), req.GetRepositoryName()) + if permissionErr != nil { + logger.Sugar().Errorf("Error Check Permission: %v\n", permissionErr.Error()) + return nil, permissionErr + } + + // 查询 + commit, respErr := controller.commitService.GetRepositoryCommitByReference(ctx, repository.RepositoryID, req.GetReference()) + if respErr != nil { + logger.Sugar().Errorf("Error list repository commits: %v\n", respErr.Error()) + return nil, respErr + } + + resp := ®istryv1alpha1.GetRepositoryCommitByReferenceResponse{ + RepositoryCommit: commit.ToProtoRepositoryCommit(), + } + return resp, nil +} + +func (controller *CommitController) ListRepositoryDraftCommits(ctx context.Context, req *registryv1alpha1.ListRepositoryDraftCommitsRequest) (*registryv1alpha1.ListRepositoryDraftCommitsResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Sugar().Errorf("Error Check Args: %v\n", argErr.Error()) + return nil, argErr + } + + // 尝试获取user ID + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + repository, permissionErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetRepositoryOwner(), req.GetRepositoryName()) + if permissionErr != nil { + logger.Sugar().Errorf("Error Check Permission: %v\n", permissionErr.Error()) + return nil, permissionErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Sugar().Errorf("Error Parse Page Token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + // 查询 + commits, respErr := controller.commitService.ListRepositoryDraftCommits(ctx, repository.RepositoryID, pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if respErr != nil { + logger.Sugar().Errorf("Error list repository draft commits: %v\n", respErr.Error()) + return nil, respErr + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(commits)) + if err != nil { + logger.Sugar().Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.ListRepositoryDraftCommitsResponse{ + RepositoryCommits: commits.ToProtoRepositoryCommits(), + NextPageToken: nextPageToken, + } + return resp, nil +} + +func (controller *CommitController) DeleteRepositoryDraftCommit(ctx context.Context, req *registryv1alpha1.DeleteRepositoryDraftCommitRequest) (*registryv1alpha1.DeleteRepositoryDraftCommitResponse, e.ResponseError) { + // 获取user ID + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + repository, permissionErr := controller.authorizationService.CheckRepositoryCanEdit(userID, req.GetRepositoryOwner(), req.GetRepositoryName()) + if permissionErr != nil { + logger.Sugar().Errorf("Error Check Permission: %v\n", permissionErr.Error()) + return nil, permissionErr + } + + // 删除 + err := controller.commitService.DeleteRepositoryDraftCommit(ctx, repository.RepositoryID, req.GetDraftName()) + if err != nil { + logger.Sugar().Errorf("Error delete repository draft commits: %v\n", err.Error()) + return nil, err + } + + resp := ®istryv1alpha1.DeleteRepositoryDraftCommitResponse{} + return resp, nil +} diff --git a/pkg/bufman/controllers/doc.go b/pkg/bufman/controllers/doc.go new file mode 100644 index 000000000..bb03cb7d7 --- /dev/null +++ b/pkg/bufman/controllers/doc.go @@ -0,0 +1,164 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type DocController struct { + docsService services.DocsService + authorizationService services.AuthorizationService + validator validity.Validator +} + +func NewDocController() *DocController { + return &DocController{ + docsService: services.NewDocsService(), + authorizationService: services.NewAuthorizationService(), + validator: validity.NewValidator(), + } +} + +func (controller *DocController) GetSourceDirectoryInfo(ctx context.Context, req *registryv1alpha1.GetSourceDirectoryInfoRequest) (*registryv1alpha1.GetSourceDirectoryInfoResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 检查用户权限 + repository, checkErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetOwner(), req.GetRepository()) + if checkErr != nil { + logger.Sugar().Errorf("Error Check: %v\n", checkErr.Error()) + + return nil, checkErr + } + + // 获取目录结构信息 + directoryInfo, respErr := controller.docsService.GetSourceDirectoryInfo(ctx, repository.RepositoryID, req.GetReference()) + if respErr != nil { + logger.Sugar().Errorf("Error get source dir info: %v\n", respErr.Error()) + + return nil, respErr + } + + resp := ®istryv1alpha1.GetSourceDirectoryInfoResponse{ + Root: directoryInfo.ToProtoFileInfo(), + } + return resp, nil +} + +func (controller *DocController) GetSourceFile(ctx context.Context, req *registryv1alpha1.GetSourceFileRequest) (*registryv1alpha1.GetSourceFileResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 检查用户权限 + repository, checkErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetOwner(), req.GetRepository()) + if checkErr != nil { + logger.Sugar().Errorf("Error Check: %v\n", checkErr.Error()) + + return nil, checkErr + } + + // 获取源码内容 + content, respErr := controller.docsService.GetSourceFile(ctx, repository.RepositoryID, req.GetReference(), req.GetPath()) + if respErr != nil { + logger.Sugar().Errorf("Error get source file: %v\n", respErr.Error()) + + return nil, respErr + } + + resp := ®istryv1alpha1.GetSourceFileResponse{ + Content: content, + } + return resp, nil +} + +func (controller *DocController) GetModulePackages(ctx context.Context, req *registryv1alpha1.GetModulePackagesRequest) (*registryv1alpha1.GetModulePackagesResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 检查用户权限 + repository, checkErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetOwner(), req.GetRepository()) + if checkErr != nil { + logger.Sugar().Errorf("Error Check: %v\n", checkErr.Error()) + + return nil, checkErr + } + + modulePackages, respErr := controller.docsService.GetModulePackages(ctx, repository.RepositoryID, req.GetReference()) + if respErr != nil { + logger.Sugar().Errorf("Error get module packages: %v\n", respErr.Error()) + + return nil, respErr + } + + resp := ®istryv1alpha1.GetModulePackagesResponse{ + Name: req.GetRepository(), + ModulePackages: modulePackages, + } + return resp, nil +} + +func (controller *DocController) GetModuleDocumentation(ctx context.Context, req *registryv1alpha1.GetModuleDocumentationRequest) (*registryv1alpha1.GetModuleDocumentationResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 检查用户权限 + repository, checkErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetOwner(), req.GetRepository()) + if checkErr != nil { + logger.Sugar().Errorf("Error Check: %v\n", checkErr.Error()) + + return nil, checkErr + } + + moduleDocumentation, respErr := controller.docsService.GetModuleDocumentation(ctx, repository.RepositoryID, req.GetReference()) + if respErr != nil { + logger.Sugar().Errorf("Error get module doc: %v\n", respErr.Error()) + + return nil, respErr + } + + resp := ®istryv1alpha1.GetModuleDocumentationResponse{ + ModuleDocumentation: moduleDocumentation, + } + return resp, nil +} + +func (controller *DocController) GetPackageDocumentation(ctx context.Context, req *registryv1alpha1.GetPackageDocumentationRequest) (*registryv1alpha1.GetPackageDocumentationResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 检查用户权限 + repository, checkErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetOwner(), req.GetRepository()) + if checkErr != nil { + logger.Sugar().Errorf("Error Check: %v\n", checkErr.Error()) + + return nil, checkErr + } + + packageDocumentation, respErr := controller.docsService.GetPackageDocumentation(ctx, repository.RepositoryID, req.GetReference(), req.GetPackageName()) + if respErr != nil { + logger.Sugar().Errorf("Error get package doc: %v\n", respErr.Error()) + + return nil, respErr + } + + resp := ®istryv1alpha1.GetPackageDocumentationResponse{ + PackageDocumentation: packageDocumentation, + } + return resp, nil +} diff --git a/pkg/bufman/controllers/repository.go b/pkg/bufman/controllers/repository.go new file mode 100644 index 000000000..5990cee72 --- /dev/null +++ b/pkg/bufman/controllers/repository.go @@ -0,0 +1,409 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type RepositoryController struct { + repositoryService services.RepositoryService + authorizationService services.AuthorizationService + validator validity.Validator +} + +func NewRepositoryController() *RepositoryController { + return &RepositoryController{ + repositoryService: services.NewRepositoryService(), + authorizationService: services.NewAuthorizationService(), + validator: validity.NewValidator(), + } +} + +func (controller *RepositoryController) GetRepository(ctx context.Context, req *registryv1alpha1.GetRepositoryRequest) (*registryv1alpha1.GetRepositoryResponse, e.ResponseError) { + // 查询 + repository, err := controller.repositoryService.GetRepository(ctx, req.GetId()) + if err != nil { + logger.Sugar().Errorf("Error get repo: %v\n", err.Error()) + + return nil, err + } + + repositoryCounts, err := controller.repositoryService.GetRepositoryCounts(ctx, repository.RepositoryID) + if err != nil { + logger.Sugar().Errorf("Error get repo counts: %v\n", err.Error()) + + return nil, err + } + + // 查询成功 + resp := ®istryv1alpha1.GetRepositoryResponse{ + Repository: repository.ToProtoRepository(), + Counts: repositoryCounts.ToProtoRepositoryCounts(), + } + return resp, nil +} + +func (controller *RepositoryController) GetRepositoryByFullName(ctx context.Context, req *registryv1alpha1.GetRepositoryByFullNameRequest) (*registryv1alpha1.GetRepositoryByFullNameResponse, e.ResponseError) { + // 验证参数 + userName, repositoryName, argErr := controller.validator.SplitFullName(req.GetFullName()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 查询 + repository, err := controller.repositoryService.GetRepositoryByUserNameAndRepositoryName(ctx, userName, repositoryName) + if err != nil { + logger.Sugar().Errorf("Error get repo: %v\n", err.Error()) + + return nil, err + } + + repositoryCounts, err := controller.repositoryService.GetRepositoryCounts(ctx, repository.RepositoryID) + if err != nil { + logger.Sugar().Errorf("Error get repo counts: %v\n", err.Error()) + + return nil, err + } + + // 查询成功 + resp := ®istryv1alpha1.GetRepositoryByFullNameResponse{ + Repository: repository.ToProtoRepository(), + Counts: repositoryCounts.ToProtoRepositoryCounts(), + } + return resp, nil +} + +func (controller *RepositoryController) ListRepositories(ctx context.Context, req *registryv1alpha1.ListRepositoriesRequest) (*registryv1alpha1.ListRepositoriesResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Sugar().Errorf("Error parse page token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + repositories, listErr := controller.repositoryService.ListRepositories(ctx, pageTokenChaim.PageOffset, int(req.GetPageSize()), req.Reverse) + if listErr != nil { + logger.Sugar().Errorf("Error list repos: %v\n", listErr.Error()) + + return nil, listErr + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(repositories)) + if err != nil { + logger.Sugar().Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.ListRepositoriesResponse{ + Repositories: repositories.ToProtoRepositories(), + NextPageToken: nextPageToken, + } + return resp, nil +} + +func (controller *RepositoryController) ListUserRepositories(ctx context.Context, req *registryv1alpha1.ListUserRepositoriesRequest) (*registryv1alpha1.ListUserRepositoriesResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Sugar().Errorf("Error parse page token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + repositories, listErr := controller.repositoryService.ListUserRepositories(ctx, req.GetUserId(), pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if err != nil { + logger.Sugar().Errorf("Error list user repos: %v\n", listErr.Error()) + + return nil, listErr + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(repositories)) + if err != nil { + logger.Sugar().Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.ListUserRepositoriesResponse{ + Repositories: repositories.ToProtoRepositories(), + NextPageToken: nextPageToken, + } + return resp, nil +} + +func (controller *RepositoryController) ListRepositoriesUserCanAccess(ctx context.Context, req *registryv1alpha1.ListRepositoriesUserCanAccessRequest) (*registryv1alpha1.ListRepositoriesUserCanAccessResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Sugar().Errorf("Error parse page token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + userID, _ := ctx.Value(constant.UserIDKey).(string) + repositories, ListErr := controller.repositoryService.ListRepositoriesUserCanAccess(ctx, userID, pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if err != nil { + logger.Sugar().Errorf("Error list repos user can access: %v\n", ListErr.Error()) + + return nil, ListErr + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(repositories)) + if err != nil { + logger.Sugar().Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.ListRepositoriesUserCanAccessResponse{ + Repositories: repositories.ToProtoRepositories(), + NextPageToken: nextPageToken, + } + return resp, nil +} + +func (controller *RepositoryController) CreateRepositoryByFullName(ctx context.Context, req *registryv1alpha1.CreateRepositoryByFullNameRequest) (*registryv1alpha1.CreateRepositoryByFullNameResponse, e.ResponseError) { + // 验证参数 + userName, repositoryName, argErr := controller.validator.SplitFullName(req.GetFullName()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v", argErr.Error()) + + return nil, argErr + } + argErr = controller.validator.CheckRepositoryName(repositoryName) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v", argErr.Error()) + + return nil, argErr + } + + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 创建 + repository, err := controller.repositoryService.CreateRepositoryByUserNameAndRepositoryName(ctx, userID, userName, repositoryName, req.GetVisibility()) + if err != nil { + logger.Sugar().Errorf("Error create repo: %v", err.Error()) + + return nil, err + } + + // 成功 + resp := ®istryv1alpha1.CreateRepositoryByFullNameResponse{ + Repository: repository.ToProtoRepository(), + } + return resp, nil +} + +func (controller *RepositoryController) DeleteRepository(ctx context.Context, req *registryv1alpha1.DeleteRepositoryRequest) (*registryv1alpha1.DeleteRepositoryResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + _, permissionErr := controller.authorizationService.CheckRepositoryCanDeleteByID(userID, req.GetId()) + if permissionErr != nil { + logger.Sugar().Errorf("Error check permission: %v", permissionErr.Error()) + + return nil, permissionErr + } + + // 查询repository,检查是否可以删除 + err := controller.repositoryService.DeleteRepository(ctx, req.GetId()) + if err != nil { + logger.Sugar().Errorf("Error delete repo: %v", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.DeleteRepositoryResponse{} + return resp, nil +} + +func (controller *RepositoryController) DeleteRepositoryByFullName(ctx context.Context, req *registryv1alpha1.DeleteRepositoryByFullNameRequest) (*registryv1alpha1.DeleteRepositoryByFullNameResponse, e.ResponseError) { + // 验证参数 + userName, repositoryName, argErr := controller.validator.SplitFullName(req.GetFullName()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + _, permissionErr := controller.authorizationService.CheckRepositoryCanDelete(userID, userName, repositoryName) + if permissionErr != nil { + logger.Sugar().Errorf("Error check permission: %v", permissionErr.Error()) + + return nil, permissionErr + } + + // 删除 + err := controller.repositoryService.DeleteRepositoryByUserNameAndRepositoryName(ctx, userName, repositoryName) + if err != nil { + logger.Sugar().Errorf("Error delete repo: %v", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.DeleteRepositoryByFullNameResponse{} + return resp, nil +} + +func (controller *RepositoryController) DeprecateRepositoryByName(ctx context.Context, req *registryv1alpha1.DeprecateRepositoryByNameRequest) (*registryv1alpha1.DeprecateRepositoryByNameResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + _, permissionErr := controller.authorizationService.CheckRepositoryCanEdit(userID, req.GetOwnerName(), req.GetRepositoryName()) + if permissionErr != nil { + logger.Sugar().Errorf("Error check permission: %v", permissionErr.Error()) + + return nil, permissionErr + } + + // 修改数据库 + updatedRepository, err := controller.repositoryService.DeprecateRepositoryByName(ctx, req.GetOwnerName(), req.GetRepositoryName(), req.GetDeprecationMessage()) + if err != nil { + logger.Sugar().Errorf("Error deprecate repo: %v", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.DeprecateRepositoryByNameResponse{ + Repository: updatedRepository.ToProtoRepository(), + } + return resp, nil +} + +func (controller *RepositoryController) UndeprecateRepositoryByName(ctx context.Context, req *registryv1alpha1.UndeprecateRepositoryByNameRequest) (*registryv1alpha1.UndeprecateRepositoryByNameResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + _, permissionErr := controller.authorizationService.CheckRepositoryCanEdit(userID, req.GetOwnerName(), req.GetRepositoryName()) + if permissionErr != nil { + logger.Sugar().Errorf("Error check permission: %v", permissionErr.Error()) + + return nil, permissionErr + } + + // 修改数据库 + updatedRepository, err := controller.repositoryService.UndeprecateRepositoryByName(ctx, req.GetOwnerName(), req.GetRepositoryName()) + if err != nil { + logger.Sugar().Errorf("Error undeprecate repo: %v", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.UndeprecateRepositoryByNameResponse{ + Repository: updatedRepository.ToProtoRepository(), + } + return resp, nil +} + +func (controller *RepositoryController) UpdateRepositorySettingsByName(ctx context.Context, req *registryv1alpha1.UpdateRepositorySettingsByNameRequest) (*registryv1alpha1.UpdateRepositorySettingsByNameResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + _, permissionErr := controller.authorizationService.CheckRepositoryCanEdit(userID, req.GetOwnerName(), req.GetRepositoryName()) + if permissionErr != nil { + logger.Sugar().Errorf("Error check permission: %v", permissionErr.Error()) + + return nil, permissionErr + } + + // 修改数据库 + err := controller.repositoryService.UpdateRepositorySettingsByName(ctx, req.GetOwnerName(), req.GetRepositoryName(), req.GetVisibility(), req.GetDescription()) + if err != nil { + logger.Sugar().Errorf("Error update repo settings: %v", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.UpdateRepositorySettingsByNameResponse{} + return resp, nil +} + +func (controller *RepositoryController) GetRepositoriesByFullName(ctx context.Context, req *registryv1alpha1.GetRepositoriesByFullNameRequest) (*registryv1alpha1.GetRepositoriesByFullNameResponse, e.ResponseError) { + retRepos := make([]*registryv1alpha1.Repository, 0, len(req.FullNames)) + for _, fullName := range req.GetFullNames() { + // 验证参数 + userName, repositoryName, argErr := controller.validator.SplitFullName(fullName) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 查询 + repository, err := controller.repositoryService.GetRepositoryByUserNameAndRepositoryName(ctx, userName, repositoryName) + if err != nil { + logger.Sugar().Errorf("Error get repo: %v\n", err.Error()) + + return nil, err + } + retRepos = append(retRepos, repository.ToProtoRepository()) + } + + resp := ®istryv1alpha1.GetRepositoriesByFullNameResponse{ + Repositories: retRepos, + } + + return resp, nil +} diff --git a/pkg/bufman/controllers/tag.go b/pkg/bufman/controllers/tag.go new file mode 100644 index 000000000..9373b33fb --- /dev/null +++ b/pkg/bufman/controllers/tag.go @@ -0,0 +1,127 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type TagController struct { + tagService services.TagService + authorizationService services.AuthorizationService + validator validity.Validator +} + +func NewTagController() *TagController { + return &TagController{ + tagService: services.NewTagService(), + authorizationService: services.NewAuthorizationService(), + validator: validity.NewValidator(), + } +} + +func (controller *TagController) CreateRepositoryTag(ctx context.Context, req *registryv1alpha1.CreateRepositoryTagRequest) (*registryv1alpha1.CreateRepositoryTagResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckTagName(req.GetName()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 获取用户ID + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + _, permissionErr := controller.authorizationService.CheckRepositoryCanEditByID(userID, req.GetRepositoryId()) + if permissionErr != nil { + logger.Sugar().Errorf("Error check permission: %v", permissionErr.Error()) + + return nil, permissionErr + } + + tag, err := controller.tagService.CreateRepositoryTag(ctx, req.GetRepositoryId(), req.GetName(), req.GetCommitName()) + if err != nil { + logger.Sugar().Errorf("Error create tag: %v", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.CreateRepositoryTagResponse{ + RepositoryTag: tag.ToProtoRepositoryTag(), + } + return resp, nil +} + +func (controller *TagController) ListRepositoryTags(ctx context.Context, req *registryv1alpha1.ListRepositoryTagsRequest) (*registryv1alpha1.ListRepositoryTagsResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Sugar().Errorf("Error parse page token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + // 尝试获取user ID + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证用户权限 + _, permissionErr := controller.authorizationService.CheckRepositoryCanAccessByID(userID, req.GetRepositoryId()) + if permissionErr != nil { + logger.Sugar().Errorf("Error check permission: %v", permissionErr.Error()) + + return nil, permissionErr + } + + tags, respErr := controller.tagService.ListRepositoryTags(ctx, req.GetRepositoryId(), pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if respErr != nil { + logger.Sugar().Errorf("Error list repo tags: %v", respErr.Error()) + + return nil, respErr + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(tags)) + if err != nil { + logger.Sugar().Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.ListRepositoryTagsResponse{ + RepositoryTags: tags.ToProtoRepositoryTags(), + NextPageToken: nextPageToken, + } + return resp, nil +} diff --git a/pkg/bufman/controllers/token.go b/pkg/bufman/controllers/token.go new file mode 100644 index 000000000..23e152095 --- /dev/null +++ b/pkg/bufman/controllers/token.go @@ -0,0 +1,131 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type TokenController struct { + tokenService services.TokenService + validator validity.Validator +} + +func NewTokenController() *TokenController { + return &TokenController{ + tokenService: services.NewTokenService(), + validator: validity.NewValidator(), + } +} + +func (controller *TokenController) CreateToken(ctx context.Context, req *registryv1alpha1.CreateTokenRequest) (*registryv1alpha1.CreateTokenResponse, e.ResponseError) { + token, err := controller.tokenService.CreateToken(ctx, req.GetUsername(), req.GetPassword(), req.GetExpireTime().AsTime(), req.GetNote()) + if err != nil { + logger.Sugar().Errorf("Error create token: %v\n", err.Error()) + + return nil, err + } + + // success + resp := ®istryv1alpha1.CreateTokenResponse{ + Token: token.TokenName, + } + return resp, nil +} + +func (controller *TokenController) GetToken(ctx context.Context, req *registryv1alpha1.GetTokenRequest) (*registryv1alpha1.GetTokenResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 查询token + token, err := controller.tokenService.GetToken(ctx, userID, req.GetTokenId()) + if err != nil { + logger.Sugar().Errorf("Error get token: %v\n", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.GetTokenResponse{ + Token: token.ToProtoToken(), + } + return resp, nil +} + +func (controller *TokenController) ListTokens(ctx context.Context, req *registryv1alpha1.ListTokensRequest) (*registryv1alpha1.ListTokensResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Sugar().Errorf("Error parse page token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 查询token + tokens, listErr := controller.tokenService.ListTokens(ctx, userID, pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if err != nil { + logger.Sugar().Errorf("Error list tokens: %v\n", listErr.Error()) + + return nil, listErr + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(tokens)) + if err != nil { + logger.Sugar().Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.ListTokensResponse{ + Tokens: tokens.ToProtoTokens(), + NextPageToken: nextPageToken, + } + return resp, nil +} + +func (controller *TokenController) DeleteToken(ctx context.Context, req *registryv1alpha1.DeleteTokenRequest) (*registryv1alpha1.DeleteTokenResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 删除token + err := controller.tokenService.DeleteToken(ctx, userID, req.GetTokenId()) + if err != nil { + logger.Sugar().Errorf("Error delete token: %v\n", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.DeleteTokenResponse{} + return resp, nil +} diff --git a/pkg/bufman/controllers/user.go b/pkg/bufman/controllers/user.go new file mode 100644 index 000000000..c0ac4b009 --- /dev/null +++ b/pkg/bufman/controllers/user.go @@ -0,0 +1,138 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type UserController struct { + userService services.UserService + validator validity.Validator +} + +func NewUserController() *UserController { + return &UserController{ + userService: services.NewUserService(), + validator: validity.NewValidator(), + } +} + +func (controller *UserController) CreateUser(ctx context.Context, req *registryv1alpha1.CreateUserRequest) (*registryv1alpha1.CreateUserResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckUserName(req.GetUsername()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + argErr = controller.validator.CheckPassword(req.GetPassword()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + user, err := controller.userService.CreateUser(ctx, req.GetUsername(), req.GetPassword()) // 创建用户 + if err != nil { + logger.Sugar().Errorf("Error create user: %v\n", err.Error()) + + return nil, err + } + + // success + resp := ®istryv1alpha1.CreateUserResponse{ + User: user.ToProtoUser(), + } + return resp, nil +} + +func (controller *UserController) GetUser(ctx context.Context, req *registryv1alpha1.GetUserRequest) (*registryv1alpha1.GetUserResponse, e.ResponseError) { + user, err := controller.userService.GetUser(ctx, req.GetId()) // 创建用户 + if err != nil { + logger.Sugar().Errorf("Error get user: %v\n", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.GetUserResponse{ + User: user.ToProtoUser(), + } + return resp, nil +} + +func (controller *UserController) GetUserByUsername(ctx context.Context, req *registryv1alpha1.GetUserByUsernameRequest) (*registryv1alpha1.GetUserByUsernameResponse, e.ResponseError) { + user, err := controller.userService.GetUserByUsername(ctx, req.GetUsername()) // 创建用户 + if err != nil { + logger.Sugar().Errorf("Error get user: %v\n", err.Error()) + + return nil, err + } + + resp := ®istryv1alpha1.GetUserByUsernameResponse{ + User: user.ToProtoUser(), + } + return resp, nil +} + +func (controller *UserController) ListUsers(ctx context.Context, req *registryv1alpha1.ListUsersRequest) (*registryv1alpha1.ListUsersResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Sugar().Errorf("Error parse page token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + users, ListErr := controller.userService.ListUsers(ctx, pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) // 创建用户 + if err != nil { + logger.Sugar().Errorf("Error list users: %v\n", ListErr.Error()) + + return nil, ListErr + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(users)) + if err != nil { + logger.Sugar().Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.ListUsersResponse{ + Users: users.ToProtoUsers(), + NextPageToken: nextPageToken, + } + + return resp, nil +} diff --git a/pkg/bufman/core/parser/document_generator.go b/pkg/bufman/core/parser/document_generator.go new file mode 100644 index 000000000..19c94e8ad --- /dev/null +++ b/pkg/bufman/core/parser/document_generator.go @@ -0,0 +1,485 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package parser + +import ( + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/bufbuild/protocompile/linker" + "github.com/bufbuild/protocompile/protoutil" + "github.com/bufbuild/protocompile/walk" + "google.golang.org/protobuf/reflect/protoreflect" +) + +type DocumentGenerator interface { + GetModulePackages() []string + GenerateDocument(packageName string) *registryv1alpha1.PackageDocumentation +} + +type documentGeneratorImpl struct { + modulePackageSet map[string]struct{} + commitName string // 当前的commitName,用于判断是否是外部依赖 + packageLinkerMap map[string]linker.Files + linkers linker.Files + packageLinkers linker.Files + parserAccessorHandler bufmoduleprotocompile.ParserAccessorHandler + messageSet map[string]*registryv1alpha1.Message +} + +func NewDocumentGenerator(commitName string, linkers linker.Files, parserAccessorHandler bufmoduleprotocompile.ParserAccessorHandler) DocumentGenerator { + g := &documentGeneratorImpl{ + commitName: commitName, + linkers: linkers, + parserAccessorHandler: parserAccessorHandler, + packageLinkerMap: map[string]linker.Files{}, + messageSet: map[string]*registryv1alpha1.Message{}, + } + + // 生成module packages Set + packagesSet := map[string]struct{}{} + for _, link := range linkers { + packagesSet[string(link.Package())] = struct{}{} + } + g.modulePackageSet = packagesSet + + return g +} + +// isDependency 判断是否是外部依赖 +func (g *documentGeneratorImpl) isDependency(fileDescriptor protoreflect.FileDescriptor) bool { + return g.parserAccessorHandler.Commit(fileDescriptor.Path()) != g.commitName +} + +func (g *documentGeneratorImpl) toProtoLocation(loc protoreflect.SourceLocation) *registryv1alpha1.Location { + return ®istryv1alpha1.Location{ + StartLine: int32(loc.StartLine), + StartColumn: int32(loc.StartColumn), + EndLine: int32(loc.EndLine), + EndColumn: int32(loc.EndColumn), + } +} + +func (g *documentGeneratorImpl) getPackageLinkers(packageName string) linker.Files { + if packageLinkers, ok := g.packageLinkerMap[packageName]; ok { + return packageLinkers + } + + packageLinkers := make(linker.Files, 0, len(g.linkers)) + for i := 0; i < len(g.linkers); i++ { + if string(g.linkers[i].Package()) == packageName { + packageLinkers = append(packageLinkers, g.linkers[i]) + } + } + g.packageLinkerMap[packageName] = packageLinkers + return packageLinkers +} + +func (g *documentGeneratorImpl) GetModulePackages() []string { + modulePackages := make([]string, 0, len(g.modulePackageSet)) + for packageName := range g.modulePackageSet { + modulePackages = append(modulePackages, packageName) + } + + return modulePackages +} + +func (g *documentGeneratorImpl) GenerateDocument(packageName string) *registryv1alpha1.PackageDocumentation { + g.messageSet = map[string]*registryv1alpha1.Message{} + + g.packageLinkers = g.getPackageLinkers(packageName) + + return g.doGenerateDocument(packageName) +} + +func (g *documentGeneratorImpl) doGenerateDocument(packageName string) *registryv1alpha1.PackageDocumentation { + var messages []*registryv1alpha1.Message + var enums []*registryv1alpha1.Enum + var services []*registryv1alpha1.Service + + for i := 0; i < len(g.packageLinkers); i++ { + packageLink := g.packageLinkers[i] + + _ = walk.Descriptors(packageLink, func(descriptor protoreflect.Descriptor) error { + switch descriptor.(type) { + case protoreflect.MessageDescriptor: + messages = append(messages, g.GetMessage(descriptor.(protoreflect.MessageDescriptor))) + case protoreflect.EnumDescriptor: + enums = append(enums, g.GetEnum(descriptor.(protoreflect.EnumDescriptor))) + case protoreflect.ServiceDescriptor: + services = append(services, g.GetService(descriptor.(protoreflect.ServiceDescriptor))) + } + + return nil + }) + } + + return ®istryv1alpha1.PackageDocumentation{ + Name: packageName, + // TODO Description: "", + Services: services, + Enums: enums, + Messages: messages, + // TODO FileExtensions: nil, + } +} + +func (g *documentGeneratorImpl) getNestedName(fullName, packageName string) string { + return strings.Replace(fullName, packageName+".", "", 1) +} + +func (g *documentGeneratorImpl) GetPackageMessages() []*registryv1alpha1.Message { + var messages []*registryv1alpha1.Message + + for i := 0; i < len(g.packageLinkers); i++ { + packageLink := g.packageLinkers[i] + messages = append(messages, g.GetMessages(packageLink.Messages())...) + } + + return messages +} + +func (g *documentGeneratorImpl) GetMessages(messageDescriptors protoreflect.MessageDescriptors) []*registryv1alpha1.Message { + messages := make([]*registryv1alpha1.Message, 0, messageDescriptors.Len()) + + for i := 0; i < messageDescriptors.Len(); i++ { + messageDescriptor := messageDescriptors.Get(i) + message := g.GetMessage(messageDescriptor) + messages = append(messages, message) + } + + return messages +} + +func (g *documentGeneratorImpl) GetMessage(messageDescriptor protoreflect.MessageDescriptor) *registryv1alpha1.Message { + if message, ok := g.messageSet[string(messageDescriptor.FullName())]; ok { + return message + } + + // get location info + messageLocation := messageDescriptor.ParentFile().SourceLocations().ByDescriptor(messageDescriptor) + // get options + messageOptions := protoutil.ProtoFromMessageDescriptor(messageDescriptor).Options + + message := ®istryv1alpha1.Message{ + Name: string(messageDescriptor.Name()), + NestedName: g.getNestedName(string(messageDescriptor.FullName()), string(messageDescriptor.ParentFile().Package())), + FullName: string(messageDescriptor.FullName()), + Description: messageLocation.LeadingComments, + FilePath: messageDescriptor.ParentFile().Path(), + IsMapEntry: messageDescriptor.IsMapEntry(), + Location: g.toProtoLocation(messageLocation), + // TODO MessageExtensions: nil, + MessageOptions: ®istryv1alpha1.MessageOptions{ + Deprecated: messageOptions.GetDeprecated(), + }, + // TODO ImplicitlyDeprecated: false, + } + + // fill message fields + fields := g.GetFields(messageDescriptor.Fields()) + + // fill message one of + oneofs := g.GetOneofs(messageDescriptor.Oneofs()) + + messageFields := make([]*registryv1alpha1.MessageField, 0, len(fields)+len(oneofs)) + for i := 0; i < len(fields); i++ { + field := fields[i] + messageFields = append(messageFields, ®istryv1alpha1.MessageField{ + MessageField: ®istryv1alpha1.MessageField_Field{ + Field: field, + }, + }) + } + for i := 0; i < len(oneofs); i++ { + oneof := oneofs[i] + messageFields = append(messageFields, ®istryv1alpha1.MessageField{ + MessageField: ®istryv1alpha1.MessageField_Oneof{ + Oneof: oneof, + }, + }) + } + message.Fields = messageFields + + // 记录message + g.messageSet[string(messageDescriptor.FullName())] = message + + return message +} + +func (g *documentGeneratorImpl) GetFields(fieldDescriptors protoreflect.FieldDescriptors) []*registryv1alpha1.Field { + fields := make([]*registryv1alpha1.Field, 0, fieldDescriptors.Len()) + + for i := 0; i < fieldDescriptors.Len(); i++ { + fieldDescriptor := fieldDescriptors.Get(i) + fields = append(fields, g.GetField(fieldDescriptor)) + } + + return fields +} + +func (g *documentGeneratorImpl) GetField(fieldDescriptor protoreflect.FieldDescriptor) *registryv1alpha1.Field { + fieldLocation := fieldDescriptor.ParentFile().SourceLocations().ByDescriptor(fieldDescriptor) + fieldOptions := protoutil.ProtoFromFieldDescriptor(fieldDescriptor).GetOptions() + + field := ®istryv1alpha1.Field{ + Name: string(fieldDescriptor.Name()), + Description: fieldLocation.LeadingComments, + Label: fieldDescriptor.Cardinality().String(), + NestedType: fieldDescriptor.Kind().String(), + FullType: fieldDescriptor.Kind().String(), + Tag: uint32(fieldDescriptor.Number()), + // TODO Extendee: "", + FieldOptions: ®istryv1alpha1.FieldOptions{ + Deprecated: fieldOptions.GetDeprecated(), + Ctype: int32(fieldOptions.GetCtype()), + Jstype: int32(fieldOptions.GetJstype()), + }, + } + if fieldOptions.GetPacked() { + packed := true + field.FieldOptions.Packed = &packed + } + + // field kind is Message + if fieldMessageDescriptor := fieldDescriptor.Message(); fieldMessageDescriptor != nil { + field.FullType = string(fieldMessageDescriptor.FullName()) + field.NestedType = g.getNestedName(string(fieldMessageDescriptor.FullName()), string(fieldMessageDescriptor.ParentFile().Package())) + field.ImportModuleRef = g.getImportModuleRef(fieldMessageDescriptor) + } + // field kind is Enum + if fieldEnumDescriptor := fieldDescriptor.Enum(); fieldEnumDescriptor != nil { + field.FullType = string(fieldEnumDescriptor.FullName()) + field.NestedType = g.getNestedName(string(fieldEnumDescriptor.FullName()), string(fieldEnumDescriptor.ParentFile().FullName())) + } + + // field kind is MapEntry + if fieldDescriptor.IsMap() { + keyDescriptor := fieldDescriptor.MapKey() + valueField := g.GetField(fieldDescriptor.MapValue()) + mapEntry := ®istryv1alpha1.MapEntry{ + KeyFullType: keyDescriptor.Kind().String(), + ValueNestedType: valueField.GetNestedType(), + ValueFullType: valueField.GetFullType(), + ValueImportModuleRef: valueField.GetImportModuleRef(), + } + + field.MapEntry = mapEntry + } + + return field +} + +func (g *documentGeneratorImpl) GetOneofs(oneofDescriptors protoreflect.OneofDescriptors) []*registryv1alpha1.Oneof { + oneofs := make([]*registryv1alpha1.Oneof, 0, oneofDescriptors.Len()) + + for i := 0; i < oneofDescriptors.Len(); i++ { + oneofDescriptor := oneofDescriptors.Get(i) + + oneof := ®istryv1alpha1.Oneof{ + Name: string(oneofDescriptor.Name()), + Fields: g.GetFields(oneofDescriptor.Fields()), + } + + oneofs = append(oneofs, oneof) + } + + return oneofs +} + +func (g *documentGeneratorImpl) GetPackageEnums() []*registryv1alpha1.Enum { + var enums []*registryv1alpha1.Enum + + for i := 0; i < len(g.packageLinkers); i++ { + packageLink := g.packageLinkers[i] + enums = append(enums, g.GetEnums(packageLink.Enums())...) + } + + return enums +} + +func (g *documentGeneratorImpl) GetEnums(enumDescriptors protoreflect.EnumDescriptors) []*registryv1alpha1.Enum { + enums := make([]*registryv1alpha1.Enum, 0, enumDescriptors.Len()) + + for i := 0; i < enumDescriptors.Len(); i++ { + enumDescriptor := enumDescriptors.Get(i) + enum := g.GetEnum(enumDescriptor) + enums = append(enums, enum) + } + + return enums +} + +func (g *documentGeneratorImpl) GetEnum(enumDescriptor protoreflect.EnumDescriptor) *registryv1alpha1.Enum { + // get location info + enumLocation := enumDescriptor.ParentFile().SourceLocations().ByDescriptor(enumDescriptor) + // get options + enumOptions := protoutil.ProtoFromEnumDescriptor(enumDescriptor).GetOptions() + + enum := ®istryv1alpha1.Enum{ + Name: string(enumDescriptor.Name()), + NestedName: g.getNestedName(string(enumDescriptor.FullName()), string(enumDescriptor.ParentFile().Package())), + FullName: string(enumDescriptor.FullName()), + Description: enumLocation.LeadingComments, + FilePath: enumDescriptor.ParentFile().Path(), + Location: g.toProtoLocation(enumLocation), + EnumOptions: ®istryv1alpha1.EnumOptions{ + Deprecated: enumOptions.GetDeprecated(), + AllowAlias: enumOptions.GetAllowAlias(), + }, + // TODO ImplicitlyDeprecated: false, + } + + // enum values + enumValues := g.GetEnumValues(enumDescriptor.Values()) + enum.Values = enumValues + + return enum +} + +func (g *documentGeneratorImpl) GetEnumValues(enumValueDescriptor protoreflect.EnumValueDescriptors) []*registryv1alpha1.EnumValue { + enumValues := make([]*registryv1alpha1.EnumValue, 0, enumValueDescriptor.Len()) + for i := 0; i < enumValueDescriptor.Len(); i++ { + enumValueDescriptor := enumValueDescriptor.Get(i) + enumValueLocation := enumValueDescriptor.ParentFile().SourceLocations().ByDescriptor(enumValueDescriptor) + enumValueOptions := protoutil.ProtoFromEnumValueDescriptor(enumValueDescriptor).GetOptions() + + enumValue := ®istryv1alpha1.EnumValue{ + Name: string(enumValueDescriptor.Name()), + Number: int32(enumValueDescriptor.Number()), + Description: enumValueLocation.LeadingComments, + EnumValueOptions: ®istryv1alpha1.EnumValueOptions{ + Deprecated: enumValueOptions.GetDeprecated(), + }, + } + + enumValues = append(enumValues, enumValue) + } + + return enumValues +} + +func (g *documentGeneratorImpl) GetPackageServices() []*registryv1alpha1.Service { + var services []*registryv1alpha1.Service + + for i := 0; i < len(g.packageLinkers); i++ { + packageLink := g.packageLinkers[i] + services = append(services, g.GetServices(packageLink.Services())...) + } + + return services +} + +func (g *documentGeneratorImpl) GetServices(serviceDescriptors protoreflect.ServiceDescriptors) []*registryv1alpha1.Service { + services := make([]*registryv1alpha1.Service, 0, serviceDescriptors.Len()) + + for i := 0; i < serviceDescriptors.Len(); i++ { + serviceDescriptor := serviceDescriptors.Get(i) + service := g.GetService(serviceDescriptor) + services = append(services, service) + } + + return services +} + +func (g *documentGeneratorImpl) GetService(serviceDescriptor protoreflect.ServiceDescriptor) *registryv1alpha1.Service { + // get location info + serviceLocation := serviceDescriptor.ParentFile().SourceLocations().ByDescriptor(serviceDescriptor) + // get options + serviceOptions := protoutil.ProtoFromServiceDescriptor(serviceDescriptor).GetOptions() + + service := ®istryv1alpha1.Service{ + Name: string(serviceDescriptor.Name()), + NestedName: g.getNestedName(string(serviceDescriptor.FullName()), string(serviceDescriptor.ParentFile().Package())), + FullName: string(serviceDescriptor.FullName()), + Description: serviceLocation.LeadingComments, + FilePath: serviceDescriptor.ParentFile().Path(), + Location: g.toProtoLocation(serviceLocation), + ServiceOptions: ®istryv1alpha1.ServiceOptions{ + Deprecated: serviceOptions.GetDeprecated(), + }, + // TODO ImplicitlyDeprecated: false, + } + + // methods + methods := g.GetMethods(serviceDescriptor.Methods()) + service.Methods = methods + + return service +} + +func (g *documentGeneratorImpl) GetMethods(methodDescriptors protoreflect.MethodDescriptors) []*registryv1alpha1.Method { + methods := make([]*registryv1alpha1.Method, 0, methodDescriptors.Len()) + + for i := 0; i < methodDescriptors.Len(); i++ { + methodDescriptor := methodDescriptors.Get(i) + methodLocation := methodDescriptor.ParentFile().SourceLocations().ByDescriptor(methodDescriptor) + methodOptions := protoutil.ProtoFromMethodDescriptor(methodDescriptor).GetOptions() + requestDescriptor := methodDescriptor.Input() + responseDescriptor := methodDescriptor.Output() + + method := ®istryv1alpha1.Method{ + Name: string(methodDescriptor.Name()), + Description: methodLocation.LeadingComments, + Request: g.getMethodRequestResponse(methodDescriptor.IsStreamingClient(), requestDescriptor), + Response: g.getMethodRequestResponse(methodDescriptor.IsStreamingServer(), responseDescriptor), + MethodOptions: ®istryv1alpha1.MethodOptions{ + Deprecated: methodOptions.GetDeprecated(), + IdempotencyLevel: int32(methodOptions.GetIdempotencyLevel()), + }, + // TODO ImplicitlyDeprecated: false, + } + + methods = append(methods, method) + } + + return methods +} + +func (g *documentGeneratorImpl) getMethodRequestResponse(streaming bool, descriptor protoreflect.MessageDescriptor) *registryv1alpha1.MethodRequestResponse { + m := g.GetMessage(descriptor) + + r := ®istryv1alpha1.MethodRequestResponse{ + NestedType: m.NestedName, + FullType: m.FullName, + Streaming: streaming, + Message: m, + } + + r.ImportModuleRef = g.getImportModuleRef(descriptor) + + return r +} + +func (g *documentGeneratorImpl) getImportModuleRef(descriptor protoreflect.Descriptor) *registryv1alpha1.ImportModuleRef { + if g.isDependency(descriptor.ParentFile()) { + // 如果是外部依赖 + fileDescriptor := descriptor.ParentFile() + identity := g.parserAccessorHandler.ModuleIdentity(fileDescriptor.Path()) + importModuleRef := ®istryv1alpha1.ImportModuleRef{ + Remote: identity.Remote(), + Owner: identity.Owner(), + Repository: identity.Repository(), + Commit: g.parserAccessorHandler.Commit(fileDescriptor.Path()), + PackageName: string(fileDescriptor.Package()), + } + + return importModuleRef + } + + return nil +} diff --git a/pkg/bufman/core/parser/proto_parser.go b/pkg/bufman/core/parser/proto_parser.go new file mode 100644 index 000000000..130d7d449 --- /dev/null +++ b/pkg/bufman/core/parser/proto_parser.go @@ -0,0 +1,171 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package parser + +import ( + "context" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleprotocompile" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + manifest2 "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" + "github.com/bufbuild/protocompile" + "github.com/bufbuild/protocompile/linker" +) + +type ProtoParser interface { + // TryCompile 尝试编译,查看是否能够编译成功 + TryCompile(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet, dependentManifests []*manifest2.Manifest, dependentBlobSets []*manifest2.BlobSet) e.ResponseError + // GetPackageDocumentation 获取package document + GetPackageDocumentation(ctx context.Context, packageName string, moduleIdentity bufmoduleref.ModuleIdentity, commitName string, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet, dependentIdentities []bufmoduleref.ModuleIdentity, dependentCommits []string, dependentManifests []*manifest2.Manifest, dependentBlobSets []*manifest2.BlobSet) (*registryv1alpha1.PackageDocumentation, e.ResponseError) + // GetPackages 获取所有的package + GetPackages(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet, dependentManifests []*manifest2.Manifest, dependentBlobSets []*manifest2.BlobSet) ([]*registryv1alpha1.ModulePackage, e.ResponseError) +} + +func NewProtoParser() ProtoParser { + return &ProtoParserImpl{} +} + +type ProtoParserImpl struct{} + +func (protoParser *ProtoParserImpl) GetPackages(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet, dependentManifests []*manifest2.Manifest, dependentBlobSets []*manifest2.BlobSet) ([]*registryv1alpha1.ModulePackage, e.ResponseError) { + module, dependentModules, err := protoParser.getModules(ctx, fileManifest, blobSet, dependentManifests, dependentBlobSets) + if err != nil { + return nil, e.NewInternalError(err) + } + + // 编译proto文件 + linkers, _, err := protoParser.compile(ctx, fileManifest, module, dependentModules) + if err != nil { + return nil, e.NewInternalError(err) + } + + packagesSet := map[string]struct{}{} + for _, link := range linkers { + packagesSet[string(link.Package())] = struct{}{} + } + + modulePackages := make([]*registryv1alpha1.ModulePackage, 0, len(packagesSet)) + for packageName := range packagesSet { + modulePackages = append(modulePackages, ®istryv1alpha1.ModulePackage{ + Name: packageName, + }) + } + + return modulePackages, nil +} + +func (protoParser *ProtoParserImpl) GetPackageDocumentation(ctx context.Context, packageName string, moduleIdentity bufmoduleref.ModuleIdentity, commitName string, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet, dependentIdentities []bufmoduleref.ModuleIdentity, dependentCommits []string, dependentManifests []*manifest2.Manifest, dependentBlobSets []*manifest2.BlobSet) (*registryv1alpha1.PackageDocumentation, e.ResponseError) { + module, dependentModules, err := protoParser.getModulesWithModuleIdentityAndCommit(ctx, moduleIdentity, commitName, fileManifest, blobSet, dependentIdentities, dependentCommits, dependentManifests, dependentBlobSets) + if err != nil { + return nil, e.NewInternalError(err) + } + + // 编译proto文件 + linkers, parserAccessorHandler, err := protoParser.compile(ctx, fileManifest, module, dependentModules) + if err != nil { + return nil, e.NewInternalError(err) + } + + // 生成package文档 + documentGenerator := NewDocumentGenerator(commitName, linkers, parserAccessorHandler) + return documentGenerator.GenerateDocument(packageName), nil +} + +func (protoParser *ProtoParserImpl) TryCompile(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet, dependentManifests []*manifest2.Manifest, dependentBlobSets []*manifest2.BlobSet) e.ResponseError { + module, dependentModules, err := protoParser.getModules(ctx, fileManifest, blobSet, dependentManifests, dependentBlobSets) + if err != nil { + return e.NewInternalError(err) + } + + // 尝试编译,查看是否成功 + _, _, err = protoParser.compile(ctx, fileManifest, module, dependentModules) + if err != nil { + return e.NewInternalError(err) + } + + return nil +} + +func (protoParser *ProtoParserImpl) getModules(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet, dependentManifests []*manifest2.Manifest, dependentBlobSets []*manifest2.BlobSet) (bufmodule.Module, []bufmodule.Module, error) { + module, err := bufmodule.NewModuleForManifestAndBlobSet(ctx, fileManifest, blobSet) + if err != nil { + return nil, nil, err + } + dependentModules := make([]bufmodule.Module, 0, len(dependentManifests)) + for i := 0; i < len(dependentManifests); i++ { + dependentModule, err := bufmodule.NewModuleForManifestAndBlobSet(ctx, dependentManifests[i], dependentBlobSets[i]) + if err != nil { + return nil, nil, err + } + dependentModules = append(dependentModules, dependentModule) + } + + return module, dependentModules, nil +} + +func (protoParser *ProtoParserImpl) getModulesWithModuleIdentityAndCommit(ctx context.Context, moduleIdentity bufmoduleref.ModuleIdentity, commit string, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet, dependentIdentities []bufmoduleref.ModuleIdentity, dependentCommits []string, dependentManifests []*manifest2.Manifest, dependentBlobSets []*manifest2.BlobSet) (bufmodule.Module, []bufmodule.Module, error) { + module, err := bufmodule.NewModuleForManifestAndBlobSet(ctx, fileManifest, blobSet, bufmodule.ModuleWithModuleIdentityAndCommit(moduleIdentity, commit)) + if err != nil { + return nil, nil, err + } + dependentModules := make([]bufmodule.Module, 0, len(dependentManifests)) + for i := 0; i < len(dependentManifests); i++ { + dependentModule, err := bufmodule.NewModuleForManifestAndBlobSet(ctx, dependentManifests[i], dependentBlobSets[i], bufmodule.ModuleWithModuleIdentityAndCommit(dependentIdentities[i], dependentCommits[i])) + if err != nil { + return nil, nil, err + } + dependentModules = append(dependentModules, dependentModule) + } + + return module, dependentModules, nil +} + +func (protoParser *ProtoParserImpl) compile(ctx context.Context, fileManifest *manifest2.Manifest, module bufmodule.Module, dependentModules []bufmodule.Module) (linker.Files, bufmoduleprotocompile.ParserAccessorHandler, error) { + moduleFileSet := bufmodule.NewModuleFileSet(module, dependentModules) + parserAccessorHandler := bufmoduleprotocompile.NewParserAccessorHandler(ctx, moduleFileSet) + compiler := protocompile.Compiler{ + MaxParallelism: thread.Parallelism(), + SourceInfoMode: protocompile.SourceInfoStandard, + Resolver: &protocompile.SourceResolver{Accessor: parserAccessorHandler.Open}, + } + + // fileDescriptors are in the same order as paths per the documentation + protoPaths := protoParser.getProtoPaths(fileManifest) + linkers, err := compiler.Compile(ctx, protoPaths...) + if err != nil { + return nil, nil, err + } + + return linkers, parserAccessorHandler, nil +} + +func (protoParser *ProtoParserImpl) getProtoPaths(fileManifest *manifest2.Manifest) []string { + var protoPaths []string + _ = fileManifest.Range(func(path string, digest manifest2.Digest) error { + if strings.HasSuffix(path, ".proto") { + protoPaths = append(protoPaths, path) + } + + return nil + }) + + return protoPaths +} diff --git a/pkg/bufman/core/resolve/resolve.go b/pkg/bufman/core/resolve/resolve.go new file mode 100644 index 000000000..d5481ad67 --- /dev/null +++ b/pkg/bufman/core/resolve/resolve.go @@ -0,0 +1,246 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resolve + +import ( + "context" + "errors" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/config" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + manifest2 "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "gorm.io/gorm" +) + +type Resolver interface { + GetAllDependenciesFromBufConfig(ctx context.Context, bufConfig *bufconfig.Config) (model.Commits, e.ResponseError) // 获取全部依赖 + GetDirectDependenciesFromBufConfig(ctx context.Context, bufConfig *bufconfig.Config) (model.Commits, e.ResponseError) // 获取直接依赖 + GetAllDependenciesFromModuleRefs(ctx context.Context, moduleReferences []bufmoduleref.ModuleReference) (model.Commits, e.ResponseError) // 获取全部依赖 + GetDirectDependenciesFromModuleRefs(ctx context.Context, moduleReferences []bufmoduleref.ModuleReference) (model.Commits, e.ResponseError) // 获取直接依赖 +} + +type ResolverImpl struct { + repositoryMapper mapper.RepositoryMapper + commitMapper mapper.CommitMapper + fileMapper mapper.FileMapper + storageHelper storage.StorageHelper +} + +func NewResolver() Resolver { + return &ResolverImpl{ + repositoryMapper: &mapper.RepositoryMapperImpl{}, + commitMapper: &mapper.CommitMapperImpl{}, + fileMapper: &mapper.FileMapperImpl{}, + storageHelper: storage.NewStorageHelper(), + } +} + +func (resolver *ResolverImpl) GetAllDependenciesFromBufConfig(ctx context.Context, bufConfig *bufconfig.Config) (model.Commits, e.ResponseError) { + var dependentCommitSet map[string]*model.Commit + var err e.ResponseError + dependentCommitSet, err = resolver.doGetDependencies(ctx, dependentCommitSet, bufConfig.Build.DependencyModuleReferences, true) + if err != nil { + return nil, err + } + + commits := make([]*model.Commit, 0, len(dependentCommitSet)) + for _, commit := range dependentCommitSet { + commits = append(commits, commit) + } + + return commits, nil +} + +func (resolver *ResolverImpl) GetDirectDependenciesFromBufConfig(ctx context.Context, bufConfig *bufconfig.Config) (model.Commits, e.ResponseError) { + var dependentCommitSet map[string]*model.Commit + var err e.ResponseError + dependentCommitSet, err = resolver.doGetDependencies(ctx, dependentCommitSet, bufConfig.Build.DependencyModuleReferences, false) + if err != nil { + return nil, err + } + + commits := make([]*model.Commit, 0, len(dependentCommitSet)) + for _, commit := range dependentCommitSet { + commits = append(commits, commit) + } + + return commits, nil +} + +func (resolver *ResolverImpl) GetAllDependenciesFromModuleRefs(ctx context.Context, moduleReferences []bufmoduleref.ModuleReference) (model.Commits, e.ResponseError) { + var dependentCommitSet map[string]*model.Commit + var err e.ResponseError + dependentCommitSet, err = resolver.doGetDependencies(ctx, dependentCommitSet, moduleReferences, true) + if err != nil { + return nil, err + } + + commits := make([]*model.Commit, 0, len(dependentCommitSet)) + for _, commit := range dependentCommitSet { + commits = append(commits, commit) + } + + return commits, nil +} + +func (resolver *ResolverImpl) GetDirectDependenciesFromModuleRefs(ctx context.Context, moduleReferences []bufmoduleref.ModuleReference) (model.Commits, e.ResponseError) { + var dependentCommitSet map[string]*model.Commit + var err e.ResponseError + dependentCommitSet, err = resolver.doGetDependencies(ctx, dependentCommitSet, moduleReferences, false) + if err != nil { + return nil, err + } + + commits := make([]*model.Commit, 0, len(dependentCommitSet)) + for _, commit := range dependentCommitSet { + commits = append(commits, commit) + } + + return commits, nil +} + +func (resolver *ResolverImpl) GetBufConfigFromCommitID(ctx context.Context, commitID string) (*bufconfig.Config, e.ResponseError) { + // 查询manifest名称 + manifestModel, err := resolver.fileMapper.FindManifestByCommitID(commitID) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("manifest(commit id = %s)", commitID)) + } + return nil, e.NewInternalError(errors.New("GetDependenciesByCommitID")) + } + + // 读取manifest + reader, err := resolver.storageHelper.ReadManifestToReader(ctx, manifestModel.Digest) + if err != nil { + return nil, nil + } + fileManifest, err := manifest2.NewFromReader(reader) + if err != nil { + return nil, e.NewInternalError(errors.New("GetDependenciesByCommitID")) + } + + // 根据文件manifest查找配置文件 + var configFileExist bool + var configFileData []byte + err = fileManifest.Range(func(path string, digest manifest2.Digest) error { + // 如果遇到配置文件,就记录下来 + for _, configFilePath := range bufconfig.AllConfigFilePaths { + if path == configFilePath { + if configFileExist { + return errors.New("two config files") + } + + reader, err := resolver.storageHelper.ReadBlobToReader(ctx, digest.Hex()) + if err != nil { + return err + } + configFileData, err = io.ReadAll(reader) + if err != nil { + return err + } + configFileExist = true + } + } + + return nil + }) + if err != nil { + return nil, e.NewInvalidArgumentError(err) + } + if !configFileExist { + // 不存在配置文件 + return nil, e.NewInvalidArgumentError(errors.New("no config file")) + } + + bufConfig, err := bufconfig.GetConfigForData(ctx, configFileData) + if err != nil { + return nil, e.NewInternalError(errors.New("GetDependenciesByCommitID")) + } + + return bufConfig, nil +} + +func (resolver *ResolverImpl) doGetDependencies(ctx context.Context, dependentCommitSet map[string]*model.Commit, dependencyReferences []bufmoduleref.ModuleReference, getAll bool) (map[string]*model.Commit, e.ResponseError) { + if dependentCommitSet == nil { + dependentCommitSet = map[string]*model.Commit{} + } + + for i := 0; i < len(dependencyReferences); i++ { + dependencyReference := dependencyReferences[i] + if dependencyReference.Remote() == config.Properties.Server.ServerHost { + // 查询repo + repo, err := resolver.repositoryMapper.FindByUserNameAndRepositoryName(dependencyReference.Owner(), dependencyReference.Repository()) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(errors.New(dependencyReference.IdentityString())) + } + return nil, e.NewInternalError(fmt.Errorf("find repository(%s)", err.Error())) + } + + // 查询当前reference,版本号是否一样 + commit, err := resolver.commitMapper.FindByRepositoryIDAndReference(repo.RepositoryID, dependencyReference.Reference()) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("%s:%s", dependencyReference.IdentityString(), dependencyReference.Reference())) + } + return nil, e.NewInternalError(fmt.Errorf("find reference(%s)", err.Error())) + } + + dependentCommit, ok := dependentCommitSet[dependencyReference.IdentityString()] + if ok && dependentCommit.CommitName == dependencyReference.Reference() { + continue + } + if ok { + // 之前已经记录过 owner/repository 的commit + if commit.CommitName != dependentCommit.CommitName { + // 同一个仓库下的依赖版本号不同,返回错误 + return nil, e.NewInternalError(fmt.Errorf("two different version %s and %s for %s", dependentCommit.CommitName, dependencyReference.Reference(), dependencyReference.IdentityString())) + } + + // 当前依赖已经记录,跳过 + continue + } else { + // 如果之前没有记录过,记录依赖commit + dependentCommitSet[dependencyReference.IdentityString()] = commit + + if getAll { + // 需要获取全部依赖,记录这个依赖下的依赖关系 + dependentBufConfig, configErr := resolver.GetBufConfigFromCommitID(ctx, commit.CommitID) + if configErr != nil { + return nil, configErr + } + + var dependentErr e.ResponseError + dependentCommitSet, dependentErr = resolver.doGetDependencies(ctx, dependentCommitSet, dependentBufConfig.Build.DependencyModuleReferences, true) + if dependentErr != nil { + return nil, dependentErr + } + } + + } + } + } + + // 通过 + return dependentCommitSet, nil +} diff --git a/pkg/bufman/core/security/page_token.go b/pkg/bufman/core/security/page_token.go new file mode 100644 index 000000000..d406d9bfa --- /dev/null +++ b/pkg/bufman/core/security/page_token.go @@ -0,0 +1,84 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "errors" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/config" + "github.com/golang-jwt/jwt/v4" +) + +type PageTokenChaim struct { + PageOffset int + jwt.RegisteredClaims +} + +func GenerateNextPageToken(lastPageOffset, lastPageSize, lastDataLength int) (string, error) { + if lastDataLength < lastPageSize { + // 已经查询完了 + return "", nil + } + + nextPageOffset := lastPageOffset + lastDataLength + // 定义 token 的过期时间 + now := time.Now() + expireTime := now.Add(config.Properties.Server.PageTokenExpireTime) + + // 创建一个自定义的 Claim + chaim := &PageTokenChaim{ + PageOffset: nextPageOffset, + RegisteredClaims: jwt.RegisteredClaims{ + ExpiresAt: jwt.NewNumericDate(expireTime), + IssuedAt: jwt.NewNumericDate(now), + Issuer: "bufman", + }, + } + + // 使用 JWT 签名算法生成 token + token := jwt.NewWithClaims(jwt.SigningMethodHS256, chaim) + + // 将 token 进行加盐加密 + tokenString, err := token.SignedString([]byte(config.Properties.Server.PageTokenSecret)) + if err != nil { + return "", err + } + + return tokenString, nil +} + +func ParsePageToken(tokenString string) (*PageTokenChaim, error) { + if tokenString == "" { + return &PageTokenChaim{ + PageOffset: 0, + }, nil + } + + // 解析 token + token, err := jwt.ParseWithClaims(tokenString, &PageTokenChaim{}, func(token *jwt.Token) (interface{}, error) { + return []byte(config.Properties.Server.PageTokenSecret), nil + }) + if err != nil { + return nil, err + } + + if claims, ok := token.Claims.(*PageTokenChaim); ok && token.Valid { + return claims, nil + } else { + return nil, errors.New("invalid page token") + } +} diff --git a/pkg/bufman/core/security/security.go b/pkg/bufman/core/security/security.go new file mode 100644 index 000000000..823f61e94 --- /dev/null +++ b/pkg/bufman/core/security/security.go @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "crypto/sha256" + "encoding/hex" + "strconv" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" +) + +// EncryptPlainPassword 加密明文密码 +func EncryptPlainPassword(userName, plainPwd string) string { + sha := sha256.New() + sha.Write([]byte(plainPwd)) + sha.Write([]byte(userName)) + bytes := sha.Sum(nil) + + return hex.EncodeToString(bytes) +} + +// GenerateToken 生成token +func GenerateToken(username, note string) string { + sha := sha256.New() + // 以用户名 note 时间戳做哈希 + sha.Write([]byte(username)) + sha.Write([]byte(note)) + now := strconv.FormatInt(time.Now().UnixNano(), 10) + sha.Write([]byte(now)) + + return hex.EncodeToString(sha.Sum(nil)[:constant.TokenLength/2]) +} + +func GenerateCommitName(userName, RepositoryName string) string { + sha := sha256.New() + // 以用户名 note 时间戳做哈希 + sha.Write([]byte(userName)) + sha.Write([]byte(RepositoryName)) + now := strconv.FormatInt(time.Now().UnixNano(), 10) + sha.Write([]byte(now)) + bytes := sha.Sum(nil) + + return hex.EncodeToString(bytes[:constant.CommitLength/2]) +} diff --git a/pkg/bufman/core/storage/disk_storage.go b/pkg/bufman/core/storage/disk_storage.go new file mode 100644 index 000000000..f31cd49d3 --- /dev/null +++ b/pkg/bufman/core/storage/disk_storage.go @@ -0,0 +1,131 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "bytes" + "context" + "io" + "os" + "path" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type DiskStorageHelperImpl struct { + mu sync.Mutex + muDict map[string]*sync.RWMutex + + pluginMu sync.Mutex + pluginMuDict map[string]*sync.RWMutex +} + +func (helper *DiskStorageHelperImpl) StoreBlob(ctx context.Context, blob *model.FileBlob) error { + return helper.store(ctx, blob.Digest, []byte(blob.Content)) +} + +func (helper *DiskStorageHelperImpl) store(ctx context.Context, digest string, content []byte) error { + helper.mu.Lock() + defer helper.mu.Unlock() + + if _, ok := helper.muDict[digest]; !ok { + helper.muDict[digest] = &sync.RWMutex{} + } + + // 上写锁 + helper.muDict[digest].Lock() + defer helper.muDict[digest].Unlock() + + // 打开文件 + filePath := helper.GetFilePath(digest) + file, err := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0o666) + if os.IsExist(err) { + // 已经存在,直接返回 + return nil + } + if err != nil { + return err + } + + _, err = file.Write(content) + if err != nil { + return err + } + + return nil +} + +func (helper *DiskStorageHelperImpl) StoreManifest(ctx context.Context, manifest *model.FileManifest) error { + return helper.store(ctx, manifest.Digest, []byte(manifest.Content)) +} + +func (helper *DiskStorageHelperImpl) StoreDocumentation(ctx context.Context, blob *model.FileBlob) error { + return nil +} + +func (helper *DiskStorageHelperImpl) ReadBlobToReader(ctx context.Context, fileName string) (io.Reader, error) { + content, err := helper.ReadBlob(ctx, fileName) + if err != nil { + return nil, err + } + + return bytes.NewReader(content), nil +} + +func (helper *DiskStorageHelperImpl) ReadBlob(ctx context.Context, fileName string) ([]byte, error) { + return helper.read(ctx, fileName) +} + +func (helper *DiskStorageHelperImpl) ReadManifestToReader(ctx context.Context, fileName string) (io.Reader, error) { + content, err := helper.ReadManifest(ctx, fileName) + if err != nil { + return nil, err + } + + return bytes.NewReader(content), nil +} + +func (helper *DiskStorageHelperImpl) ReadManifest(ctx context.Context, fileName string) ([]byte, error) { + return helper.read(ctx, fileName) +} + +func (helper *DiskStorageHelperImpl) read(ctx context.Context, fileName string) ([]byte, error) { + helper.mu.Lock() + defer helper.mu.Unlock() + + if _, ok := helper.muDict[fileName]; !ok { + helper.muDict[fileName] = &sync.RWMutex{} + } + + // 上读锁 + helper.muDict[fileName].RLock() + defer helper.muDict[fileName].RUnlock() + + // 读取文件 + filePath := helper.GetFilePath(fileName) + content, err := os.ReadFile(filePath) + if err != nil { + return nil, err + } + + return content, nil +} + +func (helper *DiskStorageHelperImpl) GetFilePath(fileName string) string { + return path.Join(constant.FileSavaDir, fileName) +} diff --git a/pkg/bufman/core/storage/storage.go b/pkg/bufman/core/storage/storage.go new file mode 100644 index 000000000..b356a680d --- /dev/null +++ b/pkg/bufman/core/storage/storage.go @@ -0,0 +1,250 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + "errors" + "io" + "sync" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + manifest2 "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" +) + +type BaseStorageHelper interface { + StoreBlob(ctx context.Context, blob *model.FileBlob) error + StoreManifest(ctx context.Context, manifest *model.FileManifest) error + StoreDocumentation(ctx context.Context, blob *model.FileBlob) error + ReadBlobToReader(ctx context.Context, digest string) (io.Reader, error) // 读取内容 + ReadBlob(ctx context.Context, fileName string) ([]byte, error) + ReadManifestToReader(ctx context.Context, fileName string) (io.Reader, error) + ReadManifest(ctx context.Context, fileName string) ([]byte, error) +} + +type StorageHelper interface { + BaseStorageHelper + ReadToManifestAndBlobSet(ctx context.Context, modelFileManifest *model.FileManifest, fileBlobs model.FileBlobs) (*manifest2.Manifest, *manifest2.BlobSet, error) // 读取为manifest和blob set + GetDocumentAndLicenseFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, manifest2.Blob, error) + GetBufManConfigFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, error) + GetDocumentFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, error) + GetLicenseFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, error) +} + +type StorageHelperImpl struct { + BaseStorageHelper +} + +// 单例模式 +var ( + storageHelperImpl *StorageHelperImpl + once sync.Once +) + +func NewStorageHelper() StorageHelper { + if storageHelperImpl == nil { + // 对象初始化 + once.Do(func() { + storageHelperImpl = &StorageHelperImpl{ + BaseStorageHelper: &DiskStorageHelperImpl{ + muDict: map[string]*sync.RWMutex{}, + pluginMuDict: map[string]*sync.RWMutex{}, + }, + } + }) + } + + return storageHelperImpl +} + +func (helper *StorageHelperImpl) ReadToManifestAndBlobSet(ctx context.Context, modelFileManifest *model.FileManifest, fileBlobs model.FileBlobs) (*manifest2.Manifest, *manifest2.BlobSet, error) { + // 读取文件清单 + reader, err := helper.ReadManifestToReader(ctx, modelFileManifest.Digest) + if err != nil { + return nil, nil, err + } + fileManifest, err := manifest2.NewFromReader(reader) + if err != nil { + return nil, nil, err + } + + // 读取文件blobs + blobs := make([]manifest2.Blob, 0, len(fileBlobs)) + for i := 0; i < len(fileBlobs); i++ { + // 读取文件 + reader, err := helper.ReadBlobToReader(ctx, fileBlobs[i].Digest) + if err != nil { + return nil, nil, err + } + + // 生成blob + blob, err := manifest2.NewMemoryBlobFromReader(reader) + if err != nil { + return nil, nil, err + } + blobs = append(blobs, blob) + } + + blobSet, err := manifest2.NewBlobSet(ctx, blobs) + if err != nil { + return nil, nil, err + } + + return fileManifest, blobSet, nil +} + +func (helper *StorageHelperImpl) GetDocumentAndLicenseFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, manifest2.Blob, error) { + var documentDataExists, licenseExists bool + var documentBlob, licenseBlob manifest2.Blob + + externalPaths := []string{ + bufmodule.LicenseFilePath, + } + externalPaths = append(externalPaths, bufmodule.AllDocumentationPaths...) + + err := fileManifest.Range(func(path string, digest manifest2.Digest) error { + blob, ok := blobSet.BlobFor(digest.String()) + if !ok { + // 文件清单中有的文件,在file blobs中没有 + return errors.New("check manifest and file blobs failed") + } + + // 如果遇到配置文件,就记录下来 + for _, externalPath := range externalPaths { + if documentDataExists && licenseExists { + break + } + + if path == externalPath { + if path == bufmodule.LicenseFilePath { + // license文件 + licenseBlob = blob + licenseExists = true + } else { + if documentDataExists { + break + } + // document文件 + documentBlob = blob + documentDataExists = true + } + } + } + + return nil + }) + if err != nil { + return nil, nil, err + } + + return documentBlob, licenseBlob, nil +} + +func (helper *StorageHelperImpl) GetBufManConfigFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, error) { + var configFileExist bool + var configFileBlob manifest2.Blob + + err := fileManifest.Range(func(path string, digest manifest2.Digest) error { + blob, ok := blobSet.BlobFor(digest.String()) + if !ok { + // 文件清单中有的文件,在file blobs中没有 + return errors.New("check manifest and file blobs failed") + } + + // 如果遇到配置文件,就记录下来 + for _, configFilePath := range bufconfig.AllConfigFilePaths { + if configFileExist { + break + } + + if path == configFilePath { + configFileBlob = blob + configFileExist = true + } + } + + return nil + }) + if err != nil { + return nil, err + } + + return configFileBlob, nil +} + +func (helper *StorageHelperImpl) GetDocumentFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, error) { + var documentExist bool + var documentBlob manifest2.Blob + + err := fileManifest.Range(func(path string, digest manifest2.Digest) error { + blob, ok := blobSet.BlobFor(digest.String()) + if !ok { + // 文件清单中有的文件,在file blobs中没有 + return errors.New("check manifest and file blobs failed") + } + + // 如果遇到README文件,就记录下来 + for _, documentationPath := range bufmodule.AllDocumentationPaths { + if documentExist { + break + } + + if path == documentationPath { + documentBlob = blob + documentExist = true + } + } + + return nil + }) + if err != nil { + return nil, err + } + + return documentBlob, nil +} + +func (helper *StorageHelperImpl) GetLicenseFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, error) { + var licenseExist bool + var licenseBlob manifest2.Blob + + err := fileManifest.Range(func(path string, digest manifest2.Digest) error { + if licenseExist { + return nil + } + + blob, ok := blobSet.BlobFor(digest.String()) + if !ok { + // 文件清单中有的文件,在file blobs中没有 + return errors.New("check manifest and file blobs failed") + } + + // 如果遇到license,就记录下来 + if path == bufmodule.LicenseFilePath { + licenseBlob = blob + licenseExist = true + } + + return nil + }) + if err != nil { + return nil, err + } + + return licenseBlob, nil +} diff --git a/pkg/bufman/core/validity/viliditor.go b/pkg/bufman/core/validity/viliditor.go new file mode 100644 index 000000000..505942027 --- /dev/null +++ b/pkg/bufman/core/validity/viliditor.go @@ -0,0 +1,196 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package validity + +import ( + "context" + "errors" + "fmt" + "regexp" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buflock" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmanifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + manifest2 "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" +) + +type Validator interface { + CheckUserName(username string) e.ResponseError // 检查用户名合法性 + CheckPassword(password string) e.ResponseError // 检查密码合法性 + CheckRepositoryName(repositoryName string) e.ResponseError // 检查repo name合法性 + CheckTagName(tagName string) e.ResponseError // 检查tag name合法性 + CheckDraftName(draftName string) e.ResponseError // 检查draft name合法性 + CheckPageSize(pageSize uint32) e.ResponseError // 检查page size合法性 + SplitFullName(fullName string) (userName, repositoryName string, respErr e.ResponseError) // 分割full name + + // CheckManifestAndBlobs 检查上传的文件是否合法 + CheckManifestAndBlobs(ctx context.Context, protoManifest *modulev1alpha1.Blob, protoBlobs []*modulev1alpha1.Blob) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) +} + +func NewValidator() Validator { + return &ValidatorImpl{} +} + +type ValidatorImpl struct{} + +func (validator *ValidatorImpl) CheckUserName(username string) e.ResponseError { + err := validator.doCheckByLengthAndPattern(username, constant.MinUserNameLength, constant.MaxUserNameLength, constant.UserNamePattern) + if err != nil { + return e.NewInvalidArgumentError(err) + } + + return nil +} + +func (validator *ValidatorImpl) CheckPassword(password string) e.ResponseError { + err := validator.doCheckByLengthAndPattern(password, constant.MinPasswordLength, constant.MaxPasswordLength, constant.PasswordPattern) + if err != nil { + return e.NewInvalidArgumentError(err) + } + + return nil +} + +func (validator *ValidatorImpl) CheckRepositoryName(repositoryName string) e.ResponseError { + err := validator.doCheckByLengthAndPattern(repositoryName, constant.MinRepositoryNameLength, constant.MaxRepositoryNameLength, constant.RepositoryNamePattern) + if err != nil { + return e.NewInvalidArgumentError(err) + } + + return nil +} + +func (validator *ValidatorImpl) CheckTagName(tagName string) e.ResponseError { + err := validator.doCheckByLengthAndPattern(tagName, constant.MinTagLength, constant.MaxTagLength, constant.TagPattern) + if err != nil { + return e.NewInvalidArgumentError(err) + } + + return nil +} + +func (validator *ValidatorImpl) CheckDraftName(draftName string) e.ResponseError { + if draftName == constant.DefaultBranch { // draft name不能为 main + return e.NewInvalidArgumentError(fmt.Errorf("draft (can not be '%v')", constant.DefaultBranch)) + } + + err := validator.doCheckByLengthAndPattern(draftName, constant.MinDraftLength, constant.MaxDraftLength, constant.DraftPattern) + if err != nil { + return e.NewInvalidArgumentError(err) + } + + return nil +} + +func (validator *ValidatorImpl) CheckPageSize(pageSize uint32) e.ResponseError { + if pageSize < constant.MinPageSize || pageSize > constant.MaxPageSize { + return e.NewInvalidArgumentError(fmt.Errorf("page size: length is limited between %v and %v", constant.MinPageSize, constant.MaxPageSize)) + } + + return nil +} + +func (validator *ValidatorImpl) SplitFullName(fullName string) (userName, repositoryName string, respErr e.ResponseError) { + split := strings.SplitN(fullName, "/", 2) + if len(split) != 2 { + respErr = e.NewInvalidArgumentError(errors.New("full name")) + return + } + + ok := split[0] != "" && split[1] != "" + if !ok { + respErr = e.NewInvalidArgumentError(errors.New("full name")) + return + } + + userName, repositoryName = split[0], split[1] + return userName, repositoryName, nil +} + +func (validator *ValidatorImpl) doCheckByLengthAndPattern(str string, minLength, maxLength int, pattern string) error { + // 长度检查 + if len(str) < minLength || len(str) > maxLength { + return fmt.Errorf("length is limited between %v and %v", minLength, maxLength) + } + + // 正则匹配 + match, _ := regexp.MatchString(pattern, str) + if !match { + return fmt.Errorf("pattern dont math %s", pattern) + } + + return nil +} + +func (validator *ValidatorImpl) CheckManifestAndBlobs(ctx context.Context, protoManifest *modulev1alpha1.Blob, protoBlobs []*modulev1alpha1.Blob) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) { + // 读取文件清单 + fileManifest, err := bufmanifest.NewManifestFromProto(ctx, protoManifest) + if err != nil { + return nil, nil, e.NewInvalidArgumentError(err) + } + if fileManifest.Empty() { + // 不允许上次空的commit + return nil, nil, e.NewInvalidArgumentError(errors.New("no files")) + } + + // 读取文件列表 + blobSet, err := bufmanifest.NewBlobSetFromProto(ctx, protoBlobs) + if err != nil { + return nil, nil, e.NewInvalidArgumentError(err) + } + + // 检查文件清单和blobs + externalPaths := []string{ + buflock.ExternalConfigFilePath, + bufmodule.LicenseFilePath, + } + externalPaths = append(externalPaths, bufmodule.AllDocumentationPaths...) + externalPaths = append(externalPaths, bufconfig.AllConfigFilePaths...) + err = fileManifest.Range(func(path string, digest manifest2.Digest) error { + _, ok := blobSet.BlobFor(digest.String()) + if !ok { + // 文件清单中有的文件,在file blobs中没有 + return errors.New("check manifest and file blobs failed") + } + + // 仅仅允许上传.proto、readme、license、配置文件 + if !strings.HasSuffix(path, ".proto") { + unexpected := true + for _, externalPath := range externalPaths { + if path == externalPath { + unexpected = false + break + } + } + + if unexpected { + return errors.New("only allow update .proto、readme、license、bufman config file") + } + } + + return nil + }) + if err != nil { + return nil, nil, e.NewInvalidArgumentError(err) + } + + return fileManifest, blobSet, nil +} diff --git a/pkg/bufman/dal/commits.gen.go b/pkg/bufman/dal/commits.gen.go new file mode 100644 index 000000000..e3032b365 --- /dev/null +++ b/pkg/bufman/dal/commits.gen.go @@ -0,0 +1,668 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +func newCommit(db *gorm.DB, opts ...gen.DOOption) commit { + _commit := commit{} + + _commit.commitDo.UseDB(db, opts...) + _commit.commitDo.UseModel(&model.Commit{}) + + tableName := _commit.commitDo.TableName() + _commit.ALL = field.NewAsterisk(tableName) + _commit.ID = field.NewInt64(tableName, "id") + _commit.UserID = field.NewString(tableName, "user_id") + _commit.UserName = field.NewString(tableName, "user_name") + _commit.RepositoryID = field.NewString(tableName, "repository_id") + _commit.RepositoryName = field.NewString(tableName, "repository_name") + _commit.CommitID = field.NewString(tableName, "commit_id") + _commit.CommitName = field.NewString(tableName, "commit_name") + _commit.DraftName = field.NewString(tableName, "draft_name") + _commit.CreatedTime = field.NewTime(tableName, "created_time") + _commit.ManifestDigest = field.NewString(tableName, "manifest_digest") + _commit.BufManConfigDigest = field.NewString(tableName, "buf_man_config_digest") + _commit.DocumentDigest = field.NewString(tableName, "document_digest") + _commit.LicenseDigest = field.NewString(tableName, "license_digest") + _commit.SequenceID = field.NewInt64(tableName, "sequence_id") + _commit.FileManifest = commitHasOneFileManifest{ + db: db.Session(&gorm.Session{}), + + RelationField: field.NewRelation("FileManifest", "model.FileManifest"), + } + + _commit.FileBlobs = commitHasManyFileBlobs{ + db: db.Session(&gorm.Session{}), + + RelationField: field.NewRelation("FileBlobs", "model.FileBlobs"), + } + + _commit.Tags = commitHasManyTags{ + db: db.Session(&gorm.Session{}), + + RelationField: field.NewRelation("Tags", "model.Tags"), + } + + _commit.fillFieldMap() + + return _commit +} + +type commit struct { + commitDo + + ALL field.Asterisk + ID field.Int64 + UserID field.String + UserName field.String + RepositoryID field.String + RepositoryName field.String + CommitID field.String + CommitName field.String + DraftName field.String + CreatedTime field.Time + ManifestDigest field.String + BufManConfigDigest field.String + DocumentDigest field.String + LicenseDigest field.String + SequenceID field.Int64 + FileManifest commitHasOneFileManifest + + FileBlobs commitHasManyFileBlobs + + Tags commitHasManyTags + + fieldMap map[string]field.Expr +} + +func (c commit) Table(newTableName string) *commit { + c.commitDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c commit) As(alias string) *commit { + c.commitDo.DO = *(c.commitDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *commit) updateTableName(table string) *commit { + c.ALL = field.NewAsterisk(table) + c.ID = field.NewInt64(table, "id") + c.UserID = field.NewString(table, "user_id") + c.UserName = field.NewString(table, "user_name") + c.RepositoryID = field.NewString(table, "repository_id") + c.RepositoryName = field.NewString(table, "repository_name") + c.CommitID = field.NewString(table, "commit_id") + c.CommitName = field.NewString(table, "commit_name") + c.DraftName = field.NewString(table, "draft_name") + c.CreatedTime = field.NewTime(table, "created_time") + c.ManifestDigest = field.NewString(table, "manifest_digest") + c.BufManConfigDigest = field.NewString(table, "buf_man_config_digest") + c.DocumentDigest = field.NewString(table, "document_digest") + c.LicenseDigest = field.NewString(table, "license_digest") + c.SequenceID = field.NewInt64(table, "sequence_id") + + c.fillFieldMap() + + return c +} + +func (c *commit) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := c.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (c *commit) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 17) + c.fieldMap["id"] = c.ID + c.fieldMap["user_id"] = c.UserID + c.fieldMap["user_name"] = c.UserName + c.fieldMap["repository_id"] = c.RepositoryID + c.fieldMap["repository_name"] = c.RepositoryName + c.fieldMap["commit_id"] = c.CommitID + c.fieldMap["commit_name"] = c.CommitName + c.fieldMap["draft_name"] = c.DraftName + c.fieldMap["created_time"] = c.CreatedTime + c.fieldMap["manifest_digest"] = c.ManifestDigest + c.fieldMap["buf_man_config_digest"] = c.BufManConfigDigest + c.fieldMap["document_digest"] = c.DocumentDigest + c.fieldMap["license_digest"] = c.LicenseDigest + c.fieldMap["sequence_id"] = c.SequenceID + +} + +func (c commit) clone(db *gorm.DB) commit { + c.commitDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c commit) replaceDB(db *gorm.DB) commit { + c.commitDo.ReplaceDB(db) + return c +} + +type commitHasOneFileManifest struct { + db *gorm.DB + + field.RelationField +} + +func (a commitHasOneFileManifest) Where(conds ...field.Expr) *commitHasOneFileManifest { + if len(conds) == 0 { + return &a + } + + exprs := make([]clause.Expression, 0, len(conds)) + for _, cond := range conds { + exprs = append(exprs, cond.BeCond().(clause.Expression)) + } + a.db = a.db.Clauses(clause.Where{Exprs: exprs}) + return &a +} + +func (a commitHasOneFileManifest) WithContext(ctx context.Context) *commitHasOneFileManifest { + a.db = a.db.WithContext(ctx) + return &a +} + +func (a commitHasOneFileManifest) Session(session *gorm.Session) *commitHasOneFileManifest { + a.db = a.db.Session(session) + return &a +} + +func (a commitHasOneFileManifest) Model(m *model.Commit) *commitHasOneFileManifestTx { + return &commitHasOneFileManifestTx{a.db.Model(m).Association(a.Name())} +} + +type commitHasOneFileManifestTx struct{ tx *gorm.Association } + +func (a commitHasOneFileManifestTx) Find() (result *model.FileManifest, err error) { + return result, a.tx.Find(&result) +} + +func (a commitHasOneFileManifestTx) Append(values ...*model.FileManifest) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Append(targetValues...) +} + +func (a commitHasOneFileManifestTx) Replace(values ...*model.FileManifest) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Replace(targetValues...) +} + +func (a commitHasOneFileManifestTx) Delete(values ...*model.FileManifest) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Delete(targetValues...) +} + +func (a commitHasOneFileManifestTx) Clear() error { + return a.tx.Clear() +} + +func (a commitHasOneFileManifestTx) Count() int64 { + return a.tx.Count() +} + +type commitHasManyFileBlobs struct { + db *gorm.DB + + field.RelationField +} + +func (a commitHasManyFileBlobs) Where(conds ...field.Expr) *commitHasManyFileBlobs { + if len(conds) == 0 { + return &a + } + + exprs := make([]clause.Expression, 0, len(conds)) + for _, cond := range conds { + exprs = append(exprs, cond.BeCond().(clause.Expression)) + } + a.db = a.db.Clauses(clause.Where{Exprs: exprs}) + return &a +} + +func (a commitHasManyFileBlobs) WithContext(ctx context.Context) *commitHasManyFileBlobs { + a.db = a.db.WithContext(ctx) + return &a +} + +func (a commitHasManyFileBlobs) Session(session *gorm.Session) *commitHasManyFileBlobs { + a.db = a.db.Session(session) + return &a +} + +func (a commitHasManyFileBlobs) Model(m *model.Commit) *commitHasManyFileBlobsTx { + return &commitHasManyFileBlobsTx{a.db.Model(m).Association(a.Name())} +} + +type commitHasManyFileBlobsTx struct{ tx *gorm.Association } + +func (a commitHasManyFileBlobsTx) Find() (result []*model.FileBlobs, err error) { + return result, a.tx.Find(&result) +} + +func (a commitHasManyFileBlobsTx) Append(values ...*model.FileBlobs) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Append(targetValues...) +} + +func (a commitHasManyFileBlobsTx) Replace(values ...*model.FileBlobs) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Replace(targetValues...) +} + +func (a commitHasManyFileBlobsTx) Delete(values ...*model.FileBlobs) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Delete(targetValues...) +} + +func (a commitHasManyFileBlobsTx) Clear() error { + return a.tx.Clear() +} + +func (a commitHasManyFileBlobsTx) Count() int64 { + return a.tx.Count() +} + +type commitHasManyTags struct { + db *gorm.DB + + field.RelationField +} + +func (a commitHasManyTags) Where(conds ...field.Expr) *commitHasManyTags { + if len(conds) == 0 { + return &a + } + + exprs := make([]clause.Expression, 0, len(conds)) + for _, cond := range conds { + exprs = append(exprs, cond.BeCond().(clause.Expression)) + } + a.db = a.db.Clauses(clause.Where{Exprs: exprs}) + return &a +} + +func (a commitHasManyTags) WithContext(ctx context.Context) *commitHasManyTags { + a.db = a.db.WithContext(ctx) + return &a +} + +func (a commitHasManyTags) Session(session *gorm.Session) *commitHasManyTags { + a.db = a.db.Session(session) + return &a +} + +func (a commitHasManyTags) Model(m *model.Commit) *commitHasManyTagsTx { + return &commitHasManyTagsTx{a.db.Model(m).Association(a.Name())} +} + +type commitHasManyTagsTx struct{ tx *gorm.Association } + +func (a commitHasManyTagsTx) Find() (result []*model.Tags, err error) { + return result, a.tx.Find(&result) +} + +func (a commitHasManyTagsTx) Append(values ...*model.Tags) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Append(targetValues...) +} + +func (a commitHasManyTagsTx) Replace(values ...*model.Tags) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Replace(targetValues...) +} + +func (a commitHasManyTagsTx) Delete(values ...*model.Tags) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Delete(targetValues...) +} + +func (a commitHasManyTagsTx) Clear() error { + return a.tx.Clear() +} + +func (a commitHasManyTagsTx) Count() int64 { + return a.tx.Count() +} + +type commitDo struct{ gen.DO } + +type ICommitDo interface { + gen.SubQuery + Debug() ICommitDo + WithContext(ctx context.Context) ICommitDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ICommitDo + WriteDB() ICommitDo + As(alias string) gen.Dao + Session(config *gorm.Session) ICommitDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ICommitDo + Not(conds ...gen.Condition) ICommitDo + Or(conds ...gen.Condition) ICommitDo + Select(conds ...field.Expr) ICommitDo + Where(conds ...gen.Condition) ICommitDo + Order(conds ...field.Expr) ICommitDo + Distinct(cols ...field.Expr) ICommitDo + Omit(cols ...field.Expr) ICommitDo + Join(table schema.Tabler, on ...field.Expr) ICommitDo + LeftJoin(table schema.Tabler, on ...field.Expr) ICommitDo + RightJoin(table schema.Tabler, on ...field.Expr) ICommitDo + Group(cols ...field.Expr) ICommitDo + Having(conds ...gen.Condition) ICommitDo + Limit(limit int) ICommitDo + Offset(offset int) ICommitDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ICommitDo + Unscoped() ICommitDo + Create(values ...*model.Commit) error + CreateInBatches(values []*model.Commit, batchSize int) error + Save(values ...*model.Commit) error + First() (*model.Commit, error) + Take() (*model.Commit, error) + Last() (*model.Commit, error) + Find() ([]*model.Commit, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Commit, err error) + FindInBatches(result *[]*model.Commit, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.Commit) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ICommitDo + Assign(attrs ...field.AssignExpr) ICommitDo + Joins(fields ...field.RelationField) ICommitDo + Preload(fields ...field.RelationField) ICommitDo + FirstOrInit() (*model.Commit, error) + FirstOrCreate() (*model.Commit, error) + FindByPage(offset int, limit int) (result []*model.Commit, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ICommitDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (c commitDo) Debug() ICommitDo { + return c.withDO(c.DO.Debug()) +} + +func (c commitDo) WithContext(ctx context.Context) ICommitDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c commitDo) ReadDB() ICommitDo { + return c.Clauses(dbresolver.Read) +} + +func (c commitDo) WriteDB() ICommitDo { + return c.Clauses(dbresolver.Write) +} + +func (c commitDo) Session(config *gorm.Session) ICommitDo { + return c.withDO(c.DO.Session(config)) +} + +func (c commitDo) Clauses(conds ...clause.Expression) ICommitDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c commitDo) Returning(value interface{}, columns ...string) ICommitDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c commitDo) Not(conds ...gen.Condition) ICommitDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c commitDo) Or(conds ...gen.Condition) ICommitDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c commitDo) Select(conds ...field.Expr) ICommitDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c commitDo) Where(conds ...gen.Condition) ICommitDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c commitDo) Order(conds ...field.Expr) ICommitDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c commitDo) Distinct(cols ...field.Expr) ICommitDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c commitDo) Omit(cols ...field.Expr) ICommitDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c commitDo) Join(table schema.Tabler, on ...field.Expr) ICommitDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c commitDo) LeftJoin(table schema.Tabler, on ...field.Expr) ICommitDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c commitDo) RightJoin(table schema.Tabler, on ...field.Expr) ICommitDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c commitDo) Group(cols ...field.Expr) ICommitDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c commitDo) Having(conds ...gen.Condition) ICommitDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c commitDo) Limit(limit int) ICommitDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c commitDo) Offset(offset int) ICommitDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c commitDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ICommitDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c commitDo) Unscoped() ICommitDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c commitDo) Create(values ...*model.Commit) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c commitDo) CreateInBatches(values []*model.Commit, batchSize int) error { + return c.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (c commitDo) Save(values ...*model.Commit) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c commitDo) First() (*model.Commit, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.Commit), nil + } +} + +func (c commitDo) Take() (*model.Commit, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.Commit), nil + } +} + +func (c commitDo) Last() (*model.Commit, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.Commit), nil + } +} + +func (c commitDo) Find() ([]*model.Commit, error) { + result, err := c.DO.Find() + return result.([]*model.Commit), err +} + +func (c commitDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Commit, err error) { + buf := make([]*model.Commit, 0, batchSize) + err = c.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (c commitDo) FindInBatches(result *[]*model.Commit, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c commitDo) Attrs(attrs ...field.AssignExpr) ICommitDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c commitDo) Assign(attrs ...field.AssignExpr) ICommitDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c commitDo) Joins(fields ...field.RelationField) ICommitDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c commitDo) Preload(fields ...field.RelationField) ICommitDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c commitDo) FirstOrInit() (*model.Commit, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.Commit), nil + } +} + +func (c commitDo) FirstOrCreate() (*model.Commit, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.Commit), nil + } +} + +func (c commitDo) FindByPage(offset int, limit int) (result []*model.Commit, count int64, err error) { + result, err = c.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = c.Offset(-1).Limit(-1).Count() + return +} + +func (c commitDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = c.Count() + if err != nil { + return + } + + err = c.Offset(offset).Limit(limit).Scan(result) + return +} + +func (c commitDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c commitDo) Delete(models ...*model.Commit) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *commitDo) withDO(do gen.Dao) *commitDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/pkg/bufman/dal/file_blobs.gen.go b/pkg/bufman/dal/file_blobs.gen.go new file mode 100644 index 000000000..a9b3122e5 --- /dev/null +++ b/pkg/bufman/dal/file_blobs.gen.go @@ -0,0 +1,392 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +func newFileBlob(db *gorm.DB, opts ...gen.DOOption) fileBlob { + _fileBlob := fileBlob{} + + _fileBlob.fileBlobDo.UseDB(db, opts...) + _fileBlob.fileBlobDo.UseModel(&model.FileBlob{}) + + tableName := _fileBlob.fileBlobDo.TableName() + _fileBlob.ALL = field.NewAsterisk(tableName) + _fileBlob.ID = field.NewInt64(tableName, "id") + _fileBlob.Digest = field.NewString(tableName, "digest") + _fileBlob.CommitID = field.NewString(tableName, "commit_id") + _fileBlob.FileName = field.NewString(tableName, "file_name") + + _fileBlob.fillFieldMap() + + return _fileBlob +} + +type fileBlob struct { + fileBlobDo + + ALL field.Asterisk + ID field.Int64 + Digest field.String + CommitID field.String + FileName field.String + + fieldMap map[string]field.Expr +} + +func (f fileBlob) Table(newTableName string) *fileBlob { + f.fileBlobDo.UseTable(newTableName) + return f.updateTableName(newTableName) +} + +func (f fileBlob) As(alias string) *fileBlob { + f.fileBlobDo.DO = *(f.fileBlobDo.As(alias).(*gen.DO)) + return f.updateTableName(alias) +} + +func (f *fileBlob) updateTableName(table string) *fileBlob { + f.ALL = field.NewAsterisk(table) + f.ID = field.NewInt64(table, "id") + f.Digest = field.NewString(table, "digest") + f.CommitID = field.NewString(table, "commit_id") + f.FileName = field.NewString(table, "file_name") + + f.fillFieldMap() + + return f +} + +func (f *fileBlob) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := f.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (f *fileBlob) fillFieldMap() { + f.fieldMap = make(map[string]field.Expr, 4) + f.fieldMap["id"] = f.ID + f.fieldMap["digest"] = f.Digest + f.fieldMap["commit_id"] = f.CommitID + f.fieldMap["file_name"] = f.FileName +} + +func (f fileBlob) clone(db *gorm.DB) fileBlob { + f.fileBlobDo.ReplaceConnPool(db.Statement.ConnPool) + return f +} + +func (f fileBlob) replaceDB(db *gorm.DB) fileBlob { + f.fileBlobDo.ReplaceDB(db) + return f +} + +type fileBlobDo struct{ gen.DO } + +type IFileBlobDo interface { + gen.SubQuery + Debug() IFileBlobDo + WithContext(ctx context.Context) IFileBlobDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IFileBlobDo + WriteDB() IFileBlobDo + As(alias string) gen.Dao + Session(config *gorm.Session) IFileBlobDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IFileBlobDo + Not(conds ...gen.Condition) IFileBlobDo + Or(conds ...gen.Condition) IFileBlobDo + Select(conds ...field.Expr) IFileBlobDo + Where(conds ...gen.Condition) IFileBlobDo + Order(conds ...field.Expr) IFileBlobDo + Distinct(cols ...field.Expr) IFileBlobDo + Omit(cols ...field.Expr) IFileBlobDo + Join(table schema.Tabler, on ...field.Expr) IFileBlobDo + LeftJoin(table schema.Tabler, on ...field.Expr) IFileBlobDo + RightJoin(table schema.Tabler, on ...field.Expr) IFileBlobDo + Group(cols ...field.Expr) IFileBlobDo + Having(conds ...gen.Condition) IFileBlobDo + Limit(limit int) IFileBlobDo + Offset(offset int) IFileBlobDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IFileBlobDo + Unscoped() IFileBlobDo + Create(values ...*model.FileBlob) error + CreateInBatches(values []*model.FileBlob, batchSize int) error + Save(values ...*model.FileBlob) error + First() (*model.FileBlob, error) + Take() (*model.FileBlob, error) + Last() (*model.FileBlob, error) + Find() ([]*model.FileBlob, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FileBlob, err error) + FindInBatches(result *[]*model.FileBlob, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.FileBlob) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IFileBlobDo + Assign(attrs ...field.AssignExpr) IFileBlobDo + Joins(fields ...field.RelationField) IFileBlobDo + Preload(fields ...field.RelationField) IFileBlobDo + FirstOrInit() (*model.FileBlob, error) + FirstOrCreate() (*model.FileBlob, error) + FindByPage(offset int, limit int) (result []*model.FileBlob, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IFileBlobDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (f fileBlobDo) Debug() IFileBlobDo { + return f.withDO(f.DO.Debug()) +} + +func (f fileBlobDo) WithContext(ctx context.Context) IFileBlobDo { + return f.withDO(f.DO.WithContext(ctx)) +} + +func (f fileBlobDo) ReadDB() IFileBlobDo { + return f.Clauses(dbresolver.Read) +} + +func (f fileBlobDo) WriteDB() IFileBlobDo { + return f.Clauses(dbresolver.Write) +} + +func (f fileBlobDo) Session(config *gorm.Session) IFileBlobDo { + return f.withDO(f.DO.Session(config)) +} + +func (f fileBlobDo) Clauses(conds ...clause.Expression) IFileBlobDo { + return f.withDO(f.DO.Clauses(conds...)) +} + +func (f fileBlobDo) Returning(value interface{}, columns ...string) IFileBlobDo { + return f.withDO(f.DO.Returning(value, columns...)) +} + +func (f fileBlobDo) Not(conds ...gen.Condition) IFileBlobDo { + return f.withDO(f.DO.Not(conds...)) +} + +func (f fileBlobDo) Or(conds ...gen.Condition) IFileBlobDo { + return f.withDO(f.DO.Or(conds...)) +} + +func (f fileBlobDo) Select(conds ...field.Expr) IFileBlobDo { + return f.withDO(f.DO.Select(conds...)) +} + +func (f fileBlobDo) Where(conds ...gen.Condition) IFileBlobDo { + return f.withDO(f.DO.Where(conds...)) +} + +func (f fileBlobDo) Order(conds ...field.Expr) IFileBlobDo { + return f.withDO(f.DO.Order(conds...)) +} + +func (f fileBlobDo) Distinct(cols ...field.Expr) IFileBlobDo { + return f.withDO(f.DO.Distinct(cols...)) +} + +func (f fileBlobDo) Omit(cols ...field.Expr) IFileBlobDo { + return f.withDO(f.DO.Omit(cols...)) +} + +func (f fileBlobDo) Join(table schema.Tabler, on ...field.Expr) IFileBlobDo { + return f.withDO(f.DO.Join(table, on...)) +} + +func (f fileBlobDo) LeftJoin(table schema.Tabler, on ...field.Expr) IFileBlobDo { + return f.withDO(f.DO.LeftJoin(table, on...)) +} + +func (f fileBlobDo) RightJoin(table schema.Tabler, on ...field.Expr) IFileBlobDo { + return f.withDO(f.DO.RightJoin(table, on...)) +} + +func (f fileBlobDo) Group(cols ...field.Expr) IFileBlobDo { + return f.withDO(f.DO.Group(cols...)) +} + +func (f fileBlobDo) Having(conds ...gen.Condition) IFileBlobDo { + return f.withDO(f.DO.Having(conds...)) +} + +func (f fileBlobDo) Limit(limit int) IFileBlobDo { + return f.withDO(f.DO.Limit(limit)) +} + +func (f fileBlobDo) Offset(offset int) IFileBlobDo { + return f.withDO(f.DO.Offset(offset)) +} + +func (f fileBlobDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IFileBlobDo { + return f.withDO(f.DO.Scopes(funcs...)) +} + +func (f fileBlobDo) Unscoped() IFileBlobDo { + return f.withDO(f.DO.Unscoped()) +} + +func (f fileBlobDo) Create(values ...*model.FileBlob) error { + if len(values) == 0 { + return nil + } + return f.DO.Create(values) +} + +func (f fileBlobDo) CreateInBatches(values []*model.FileBlob, batchSize int) error { + return f.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (f fileBlobDo) Save(values ...*model.FileBlob) error { + if len(values) == 0 { + return nil + } + return f.DO.Save(values) +} + +func (f fileBlobDo) First() (*model.FileBlob, error) { + if result, err := f.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.FileBlob), nil + } +} + +func (f fileBlobDo) Take() (*model.FileBlob, error) { + if result, err := f.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.FileBlob), nil + } +} + +func (f fileBlobDo) Last() (*model.FileBlob, error) { + if result, err := f.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.FileBlob), nil + } +} + +func (f fileBlobDo) Find() ([]*model.FileBlob, error) { + result, err := f.DO.Find() + return result.([]*model.FileBlob), err +} + +func (f fileBlobDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FileBlob, err error) { + buf := make([]*model.FileBlob, 0, batchSize) + err = f.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (f fileBlobDo) FindInBatches(result *[]*model.FileBlob, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return f.DO.FindInBatches(result, batchSize, fc) +} + +func (f fileBlobDo) Attrs(attrs ...field.AssignExpr) IFileBlobDo { + return f.withDO(f.DO.Attrs(attrs...)) +} + +func (f fileBlobDo) Assign(attrs ...field.AssignExpr) IFileBlobDo { + return f.withDO(f.DO.Assign(attrs...)) +} + +func (f fileBlobDo) Joins(fields ...field.RelationField) IFileBlobDo { + for _, _f := range fields { + f = *f.withDO(f.DO.Joins(_f)) + } + return &f +} + +func (f fileBlobDo) Preload(fields ...field.RelationField) IFileBlobDo { + for _, _f := range fields { + f = *f.withDO(f.DO.Preload(_f)) + } + return &f +} + +func (f fileBlobDo) FirstOrInit() (*model.FileBlob, error) { + if result, err := f.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.FileBlob), nil + } +} + +func (f fileBlobDo) FirstOrCreate() (*model.FileBlob, error) { + if result, err := f.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.FileBlob), nil + } +} + +func (f fileBlobDo) FindByPage(offset int, limit int) (result []*model.FileBlob, count int64, err error) { + result, err = f.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = f.Offset(-1).Limit(-1).Count() + return +} + +func (f fileBlobDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = f.Count() + if err != nil { + return + } + + err = f.Offset(offset).Limit(limit).Scan(result) + return +} + +func (f fileBlobDo) Scan(result interface{}) (err error) { + return f.DO.Scan(result) +} + +func (f fileBlobDo) Delete(models ...*model.FileBlob) (result gen.ResultInfo, err error) { + return f.DO.Delete(models) +} + +func (f *fileBlobDo) withDO(do gen.Dao) *fileBlobDo { + f.DO = *do.(*gen.DO) + return f +} diff --git a/pkg/bufman/dal/file_manifests.gen.go b/pkg/bufman/dal/file_manifests.gen.go new file mode 100644 index 000000000..e98e2bcec --- /dev/null +++ b/pkg/bufman/dal/file_manifests.gen.go @@ -0,0 +1,388 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +func newFileManifest(db *gorm.DB, opts ...gen.DOOption) fileManifest { + _fileManifest := fileManifest{} + + _fileManifest.fileManifestDo.UseDB(db, opts...) + _fileManifest.fileManifestDo.UseModel(&model.FileManifest{}) + + tableName := _fileManifest.fileManifestDo.TableName() + _fileManifest.ALL = field.NewAsterisk(tableName) + _fileManifest.ID = field.NewInt64(tableName, "id") + _fileManifest.Digest = field.NewString(tableName, "digest") + _fileManifest.CommitID = field.NewString(tableName, "commit_id") + + _fileManifest.fillFieldMap() + + return _fileManifest +} + +type fileManifest struct { + fileManifestDo + + ALL field.Asterisk + ID field.Int64 + Digest field.String + CommitID field.String + + fieldMap map[string]field.Expr +} + +func (f fileManifest) Table(newTableName string) *fileManifest { + f.fileManifestDo.UseTable(newTableName) + return f.updateTableName(newTableName) +} + +func (f fileManifest) As(alias string) *fileManifest { + f.fileManifestDo.DO = *(f.fileManifestDo.As(alias).(*gen.DO)) + return f.updateTableName(alias) +} + +func (f *fileManifest) updateTableName(table string) *fileManifest { + f.ALL = field.NewAsterisk(table) + f.ID = field.NewInt64(table, "id") + f.Digest = field.NewString(table, "digest") + f.CommitID = field.NewString(table, "commit_id") + + f.fillFieldMap() + + return f +} + +func (f *fileManifest) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := f.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (f *fileManifest) fillFieldMap() { + f.fieldMap = make(map[string]field.Expr, 3) + f.fieldMap["id"] = f.ID + f.fieldMap["digest"] = f.Digest + f.fieldMap["commit_id"] = f.CommitID +} + +func (f fileManifest) clone(db *gorm.DB) fileManifest { + f.fileManifestDo.ReplaceConnPool(db.Statement.ConnPool) + return f +} + +func (f fileManifest) replaceDB(db *gorm.DB) fileManifest { + f.fileManifestDo.ReplaceDB(db) + return f +} + +type fileManifestDo struct{ gen.DO } + +type IFileManifestDo interface { + gen.SubQuery + Debug() IFileManifestDo + WithContext(ctx context.Context) IFileManifestDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IFileManifestDo + WriteDB() IFileManifestDo + As(alias string) gen.Dao + Session(config *gorm.Session) IFileManifestDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IFileManifestDo + Not(conds ...gen.Condition) IFileManifestDo + Or(conds ...gen.Condition) IFileManifestDo + Select(conds ...field.Expr) IFileManifestDo + Where(conds ...gen.Condition) IFileManifestDo + Order(conds ...field.Expr) IFileManifestDo + Distinct(cols ...field.Expr) IFileManifestDo + Omit(cols ...field.Expr) IFileManifestDo + Join(table schema.Tabler, on ...field.Expr) IFileManifestDo + LeftJoin(table schema.Tabler, on ...field.Expr) IFileManifestDo + RightJoin(table schema.Tabler, on ...field.Expr) IFileManifestDo + Group(cols ...field.Expr) IFileManifestDo + Having(conds ...gen.Condition) IFileManifestDo + Limit(limit int) IFileManifestDo + Offset(offset int) IFileManifestDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IFileManifestDo + Unscoped() IFileManifestDo + Create(values ...*model.FileManifest) error + CreateInBatches(values []*model.FileManifest, batchSize int) error + Save(values ...*model.FileManifest) error + First() (*model.FileManifest, error) + Take() (*model.FileManifest, error) + Last() (*model.FileManifest, error) + Find() ([]*model.FileManifest, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FileManifest, err error) + FindInBatches(result *[]*model.FileManifest, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.FileManifest) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IFileManifestDo + Assign(attrs ...field.AssignExpr) IFileManifestDo + Joins(fields ...field.RelationField) IFileManifestDo + Preload(fields ...field.RelationField) IFileManifestDo + FirstOrInit() (*model.FileManifest, error) + FirstOrCreate() (*model.FileManifest, error) + FindByPage(offset int, limit int) (result []*model.FileManifest, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IFileManifestDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (f fileManifestDo) Debug() IFileManifestDo { + return f.withDO(f.DO.Debug()) +} + +func (f fileManifestDo) WithContext(ctx context.Context) IFileManifestDo { + return f.withDO(f.DO.WithContext(ctx)) +} + +func (f fileManifestDo) ReadDB() IFileManifestDo { + return f.Clauses(dbresolver.Read) +} + +func (f fileManifestDo) WriteDB() IFileManifestDo { + return f.Clauses(dbresolver.Write) +} + +func (f fileManifestDo) Session(config *gorm.Session) IFileManifestDo { + return f.withDO(f.DO.Session(config)) +} + +func (f fileManifestDo) Clauses(conds ...clause.Expression) IFileManifestDo { + return f.withDO(f.DO.Clauses(conds...)) +} + +func (f fileManifestDo) Returning(value interface{}, columns ...string) IFileManifestDo { + return f.withDO(f.DO.Returning(value, columns...)) +} + +func (f fileManifestDo) Not(conds ...gen.Condition) IFileManifestDo { + return f.withDO(f.DO.Not(conds...)) +} + +func (f fileManifestDo) Or(conds ...gen.Condition) IFileManifestDo { + return f.withDO(f.DO.Or(conds...)) +} + +func (f fileManifestDo) Select(conds ...field.Expr) IFileManifestDo { + return f.withDO(f.DO.Select(conds...)) +} + +func (f fileManifestDo) Where(conds ...gen.Condition) IFileManifestDo { + return f.withDO(f.DO.Where(conds...)) +} + +func (f fileManifestDo) Order(conds ...field.Expr) IFileManifestDo { + return f.withDO(f.DO.Order(conds...)) +} + +func (f fileManifestDo) Distinct(cols ...field.Expr) IFileManifestDo { + return f.withDO(f.DO.Distinct(cols...)) +} + +func (f fileManifestDo) Omit(cols ...field.Expr) IFileManifestDo { + return f.withDO(f.DO.Omit(cols...)) +} + +func (f fileManifestDo) Join(table schema.Tabler, on ...field.Expr) IFileManifestDo { + return f.withDO(f.DO.Join(table, on...)) +} + +func (f fileManifestDo) LeftJoin(table schema.Tabler, on ...field.Expr) IFileManifestDo { + return f.withDO(f.DO.LeftJoin(table, on...)) +} + +func (f fileManifestDo) RightJoin(table schema.Tabler, on ...field.Expr) IFileManifestDo { + return f.withDO(f.DO.RightJoin(table, on...)) +} + +func (f fileManifestDo) Group(cols ...field.Expr) IFileManifestDo { + return f.withDO(f.DO.Group(cols...)) +} + +func (f fileManifestDo) Having(conds ...gen.Condition) IFileManifestDo { + return f.withDO(f.DO.Having(conds...)) +} + +func (f fileManifestDo) Limit(limit int) IFileManifestDo { + return f.withDO(f.DO.Limit(limit)) +} + +func (f fileManifestDo) Offset(offset int) IFileManifestDo { + return f.withDO(f.DO.Offset(offset)) +} + +func (f fileManifestDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IFileManifestDo { + return f.withDO(f.DO.Scopes(funcs...)) +} + +func (f fileManifestDo) Unscoped() IFileManifestDo { + return f.withDO(f.DO.Unscoped()) +} + +func (f fileManifestDo) Create(values ...*model.FileManifest) error { + if len(values) == 0 { + return nil + } + return f.DO.Create(values) +} + +func (f fileManifestDo) CreateInBatches(values []*model.FileManifest, batchSize int) error { + return f.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (f fileManifestDo) Save(values ...*model.FileManifest) error { + if len(values) == 0 { + return nil + } + return f.DO.Save(values) +} + +func (f fileManifestDo) First() (*model.FileManifest, error) { + if result, err := f.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.FileManifest), nil + } +} + +func (f fileManifestDo) Take() (*model.FileManifest, error) { + if result, err := f.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.FileManifest), nil + } +} + +func (f fileManifestDo) Last() (*model.FileManifest, error) { + if result, err := f.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.FileManifest), nil + } +} + +func (f fileManifestDo) Find() ([]*model.FileManifest, error) { + result, err := f.DO.Find() + return result.([]*model.FileManifest), err +} + +func (f fileManifestDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FileManifest, err error) { + buf := make([]*model.FileManifest, 0, batchSize) + err = f.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (f fileManifestDo) FindInBatches(result *[]*model.FileManifest, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return f.DO.FindInBatches(result, batchSize, fc) +} + +func (f fileManifestDo) Attrs(attrs ...field.AssignExpr) IFileManifestDo { + return f.withDO(f.DO.Attrs(attrs...)) +} + +func (f fileManifestDo) Assign(attrs ...field.AssignExpr) IFileManifestDo { + return f.withDO(f.DO.Assign(attrs...)) +} + +func (f fileManifestDo) Joins(fields ...field.RelationField) IFileManifestDo { + for _, _f := range fields { + f = *f.withDO(f.DO.Joins(_f)) + } + return &f +} + +func (f fileManifestDo) Preload(fields ...field.RelationField) IFileManifestDo { + for _, _f := range fields { + f = *f.withDO(f.DO.Preload(_f)) + } + return &f +} + +func (f fileManifestDo) FirstOrInit() (*model.FileManifest, error) { + if result, err := f.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.FileManifest), nil + } +} + +func (f fileManifestDo) FirstOrCreate() (*model.FileManifest, error) { + if result, err := f.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.FileManifest), nil + } +} + +func (f fileManifestDo) FindByPage(offset int, limit int) (result []*model.FileManifest, count int64, err error) { + result, err = f.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = f.Offset(-1).Limit(-1).Count() + return +} + +func (f fileManifestDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = f.Count() + if err != nil { + return + } + + err = f.Offset(offset).Limit(limit).Scan(result) + return +} + +func (f fileManifestDo) Scan(result interface{}) (err error) { + return f.DO.Scan(result) +} + +func (f fileManifestDo) Delete(models ...*model.FileManifest) (result gen.ResultInfo, err error) { + return f.DO.Delete(models) +} + +func (f *fileManifestDo) withDO(do gen.Dao) *fileManifestDo { + f.DO = *do.(*gen.DO) + return f +} diff --git a/pkg/bufman/dal/gen.go b/pkg/bufman/dal/gen.go new file mode 100644 index 000000000..75386bcbe --- /dev/null +++ b/pkg/bufman/dal/gen.go @@ -0,0 +1,151 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + "database/sql" + + "gorm.io/gorm" + + "gorm.io/gen" + + "gorm.io/plugin/dbresolver" +) + +var ( + Q = new(Query) + Commit *commit + FileBlob *fileBlob + FileManifest *fileManifest + Repository *repository + Tag *tag + Token *token + User *user +) + +func SetDefault(db *gorm.DB, opts ...gen.DOOption) { + *Q = *Use(db, opts...) + Commit = &Q.Commit + FileBlob = &Q.FileBlob + FileManifest = &Q.FileManifest + Repository = &Q.Repository + Tag = &Q.Tag + Token = &Q.Token + User = &Q.User +} + +func Use(db *gorm.DB, opts ...gen.DOOption) *Query { + return &Query{ + db: db, + Commit: newCommit(db, opts...), + FileBlob: newFileBlob(db, opts...), + FileManifest: newFileManifest(db, opts...), + Repository: newRepository(db, opts...), + Tag: newTag(db, opts...), + Token: newToken(db, opts...), + User: newUser(db, opts...), + } +} + +type Query struct { + db *gorm.DB + + Commit commit + FileBlob fileBlob + FileManifest fileManifest + Repository repository + Tag tag + Token token + User user +} + +func (q *Query) Available() bool { return q.db != nil } + +func (q *Query) clone(db *gorm.DB) *Query { + return &Query{ + db: db, + Commit: q.Commit.clone(db), + FileBlob: q.FileBlob.clone(db), + FileManifest: q.FileManifest.clone(db), + Repository: q.Repository.clone(db), + Tag: q.Tag.clone(db), + Token: q.Token.clone(db), + User: q.User.clone(db), + } +} + +func (q *Query) ReadDB() *Query { + return q.ReplaceDB(q.db.Clauses(dbresolver.Read)) +} + +func (q *Query) WriteDB() *Query { + return q.ReplaceDB(q.db.Clauses(dbresolver.Write)) +} + +func (q *Query) ReplaceDB(db *gorm.DB) *Query { + return &Query{ + db: db, + Commit: q.Commit.replaceDB(db), + FileBlob: q.FileBlob.replaceDB(db), + FileManifest: q.FileManifest.replaceDB(db), + Repository: q.Repository.replaceDB(db), + Tag: q.Tag.replaceDB(db), + Token: q.Token.replaceDB(db), + User: q.User.replaceDB(db), + } +} + +type queryCtx struct { + Commit ICommitDo + FileBlob IFileBlobDo + FileManifest IFileManifestDo + Repository IRepositoryDo + Tag ITagDo + Token ITokenDo + User IUserDo +} + +func (q *Query) WithContext(ctx context.Context) *queryCtx { + return &queryCtx{ + Commit: q.Commit.WithContext(ctx), + FileBlob: q.FileBlob.WithContext(ctx), + FileManifest: q.FileManifest.WithContext(ctx), + Repository: q.Repository.WithContext(ctx), + Tag: q.Tag.WithContext(ctx), + Token: q.Token.WithContext(ctx), + User: q.User.WithContext(ctx), + } +} + +func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error { + return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...) +} + +func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx { + tx := q.db.Begin(opts...) + return &QueryTx{Query: q.clone(tx), Error: tx.Error} +} + +type QueryTx struct { + *Query + Error error +} + +func (q *QueryTx) Commit() error { + return q.db.Commit().Error +} + +func (q *QueryTx) Rollback() error { + return q.db.Rollback().Error +} + +func (q *QueryTx) SavePoint(name string) error { + return q.db.SavePoint(name).Error +} + +func (q *QueryTx) RollbackTo(name string) error { + return q.db.RollbackTo(name).Error +} diff --git a/pkg/bufman/dal/repositories.gen.go b/pkg/bufman/dal/repositories.gen.go new file mode 100644 index 000000000..296069b55 --- /dev/null +++ b/pkg/bufman/dal/repositories.gen.go @@ -0,0 +1,606 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +func newRepository(db *gorm.DB, opts ...gen.DOOption) repository { + _repository := repository{} + + _repository.repositoryDo.UseDB(db, opts...) + _repository.repositoryDo.UseModel(&model.Repository{}) + + tableName := _repository.repositoryDo.TableName() + _repository.ALL = field.NewAsterisk(tableName) + _repository.ID = field.NewInt64(tableName, "id") + _repository.UserID = field.NewString(tableName, "user_id") + _repository.UserName = field.NewString(tableName, "user_name") + _repository.RepositoryID = field.NewString(tableName, "repository_id") + _repository.RepositoryName = field.NewString(tableName, "repository_name") + _repository.CreatedTime = field.NewTime(tableName, "created_time") + _repository.UpdateTime = field.NewTime(tableName, "update_time") + _repository.Visibility = field.NewUint8(tableName, "visibility") + _repository.Deprecated = field.NewBool(tableName, "deprecated") + _repository.DeprecationMsg = field.NewString(tableName, "deprecation_msg") + _repository.Url = field.NewString(tableName, "url") + _repository.Description = field.NewString(tableName, "description") + _repository.DraftCommits = repositoryHasManyDraftCommits{ + db: db.Session(&gorm.Session{}), + + RelationField: field.NewRelation("DraftCommits", "model.Commit"), + FileManifest: struct { + field.RelationField + }{ + RelationField: field.NewRelation("DraftCommits.FileManifest", "model.FileManifest"), + }, + FileBlobs: struct { + field.RelationField + }{ + RelationField: field.NewRelation("DraftCommits.FileBlobs", "model.FileBlobs"), + }, + Tags: struct { + field.RelationField + }{ + RelationField: field.NewRelation("DraftCommits.Tags", "model.Tags"), + }, + } + + _repository.Tags = repositoryHasManyTags{ + db: db.Session(&gorm.Session{}), + + RelationField: field.NewRelation("Tags", "model.Tag"), + } + + _repository.fillFieldMap() + + return _repository +} + +type repository struct { + repositoryDo + + ALL field.Asterisk + ID field.Int64 + UserID field.String + UserName field.String + RepositoryID field.String + RepositoryName field.String + CreatedTime field.Time + UpdateTime field.Time + Visibility field.Uint8 + Deprecated field.Bool + DeprecationMsg field.String + Url field.String + Description field.String + DraftCommits repositoryHasManyDraftCommits + + Tags repositoryHasManyTags + + fieldMap map[string]field.Expr +} + +func (r repository) Table(newTableName string) *repository { + r.repositoryDo.UseTable(newTableName) + return r.updateTableName(newTableName) +} + +func (r repository) As(alias string) *repository { + r.repositoryDo.DO = *(r.repositoryDo.As(alias).(*gen.DO)) + return r.updateTableName(alias) +} + +func (r *repository) updateTableName(table string) *repository { + r.ALL = field.NewAsterisk(table) + r.ID = field.NewInt64(table, "id") + r.UserID = field.NewString(table, "user_id") + r.UserName = field.NewString(table, "user_name") + r.RepositoryID = field.NewString(table, "repository_id") + r.RepositoryName = field.NewString(table, "repository_name") + r.CreatedTime = field.NewTime(table, "created_time") + r.UpdateTime = field.NewTime(table, "update_time") + r.Visibility = field.NewUint8(table, "visibility") + r.Deprecated = field.NewBool(table, "deprecated") + r.DeprecationMsg = field.NewString(table, "deprecation_msg") + r.Url = field.NewString(table, "url") + r.Description = field.NewString(table, "description") + + r.fillFieldMap() + + return r +} + +func (r *repository) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := r.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (r *repository) fillFieldMap() { + r.fieldMap = make(map[string]field.Expr, 14) + r.fieldMap["id"] = r.ID + r.fieldMap["user_id"] = r.UserID + r.fieldMap["user_name"] = r.UserName + r.fieldMap["repository_id"] = r.RepositoryID + r.fieldMap["repository_name"] = r.RepositoryName + r.fieldMap["created_time"] = r.CreatedTime + r.fieldMap["update_time"] = r.UpdateTime + r.fieldMap["visibility"] = r.Visibility + r.fieldMap["deprecated"] = r.Deprecated + r.fieldMap["deprecation_msg"] = r.DeprecationMsg + r.fieldMap["url"] = r.Url + r.fieldMap["description"] = r.Description + +} + +func (r repository) clone(db *gorm.DB) repository { + r.repositoryDo.ReplaceConnPool(db.Statement.ConnPool) + return r +} + +func (r repository) replaceDB(db *gorm.DB) repository { + r.repositoryDo.ReplaceDB(db) + return r +} + +type repositoryHasManyDraftCommits struct { + db *gorm.DB + + field.RelationField + + FileManifest struct { + field.RelationField + } + FileBlobs struct { + field.RelationField + } + Tags struct { + field.RelationField + } +} + +func (a repositoryHasManyDraftCommits) Where(conds ...field.Expr) *repositoryHasManyDraftCommits { + if len(conds) == 0 { + return &a + } + + exprs := make([]clause.Expression, 0, len(conds)) + for _, cond := range conds { + exprs = append(exprs, cond.BeCond().(clause.Expression)) + } + a.db = a.db.Clauses(clause.Where{Exprs: exprs}) + return &a +} + +func (a repositoryHasManyDraftCommits) WithContext(ctx context.Context) *repositoryHasManyDraftCommits { + a.db = a.db.WithContext(ctx) + return &a +} + +func (a repositoryHasManyDraftCommits) Session(session *gorm.Session) *repositoryHasManyDraftCommits { + a.db = a.db.Session(session) + return &a +} + +func (a repositoryHasManyDraftCommits) Model(m *model.Repository) *repositoryHasManyDraftCommitsTx { + return &repositoryHasManyDraftCommitsTx{a.db.Model(m).Association(a.Name())} +} + +type repositoryHasManyDraftCommitsTx struct{ tx *gorm.Association } + +func (a repositoryHasManyDraftCommitsTx) Find() (result []*model.Commit, err error) { + return result, a.tx.Find(&result) +} + +func (a repositoryHasManyDraftCommitsTx) Append(values ...*model.Commit) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Append(targetValues...) +} + +func (a repositoryHasManyDraftCommitsTx) Replace(values ...*model.Commit) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Replace(targetValues...) +} + +func (a repositoryHasManyDraftCommitsTx) Delete(values ...*model.Commit) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Delete(targetValues...) +} + +func (a repositoryHasManyDraftCommitsTx) Clear() error { + return a.tx.Clear() +} + +func (a repositoryHasManyDraftCommitsTx) Count() int64 { + return a.tx.Count() +} + +type repositoryHasManyTags struct { + db *gorm.DB + + field.RelationField +} + +func (a repositoryHasManyTags) Where(conds ...field.Expr) *repositoryHasManyTags { + if len(conds) == 0 { + return &a + } + + exprs := make([]clause.Expression, 0, len(conds)) + for _, cond := range conds { + exprs = append(exprs, cond.BeCond().(clause.Expression)) + } + a.db = a.db.Clauses(clause.Where{Exprs: exprs}) + return &a +} + +func (a repositoryHasManyTags) WithContext(ctx context.Context) *repositoryHasManyTags { + a.db = a.db.WithContext(ctx) + return &a +} + +func (a repositoryHasManyTags) Session(session *gorm.Session) *repositoryHasManyTags { + a.db = a.db.Session(session) + return &a +} + +func (a repositoryHasManyTags) Model(m *model.Repository) *repositoryHasManyTagsTx { + return &repositoryHasManyTagsTx{a.db.Model(m).Association(a.Name())} +} + +type repositoryHasManyTagsTx struct{ tx *gorm.Association } + +func (a repositoryHasManyTagsTx) Find() (result []*model.Tag, err error) { + return result, a.tx.Find(&result) +} + +func (a repositoryHasManyTagsTx) Append(values ...*model.Tag) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Append(targetValues...) +} + +func (a repositoryHasManyTagsTx) Replace(values ...*model.Tag) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Replace(targetValues...) +} + +func (a repositoryHasManyTagsTx) Delete(values ...*model.Tag) (err error) { + targetValues := make([]interface{}, len(values)) + for i, v := range values { + targetValues[i] = v + } + return a.tx.Delete(targetValues...) +} + +func (a repositoryHasManyTagsTx) Clear() error { + return a.tx.Clear() +} + +func (a repositoryHasManyTagsTx) Count() int64 { + return a.tx.Count() +} + +type repositoryDo struct{ gen.DO } + +type IRepositoryDo interface { + gen.SubQuery + Debug() IRepositoryDo + WithContext(ctx context.Context) IRepositoryDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IRepositoryDo + WriteDB() IRepositoryDo + As(alias string) gen.Dao + Session(config *gorm.Session) IRepositoryDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IRepositoryDo + Not(conds ...gen.Condition) IRepositoryDo + Or(conds ...gen.Condition) IRepositoryDo + Select(conds ...field.Expr) IRepositoryDo + Where(conds ...gen.Condition) IRepositoryDo + Order(conds ...field.Expr) IRepositoryDo + Distinct(cols ...field.Expr) IRepositoryDo + Omit(cols ...field.Expr) IRepositoryDo + Join(table schema.Tabler, on ...field.Expr) IRepositoryDo + LeftJoin(table schema.Tabler, on ...field.Expr) IRepositoryDo + RightJoin(table schema.Tabler, on ...field.Expr) IRepositoryDo + Group(cols ...field.Expr) IRepositoryDo + Having(conds ...gen.Condition) IRepositoryDo + Limit(limit int) IRepositoryDo + Offset(offset int) IRepositoryDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IRepositoryDo + Unscoped() IRepositoryDo + Create(values ...*model.Repository) error + CreateInBatches(values []*model.Repository, batchSize int) error + Save(values ...*model.Repository) error + First() (*model.Repository, error) + Take() (*model.Repository, error) + Last() (*model.Repository, error) + Find() ([]*model.Repository, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Repository, err error) + FindInBatches(result *[]*model.Repository, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.Repository) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IRepositoryDo + Assign(attrs ...field.AssignExpr) IRepositoryDo + Joins(fields ...field.RelationField) IRepositoryDo + Preload(fields ...field.RelationField) IRepositoryDo + FirstOrInit() (*model.Repository, error) + FirstOrCreate() (*model.Repository, error) + FindByPage(offset int, limit int) (result []*model.Repository, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IRepositoryDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (r repositoryDo) Debug() IRepositoryDo { + return r.withDO(r.DO.Debug()) +} + +func (r repositoryDo) WithContext(ctx context.Context) IRepositoryDo { + return r.withDO(r.DO.WithContext(ctx)) +} + +func (r repositoryDo) ReadDB() IRepositoryDo { + return r.Clauses(dbresolver.Read) +} + +func (r repositoryDo) WriteDB() IRepositoryDo { + return r.Clauses(dbresolver.Write) +} + +func (r repositoryDo) Session(config *gorm.Session) IRepositoryDo { + return r.withDO(r.DO.Session(config)) +} + +func (r repositoryDo) Clauses(conds ...clause.Expression) IRepositoryDo { + return r.withDO(r.DO.Clauses(conds...)) +} + +func (r repositoryDo) Returning(value interface{}, columns ...string) IRepositoryDo { + return r.withDO(r.DO.Returning(value, columns...)) +} + +func (r repositoryDo) Not(conds ...gen.Condition) IRepositoryDo { + return r.withDO(r.DO.Not(conds...)) +} + +func (r repositoryDo) Or(conds ...gen.Condition) IRepositoryDo { + return r.withDO(r.DO.Or(conds...)) +} + +func (r repositoryDo) Select(conds ...field.Expr) IRepositoryDo { + return r.withDO(r.DO.Select(conds...)) +} + +func (r repositoryDo) Where(conds ...gen.Condition) IRepositoryDo { + return r.withDO(r.DO.Where(conds...)) +} + +func (r repositoryDo) Order(conds ...field.Expr) IRepositoryDo { + return r.withDO(r.DO.Order(conds...)) +} + +func (r repositoryDo) Distinct(cols ...field.Expr) IRepositoryDo { + return r.withDO(r.DO.Distinct(cols...)) +} + +func (r repositoryDo) Omit(cols ...field.Expr) IRepositoryDo { + return r.withDO(r.DO.Omit(cols...)) +} + +func (r repositoryDo) Join(table schema.Tabler, on ...field.Expr) IRepositoryDo { + return r.withDO(r.DO.Join(table, on...)) +} + +func (r repositoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) IRepositoryDo { + return r.withDO(r.DO.LeftJoin(table, on...)) +} + +func (r repositoryDo) RightJoin(table schema.Tabler, on ...field.Expr) IRepositoryDo { + return r.withDO(r.DO.RightJoin(table, on...)) +} + +func (r repositoryDo) Group(cols ...field.Expr) IRepositoryDo { + return r.withDO(r.DO.Group(cols...)) +} + +func (r repositoryDo) Having(conds ...gen.Condition) IRepositoryDo { + return r.withDO(r.DO.Having(conds...)) +} + +func (r repositoryDo) Limit(limit int) IRepositoryDo { + return r.withDO(r.DO.Limit(limit)) +} + +func (r repositoryDo) Offset(offset int) IRepositoryDo { + return r.withDO(r.DO.Offset(offset)) +} + +func (r repositoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IRepositoryDo { + return r.withDO(r.DO.Scopes(funcs...)) +} + +func (r repositoryDo) Unscoped() IRepositoryDo { + return r.withDO(r.DO.Unscoped()) +} + +func (r repositoryDo) Create(values ...*model.Repository) error { + if len(values) == 0 { + return nil + } + return r.DO.Create(values) +} + +func (r repositoryDo) CreateInBatches(values []*model.Repository, batchSize int) error { + return r.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (r repositoryDo) Save(values ...*model.Repository) error { + if len(values) == 0 { + return nil + } + return r.DO.Save(values) +} + +func (r repositoryDo) First() (*model.Repository, error) { + if result, err := r.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.Repository), nil + } +} + +func (r repositoryDo) Take() (*model.Repository, error) { + if result, err := r.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.Repository), nil + } +} + +func (r repositoryDo) Last() (*model.Repository, error) { + if result, err := r.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.Repository), nil + } +} + +func (r repositoryDo) Find() ([]*model.Repository, error) { + result, err := r.DO.Find() + return result.([]*model.Repository), err +} + +func (r repositoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Repository, err error) { + buf := make([]*model.Repository, 0, batchSize) + err = r.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (r repositoryDo) FindInBatches(result *[]*model.Repository, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return r.DO.FindInBatches(result, batchSize, fc) +} + +func (r repositoryDo) Attrs(attrs ...field.AssignExpr) IRepositoryDo { + return r.withDO(r.DO.Attrs(attrs...)) +} + +func (r repositoryDo) Assign(attrs ...field.AssignExpr) IRepositoryDo { + return r.withDO(r.DO.Assign(attrs...)) +} + +func (r repositoryDo) Joins(fields ...field.RelationField) IRepositoryDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Joins(_f)) + } + return &r +} + +func (r repositoryDo) Preload(fields ...field.RelationField) IRepositoryDo { + for _, _f := range fields { + r = *r.withDO(r.DO.Preload(_f)) + } + return &r +} + +func (r repositoryDo) FirstOrInit() (*model.Repository, error) { + if result, err := r.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.Repository), nil + } +} + +func (r repositoryDo) FirstOrCreate() (*model.Repository, error) { + if result, err := r.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.Repository), nil + } +} + +func (r repositoryDo) FindByPage(offset int, limit int) (result []*model.Repository, count int64, err error) { + result, err = r.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = r.Offset(-1).Limit(-1).Count() + return +} + +func (r repositoryDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = r.Count() + if err != nil { + return + } + + err = r.Offset(offset).Limit(limit).Scan(result) + return +} + +func (r repositoryDo) Scan(result interface{}) (err error) { + return r.DO.Scan(result) +} + +func (r repositoryDo) Delete(models ...*model.Repository) (result gen.ResultInfo, err error) { + return r.DO.Delete(models) +} + +func (r *repositoryDo) withDO(do gen.Dao) *repositoryDo { + r.DO = *do.(*gen.DO) + return r +} diff --git a/pkg/bufman/dal/tags.gen.go b/pkg/bufman/dal/tags.gen.go new file mode 100644 index 000000000..e26c68c6e --- /dev/null +++ b/pkg/bufman/dal/tags.gen.go @@ -0,0 +1,412 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +func newTag(db *gorm.DB, opts ...gen.DOOption) tag { + _tag := tag{} + + _tag.tagDo.UseDB(db, opts...) + _tag.tagDo.UseModel(&model.Tag{}) + + tableName := _tag.tagDo.TableName() + _tag.ALL = field.NewAsterisk(tableName) + _tag.ID = field.NewInt64(tableName, "id") + _tag.UserID = field.NewString(tableName, "user_id") + _tag.UserName = field.NewString(tableName, "user_name") + _tag.RepositoryID = field.NewString(tableName, "repository_id") + _tag.CommitID = field.NewString(tableName, "commit_id") + _tag.CommitName = field.NewString(tableName, "commit_name") + _tag.TagID = field.NewString(tableName, "tag_id") + _tag.CreatedTime = field.NewTime(tableName, "created_time") + _tag.TagName = field.NewString(tableName, "tag_name") + + _tag.fillFieldMap() + + return _tag +} + +type tag struct { + tagDo + + ALL field.Asterisk + ID field.Int64 + UserID field.String + UserName field.String + RepositoryID field.String + CommitID field.String + CommitName field.String + TagID field.String + CreatedTime field.Time + TagName field.String + + fieldMap map[string]field.Expr +} + +func (t tag) Table(newTableName string) *tag { + t.tagDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t tag) As(alias string) *tag { + t.tagDo.DO = *(t.tagDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *tag) updateTableName(table string) *tag { + t.ALL = field.NewAsterisk(table) + t.ID = field.NewInt64(table, "id") + t.UserID = field.NewString(table, "user_id") + t.UserName = field.NewString(table, "user_name") + t.RepositoryID = field.NewString(table, "repository_id") + t.CommitID = field.NewString(table, "commit_id") + t.CommitName = field.NewString(table, "commit_name") + t.TagID = field.NewString(table, "tag_id") + t.CreatedTime = field.NewTime(table, "created_time") + t.TagName = field.NewString(table, "tag_name") + + t.fillFieldMap() + + return t +} + +func (t *tag) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *tag) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 9) + t.fieldMap["id"] = t.ID + t.fieldMap["user_id"] = t.UserID + t.fieldMap["user_name"] = t.UserName + t.fieldMap["repository_id"] = t.RepositoryID + t.fieldMap["commit_id"] = t.CommitID + t.fieldMap["commit_name"] = t.CommitName + t.fieldMap["tag_id"] = t.TagID + t.fieldMap["created_time"] = t.CreatedTime + t.fieldMap["tag_name"] = t.TagName +} + +func (t tag) clone(db *gorm.DB) tag { + t.tagDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t tag) replaceDB(db *gorm.DB) tag { + t.tagDo.ReplaceDB(db) + return t +} + +type tagDo struct{ gen.DO } + +type ITagDo interface { + gen.SubQuery + Debug() ITagDo + WithContext(ctx context.Context) ITagDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ITagDo + WriteDB() ITagDo + As(alias string) gen.Dao + Session(config *gorm.Session) ITagDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ITagDo + Not(conds ...gen.Condition) ITagDo + Or(conds ...gen.Condition) ITagDo + Select(conds ...field.Expr) ITagDo + Where(conds ...gen.Condition) ITagDo + Order(conds ...field.Expr) ITagDo + Distinct(cols ...field.Expr) ITagDo + Omit(cols ...field.Expr) ITagDo + Join(table schema.Tabler, on ...field.Expr) ITagDo + LeftJoin(table schema.Tabler, on ...field.Expr) ITagDo + RightJoin(table schema.Tabler, on ...field.Expr) ITagDo + Group(cols ...field.Expr) ITagDo + Having(conds ...gen.Condition) ITagDo + Limit(limit int) ITagDo + Offset(offset int) ITagDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ITagDo + Unscoped() ITagDo + Create(values ...*model.Tag) error + CreateInBatches(values []*model.Tag, batchSize int) error + Save(values ...*model.Tag) error + First() (*model.Tag, error) + Take() (*model.Tag, error) + Last() (*model.Tag, error) + Find() ([]*model.Tag, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Tag, err error) + FindInBatches(result *[]*model.Tag, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.Tag) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ITagDo + Assign(attrs ...field.AssignExpr) ITagDo + Joins(fields ...field.RelationField) ITagDo + Preload(fields ...field.RelationField) ITagDo + FirstOrInit() (*model.Tag, error) + FirstOrCreate() (*model.Tag, error) + FindByPage(offset int, limit int) (result []*model.Tag, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ITagDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (t tagDo) Debug() ITagDo { + return t.withDO(t.DO.Debug()) +} + +func (t tagDo) WithContext(ctx context.Context) ITagDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t tagDo) ReadDB() ITagDo { + return t.Clauses(dbresolver.Read) +} + +func (t tagDo) WriteDB() ITagDo { + return t.Clauses(dbresolver.Write) +} + +func (t tagDo) Session(config *gorm.Session) ITagDo { + return t.withDO(t.DO.Session(config)) +} + +func (t tagDo) Clauses(conds ...clause.Expression) ITagDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t tagDo) Returning(value interface{}, columns ...string) ITagDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t tagDo) Not(conds ...gen.Condition) ITagDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t tagDo) Or(conds ...gen.Condition) ITagDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t tagDo) Select(conds ...field.Expr) ITagDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t tagDo) Where(conds ...gen.Condition) ITagDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t tagDo) Order(conds ...field.Expr) ITagDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t tagDo) Distinct(cols ...field.Expr) ITagDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t tagDo) Omit(cols ...field.Expr) ITagDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t tagDo) Join(table schema.Tabler, on ...field.Expr) ITagDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t tagDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITagDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t tagDo) RightJoin(table schema.Tabler, on ...field.Expr) ITagDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t tagDo) Group(cols ...field.Expr) ITagDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t tagDo) Having(conds ...gen.Condition) ITagDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t tagDo) Limit(limit int) ITagDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t tagDo) Offset(offset int) ITagDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t tagDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITagDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t tagDo) Unscoped() ITagDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t tagDo) Create(values ...*model.Tag) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t tagDo) CreateInBatches(values []*model.Tag, batchSize int) error { + return t.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (t tagDo) Save(values ...*model.Tag) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t tagDo) First() (*model.Tag, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.Tag), nil + } +} + +func (t tagDo) Take() (*model.Tag, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.Tag), nil + } +} + +func (t tagDo) Last() (*model.Tag, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.Tag), nil + } +} + +func (t tagDo) Find() ([]*model.Tag, error) { + result, err := t.DO.Find() + return result.([]*model.Tag), err +} + +func (t tagDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Tag, err error) { + buf := make([]*model.Tag, 0, batchSize) + err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (t tagDo) FindInBatches(result *[]*model.Tag, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t tagDo) Attrs(attrs ...field.AssignExpr) ITagDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t tagDo) Assign(attrs ...field.AssignExpr) ITagDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t tagDo) Joins(fields ...field.RelationField) ITagDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t tagDo) Preload(fields ...field.RelationField) ITagDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t tagDo) FirstOrInit() (*model.Tag, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.Tag), nil + } +} + +func (t tagDo) FirstOrCreate() (*model.Tag, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.Tag), nil + } +} + +func (t tagDo) FindByPage(offset int, limit int) (result []*model.Tag, count int64, err error) { + result, err = t.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = t.Offset(-1).Limit(-1).Count() + return +} + +func (t tagDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t tagDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t tagDo) Delete(models ...*model.Tag) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *tagDo) withDO(do gen.Dao) *tagDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/pkg/bufman/dal/tokens.gen.go b/pkg/bufman/dal/tokens.gen.go new file mode 100644 index 000000000..d86171037 --- /dev/null +++ b/pkg/bufman/dal/tokens.gen.go @@ -0,0 +1,404 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +func newToken(db *gorm.DB, opts ...gen.DOOption) token { + _token := token{} + + _token.tokenDo.UseDB(db, opts...) + _token.tokenDo.UseModel(&model.Token{}) + + tableName := _token.tokenDo.TableName() + _token.ALL = field.NewAsterisk(tableName) + _token.ID = field.NewInt64(tableName, "id") + _token.UserID = field.NewString(tableName, "user_id") + _token.TokenID = field.NewString(tableName, "token_id") + _token.TokenName = field.NewString(tableName, "token_name") + _token.CreatedTime = field.NewTime(tableName, "created_time") + _token.ExpireTime = field.NewTime(tableName, "expire_time") + _token.Note = field.NewString(tableName, "note") + + _token.fillFieldMap() + + return _token +} + +type token struct { + tokenDo + + ALL field.Asterisk + ID field.Int64 + UserID field.String + TokenID field.String + TokenName field.String + CreatedTime field.Time + ExpireTime field.Time + Note field.String + + fieldMap map[string]field.Expr +} + +func (t token) Table(newTableName string) *token { + t.tokenDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t token) As(alias string) *token { + t.tokenDo.DO = *(t.tokenDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *token) updateTableName(table string) *token { + t.ALL = field.NewAsterisk(table) + t.ID = field.NewInt64(table, "id") + t.UserID = field.NewString(table, "user_id") + t.TokenID = field.NewString(table, "token_id") + t.TokenName = field.NewString(table, "token_name") + t.CreatedTime = field.NewTime(table, "created_time") + t.ExpireTime = field.NewTime(table, "expire_time") + t.Note = field.NewString(table, "note") + + t.fillFieldMap() + + return t +} + +func (t *token) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *token) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 7) + t.fieldMap["id"] = t.ID + t.fieldMap["user_id"] = t.UserID + t.fieldMap["token_id"] = t.TokenID + t.fieldMap["token_name"] = t.TokenName + t.fieldMap["created_time"] = t.CreatedTime + t.fieldMap["expire_time"] = t.ExpireTime + t.fieldMap["note"] = t.Note +} + +func (t token) clone(db *gorm.DB) token { + t.tokenDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t token) replaceDB(db *gorm.DB) token { + t.tokenDo.ReplaceDB(db) + return t +} + +type tokenDo struct{ gen.DO } + +type ITokenDo interface { + gen.SubQuery + Debug() ITokenDo + WithContext(ctx context.Context) ITokenDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ITokenDo + WriteDB() ITokenDo + As(alias string) gen.Dao + Session(config *gorm.Session) ITokenDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ITokenDo + Not(conds ...gen.Condition) ITokenDo + Or(conds ...gen.Condition) ITokenDo + Select(conds ...field.Expr) ITokenDo + Where(conds ...gen.Condition) ITokenDo + Order(conds ...field.Expr) ITokenDo + Distinct(cols ...field.Expr) ITokenDo + Omit(cols ...field.Expr) ITokenDo + Join(table schema.Tabler, on ...field.Expr) ITokenDo + LeftJoin(table schema.Tabler, on ...field.Expr) ITokenDo + RightJoin(table schema.Tabler, on ...field.Expr) ITokenDo + Group(cols ...field.Expr) ITokenDo + Having(conds ...gen.Condition) ITokenDo + Limit(limit int) ITokenDo + Offset(offset int) ITokenDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ITokenDo + Unscoped() ITokenDo + Create(values ...*model.Token) error + CreateInBatches(values []*model.Token, batchSize int) error + Save(values ...*model.Token) error + First() (*model.Token, error) + Take() (*model.Token, error) + Last() (*model.Token, error) + Find() ([]*model.Token, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Token, err error) + FindInBatches(result *[]*model.Token, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.Token) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ITokenDo + Assign(attrs ...field.AssignExpr) ITokenDo + Joins(fields ...field.RelationField) ITokenDo + Preload(fields ...field.RelationField) ITokenDo + FirstOrInit() (*model.Token, error) + FirstOrCreate() (*model.Token, error) + FindByPage(offset int, limit int) (result []*model.Token, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ITokenDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (t tokenDo) Debug() ITokenDo { + return t.withDO(t.DO.Debug()) +} + +func (t tokenDo) WithContext(ctx context.Context) ITokenDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t tokenDo) ReadDB() ITokenDo { + return t.Clauses(dbresolver.Read) +} + +func (t tokenDo) WriteDB() ITokenDo { + return t.Clauses(dbresolver.Write) +} + +func (t tokenDo) Session(config *gorm.Session) ITokenDo { + return t.withDO(t.DO.Session(config)) +} + +func (t tokenDo) Clauses(conds ...clause.Expression) ITokenDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t tokenDo) Returning(value interface{}, columns ...string) ITokenDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t tokenDo) Not(conds ...gen.Condition) ITokenDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t tokenDo) Or(conds ...gen.Condition) ITokenDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t tokenDo) Select(conds ...field.Expr) ITokenDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t tokenDo) Where(conds ...gen.Condition) ITokenDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t tokenDo) Order(conds ...field.Expr) ITokenDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t tokenDo) Distinct(cols ...field.Expr) ITokenDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t tokenDo) Omit(cols ...field.Expr) ITokenDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t tokenDo) Join(table schema.Tabler, on ...field.Expr) ITokenDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t tokenDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITokenDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t tokenDo) RightJoin(table schema.Tabler, on ...field.Expr) ITokenDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t tokenDo) Group(cols ...field.Expr) ITokenDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t tokenDo) Having(conds ...gen.Condition) ITokenDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t tokenDo) Limit(limit int) ITokenDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t tokenDo) Offset(offset int) ITokenDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t tokenDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITokenDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t tokenDo) Unscoped() ITokenDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t tokenDo) Create(values ...*model.Token) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t tokenDo) CreateInBatches(values []*model.Token, batchSize int) error { + return t.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (t tokenDo) Save(values ...*model.Token) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t tokenDo) First() (*model.Token, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.Token), nil + } +} + +func (t tokenDo) Take() (*model.Token, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.Token), nil + } +} + +func (t tokenDo) Last() (*model.Token, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.Token), nil + } +} + +func (t tokenDo) Find() ([]*model.Token, error) { + result, err := t.DO.Find() + return result.([]*model.Token), err +} + +func (t tokenDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Token, err error) { + buf := make([]*model.Token, 0, batchSize) + err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (t tokenDo) FindInBatches(result *[]*model.Token, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t tokenDo) Attrs(attrs ...field.AssignExpr) ITokenDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t tokenDo) Assign(attrs ...field.AssignExpr) ITokenDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t tokenDo) Joins(fields ...field.RelationField) ITokenDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t tokenDo) Preload(fields ...field.RelationField) ITokenDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t tokenDo) FirstOrInit() (*model.Token, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.Token), nil + } +} + +func (t tokenDo) FirstOrCreate() (*model.Token, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.Token), nil + } +} + +func (t tokenDo) FindByPage(offset int, limit int) (result []*model.Token, count int64, err error) { + result, err = t.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = t.Offset(-1).Limit(-1).Count() + return +} + +func (t tokenDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t tokenDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t tokenDo) Delete(models ...*model.Token) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *tokenDo) withDO(do gen.Dao) *tokenDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/pkg/bufman/dal/users.gen.go b/pkg/bufman/dal/users.gen.go new file mode 100644 index 000000000..b4b8398d3 --- /dev/null +++ b/pkg/bufman/dal/users.gen.go @@ -0,0 +1,416 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +func newUser(db *gorm.DB, opts ...gen.DOOption) user { + _user := user{} + + _user.userDo.UseDB(db, opts...) + _user.userDo.UseModel(&model.User{}) + + tableName := _user.userDo.TableName() + _user.ALL = field.NewAsterisk(tableName) + _user.ID = field.NewInt64(tableName, "id") + _user.UserID = field.NewString(tableName, "user_id") + _user.UserName = field.NewString(tableName, "user_name") + _user.Password = field.NewString(tableName, "password") + _user.CreatedTime = field.NewTime(tableName, "created_time") + _user.UpdateTime = field.NewTime(tableName, "update_time") + _user.Deactivated = field.NewBool(tableName, "deactivated") + _user.Url = field.NewString(tableName, "url") + _user.Description = field.NewString(tableName, "description") + _user.UserType = field.NewInt32(tableName, "user_type") + + _user.fillFieldMap() + + return _user +} + +type user struct { + userDo + + ALL field.Asterisk + ID field.Int64 + UserID field.String + UserName field.String + Password field.String + CreatedTime field.Time + UpdateTime field.Time + Deactivated field.Bool + Url field.String + Description field.String + UserType field.Int32 + + fieldMap map[string]field.Expr +} + +func (u user) Table(newTableName string) *user { + u.userDo.UseTable(newTableName) + return u.updateTableName(newTableName) +} + +func (u user) As(alias string) *user { + u.userDo.DO = *(u.userDo.As(alias).(*gen.DO)) + return u.updateTableName(alias) +} + +func (u *user) updateTableName(table string) *user { + u.ALL = field.NewAsterisk(table) + u.ID = field.NewInt64(table, "id") + u.UserID = field.NewString(table, "user_id") + u.UserName = field.NewString(table, "user_name") + u.Password = field.NewString(table, "password") + u.CreatedTime = field.NewTime(table, "created_time") + u.UpdateTime = field.NewTime(table, "update_time") + u.Deactivated = field.NewBool(table, "deactivated") + u.Url = field.NewString(table, "url") + u.Description = field.NewString(table, "description") + u.UserType = field.NewInt32(table, "user_type") + + u.fillFieldMap() + + return u +} + +func (u *user) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := u.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (u *user) fillFieldMap() { + u.fieldMap = make(map[string]field.Expr, 10) + u.fieldMap["id"] = u.ID + u.fieldMap["user_id"] = u.UserID + u.fieldMap["user_name"] = u.UserName + u.fieldMap["password"] = u.Password + u.fieldMap["created_time"] = u.CreatedTime + u.fieldMap["update_time"] = u.UpdateTime + u.fieldMap["deactivated"] = u.Deactivated + u.fieldMap["url"] = u.Url + u.fieldMap["description"] = u.Description + u.fieldMap["user_type"] = u.UserType +} + +func (u user) clone(db *gorm.DB) user { + u.userDo.ReplaceConnPool(db.Statement.ConnPool) + return u +} + +func (u user) replaceDB(db *gorm.DB) user { + u.userDo.ReplaceDB(db) + return u +} + +type userDo struct{ gen.DO } + +type IUserDo interface { + gen.SubQuery + Debug() IUserDo + WithContext(ctx context.Context) IUserDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IUserDo + WriteDB() IUserDo + As(alias string) gen.Dao + Session(config *gorm.Session) IUserDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IUserDo + Not(conds ...gen.Condition) IUserDo + Or(conds ...gen.Condition) IUserDo + Select(conds ...field.Expr) IUserDo + Where(conds ...gen.Condition) IUserDo + Order(conds ...field.Expr) IUserDo + Distinct(cols ...field.Expr) IUserDo + Omit(cols ...field.Expr) IUserDo + Join(table schema.Tabler, on ...field.Expr) IUserDo + LeftJoin(table schema.Tabler, on ...field.Expr) IUserDo + RightJoin(table schema.Tabler, on ...field.Expr) IUserDo + Group(cols ...field.Expr) IUserDo + Having(conds ...gen.Condition) IUserDo + Limit(limit int) IUserDo + Offset(offset int) IUserDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IUserDo + Unscoped() IUserDo + Create(values ...*model.User) error + CreateInBatches(values []*model.User, batchSize int) error + Save(values ...*model.User) error + First() (*model.User, error) + Take() (*model.User, error) + Last() (*model.User, error) + Find() ([]*model.User, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.User, err error) + FindInBatches(result *[]*model.User, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.User) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IUserDo + Assign(attrs ...field.AssignExpr) IUserDo + Joins(fields ...field.RelationField) IUserDo + Preload(fields ...field.RelationField) IUserDo + FirstOrInit() (*model.User, error) + FirstOrCreate() (*model.User, error) + FindByPage(offset int, limit int) (result []*model.User, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IUserDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (u userDo) Debug() IUserDo { + return u.withDO(u.DO.Debug()) +} + +func (u userDo) WithContext(ctx context.Context) IUserDo { + return u.withDO(u.DO.WithContext(ctx)) +} + +func (u userDo) ReadDB() IUserDo { + return u.Clauses(dbresolver.Read) +} + +func (u userDo) WriteDB() IUserDo { + return u.Clauses(dbresolver.Write) +} + +func (u userDo) Session(config *gorm.Session) IUserDo { + return u.withDO(u.DO.Session(config)) +} + +func (u userDo) Clauses(conds ...clause.Expression) IUserDo { + return u.withDO(u.DO.Clauses(conds...)) +} + +func (u userDo) Returning(value interface{}, columns ...string) IUserDo { + return u.withDO(u.DO.Returning(value, columns...)) +} + +func (u userDo) Not(conds ...gen.Condition) IUserDo { + return u.withDO(u.DO.Not(conds...)) +} + +func (u userDo) Or(conds ...gen.Condition) IUserDo { + return u.withDO(u.DO.Or(conds...)) +} + +func (u userDo) Select(conds ...field.Expr) IUserDo { + return u.withDO(u.DO.Select(conds...)) +} + +func (u userDo) Where(conds ...gen.Condition) IUserDo { + return u.withDO(u.DO.Where(conds...)) +} + +func (u userDo) Order(conds ...field.Expr) IUserDo { + return u.withDO(u.DO.Order(conds...)) +} + +func (u userDo) Distinct(cols ...field.Expr) IUserDo { + return u.withDO(u.DO.Distinct(cols...)) +} + +func (u userDo) Omit(cols ...field.Expr) IUserDo { + return u.withDO(u.DO.Omit(cols...)) +} + +func (u userDo) Join(table schema.Tabler, on ...field.Expr) IUserDo { + return u.withDO(u.DO.Join(table, on...)) +} + +func (u userDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserDo { + return u.withDO(u.DO.LeftJoin(table, on...)) +} + +func (u userDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserDo { + return u.withDO(u.DO.RightJoin(table, on...)) +} + +func (u userDo) Group(cols ...field.Expr) IUserDo { + return u.withDO(u.DO.Group(cols...)) +} + +func (u userDo) Having(conds ...gen.Condition) IUserDo { + return u.withDO(u.DO.Having(conds...)) +} + +func (u userDo) Limit(limit int) IUserDo { + return u.withDO(u.DO.Limit(limit)) +} + +func (u userDo) Offset(offset int) IUserDo { + return u.withDO(u.DO.Offset(offset)) +} + +func (u userDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserDo { + return u.withDO(u.DO.Scopes(funcs...)) +} + +func (u userDo) Unscoped() IUserDo { + return u.withDO(u.DO.Unscoped()) +} + +func (u userDo) Create(values ...*model.User) error { + if len(values) == 0 { + return nil + } + return u.DO.Create(values) +} + +func (u userDo) CreateInBatches(values []*model.User, batchSize int) error { + return u.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (u userDo) Save(values ...*model.User) error { + if len(values) == 0 { + return nil + } + return u.DO.Save(values) +} + +func (u userDo) First() (*model.User, error) { + if result, err := u.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Take() (*model.User, error) { + if result, err := u.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Last() (*model.User, error) { + if result, err := u.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Find() ([]*model.User, error) { + result, err := u.DO.Find() + return result.([]*model.User), err +} + +func (u userDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.User, err error) { + buf := make([]*model.User, 0, batchSize) + err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (u userDo) FindInBatches(result *[]*model.User, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return u.DO.FindInBatches(result, batchSize, fc) +} + +func (u userDo) Attrs(attrs ...field.AssignExpr) IUserDo { + return u.withDO(u.DO.Attrs(attrs...)) +} + +func (u userDo) Assign(attrs ...field.AssignExpr) IUserDo { + return u.withDO(u.DO.Assign(attrs...)) +} + +func (u userDo) Joins(fields ...field.RelationField) IUserDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Joins(_f)) + } + return &u +} + +func (u userDo) Preload(fields ...field.RelationField) IUserDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Preload(_f)) + } + return &u +} + +func (u userDo) FirstOrInit() (*model.User, error) { + if result, err := u.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) FirstOrCreate() (*model.User, error) { + if result, err := u.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) FindByPage(offset int, limit int) (result []*model.User, count int64, err error) { + result, err = u.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = u.Offset(-1).Limit(-1).Count() + return +} + +func (u userDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = u.Count() + if err != nil { + return + } + + err = u.Offset(offset).Limit(limit).Scan(result) + return +} + +func (u userDo) Scan(result interface{}) (err error) { + return u.DO.Scan(result) +} + +func (u userDo) Delete(models ...*model.User) (result gen.ResultInfo, err error) { + return u.DO.Delete(models) +} + +func (u *userDo) withDO(do gen.Dao) *userDo { + u.DO = *do.(*gen.DO) + return u +} diff --git a/pkg/bufman/e/base_error.go b/pkg/bufman/e/base_error.go new file mode 100644 index 000000000..8f479cf65 --- /dev/null +++ b/pkg/bufman/e/base_error.go @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package e + +import ( + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ResponseError interface { + Error() string + Err() error + Code() codes.Code + String() string +} + +type BaseResponseError struct { + stat *status.Status +} + +func NewBaseResponseError(msg string, code codes.Code) *BaseResponseError { + return &BaseResponseError{ + stat: status.New(code, msg), + } +} + +func (e *BaseResponseError) Error() string { + if e == nil { + return "" + } + + return e.stat.Message() +} + +func (e *BaseResponseError) Err() error { + if e == nil { + return status.Error(codes.Unknown, codes.Unknown.String()) + } + + return e.stat.Err() +} + +func (e *BaseResponseError) Code() codes.Code { + if e == nil { + return codes.Unknown + } + + return e.stat.Code() +} + +func (e *BaseResponseError) String() string { + if e == nil { + return "" + } + + return e.stat.String() +} diff --git a/pkg/bufman/e/errors.go b/pkg/bufman/e/errors.go new file mode 100644 index 000000000..73dd38354 --- /dev/null +++ b/pkg/bufman/e/errors.go @@ -0,0 +1,90 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package e + +import ( + "google.golang.org/grpc/codes" +) + +type UnknownError struct { + *BaseResponseError +} + +func NewUnknownError(err error) *UnknownError { + return &UnknownError{ + NewBaseResponseError(err.Error(), codes.Unknown), + } +} + +type NotFoundError struct { + *BaseResponseError +} + +func NewNotFoundError(err error) *NotFoundError { + return &NotFoundError{ + NewBaseResponseError(err.Error(), codes.NotFound), + } +} + +type AlreadyExistsError struct { + *BaseResponseError +} + +func NewAlreadyExistsError(err error) *AlreadyExistsError { + return &AlreadyExistsError{ + NewBaseResponseError(err.Error(), codes.AlreadyExists), + } +} + +type PermissionDeniedError struct { + *BaseResponseError +} + +func NewPermissionDeniedError(err error) *PermissionDeniedError { + return &PermissionDeniedError{ + NewBaseResponseError(err.Error(), codes.PermissionDenied), + } +} + +type InternalError struct { + *BaseResponseError +} + +func NewInternalError(err error) *InternalError { + return &InternalError{ + NewBaseResponseError(err.Error(), codes.Internal), + } +} + +type CodeUnauthenticatedError struct { + *BaseResponseError +} + +func NewUnauthenticatedError(err error) *CodeUnauthenticatedError { + return &CodeUnauthenticatedError{ + NewBaseResponseError(err.Error(), codes.Unauthenticated), + } +} + +type InvalidArgumentError struct { + *BaseResponseError +} + +func NewInvalidArgumentError(err error) *InvalidArgumentError { + return &InvalidArgumentError{ + NewBaseResponseError(err.Error(), codes.InvalidArgument), + } +} diff --git a/pkg/bufman/gorm_gen/gorm_gen.go b/pkg/bufman/gorm_gen/gorm_gen.go new file mode 100644 index 000000000..d879b0b05 --- /dev/null +++ b/pkg/bufman/gorm_gen/gorm_gen.go @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + "gorm.io/driver/mysql" + "gorm.io/gen" + "gorm.io/gorm" +) + +func main() { + dsn := "root:qwas617.@tcp(127.0.0.1:3306)/idl_manager?charset=utf8mb4&parseTime=True&loc=Local" + + // Initialize the generator with configuration + g := gen.NewGenerator(gen.Config{ + OutPath: "pkg/bufman/dal", // output directory + Mode: gen.WithDefaultQuery | gen.WithQueryInterface | gen.WithoutContext, + FieldNullable: true, + }) + + db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{TranslateError: true}) + if err != nil { + panic(err) + } + + // Use the above `*gorm.DB` instance to initialize the generator, + // which is required to generate structs from db when using `GenerateModel/GenerateModelAs` + g.UseDB(db) + + // Generate default DAO interface for those specified structs + g.ApplyBasic(model.User{}, model.Token{}, model.Repository{}, model.Tag{}, model.Commit{}, model.FileManifest{}, model.FileBlob{}) + + // Execute the generator + g.Execute() +} diff --git a/pkg/bufman/handlers/grpc_handlers/authn.go b/pkg/bufman/handlers/grpc_handlers/authn.go new file mode 100644 index 000000000..7b8aefa03 --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/authn.go @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type AuthnServiceHandler struct { + registryv1alpha1.UnimplementedAuthnServiceServer + authnController *controllers.AuthnController +} + +func NewAuthnServiceHandler() *AuthnServiceHandler { + return &AuthnServiceHandler{ + authnController: controllers.NewAuthnController(), + } +} + +func (handler *AuthnServiceHandler) GetCurrentUser(ctx context.Context, request *registryv1alpha1.GetCurrentUserRequest) (*registryv1alpha1.GetCurrentUserResponse, error) { + resp, err := handler.authnController.GetCurrentUser(ctx, request) + if err != nil { + logger.Sugar().Errorf("Error Get User: %v\n", err.Error()) + return nil, err.Err() + } + + return resp, nil +} diff --git a/pkg/bufman/handlers/grpc_handlers/commit.go b/pkg/bufman/handlers/grpc_handlers/commit.go new file mode 100644 index 000000000..14520bcfa --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/commit.go @@ -0,0 +1,72 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" +) + +type CommitServiceHandler struct { + registryv1alpha1.UnimplementedRepositoryCommitServiceServer + + commitController *controllers.CommitController +} + +func NewCommitServiceHandler() *CommitServiceHandler { + return &CommitServiceHandler{ + commitController: controllers.NewCommitController(), + } +} + +func (handler *CommitServiceHandler) GetRepositoryCommitByReference(ctx context.Context, req *registryv1alpha1.GetRepositoryCommitByReferenceRequest) (*registryv1alpha1.GetRepositoryCommitByReferenceResponse, error) { + resp, err := handler.commitController.GetRepositoryCommitByReference(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *CommitServiceHandler) ListRepositoryDraftCommits(ctx context.Context, req *registryv1alpha1.ListRepositoryDraftCommitsRequest) (*registryv1alpha1.ListRepositoryDraftCommitsResponse, error) { + resp, err := handler.commitController.ListRepositoryDraftCommits(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *CommitServiceHandler) DeleteRepositoryDraftCommit(ctx context.Context, req *registryv1alpha1.DeleteRepositoryDraftCommitRequest) (*registryv1alpha1.DeleteRepositoryDraftCommitResponse, error) { + resp, err := handler.commitController.DeleteRepositoryDraftCommit(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *CommitServiceHandler) ListRepositoryCommitsByBranch(ctx context.Context, req *registryv1alpha1.ListRepositoryCommitsByBranchRequest) (*registryv1alpha1.ListRepositoryCommitsByBranchResponse, error) { + // TODO implement me + panic("implement me") +} + +func (handler *CommitServiceHandler) GetRepositoryCommitBySequenceId(ctx context.Context, req *registryv1alpha1.GetRepositoryCommitBySequenceIdRequest) (*registryv1alpha1.GetRepositoryCommitBySequenceIdResponse, error) { + // TODO implement me + panic("implement me") +} diff --git a/pkg/bufman/handlers/grpc_handlers/docs.go b/pkg/bufman/handlers/grpc_handlers/docs.go new file mode 100644 index 000000000..da4137533 --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/docs.go @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" +) + +type DocServiceHandler struct { + registryv1alpha1.UnimplementedDocServiceServer + + docController *controllers.DocController +} + +func NewDocServiceHandler() *DocServiceHandler { + return &DocServiceHandler{ + docController: controllers.NewDocController(), + } +} + +func (handler *DocServiceHandler) GetSourceDirectoryInfo(ctx context.Context, req *registryv1alpha1.GetSourceDirectoryInfoRequest) (*registryv1alpha1.GetSourceDirectoryInfoResponse, error) { + resp, err := handler.docController.GetSourceDirectoryInfo(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *DocServiceHandler) GetSourceFile(ctx context.Context, req *registryv1alpha1.GetSourceFileRequest) (*registryv1alpha1.GetSourceFileResponse, error) { + resp, err := handler.docController.GetSourceFile(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *DocServiceHandler) GetModulePackages(ctx context.Context, req *registryv1alpha1.GetModulePackagesRequest) (*registryv1alpha1.GetModulePackagesResponse, error) { + resp, err := handler.docController.GetModulePackages(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *DocServiceHandler) GetModuleDocumentation(ctx context.Context, req *registryv1alpha1.GetModuleDocumentationRequest) (*registryv1alpha1.GetModuleDocumentationResponse, error) { + resp, err := handler.docController.GetModuleDocumentation(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *DocServiceHandler) GetPackageDocumentation(ctx context.Context, req *registryv1alpha1.GetPackageDocumentationRequest) (*registryv1alpha1.GetPackageDocumentationResponse, error) { + resp, err := handler.docController.GetPackageDocumentation(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} diff --git a/pkg/bufman/handlers/grpc_handlers/download.go b/pkg/bufman/handlers/grpc_handlers/download.go new file mode 100644 index 000000000..0c71688b6 --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/download.go @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmanifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type DownloadServiceHandler struct { + registryv1alpha1.UnimplementedDownloadServiceServer + + downloadService services.DownloadService + authorizationService services.AuthorizationService +} + +func NewDownloadServiceHandler() *DownloadServiceHandler { + return &DownloadServiceHandler{ + downloadService: services.NewDownloadService(), + authorizationService: services.NewAuthorizationService(), + } +} + +func (handler *DownloadServiceHandler) DownloadManifestAndBlobs(ctx context.Context, req *registryv1alpha1.DownloadManifestAndBlobsRequest) (*registryv1alpha1.DownloadManifestAndBlobsResponse, error) { + // 检查用户权限 + userID, _ := ctx.Value(constant.UserIDKey).(string) + repository, checkErr := handler.authorizationService.CheckRepositoryCanAccess(userID, req.GetOwner(), req.GetRepository()) + if checkErr != nil { + logger.Sugar().Errorf("Error Check: %v\n", checkErr.Error()) + + return nil, checkErr.Err() + } + + // 获取对应文件内容、文件清单 + fileManifest, blobSet, err := handler.downloadService.DownloadManifestAndBlobs(ctx, repository.RepositoryID, req.GetReference()) + if err != nil { + logger.Sugar().Errorf("Error download manifest and blobs: %v\n", err.Error()) + + return nil, err.Err() + } + + // 转为响应格式 + protoManifest, protoBlobs, toProtoErr := bufmanifest.ToProtoManifestAndBlobs(ctx, fileManifest, blobSet) + if toProtoErr != nil { + logger.Sugar().Errorf("Error transform to response proto manifest and blobs: %v\n", toProtoErr.Error()) + + respErr := e.NewInternalError(toProtoErr) + return nil, respErr.Err() + } + + return ®istryv1alpha1.DownloadManifestAndBlobsResponse{ + Manifest: protoManifest, + Blobs: protoBlobs, + }, nil +} diff --git a/pkg/bufman/handlers/grpc_handlers/push.go b/pkg/bufman/handlers/grpc_handlers/push.go new file mode 100644 index 000000000..51100f190 --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/push.go @@ -0,0 +1,185 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/parser" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/resolve" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + manifest2 "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type PushServiceHandler struct { + registryv1alpha1.UnimplementedPushServiceServer + + pushService services.PushService + validator validity.Validator + resolver resolve.Resolver + storageHelper storage.StorageHelper + protoParser parser.ProtoParser +} + +func NewPushServiceHandler() *PushServiceHandler { + return &PushServiceHandler{ + pushService: services.NewPushService(), + validator: validity.NewValidator(), + resolver: resolve.NewResolver(), + storageHelper: storage.NewStorageHelper(), + protoParser: parser.NewProtoParser(), + } +} + +func (handler *PushServiceHandler) PushManifestAndBlobs(ctx context.Context, req *registryv1alpha1.PushManifestAndBlobsRequest) (*registryv1alpha1.PushManifestAndBlobsResponse, error) { + // 验证参数 + + // 检查tags名称合法性 + var argErr e.ResponseError + for _, tag := range req.GetTags() { + argErr = handler.validator.CheckTagName(tag) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Err()) + + return nil, argErr.Err() + } + } + + // 检查draft名称合法性 + if req.GetDraftName() != "" { + argErr = handler.validator.CheckDraftName(req.GetDraftName()) + if argErr != nil { + logger.Sugar().Errorf("Error check: %v\n", argErr.Err()) + + return nil, argErr.Err() + } + } + + // draft和tag只能二选一 + if req.GetDraftName() != "" && len(req.GetTags()) > 0 { + responseError := e.NewInvalidArgumentError(fmt.Errorf("draft and tags (only choose one)")) + logger.Sugar().Errorf("Error draft and tag must choose one (not both): %v\n", responseError.Err()) + return nil, responseError.Err() + } + + // 检查上传文件 + fileManifest, blobSet, checkErr := handler.validator.CheckManifestAndBlobs(ctx, req.GetManifest(), req.GetBlobs()) + if checkErr != nil { + logger.Sugar().Errorf("Error check manifest and blobs: %v\n", checkErr.Err()) + + return nil, checkErr.Err() + } + + // 获取bufConfig + bufConfigBlob, err := handler.storageHelper.GetBufManConfigFromBlob(ctx, fileManifest, blobSet) + if err != nil { + logger.Sugar().Errorf("Error get config: %v\n", err) + + configErr := e.NewInternalError(err) + return nil, configErr.Err() + } + + var dependentManifests []*manifest2.Manifest + var dependentBlobSets []*manifest2.BlobSet + if bufConfigBlob != nil { + // 生成Config + reader, err := bufConfigBlob.Open(ctx) + if err != nil { + logger.Sugar().Errorf("Error read config: %v\n", err) + + respErr := e.NewInternalError(err) + return nil, respErr.Err() + } + defer reader.Close() + configData, err := io.ReadAll(reader) + if err != nil { + logger.Sugar().Errorf("Error read config: %v\n", err) + + respErr := e.NewInternalError(err) + return nil, respErr.Err() + } + bufConfig, err := bufconfig.GetConfigForData(ctx, configData) + if err != nil { + logger.Sugar().Errorf("Error read config: %v\n", err) + + // 无法解析配置文件 + respErr := e.NewInternalError(err) + return nil, respErr.Err() + } + + // 获取全部依赖commits + dependentCommits, dependenceErr := handler.resolver.GetAllDependenciesFromBufConfig(ctx, bufConfig) + if dependenceErr != nil { + logger.Sugar().Errorf("Error get all dependencies: %v\n", dependenceErr) + + return nil, dependenceErr.Err() + } + + // 读取依赖文件 + dependentManifests = make([]*manifest2.Manifest, 0, len(dependentCommits)) + dependentBlobSets = make([]*manifest2.BlobSet, 0, len(dependentCommits)) + for i := 0; i < len(dependentCommits); i++ { + dependentCommit := dependentCommits[i] + dependentManifest, dependentBlobSet, getErr := handler.pushService.GetManifestAndBlobSet(ctx, dependentCommit.RepositoryID, dependentCommit.CommitName) + if getErr != nil { + logger.Sugar().Errorf("Error get manifest and blob set: %v\n", getErr) + + return nil, getErr.Err() + } + + dependentManifests = append(dependentManifests, dependentManifest) + dependentBlobSets = append(dependentBlobSets, dependentBlobSet) + } + } + + // 编译检查 + compileErr := handler.protoParser.TryCompile(ctx, fileManifest, blobSet, dependentManifests, dependentBlobSets) + if compileErr != nil { + logger.Sugar().Errorf("Error try to compile proto: %v\n", compileErr.Error()) + + return nil, compileErr.Err() + } + + var commit *model.Commit + var serviceErr e.ResponseError + userID, _ := ctx.Value(constant.UserIDKey).(string) + if req.DraftName != "" { + commit, serviceErr = handler.pushService.PushManifestAndBlobsWithDraft(ctx, userID, req.GetOwner(), req.GetRepository(), fileManifest, blobSet, req.GetDraftName()) + } else if len(req.GetTags()) > 0 { + commit, serviceErr = handler.pushService.PushManifestAndBlobsWithTags(ctx, userID, req.GetOwner(), req.GetRepository(), fileManifest, blobSet, req.GetTags()) + } else { + commit, serviceErr = handler.pushService.PushManifestAndBlobs(ctx, userID, req.GetOwner(), req.GetRepository(), fileManifest, blobSet) + } + if serviceErr != nil { + logger.Sugar().Errorf("Error push: %v\n", serviceErr.Error()) + + return nil, serviceErr.Err() + } + + return ®istryv1alpha1.PushManifestAndBlobsResponse{ + LocalModulePin: commit.ToProtoLocalModulePin(), + }, nil +} diff --git a/pkg/bufman/handlers/grpc_handlers/repository.go b/pkg/bufman/handlers/grpc_handlers/repository.go new file mode 100644 index 000000000..6209ed345 --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/repository.go @@ -0,0 +1,142 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" +) + +type RepositoryServiceHandler struct { + registryv1alpha1.UnimplementedRepositoryServiceServer + repositoryController *controllers.RepositoryController +} + +func NewRepositoryServiceHandler() *RepositoryServiceHandler { + return &RepositoryServiceHandler{ + repositoryController: controllers.NewRepositoryController(), + } +} + +func (handler *RepositoryServiceHandler) GetRepository(ctx context.Context, req *registryv1alpha1.GetRepositoryRequest) (*registryv1alpha1.GetRepositoryResponse, error) { + resp, err := handler.repositoryController.GetRepository(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) GetRepositoryByFullName(ctx context.Context, req *registryv1alpha1.GetRepositoryByFullNameRequest) (*registryv1alpha1.GetRepositoryByFullNameResponse, error) { + resp, err := handler.repositoryController.GetRepositoryByFullName(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) ListRepositories(ctx context.Context, req *registryv1alpha1.ListRepositoriesRequest) (*registryv1alpha1.ListRepositoriesResponse, error) { + resp, err := handler.repositoryController.ListRepositories(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) ListUserRepositories(ctx context.Context, req *registryv1alpha1.ListUserRepositoriesRequest) (*registryv1alpha1.ListUserRepositoriesResponse, error) { + resp, err := handler.repositoryController.ListUserRepositories(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) ListRepositoriesUserCanAccess(ctx context.Context, req *registryv1alpha1.ListRepositoriesUserCanAccessRequest) (*registryv1alpha1.ListRepositoriesUserCanAccessResponse, error) { + resp, err := handler.repositoryController.ListRepositoriesUserCanAccess(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) CreateRepositoryByFullName(ctx context.Context, req *registryv1alpha1.CreateRepositoryByFullNameRequest) (*registryv1alpha1.CreateRepositoryByFullNameResponse, error) { + resp, err := handler.repositoryController.CreateRepositoryByFullName(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) DeleteRepository(ctx context.Context, req *registryv1alpha1.DeleteRepositoryRequest) (*registryv1alpha1.DeleteRepositoryResponse, error) { + resp, err := handler.repositoryController.DeleteRepository(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) DeleteRepositoryByFullName(ctx context.Context, req *registryv1alpha1.DeleteRepositoryByFullNameRequest) (*registryv1alpha1.DeleteRepositoryByFullNameResponse, error) { + resp, err := handler.repositoryController.DeleteRepositoryByFullName(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) DeprecateRepositoryByName(ctx context.Context, req *registryv1alpha1.DeprecateRepositoryByNameRequest) (*registryv1alpha1.DeprecateRepositoryByNameResponse, error) { + resp, err := handler.repositoryController.DeprecateRepositoryByName(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) UndeprecateRepositoryByName(ctx context.Context, req *registryv1alpha1.UndeprecateRepositoryByNameRequest) (*registryv1alpha1.UndeprecateRepositoryByNameResponse, error) { + resp, err := handler.repositoryController.UndeprecateRepositoryByName(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) UpdateRepositorySettingsByName(ctx context.Context, req *registryv1alpha1.UpdateRepositorySettingsByNameRequest) (*registryv1alpha1.UpdateRepositorySettingsByNameResponse, error) { + resp, err := handler.repositoryController.UpdateRepositorySettingsByName(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *RepositoryServiceHandler) GetRepositoriesByFullName(ctx context.Context, req *registryv1alpha1.GetRepositoriesByFullNameRequest) (*registryv1alpha1.GetRepositoriesByFullNameResponse, error) { + resp, err := handler.repositoryController.GetRepositoriesByFullName(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} diff --git a/pkg/bufman/handlers/grpc_handlers/resolve.go b/pkg/bufman/handlers/grpc_handlers/resolve.go new file mode 100644 index 000000000..d14310fac --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/resolve.go @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/resolve" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type ResolveServiceHandler struct { + registryv1alpha1.UnimplementedResolveServiceServer + + resolver resolve.Resolver + authorizationService services.AuthorizationService +} + +func NewResolveServiceHandler() *ResolveServiceHandler { + return &ResolveServiceHandler{ + resolver: resolve.NewResolver(), + authorizationService: services.NewAuthorizationService(), + } +} + +func (handler *ResolveServiceHandler) GetModulePins(ctx context.Context, req *registryv1alpha1.GetModulePinsRequest) (*registryv1alpha1.GetModulePinsResponse, error) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 首先检查用户权限,是否对repo有访问权限 + var checkErr e.ResponseError + repositoryMap := map[string]*model.Repository{} + for _, moduleReference := range req.GetModuleReferences() { + fullName := moduleReference.GetOwner() + "/" + moduleReference.GetRepository() + repo, ok := repositoryMap[fullName] + if !ok { + repo, checkErr = handler.authorizationService.CheckRepositoryCanAccess(userID, moduleReference.GetOwner(), moduleReference.GetRepository()) + if checkErr != nil { + logger.Sugar().Errorf("Error check: %v\n", checkErr.Error()) + + return nil, checkErr.Err() + } + repositoryMap[fullName] = repo + } + repositoryMap[fullName] = repo + } + + moduleReferences, bufRefErr := bufmoduleref.NewModuleReferencesForProtos(req.GetModuleReferences()...) + if bufRefErr != nil { + logger.Sugar().Errorf("Error read mod ref from proto: %v\n", bufRefErr.Error()) + + return nil, e.NewInternalError(bufRefErr).Err() + } + + // 获取所有的依赖commits + commits, err := handler.resolver.GetAllDependenciesFromModuleRefs(ctx, moduleReferences) + if err != nil { + logger.Sugar().Errorf("Error get all dependencies: %v\n", err.Error()) + + return nil, err.Err() + } + + retPins := commits.ToProtoModulePins() + currentModulePins, curPinErr := bufmoduleref.NewModulePinsForProtos(req.GetCurrentModulePins()...) + if curPinErr != nil { + logger.Sugar().Errorf("Error read mod pins from proto: %v\n", curPinErr.Error()) + + return nil, e.NewInternalError(curPinErr).Err() + } + // 处理CurrentModulePins + for _, currentModulePin := range currentModulePins { + for _, moduleRef := range moduleReferences { + if currentModulePin.IdentityString() == moduleRef.IdentityString() { + // 需要更新的依赖,已经加入到了返回的结果中 + continue + } + } + + ownerName := currentModulePin.Owner() + repositoryName := currentModulePin.Repository() + for _, commit := range commits { + // 如果current module pin在reference的查询出的commits内,则有breaking的可能 + if commit.UserName == ownerName && commit.RepositoryName == repositoryName { + commitName := currentModulePin.Commit() + if commit.CommitName != commitName { + // 版本号不一样,存在breaking + respErr := e.NewInvalidArgumentError(fmt.Errorf("%s/%s (possible to cause breaking)", currentModulePin.Owner(), currentModulePin.Repository())) + logger.Sugar().Errorf("Error has breaking: %v\n", respErr.Error()) + + return nil, respErr.Err() + } + } + } + + // 当前pin没有breaking的可能性,加入到返回结果中 + protoPin := bufmoduleref.NewProtoModulePinForModulePin(currentModulePin) + retPins = append(retPins, protoPin) + } + + return ®istryv1alpha1.GetModulePinsResponse{ + ModulePins: retPins, + }, nil +} diff --git a/pkg/bufman/handlers/grpc_handlers/tag.go b/pkg/bufman/handlers/grpc_handlers/tag.go new file mode 100644 index 000000000..6de7dc0ed --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/tag.go @@ -0,0 +1,57 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" +) + +type TagServiceHandler struct { + registryv1alpha1.UnimplementedRepositoryTagServiceServer + + tagController *controllers.TagController +} + +func NewTagServiceHandler() *TagServiceHandler { + return &TagServiceHandler{ + tagController: controllers.NewTagController(), + } +} + +func (handler *TagServiceHandler) CreateRepositoryTag(ctx context.Context, req *registryv1alpha1.CreateRepositoryTagRequest) (*registryv1alpha1.CreateRepositoryTagResponse, error) { + resp, err := handler.tagController.CreateRepositoryTag(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *TagServiceHandler) ListRepositoryTags(ctx context.Context, req *registryv1alpha1.ListRepositoryTagsRequest) (*registryv1alpha1.ListRepositoryTagsResponse, error) { + resp, err := handler.tagController.ListRepositoryTags(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *TagServiceHandler) ListRepositoryTagsForReference(ctx context.Context, req *registryv1alpha1.ListRepositoryTagsForReferenceRequest) (*registryv1alpha1.ListRepositoryTagsForReferenceResponse, error) { + panic("implement me") +} diff --git a/pkg/bufman/handlers/grpc_handlers/token.go b/pkg/bufman/handlers/grpc_handlers/token.go new file mode 100644 index 000000000..58b6ea6b0 --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/token.go @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" +) + +type TokenServiceHandler struct { + registryv1alpha1.UnimplementedTokenServiceServer + tokenController *controllers.TokenController +} + +func NewTokenServiceHandler() *TokenServiceHandler { + return &TokenServiceHandler{ + tokenController: controllers.NewTokenController(), + } +} + +func (handler *TokenServiceHandler) CreateToken(ctx context.Context, req *registryv1alpha1.CreateTokenRequest) (*registryv1alpha1.CreateTokenResponse, error) { + resp, err := handler.tokenController.CreateToken(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *TokenServiceHandler) GetToken(ctx context.Context, req *registryv1alpha1.GetTokenRequest) (*registryv1alpha1.GetTokenResponse, error) { + resp, err := handler.tokenController.GetToken(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *TokenServiceHandler) ListTokens(ctx context.Context, req *registryv1alpha1.ListTokensRequest) (*registryv1alpha1.ListTokensResponse, error) { + resp, err := handler.tokenController.ListTokens(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *TokenServiceHandler) DeleteToken(ctx context.Context, req *registryv1alpha1.DeleteTokenRequest) (*registryv1alpha1.DeleteTokenResponse, error) { + resp, err := handler.tokenController.DeleteToken(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} diff --git a/pkg/bufman/handlers/grpc_handlers/user.go b/pkg/bufman/handlers/grpc_handlers/user.go new file mode 100644 index 000000000..dcde1a332 --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/user.go @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package grpc_handlers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" +) + +type UserServiceHandler struct { + registryv1alpha1.UnimplementedUserServiceServer + userController *controllers.UserController +} + +func NewUserServiceHandler() *UserServiceHandler { + return &UserServiceHandler{ + userController: controllers.NewUserController(), + } +} + +func (handler *UserServiceHandler) CreateUser(ctx context.Context, req *registryv1alpha1.CreateUserRequest) (*registryv1alpha1.CreateUserResponse, error) { + resp, err := handler.userController.CreateUser(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *UserServiceHandler) GetUser(ctx context.Context, req *registryv1alpha1.GetUserRequest) (*registryv1alpha1.GetUserResponse, error) { + resp, err := handler.userController.GetUser(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *UserServiceHandler) GetUserByUsername(ctx context.Context, req *registryv1alpha1.GetUserByUsernameRequest) (*registryv1alpha1.GetUserByUsernameResponse, error) { + resp, err := handler.userController.GetUserByUsername(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} + +func (handler *UserServiceHandler) ListUsers(ctx context.Context, req *registryv1alpha1.ListUsersRequest) (*registryv1alpha1.ListUsersResponse, error) { + resp, err := handler.userController.ListUsers(ctx, req) + if err != nil { + return nil, err.Err() + } + + return resp, nil +} diff --git a/pkg/bufman/handlers/http_handlers/authn.go b/pkg/bufman/handlers/http_handlers/authn.go new file mode 100644 index 000000000..bbbd1dfcd --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/authn.go @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/gin-gonic/gin" +) + +type authnGroup struct { + authnController *controllers.AuthnController +} + +var AuthnGroup = &authnGroup{ + authnController: controllers.NewAuthnController(), +} + +func (group *authnGroup) GetCurrentUser(c *gin.Context) { + req := ®istryv1alpha1.GetCurrentUserRequest{} + resp, err := group.authnController.GetCurrentUser(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + return + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} diff --git a/pkg/bufman/handlers/http_handlers/commit.go b/pkg/bufman/handlers/http_handlers/commit.go new file mode 100644 index 000000000..4e90672bc --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/commit.go @@ -0,0 +1,114 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/gin-gonic/gin" +) + +type commitGroup struct { + commitController *controllers.CommitController +} + +var CommitGroup = &commitGroup{ + commitController: controllers.NewCommitController(), +} + +func (group *commitGroup) ListRepositoryCommitsByReference(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.ListRepositoryCommitsByReferenceRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + bindErr = c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.commitController.ListRepositoryCommitsByReference(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *commitGroup) GetRepositoryCommitByReference(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetRepositoryCommitByReferenceRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.commitController.GetRepositoryCommitByReference(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *commitGroup) ListRepositoryDraftCommits(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.ListRepositoryDraftCommitsRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + bindErr = c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.commitController.ListRepositoryDraftCommits(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *commitGroup) DeleteRepositoryDraftCommit(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.DeleteRepositoryDraftCommitRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.commitController.DeleteRepositoryDraftCommit(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} diff --git a/pkg/bufman/handlers/http_handlers/common.go b/pkg/bufman/handlers/http_handlers/common.go new file mode 100644 index 000000000..6c61d3544 --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/common.go @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + "google.golang.org/grpc/codes" +) + +type HTTPResponse struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data interface{} `json:"data,omitempty"` +} + +func NewHTTPResponse(data interface{}) *HTTPResponse { + resp := &HTTPResponse{} + + switch data.(type) { + case e.ResponseError: + resp.Code = int(data.(e.ResponseError).Code()) + resp.Msg = data.(e.ResponseError).Error() + case error: + resp.Code = int(codes.Internal) + resp.Msg = data.(error).Error() + default: + resp.Msg = "Success" + resp.Data = data + } + + return resp +} diff --git a/pkg/bufman/handlers/http_handlers/doc.go b/pkg/bufman/handlers/http_handlers/doc.go new file mode 100644 index 000000000..79f5f62dd --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/doc.go @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/gin-gonic/gin" +) + +type docGroup struct { + docController *controllers.DocController +} + +var DocGroup = &docGroup{ + docController: controllers.NewDocController(), +} + +func (group *docGroup) GetSourceDirectoryInfo(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetSourceDirectoryInfoRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.docController.GetSourceDirectoryInfo(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *docGroup) GetSourceFile(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetSourceFileRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.docController.GetSourceFile(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *docGroup) GetModulePackages(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetModulePackagesRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.docController.GetModulePackages(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *docGroup) GetModuleDocumentation(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetModuleDocumentationRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.docController.GetModuleDocumentation(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *docGroup) GetPackageDocumentation(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetPackageDocumentationRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.docController.GetPackageDocumentation(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} diff --git a/pkg/bufman/handlers/http_handlers/repository.go b/pkg/bufman/handlers/http_handlers/repository.go new file mode 100644 index 000000000..6fc20b42b --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/repository.go @@ -0,0 +1,216 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/gin-gonic/gin" +) + +type repositoryGroup struct { + repositoryController *controllers.RepositoryController +} + +var RepositoryGroup = &repositoryGroup{ + repositoryController: controllers.NewRepositoryController(), +} + +func (group *repositoryGroup) CreateRepositoryByFullName(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.CreateRepositoryByFullNameRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.CreateRepositoryByFullName(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) GetRepository(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetRepositoryRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.GetRepository(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) GetRepositoryByFullName(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetRepositoryByFullNameRequest{} + repositoryName := c.Param("repository_name") + repositoryOwner := c.Param("repository_owner") + fullName := repositoryOwner + "/" + repositoryName + req.FullName = fullName + + resp, err := group.repositoryController.GetRepositoryByFullName(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) ListRepositories(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.ListRepositoriesRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.ListRepositories(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) DeleteRepository(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.DeleteRepositoryRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.DeleteRepository(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) ListUserRepositories(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.ListUserRepositoriesRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + bindErr = c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.ListUserRepositories(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) ListRepositoriesUserCanAccess(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.ListRepositoriesUserCanAccessRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.ListRepositoriesUserCanAccess(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) DeprecateRepositoryByName(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.DeprecateRepositoryByNameRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.DeprecateRepositoryByName(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) UndeprecateRepositoryByName(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.UndeprecateRepositoryByNameRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.UndeprecateRepositoryByName(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *repositoryGroup) UpdateRepositorySettingsByName(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.UpdateRepositorySettingsByNameRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.repositoryController.UpdateRepositorySettingsByName(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} diff --git a/pkg/bufman/handlers/http_handlers/tag.go b/pkg/bufman/handlers/http_handlers/tag.go new file mode 100644 index 000000000..35637b634 --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/tag.go @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/gin-gonic/gin" +) + +type tagGroup struct { + tagController *controllers.TagController +} + +var TagGroup = &tagGroup{ + tagController: controllers.NewTagController(), +} + +func (group *tagGroup) CreateRepositoryTag(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.CreateRepositoryTagRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.tagController.CreateRepositoryTag(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *tagGroup) ListRepositoryTags(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.ListRepositoryTagsRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.tagController.ListRepositoryTags(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} diff --git a/pkg/bufman/handlers/http_handlers/token.go b/pkg/bufman/handlers/http_handlers/token.go new file mode 100644 index 000000000..be9f50398 --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/token.go @@ -0,0 +1,104 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/gin-gonic/gin" +) + +type tokenGroup struct { + tokenController *controllers.TokenController +} + +var TokenGroup = &tokenGroup{ + tokenController: controllers.NewTokenController(), +} + +func (group *tokenGroup) CreateToken(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.CreateTokenRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.tokenController.CreateToken(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *tokenGroup) GetToken(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetTokenRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.tokenController.GetToken(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *tokenGroup) ListTokens(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.ListTokensRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.tokenController.ListTokens(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *tokenGroup) DeleteToken(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.DeleteTokenRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.tokenController.DeleteToken(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} diff --git a/pkg/bufman/handlers/http_handlers/user.go b/pkg/bufman/handlers/http_handlers/user.go new file mode 100644 index 000000000..de56839b5 --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/user.go @@ -0,0 +1,88 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/gin-gonic/gin" +) + +type userGroup struct { + userController *controllers.UserController +} + +var UserGroup = &userGroup{ + userController: controllers.NewUserController(), +} + +func (group *userGroup) CreateUser(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.CreateUserRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + // 查询用户 + resp, err := group.userController.CreateUser(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + return + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *userGroup) GetUser(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.GetUserRequest{} + bindErr := c.ShouldBindUri(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.userController.GetUser(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *userGroup) ListUsers(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.ListUsersRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.userController.ListUsers(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} diff --git a/pkg/bufman/interceptors/auth.go b/pkg/bufman/interceptors/auth.go new file mode 100644 index 000000000..c660762db --- /dev/null +++ b/pkg/bufman/interceptors/auth.go @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package interceptors + +import ( + "context" + "strings" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +func Auth() grpc.UnaryServerInterceptor { + return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return handler(ctx, req) + } + + tokens := md.Get(constant.AuthHeader) + if len(tokens) < 1 { + return handler(ctx, req) + } + + // Get user id + userID := i.auth(tokens[0]) + + return handler(context.WithValue(ctx, constant.UserIDKey, userID), req) + } +} + +func (i *interceptor) auth(rawToken string) (userID string) { + contents := strings.Split(rawToken, " ") + if len(contents) != 2 { + return "" + } + + prefix, token := contents[0], contents[1] + if prefix != constant.AuthPrefix { + return "" + } + + // 验证token + tokenEntity, err := i.tokenMapper.FindAvailableByTokenName(token) + if err != nil { + return "" + } + + return tokenEntity.UserID +} diff --git a/pkg/bufman/interceptors/init.go b/pkg/bufman/interceptors/init.go new file mode 100644 index 000000000..7a8832931 --- /dev/null +++ b/pkg/bufman/interceptors/init.go @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package interceptors + +import "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + +type interceptor struct { + tokenMapper mapper.TokenMapper +} + +var i *interceptor + +func init() { + i = &interceptor{ + tokenMapper: &mapper.TokenMapperImpl{}, + } +} diff --git a/pkg/bufman/mapper/commit_mapper.go b/pkg/bufman/mapper/commit_mapper.go new file mode 100644 index 000000000..11d68b84d --- /dev/null +++ b/pkg/bufman/mapper/commit_mapper.go @@ -0,0 +1,331 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mapper + +import ( + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/dal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + "gorm.io/gorm" +) + +type CommitMapper interface { + Create(commit *model.Commit) error + GetDraftCountsByRepositoryID(repositoryID string) (int64, error) + FindLastByRepositoryID(repositoryID string) (*model.Commit, error) + FindByRepositoryIDAndCommitName(repositoryID string, commitName string) (*model.Commit, error) + FindByRepositoryIDAndTagName(repositoryID string, tagName string) (*model.Commit, error) + FindByRepositoryIDAndDraftName(repositoryID string, draftName string) (*model.Commit, error) + FindByRepositoryIDAndReference(repositoryID string, reference string) (*model.Commit, error) + FindPageByRepositoryID(repositoryID string, offset, limit int, reverse bool) (model.Commits, error) + FindPageByRepositoryIDAndDraftName(repositoryID, draftName string, offset, limit int, reverse bool) (model.Commits, error) + FindPageByRepositoryIDAndTagName(repositoryID string, tagName string, offset, limit int, reverse bool) (model.Commits, error) + FindPageByRepositoryIDAndCommitName(repositoryID string, commitName string, offset, limit int, reverse bool) (model.Commits, error) + FindPageByRepositoryIDAndReference(repositoryID string, reference string, offset, limit int, reverse bool) (model.Commits, error) + FindDraftPageByRepositoryID(repositoryID string, offset, limit int, reverse bool) (model.Commits, error) + FindDraftPageByRepositoryIDAndQuery(repositoryID, query string, offset, limit int, reverse bool) (model.Commits, error) + DeleteByRepositoryIDAndDraftName(repositoryID string, draftName string) error +} + +type CommitMapperImpl struct{} + +var ( + ErrTagAndDraftDuplicated = errors.New("tag and draft duplicated") + ErrLastCommitDuplicated = errors.New("same commit compared to las commit") +) + +func (c *CommitMapperImpl) Create(commit *model.Commit) error { + return dal.Q.Transaction(func(tx *dal.Query) error { + // 检查与上次提交的是否相同 + lastCommit, err := tx.Commit.Where(tx.Commit.RepositoryID.Eq(commit.RepositoryID)).Last() + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return err + } + if lastCommit != nil && lastCommit.ManifestDigest == commit.ManifestDigest { + return ErrLastCommitDuplicated + } + + // 检查tag和draft是否冲突 + if len(commit.Tags) > 0 { + tagNames := make([]string, len(commit.Tags)) + for i := 0; i < len(commit.Tags); i++ { + tagNames[i] = commit.Tags[i].TagName + } + _, err = tx.Commit.Where(tx.Commit.RepositoryID.Eq(commit.RepositoryID), tx.Commit.DraftName.In(tagNames...)).First() + if err == nil || !errors.Is(err, gorm.ErrRecordNotFound) { + // 冲突 + return ErrTagAndDraftDuplicated + } + } + + // 存储 + err = tx.Commit.Create(commit) + if err != nil { + return err + } + + // 查询sequence id + sequenceID, err := c.FindSequenceID(commit) + if err != nil { + return err + } + commit.SequenceID = sequenceID + + return tx.Commit.Save(commit) + }) +} + +func (c *CommitMapperImpl) GetDraftCountsByRepositoryID(repositoryID string) (int64, error) { + return dal.Commit.Where(dal.Commit.CommitID.Eq(repositoryID), dal.Commit.DraftName.Neq("")).Count() +} + +func (c *CommitMapperImpl) FindLastByRepositoryID(repositoryID string) (*model.Commit, error) { + return dal.Commit.Where(dal.Commit.RepositoryID.Eq(repositoryID), dal.Commit.DraftName.Eq("")).Last() +} + +func (c *CommitMapperImpl) FindByRepositoryIDAndCommitName(repositoryID string, commitName string) (*model.Commit, error) { + return dal.Commit.Where(dal.Commit.RepositoryID.Eq(repositoryID), dal.Commit.CommitName.Eq(commitName)).First() +} + +func (c *CommitMapperImpl) FindByRepositoryIDAndTagName(repositoryID string, tagName string) (*model.Commit, error) { + tag := &model.Tag{} + commit := &model.Commit{} + err := dal.Q.Transaction(func(tx *dal.Query) error { + // 查询tag + var err error + tag, err = tx.Tag.Where(tx.Tag.RepositoryID.Eq(repositoryID), tx.Tag.TagName.Eq(tagName)).Last() + if err != nil { + return err + } + + commit, err = tx.Commit.Where(tx.Commit.CommitID.Eq(tag.CommitID)).First() + if err != nil { + return err + } + + return nil + }) + if err != nil { + return nil, err + } + + return commit, nil +} + +func (c *CommitMapperImpl) FindByRepositoryIDAndDraftName(repositoryID string, draftName string) (*model.Commit, error) { + return dal.Commit.Where(dal.Commit.RepositoryID.Eq(repositoryID), dal.Commit.DraftName.Eq(draftName)).Last() +} + +func (c *CommitMapperImpl) FindByRepositoryIDAndReference(repositoryID string, reference string) (*model.Commit, error) { + var commit *model.Commit + var err error + if reference == "" || reference == constant.DefaultBranch { + commit, err = c.FindLastByRepositoryID(repositoryID) + } else if len(reference) == constant.CommitLength { + // 查询commit + commit, err = c.FindByRepositoryIDAndCommitName(repositoryID, reference) + if err != nil { + return nil, err + } + } + + if commit != nil && err == nil { + return commit, nil + } + + // 查询tag + commit, err = c.FindByRepositoryIDAndTagName(repositoryID, reference) + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return nil, err + } + if err != nil { + // 查询draft + commit, err = c.FindByRepositoryIDAndDraftName(repositoryID, reference) + if err != nil { + return nil, err + } + } + + return commit, nil +} + +func (c *CommitMapperImpl) FindByRepositoryNameAndReference(repositoryID string, reference string) (*model.Commit, error) { + var commit *model.Commit + var err error + if reference == "" || reference == constant.DefaultBranch { + commit, err = c.FindLastByRepositoryID(repositoryID) + } else if len(reference) == constant.CommitLength { + // 查询commit + commit, err = c.FindByRepositoryIDAndCommitName(repositoryID, reference) + if err != nil { + return nil, err + } + } + + // 查询tag + commit, err = c.FindByRepositoryIDAndTagName(repositoryID, reference) + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return nil, err + } + if err != nil { + // 查询draft + commit, err = c.FindByRepositoryIDAndDraftName(repositoryID, reference) + if err != nil { + return nil, err + } + } + + return commit, nil +} + +func (c *CommitMapperImpl) FindPageByRepositoryID(repositoryID string, offset, limit int, reverse bool) (model.Commits, error) { + stmt := dal.Commit.Where(dal.Commit.RepositoryID.Eq(repositoryID), dal.Commit.DraftName.Eq("")).Offset(offset).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Commit.SequenceID.Desc()) + } else { + stmt = stmt.Order(dal.Commit.SequenceID) + } + + return stmt.Find() +} + +func (c *CommitMapperImpl) FindPageByRepositoryIDAndDraftName(repositoryID, draftName string, offset, limit int, reverse bool) (model.Commits, error) { + stmt := dal.Commit.Where(dal.Commit.RepositoryID.Eq(repositoryID), dal.Commit.DraftName.Eq(draftName)).Offset(offset).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Commit.ID.Desc()) + } + + return stmt.Find() +} + +func (c *CommitMapperImpl) FindPageByRepositoryIDAndCommitName(repositoryID string, commitName string, offset, limit int, reverse bool) (model.Commits, error) { + var commits model.Commits + err := dal.Q.Transaction(func(tx *dal.Query) error { + // 查询commit name对应的sequence id + commit, err := tx.Commit.Where(tx.Commit.RepositoryID.Eq(repositoryID), tx.Commit.CommitName.Eq(commitName)).Last() + if err != nil { + return err + } + + // 查询commits + stmt := tx.Commit.Where(tx.Commit.RepositoryID.Eq(repositoryID), tx.Commit.DraftName.Eq(""), tx.Commit.SequenceID.Lte(commit.SequenceID)).Offset(offset).Limit(limit) + if reverse { + stmt.Order(tx.Commit.SequenceID.Desc()) + } + commits, err = stmt.Find() + if err != nil { + return err + } + + return nil + }) + if err != nil { + return nil, err + } + + return commits, nil +} + +func (c *CommitMapperImpl) FindPageByRepositoryIDAndTagName(repositoryID string, tagName string, offset, limit int, reverse bool) (model.Commits, error) { + var commits model.Commits + err := dal.Q.Transaction(func(tx *dal.Query) error { + // 查询tag + tag, err := tx.Tag.Where(tx.Tag.RepositoryID.Eq(repositoryID), tx.Tag.TagName.Eq(tagName)).Last() + if err != nil { + return err + } + + // 查询commits + commits, err = c.FindPageByRepositoryIDAndCommitName(repositoryID, tag.CommitName, offset, limit, reverse) + if err != nil { + return err + } + + return nil + }) + if err != nil { + return nil, err + } + + return commits, nil +} + +func (c *CommitMapperImpl) FindPageByRepositoryIDAndReference(repositoryID string, reference string, offset, limit int, reverse bool) (model.Commits, error) { + var commits model.Commits + var err error + if reference == "" || reference == constant.DefaultBranch { + commits, err = c.FindPageByRepositoryID(repositoryID, offset, limit, reverse) + } else if len(reference) == constant.CommitLength { + commits, err = c.FindPageByRepositoryIDAndCommitName(repositoryID, reference, offset, limit, reverse) + } else { + commits, err = c.FindPageByRepositoryIDAndTagName(repositoryID, reference, offset, limit, reverse) + } + + if err != nil { + return nil, err + } + + if len(commits) == 0 { + // 查询drafts + commits, err = c.FindPageByRepositoryIDAndDraftName(repositoryID, reference, offset, limit, reverse) + if err != nil { + return nil, err + } + } + + return commits, nil +} + +func (c *CommitMapperImpl) FindDraftPageByRepositoryID(repositoryID string, offset, limit int, reverse bool) (model.Commits, error) { + stmt := dal.Commit.Where(dal.Commit.RepositoryID.Eq(repositoryID), dal.Commit.DraftName.Neq("")).Offset(offset).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Commit.ID.Desc()) + } + + return stmt.Find() +} + +func (c *CommitMapperImpl) FindDraftPageByRepositoryIDAndQuery(repositoryID, query string, offset, limit int, reverse bool) (model.Commits, error) { + stmt := dal.Commit.Where(dal.Commit.RepositoryID.Eq(repositoryID), dal.Commit.DraftName.Neq(""), dal.Commit.DraftName.Like("%"+query+"%")).Offset(offset).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Commit.ID.Desc()) + } + + return stmt.Find() +} + +func (c *CommitMapperImpl) DeleteByRepositoryIDAndDraftName(repositoryID string, draftName string) error { + _, err := dal.Commit.Where(dal.Commit.RepositoryID.Eq(repositoryID), dal.Commit.DraftName.Eq(draftName), dal.Commit.DraftName.Neq("")).Delete() + return err +} + +func (c *CommitMapperImpl) FindSequenceID(commit *model.Commit) (int64, error) { + var sequenceID int64 + var err error + if commit.DraftName == "" { + sequenceID, err = dal.Commit.Where(dal.Commit.DraftName.Eq(""), dal.Commit.ID.Lte(commit.ID), dal.Commit.CreatedTime.Lte(commit.CreatedTime)).Count() + } else { + // draft 没有sequence id + return 0, nil + } + if err != nil { + return 0, err + } + + return sequenceID, nil +} diff --git a/pkg/bufman/mapper/file_mapper.go b/pkg/bufman/mapper/file_mapper.go new file mode 100644 index 000000000..192cc1e8e --- /dev/null +++ b/pkg/bufman/mapper/file_mapper.go @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mapper + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/dal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type FileMapper interface { + FindAllBlobsByCommitID(commitID string) (model.FileBlobs, error) + FindManifestByCommitID(commitID string) (*model.FileManifest, error) + FindBlobByCommitIDAndPath(commitID, path string) (*model.FileBlob, error) +} + +type FileMapperImpl struct{} + +func (f *FileMapperImpl) FindAllBlobsByCommitID(commitID string) (model.FileBlobs, error) { + return dal.FileBlob.Where(dal.FileBlob.CommitID.Eq(commitID)).Find() +} + +func (f *FileMapperImpl) FindManifestByCommitID(commitID string) (*model.FileManifest, error) { + return dal.FileManifest.Where(dal.FileManifest.CommitID.Eq(commitID)).First() +} + +func (f *FileMapperImpl) FindBlobByCommitIDAndPath(commitID, path string) (*model.FileBlob, error) { + return dal.FileBlob.Where(dal.FileBlob.CommitID.Eq(commitID), dal.FileBlob.FileName.Eq(path)).First() +} diff --git a/pkg/bufman/mapper/repository_mapper.go b/pkg/bufman/mapper/repository_mapper.go new file mode 100644 index 000000000..5d0aac6fc --- /dev/null +++ b/pkg/bufman/mapper/repository_mapper.go @@ -0,0 +1,159 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mapper + +import ( + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/dal" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type RepositoryMapper interface { + Create(repository *model.Repository) error + FindByRepositoryID(repositoryID string) (*model.Repository, error) + FindByUserNameAndRepositoryName(userName, RepositoryName string) (*model.Repository, error) + FindPage(offset, limit int, reverse bool) (model.Repositories, error) + FindPageByQuery(query string, offset, limit int, reverse bool) (model.Repositories, error) + FindPageByUserID(userID string, offset, limit int, reverse bool) (model.Repositories, error) + FindAccessiblePageByUserID(userID string, offset, limit int, reverse bool) (model.Repositories, error) + DeleteByRepositoryID(repositoryID string) error + DeleteByUserNameAndRepositoryName(userName, RepositoryName string) error + UpdateByUserNameAndRepositoryName(userName, RepositoryName string, repository *model.Repository) error + UpdateDeprecatedByUserNameAndRepositoryName(userName, RepositoryName string, repository *model.Repository) error +} + +type RepositoryMapperImpl struct{} + +func (r *RepositoryMapperImpl) Create(repository *model.Repository) error { + return dal.Q.Transaction(func(tx *dal.Query) error { + // 更新用户 update time + _, err := tx.User.Where(tx.User.UserID.Eq(repository.UserID)).Update(tx.User.UpdateTime, time.Now()) + if err != nil { + return err + } + + // create + return tx.Repository.Create(repository) + }) +} + +func (r *RepositoryMapperImpl) FindByRepositoryID(repositoryID string) (*model.Repository, error) { + return dal.Repository.Where(dal.Repository.RepositoryID.Eq(repositoryID)).First() +} + +func (r *RepositoryMapperImpl) FindByUserNameAndRepositoryName(userName, RepositoryName string) (*model.Repository, error) { + return dal.Repository.Where(dal.Repository.UserName.Eq(userName), dal.Repository.RepositoryName.Eq(RepositoryName)).First() +} + +func (r *RepositoryMapperImpl) FindPage(offset, limit int, reverse bool) (model.Repositories, error) { + stmt := dal.Repository.Offset(offset).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Repository.ID.Desc()) + } + + return stmt.Find() +} + +func (r *RepositoryMapperImpl) FindPageByQuery(query string, offset, limit int, reverse bool) (model.Repositories, error) { + stmt := dal.Repository.Where(dal.Repository.RepositoryName.Like("%" + query + "%")).Or(dal.Repository.Description.Like("%" + query + "%")).Offset(offset).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Repository.ID.Desc()) + } + + return stmt.Find() +} + +func (r *RepositoryMapperImpl) FindPageByUserID(userID string, offset, limit int, reverse bool) (model.Repositories, error) { + stmt := dal.Repository.Offset(offset).Where(dal.Repository.UserID.Eq(userID)).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Repository.ID.Desc()) + } + + return stmt.Find() +} + +func (r *RepositoryMapperImpl) FindAccessiblePageByUserID(userID string, offset, limit int, reverse bool) (model.Repositories, error) { + stmt := dal.Repository.Offset(offset).Where(dal.Repository.Visibility.Eq(uint8(registryv1alpha1.Visibility_VISIBILITY_PUBLIC))).Or(dal.Repository.UserID.Eq(userID)).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Repository.ID.Desc()) + } + + return stmt.Find() +} + +func (r *RepositoryMapperImpl) DeleteByRepositoryID(repositoryID string) error { + repository := &model.Repository{} + return dal.Q.Transaction(func(tx *dal.Query) error { + // 删除repo + _, err := tx.Repository.Where(tx.Repository.RepositoryID.Eq(repositoryID)).Delete(repository) + if err != nil { + return err + } + + // 删除commit + _, err = tx.Commit.Where(tx.Commit.RepositoryID.Eq(repositoryID)).Delete() + if err != nil { + return err + } + + // 删除tag + _, err = tx.Tag.Where(tx.Tag.RepositoryID.Eq(repositoryID)).Delete() + if err != nil { + return err + } + + return nil + }) +} + +func (r *RepositoryMapperImpl) DeleteByUserNameAndRepositoryName(userName, RepositoryName string) error { + repository := &model.Repository{} + return dal.Q.Transaction(func(tx *dal.Query) error { + // 删除repo + _, err := tx.Repository.Where(tx.Repository.UserName.Eq(userName), tx.Repository.RepositoryName.Eq(RepositoryName)).Delete(repository) + if err != nil { + return err + } + + // 删除commit + _, err = tx.Commit.Where(tx.Commit.RepositoryID.Eq(repository.RepositoryID)).Delete() + if err != nil { + return err + } + + // 删除tag + _, err = tx.Tag.Where(tx.Tag.RepositoryID.Eq(repository.RepositoryID)).Delete() + if err != nil { + return err + } + + return nil + }) +} + +func (r *RepositoryMapperImpl) UpdateByUserNameAndRepositoryName(userName, RepositoryName string, repository *model.Repository) error { + _, err := dal.Repository.Select(dal.Repository.Visibility, dal.Repository.Description).Where(dal.Repository.UserName.Eq(userName), dal.Repository.RepositoryName.Eq(RepositoryName)).Updates(repository) + + return err +} + +func (r *RepositoryMapperImpl) UpdateDeprecatedByUserNameAndRepositoryName(userName, RepositoryName string, repository *model.Repository) error { + _, err := dal.Repository.Select(dal.Repository.Deprecated, dal.Repository.DeprecationMsg).Where(dal.Repository.UserName.Eq(userName), dal.Repository.RepositoryName.Eq(RepositoryName)).Updates(repository) + + return err +} diff --git a/pkg/bufman/mapper/tag_mapper.go b/pkg/bufman/mapper/tag_mapper.go new file mode 100644 index 000000000..5e0b273ec --- /dev/null +++ b/pkg/bufman/mapper/tag_mapper.go @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mapper + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/dal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type TagMapper interface { + Create(tag *model.Tag) error + GetCountsByRepositoryID(repositoryID string) (int64, error) + FindPageByRepositoryID(repositoryID string, offset, limit int, reverse bool) (model.Tags, error) + FindPageByRepositoryIDAndQuery(repositoryID, query string, offset, limit int, reverse bool) (model.Tags, error) +} + +type TagMapperImpl struct{} + +func (t *TagMapperImpl) Create(tag *model.Tag) error { + return dal.Tag.Create(tag) +} + +func (t *TagMapperImpl) GetCountsByRepositoryID(repositoryID string) (int64, error) { + return dal.Tag.Where(dal.Tag.RepositoryID.Eq(repositoryID)).Count() +} + +func (t *TagMapperImpl) FindPageByRepositoryID(repositoryID string, offset, limit int, reverse bool) (model.Tags, error) { + stmt := dal.Tag.Where(dal.Tag.RepositoryID.Eq(repositoryID)).Offset(offset).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Tag.ID.Desc()) + } + + return stmt.Find() +} + +func (t *TagMapperImpl) FindPageByRepositoryIDAndQuery(repositoryID, query string, offset, limit int, reverse bool) (model.Tags, error) { + stmt := dal.Tag.Where(dal.Tag.RepositoryID.Eq(repositoryID), dal.Tag.TagName.Like("%"+query+"%")).Offset(offset).Limit(limit) + if reverse { + stmt = stmt.Order(dal.Tag.ID.Desc()) + } + + return stmt.Find() +} diff --git a/pkg/bufman/mapper/token_mapper.go b/pkg/bufman/mapper/token_mapper.go new file mode 100644 index 000000000..87a480e02 --- /dev/null +++ b/pkg/bufman/mapper/token_mapper.go @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mapper + +import ( + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/dal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type TokenMapper interface { + Create(token *model.Token) error + FindAvailableByTokenID(tokenID string) (*model.Token, error) + FindAvailableByTokenName(tokenName string) (*model.Token, error) + FindAvailablePageByUserID(userID string, offset int, limit int, reverse bool) (model.Tokens, error) + DeleteByTokenID(tokenID string) error +} + +type TokenMapperImpl struct{} + +func (t *TokenMapperImpl) Create(token *model.Token) error { + return dal.Token.Create(token) +} + +func (t *TokenMapperImpl) FindAvailableByTokenID(tokenID string) (*model.Token, error) { + return dal.Token.Where(dal.Token.TokenID.Eq(tokenID), dal.Token.ExpireTime.Gt(time.Now())).First() +} + +func (t *TokenMapperImpl) FindAvailableByTokenName(tokenName string) (*model.Token, error) { + return dal.Token.Where(dal.Token.TokenName.Eq(tokenName), dal.Token.ExpireTime.Gt(time.Now())).First() +} + +func (t *TokenMapperImpl) FindAvailablePageByUserID(userID string, offset int, limit int, reverse bool) (model.Tokens, error) { + stmt := dal.Token.Where(dal.Token.UserID.Eq(userID), dal.Token.ExpireTime.Gt(time.Now())) + if reverse { + stmt.Order(dal.Token.ID.Desc()) + } + + tokens, _, err := stmt.FindByPage(offset, limit) + + return tokens, err +} + +func (t *TokenMapperImpl) DeleteByTokenID(tokenID string) error { + token := &model.Token{} + _, err := dal.Token.Where(dal.Token.TokenID.Eq(tokenID), dal.Token.ExpireTime.Gt(time.Now())).Delete(token) + return err +} diff --git a/pkg/bufman/mapper/user_mapper.go b/pkg/bufman/mapper/user_mapper.go new file mode 100644 index 000000000..d8144c0a7 --- /dev/null +++ b/pkg/bufman/mapper/user_mapper.go @@ -0,0 +1,63 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mapper + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/dal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type UserMapper interface { + Create(user *model.User) error + FindByUserID(userID string) (*model.User, error) + FindByUserName(userName string) (*model.User, error) + FindPage(offset int, limit int, reverse bool) (model.Users, error) + FindPageByQuery(query string, offset int, limit int, reverse bool) (model.Users, error) +} + +type UserMapperImpl struct{} + +func (u *UserMapperImpl) Create(user *model.User) error { + return dal.User.Create(user) +} + +func (u *UserMapperImpl) FindByUserID(userID string) (*model.User, error) { + return dal.User.Where(dal.User.UserID.Eq(userID)).First() +} + +func (u *UserMapperImpl) FindByUserName(userName string) (*model.User, error) { + return dal.User.Where(dal.User.UserName.Eq(userName)).First() +} + +func (u *UserMapperImpl) FindPage(offset int, limit int, reverse bool) (model.Users, error) { + stmt := dal.User + if reverse { + stmt.Order(dal.User.ID.Desc()) + } + + users, _, err := stmt.FindByPage(offset, limit) + return users, err +} + +func (u *UserMapperImpl) FindPageByQuery(query string, offset int, limit int, reverse bool) (model.Users, error) { + stmt := dal.User.Where(dal.User.UserName.Like("%" + query + "%")) + if reverse { + stmt.Order(dal.User.ID.Desc()) + } + + users, _, err := stmt.FindByPage(offset, limit) + return users, err +} diff --git a/pkg/bufman/model/commit.go b/pkg/bufman/model/commit.go new file mode 100644 index 000000000..90d2d15ec --- /dev/null +++ b/pkg/bufman/model/commit.go @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package model + +import ( + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/config" + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + modulev1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/module/v1alpha1" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type Commit struct { + ID int64 `gorm:"primaryKey;autoIncrement"` + UserID string `gorm:"type:varchar(64);"` + UserName string `gorm:"type:varchar(200);not null"` + RepositoryID string `gorm:"type:varchar(64)"` + RepositoryName string `gorm:"type:varchar(200)"` + CommitID string `gorm:"type:varchar(64);unique;not null"` + CommitName string `gorm:"type:varchar(64);unique"` + DraftName string `gorm:"type:varchar(20)"` + CreatedTime time.Time `gorm:"autoCreateTime"` + ManifestDigest string `gorm:"type:string;"` + BufManConfigDigest string `gorm:"not null"` // bufman配置文件digest + DocumentDigest string // README文档digest + LicenseDigest string // README文档digest + + SequenceID int64 + + // 文件清单 + FileManifest *FileManifest `gorm:"foreignKey:CommitID;references:CommitID"` + // 文件blobs + FileBlobs FileBlobs `gorm:"foreignKey:CommitID;references:CommitID"` + // 关联的tag + Tags Tags `gorm:"foreignKey:RepositoryID;references:RepositoryID"` +} + +func (commit *Commit) TableName() string { + return "commits" +} + +func (commit *Commit) ToProtoLocalModulePin() *registryv1alpha1.LocalModulePin { + if commit == nil { + return (&Commit{}).ToProtoLocalModulePin() + } + + modulePin := ®istryv1alpha1.LocalModulePin{ + Owner: commit.UserName, + Repository: commit.RepositoryName, + Commit: commit.CommitName, + CreateTime: timestamppb.New(commit.CreatedTime), + ManifestDigest: string(manifest.DigestTypeShake256) + ":" + commit.ManifestDigest, + } + + if commit.DraftName == "" { + modulePin.Branch = constant.DefaultBranch + } + + if commit.DraftName != "" { + modulePin.DraftName = commit.DraftName + } + + return modulePin +} + +func (commit *Commit) ToProtoModulePin() *modulev1alpha1.ModulePin { + if commit == nil { + return (&Commit{}).ToProtoModulePin() + } + + modulePin := &modulev1alpha1.ModulePin{ + Remote: config.Properties.Server.ServerHost, + Owner: commit.UserName, + Repository: commit.RepositoryName, + Commit: commit.CommitName, + CreateTime: timestamppb.New(commit.CreatedTime), + ManifestDigest: string(manifest.DigestTypeShake256) + ":" + commit.ManifestDigest, + } + + return modulePin +} + +func (commit *Commit) ToProtoRepositoryCommit() *registryv1alpha1.RepositoryCommit { + if commit == nil { + return (&Commit{}).ToProtoRepositoryCommit() + } + + repositoryCommit := ®istryv1alpha1.RepositoryCommit{ + Id: commit.CommitID, + CreateTime: timestamppb.New(commit.CreatedTime), + Name: commit.CommitName, + CommitSequenceId: commit.SequenceID, + Author: commit.UserName, + ManifestDigest: string(manifest.DigestTypeShake256) + ":" + commit.ManifestDigest, + } + + if commit.DraftName != "" { + repositoryCommit.DraftName = commit.DraftName + } + + if len(commit.Tags) > 0 { + repositoryCommit.Tags = commit.Tags.ToProtoRepositoryTags() + } + + return repositoryCommit +} + +type Commits []*Commit + +func (commits *Commits) ToProtoRepositoryCommits() []*registryv1alpha1.RepositoryCommit { + repositoryCommits := make([]*registryv1alpha1.RepositoryCommit, len(*commits)) + for i := 0; i < len(*commits); i++ { + repositoryCommits[i] = (*commits)[i].ToProtoRepositoryCommit() + } + + return repositoryCommits +} + +func (commits *Commits) ToProtoModulePins() []*modulev1alpha1.ModulePin { + modulePins := make([]*modulev1alpha1.ModulePin, len(*commits)) + for i := 0; i < len(*commits); i++ { + modulePins[i] = (*commits)[i].ToProtoModulePin() + } + + return modulePins +} diff --git a/pkg/bufman/model/file.go b/pkg/bufman/model/file.go new file mode 100644 index 000000000..cd084026b --- /dev/null +++ b/pkg/bufman/model/file.go @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package model + +import ( + "path/filepath" + "strings" + "time" + + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" +) + +// FileManifest 保存文件清单,记录每一次提交的所有文件 +type FileManifest struct { + ID int64 `gorm:"primaryKey;autoIncrement"` + Digest string // 文件清单哈希 + CommitID string `gorm:"type:varchar(64), unique"` + Content string `gorm:"-"` // 文件清单内容 + UserID string `gorm:"-"` + UserName string `gorm:"-"` + RepositoryID string `gorm:"-"` + RepositoryName string `gorm:"-"` + CommitName string `gorm:"-"` + DraftName string `gorm:"-"` + CreatedTime time.Time `gorm:"-"` +} + +type FileManifests []*FileManifest + +// FileBlob 保存文件blob +type FileBlob struct { + ID int64 `gorm:"primaryKey;autoIncrement"` + Digest string // 文件哈希 + CommitID string `gorm:"type:varchar(64);index"` + FileName string + Content string `gorm:"-"` + UserID string `gorm:"-"` + UserName string `gorm:"-"` + RepositoryID string `gorm:"-"` + RepositoryName string `gorm:"-"` + CommitName string `gorm:"-"` + CreatedTime time.Time `gorm:"-"` +} + +type FileBlobs []*FileBlob + +func (fileBlobs *FileBlobs) ToProtoFileInfo() *registryv1alpha1.FileInfo { + root := ®istryv1alpha1.FileInfo{ + Path: ".", + IsDir: true, + } + + for i := 0; i < len(*fileBlobs); i++ { + fileBlob := (*fileBlobs)[i] + if fileBlobs == nil { + fileBlob = &FileBlob{} + } + doToProtoFileInfo(root, fileBlob.FileName) + } + + return root +} + +func doToProtoFileInfo(root *registryv1alpha1.FileInfo, filePath string) { + // 分割file path + filePath = filepath.ToSlash(filePath) + pathLists := strings.Split(filePath, "/") + // level指向当前层数 + level := root + + // 按照路径去查找 + for i := 0; i < len(pathLists); i++ { + path := strings.Join(pathLists[:i+1], "/") + exists := false + var next *registryv1alpha1.FileInfo + if level.Children != nil { + // 在child中寻找path + for _, child := range level.Children { + if child.Path == path { + exists = true + next = child + break + } + } + } + + // path不存在 + if !exists { + child := ®istryv1alpha1.FileInfo{ + Path: path, + IsDir: i < len(pathLists)-1, + } + level.Children = append(level.Children, child) + next = child + } + + level = next // 指向下一层 + } +} + +//// FileIdentity 唯一文件表,根据哈希值记录文件实际存储地址 +//type FileIdentity struct { +// ID int64 `gorm:"primaryKey;autoIncrement"` +// Digest string `gorm:"unique"` // 文件哈希 +// Location string // 文件实际存储地址 +// FileName string // 文件实际存储名字 +//} diff --git a/pkg/bufman/model/init.go b/pkg/bufman/model/init.go new file mode 100644 index 000000000..3b7699e72 --- /dev/null +++ b/pkg/bufman/model/init.go @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package model + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/config" + "gorm.io/driver/mysql" + "gorm.io/gorm" +) + +func InitDB() { + dsn := config.Properties.MySQL.MysqlDsn + var DB *gorm.DB + var err error + if dsn == "" { + panic("MySQL DSN is empty") + } else { + DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{TranslateError: true}) + } + + if err != nil { + panic(err) + } else { + config.DataBase = DB + // init table + initErr := DB.AutoMigrate( + &Repository{}, + &Commit{}, + &Tag{}, + &User{}, + &Token{}, + &FileManifest{}, + &FileBlob{}, + ) + if initErr != nil { + panic(initErr) + } + } + + db, err := config.DataBase.DB() + if err != nil { + panic(err) + } + + db.SetMaxOpenConns(config.Properties.MySQL.MaxOpenConnections) + db.SetMaxIdleConns(config.Properties.MySQL.MaxIdleConnections) + db.SetConnMaxLifetime(config.Properties.MySQL.MaxLifeTime) + db.SetConnMaxIdleTime(config.Properties.MySQL.MaxIdleTime) +} diff --git a/pkg/bufman/model/repository.go b/pkg/bufman/model/repository.go new file mode 100644 index 000000000..5c54cd585 --- /dev/null +++ b/pkg/bufman/model/repository.go @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package model + +import ( + "time" + + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "google.golang.org/protobuf/types/known/timestamppb" +) + +// Repository 仓库 +type Repository struct { + ID int64 `gorm:"primaryKey;autoIncrement"` + UserID string `gorm:"type:varchar(64);uniqueIndex:uni_user_id_name"` // 所属用户,与仓库名组成唯一索引 + UserName string `gorm:"type:varchar(200);not null"` + RepositoryID string `gorm:"type:varchar(64);unique;not null"` + RepositoryName string `gorm:"type:varchar(200);uniqueIndex:uni_user_id_name"` // 仓库名,与拥有者组成唯一索引 + CreatedTime time.Time `gorm:"autoCreateTime"` + UpdateTime time.Time `gorm:"autoUpdateTime"` + Visibility uint8 `gorm:"default:1"` // 可见性,1:public 2:private + Deprecated bool // 是否弃用 + DeprecationMsg string // 弃用说明 + Url string // 描述信息中的Url + Description string // 描述信息 + + // 拥有的draft + DraftCommits []*Commit `gorm:"foreignKey:RepositoryID;references:RepositoryID"` + // 拥有的tag + Tags []*Tag `gorm:"foreignKey:RepositoryID;references:RepositoryID"` +} + +func (repository *Repository) TableName() string { + return "repositories" +} + +func (repository *Repository) ToProtoRepository() *registryv1alpha1.Repository { + if repository == nil { + return (&Repository{}).ToProtoRepository() + } + + return ®istryv1alpha1.Repository{ + Id: repository.RepositoryID, + CreateTime: timestamppb.New(repository.CreatedTime), + UpdateTime: timestamppb.New(repository.UpdateTime), + Name: repository.RepositoryName, + Owner: ®istryv1alpha1.Repository_UserId{UserId: repository.UserID}, + Visibility: registryv1alpha1.Visibility(repository.Visibility), + Deprecated: repository.Deprecated, + DeprecationMessage: repository.DeprecationMsg, + OwnerName: repository.UserName, + Description: repository.Description, + Url: repository.Url, + } +} + +type Repositories []*Repository + +func (repositoryEntities *Repositories) ToProtoRepositories() []*registryv1alpha1.Repository { + repositories := make([]*registryv1alpha1.Repository, 0, len(*repositoryEntities)) + + for i := 0; i < len(*repositoryEntities); i++ { + repositories = append(repositories, (*repositoryEntities)[i].ToProtoRepository()) + } + + return repositories +} + +type RepositoryCounts struct { + TagsCount int64 + DraftsCount int64 +} + +func (repositoryCounts *RepositoryCounts) ToProtoRepositoryCounts() *registryv1alpha1.RepositoryCounts { + if repositoryCounts == nil { + return (&RepositoryCounts{}).ToProtoRepositoryCounts() + } + + return ®istryv1alpha1.RepositoryCounts{ + TagsCount: uint32(repositoryCounts.TagsCount), + DraftsCount: uint32(repositoryCounts.DraftsCount), + } +} diff --git a/pkg/bufman/model/tag.go b/pkg/bufman/model/tag.go new file mode 100644 index 000000000..222c8cce7 --- /dev/null +++ b/pkg/bufman/model/tag.go @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package model + +import ( + "time" + + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type Tag struct { + ID int64 `gorm:"primaryKey;autoIncrement"` + UserID string `gorm:"type:varchar(64)"` + UserName string `gorm:"type:varchar(200);not null"` + RepositoryID string `gorm:"type:varchar(64)"` + // RepositoryName string `gorm:"type:varchar(200)"` + CommitID string `gorm:"type:varchar(64)"` + CommitName string `gorm:"type:varchar(64)"` + TagID string `gorm:"type:varchar(64);unique;not null"` + CreatedTime time.Time `gorm:"autoCreateTime"` + TagName string `gorm:"type:varchar(20)"` +} + +func (tag *Tag) TableName() string { + return "tags" +} + +func (tag *Tag) ToProtoRepositoryTag() *registryv1alpha1.RepositoryTag { + if tag == nil { + return (&Tag{}).ToProtoRepositoryTag() + } + + return ®istryv1alpha1.RepositoryTag{ + Id: tag.TagID, + CreateTime: timestamppb.New(tag.CreatedTime), + Name: tag.TagName, + CommitName: tag.CommitName, + Author: tag.UserName, + } +} + +type Tags []*Tag + +func (tags *Tags) ToProtoRepositoryTags() []*registryv1alpha1.RepositoryTag { + repositoryTags := make([]*registryv1alpha1.RepositoryTag, len(*tags)) + for i := 0; i < len(*tags); i++ { + repositoryTags[i] = (*tags)[i].ToProtoRepositoryTag() + } + + return repositoryTags +} diff --git a/pkg/bufman/model/token.go b/pkg/bufman/model/token.go new file mode 100644 index 000000000..32510d380 --- /dev/null +++ b/pkg/bufman/model/token.go @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package model + +import ( + "time" + + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type Token struct { + ID int64 `gorm:"primaryKey;autoIncrement"` + UserID string `gorm:"type:varchar(64);not null"` + TokenID string `gorm:"type:varchar(64);unique; not null"` + TokenName string `gorm:"type:varchar(64);type:string"` + CreatedTime time.Time `gorm:"autoCreateTime"` + ExpireTime time.Time `gorm:"not null"` // token 过期时间 + Note string +} + +func (token *Token) TableName() string { + return "tokens" +} + +func (token *Token) ToProtoToken() *registryv1alpha1.Token { + if token == nil { + return (&Token{}).ToProtoToken() + } + + return ®istryv1alpha1.Token{ + Id: token.TokenID, + CreateTime: timestamppb.New(token.CreatedTime), + ExpireTime: timestamppb.New(token.ExpireTime), + Note: token.Note, + } +} + +type Tokens []*Token + +func (tokens *Tokens) ToProtoTokens() []*registryv1alpha1.Token { + ts := make([]*registryv1alpha1.Token, 0, len(*tokens)) + for i := 0; i < len(*tokens); i++ { + ts = append(ts, (*tokens)[i].ToProtoToken()) + } + + return ts +} diff --git a/pkg/bufman/model/user.go b/pkg/bufman/model/user.go new file mode 100644 index 000000000..2db73d362 --- /dev/null +++ b/pkg/bufman/model/user.go @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package model + +import ( + "time" + + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "google.golang.org/protobuf/types/known/timestamppb" +) + +// User 用户表 +type User struct { + ID int64 `gorm:"primaryKey;autoIncrement"` + UserID string `gorm:"type:varchar(64);unique; not null"` + UserName string `gorm:"type:varchar(200);unique;not null"` + Password string `gorm:"type:varchar(64);not null"` + CreatedTime time.Time `gorm:"autoCreateTime"` + UpdateTime time.Time `gorm:"autoUpdateTime"` + Deactivated bool // 无效 + Url string + Description string // 描述信息 + UserType int32 `gorm:"default:1"` +} + +func (user *User) TableName() string { + return "users" +} + +func (user *User) ToProtoUser() *registryv1alpha1.User { + if user == nil { + return (&User{}).ToProtoUser() + } + + return ®istryv1alpha1.User{ + Id: user.UserID, + CreateTime: timestamppb.New(user.CreatedTime), + UpdateTime: timestamppb.New(user.UpdateTime), + Username: user.UserName, + Deactivated: user.Deactivated, + Description: user.Description, + Url: user.Url, + } +} + +type Users []*User + +func (users *Users) ToProtoUsers() []*registryv1alpha1.User { + protoUsers := make([]*registryv1alpha1.User, 0, len(*users)) + for i := 0; i < len(*users); i++ { + protoUsers = append(protoUsers, (*users)[i].ToProtoUser()) + } + + return protoUsers +} diff --git a/pkg/bufman/router/grpc_router.go b/pkg/bufman/router/grpc_router.go new file mode 100644 index 000000000..5674336e2 --- /dev/null +++ b/pkg/bufman/router/grpc_router.go @@ -0,0 +1,159 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package router + +import ( + "crypto/tls" + "crypto/x509" + "fmt" + "net" + + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/handlers/grpc_handlers" + "github.com/apache/dubbo-kubernetes/pkg/bufman/interceptors" + dubbo_cp "github.com/apache/dubbo-kubernetes/pkg/config/app/dubbo-cp" + "github.com/apache/dubbo-kubernetes/pkg/core/cert/provider" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/reflection" +) + +type GRPCRouter struct { + PlainServer *grpc.Server + PlainServerPort int + SecureServer *grpc.Server + SecureServerPort int +} +type GrpcServer struct { + PlainServer *grpc.Server + PlainServerPort int + SecureServer *grpc.Server + SecureServerPort int +} + +func newGrpcServer(s *provider.CertStorage, config *dubbo_cp.Config) *GRPCRouter { + router := &GRPCRouter{ + PlainServerPort: config.Bufman.Server.GrpcPlainPort, + SecureServerPort: config.Bufman.Server.GrpcSecurePort, + } + pool := x509.NewCertPool() + tlsConfig := &tls.Config{ + GetCertificate: func(info *tls.ClientHelloInfo) (*tls.Certificate, error) { + for _, cert := range s.GetTrustedCerts() { + pool.AddCert(cert.Cert) + } + return s.GetServerCert(info.ServerName), nil + }, + ClientCAs: pool, + ClientAuth: tls.VerifyClientCertIfGiven, + } + + router.PlainServer = grpc.NewServer(grpc.ChainUnaryInterceptor(interceptors.Auth())) + reflection.Register(router.PlainServer) + + router.SecureServer = grpc.NewServer(grpc.Creds(credentials.NewTLS(tlsConfig)), grpc.ChainUnaryInterceptor(interceptors.Auth())) + reflection.Register(router.SecureServer) + return router +} + +func (r *GRPCRouter) NeedLeaderElection() bool { + return false +} + +func (r *GRPCRouter) Start(stop <-chan struct{}) error { + plainLis, err := net.Listen("tcp", fmt.Sprintf(":%d", r.PlainServerPort)) + if err != nil { + return err + } + secureLis, err := net.Listen("tcp", fmt.Sprintf(":%d", r.SecureServerPort)) + if err != nil { + return err + } + plainErrChan := make(chan error) + secureErrChan := make(chan error) + go func() { + defer close(plainErrChan) + if err = r.PlainServer.Serve(plainLis); err != nil { + logger.Sugar().Error(err, "bufman terminated with an error") + plainErrChan <- err + } else { + logger.Sugar().Info("bufman terminated normally") + } + }() + go func() { + defer close(secureErrChan) + if err = r.SecureServer.Serve(secureLis); err != nil { + logger.Sugar().Error(err, "bufman terminated with an error") + secureErrChan <- err + } else { + logger.Sugar().Info("terminated normally") + } + }() + + select { + case <-stop: + logger.Sugar().Info("bufman stopping gracefully") + r.PlainServer.GracefulStop() + r.SecureServer.GracefulStop() + return nil + case err := <-secureErrChan: + return err + case err := <-plainErrChan: + return err + } +} + +func InitGRPCRouter(s *provider.CertStorage, config *dubbo_cp.Config) *GRPCRouter { + r := newGrpcServer(s, config) + + register(r.PlainServer) + register(r.SecureServer) + + return r +} + +func register(server *grpc.Server) { + // UserService + registryv1alpha1.RegisterUserServiceServer(server, grpc_handlers.NewUserServiceHandler()) + + // TokenService + registryv1alpha1.RegisterTokenServiceServer(server, grpc_handlers.NewTokenServiceHandler()) + + // AuthnService + registryv1alpha1.RegisterAuthnServiceServer(server, grpc_handlers.NewAuthnServiceHandler()) + + // RepositoryService + registryv1alpha1.RegisterRepositoryServiceServer(server, grpc_handlers.NewRepositoryServiceHandler()) + + // PushService + registryv1alpha1.RegisterPushServiceServer(server, grpc_handlers.NewPushServiceHandler()) + + // CommitService + registryv1alpha1.RegisterRepositoryCommitServiceServer(server, grpc_handlers.NewCommitServiceHandler()) + + // TagService + registryv1alpha1.RegisterRepositoryTagServiceServer(server, grpc_handlers.NewTagServiceHandler()) + + // ResolveService + registryv1alpha1.RegisterResolveServiceServer(server, grpc_handlers.NewResolveServiceHandler()) + + // DownloadService + registryv1alpha1.RegisterDownloadServiceServer(server, grpc_handlers.NewDownloadServiceHandler()) + + // DocService + registryv1alpha1.RegisterDocServiceServer(server, grpc_handlers.NewDocServiceHandler()) +} diff --git a/pkg/bufman/router/http_router.go b/pkg/bufman/router/http_router.go new file mode 100644 index 000000000..6def43a5c --- /dev/null +++ b/pkg/bufman/router/http_router.go @@ -0,0 +1,138 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package router + +import ( + "context" + "net/http" + "strconv" + + "github.com/apache/dubbo-kubernetes/pkg/admin/config" + "github.com/apache/dubbo-kubernetes/pkg/bufman/handlers/http_handlers" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" + "github.com/gin-gonic/gin" +) + +type HTTPRouter struct { + Engine *gin.Engine +} + +func (r *HTTPRouter) Start(stop <-chan struct{}) error { + errChan := make(chan error) + + var httpServer *http.Server + httpServer = r.startHttpServer(errChan) + select { + case <-stop: + logger.Sugar().Info("stopping bufman") + if httpServer != nil { + return httpServer.Shutdown(context.Background()) + } + case err := <-errChan: + return err + } + return nil +} + +func (r *HTTPRouter) startHttpServer(errChan chan error) *http.Server { + server := &http.Server{ + Addr: ":" + strconv.Itoa(config.AdminPort), + Handler: r.Engine, + } + + go func() { + err := server.ListenAndServe() + if err != nil { + switch err { + case http.ErrServerClosed: + logger.Sugar().Info("shutting down bufman HTTP Server") + default: + logger.Sugar().Error(err, "could not start bufman HTTP Server") + errChan <- err + } + } + }() + return server +} + +func (r *HTTPRouter) NeedLeaderElection() bool { + return false +} + +func InitHTTPRouter() *HTTPRouter { + r := gin.Default() + + router := r.Group("/api/v1") + authn := router.Group("/authn") + { + authn.GET("/current_user", http_handlers.AuthnGroup.GetCurrentUser) // 根据token获取当前用户信息 + } + + user := router.Group("/user") + { + user.POST("/create", http_handlers.UserGroup.CreateUser) // 创建用户 + user.GET("/:id", http_handlers.UserGroup.GetUser) // 查询用户 + user.POST("/list", http_handlers.UserGroup.ListUsers) // 批量查询用户 + } + + token := router.Group("/token") + { + token.POST("/create", http_handlers.TokenGroup.CreateToken) // 创建token + token.GET("/:token_id", http_handlers.TokenGroup.GetToken) // 获取token + token.POST("/list", http_handlers.TokenGroup.ListTokens) // 批量查询token + token.DELETE("/:token_id", http_handlers.TokenGroup.DeleteToken) // 删除tokens + } + + repository := router.Group("/repository") + { + repository.POST("/create", http_handlers.RepositoryGroup.CreateRepositoryByFullName) // 创建repository + repository.GET("/:id", http_handlers.RepositoryGroup.GetRepository) // 根据id获取repository + repository.POST("/list", http_handlers.RepositoryGroup.ListRepositories) // 批量查询所有repository + repository.DELETE("/:id", http_handlers.RepositoryGroup.DeleteRepository) // 删除repository + repository.POST("/list/:user_id", http_handlers.RepositoryGroup.ListUserRepositories) // 批量查询用户的repository + repository.POST("/list_accessible", http_handlers.RepositoryGroup.ListRepositoriesUserCanAccess) // 批量查询当前用户可访问的repository + repository.PUT("/deprecate", http_handlers.RepositoryGroup.DeprecateRepositoryByName) // 弃用repository + repository.PUT("/undeprecate", http_handlers.RepositoryGroup.UndeprecateRepositoryByName) // 解除弃用 + repository.PUT("/update", http_handlers.RepositoryGroup.UpdateRepositorySettingsByName) // 更新repository + + commit := repository.Group("/commit") + { + commit.POST("/list/:repository_owner/:repository_name/:reference", http_handlers.CommitGroup.ListRepositoryCommitsByReference) // 获取reference对应commit以及之前的commits + commit.GET("/:repository_owner/:repository_name/:reference", http_handlers.CommitGroup.GetRepositoryCommitByReference) // 获取reference对应commit + commit.POST("/draft/list/:repository_owner/:repository_name", http_handlers.CommitGroup.ListRepositoryDraftCommits) // 获取所有的草稿 + commit.DELETE("/draft/:repository_owner/:repository_name/:draft_name", http_handlers.CommitGroup.DeleteRepositoryDraftCommit) // 删除草稿 + } + + tag := repository.Group("/tag") + { + tag.POST("/create", http_handlers.TagGroup.CreateRepositoryTag) // 创建tag + tag.POST("/list", http_handlers.TagGroup.ListRepositoryTags) // 查询repository下的所有tag + } + + doc := repository.Group("/doc") + { + doc.GET("/source/:repository_owner/:repository_name/:reference", http_handlers.DocGroup.GetSourceDirectoryInfo) // 获取目录信息 + doc.GET("/source/:repository_owner/:repository_name/:reference/:path", http_handlers.DocGroup.GetSourceFile) // 获取文件源码 + doc.GET("/module/:repository_owner/:repository_name/:reference", http_handlers.DocGroup.GetModuleDocumentation) // 获取repo说明文档 + doc.GET("/package/:repository_owner/:repository_name/:reference", http_handlers.DocGroup.GetModulePackages) // 获取repo packages + doc.GET("/package/:repository_owner/:repository_name/:reference/:package_name", http_handlers.DocGroup.GetPackageDocumentation) // 获取包说明文档 + } + } + + return &HTTPRouter{ + Engine: r, + } +} diff --git a/pkg/bufman/services/authz_service.go b/pkg/bufman/services/authz_service.go new file mode 100644 index 000000000..154243071 --- /dev/null +++ b/pkg/bufman/services/authz_service.go @@ -0,0 +1,153 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + "gorm.io/gorm" +) + +// AuthorizationService 用户权限验证 +type AuthorizationService interface { + CheckRepositoryCanAccess(userID, ownerName, repositoryName string) (*model.Repository, e.ResponseError) // 检查user id用户是否可以访问repo + CheckRepositoryCanAccessByID(userID, repositoryID string) (*model.Repository, e.ResponseError) + CheckRepositoryCanEdit(userID, ownerName, repositoryName string) (*model.Repository, e.ResponseError) // 检查user是否可以修改repo + CheckRepositoryCanEditByID(userID, repositoryID string) (*model.Repository, e.ResponseError) + CheckRepositoryCanDelete(userID, ownerName, repositoryName string) (*model.Repository, e.ResponseError) // 检查用户是否可以删除repo + CheckRepositoryCanDeleteByID(userID, repositoryID string) (*model.Repository, e.ResponseError) +} + +func NewAuthorizationService() AuthorizationService { + return &AuthorizationServiceImpl{ + repositoryMapper: &mapper.RepositoryMapperImpl{}, + } +} + +type AuthorizationServiceImpl struct { + repositoryMapper mapper.RepositoryMapper +} + +func (authorizationService *AuthorizationServiceImpl) CheckRepositoryCanAccess(userID, ownerName, repositoryName string) (*model.Repository, e.ResponseError) { + repository, err := authorizationService.repositoryMapper.FindByUserNameAndRepositoryName(ownerName, repositoryName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("repository [name=%s/%s]", ownerName, repositoryName)) + } + + return nil, e.NewInternalError(err) + } + + if registryv1alpha1.Visibility(repository.Visibility) != registryv1alpha1.Visibility_VISIBILITY_PUBLIC && repository.UserID != userID { + return nil, e.NewPermissionDeniedError(fmt.Errorf("repository [name=%s/%s]", ownerName, repositoryName)) + } + + return repository, nil +} + +func (authorizationService *AuthorizationServiceImpl) CheckRepositoryCanAccessByID(userID, repositoryID string) (*model.Repository, e.ResponseError) { + repository, err := authorizationService.repositoryMapper.FindByRepositoryID(repositoryID) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("repository [id=%s]", repositoryID)) + } + + return nil, e.NewInternalError(err) + } + + if registryv1alpha1.Visibility(repository.Visibility) != registryv1alpha1.Visibility_VISIBILITY_PUBLIC && repository.UserID != userID { + return nil, e.NewPermissionDeniedError(fmt.Errorf("repository [id=%s]", repositoryID)) + } + + return repository, nil +} + +func (authorizationService *AuthorizationServiceImpl) CheckRepositoryCanEdit(userID, ownerName, repositoryName string) (*model.Repository, e.ResponseError) { + repository, err := authorizationService.repositoryMapper.FindByUserNameAndRepositoryName(ownerName, repositoryName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("repository [name=%s/%s]", ownerName, repositoryName)) + } + + return nil, e.NewInternalError(err) + } + + // 只有所属用户才能修改 + if repository.UserID != userID { + return nil, e.NewPermissionDeniedError(fmt.Errorf("repository [name=%s/%s]", ownerName, repositoryName)) + } + + return repository, nil +} + +func (authorizationService *AuthorizationServiceImpl) CheckRepositoryCanEditByID(userID, repositoryID string) (*model.Repository, e.ResponseError) { + repository, err := authorizationService.repositoryMapper.FindByRepositoryID(repositoryID) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("repository [id=%s]", repositoryID)) + } + + return nil, e.NewInternalError(err) + } + + // 只有所属用户才能修改 + if repository.UserID != userID { + return nil, e.NewPermissionDeniedError(fmt.Errorf("repository [id=%s]", repositoryID)) + } + + return repository, nil +} + +func (authorizationService *AuthorizationServiceImpl) CheckRepositoryCanDelete(userID, ownerName, repositoryName string) (*model.Repository, e.ResponseError) { + repository, err := authorizationService.repositoryMapper.FindByUserNameAndRepositoryName(ownerName, repositoryName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("repository [name=%s/%s]", ownerName, repositoryName)) + } + + return nil, e.NewInternalError(err) + } + + // 只有所属用户才能修改 + if repository.UserID != userID { + return nil, e.NewPermissionDeniedError(fmt.Errorf("repository [name=%s/%s]", ownerName, repositoryName)) + } + + return repository, nil +} + +func (authorizationService *AuthorizationServiceImpl) CheckRepositoryCanDeleteByID(userID, repositoryID string) (*model.Repository, e.ResponseError) { + repository, err := authorizationService.repositoryMapper.FindByRepositoryID(repositoryID) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("repository [id=%s]", repositoryID)) + } + + return nil, e.NewInternalError(err) + } + + // 只有所属用户才能修改 + if repository.UserID != userID { + return nil, e.NewPermissionDeniedError(fmt.Errorf("repository [id=%s]", repositoryID)) + } + + return repository, nil +} diff --git a/pkg/bufman/services/commit_service.go b/pkg/bufman/services/commit_service.go new file mode 100644 index 000000000..09049e17f --- /dev/null +++ b/pkg/bufman/services/commit_service.go @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "context" + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + "gorm.io/gorm" +) + +type CommitService interface { + ListRepositoryCommitsByReference(ctx context.Context, repositoryID, reference string, offset, limit int, reverse bool) (model.Commits, e.ResponseError) + GetRepositoryCommitByReference(ctx context.Context, repositoryID, reference string) (*model.Commit, e.ResponseError) + ListRepositoryDraftCommits(ctx context.Context, repositoryID string, offset, limit int, reverse bool) (model.Commits, e.ResponseError) + DeleteRepositoryDraftCommit(ctx context.Context, repositoryID, draftName string) e.ResponseError +} + +type CommitServiceImpl struct { + repositoryMapper mapper.RepositoryMapper + commitMapper mapper.CommitMapper +} + +func NewCommitService() CommitService { + return &CommitServiceImpl{ + repositoryMapper: &mapper.RepositoryMapperImpl{}, + commitMapper: &mapper.CommitMapperImpl{}, + } +} + +func (commitService *CommitServiceImpl) ListRepositoryCommitsByReference(ctx context.Context, repositoryID, reference string, offset, limit int, reverse bool) (model.Commits, e.ResponseError) { + // 查询commits + commits, err := commitService.commitMapper.FindPageByRepositoryIDAndReference(repositoryID, reference, offset, limit, reverse) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + return nil, e.NewInternalError(err) + } + + return commits, nil +} + +func (commitService *CommitServiceImpl) GetRepositoryCommitByReference(ctx context.Context, repositoryID, reference string) (*model.Commit, e.ResponseError) { + // 查询commit + commit, err := commitService.commitMapper.FindByRepositoryIDAndReference(repositoryID, reference) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + + return nil, e.NewInternalError(err) + } + + return commit, nil +} + +func (commitService *CommitServiceImpl) ListRepositoryDraftCommits(ctx context.Context, repositoryID string, offset, limit int, reverse bool) (model.Commits, e.ResponseError) { + var commits model.Commits + var err error + // 查询draft + commits, err = commitService.commitMapper.FindDraftPageByRepositoryID(repositoryID, offset, limit, reverse) + if err != nil { + return nil, e.NewInternalError(err) + } + + return commits, nil +} + +func (commitService *CommitServiceImpl) DeleteRepositoryDraftCommit(ctx context.Context, repositoryID, draftName string) e.ResponseError { + // 删除 + err := commitService.commitMapper.DeleteByRepositoryIDAndDraftName(repositoryID, draftName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return e.NewNotFoundError(err) + } + + return e.NewInternalError(err) + } + + return nil +} diff --git a/pkg/bufman/services/docs_service.go b/pkg/bufman/services/docs_service.go new file mode 100644 index 000000000..bebe56209 --- /dev/null +++ b/pkg/bufman/services/docs_service.go @@ -0,0 +1,354 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "context" + "errors" + "fmt" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" + "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/apache/dubbo-kubernetes/pkg/bufman/config" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/parser" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/resolve" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + manifest2 "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "gorm.io/gorm" +) + +type DocsService interface { + GetSourceDirectoryInfo(ctx context.Context, repositoryID, reference string) (model.FileBlobs, e.ResponseError) + GetSourceFile(ctx context.Context, repositoryID, reference, path string) ([]byte, e.ResponseError) + GetModulePackages(ctx context.Context, repositoryID, reference string) ([]*registryv1alpha1.ModulePackage, e.ResponseError) + GetModuleDocumentation(ctx context.Context, repositoryID, reference string) (*registryv1alpha1.ModuleDocumentation, e.ResponseError) + GetPackageDocumentation(ctx context.Context, repositoryID, reference, packageName string) (*registryv1alpha1.PackageDocumentation, e.ResponseError) +} + +type DocsServiceImpl struct { + commitMapper mapper.CommitMapper + fileMapper mapper.FileMapper + storageHelper storage.StorageHelper + protoParser parser.ProtoParser + resolver resolve.Resolver +} + +func NewDocsService() DocsService { + return &DocsServiceImpl{ + commitMapper: &mapper.CommitMapperImpl{}, + fileMapper: &mapper.FileMapperImpl{}, + storageHelper: storage.NewStorageHelper(), + protoParser: parser.NewProtoParser(), + resolver: resolve.NewResolver(), + } +} + +func (docsService *DocsServiceImpl) GetSourceDirectoryInfo(ctx context.Context, repositoryID, reference string) (model.FileBlobs, e.ResponseError) { + // 根据reference查询commit + commit, err := docsService.commitMapper.FindByRepositoryIDAndReference(repositoryID, reference) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + + return nil, e.NewInternalError(err) + } + + // 查询所有文件 + fileBlobs, err := docsService.fileMapper.FindAllBlobsByCommitID(commit.CommitID) + if err != nil { + return nil, e.NewInternalError(err) + } + + return fileBlobs, nil +} + +func (docsService *DocsServiceImpl) GetSourceFile(ctx context.Context, repositoryID, reference, path string) ([]byte, e.ResponseError) { + // 根据reference查询commit + commit, err := docsService.commitMapper.FindByRepositoryIDAndReference(repositoryID, reference) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + + return nil, e.NewInternalError(err) + } + + // 查询file + fileBlob, err := docsService.fileMapper.FindBlobByCommitIDAndPath(commit.CommitID, path) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + + return nil, e.NewInternalError(err) + } + + // 读取文件 + content, err := docsService.storageHelper.ReadBlob(ctx, fileBlob.Digest) + if err != nil { + return nil, e.NewInternalError(err) + } + + return content, nil +} + +func (docsService *DocsServiceImpl) GetModulePackages(ctx context.Context, repositoryID, reference string) ([]*registryv1alpha1.ModulePackage, e.ResponseError) { + // 读取commit文件 + fileManifest, blobSet, err := docsService.getManifestAndBlobSet(ctx, repositoryID, reference) + if err != nil { + return nil, err + } + + // 读取依赖 + dependentManifests, dependentBlobSets, err := docsService.getDependentManifestsAndBlobSets(ctx, fileManifest, blobSet) + if err != nil { + return nil, err + } + + // 获取所有的packages + packages, err := docsService.protoParser.GetPackages(ctx, fileManifest, blobSet, dependentManifests, dependentBlobSets) + if err != nil { + return nil, err + } + + return packages, nil +} + +func (docsService *DocsServiceImpl) GetModuleDocumentation(ctx context.Context, repositoryID, reference string) (*registryv1alpha1.ModuleDocumentation, e.ResponseError) { + // 读取commit文件 + fileManifest, blobSet, err := docsService.getManifestAndBlobSet(ctx, repositoryID, reference) + if err != nil { + return nil, err + } + + documentBlob, licenseBlob, readErr := docsService.storageHelper.GetDocumentAndLicenseFromBlob(ctx, fileManifest, blobSet) + if readErr != nil { + return nil, e.NewInternalError(readErr) + } + + // 读取document + var documentation string + if documentBlob != nil { + documentData, readErr := docsService.storageHelper.ReadBlob(ctx, documentBlob.Digest().Hex()) + if readErr != nil { + return nil, e.NewInternalError(readErr) + } + documentation = string(documentData) + } + + // 读取license + var license string + if licenseBlob != nil { + licenceData, readErr := docsService.storageHelper.ReadBlob(ctx, documentBlob.Digest().Hex()) + if readErr != nil { + return nil, e.NewInternalError(readErr) + } + license = string(licenceData) + } + + // 获取documentation path + paths, _ := fileManifest.PathsFor(documentBlob.Digest().String()) + documentPath := paths[0] + + return ®istryv1alpha1.ModuleDocumentation{ + Documentation: documentation, + License: license, + DocumentationPath: documentPath, + }, nil +} + +func (docsService *DocsServiceImpl) GetPackageDocumentation(ctx context.Context, repositoryID, reference, packageName string) (*registryv1alpha1.PackageDocumentation, e.ResponseError) { + // 查询reference对应的commit + commit, err := docsService.commitMapper.FindByRepositoryIDAndReference(repositoryID, reference) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(fmt.Errorf("repository %s", repositoryID)) + } + + return nil, e.NewInternalError(err) + } + + // 获取文件清单 + fileManifest, blobSet, err := docsService.getManifestAndBlobSetByCommitID(ctx, commit.CommitID) + if err != nil { + return nil, e.NewInternalError(err) + } + + identity, err := bufmoduleref.NewModuleIdentity(config.Properties.Server.ServerHost, commit.UserName, commit.RepositoryName) + if err != nil { + return nil, e.NewInternalError(err) + } + commitName := commit.CommitName + + // 获取bufConfig + bufConfigBlob, configErr := docsService.storageHelper.GetBufManConfigFromBlob(ctx, fileManifest, blobSet) + if configErr != nil { + return nil, e.NewInternalError(configErr) + } + + var dependentManifests []*manifest2.Manifest + var dependentBlobSets []*manifest2.BlobSet + var dependentIdentities []bufmoduleref.ModuleIdentity + var dependentCommitNames []string + if bufConfigBlob != nil { + // 生成Config + reader, configErr := bufConfigBlob.Open(ctx) + if configErr != nil { + return nil, e.NewInternalError(configErr) + } + defer reader.Close() + configData, configErr := io.ReadAll(reader) + if configErr != nil { + return nil, e.NewInternalError(configErr) + } + bufConfig, configErr := bufconfig.GetConfigForData(ctx, configData) + if configErr != nil { + // 无法解析配置文件 + return nil, e.NewInternalError(configErr) + } + + // 获取全部依赖commits + dependentCommits, dependenceErr := docsService.resolver.GetAllDependenciesFromBufConfig(ctx, bufConfig) + if dependenceErr != nil { + return nil, e.NewInternalError(dependenceErr) + } + + // 读取依赖文件 + dependentManifests = make([]*manifest2.Manifest, 0, len(dependentCommits)) + dependentBlobSets = make([]*manifest2.BlobSet, 0, len(dependentCommits)) + dependentIdentities = make([]bufmoduleref.ModuleIdentity, 0, len(dependentCommits)) + dependentCommitNames = make([]string, 0, len(dependentCommits)) + for i := 0; i < len(dependentCommits); i++ { + dependentCommit := dependentCommits[i] + dependentManifest, dependentBlobSet, getErr := docsService.getManifestAndBlobSetByCommitID(ctx, dependentCommit.CommitID) + if getErr != nil { + return nil, getErr + } + + dependentIdentity, err := bufmoduleref.NewModuleIdentity(config.Properties.Server.ServerHost, dependentCommit.UserName, dependentCommit.RepositoryName) + if err != nil { + return nil, e.NewInternalError(err) + } + dependentIdentities = append(dependentIdentities, dependentIdentity) + dependentCommitNames = append(dependentCommitNames, dependentCommit.CommitName) + dependentManifests = append(dependentManifests, dependentManifest) + dependentBlobSets = append(dependentBlobSets, dependentBlobSet) + } + } + + // 根据proto文件生成文档 + packageDocument, documentErr := docsService.protoParser.GetPackageDocumentation(ctx, packageName, identity, commitName, fileManifest, blobSet, dependentIdentities, dependentCommitNames, dependentManifests, dependentBlobSets) + if err != nil { + return nil, documentErr + } + + return packageDocument, nil +} + +// getDependentManifestsAndBlobSets 获取依赖的manifests和blob sets +func (docsService *DocsServiceImpl) getDependentManifestsAndBlobSets(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) ([]*manifest2.Manifest, []*manifest2.BlobSet, e.ResponseError) { + // 获取bufConfig + bufConfigBlob, configErr := docsService.storageHelper.GetBufManConfigFromBlob(ctx, fileManifest, blobSet) + if configErr != nil { + return nil, nil, e.NewInternalError(configErr) + } + + var dependentManifests []*manifest2.Manifest + var dependentBlobSets []*manifest2.BlobSet + if bufConfigBlob != nil { + // 生成Config + reader, configErr := bufConfigBlob.Open(ctx) + if configErr != nil { + return nil, nil, e.NewInternalError(configErr) + } + defer reader.Close() + configData, configErr := io.ReadAll(reader) + if configErr != nil { + return nil, nil, e.NewInternalError(configErr) + } + bufConfig, configErr := bufconfig.GetConfigForData(ctx, configData) + if configErr != nil { + // 无法解析配置文件 + return nil, nil, e.NewInternalError(configErr) + } + + // 获取全部依赖commits + dependentCommits, dependenceErr := docsService.resolver.GetAllDependenciesFromBufConfig(ctx, bufConfig) + if dependenceErr != nil { + return nil, nil, e.NewInternalError(dependenceErr) + } + + // 读取依赖文件 + dependentManifests = make([]*manifest2.Manifest, 0, len(dependentCommits)) + dependentBlobSets = make([]*manifest2.BlobSet, 0, len(dependentCommits)) + for i := 0; i < len(dependentCommits); i++ { + dependentCommit := dependentCommits[i] + dependentManifest, dependentBlobSet, getErr := docsService.getManifestAndBlobSetByCommitID(ctx, dependentCommit.CommitID) + if getErr != nil { + return nil, nil, getErr + } + + dependentManifests = append(dependentManifests, dependentManifest) + dependentBlobSets = append(dependentBlobSets, dependentBlobSet) + } + } + + return dependentManifests, dependentBlobSets, nil +} + +func (docsService *DocsServiceImpl) getManifestAndBlobSet(ctx context.Context, repositoryID string, reference string) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) { + // 查询reference对应的commit + commit, err := docsService.commitMapper.FindByRepositoryIDAndReference(repositoryID, reference) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, nil, e.NewNotFoundError(fmt.Errorf("repository %s", repositoryID)) + } + + return nil, nil, e.NewInternalError(err) + } + + return docsService.getManifestAndBlobSetByCommitID(ctx, commit.CommitID) +} + +func (docsService *DocsServiceImpl) getManifestAndBlobSetByCommitID(ctx context.Context, commitID string) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) { + // 查询文件清单 + modelFileManifest, err := docsService.fileMapper.FindManifestByCommitID(commitID) + if err != nil { + if err != nil { + return nil, nil, e.NewInternalError(err) + } + } + + // 接着查询blobs + fileBlobs, err := docsService.fileMapper.FindAllBlobsByCommitID(commitID) + if err != nil { + return nil, nil, e.NewInternalError(err) + } + + // 读取 + fileManifest, blobSet, err := docsService.storageHelper.ReadToManifestAndBlobSet(ctx, modelFileManifest, fileBlobs) + if err != nil { + return nil, nil, e.NewInternalError(err) + } + + return fileManifest, blobSet, nil +} diff --git a/pkg/bufman/services/download_service.go b/pkg/bufman/services/download_service.go new file mode 100644 index 000000000..443f27a47 --- /dev/null +++ b/pkg/bufman/services/download_service.go @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "context" + "errors" + "fmt" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + manifest2 "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "gorm.io/gorm" +) + +type DownloadService interface { + DownloadManifestAndBlobs(ctx context.Context, registerID string, reference string) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) +} + +type DownloadServiceImpl struct { + commitMapper mapper.CommitMapper + fileMapper mapper.FileMapper + storageHelper storage.StorageHelper +} + +func NewDownloadService() DownloadService { + return &DownloadServiceImpl{ + commitMapper: &mapper.CommitMapperImpl{}, + fileMapper: &mapper.FileMapperImpl{}, + storageHelper: storage.NewStorageHelper(), + } +} + +func (downloadService *DownloadServiceImpl) DownloadManifestAndBlobs(ctx context.Context, registerID string, reference string) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) { + // 查询reference对应的commit + commit, err := downloadService.commitMapper.FindByRepositoryIDAndReference(registerID, reference) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, nil, e.NewNotFoundError(fmt.Errorf("reference %s", reference)) + } + + return nil, nil, e.NewInternalError(err) + } + + // 查询文件清单 + modelFileManifest, err := downloadService.fileMapper.FindManifestByCommitID(commit.CommitID) + if err != nil { + if err != nil { + return nil, nil, e.NewInternalError(err) + } + } + + // 接着查询blobs + fileBlobs, err := downloadService.fileMapper.FindAllBlobsByCommitID(commit.CommitID) + if err != nil { + return nil, nil, e.NewInternalError(err) + } + + // 读取 + fileManifest, blobSet, err := downloadService.storageHelper.ReadToManifestAndBlobSet(ctx, modelFileManifest, fileBlobs) + if err != nil { + return nil, nil, e.NewInternalError(err) + } + + return fileManifest, blobSet, nil +} diff --git a/pkg/bufman/services/push_service.go b/pkg/bufman/services/push_service.go new file mode 100644 index 000000000..bb542b1da --- /dev/null +++ b/pkg/bufman/services/push_service.go @@ -0,0 +1,335 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "context" + "errors" + "fmt" + "io" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/storage" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + manifest2 "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" + "github.com/google/uuid" + "gorm.io/gorm" +) + +type PushService interface { + PushManifestAndBlobs(ctx context.Context, userID, ownerName, repositoryName string, fileManifest *manifest2.Manifest, fileBlobs *manifest2.BlobSet) (*model.Commit, e.ResponseError) + PushManifestAndBlobsWithTags(ctx context.Context, userID, ownerName, repositoryName string, fileManifest *manifest2.Manifest, fileBlobs *manifest2.BlobSet, tagNames []string) (*model.Commit, e.ResponseError) + PushManifestAndBlobsWithDraft(ctx context.Context, userID, ownerName, repositoryName string, fileManifest *manifest2.Manifest, fileBlobs *manifest2.BlobSet, draftName string) (*model.Commit, e.ResponseError) + GetManifestAndBlobSet(ctx context.Context, repositoryID string, reference string) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) +} + +type PushServiceImpl struct { + userMapper mapper.UserMapper + repositoryMapper mapper.RepositoryMapper + fileMapper mapper.FileMapper + commitMapper mapper.CommitMapper + storageHelper storage.StorageHelper +} + +func NewPushService() PushService { + return &PushServiceImpl{ + userMapper: &mapper.UserMapperImpl{}, + repositoryMapper: &mapper.RepositoryMapperImpl{}, + commitMapper: &mapper.CommitMapperImpl{}, + fileMapper: &mapper.FileMapperImpl{}, + storageHelper: storage.NewStorageHelper(), + } +} + +func (pushService *PushServiceImpl) GetManifestAndBlobSet(ctx context.Context, repositoryID string, reference string) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) { + // 查询reference对应的commit + commit, err := pushService.commitMapper.FindByRepositoryIDAndReference(repositoryID, reference) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, nil, e.NewNotFoundError(fmt.Errorf("repository %s", repositoryID)) + } + + return nil, nil, e.NewInternalError(err) + } + + // 查询文件清单 + modelFileManifest, err := pushService.fileMapper.FindManifestByCommitID(commit.CommitID) + if err != nil { + if err != nil { + return nil, nil, e.NewInternalError(err) + } + } + + // 接着查询blobs + fileBlobs, err := pushService.fileMapper.FindAllBlobsByCommitID(commit.CommitID) + if err != nil { + return nil, nil, e.NewInternalError(err) + } + + // 读取 + fileManifest, blobSet, err := pushService.storageHelper.ReadToManifestAndBlobSet(ctx, modelFileManifest, fileBlobs) + if err != nil { + return nil, nil, e.NewInternalError(err) + } + + return fileManifest, blobSet, nil +} + +func (pushService *PushServiceImpl) PushManifestAndBlobs(ctx context.Context, userID, ownerName, repositoryName string, fileManifest *manifest2.Manifest, fileBlobs *manifest2.BlobSet) (*model.Commit, e.ResponseError) { + commit, err := pushService.toCommit(ctx, userID, ownerName, repositoryName, fileManifest, fileBlobs) + if err != nil { + return nil, err + } + + // 写入文件 + err = pushService.saveFileManifestAndBlobs(ctx, commit) + if err != nil { + return nil, err + } + + // 写入数据库 + createErr := pushService.commitMapper.Create(commit) + if createErr != nil { + if errors.Is(createErr, gorm.ErrDuplicatedKey) { + return nil, e.NewInternalError(createErr) + } + if errors.Is(createErr, mapper.ErrLastCommitDuplicated) { + return nil, e.NewAlreadyExistsError(createErr) + } + + return nil, e.NewInternalError(createErr) + } + + return commit, nil +} + +func (pushService *PushServiceImpl) PushManifestAndBlobsWithTags(ctx context.Context, userID, ownerName, repositoryName string, fileManifest *manifest2.Manifest, fileBlobs *manifest2.BlobSet, tagNames []string) (*model.Commit, e.ResponseError) { + commit, err := pushService.toCommit(ctx, userID, ownerName, repositoryName, fileManifest, fileBlobs) + if err != nil { + return nil, err + } + + // 生成tags + var tags []*model.Tag + for i := 0; i < len(tagNames); i++ { + tags = append(tags, &model.Tag{ + UserID: commit.UserID, + RepositoryID: commit.RepositoryID, + CommitID: commit.CommitID, + TagID: uuid.NewString(), + TagName: tagNames[i], + }) + } + commit.Tags = tags + + // 写入文件 + err = pushService.saveFileManifestAndBlobs(ctx, commit) + if err != nil { + return nil, err + } + + createErr := pushService.commitMapper.Create(commit) + if createErr != nil { + if errors.Is(createErr, mapper.ErrTagAndDraftDuplicated) || errors.Is(createErr, gorm.ErrDuplicatedKey) { + return nil, e.NewInternalError(createErr) + } + if errors.Is(createErr, mapper.ErrLastCommitDuplicated) { + return nil, e.NewAlreadyExistsError(createErr) + } + + return nil, e.NewInternalError(createErr) + } + + return commit, nil +} + +func (pushService *PushServiceImpl) PushManifestAndBlobsWithDraft(ctx context.Context, userID, ownerName, repositoryName string, fileManifest *manifest2.Manifest, fileBlobs *manifest2.BlobSet, draftName string) (*model.Commit, e.ResponseError) { + commit, err := pushService.toCommit(ctx, userID, ownerName, repositoryName, fileManifest, fileBlobs) + if err != nil { + return nil, err + } + commit.DraftName = draftName + + // 写入文件 + err = pushService.saveFileManifestAndBlobs(ctx, commit) + if err != nil { + return nil, err + } + + createErr := pushService.commitMapper.Create(commit) + if createErr != nil { + if errors.Is(createErr, mapper.ErrTagAndDraftDuplicated) { + return nil, e.NewInternalError(createErr) + } + if errors.Is(createErr, mapper.ErrLastCommitDuplicated) { + return nil, e.NewAlreadyExistsError(createErr) + } + + return nil, e.NewInternalError(createErr) + } + + return commit, nil +} + +func (pushService *PushServiceImpl) toCommit(ctx context.Context, userID, ownerName, repositoryName string, fileManifest *manifest2.Manifest, fileBlobs *manifest2.BlobSet) (*model.Commit, e.ResponseError) { + // 获取user + user, err := pushService.userMapper.FindByUserID(userID) + if err != nil || user.UserName != ownerName { + return nil, e.NewPermissionDeniedError(err) + } + + // 获取repo + repository, err := pushService.repositoryMapper.FindByUserNameAndRepositoryName(ownerName, repositoryName) + if err != nil { + return nil, e.NewNotFoundError(err) + } + + commitID := uuid.NewString() + commitName := security.GenerateCommitName(user.UserName, repositoryName) + createTime := time.Now() + + // 生成file blobs + modelBlobs := make([]*model.FileBlob, 0, len(fileManifest.Paths())) + err = fileManifest.Range(func(path string, digest manifest2.Digest) error { + // 读取文件内容 + blob, ok := fileBlobs.BlobFor(digest.String()) + if !ok { + return e.NewInvalidArgumentError(fmt.Errorf("blob is not valid")) + } + + readCloser, err := blob.Open(ctx) + if err != nil { + return e.NewInternalError(err) + } + + content, err := io.ReadAll(readCloser) + if err != nil { + return e.NewInternalError(err) + } + + modelBlobs = append(modelBlobs, &model.FileBlob{ + Digest: digest.Hex(), + CommitID: commitID, + FileName: path, + Content: string(content), + UserID: user.UserID, + UserName: user.UserName, + RepositoryID: repository.RepositoryID, + RepositoryName: repository.RepositoryName, + CommitName: commitName, + CreatedTime: createTime, + }) + return nil + }) + if err != nil { + return nil, e.NewInternalError(err) + } + + // 生成manifest + fileManifestBlob, err := fileManifest.Blob() + if err != nil { + return nil, e.NewInternalError(err) + } + readCloser, err := fileManifestBlob.Open(ctx) + if err != nil { + return nil, e.NewInternalError(err) + } + content, err := io.ReadAll(readCloser) + if err != nil { + return nil, e.NewInternalError(err) + } + modelFileManifest := &model.FileManifest{ + ID: 0, + Digest: fileManifestBlob.Digest().Hex(), + CommitID: commitID, + Content: string(content), + UserID: user.UserID, + UserName: user.UserName, + RepositoryID: repository.RepositoryID, + RepositoryName: repository.RepositoryName, + CommitName: commitName, + CreatedTime: createTime, + } + + // 获取bufman config blob + configBlob, err := pushService.storageHelper.GetBufManConfigFromBlob(ctx, fileManifest, fileBlobs) + if err != nil { + return nil, e.NewInternalError(err) + } + // 获取README LICENSE + documentBlob, licenseBlob, err := pushService.storageHelper.GetDocumentAndLicenseFromBlob(ctx, fileManifest, fileBlobs) + if err != nil { + return nil, e.NewInternalError(err) + } + + commit := &model.Commit{ + UserID: user.UserID, + UserName: user.UserName, + RepositoryID: repository.RepositoryID, + RepositoryName: repositoryName, + CommitID: commitID, + CommitName: commitName, + CreatedTime: createTime, + ManifestDigest: fileManifestBlob.Digest().Hex(), + SequenceID: 0, + FileManifest: modelFileManifest, + FileBlobs: modelBlobs, + } + if configBlob != nil { + commit.BufManConfigDigest = configBlob.Digest().Hex() + } + if documentBlob != nil { + commit.DocumentDigest = documentBlob.Digest().Hex() + } + if licenseBlob != nil { + commit.LicenseDigest = licenseBlob.Digest().Hex() + } + + return commit, nil +} + +func (pushService *PushServiceImpl) saveFileManifestAndBlobs(ctx context.Context, commit *model.Commit) e.ResponseError { + // 保存file blobs + for i := 0; i < len(commit.FileBlobs); i++ { + fileBlob := commit.FileBlobs[i] + + // 如果是README文件 + if fileBlob.Digest == commit.DocumentDigest { + err := pushService.storageHelper.StoreDocumentation(ctx, fileBlob) + if err != nil { + return e.NewInternalError(err) + } + + } + + // 普通文件 + err := pushService.storageHelper.StoreBlob(ctx, fileBlob) + if err != nil { + return e.NewInternalError(err) + } + } + + // 保存file manifest + err := pushService.storageHelper.StoreManifest(ctx, commit.FileManifest) + if err != nil { + return e.NewInternalError(err) + } + + return nil +} diff --git a/pkg/bufman/services/repository_service.go b/pkg/bufman/services/repository_service.go new file mode 100644 index 000000000..36c108691 --- /dev/null +++ b/pkg/bufman/services/repository_service.go @@ -0,0 +1,219 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "context" + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + "github.com/google/uuid" + "gorm.io/gorm" +) + +type RepositoryService interface { + GetRepository(ctx context.Context, repositoryID string) (*model.Repository, e.ResponseError) + GetRepositoryByUserNameAndRepositoryName(ctx context.Context, userName, repositoryName string) (*model.Repository, e.ResponseError) + GetRepositoryCounts(ctx context.Context, repositoryID string) (*model.RepositoryCounts, e.ResponseError) + ListRepositories(ctx context.Context, offset, limit int, reverse bool) (model.Repositories, e.ResponseError) + ListUserRepositories(ctx context.Context, userID string, offset, limit int, reverse bool) (model.Repositories, e.ResponseError) + ListRepositoriesUserCanAccess(ctx context.Context, userID string, offset, limit int, reverse bool) (model.Repositories, e.ResponseError) + CreateRepositoryByUserNameAndRepositoryName(ctx context.Context, userID, userName, repositoryName string, visibility registryv1alpha1.Visibility) (*model.Repository, e.ResponseError) + DeleteRepository(ctx context.Context, repositoryID string) e.ResponseError + DeleteRepositoryByUserNameAndRepositoryName(ctx context.Context, userName, repositoryName string) e.ResponseError + DeprecateRepositoryByName(ctx context.Context, ownerName, repositoryName, deprecateMsg string) (*model.Repository, e.ResponseError) + UndeprecateRepositoryByName(ctx context.Context, ownerName, repositoryName string) (*model.Repository, e.ResponseError) + UpdateRepositorySettingsByName(ctx context.Context, ownerName, repositoryName string, visibility registryv1alpha1.Visibility, description string) e.ResponseError +} + +type RepositoryServiceImpl struct { + repositoryMapper mapper.RepositoryMapper + userMapper mapper.UserMapper + commitMapper mapper.CommitMapper + tagMapper mapper.TagMapper +} + +func NewRepositoryService() RepositoryService { + return &RepositoryServiceImpl{ + repositoryMapper: &mapper.RepositoryMapperImpl{}, + userMapper: &mapper.UserMapperImpl{}, + commitMapper: &mapper.CommitMapperImpl{}, + tagMapper: &mapper.TagMapperImpl{}, + } +} + +func (repositoryService *RepositoryServiceImpl) GetRepository(ctx context.Context, repositoryID string) (*model.Repository, e.ResponseError) { + // 查询 + repository, err := repositoryService.repositoryMapper.FindByRepositoryID(repositoryID) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + return nil, e.NewInternalError(err) + } + + return repository, nil +} + +func (repositoryService *RepositoryServiceImpl) GetRepositoryByUserNameAndRepositoryName(ctx context.Context, userName, repositoryName string) (*model.Repository, e.ResponseError) { + // 查询 + repository, err := repositoryService.repositoryMapper.FindByUserNameAndRepositoryName(userName, repositoryName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + return nil, e.NewInternalError(err) + } + + return repository, nil +} + +func (repositoryService *RepositoryServiceImpl) GetRepositoryCounts(ctx context.Context, repositoryID string) (*model.RepositoryCounts, e.ResponseError) { + // 忽略错误 + draftCounts, _ := repositoryService.commitMapper.GetDraftCountsByRepositoryID(repositoryID) + tagCounts, _ := repositoryService.tagMapper.GetCountsByRepositoryID(repositoryID) + repositoryCounts := &model.RepositoryCounts{ + TagsCount: tagCounts, + DraftsCount: draftCounts, + } + + return repositoryCounts, nil +} + +func (repositoryService *RepositoryServiceImpl) ListRepositories(ctx context.Context, offset, limit int, reverse bool) (model.Repositories, e.ResponseError) { + repositories, err := repositoryService.repositoryMapper.FindPage(offset, limit, reverse) + if err != nil { + return nil, e.NewInternalError(err) + } + + return repositories, nil +} + +func (repositoryService *RepositoryServiceImpl) ListUserRepositories(ctx context.Context, userID string, offset, limit int, reverse bool) (model.Repositories, e.ResponseError) { + repositories, err := repositoryService.repositoryMapper.FindPageByUserID(userID, offset, limit, reverse) + if err != nil { + return nil, e.NewInternalError(err) + } + + return repositories, nil +} + +func (repositoryService *RepositoryServiceImpl) ListRepositoriesUserCanAccess(ctx context.Context, userID string, offset, limit int, reverse bool) (model.Repositories, e.ResponseError) { + repositories, err := repositoryService.repositoryMapper.FindAccessiblePageByUserID(userID, offset, limit, reverse) + if err != nil { + return nil, e.NewInternalError(err) + } + + return repositories, nil +} + +func (repositoryService *RepositoryServiceImpl) CreateRepositoryByUserNameAndRepositoryName(ctx context.Context, userID, userName, repositoryName string, visibility registryv1alpha1.Visibility) (*model.Repository, e.ResponseError) { + // 查询用户 + user, err := repositoryService.userMapper.FindByUserName(userName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + + return nil, e.NewInternalError(err) + } + if user.UserID != userID { + return nil, e.NewPermissionDeniedError(err) + } + + // 创建repo + repository := &model.Repository{ + UserID: user.UserID, + UserName: user.UserName, + RepositoryID: uuid.NewString(), + RepositoryName: repositoryName, + Visibility: uint8(visibility), + } + + err = repositoryService.repositoryMapper.Create(repository) + if err != nil { + if errors.Is(err, gorm.ErrDuplicatedKey) { + return nil, e.NewAlreadyExistsError(err) + } + + return nil, e.NewInternalError(err) + } + + return repository, nil +} + +func (repositoryService *RepositoryServiceImpl) DeleteRepository(ctx context.Context, repositoryID string) e.ResponseError { + // 删除 + err := repositoryService.repositoryMapper.DeleteByRepositoryID(repositoryID) + if err != nil { + return e.NewInternalError(err) + } + + return nil +} + +func (repositoryService *RepositoryServiceImpl) DeleteRepositoryByUserNameAndRepositoryName(ctx context.Context, userName, repositoryName string) e.ResponseError { + err := repositoryService.repositoryMapper.DeleteByUserNameAndRepositoryName(userName, repositoryName) + if err != nil { + return e.NewInternalError(err) + } + + return nil +} + +func (repositoryService *RepositoryServiceImpl) DeprecateRepositoryByName(ctx context.Context, ownerName, repositoryName, deprecateMsg string) (*model.Repository, e.ResponseError) { + // 修改数据库 + updatedRepository := &model.Repository{ + Deprecated: true, + DeprecationMsg: deprecateMsg, + } + err := repositoryService.repositoryMapper.UpdateDeprecatedByUserNameAndRepositoryName(ownerName, repositoryName, updatedRepository) + if err != nil { + return nil, e.NewInternalError(err) + } + + return updatedRepository, nil +} + +func (repositoryService *RepositoryServiceImpl) UndeprecateRepositoryByName(ctx context.Context, ownerName, repositoryName string) (*model.Repository, e.ResponseError) { + // 修改数据库 + updatedRepository := &model.Repository{ + Deprecated: false, + } + err := repositoryService.repositoryMapper.UpdateDeprecatedByUserNameAndRepositoryName(ownerName, repositoryName, updatedRepository) + if err != nil { + return nil, e.NewInternalError(err) + } + + return updatedRepository, nil +} + +func (repositoryService *RepositoryServiceImpl) UpdateRepositorySettingsByName(ctx context.Context, ownerName, repositoryName string, visibility registryv1alpha1.Visibility, description string) e.ResponseError { + // 修改数据库 + updatedRepository := &model.Repository{ + Visibility: uint8(visibility), + Description: description, + } + err := repositoryService.repositoryMapper.UpdateByUserNameAndRepositoryName(ownerName, repositoryName, updatedRepository) + if err != nil { + return e.NewInternalError(err) + } + + return nil +} diff --git a/pkg/bufman/services/tag_service.go b/pkg/bufman/services/tag_service.go new file mode 100644 index 000000000..e078c0adb --- /dev/null +++ b/pkg/bufman/services/tag_service.go @@ -0,0 +1,85 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "context" + "errors" + + "github.com/google/uuid" + "gorm.io/gorm" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type TagService interface { + CreateRepositoryTag(ctx context.Context, repositoryID, TagName, commitName string) (*model.Tag, e.ResponseError) + ListRepositoryTags(ctx context.Context, repositoryID string, offset, limit int, reverse bool) (model.Tags, e.ResponseError) +} + +func NewTagService() TagService { + return &TagServiceImpl{ + repositoryMapper: &mapper.RepositoryMapperImpl{}, + commitMapper: &mapper.CommitMapperImpl{}, + tagMapper: &mapper.TagMapperImpl{}, + validator: validity.NewValidator(), + } +} + +type TagServiceImpl struct { + repositoryMapper mapper.RepositoryMapper + commitMapper mapper.CommitMapper + tagMapper mapper.TagMapper + validator validity.Validator +} + +func (tagService *TagServiceImpl) CreateRepositoryTag(ctx context.Context, repositoryID, TagName, commitName string) (*model.Tag, e.ResponseError) { + // 查询commitName + commit, err := tagService.commitMapper.FindByRepositoryIDAndCommitName(repositoryID, commitName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + } + + tag := &model.Tag{ + UserID: commit.UserID, + UserName: commit.UserName, + RepositoryID: repositoryID, + CommitID: commit.CommitID, + CommitName: commitName, + TagID: uuid.NewString(), + TagName: TagName, + } + err = tagService.tagMapper.Create(tag) + if err != nil { + return nil, e.NewInternalError(err) + } + + return tag, nil +} + +func (tagService *TagServiceImpl) ListRepositoryTags(ctx context.Context, repositoryID string, offset, limit int, reverse bool) (model.Tags, e.ResponseError) { + tags, err := tagService.tagMapper.FindPageByRepositoryID(repositoryID, limit, offset, reverse) + if err != nil { + return nil, e.NewInternalError(err) + } + + return tags, nil +} diff --git a/pkg/bufman/services/token_service.go b/pkg/bufman/services/token_service.go new file mode 100644 index 000000000..326e78213 --- /dev/null +++ b/pkg/bufman/services/token_service.go @@ -0,0 +1,128 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "context" + "errors" + "time" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + "github.com/google/uuid" + "gorm.io/gorm" +) + +type TokenService interface { + CreateToken(ctx context.Context, userName, password string, expireTime time.Time, note string) (*model.Token, e.ResponseError) + GetToken(ctx context.Context, userID, tokenID string) (*model.Token, e.ResponseError) + ListTokens(ctx context.Context, userID string, offset, limit int, reverse bool) (model.Tokens, e.ResponseError) + DeleteToken(ctx context.Context, userID, tokenID string) e.ResponseError +} + +type TokenServiceImpl struct { + userMapper mapper.UserMapper + tokenMapper mapper.TokenMapper +} + +func NewTokenService() TokenService { + return &TokenServiceImpl{ + userMapper: &mapper.UserMapperImpl{}, + tokenMapper: &mapper.TokenMapperImpl{}, + } +} + +func (tokenService *TokenServiceImpl) CreateToken(ctx context.Context, userName, password string, expireTime time.Time, note string) (*model.Token, e.ResponseError) { + user, err := tokenService.userMapper.FindByUserName(userName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewPermissionDeniedError(err) + } + + return nil, e.NewInternalError(err) + } + if security.EncryptPlainPassword(userName, password) != user.Password { + // 密码不正确 + return nil, e.NewPermissionDeniedError(err) + } + + token := &model.Token{ + ID: 0, + UserID: user.UserID, + TokenID: uuid.NewString(), + TokenName: security.GenerateToken(userName, note), + ExpireTime: expireTime, + Note: note, + } + err = tokenService.tokenMapper.Create(token) // 创建token + if err != nil { + return nil, e.NewInternalError(err) + } + + return token, nil +} + +func (tokenService *TokenServiceImpl) GetToken(ctx context.Context, userID, tokenID string) (*model.Token, e.ResponseError) { + token, err := tokenService.tokenMapper.FindAvailableByTokenID(tokenID) + if err != nil { + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + + return nil, e.NewInternalError(err) + } + if userID != token.UserID { + // 不能查看其他人的token + return nil, e.NewPermissionDeniedError(err) + } + + return token, nil +} + +func (tokenService *TokenServiceImpl) ListTokens(ctx context.Context, userID string, offset, limit int, reverse bool) (model.Tokens, e.ResponseError) { + tokens, err := tokenService.tokenMapper.FindAvailablePageByUserID(userID, offset, limit, reverse) + if err != nil { + return nil, e.NewInternalError(err) + } + + return tokens, nil +} + +func (tokenService *TokenServiceImpl) DeleteToken(ctx context.Context, userID, tokenID string) e.ResponseError { + // 查询token + token, err := tokenService.tokenMapper.FindAvailableByTokenID(tokenID) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return e.NewNotFoundError(err) + } + + return e.NewInternalError(err) + } + if token.UserID != userID { + // 不能删除其他人的token + return e.NewPermissionDeniedError(err) + } + + // 删除token + err = tokenService.tokenMapper.DeleteByTokenID(tokenID) + if err != nil { + return e.NewInternalError(err) + } + + return nil +} diff --git a/pkg/bufman/services/user_service.go b/pkg/bufman/services/user_service.go new file mode 100644 index 000000000..235430d3a --- /dev/null +++ b/pkg/bufman/services/user_service.go @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package services + +import ( + "context" + "errors" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + "github.com/apache/dubbo-kubernetes/pkg/bufman/mapper" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + "github.com/google/uuid" + "gorm.io/gorm" +) + +type UserService interface { + CreateUser(ctx context.Context, userName, password string) (*model.User, e.ResponseError) + GetUser(ctx context.Context, userID string) (*model.User, e.ResponseError) + GetUserByUsername(ctx context.Context, userName string) (*model.User, e.ResponseError) + ListUsers(ctx context.Context, offset int, limit int, reverse bool) (model.Users, e.ResponseError) +} + +type UserServiceImpl struct { + userMapper mapper.UserMapper +} + +func NewUserService() UserService { + return &UserServiceImpl{ + userMapper: &mapper.UserMapperImpl{}, + } +} + +func (userService *UserServiceImpl) CreateUser(ctx context.Context, userName, password string) (*model.User, e.ResponseError) { + user := &model.User{ + UserID: uuid.NewString(), + UserName: userName, + Password: security.EncryptPlainPassword(userName, password), // 加密明文密码 + } + + err := userService.userMapper.Create(user) // 创建用户 + if err != nil { + // 用户重复 + if errors.Is(err, gorm.ErrDuplicatedKey) { + return nil, e.NewAlreadyExistsError(err) + } + + return nil, e.NewInternalError(err) + } + + return user, nil +} + +func (userService *UserServiceImpl) GetUser(ctx context.Context, userID string) (*model.User, e.ResponseError) { + user, err := userService.userMapper.FindByUserID(userID) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + + return nil, e.NewInternalError(err) + } + + return user, nil +} + +func (userService *UserServiceImpl) GetUserByUsername(ctx context.Context, userName string) (*model.User, e.ResponseError) { + user, err := userService.userMapper.FindByUserName(userName) + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, e.NewNotFoundError(err) + } + + return nil, e.NewInternalError(err) + } + + return user, nil +} + +func (userService *UserServiceImpl) ListUsers(ctx context.Context, offset int, limit int, reverse bool) (model.Users, e.ResponseError) { + users, err := userService.userMapper.FindPage(offset, limit, reverse) + if err != nil { + return nil, e.NewInternalError(err) + } + + return users, nil +} diff --git a/pkg/bufman/setup.go b/pkg/bufman/setup.go new file mode 100644 index 000000000..79439b9d9 --- /dev/null +++ b/pkg/bufman/setup.go @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package bufman + +import ( + "github.com/apache/dubbo-kubernetes/pkg/bufman/router" + core_runtime "github.com/apache/dubbo-kubernetes/pkg/core/runtime" + "github.com/pkg/errors" +) + +func Setup(rt core_runtime.Runtime) error { + if err := InitConfig(rt); err != nil { + return errors.Wrap(err, "Bufman init config failed") + } + + if err := RegisterDatabase(rt); err != nil { + return errors.Wrap(err, "Bufman Database register failed") + } + + httpRouter := router.InitHTTPRouter() + grpcRouter := router.InitGRPCRouter(rt.CertStorage(), rt.Config()) + + if err := rt.Add(httpRouter); err != nil { + return errors.Wrap(err, "Add Bufman HTTP Server Component failed") + } + if err := rt.Add(grpcRouter); err != nil { + return errors.Wrap(err, "Add Bufman GRPC Server Component failed") + } + return nil +} From 75ba5ec874850429a158f39973e001514a234b9f Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:39:27 +0800 Subject: [PATCH 09/18] setup bufman --- app/dubbo-cp/cmd/run.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/dubbo-cp/cmd/run.go b/app/dubbo-cp/cmd/run.go index 8d3973868..656d5152c 100644 --- a/app/dubbo-cp/cmd/run.go +++ b/app/dubbo-cp/cmd/run.go @@ -22,12 +22,12 @@ import ( "os" "time" - "github.com/apache/dubbo-kubernetes/pkg/webhook" - "github.com/apache/dubbo-kubernetes/pkg/admin" + "github.com/apache/dubbo-kubernetes/pkg/bufman" "github.com/apache/dubbo-kubernetes/pkg/core/kubeclient" "github.com/apache/dubbo-kubernetes/pkg/dds" "github.com/apache/dubbo-kubernetes/pkg/snp" + "github.com/apache/dubbo-kubernetes/pkg/webhook" "github.com/apache/dubbo-kubernetes/pkg/authority" "github.com/apache/dubbo-kubernetes/pkg/config" @@ -90,6 +90,10 @@ func newRunCmdWithOpts(opts cmd.RunCmdOpts) *cobra.Command { logger.Sugar().Error(err, "unable to set up Metrics") } + if err := bufman.Setup(rt); err != nil { + logger.Sugar().Error(err, "unable to set up bufman") + } + if err := cert.Setup(rt); err != nil { logger.Sugar().Error(err, "unable to set up certProvider") } From 6f5aa4123299ccc2872d3da832abc5ad8ce94b51 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Mon, 1 Jan 2024 20:53:02 +0800 Subject: [PATCH 10/18] update gorm gen --- pkg/bufman/gorm_gen/gorm_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/bufman/gorm_gen/gorm_gen.go b/pkg/bufman/gorm_gen/gorm_gen.go index d879b0b05..7655c2268 100644 --- a/pkg/bufman/gorm_gen/gorm_gen.go +++ b/pkg/bufman/gorm_gen/gorm_gen.go @@ -23,7 +23,7 @@ import ( ) func main() { - dsn := "root:qwas617.@tcp(127.0.0.1:3306)/idl_manager?charset=utf8mb4&parseTime=True&loc=Local" + dsn := "root:123456@tcp(127.0.0.1:3306)/idl_manager?charset=utf8mb4&parseTime=True&loc=Local" // Initialize the generator with configuration g := gen.NewGenerator(gen.Config{ From e597b3f804af87df3126a29355cb1935dfc19f3b Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Tue, 2 Jan 2024 11:20:22 +0800 Subject: [PATCH 11/18] bufman save files using db instead of fs --- pkg/bufman/bootstrap.go | 2 +- pkg/bufman/core/resolve/resolve.go | 2 +- pkg/bufman/core/storage/db_storage.go | 74 +++++ pkg/bufman/core/storage/disk_storage.go | 40 +-- pkg/bufman/core/storage/storage.go | 21 +- pkg/bufman/dal/commit_files.gen.go | 392 ++++++++++++++++++++++++ pkg/bufman/dal/commits.gen.go | 238 +------------- pkg/bufman/dal/file_blobs.gen.go | 20 +- pkg/bufman/dal/file_manifests.gen.go | 388 ----------------------- pkg/bufman/dal/gen.go | 108 +++---- pkg/bufman/dal/repositories.gen.go | 184 +---------- pkg/bufman/gorm_gen/gorm_gen.go | 17 +- pkg/bufman/mapper/file_mapper.go | 28 +- pkg/bufman/mapper/tag_mapper.go | 5 + pkg/bufman/model/commit.go | 10 +- pkg/bufman/model/file.go | 42 +-- pkg/bufman/model/init.go | 62 ---- pkg/bufman/model/repository.go | 4 +- pkg/bufman/services/docs_service.go | 12 +- pkg/bufman/services/download_service.go | 4 +- pkg/bufman/services/push_service.go | 40 ++- 21 files changed, 647 insertions(+), 1046 deletions(-) create mode 100644 pkg/bufman/core/storage/db_storage.go create mode 100644 pkg/bufman/dal/commit_files.gen.go delete mode 100644 pkg/bufman/dal/file_manifests.gen.go delete mode 100644 pkg/bufman/model/init.go diff --git a/pkg/bufman/bootstrap.go b/pkg/bufman/bootstrap.go index 31b6a7d6c..6608ceca0 100644 --- a/pkg/bufman/bootstrap.go +++ b/pkg/bufman/bootstrap.go @@ -56,7 +56,7 @@ func RegisterDatabase(rt core_runtime.Runtime) error { &model.Tag{}, &model.User{}, &model.Token{}, - &model.FileManifest{}, + &model.CommitFile{}, &model.FileBlob{}, ) if initErr != nil { diff --git a/pkg/bufman/core/resolve/resolve.go b/pkg/bufman/core/resolve/resolve.go index d5481ad67..788423458 100644 --- a/pkg/bufman/core/resolve/resolve.go +++ b/pkg/bufman/core/resolve/resolve.go @@ -121,7 +121,7 @@ func (resolver *ResolverImpl) GetDirectDependenciesFromModuleRefs(ctx context.Co func (resolver *ResolverImpl) GetBufConfigFromCommitID(ctx context.Context, commitID string) (*bufconfig.Config, e.ResponseError) { // 查询manifest名称 - manifestModel, err := resolver.fileMapper.FindManifestByCommitID(commitID) + manifestModel, err := resolver.fileMapper.FindCommitManifestByCommitID(commitID) if err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, e.NewNotFoundError(fmt.Errorf("manifest(commit id = %s)", commitID)) diff --git a/pkg/bufman/core/storage/db_storage.go b/pkg/bufman/core/storage/db_storage.go new file mode 100644 index 000000000..9eba03423 --- /dev/null +++ b/pkg/bufman/core/storage/db_storage.go @@ -0,0 +1,74 @@ +package storage + +import ( + "bytes" + "context" + "io" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/dal" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type DBStorageHelperImpl struct { +} + +func NewDBStorageHelper() *DBStorageHelperImpl { + return &DBStorageHelperImpl{} +} + +func (helper *DBStorageHelperImpl) StoreBlob(ctx context.Context, file *model.CommitFile) error { + return dal.FileBlob.Create(&model.FileBlob{ + Digest: file.Digest, + Content: file.Content, + }) +} + +func (helper *DBStorageHelperImpl) StoreManifest(ctx context.Context, manifest *model.CommitFile) error { + return dal.FileBlob.Create(&model.FileBlob{ + Digest: manifest.Digest, + Content: manifest.Content, + }) +} + +func (helper *DBStorageHelperImpl) StoreDocumentation(ctx context.Context, file *model.CommitFile) error { + return dal.FileBlob.Create(&model.FileBlob{ + Digest: file.Digest, + Content: file.Content, + }) +} + +func (helper *DBStorageHelperImpl) ReadBlobToReader(ctx context.Context, digest string) (io.Reader, error) { + content, err := helper.ReadManifest(ctx, digest) + if err != nil { + return nil, err + } + + return bytes.NewReader(content), nil +} + +func (helper *DBStorageHelperImpl) ReadBlob(ctx context.Context, digest string) ([]byte, error) { + blob, err := dal.FileBlob.Where(dal.FileBlob.Digest.Eq(digest)).First() + if err != nil { + return nil, err + } + + return blob.Content, nil +} + +func (helper *DBStorageHelperImpl) ReadManifestToReader(ctx context.Context, digest string) (io.Reader, error) { + content, err := helper.ReadManifest(ctx, digest) + if err != nil { + return nil, err + } + + return bytes.NewReader(content), nil +} + +func (helper *DBStorageHelperImpl) ReadManifest(ctx context.Context, digest string) ([]byte, error) { + blob, err := dal.FileBlob.Where(dal.FileBlob.Digest.Eq(digest)).First() + if err != nil { + return nil, err + } + + return blob.Content, nil +} diff --git a/pkg/bufman/core/storage/disk_storage.go b/pkg/bufman/core/storage/disk_storage.go index f31cd49d3..02b1fa766 100644 --- a/pkg/bufman/core/storage/disk_storage.go +++ b/pkg/bufman/core/storage/disk_storage.go @@ -27,6 +27,8 @@ import ( "github.com/apache/dubbo-kubernetes/pkg/bufman/model" ) +// DiskStorageHelperImpl +// Deprecated type DiskStorageHelperImpl struct { mu sync.Mutex muDict map[string]*sync.RWMutex @@ -35,7 +37,7 @@ type DiskStorageHelperImpl struct { pluginMuDict map[string]*sync.RWMutex } -func (helper *DiskStorageHelperImpl) StoreBlob(ctx context.Context, blob *model.FileBlob) error { +func (helper *DiskStorageHelperImpl) StoreBlob(ctx context.Context, blob *model.CommitFile) error { return helper.store(ctx, blob.Digest, []byte(blob.Content)) } @@ -70,16 +72,16 @@ func (helper *DiskStorageHelperImpl) store(ctx context.Context, digest string, c return nil } -func (helper *DiskStorageHelperImpl) StoreManifest(ctx context.Context, manifest *model.FileManifest) error { +func (helper *DiskStorageHelperImpl) StoreManifest(ctx context.Context, manifest *model.CommitFile) error { return helper.store(ctx, manifest.Digest, []byte(manifest.Content)) } -func (helper *DiskStorageHelperImpl) StoreDocumentation(ctx context.Context, blob *model.FileBlob) error { +func (helper *DiskStorageHelperImpl) StoreDocumentation(ctx context.Context, blob *model.CommitFile) error { return nil } -func (helper *DiskStorageHelperImpl) ReadBlobToReader(ctx context.Context, fileName string) (io.Reader, error) { - content, err := helper.ReadBlob(ctx, fileName) +func (helper *DiskStorageHelperImpl) ReadBlobToReader(ctx context.Context, digest string) (io.Reader, error) { + content, err := helper.ReadBlob(ctx, digest) if err != nil { return nil, err } @@ -87,12 +89,12 @@ func (helper *DiskStorageHelperImpl) ReadBlobToReader(ctx context.Context, fileN return bytes.NewReader(content), nil } -func (helper *DiskStorageHelperImpl) ReadBlob(ctx context.Context, fileName string) ([]byte, error) { - return helper.read(ctx, fileName) +func (helper *DiskStorageHelperImpl) ReadBlob(ctx context.Context, digest string) ([]byte, error) { + return helper.read(ctx, digest) } -func (helper *DiskStorageHelperImpl) ReadManifestToReader(ctx context.Context, fileName string) (io.Reader, error) { - content, err := helper.ReadManifest(ctx, fileName) +func (helper *DiskStorageHelperImpl) ReadManifestToReader(ctx context.Context, digest string) (io.Reader, error) { + content, err := helper.ReadManifest(ctx, digest) if err != nil { return nil, err } @@ -100,24 +102,24 @@ func (helper *DiskStorageHelperImpl) ReadManifestToReader(ctx context.Context, f return bytes.NewReader(content), nil } -func (helper *DiskStorageHelperImpl) ReadManifest(ctx context.Context, fileName string) ([]byte, error) { - return helper.read(ctx, fileName) +func (helper *DiskStorageHelperImpl) ReadManifest(ctx context.Context, digest string) ([]byte, error) { + return helper.read(ctx, digest) } -func (helper *DiskStorageHelperImpl) read(ctx context.Context, fileName string) ([]byte, error) { +func (helper *DiskStorageHelperImpl) read(ctx context.Context, digest string) ([]byte, error) { helper.mu.Lock() defer helper.mu.Unlock() - if _, ok := helper.muDict[fileName]; !ok { - helper.muDict[fileName] = &sync.RWMutex{} + if _, ok := helper.muDict[digest]; !ok { + helper.muDict[digest] = &sync.RWMutex{} } // 上读锁 - helper.muDict[fileName].RLock() - defer helper.muDict[fileName].RUnlock() + helper.muDict[digest].RLock() + defer helper.muDict[digest].RUnlock() // 读取文件 - filePath := helper.GetFilePath(fileName) + filePath := helper.GetFilePath(digest) content, err := os.ReadFile(filePath) if err != nil { return nil, err @@ -126,6 +128,6 @@ func (helper *DiskStorageHelperImpl) read(ctx context.Context, fileName string) return content, nil } -func (helper *DiskStorageHelperImpl) GetFilePath(fileName string) string { - return path.Join(constant.FileSavaDir, fileName) +func (helper *DiskStorageHelperImpl) GetFilePath(digest string) string { + return path.Join(constant.FileSavaDir, digest) } diff --git a/pkg/bufman/core/storage/storage.go b/pkg/bufman/core/storage/storage.go index b356a680d..3f55a5950 100644 --- a/pkg/bufman/core/storage/storage.go +++ b/pkg/bufman/core/storage/storage.go @@ -28,18 +28,18 @@ import ( ) type BaseStorageHelper interface { - StoreBlob(ctx context.Context, blob *model.FileBlob) error - StoreManifest(ctx context.Context, manifest *model.FileManifest) error - StoreDocumentation(ctx context.Context, blob *model.FileBlob) error + StoreBlob(ctx context.Context, blob *model.CommitFile) error + StoreManifest(ctx context.Context, manifest *model.CommitFile) error + StoreDocumentation(ctx context.Context, blob *model.CommitFile) error ReadBlobToReader(ctx context.Context, digest string) (io.Reader, error) // 读取内容 - ReadBlob(ctx context.Context, fileName string) ([]byte, error) - ReadManifestToReader(ctx context.Context, fileName string) (io.Reader, error) - ReadManifest(ctx context.Context, fileName string) ([]byte, error) + ReadBlob(ctx context.Context, digest string) ([]byte, error) + ReadManifestToReader(ctx context.Context, digest string) (io.Reader, error) + ReadManifest(ctx context.Context, digest string) ([]byte, error) } type StorageHelper interface { BaseStorageHelper - ReadToManifestAndBlobSet(ctx context.Context, modelFileManifest *model.FileManifest, fileBlobs model.FileBlobs) (*manifest2.Manifest, *manifest2.BlobSet, error) // 读取为manifest和blob set + ReadToManifestAndBlobSet(ctx context.Context, modelFileManifest *model.CommitFile, fileBlobs model.CommitFiles) (*manifest2.Manifest, *manifest2.BlobSet, error) // 读取为manifest和blob set GetDocumentAndLicenseFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, manifest2.Blob, error) GetBufManConfigFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, error) GetDocumentFromBlob(ctx context.Context, fileManifest *manifest2.Manifest, blobSet *manifest2.BlobSet) (manifest2.Blob, error) @@ -61,10 +61,7 @@ func NewStorageHelper() StorageHelper { // 对象初始化 once.Do(func() { storageHelperImpl = &StorageHelperImpl{ - BaseStorageHelper: &DiskStorageHelperImpl{ - muDict: map[string]*sync.RWMutex{}, - pluginMuDict: map[string]*sync.RWMutex{}, - }, + BaseStorageHelper: NewDBStorageHelper(), } }) } @@ -72,7 +69,7 @@ func NewStorageHelper() StorageHelper { return storageHelperImpl } -func (helper *StorageHelperImpl) ReadToManifestAndBlobSet(ctx context.Context, modelFileManifest *model.FileManifest, fileBlobs model.FileBlobs) (*manifest2.Manifest, *manifest2.BlobSet, error) { +func (helper *StorageHelperImpl) ReadToManifestAndBlobSet(ctx context.Context, modelFileManifest *model.CommitFile, fileBlobs model.CommitFiles) (*manifest2.Manifest, *manifest2.BlobSet, error) { // 读取文件清单 reader, err := helper.ReadManifestToReader(ctx, modelFileManifest.Digest) if err != nil { diff --git a/pkg/bufman/dal/commit_files.gen.go b/pkg/bufman/dal/commit_files.gen.go new file mode 100644 index 000000000..f34655a3c --- /dev/null +++ b/pkg/bufman/dal/commit_files.gen.go @@ -0,0 +1,392 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package dal + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +func newCommitFile(db *gorm.DB, opts ...gen.DOOption) commitFile { + _commitFile := commitFile{} + + _commitFile.commitFileDo.UseDB(db, opts...) + _commitFile.commitFileDo.UseModel(&model.CommitFile{}) + + tableName := _commitFile.commitFileDo.TableName() + _commitFile.ALL = field.NewAsterisk(tableName) + _commitFile.ID = field.NewInt64(tableName, "id") + _commitFile.Digest = field.NewString(tableName, "digest") + _commitFile.CommitID = field.NewString(tableName, "commit_id") + _commitFile.FileName = field.NewString(tableName, "file_name") + + _commitFile.fillFieldMap() + + return _commitFile +} + +type commitFile struct { + commitFileDo + + ALL field.Asterisk + ID field.Int64 + Digest field.String + CommitID field.String + FileName field.String + + fieldMap map[string]field.Expr +} + +func (c commitFile) Table(newTableName string) *commitFile { + c.commitFileDo.UseTable(newTableName) + return c.updateTableName(newTableName) +} + +func (c commitFile) As(alias string) *commitFile { + c.commitFileDo.DO = *(c.commitFileDo.As(alias).(*gen.DO)) + return c.updateTableName(alias) +} + +func (c *commitFile) updateTableName(table string) *commitFile { + c.ALL = field.NewAsterisk(table) + c.ID = field.NewInt64(table, "id") + c.Digest = field.NewString(table, "digest") + c.CommitID = field.NewString(table, "commit_id") + c.FileName = field.NewString(table, "file_name") + + c.fillFieldMap() + + return c +} + +func (c *commitFile) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := c.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (c *commitFile) fillFieldMap() { + c.fieldMap = make(map[string]field.Expr, 4) + c.fieldMap["id"] = c.ID + c.fieldMap["digest"] = c.Digest + c.fieldMap["commit_id"] = c.CommitID + c.fieldMap["file_name"] = c.FileName +} + +func (c commitFile) clone(db *gorm.DB) commitFile { + c.commitFileDo.ReplaceConnPool(db.Statement.ConnPool) + return c +} + +func (c commitFile) replaceDB(db *gorm.DB) commitFile { + c.commitFileDo.ReplaceDB(db) + return c +} + +type commitFileDo struct{ gen.DO } + +type ICommitFileDo interface { + gen.SubQuery + Debug() ICommitFileDo + WithContext(ctx context.Context) ICommitFileDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ICommitFileDo + WriteDB() ICommitFileDo + As(alias string) gen.Dao + Session(config *gorm.Session) ICommitFileDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ICommitFileDo + Not(conds ...gen.Condition) ICommitFileDo + Or(conds ...gen.Condition) ICommitFileDo + Select(conds ...field.Expr) ICommitFileDo + Where(conds ...gen.Condition) ICommitFileDo + Order(conds ...field.Expr) ICommitFileDo + Distinct(cols ...field.Expr) ICommitFileDo + Omit(cols ...field.Expr) ICommitFileDo + Join(table schema.Tabler, on ...field.Expr) ICommitFileDo + LeftJoin(table schema.Tabler, on ...field.Expr) ICommitFileDo + RightJoin(table schema.Tabler, on ...field.Expr) ICommitFileDo + Group(cols ...field.Expr) ICommitFileDo + Having(conds ...gen.Condition) ICommitFileDo + Limit(limit int) ICommitFileDo + Offset(offset int) ICommitFileDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ICommitFileDo + Unscoped() ICommitFileDo + Create(values ...*model.CommitFile) error + CreateInBatches(values []*model.CommitFile, batchSize int) error + Save(values ...*model.CommitFile) error + First() (*model.CommitFile, error) + Take() (*model.CommitFile, error) + Last() (*model.CommitFile, error) + Find() ([]*model.CommitFile, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.CommitFile, err error) + FindInBatches(result *[]*model.CommitFile, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.CommitFile) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ICommitFileDo + Assign(attrs ...field.AssignExpr) ICommitFileDo + Joins(fields ...field.RelationField) ICommitFileDo + Preload(fields ...field.RelationField) ICommitFileDo + FirstOrInit() (*model.CommitFile, error) + FirstOrCreate() (*model.CommitFile, error) + FindByPage(offset int, limit int) (result []*model.CommitFile, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ICommitFileDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (c commitFileDo) Debug() ICommitFileDo { + return c.withDO(c.DO.Debug()) +} + +func (c commitFileDo) WithContext(ctx context.Context) ICommitFileDo { + return c.withDO(c.DO.WithContext(ctx)) +} + +func (c commitFileDo) ReadDB() ICommitFileDo { + return c.Clauses(dbresolver.Read) +} + +func (c commitFileDo) WriteDB() ICommitFileDo { + return c.Clauses(dbresolver.Write) +} + +func (c commitFileDo) Session(config *gorm.Session) ICommitFileDo { + return c.withDO(c.DO.Session(config)) +} + +func (c commitFileDo) Clauses(conds ...clause.Expression) ICommitFileDo { + return c.withDO(c.DO.Clauses(conds...)) +} + +func (c commitFileDo) Returning(value interface{}, columns ...string) ICommitFileDo { + return c.withDO(c.DO.Returning(value, columns...)) +} + +func (c commitFileDo) Not(conds ...gen.Condition) ICommitFileDo { + return c.withDO(c.DO.Not(conds...)) +} + +func (c commitFileDo) Or(conds ...gen.Condition) ICommitFileDo { + return c.withDO(c.DO.Or(conds...)) +} + +func (c commitFileDo) Select(conds ...field.Expr) ICommitFileDo { + return c.withDO(c.DO.Select(conds...)) +} + +func (c commitFileDo) Where(conds ...gen.Condition) ICommitFileDo { + return c.withDO(c.DO.Where(conds...)) +} + +func (c commitFileDo) Order(conds ...field.Expr) ICommitFileDo { + return c.withDO(c.DO.Order(conds...)) +} + +func (c commitFileDo) Distinct(cols ...field.Expr) ICommitFileDo { + return c.withDO(c.DO.Distinct(cols...)) +} + +func (c commitFileDo) Omit(cols ...field.Expr) ICommitFileDo { + return c.withDO(c.DO.Omit(cols...)) +} + +func (c commitFileDo) Join(table schema.Tabler, on ...field.Expr) ICommitFileDo { + return c.withDO(c.DO.Join(table, on...)) +} + +func (c commitFileDo) LeftJoin(table schema.Tabler, on ...field.Expr) ICommitFileDo { + return c.withDO(c.DO.LeftJoin(table, on...)) +} + +func (c commitFileDo) RightJoin(table schema.Tabler, on ...field.Expr) ICommitFileDo { + return c.withDO(c.DO.RightJoin(table, on...)) +} + +func (c commitFileDo) Group(cols ...field.Expr) ICommitFileDo { + return c.withDO(c.DO.Group(cols...)) +} + +func (c commitFileDo) Having(conds ...gen.Condition) ICommitFileDo { + return c.withDO(c.DO.Having(conds...)) +} + +func (c commitFileDo) Limit(limit int) ICommitFileDo { + return c.withDO(c.DO.Limit(limit)) +} + +func (c commitFileDo) Offset(offset int) ICommitFileDo { + return c.withDO(c.DO.Offset(offset)) +} + +func (c commitFileDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ICommitFileDo { + return c.withDO(c.DO.Scopes(funcs...)) +} + +func (c commitFileDo) Unscoped() ICommitFileDo { + return c.withDO(c.DO.Unscoped()) +} + +func (c commitFileDo) Create(values ...*model.CommitFile) error { + if len(values) == 0 { + return nil + } + return c.DO.Create(values) +} + +func (c commitFileDo) CreateInBatches(values []*model.CommitFile, batchSize int) error { + return c.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (c commitFileDo) Save(values ...*model.CommitFile) error { + if len(values) == 0 { + return nil + } + return c.DO.Save(values) +} + +func (c commitFileDo) First() (*model.CommitFile, error) { + if result, err := c.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.CommitFile), nil + } +} + +func (c commitFileDo) Take() (*model.CommitFile, error) { + if result, err := c.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.CommitFile), nil + } +} + +func (c commitFileDo) Last() (*model.CommitFile, error) { + if result, err := c.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.CommitFile), nil + } +} + +func (c commitFileDo) Find() ([]*model.CommitFile, error) { + result, err := c.DO.Find() + return result.([]*model.CommitFile), err +} + +func (c commitFileDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.CommitFile, err error) { + buf := make([]*model.CommitFile, 0, batchSize) + err = c.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (c commitFileDo) FindInBatches(result *[]*model.CommitFile, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return c.DO.FindInBatches(result, batchSize, fc) +} + +func (c commitFileDo) Attrs(attrs ...field.AssignExpr) ICommitFileDo { + return c.withDO(c.DO.Attrs(attrs...)) +} + +func (c commitFileDo) Assign(attrs ...field.AssignExpr) ICommitFileDo { + return c.withDO(c.DO.Assign(attrs...)) +} + +func (c commitFileDo) Joins(fields ...field.RelationField) ICommitFileDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Joins(_f)) + } + return &c +} + +func (c commitFileDo) Preload(fields ...field.RelationField) ICommitFileDo { + for _, _f := range fields { + c = *c.withDO(c.DO.Preload(_f)) + } + return &c +} + +func (c commitFileDo) FirstOrInit() (*model.CommitFile, error) { + if result, err := c.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.CommitFile), nil + } +} + +func (c commitFileDo) FirstOrCreate() (*model.CommitFile, error) { + if result, err := c.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.CommitFile), nil + } +} + +func (c commitFileDo) FindByPage(offset int, limit int) (result []*model.CommitFile, count int64, err error) { + result, err = c.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = c.Offset(-1).Limit(-1).Count() + return +} + +func (c commitFileDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = c.Count() + if err != nil { + return + } + + err = c.Offset(offset).Limit(limit).Scan(result) + return +} + +func (c commitFileDo) Scan(result interface{}) (err error) { + return c.DO.Scan(result) +} + +func (c commitFileDo) Delete(models ...*model.CommitFile) (result gen.ResultInfo, err error) { + return c.DO.Delete(models) +} + +func (c *commitFileDo) withDO(do gen.Dao) *commitFileDo { + c.DO = *do.(*gen.DO) + return c +} diff --git a/pkg/bufman/dal/commits.gen.go b/pkg/bufman/dal/commits.gen.go index e3032b365..3f35f17b6 100644 --- a/pkg/bufman/dal/commits.gen.go +++ b/pkg/bufman/dal/commits.gen.go @@ -41,23 +41,6 @@ func newCommit(db *gorm.DB, opts ...gen.DOOption) commit { _commit.DocumentDigest = field.NewString(tableName, "document_digest") _commit.LicenseDigest = field.NewString(tableName, "license_digest") _commit.SequenceID = field.NewInt64(tableName, "sequence_id") - _commit.FileManifest = commitHasOneFileManifest{ - db: db.Session(&gorm.Session{}), - - RelationField: field.NewRelation("FileManifest", "model.FileManifest"), - } - - _commit.FileBlobs = commitHasManyFileBlobs{ - db: db.Session(&gorm.Session{}), - - RelationField: field.NewRelation("FileBlobs", "model.FileBlobs"), - } - - _commit.Tags = commitHasManyTags{ - db: db.Session(&gorm.Session{}), - - RelationField: field.NewRelation("Tags", "model.Tags"), - } _commit.fillFieldMap() @@ -82,11 +65,6 @@ type commit struct { DocumentDigest field.String LicenseDigest field.String SequenceID field.Int64 - FileManifest commitHasOneFileManifest - - FileBlobs commitHasManyFileBlobs - - Tags commitHasManyTags fieldMap map[string]field.Expr } @@ -133,7 +111,7 @@ func (c *commit) GetFieldByName(fieldName string) (field.OrderExpr, bool) { } func (c *commit) fillFieldMap() { - c.fieldMap = make(map[string]field.Expr, 17) + c.fieldMap = make(map[string]field.Expr, 14) c.fieldMap["id"] = c.ID c.fieldMap["user_id"] = c.UserID c.fieldMap["user_name"] = c.UserName @@ -148,7 +126,6 @@ func (c *commit) fillFieldMap() { c.fieldMap["document_digest"] = c.DocumentDigest c.fieldMap["license_digest"] = c.LicenseDigest c.fieldMap["sequence_id"] = c.SequenceID - } func (c commit) clone(db *gorm.DB) commit { @@ -161,219 +138,6 @@ func (c commit) replaceDB(db *gorm.DB) commit { return c } -type commitHasOneFileManifest struct { - db *gorm.DB - - field.RelationField -} - -func (a commitHasOneFileManifest) Where(conds ...field.Expr) *commitHasOneFileManifest { - if len(conds) == 0 { - return &a - } - - exprs := make([]clause.Expression, 0, len(conds)) - for _, cond := range conds { - exprs = append(exprs, cond.BeCond().(clause.Expression)) - } - a.db = a.db.Clauses(clause.Where{Exprs: exprs}) - return &a -} - -func (a commitHasOneFileManifest) WithContext(ctx context.Context) *commitHasOneFileManifest { - a.db = a.db.WithContext(ctx) - return &a -} - -func (a commitHasOneFileManifest) Session(session *gorm.Session) *commitHasOneFileManifest { - a.db = a.db.Session(session) - return &a -} - -func (a commitHasOneFileManifest) Model(m *model.Commit) *commitHasOneFileManifestTx { - return &commitHasOneFileManifestTx{a.db.Model(m).Association(a.Name())} -} - -type commitHasOneFileManifestTx struct{ tx *gorm.Association } - -func (a commitHasOneFileManifestTx) Find() (result *model.FileManifest, err error) { - return result, a.tx.Find(&result) -} - -func (a commitHasOneFileManifestTx) Append(values ...*model.FileManifest) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Append(targetValues...) -} - -func (a commitHasOneFileManifestTx) Replace(values ...*model.FileManifest) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Replace(targetValues...) -} - -func (a commitHasOneFileManifestTx) Delete(values ...*model.FileManifest) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Delete(targetValues...) -} - -func (a commitHasOneFileManifestTx) Clear() error { - return a.tx.Clear() -} - -func (a commitHasOneFileManifestTx) Count() int64 { - return a.tx.Count() -} - -type commitHasManyFileBlobs struct { - db *gorm.DB - - field.RelationField -} - -func (a commitHasManyFileBlobs) Where(conds ...field.Expr) *commitHasManyFileBlobs { - if len(conds) == 0 { - return &a - } - - exprs := make([]clause.Expression, 0, len(conds)) - for _, cond := range conds { - exprs = append(exprs, cond.BeCond().(clause.Expression)) - } - a.db = a.db.Clauses(clause.Where{Exprs: exprs}) - return &a -} - -func (a commitHasManyFileBlobs) WithContext(ctx context.Context) *commitHasManyFileBlobs { - a.db = a.db.WithContext(ctx) - return &a -} - -func (a commitHasManyFileBlobs) Session(session *gorm.Session) *commitHasManyFileBlobs { - a.db = a.db.Session(session) - return &a -} - -func (a commitHasManyFileBlobs) Model(m *model.Commit) *commitHasManyFileBlobsTx { - return &commitHasManyFileBlobsTx{a.db.Model(m).Association(a.Name())} -} - -type commitHasManyFileBlobsTx struct{ tx *gorm.Association } - -func (a commitHasManyFileBlobsTx) Find() (result []*model.FileBlobs, err error) { - return result, a.tx.Find(&result) -} - -func (a commitHasManyFileBlobsTx) Append(values ...*model.FileBlobs) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Append(targetValues...) -} - -func (a commitHasManyFileBlobsTx) Replace(values ...*model.FileBlobs) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Replace(targetValues...) -} - -func (a commitHasManyFileBlobsTx) Delete(values ...*model.FileBlobs) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Delete(targetValues...) -} - -func (a commitHasManyFileBlobsTx) Clear() error { - return a.tx.Clear() -} - -func (a commitHasManyFileBlobsTx) Count() int64 { - return a.tx.Count() -} - -type commitHasManyTags struct { - db *gorm.DB - - field.RelationField -} - -func (a commitHasManyTags) Where(conds ...field.Expr) *commitHasManyTags { - if len(conds) == 0 { - return &a - } - - exprs := make([]clause.Expression, 0, len(conds)) - for _, cond := range conds { - exprs = append(exprs, cond.BeCond().(clause.Expression)) - } - a.db = a.db.Clauses(clause.Where{Exprs: exprs}) - return &a -} - -func (a commitHasManyTags) WithContext(ctx context.Context) *commitHasManyTags { - a.db = a.db.WithContext(ctx) - return &a -} - -func (a commitHasManyTags) Session(session *gorm.Session) *commitHasManyTags { - a.db = a.db.Session(session) - return &a -} - -func (a commitHasManyTags) Model(m *model.Commit) *commitHasManyTagsTx { - return &commitHasManyTagsTx{a.db.Model(m).Association(a.Name())} -} - -type commitHasManyTagsTx struct{ tx *gorm.Association } - -func (a commitHasManyTagsTx) Find() (result []*model.Tags, err error) { - return result, a.tx.Find(&result) -} - -func (a commitHasManyTagsTx) Append(values ...*model.Tags) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Append(targetValues...) -} - -func (a commitHasManyTagsTx) Replace(values ...*model.Tags) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Replace(targetValues...) -} - -func (a commitHasManyTagsTx) Delete(values ...*model.Tags) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Delete(targetValues...) -} - -func (a commitHasManyTagsTx) Clear() error { - return a.tx.Clear() -} - -func (a commitHasManyTagsTx) Count() int64 { - return a.tx.Count() -} - type commitDo struct{ gen.DO } type ICommitDo interface { diff --git a/pkg/bufman/dal/file_blobs.gen.go b/pkg/bufman/dal/file_blobs.gen.go index a9b3122e5..2e8bc36b6 100644 --- a/pkg/bufman/dal/file_blobs.gen.go +++ b/pkg/bufman/dal/file_blobs.gen.go @@ -29,8 +29,7 @@ func newFileBlob(db *gorm.DB, opts ...gen.DOOption) fileBlob { _fileBlob.ALL = field.NewAsterisk(tableName) _fileBlob.ID = field.NewInt64(tableName, "id") _fileBlob.Digest = field.NewString(tableName, "digest") - _fileBlob.CommitID = field.NewString(tableName, "commit_id") - _fileBlob.FileName = field.NewString(tableName, "file_name") + _fileBlob.Content = field.NewBytes(tableName, "content") _fileBlob.fillFieldMap() @@ -40,11 +39,10 @@ func newFileBlob(db *gorm.DB, opts ...gen.DOOption) fileBlob { type fileBlob struct { fileBlobDo - ALL field.Asterisk - ID field.Int64 - Digest field.String - CommitID field.String - FileName field.String + ALL field.Asterisk + ID field.Int64 + Digest field.String + Content field.Bytes fieldMap map[string]field.Expr } @@ -63,8 +61,7 @@ func (f *fileBlob) updateTableName(table string) *fileBlob { f.ALL = field.NewAsterisk(table) f.ID = field.NewInt64(table, "id") f.Digest = field.NewString(table, "digest") - f.CommitID = field.NewString(table, "commit_id") - f.FileName = field.NewString(table, "file_name") + f.Content = field.NewBytes(table, "content") f.fillFieldMap() @@ -81,11 +78,10 @@ func (f *fileBlob) GetFieldByName(fieldName string) (field.OrderExpr, bool) { } func (f *fileBlob) fillFieldMap() { - f.fieldMap = make(map[string]field.Expr, 4) + f.fieldMap = make(map[string]field.Expr, 3) f.fieldMap["id"] = f.ID f.fieldMap["digest"] = f.Digest - f.fieldMap["commit_id"] = f.CommitID - f.fieldMap["file_name"] = f.FileName + f.fieldMap["content"] = f.Content } func (f fileBlob) clone(db *gorm.DB) fileBlob { diff --git a/pkg/bufman/dal/file_manifests.gen.go b/pkg/bufman/dal/file_manifests.gen.go deleted file mode 100644 index e98e2bcec..000000000 --- a/pkg/bufman/dal/file_manifests.gen.go +++ /dev/null @@ -1,388 +0,0 @@ -// Code generated by gorm.io/gen. DO NOT EDIT. -// Code generated by gorm.io/gen. DO NOT EDIT. -// Code generated by gorm.io/gen. DO NOT EDIT. - -package dal - -import ( - "context" - - "gorm.io/gorm" - "gorm.io/gorm/clause" - "gorm.io/gorm/schema" - - "gorm.io/gen" - "gorm.io/gen/field" - - "gorm.io/plugin/dbresolver" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/model" -) - -func newFileManifest(db *gorm.DB, opts ...gen.DOOption) fileManifest { - _fileManifest := fileManifest{} - - _fileManifest.fileManifestDo.UseDB(db, opts...) - _fileManifest.fileManifestDo.UseModel(&model.FileManifest{}) - - tableName := _fileManifest.fileManifestDo.TableName() - _fileManifest.ALL = field.NewAsterisk(tableName) - _fileManifest.ID = field.NewInt64(tableName, "id") - _fileManifest.Digest = field.NewString(tableName, "digest") - _fileManifest.CommitID = field.NewString(tableName, "commit_id") - - _fileManifest.fillFieldMap() - - return _fileManifest -} - -type fileManifest struct { - fileManifestDo - - ALL field.Asterisk - ID field.Int64 - Digest field.String - CommitID field.String - - fieldMap map[string]field.Expr -} - -func (f fileManifest) Table(newTableName string) *fileManifest { - f.fileManifestDo.UseTable(newTableName) - return f.updateTableName(newTableName) -} - -func (f fileManifest) As(alias string) *fileManifest { - f.fileManifestDo.DO = *(f.fileManifestDo.As(alias).(*gen.DO)) - return f.updateTableName(alias) -} - -func (f *fileManifest) updateTableName(table string) *fileManifest { - f.ALL = field.NewAsterisk(table) - f.ID = field.NewInt64(table, "id") - f.Digest = field.NewString(table, "digest") - f.CommitID = field.NewString(table, "commit_id") - - f.fillFieldMap() - - return f -} - -func (f *fileManifest) GetFieldByName(fieldName string) (field.OrderExpr, bool) { - _f, ok := f.fieldMap[fieldName] - if !ok || _f == nil { - return nil, false - } - _oe, ok := _f.(field.OrderExpr) - return _oe, ok -} - -func (f *fileManifest) fillFieldMap() { - f.fieldMap = make(map[string]field.Expr, 3) - f.fieldMap["id"] = f.ID - f.fieldMap["digest"] = f.Digest - f.fieldMap["commit_id"] = f.CommitID -} - -func (f fileManifest) clone(db *gorm.DB) fileManifest { - f.fileManifestDo.ReplaceConnPool(db.Statement.ConnPool) - return f -} - -func (f fileManifest) replaceDB(db *gorm.DB) fileManifest { - f.fileManifestDo.ReplaceDB(db) - return f -} - -type fileManifestDo struct{ gen.DO } - -type IFileManifestDo interface { - gen.SubQuery - Debug() IFileManifestDo - WithContext(ctx context.Context) IFileManifestDo - WithResult(fc func(tx gen.Dao)) gen.ResultInfo - ReplaceDB(db *gorm.DB) - ReadDB() IFileManifestDo - WriteDB() IFileManifestDo - As(alias string) gen.Dao - Session(config *gorm.Session) IFileManifestDo - Columns(cols ...field.Expr) gen.Columns - Clauses(conds ...clause.Expression) IFileManifestDo - Not(conds ...gen.Condition) IFileManifestDo - Or(conds ...gen.Condition) IFileManifestDo - Select(conds ...field.Expr) IFileManifestDo - Where(conds ...gen.Condition) IFileManifestDo - Order(conds ...field.Expr) IFileManifestDo - Distinct(cols ...field.Expr) IFileManifestDo - Omit(cols ...field.Expr) IFileManifestDo - Join(table schema.Tabler, on ...field.Expr) IFileManifestDo - LeftJoin(table schema.Tabler, on ...field.Expr) IFileManifestDo - RightJoin(table schema.Tabler, on ...field.Expr) IFileManifestDo - Group(cols ...field.Expr) IFileManifestDo - Having(conds ...gen.Condition) IFileManifestDo - Limit(limit int) IFileManifestDo - Offset(offset int) IFileManifestDo - Count() (count int64, err error) - Scopes(funcs ...func(gen.Dao) gen.Dao) IFileManifestDo - Unscoped() IFileManifestDo - Create(values ...*model.FileManifest) error - CreateInBatches(values []*model.FileManifest, batchSize int) error - Save(values ...*model.FileManifest) error - First() (*model.FileManifest, error) - Take() (*model.FileManifest, error) - Last() (*model.FileManifest, error) - Find() ([]*model.FileManifest, error) - FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FileManifest, err error) - FindInBatches(result *[]*model.FileManifest, batchSize int, fc func(tx gen.Dao, batch int) error) error - Pluck(column field.Expr, dest interface{}) error - Delete(...*model.FileManifest) (info gen.ResultInfo, err error) - Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) - UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - Updates(value interface{}) (info gen.ResultInfo, err error) - UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) - UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) - UpdateColumns(value interface{}) (info gen.ResultInfo, err error) - UpdateFrom(q gen.SubQuery) gen.Dao - Attrs(attrs ...field.AssignExpr) IFileManifestDo - Assign(attrs ...field.AssignExpr) IFileManifestDo - Joins(fields ...field.RelationField) IFileManifestDo - Preload(fields ...field.RelationField) IFileManifestDo - FirstOrInit() (*model.FileManifest, error) - FirstOrCreate() (*model.FileManifest, error) - FindByPage(offset int, limit int) (result []*model.FileManifest, count int64, err error) - ScanByPage(result interface{}, offset int, limit int) (count int64, err error) - Scan(result interface{}) (err error) - Returning(value interface{}, columns ...string) IFileManifestDo - UnderlyingDB() *gorm.DB - schema.Tabler -} - -func (f fileManifestDo) Debug() IFileManifestDo { - return f.withDO(f.DO.Debug()) -} - -func (f fileManifestDo) WithContext(ctx context.Context) IFileManifestDo { - return f.withDO(f.DO.WithContext(ctx)) -} - -func (f fileManifestDo) ReadDB() IFileManifestDo { - return f.Clauses(dbresolver.Read) -} - -func (f fileManifestDo) WriteDB() IFileManifestDo { - return f.Clauses(dbresolver.Write) -} - -func (f fileManifestDo) Session(config *gorm.Session) IFileManifestDo { - return f.withDO(f.DO.Session(config)) -} - -func (f fileManifestDo) Clauses(conds ...clause.Expression) IFileManifestDo { - return f.withDO(f.DO.Clauses(conds...)) -} - -func (f fileManifestDo) Returning(value interface{}, columns ...string) IFileManifestDo { - return f.withDO(f.DO.Returning(value, columns...)) -} - -func (f fileManifestDo) Not(conds ...gen.Condition) IFileManifestDo { - return f.withDO(f.DO.Not(conds...)) -} - -func (f fileManifestDo) Or(conds ...gen.Condition) IFileManifestDo { - return f.withDO(f.DO.Or(conds...)) -} - -func (f fileManifestDo) Select(conds ...field.Expr) IFileManifestDo { - return f.withDO(f.DO.Select(conds...)) -} - -func (f fileManifestDo) Where(conds ...gen.Condition) IFileManifestDo { - return f.withDO(f.DO.Where(conds...)) -} - -func (f fileManifestDo) Order(conds ...field.Expr) IFileManifestDo { - return f.withDO(f.DO.Order(conds...)) -} - -func (f fileManifestDo) Distinct(cols ...field.Expr) IFileManifestDo { - return f.withDO(f.DO.Distinct(cols...)) -} - -func (f fileManifestDo) Omit(cols ...field.Expr) IFileManifestDo { - return f.withDO(f.DO.Omit(cols...)) -} - -func (f fileManifestDo) Join(table schema.Tabler, on ...field.Expr) IFileManifestDo { - return f.withDO(f.DO.Join(table, on...)) -} - -func (f fileManifestDo) LeftJoin(table schema.Tabler, on ...field.Expr) IFileManifestDo { - return f.withDO(f.DO.LeftJoin(table, on...)) -} - -func (f fileManifestDo) RightJoin(table schema.Tabler, on ...field.Expr) IFileManifestDo { - return f.withDO(f.DO.RightJoin(table, on...)) -} - -func (f fileManifestDo) Group(cols ...field.Expr) IFileManifestDo { - return f.withDO(f.DO.Group(cols...)) -} - -func (f fileManifestDo) Having(conds ...gen.Condition) IFileManifestDo { - return f.withDO(f.DO.Having(conds...)) -} - -func (f fileManifestDo) Limit(limit int) IFileManifestDo { - return f.withDO(f.DO.Limit(limit)) -} - -func (f fileManifestDo) Offset(offset int) IFileManifestDo { - return f.withDO(f.DO.Offset(offset)) -} - -func (f fileManifestDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IFileManifestDo { - return f.withDO(f.DO.Scopes(funcs...)) -} - -func (f fileManifestDo) Unscoped() IFileManifestDo { - return f.withDO(f.DO.Unscoped()) -} - -func (f fileManifestDo) Create(values ...*model.FileManifest) error { - if len(values) == 0 { - return nil - } - return f.DO.Create(values) -} - -func (f fileManifestDo) CreateInBatches(values []*model.FileManifest, batchSize int) error { - return f.DO.CreateInBatches(values, batchSize) -} - -// Save : !!! underlying implementation is different with GORM -// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) -func (f fileManifestDo) Save(values ...*model.FileManifest) error { - if len(values) == 0 { - return nil - } - return f.DO.Save(values) -} - -func (f fileManifestDo) First() (*model.FileManifest, error) { - if result, err := f.DO.First(); err != nil { - return nil, err - } else { - return result.(*model.FileManifest), nil - } -} - -func (f fileManifestDo) Take() (*model.FileManifest, error) { - if result, err := f.DO.Take(); err != nil { - return nil, err - } else { - return result.(*model.FileManifest), nil - } -} - -func (f fileManifestDo) Last() (*model.FileManifest, error) { - if result, err := f.DO.Last(); err != nil { - return nil, err - } else { - return result.(*model.FileManifest), nil - } -} - -func (f fileManifestDo) Find() ([]*model.FileManifest, error) { - result, err := f.DO.Find() - return result.([]*model.FileManifest), err -} - -func (f fileManifestDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FileManifest, err error) { - buf := make([]*model.FileManifest, 0, batchSize) - err = f.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { - defer func() { results = append(results, buf...) }() - return fc(tx, batch) - }) - return results, err -} - -func (f fileManifestDo) FindInBatches(result *[]*model.FileManifest, batchSize int, fc func(tx gen.Dao, batch int) error) error { - return f.DO.FindInBatches(result, batchSize, fc) -} - -func (f fileManifestDo) Attrs(attrs ...field.AssignExpr) IFileManifestDo { - return f.withDO(f.DO.Attrs(attrs...)) -} - -func (f fileManifestDo) Assign(attrs ...field.AssignExpr) IFileManifestDo { - return f.withDO(f.DO.Assign(attrs...)) -} - -func (f fileManifestDo) Joins(fields ...field.RelationField) IFileManifestDo { - for _, _f := range fields { - f = *f.withDO(f.DO.Joins(_f)) - } - return &f -} - -func (f fileManifestDo) Preload(fields ...field.RelationField) IFileManifestDo { - for _, _f := range fields { - f = *f.withDO(f.DO.Preload(_f)) - } - return &f -} - -func (f fileManifestDo) FirstOrInit() (*model.FileManifest, error) { - if result, err := f.DO.FirstOrInit(); err != nil { - return nil, err - } else { - return result.(*model.FileManifest), nil - } -} - -func (f fileManifestDo) FirstOrCreate() (*model.FileManifest, error) { - if result, err := f.DO.FirstOrCreate(); err != nil { - return nil, err - } else { - return result.(*model.FileManifest), nil - } -} - -func (f fileManifestDo) FindByPage(offset int, limit int) (result []*model.FileManifest, count int64, err error) { - result, err = f.Offset(offset).Limit(limit).Find() - if err != nil { - return - } - - if size := len(result); 0 < limit && 0 < size && size < limit { - count = int64(size + offset) - return - } - - count, err = f.Offset(-1).Limit(-1).Count() - return -} - -func (f fileManifestDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { - count, err = f.Count() - if err != nil { - return - } - - err = f.Offset(offset).Limit(limit).Scan(result) - return -} - -func (f fileManifestDo) Scan(result interface{}) (err error) { - return f.DO.Scan(result) -} - -func (f fileManifestDo) Delete(models ...*model.FileManifest) (result gen.ResultInfo, err error) { - return f.DO.Delete(models) -} - -func (f *fileManifestDo) withDO(do gen.Dao) *fileManifestDo { - f.DO = *do.(*gen.DO) - return f -} diff --git a/pkg/bufman/dal/gen.go b/pkg/bufman/dal/gen.go index 75386bcbe..2e67f2651 100644 --- a/pkg/bufman/dal/gen.go +++ b/pkg/bufman/dal/gen.go @@ -16,21 +16,21 @@ import ( ) var ( - Q = new(Query) - Commit *commit - FileBlob *fileBlob - FileManifest *fileManifest - Repository *repository - Tag *tag - Token *token - User *user + Q = new(Query) + Commit *commit + CommitFile *commitFile + FileBlob *fileBlob + Repository *repository + Tag *tag + Token *token + User *user ) func SetDefault(db *gorm.DB, opts ...gen.DOOption) { *Q = *Use(db, opts...) Commit = &Q.Commit + CommitFile = &Q.CommitFile FileBlob = &Q.FileBlob - FileManifest = &Q.FileManifest Repository = &Q.Repository Tag = &Q.Tag Token = &Q.Token @@ -39,41 +39,41 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) { func Use(db *gorm.DB, opts ...gen.DOOption) *Query { return &Query{ - db: db, - Commit: newCommit(db, opts...), - FileBlob: newFileBlob(db, opts...), - FileManifest: newFileManifest(db, opts...), - Repository: newRepository(db, opts...), - Tag: newTag(db, opts...), - Token: newToken(db, opts...), - User: newUser(db, opts...), + db: db, + Commit: newCommit(db, opts...), + CommitFile: newCommitFile(db, opts...), + FileBlob: newFileBlob(db, opts...), + Repository: newRepository(db, opts...), + Tag: newTag(db, opts...), + Token: newToken(db, opts...), + User: newUser(db, opts...), } } type Query struct { db *gorm.DB - Commit commit - FileBlob fileBlob - FileManifest fileManifest - Repository repository - Tag tag - Token token - User user + Commit commit + CommitFile commitFile + FileBlob fileBlob + Repository repository + Tag tag + Token token + User user } func (q *Query) Available() bool { return q.db != nil } func (q *Query) clone(db *gorm.DB) *Query { return &Query{ - db: db, - Commit: q.Commit.clone(db), - FileBlob: q.FileBlob.clone(db), - FileManifest: q.FileManifest.clone(db), - Repository: q.Repository.clone(db), - Tag: q.Tag.clone(db), - Token: q.Token.clone(db), - User: q.User.clone(db), + db: db, + Commit: q.Commit.clone(db), + CommitFile: q.CommitFile.clone(db), + FileBlob: q.FileBlob.clone(db), + Repository: q.Repository.clone(db), + Tag: q.Tag.clone(db), + Token: q.Token.clone(db), + User: q.User.clone(db), } } @@ -87,36 +87,36 @@ func (q *Query) WriteDB() *Query { func (q *Query) ReplaceDB(db *gorm.DB) *Query { return &Query{ - db: db, - Commit: q.Commit.replaceDB(db), - FileBlob: q.FileBlob.replaceDB(db), - FileManifest: q.FileManifest.replaceDB(db), - Repository: q.Repository.replaceDB(db), - Tag: q.Tag.replaceDB(db), - Token: q.Token.replaceDB(db), - User: q.User.replaceDB(db), + db: db, + Commit: q.Commit.replaceDB(db), + CommitFile: q.CommitFile.replaceDB(db), + FileBlob: q.FileBlob.replaceDB(db), + Repository: q.Repository.replaceDB(db), + Tag: q.Tag.replaceDB(db), + Token: q.Token.replaceDB(db), + User: q.User.replaceDB(db), } } type queryCtx struct { - Commit ICommitDo - FileBlob IFileBlobDo - FileManifest IFileManifestDo - Repository IRepositoryDo - Tag ITagDo - Token ITokenDo - User IUserDo + Commit ICommitDo + CommitFile ICommitFileDo + FileBlob IFileBlobDo + Repository IRepositoryDo + Tag ITagDo + Token ITokenDo + User IUserDo } func (q *Query) WithContext(ctx context.Context) *queryCtx { return &queryCtx{ - Commit: q.Commit.WithContext(ctx), - FileBlob: q.FileBlob.WithContext(ctx), - FileManifest: q.FileManifest.WithContext(ctx), - Repository: q.Repository.WithContext(ctx), - Tag: q.Tag.WithContext(ctx), - Token: q.Token.WithContext(ctx), - User: q.User.WithContext(ctx), + Commit: q.Commit.WithContext(ctx), + CommitFile: q.CommitFile.WithContext(ctx), + FileBlob: q.FileBlob.WithContext(ctx), + Repository: q.Repository.WithContext(ctx), + Tag: q.Tag.WithContext(ctx), + Token: q.Token.WithContext(ctx), + User: q.User.WithContext(ctx), } } diff --git a/pkg/bufman/dal/repositories.gen.go b/pkg/bufman/dal/repositories.gen.go index 296069b55..0c6c5a042 100644 --- a/pkg/bufman/dal/repositories.gen.go +++ b/pkg/bufman/dal/repositories.gen.go @@ -39,32 +39,6 @@ func newRepository(db *gorm.DB, opts ...gen.DOOption) repository { _repository.DeprecationMsg = field.NewString(tableName, "deprecation_msg") _repository.Url = field.NewString(tableName, "url") _repository.Description = field.NewString(tableName, "description") - _repository.DraftCommits = repositoryHasManyDraftCommits{ - db: db.Session(&gorm.Session{}), - - RelationField: field.NewRelation("DraftCommits", "model.Commit"), - FileManifest: struct { - field.RelationField - }{ - RelationField: field.NewRelation("DraftCommits.FileManifest", "model.FileManifest"), - }, - FileBlobs: struct { - field.RelationField - }{ - RelationField: field.NewRelation("DraftCommits.FileBlobs", "model.FileBlobs"), - }, - Tags: struct { - field.RelationField - }{ - RelationField: field.NewRelation("DraftCommits.Tags", "model.Tags"), - }, - } - - _repository.Tags = repositoryHasManyTags{ - db: db.Session(&gorm.Session{}), - - RelationField: field.NewRelation("Tags", "model.Tag"), - } _repository.fillFieldMap() @@ -87,9 +61,6 @@ type repository struct { DeprecationMsg field.String Url field.String Description field.String - DraftCommits repositoryHasManyDraftCommits - - Tags repositoryHasManyTags fieldMap map[string]field.Expr } @@ -134,7 +105,7 @@ func (r *repository) GetFieldByName(fieldName string) (field.OrderExpr, bool) { } func (r *repository) fillFieldMap() { - r.fieldMap = make(map[string]field.Expr, 14) + r.fieldMap = make(map[string]field.Expr, 12) r.fieldMap["id"] = r.ID r.fieldMap["user_id"] = r.UserID r.fieldMap["user_name"] = r.UserName @@ -147,7 +118,6 @@ func (r *repository) fillFieldMap() { r.fieldMap["deprecation_msg"] = r.DeprecationMsg r.fieldMap["url"] = r.Url r.fieldMap["description"] = r.Description - } func (r repository) clone(db *gorm.DB) repository { @@ -160,158 +130,6 @@ func (r repository) replaceDB(db *gorm.DB) repository { return r } -type repositoryHasManyDraftCommits struct { - db *gorm.DB - - field.RelationField - - FileManifest struct { - field.RelationField - } - FileBlobs struct { - field.RelationField - } - Tags struct { - field.RelationField - } -} - -func (a repositoryHasManyDraftCommits) Where(conds ...field.Expr) *repositoryHasManyDraftCommits { - if len(conds) == 0 { - return &a - } - - exprs := make([]clause.Expression, 0, len(conds)) - for _, cond := range conds { - exprs = append(exprs, cond.BeCond().(clause.Expression)) - } - a.db = a.db.Clauses(clause.Where{Exprs: exprs}) - return &a -} - -func (a repositoryHasManyDraftCommits) WithContext(ctx context.Context) *repositoryHasManyDraftCommits { - a.db = a.db.WithContext(ctx) - return &a -} - -func (a repositoryHasManyDraftCommits) Session(session *gorm.Session) *repositoryHasManyDraftCommits { - a.db = a.db.Session(session) - return &a -} - -func (a repositoryHasManyDraftCommits) Model(m *model.Repository) *repositoryHasManyDraftCommitsTx { - return &repositoryHasManyDraftCommitsTx{a.db.Model(m).Association(a.Name())} -} - -type repositoryHasManyDraftCommitsTx struct{ tx *gorm.Association } - -func (a repositoryHasManyDraftCommitsTx) Find() (result []*model.Commit, err error) { - return result, a.tx.Find(&result) -} - -func (a repositoryHasManyDraftCommitsTx) Append(values ...*model.Commit) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Append(targetValues...) -} - -func (a repositoryHasManyDraftCommitsTx) Replace(values ...*model.Commit) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Replace(targetValues...) -} - -func (a repositoryHasManyDraftCommitsTx) Delete(values ...*model.Commit) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Delete(targetValues...) -} - -func (a repositoryHasManyDraftCommitsTx) Clear() error { - return a.tx.Clear() -} - -func (a repositoryHasManyDraftCommitsTx) Count() int64 { - return a.tx.Count() -} - -type repositoryHasManyTags struct { - db *gorm.DB - - field.RelationField -} - -func (a repositoryHasManyTags) Where(conds ...field.Expr) *repositoryHasManyTags { - if len(conds) == 0 { - return &a - } - - exprs := make([]clause.Expression, 0, len(conds)) - for _, cond := range conds { - exprs = append(exprs, cond.BeCond().(clause.Expression)) - } - a.db = a.db.Clauses(clause.Where{Exprs: exprs}) - return &a -} - -func (a repositoryHasManyTags) WithContext(ctx context.Context) *repositoryHasManyTags { - a.db = a.db.WithContext(ctx) - return &a -} - -func (a repositoryHasManyTags) Session(session *gorm.Session) *repositoryHasManyTags { - a.db = a.db.Session(session) - return &a -} - -func (a repositoryHasManyTags) Model(m *model.Repository) *repositoryHasManyTagsTx { - return &repositoryHasManyTagsTx{a.db.Model(m).Association(a.Name())} -} - -type repositoryHasManyTagsTx struct{ tx *gorm.Association } - -func (a repositoryHasManyTagsTx) Find() (result []*model.Tag, err error) { - return result, a.tx.Find(&result) -} - -func (a repositoryHasManyTagsTx) Append(values ...*model.Tag) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Append(targetValues...) -} - -func (a repositoryHasManyTagsTx) Replace(values ...*model.Tag) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Replace(targetValues...) -} - -func (a repositoryHasManyTagsTx) Delete(values ...*model.Tag) (err error) { - targetValues := make([]interface{}, len(values)) - for i, v := range values { - targetValues[i] = v - } - return a.tx.Delete(targetValues...) -} - -func (a repositoryHasManyTagsTx) Clear() error { - return a.tx.Clear() -} - -func (a repositoryHasManyTagsTx) Count() int64 { - return a.tx.Count() -} - type repositoryDo struct{ gen.DO } type IRepositoryDo interface { diff --git a/pkg/bufman/gorm_gen/gorm_gen.go b/pkg/bufman/gorm_gen/gorm_gen.go index 7655c2268..5bc118cd3 100644 --- a/pkg/bufman/gorm_gen/gorm_gen.go +++ b/pkg/bufman/gorm_gen/gorm_gen.go @@ -17,14 +17,10 @@ package main import ( "github.com/apache/dubbo-kubernetes/pkg/bufman/model" - "gorm.io/driver/mysql" "gorm.io/gen" - "gorm.io/gorm" ) func main() { - dsn := "root:123456@tcp(127.0.0.1:3306)/idl_manager?charset=utf8mb4&parseTime=True&loc=Local" - // Initialize the generator with configuration g := gen.NewGenerator(gen.Config{ OutPath: "pkg/bufman/dal", // output directory @@ -32,17 +28,8 @@ func main() { FieldNullable: true, }) - db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{TranslateError: true}) - if err != nil { - panic(err) - } - - // Use the above `*gorm.DB` instance to initialize the generator, - // which is required to generate structs from db when using `GenerateModel/GenerateModelAs` - g.UseDB(db) - - // Generate default DAO interface for those specified structs - g.ApplyBasic(model.User{}, model.Token{}, model.Repository{}, model.Tag{}, model.Commit{}, model.FileManifest{}, model.FileBlob{}) + //// Generate default DAO interface for those specified structs + g.ApplyBasic(model.User{}, model.Token{}, model.Repository{}, model.Tag{}, model.Commit{}, model.FileBlob{}, model.CommitFile{}) // Execute the generator g.Execute() diff --git a/pkg/bufman/mapper/file_mapper.go b/pkg/bufman/mapper/file_mapper.go index 192cc1e8e..70cf50f60 100644 --- a/pkg/bufman/mapper/file_mapper.go +++ b/pkg/bufman/mapper/file_mapper.go @@ -21,21 +21,31 @@ import ( ) type FileMapper interface { - FindAllBlobsByCommitID(commitID string) (model.FileBlobs, error) - FindManifestByCommitID(commitID string) (*model.FileManifest, error) - FindBlobByCommitIDAndPath(commitID, path string) (*model.FileBlob, error) + FindCommitFilesExceptManifestByCommitID(commitID string) (model.CommitFiles, error) + FindCommitManifestByCommitID(commitID string) (*model.CommitFile, error) + FindCommitFileByCommitIDAndPath(commitID, path string) (*model.CommitFile, error) } type FileMapperImpl struct{} -func (f *FileMapperImpl) FindAllBlobsByCommitID(commitID string) (model.FileBlobs, error) { - return dal.FileBlob.Where(dal.FileBlob.CommitID.Eq(commitID)).Find() +func (f *FileMapperImpl) FindCommitFilesExceptManifestByCommitID(commitID string) (model.CommitFiles, error) { + commit, err := dal.Commit.Where(dal.Commit.CommitID.Eq(commitID)).First() + if err != nil { + return nil, err + } + + return dal.CommitFile.Where(dal.CommitFile.CommitID.Eq(commitID), dal.CommitFile.Digest.Neq(commit.ManifestDigest)).Find() } -func (f *FileMapperImpl) FindManifestByCommitID(commitID string) (*model.FileManifest, error) { - return dal.FileManifest.Where(dal.FileManifest.CommitID.Eq(commitID)).First() +func (f *FileMapperImpl) FindCommitManifestByCommitID(commitID string) (*model.CommitFile, error) { + commit, err := dal.Commit.Where(dal.Commit.CommitID.Eq(commitID)).First() + if err != nil { + return nil, err + } + + return dal.CommitFile.Where(dal.CommitFile.CommitID.Eq(commitID), dal.CommitFile.Digest.Eq(commit.ManifestDigest)).First() } -func (f *FileMapperImpl) FindBlobByCommitIDAndPath(commitID, path string) (*model.FileBlob, error) { - return dal.FileBlob.Where(dal.FileBlob.CommitID.Eq(commitID), dal.FileBlob.FileName.Eq(path)).First() +func (f *FileMapperImpl) FindCommitFileByCommitIDAndPath(commitID, path string) (*model.CommitFile, error) { + return dal.CommitFile.Where(dal.CommitFile.CommitID.Eq(commitID), dal.CommitFile.FileName.Eq(path)).First() } diff --git a/pkg/bufman/mapper/tag_mapper.go b/pkg/bufman/mapper/tag_mapper.go index 5e0b273ec..08218e03e 100644 --- a/pkg/bufman/mapper/tag_mapper.go +++ b/pkg/bufman/mapper/tag_mapper.go @@ -22,6 +22,7 @@ import ( type TagMapper interface { Create(tag *model.Tag) error + CreateInBatch(tags ...*model.Tag) error GetCountsByRepositoryID(repositoryID string) (int64, error) FindPageByRepositoryID(repositoryID string, offset, limit int, reverse bool) (model.Tags, error) FindPageByRepositoryIDAndQuery(repositoryID, query string, offset, limit int, reverse bool) (model.Tags, error) @@ -33,6 +34,10 @@ func (t *TagMapperImpl) Create(tag *model.Tag) error { return dal.Tag.Create(tag) } +func (t *TagMapperImpl) CreateInBatch(tags ...*model.Tag) error { + return dal.Tag.Create(tags...) +} + func (t *TagMapperImpl) GetCountsByRepositoryID(repositoryID string) (int64, error) { return dal.Tag.Where(dal.Tag.RepositoryID.Eq(repositoryID)).Count() } diff --git a/pkg/bufman/model/commit.go b/pkg/bufman/model/commit.go index 90d2d15ec..06d53f1dd 100644 --- a/pkg/bufman/model/commit.go +++ b/pkg/bufman/model/commit.go @@ -45,12 +45,12 @@ type Commit struct { SequenceID int64 - // 文件清单 - FileManifest *FileManifest `gorm:"foreignKey:CommitID;references:CommitID"` - // 文件blobs - FileBlobs FileBlobs `gorm:"foreignKey:CommitID;references:CommitID"` + // 清单文件 + CommitManifest *CommitFile `gorm:"-"` + // 其他所有文件 + CommitFiles CommitFiles `gorm:"-"` // 关联的tag - Tags Tags `gorm:"foreignKey:RepositoryID;references:RepositoryID"` + Tags Tags `gorm:"-"` } func (commit *Commit) TableName() string { diff --git a/pkg/bufman/model/file.go b/pkg/bufman/model/file.go index cd084026b..500df6ee1 100644 --- a/pkg/bufman/model/file.go +++ b/pkg/bufman/model/file.go @@ -25,30 +25,13 @@ import ( registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" ) -// FileManifest 保存文件清单,记录每一次提交的所有文件 -type FileManifest struct { - ID int64 `gorm:"primaryKey;autoIncrement"` - Digest string // 文件清单哈希 - CommitID string `gorm:"type:varchar(64), unique"` - Content string `gorm:"-"` // 文件清单内容 - UserID string `gorm:"-"` - UserName string `gorm:"-"` - RepositoryID string `gorm:"-"` - RepositoryName string `gorm:"-"` - CommitName string `gorm:"-"` - DraftName string `gorm:"-"` - CreatedTime time.Time `gorm:"-"` -} - -type FileManifests []*FileManifest - -// FileBlob 保存文件blob -type FileBlob struct { +// CommitFile 保存一个commit中的文件名和摘要 +type CommitFile struct { ID int64 `gorm:"primaryKey;autoIncrement"` Digest string // 文件哈希 CommitID string `gorm:"type:varchar(64);index"` FileName string - Content string `gorm:"-"` + Content []byte `gorm:"-"` UserID string `gorm:"-"` UserName string `gorm:"-"` RepositoryID string `gorm:"-"` @@ -57,18 +40,25 @@ type FileBlob struct { CreatedTime time.Time `gorm:"-"` } -type FileBlobs []*FileBlob +// FileBlob 以哈希作为区分,记录文件内容 +type FileBlob struct { + ID int64 `gorm:"primaryKey;autoIncrement"` + Digest string // 文件哈希 + Content []byte `gorm:"type:blob"` +} + +type CommitFiles []*CommitFile -func (fileBlobs *FileBlobs) ToProtoFileInfo() *registryv1alpha1.FileInfo { +func (commitFiles *CommitFiles) ToProtoFileInfo() *registryv1alpha1.FileInfo { root := ®istryv1alpha1.FileInfo{ Path: ".", IsDir: true, } - for i := 0; i < len(*fileBlobs); i++ { - fileBlob := (*fileBlobs)[i] - if fileBlobs == nil { - fileBlob = &FileBlob{} + for i := 0; i < len(*commitFiles); i++ { + fileBlob := (*commitFiles)[i] + if commitFiles == nil { + fileBlob = &CommitFile{} } doToProtoFileInfo(root, fileBlob.FileName) } diff --git a/pkg/bufman/model/init.go b/pkg/bufman/model/init.go deleted file mode 100644 index 3b7699e72..000000000 --- a/pkg/bufman/model/init.go +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package model - -import ( - "github.com/apache/dubbo-kubernetes/pkg/bufman/config" - "gorm.io/driver/mysql" - "gorm.io/gorm" -) - -func InitDB() { - dsn := config.Properties.MySQL.MysqlDsn - var DB *gorm.DB - var err error - if dsn == "" { - panic("MySQL DSN is empty") - } else { - DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{TranslateError: true}) - } - - if err != nil { - panic(err) - } else { - config.DataBase = DB - // init table - initErr := DB.AutoMigrate( - &Repository{}, - &Commit{}, - &Tag{}, - &User{}, - &Token{}, - &FileManifest{}, - &FileBlob{}, - ) - if initErr != nil { - panic(initErr) - } - } - - db, err := config.DataBase.DB() - if err != nil { - panic(err) - } - - db.SetMaxOpenConns(config.Properties.MySQL.MaxOpenConnections) - db.SetMaxIdleConns(config.Properties.MySQL.MaxIdleConnections) - db.SetConnMaxLifetime(config.Properties.MySQL.MaxLifeTime) - db.SetConnMaxIdleTime(config.Properties.MySQL.MaxIdleTime) -} diff --git a/pkg/bufman/model/repository.go b/pkg/bufman/model/repository.go index 5c54cd585..38378da50 100644 --- a/pkg/bufman/model/repository.go +++ b/pkg/bufman/model/repository.go @@ -40,9 +40,9 @@ type Repository struct { Description string // 描述信息 // 拥有的draft - DraftCommits []*Commit `gorm:"foreignKey:RepositoryID;references:RepositoryID"` + DraftCommits []*Commit `gorm:"-"` // 拥有的tag - Tags []*Tag `gorm:"foreignKey:RepositoryID;references:RepositoryID"` + Tags []*Tag `gorm:"-"` } func (repository *Repository) TableName() string { diff --git a/pkg/bufman/services/docs_service.go b/pkg/bufman/services/docs_service.go index bebe56209..40d06025b 100644 --- a/pkg/bufman/services/docs_service.go +++ b/pkg/bufman/services/docs_service.go @@ -36,7 +36,7 @@ import ( ) type DocsService interface { - GetSourceDirectoryInfo(ctx context.Context, repositoryID, reference string) (model.FileBlobs, e.ResponseError) + GetSourceDirectoryInfo(ctx context.Context, repositoryID, reference string) (model.CommitFiles, e.ResponseError) GetSourceFile(ctx context.Context, repositoryID, reference, path string) ([]byte, e.ResponseError) GetModulePackages(ctx context.Context, repositoryID, reference string) ([]*registryv1alpha1.ModulePackage, e.ResponseError) GetModuleDocumentation(ctx context.Context, repositoryID, reference string) (*registryv1alpha1.ModuleDocumentation, e.ResponseError) @@ -61,7 +61,7 @@ func NewDocsService() DocsService { } } -func (docsService *DocsServiceImpl) GetSourceDirectoryInfo(ctx context.Context, repositoryID, reference string) (model.FileBlobs, e.ResponseError) { +func (docsService *DocsServiceImpl) GetSourceDirectoryInfo(ctx context.Context, repositoryID, reference string) (model.CommitFiles, e.ResponseError) { // 根据reference查询commit commit, err := docsService.commitMapper.FindByRepositoryIDAndReference(repositoryID, reference) if err != nil { @@ -73,7 +73,7 @@ func (docsService *DocsServiceImpl) GetSourceDirectoryInfo(ctx context.Context, } // 查询所有文件 - fileBlobs, err := docsService.fileMapper.FindAllBlobsByCommitID(commit.CommitID) + fileBlobs, err := docsService.fileMapper.FindCommitFilesExceptManifestByCommitID(commit.CommitID) if err != nil { return nil, e.NewInternalError(err) } @@ -93,7 +93,7 @@ func (docsService *DocsServiceImpl) GetSourceFile(ctx context.Context, repositor } // 查询file - fileBlob, err := docsService.fileMapper.FindBlobByCommitIDAndPath(commit.CommitID, path) + fileBlob, err := docsService.fileMapper.FindCommitFileByCommitIDAndPath(commit.CommitID, path) if err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, e.NewNotFoundError(err) @@ -331,7 +331,7 @@ func (docsService *DocsServiceImpl) getManifestAndBlobSet(ctx context.Context, r func (docsService *DocsServiceImpl) getManifestAndBlobSetByCommitID(ctx context.Context, commitID string) (*manifest2.Manifest, *manifest2.BlobSet, e.ResponseError) { // 查询文件清单 - modelFileManifest, err := docsService.fileMapper.FindManifestByCommitID(commitID) + modelFileManifest, err := docsService.fileMapper.FindCommitManifestByCommitID(commitID) if err != nil { if err != nil { return nil, nil, e.NewInternalError(err) @@ -339,7 +339,7 @@ func (docsService *DocsServiceImpl) getManifestAndBlobSetByCommitID(ctx context. } // 接着查询blobs - fileBlobs, err := docsService.fileMapper.FindAllBlobsByCommitID(commitID) + fileBlobs, err := docsService.fileMapper.FindCommitFilesExceptManifestByCommitID(commitID) if err != nil { return nil, nil, e.NewInternalError(err) } diff --git a/pkg/bufman/services/download_service.go b/pkg/bufman/services/download_service.go index 443f27a47..a9c026937 100644 --- a/pkg/bufman/services/download_service.go +++ b/pkg/bufman/services/download_service.go @@ -57,7 +57,7 @@ func (downloadService *DownloadServiceImpl) DownloadManifestAndBlobs(ctx context } // 查询文件清单 - modelFileManifest, err := downloadService.fileMapper.FindManifestByCommitID(commit.CommitID) + modelFileManifest, err := downloadService.fileMapper.FindCommitManifestByCommitID(commit.CommitID) if err != nil { if err != nil { return nil, nil, e.NewInternalError(err) @@ -65,7 +65,7 @@ func (downloadService *DownloadServiceImpl) DownloadManifestAndBlobs(ctx context } // 接着查询blobs - fileBlobs, err := downloadService.fileMapper.FindAllBlobsByCommitID(commit.CommitID) + fileBlobs, err := downloadService.fileMapper.FindCommitFilesExceptManifestByCommitID(commit.CommitID) if err != nil { return nil, nil, e.NewInternalError(err) } diff --git a/pkg/bufman/services/push_service.go b/pkg/bufman/services/push_service.go index bb542b1da..fdbfade45 100644 --- a/pkg/bufman/services/push_service.go +++ b/pkg/bufman/services/push_service.go @@ -44,6 +44,7 @@ type PushServiceImpl struct { repositoryMapper mapper.RepositoryMapper fileMapper mapper.FileMapper commitMapper mapper.CommitMapper + tagMapper mapper.TagMapper storageHelper storage.StorageHelper } @@ -52,6 +53,7 @@ func NewPushService() PushService { userMapper: &mapper.UserMapperImpl{}, repositoryMapper: &mapper.RepositoryMapperImpl{}, commitMapper: &mapper.CommitMapperImpl{}, + tagMapper: &mapper.TagMapperImpl{}, fileMapper: &mapper.FileMapperImpl{}, storageHelper: storage.NewStorageHelper(), } @@ -69,7 +71,7 @@ func (pushService *PushServiceImpl) GetManifestAndBlobSet(ctx context.Context, r } // 查询文件清单 - modelFileManifest, err := pushService.fileMapper.FindManifestByCommitID(commit.CommitID) + modelFileManifest, err := pushService.fileMapper.FindCommitManifestByCommitID(commit.CommitID) if err != nil { if err != nil { return nil, nil, e.NewInternalError(err) @@ -77,7 +79,7 @@ func (pushService *PushServiceImpl) GetManifestAndBlobSet(ctx context.Context, r } // 接着查询blobs - fileBlobs, err := pushService.fileMapper.FindAllBlobsByCommitID(commit.CommitID) + fileBlobs, err := pushService.fileMapper.FindCommitFilesExceptManifestByCommitID(commit.CommitID) if err != nil { return nil, nil, e.NewInternalError(err) } @@ -144,6 +146,7 @@ func (pushService *PushServiceImpl) PushManifestAndBlobsWithTags(ctx context.Con return nil, err } + // 写入commit createErr := pushService.commitMapper.Create(commit) if createErr != nil { if errors.Is(createErr, mapper.ErrTagAndDraftDuplicated) || errors.Is(createErr, gorm.ErrDuplicatedKey) { @@ -156,6 +159,19 @@ func (pushService *PushServiceImpl) PushManifestAndBlobsWithTags(ctx context.Con return nil, e.NewInternalError(createErr) } + // 写入tag + createErr = pushService.tagMapper.CreateInBatch(tags...) + if createErr != nil { + if errors.Is(createErr, mapper.ErrTagAndDraftDuplicated) || errors.Is(createErr, gorm.ErrDuplicatedKey) { + return nil, e.NewInternalError(createErr) + } + if errors.Is(createErr, mapper.ErrLastCommitDuplicated) { + return nil, e.NewAlreadyExistsError(createErr) + } + + return nil, e.NewInternalError(createErr) + } + return commit, nil } @@ -205,7 +221,7 @@ func (pushService *PushServiceImpl) toCommit(ctx context.Context, userID, ownerN createTime := time.Now() // 生成file blobs - modelBlobs := make([]*model.FileBlob, 0, len(fileManifest.Paths())) + modelBlobs := make([]*model.CommitFile, 0, len(fileManifest.Paths())) err = fileManifest.Range(func(path string, digest manifest2.Digest) error { // 读取文件内容 blob, ok := fileBlobs.BlobFor(digest.String()) @@ -223,11 +239,11 @@ func (pushService *PushServiceImpl) toCommit(ctx context.Context, userID, ownerN return e.NewInternalError(err) } - modelBlobs = append(modelBlobs, &model.FileBlob{ + modelBlobs = append(modelBlobs, &model.CommitFile{ Digest: digest.Hex(), CommitID: commitID, FileName: path, - Content: string(content), + Content: content, UserID: user.UserID, UserName: user.UserName, RepositoryID: repository.RepositoryID, @@ -254,11 +270,11 @@ func (pushService *PushServiceImpl) toCommit(ctx context.Context, userID, ownerN if err != nil { return nil, e.NewInternalError(err) } - modelFileManifest := &model.FileManifest{ + modelFileManifest := &model.CommitFile{ ID: 0, Digest: fileManifestBlob.Digest().Hex(), CommitID: commitID, - Content: string(content), + Content: content, UserID: user.UserID, UserName: user.UserName, RepositoryID: repository.RepositoryID, @@ -288,8 +304,8 @@ func (pushService *PushServiceImpl) toCommit(ctx context.Context, userID, ownerN CreatedTime: createTime, ManifestDigest: fileManifestBlob.Digest().Hex(), SequenceID: 0, - FileManifest: modelFileManifest, - FileBlobs: modelBlobs, + CommitManifest: modelFileManifest, + CommitFiles: modelBlobs, } if configBlob != nil { commit.BufManConfigDigest = configBlob.Digest().Hex() @@ -306,8 +322,8 @@ func (pushService *PushServiceImpl) toCommit(ctx context.Context, userID, ownerN func (pushService *PushServiceImpl) saveFileManifestAndBlobs(ctx context.Context, commit *model.Commit) e.ResponseError { // 保存file blobs - for i := 0; i < len(commit.FileBlobs); i++ { - fileBlob := commit.FileBlobs[i] + for i := 0; i < len(commit.CommitFiles); i++ { + fileBlob := commit.CommitFiles[i] // 如果是README文件 if fileBlob.Digest == commit.DocumentDigest { @@ -326,7 +342,7 @@ func (pushService *PushServiceImpl) saveFileManifestAndBlobs(ctx context.Context } // 保存file manifest - err := pushService.storageHelper.StoreManifest(ctx, commit.FileManifest) + err := pushService.storageHelper.StoreManifest(ctx, commit.CommitManifest) if err != nil { return e.NewInternalError(err) } From 3474c47fb94f16a16264fd58483f0de2d89c2eaf Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Tue, 2 Jan 2024 11:24:58 +0800 Subject: [PATCH 12/18] add license --- pkg/bufman/core/storage/db_storage.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/bufman/core/storage/db_storage.go b/pkg/bufman/core/storage/db_storage.go index 9eba03423..fc8d04af5 100644 --- a/pkg/bufman/core/storage/db_storage.go +++ b/pkg/bufman/core/storage/db_storage.go @@ -1,3 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage import ( From d603abdca83fa568c34621343a7c957a0c4896e4 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Tue, 2 Jan 2024 11:30:45 +0800 Subject: [PATCH 13/18] open bufman optionally --- pkg/bufman/setup.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/bufman/setup.go b/pkg/bufman/setup.go index 79439b9d9..e8eb68bb7 100644 --- a/pkg/bufman/setup.go +++ b/pkg/bufman/setup.go @@ -24,6 +24,11 @@ import ( ) func Setup(rt core_runtime.Runtime) error { + if !rt.Config().Bufman.OpenBufman { + // dont open bufman + return nil + } + if err := InitConfig(rt); err != nil { return errors.Wrap(err, "Bufman init config failed") } From 1fe70f2649ec793fb6cae30bf9dd8137aba82bfc Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Tue, 2 Jan 2024 11:40:10 +0800 Subject: [PATCH 14/18] add search interface --- pkg/bufman/core/search/db_search.go | 49 +++++++++++++++++++++++++++++ pkg/bufman/core/search/search.go | 29 +++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 pkg/bufman/core/search/db_search.go create mode 100644 pkg/bufman/core/search/search.go diff --git a/pkg/bufman/core/search/db_search.go b/pkg/bufman/core/search/db_search.go new file mode 100644 index 000000000..959b5c7ee --- /dev/null +++ b/pkg/bufman/core/search/db_search.go @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package search + +import ( + "context" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type DBSearcherImpl struct { +} + +func (searcher *DBSearcherImpl) SearchUsers(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.User, error) { + //TODO implement me + panic("implement me") +} + +func (searcher *DBSearcherImpl) SearchRepositories(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Repository, error) { + //TODO implement me + panic("implement me") +} + +func (searcher *DBSearcherImpl) SearchCommitsByContent(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Repository, error) { + //TODO implement me + panic("implement me") +} + +func (searcher *DBSearcherImpl) SearchTag(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Tag, error) { + //TODO implement me + panic("implement me") +} + +func (searcher *DBSearcherImpl) SearchDraft(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Commit, error) { + //TODO implement me + panic("implement me") +} diff --git a/pkg/bufman/core/search/search.go b/pkg/bufman/core/search/search.go new file mode 100644 index 000000000..e37397584 --- /dev/null +++ b/pkg/bufman/core/search/search.go @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package search + +import ( + "context" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" +) + +type Searcher interface { + SearchUsers(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.User, error) + SearchRepositories(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Repository, error) + SearchCommitsByContent(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Repository, error) + SearchTag(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Tag, error) + SearchDraft(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Commit, error) +} From 748f771a1a189d08751a4002dc37b3df3730f27a Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Tue, 2 Jan 2024 21:33:06 +0800 Subject: [PATCH 15/18] bufman implement search api using db --- pkg/bufman/controllers/search.go | 334 ++++++++++++++++++++ pkg/bufman/core/lru/lru.go | 135 ++++++++ pkg/bufman/core/search/db_search.go | 97 +++++- pkg/bufman/core/search/search.go | 29 +- pkg/bufman/core/validity/viliditor.go | 22 +- pkg/bufman/handlers/grpc_handlers/search.go | 47 +++ pkg/bufman/handlers/http_handlers/search.go | 122 +++++++ pkg/bufman/model/commit.go | 22 ++ pkg/bufman/model/repository.go | 24 ++ pkg/bufman/model/user.go | 21 ++ pkg/bufman/router/http_router.go | 9 + 11 files changed, 836 insertions(+), 26 deletions(-) create mode 100644 pkg/bufman/controllers/search.go create mode 100644 pkg/bufman/core/lru/lru.go create mode 100644 pkg/bufman/handlers/grpc_handlers/search.go create mode 100644 pkg/bufman/handlers/http_handlers/search.go diff --git a/pkg/bufman/controllers/search.go b/pkg/bufman/controllers/search.go new file mode 100644 index 000000000..9ea284eba --- /dev/null +++ b/pkg/bufman/controllers/search.go @@ -0,0 +1,334 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllers + +import ( + "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/lru" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/constant" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/search" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/security" + "github.com/apache/dubbo-kubernetes/pkg/bufman/core/validity" + "github.com/apache/dubbo-kubernetes/pkg/bufman/e" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/apache/dubbo-kubernetes/pkg/bufman/services" + "github.com/apache/dubbo-kubernetes/pkg/core/logger" +) + +type SearchController struct { + searcher search.Searcher + validator validity.Validator + authorizationService services.AuthorizationService +} + +func NewSearchController() *SearchController { + return &SearchController{ + validator: validity.NewValidator(), + searcher: search.NewSearcher(), + authorizationService: services.NewAuthorizationService(), + } +} + +func (controller *SearchController) SearchUser(ctx context.Context, req *registryv1alpha1.SearchUserRequest) (*registryv1alpha1.SearchUserResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + argErr = controller.validator.CheckQuery(req.GetQuery()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Errorf("Error parse page token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + // 查询结果 + users, searchErr := controller.searcher.SearchUsers(ctx, req.GetQuery(), pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if searchErr != nil { + logger.Errorf("Error search user: %v\n", searchErr.Error()) + + return nil, e.NewInternalError(searchErr) + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(users)) + if err != nil { + logger.Errorf("Error generate next page token: %v\n", err.Error()) + + return nil, e.NewInternalError(err) + } + + resp := ®istryv1alpha1.SearchUserResponse{ + Users: users.ToProtoSearchResults(), + NextPageToken: nextPageToken, + } + + return resp, nil +} + +func (controller *SearchController) SearchRepository(ctx context.Context, req *registryv1alpha1.SearchRepositoryRequest) (*registryv1alpha1.SearchRepositoryResponse, e.ResponseError) { + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + argErr = controller.validator.CheckQuery(req.GetQuery()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Errorf("Error parse page token: %v\n", err.Error()) + + respErr := e.NewInvalidArgumentError(err) + return nil, respErr + } + + // 查询结果 + repositories, searchErr := controller.searcher.SearchRepositories(ctx, req.GetQuery(), pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if searchErr != nil { + logger.Errorf("Error search repo: %v\n", searchErr.Error()) + + return nil, e.NewInternalError(searchErr) + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(repositories)) + if err != nil { + logger.Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.SearchRepositoryResponse{ + Repositories: repositories.ToProtoSearchResults(), + NextPageToken: nextPageToken, + } + + return resp, nil +} + +func (controller *SearchController) SearchLastCommitByContent(ctx context.Context, req *registryv1alpha1.SearchLastCommitByContentRequest) (*registryv1alpha1.SearchLastCommitByContentResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + argErr = controller.validator.CheckQuery(req.GetQuery()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Errorf("Error parse page token: %v\n", err.Error()) + + return nil, e.NewInvalidArgumentError(err) + } + + // 查询结果 + commits, searchErr := controller.searcher.SearchCommitsByContent(ctx, userID, req.GetQuery(), pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if searchErr != nil { + logger.Errorf("Error search commit by content: %v\n", searchErr.Error()) + + return nil, e.NewInternalError(searchErr) + } + + lruQueue := lru.NewLru(len(commits)) + for i := 0; i < len(commits); i++ { + commit := commits[i] + + identity := commit.RepositoryID + if v, ok := lruQueue.Get(identity); !ok || (ok && v.(*model.Commit).CreatedTime.Before(commit.CreatedTime)) { + // 同一个repo下,只记录最晚的匹配commit + _ = lruQueue.Add(identity, commits) + } + } + + // 转为commit + // 在LRU队列上,越靠近后方,在查询结果位置越靠前,所以倒序遍历 + retCommits := make([]*model.Commit, 0, lruQueue.Len()) + _ = lruQueue.RangeValue(true, func(key, value interface{}) error { + commit, ok := value.(*model.Commit) + if !ok { + return nil + } + + retCommits = append(retCommits, commit) + return nil + }) + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(commits)) + if err != nil { + logger.Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + m := model.Commits(retCommits) + resp := ®istryv1alpha1.SearchLastCommitByContentResponse{ + Commits: m.ToProtoSearchResults(), + NextPageToken: nextPageToken, + } + + return resp, nil +} + +func (controller *SearchController) SearchTag(ctx context.Context, req *registryv1alpha1.SearchTagRequest) (*registryv1alpha1.SearchTagResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + argErr = controller.validator.CheckQuery(req.GetQuery()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 查询权限 + repository, checkErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetRepositoryOwner(), req.GetRepositoryName()) + if checkErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, checkErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Errorf("Error parse page token: %v\n", err.Error()) + + return nil, e.NewInvalidArgumentError(err) + } + + // 查询结果 + tags, searchErr := controller.searcher.SearchTag(ctx, repository.RepositoryID, req.GetQuery(), pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if searchErr != nil { + logger.Errorf("Error search tag: %v\n", searchErr.Error()) + + return nil, e.NewInternalError(searchErr) + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(tags)) + if err != nil { + logger.Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.SearchTagResponse{ + RepositoryTags: tags.ToProtoRepositoryTags(), + NextPageToken: nextPageToken, + } + + return resp, nil +} + +func (controller *SearchController) SearchDraft(ctx context.Context, req *registryv1alpha1.SearchDraftRequest) (*registryv1alpha1.SearchDraftResponse, e.ResponseError) { + userID, _ := ctx.Value(constant.UserIDKey).(string) + + // 验证参数 + argErr := controller.validator.CheckPageSize(req.GetPageSize()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + argErr = controller.validator.CheckQuery(req.GetQuery()) + if argErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, argErr + } + + // 查询权限 + repository, checkErr := controller.authorizationService.CheckRepositoryCanAccess(userID, req.GetRepositoryOwner(), req.GetRepositoryName()) + if checkErr != nil { + logger.Errorf("Error check: %v\n", argErr.Error()) + + return nil, checkErr + } + + // 解析page token + pageTokenChaim, err := security.ParsePageToken(req.GetPageToken()) + if err != nil { + logger.Errorf("Error parse page token: %v\n", err.Error()) + + return nil, e.NewInvalidArgumentError(err) + } + + // 查询结果 + commits, searchErr := controller.searcher.SearchDraft(ctx, repository.RepositoryID, req.GetQuery(), pageTokenChaim.PageOffset, int(req.GetPageSize()), req.GetReverse()) + if searchErr != nil { + logger.Errorf("Error search draft: %v\n", searchErr.Error()) + + return nil, e.NewInternalError(searchErr) + } + + // 生成下一页token + nextPageToken, err := security.GenerateNextPageToken(pageTokenChaim.PageOffset, int(req.GetPageSize()), len(commits)) + if err != nil { + logger.Errorf("Error generate next page token: %v\n", err.Error()) + + respErr := e.NewInternalError(err) + return nil, respErr + } + + resp := ®istryv1alpha1.SearchDraftResponse{ + RepositoryCommits: commits.ToProtoRepositoryCommits(), + NextPageToken: nextPageToken, + } + + return resp, nil +} diff --git a/pkg/bufman/core/lru/lru.go b/pkg/bufman/core/lru/lru.go new file mode 100644 index 000000000..6705ba1db --- /dev/null +++ b/pkg/bufman/core/lru/lru.go @@ -0,0 +1,135 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package lru + +import ( + "container/list" + "errors" + "sync" +) + +type Lru struct { + max int + l *list.List + Call func(key interface{}, value interface{}) + cache map[interface{}]*list.Element + mu *sync.Mutex +} + +type Node struct { + Key interface{} + Val interface{} +} + +func NewLru(len int) *Lru { + return &Lru{ + max: len, + l: list.New(), + cache: make(map[interface{}]*list.Element), + mu: new(sync.Mutex), + } +} + +func (l *Lru) Len() int { + return len(l.cache) +} + +func (l *Lru) Add(key interface{}, val interface{}) error { + if l.l == nil { + return errors.New("not init NewLru") + } + + l.mu.Lock() + defer l.mu.Unlock() + if e, ok := l.cache[key]; ok { //以及存在 + e.Value.(*Node).Val = val + l.l.MoveToFront(e) + return nil + } + ele := l.l.PushFront(&Node{ + Key: key, + Val: val, + }) + l.cache[key] = ele + if l.max != 0 && l.l.Len() > l.max { + if e := l.l.Back(); e != nil { + l.l.Remove(e) + node := e.Value.(*Node) + delete(l.cache, node.Key) + if l.Call != nil { + l.Call(node.Key, node.Val) + } + } + } + return nil +} + +func (l *Lru) RangeValue(reverse bool, f func(key, value interface{}) error) error { + if reverse { + for e := l.l.Back(); e != nil; e = e.Prev() { + node := e.Value.(*Node) + err := f(node.Key, node.Val) + if err != nil { + return err + } + } + + return nil + } + + for e := l.l.Front(); e != nil; e = e.Next() { + node := e.Value.(*Node) + err := f(node.Key, node.Val) + if err != nil { + return err + } + } + + return nil +} + +func (l *Lru) Get(key interface{}) (val interface{}, ok bool) { + if l.cache == nil { + return + } + l.mu.Lock() + defer l.mu.Unlock() + if ele, ok := l.cache[key]; ok { + l.l.MoveToFront(ele) + return ele.Value.(*Node).Val, true + } + return +} + +func (l *Lru) Del(key interface{}) { + if l.cache == nil { + return + } + l.mu.Lock() + defer l.mu.Unlock() + if ele, ok := l.cache[key]; ok { + delete(l.cache, ele) + if e := l.l.Back(); e != nil { + l.l.Remove(e) + delete(l.cache, key) + if l.Call != nil { + node := e.Value.(*Node) + l.Call(node.Key, node.Val) + } + } + } + +} diff --git a/pkg/bufman/core/search/db_search.go b/pkg/bufman/core/search/db_search.go index 959b5c7ee..8b87fae8b 100644 --- a/pkg/bufman/core/search/db_search.go +++ b/pkg/bufman/core/search/db_search.go @@ -17,33 +17,100 @@ package search import ( "context" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/dal" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" "github.com/apache/dubbo-kubernetes/pkg/bufman/model" ) type DBSearcherImpl struct { } -func (searcher *DBSearcherImpl) SearchUsers(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.User, error) { - //TODO implement me - panic("implement me") +func NewDBSearcher() *DBSearcherImpl { + return &DBSearcherImpl{} +} + +func (searcher *DBSearcherImpl) SearchUsers(ctx context.Context, query string, offset, limit int, reverse bool) (model.Users, error) { + order := dal.User.ID.Asc() + if reverse { + order = dal.User.ID.Desc() + } + return dal.User.Where(dal.User.UserName.Like("%" + query + "%")).Or(dal.User.Description.Like("%" + query + "query")).Offset(offset).Limit(limit).Order(order).Find() } -func (searcher *DBSearcherImpl) SearchRepositories(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Repository, error) { - //TODO implement me - panic("implement me") +func (searcher *DBSearcherImpl) SearchRepositories(ctx context.Context, query string, offset, limit int, reverse bool) (model.Repositories, error) { + order := dal.Repository.ID.Asc() + if reverse { + order = dal.Repository.ID.Desc() + } + return dal.Repository.Where(dal.Repository.RepositoryName.Like("%" + query + "%")).Or(dal.Repository.Description.Like("%" + query + "query")). + Offset(offset).Limit(limit).Order(order).Find() } -func (searcher *DBSearcherImpl) SearchCommitsByContent(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Repository, error) { - //TODO implement me - panic("implement me") +func (searcher *DBSearcherImpl) SearchCommitsByContent(ctx context.Context, userID, query string, offset, limit int, reverse bool) (model.Commits, error) { + // search file content + blobs, err := dal.FileBlob.Where(dal.FileBlob.Content.Like("%" + query + "%")).Find() + if err != nil { + return nil, err + } + digestSet := make(map[string]struct{}) + for _, blob := range blobs { + digestSet[blob.Digest] = struct{}{} + } + digests := make([]string, len(digestSet)) + for digest := range digestSet { + digests = append(digests, digest) + } + + // search commit file by digest + commitFiles, err := dal.CommitFile.Where(dal.CommitFile.Digest.In(digests...)).Find() + if err != nil { + return nil, err + } + commitIDSet := make(map[string]struct{}) + for _, commitFile := range commitFiles { + commitIDSet[commitFile.CommitID] = struct{}{} + } + commitIDs := make([]string, len(commitIDSet)) + for commitID := range commitIDSet { + commitIDs = append(commitIDs, commitID) + } + + // search repository by userID + repositories, err := dal.Repository.Where(dal.Repository.Visibility.Eq(uint8(registryv1alpha1.Visibility_VISIBILITY_PUBLIC))).Or(dal.Repository.UserID.Eq(userID)).Find() + if err != nil { + return nil, err + } + repositoryIDSet := make(map[string]struct{}) + for _, repository := range repositories { + repositoryIDSet[repository.RepositoryID] = struct{}{} + } + repositoryIDs := make([]string, 0, len(repositoryIDSet)) + for repositoryID := range repositoryIDSet { + repositoryIDs = append(repositoryIDs, repositoryID) + } + + // search commit by commitID + order := dal.Commit.ID.Asc() + if reverse { + order = dal.Commit.ID.Desc() + } + + return dal.Commit.Where(dal.Commit.RepositoryID.In(repositoryIDs...), dal.Commit.CommitID.In(commitIDs...), dal.Commit.DraftName.Eq("")).Offset(offset).Limit(limit).Order(order).Find() } -func (searcher *DBSearcherImpl) SearchTag(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Tag, error) { - //TODO implement me - panic("implement me") +func (searcher *DBSearcherImpl) SearchTag(ctx context.Context, repositoryID string, query string, offset, limit int, reverse bool) (model.Tags, error) { + order := dal.Tag.ID.Asc() + if reverse { + order = dal.Tag.ID.Desc() + } + return dal.Tag.Where(dal.Repository.RepositoryID.Eq(repositoryID), dal.Tag.TagName.Like("%"+query+"%")).Offset(offset).Limit(limit).Order(order).Find() } -func (searcher *DBSearcherImpl) SearchDraft(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Commit, error) { - //TODO implement me - panic("implement me") +func (searcher *DBSearcherImpl) SearchDraft(ctx context.Context, repositoryID string, query string, offset, limit int, reverse bool) (model.Commits, error) { + order := dal.Commit.ID.Asc() + if reverse { + order = dal.Commit.ID.Desc() + } + return dal.Commit.Where(dal.Repository.RepositoryID.Eq(repositoryID), dal.Commit.DraftName.Like("%"+query+"%")).Offset(offset).Limit(limit).Order(order).Find() } diff --git a/pkg/bufman/core/search/search.go b/pkg/bufman/core/search/search.go index e37397584..15475925e 100644 --- a/pkg/bufman/core/search/search.go +++ b/pkg/bufman/core/search/search.go @@ -17,13 +17,32 @@ package search import ( "context" + "sync" + "github.com/apache/dubbo-kubernetes/pkg/bufman/model" ) type Searcher interface { - SearchUsers(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.User, error) - SearchRepositories(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Repository, error) - SearchCommitsByContent(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Repository, error) - SearchTag(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Tag, error) - SearchDraft(ctx context.Context, query string, offset, limit int, reverse bool) ([]*model.Commit, error) + SearchUsers(ctx context.Context, query string, offset, limit int, reverse bool) (model.Users, error) + SearchRepositories(ctx context.Context, query string, offset, limit int, reverse bool) (model.Repositories, error) + SearchCommitsByContent(ctx context.Context, userID string, query string, offset, limit int, reverse bool) (model.Commits, error) + SearchTag(ctx context.Context, repositoryID string, query string, offset, limit int, reverse bool) (model.Tags, error) + SearchDraft(ctx context.Context, repositoryID string, query string, offset, limit int, reverse bool) (model.Commits, error) +} + +// 单例模式 +var ( + searcher Searcher + once sync.Once +) + +func NewSearcher() Searcher { + if searcher == nil { + // 对象初始化 + once.Do(func() { + searcher = NewDBSearcher() + }) + } + + return searcher } diff --git a/pkg/bufman/core/validity/viliditor.go b/pkg/bufman/core/validity/viliditor.go index 505942027..f8ffe8d49 100644 --- a/pkg/bufman/core/validity/viliditor.go +++ b/pkg/bufman/core/validity/viliditor.go @@ -33,12 +33,13 @@ import ( ) type Validator interface { - CheckUserName(username string) e.ResponseError // 检查用户名合法性 - CheckPassword(password string) e.ResponseError // 检查密码合法性 - CheckRepositoryName(repositoryName string) e.ResponseError // 检查repo name合法性 - CheckTagName(tagName string) e.ResponseError // 检查tag name合法性 - CheckDraftName(draftName string) e.ResponseError // 检查draft name合法性 - CheckPageSize(pageSize uint32) e.ResponseError // 检查page size合法性 + CheckUserName(username string) e.ResponseError // 检查用户名合法性 + CheckPassword(password string) e.ResponseError // 检查密码合法性 + CheckRepositoryName(repositoryName string) e.ResponseError // 检查repo name合法性 + CheckTagName(tagName string) e.ResponseError // 检查tag name合法性 + CheckDraftName(draftName string) e.ResponseError // 检查draft name合法性 + CheckPageSize(pageSize uint32) e.ResponseError // 检查page size合法性 + CheckQuery(query string) e.ResponseError SplitFullName(fullName string) (userName, repositoryName string, respErr e.ResponseError) // 分割full name // CheckManifestAndBlobs 检查上传的文件是否合法 @@ -108,6 +109,15 @@ func (validator *ValidatorImpl) CheckPageSize(pageSize uint32) e.ResponseError { return nil } +func (validator *ValidatorImpl) CheckQuery(query string) e.ResponseError { + err := validator.doCheckByLengthAndPattern(query, constant.MinQueryLength, constant.MaxQueryLength, constant.QueryPattern) + if err != nil { + return e.NewInvalidArgumentError(err) + } + + return nil +} + func (validator *ValidatorImpl) SplitFullName(fullName string) (userName, repositoryName string, respErr e.ResponseError) { split := strings.SplitN(fullName, "/", 2) if len(split) != 2 { diff --git a/pkg/bufman/handlers/grpc_handlers/search.go b/pkg/bufman/handlers/grpc_handlers/search.go new file mode 100644 index 000000000..16c14fcc9 --- /dev/null +++ b/pkg/bufman/handlers/grpc_handlers/search.go @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grpc_handlers + +import ( + "context" + + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type SearchServiceHandler struct { + registryv1alpha1.UnimplementedSearchServiceServer +} + +func (SearchServiceHandler) SearchUser(ctx context.Context, req *registryv1alpha1.SearchUserRequest) (*registryv1alpha1.SearchUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchUser not implemented") +} +func (SearchServiceHandler) SearchRepository(ctx context.Context, req *registryv1alpha1.SearchRepositoryRequest) (*registryv1alpha1.SearchRepositoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchRepository not implemented") +} +func (SearchServiceHandler) SearchLastCommitByContent(ctx context.Context, req *registryv1alpha1.SearchLastCommitByContentRequest) (*registryv1alpha1.SearchLastCommitByContentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchLastCommitByContent not implemented") +} +func (SearchServiceHandler) SearchCurationPlugin(ctx context.Context, req *registryv1alpha1.SearchCuratedPluginRequest) (*registryv1alpha1.SearchCuratedPluginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchCurationPlugin not implemented") +} +func (SearchServiceHandler) SearchTag(ctx context.Context, req *registryv1alpha1.SearchTagRequest) (*registryv1alpha1.SearchTagResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchTag not implemented") +} +func (SearchServiceHandler) SearchDraft(ctx context.Context, req *registryv1alpha1.SearchDraftRequest) (*registryv1alpha1.SearchDraftResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchDraft not implemented") +} diff --git a/pkg/bufman/handlers/http_handlers/search.go b/pkg/bufman/handlers/http_handlers/search.go new file mode 100644 index 000000000..af1c0165b --- /dev/null +++ b/pkg/bufman/handlers/http_handlers/search.go @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_handlers + +import ( + "net/http" + + "github.com/apache/dubbo-kubernetes/pkg/bufman/controllers" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" + "github.com/gin-gonic/gin" +) + +type searchGroup struct { + searchController *controllers.SearchController +} + +var SearchGroup = &searchGroup{ + searchController: controllers.NewSearchController(), +} + +func (group *searchGroup) SearchUser(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.SearchUserRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.searchController.SearchUser(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *searchGroup) SearchRepository(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.SearchRepositoryRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.searchController.SearchRepository(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *searchGroup) SearchLastCommitByContent(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.SearchLastCommitByContentRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.searchController.SearchLastCommitByContent(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *searchGroup) SearchTag(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.SearchTagRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.searchController.SearchTag(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} + +func (group *searchGroup) SearchDraft(c *gin.Context) { + // 绑定参数 + req := ®istryv1alpha1.SearchDraftRequest{} + bindErr := c.ShouldBindJSON(req) + if bindErr != nil { + c.JSON(http.StatusBadRequest, NewHTTPResponse(bindErr)) + return + } + + resp, err := group.searchController.SearchDraft(c, req) + if err != nil { + c.JSON(http.StatusInternalServerError, NewHTTPResponse(err)) + } + + // 正常返回 + c.JSON(http.StatusOK, NewHTTPResponse(resp)) +} diff --git a/pkg/bufman/model/commit.go b/pkg/bufman/model/commit.go index 06d53f1dd..c99082f75 100644 --- a/pkg/bufman/model/commit.go +++ b/pkg/bufman/model/commit.go @@ -123,6 +123,19 @@ func (commit *Commit) ToProtoRepositoryCommit() *registryv1alpha1.RepositoryComm return repositoryCommit } +func (commit *Commit) ToProtoSearchResult() *registryv1alpha1.CommitSearchResult { + if commit == nil { + return (&Commit{}).ToProtoSearchResult() + } + + return ®istryv1alpha1.CommitSearchResult{ + Id: commit.CommitID, + Name: commit.CommitName, + Owner: commit.UserName, + RepositoryName: commit.RepositoryName, + } +} + type Commits []*Commit func (commits *Commits) ToProtoRepositoryCommits() []*registryv1alpha1.RepositoryCommit { @@ -142,3 +155,12 @@ func (commits *Commits) ToProtoModulePins() []*modulev1alpha1.ModulePin { return modulePins } + +func (commits *Commits) ToProtoSearchResults() []*registryv1alpha1.CommitSearchResult { + commitSearchResults := make([]*registryv1alpha1.CommitSearchResult, len(*commits)) + for i := 0; i < len(*commits); i++ { + commitSearchResults[i] = (*commits)[i].ToProtoSearchResult() + } + + return commitSearchResults +} diff --git a/pkg/bufman/model/repository.go b/pkg/bufman/model/repository.go index 38378da50..85f2cfb49 100644 --- a/pkg/bufman/model/repository.go +++ b/pkg/bufman/model/repository.go @@ -69,6 +69,20 @@ func (repository *Repository) ToProtoRepository() *registryv1alpha1.Repository { } } +func (repository *Repository) ToProtoSearchResult() *registryv1alpha1.RepositorySearchResult { + if repository == nil { + return (&Repository{}).ToProtoSearchResult() + } + + return ®istryv1alpha1.RepositorySearchResult{ + Id: repository.RepositoryID, + Name: repository.RepositoryName, + Owner: repository.UserName, + Visibility: registryv1alpha1.Visibility(repository.Visibility), + Deprecated: repository.Deprecated, + } +} + type Repositories []*Repository func (repositoryEntities *Repositories) ToProtoRepositories() []*registryv1alpha1.Repository { @@ -96,3 +110,13 @@ func (repositoryCounts *RepositoryCounts) ToProtoRepositoryCounts() *registryv1a DraftsCount: uint32(repositoryCounts.DraftsCount), } } + +func (repositoryEntities *Repositories) ToProtoSearchResults() []*registryv1alpha1.RepositorySearchResult { + repositorySearchResults := make([]*registryv1alpha1.RepositorySearchResult, 0, len(*repositoryEntities)) + + for i := 0; i < len(*repositoryEntities); i++ { + repositorySearchResults = append(repositorySearchResults, (*repositoryEntities)[i].ToProtoSearchResult()) + } + + return repositorySearchResults +} diff --git a/pkg/bufman/model/user.go b/pkg/bufman/model/user.go index 2db73d362..e85c7ac94 100644 --- a/pkg/bufman/model/user.go +++ b/pkg/bufman/model/user.go @@ -58,6 +58,18 @@ func (user *User) ToProtoUser() *registryv1alpha1.User { } } +func (user *User) ToProtoSearchResult() *registryv1alpha1.UserSearchResult { + if user == nil { + return (&User{}).ToProtoSearchResult() + } + + return ®istryv1alpha1.UserSearchResult{ + Id: user.UserID, + Username: user.UserName, + Deactivated: user.Deactivated, + } +} + type Users []*User func (users *Users) ToProtoUsers() []*registryv1alpha1.User { @@ -68,3 +80,12 @@ func (users *Users) ToProtoUsers() []*registryv1alpha1.User { return protoUsers } + +func (users *Users) ToProtoSearchResults() []*registryv1alpha1.UserSearchResult { + protoResults := make([]*registryv1alpha1.UserSearchResult, 0, len(*users)) + for i := 0; i < len(*users); i++ { + protoResults = append(protoResults, (*users)[i].ToProtoSearchResult()) + } + + return protoResults +} diff --git a/pkg/bufman/router/http_router.go b/pkg/bufman/router/http_router.go index 6def43a5c..ab4af9690 100644 --- a/pkg/bufman/router/http_router.go +++ b/pkg/bufman/router/http_router.go @@ -130,6 +130,15 @@ func InitHTTPRouter() *HTTPRouter { doc.GET("/package/:repository_owner/:repository_name/:reference", http_handlers.DocGroup.GetModulePackages) // 获取repo packages doc.GET("/package/:repository_owner/:repository_name/:reference/:package_name", http_handlers.DocGroup.GetPackageDocumentation) // 获取包说明文档 } + + search := router.Group("/search") + { + search.POST("/user", http_handlers.SearchGroup.SearchUser) // 搜索用户 + search.POST("/repository", http_handlers.SearchGroup.SearchRepository) // 搜索仓库 + search.POST("/commit", http_handlers.SearchGroup.SearchLastCommitByContent) // 搜索根据内容搜索最近一次提交 + search.POST("/tag", http_handlers.SearchGroup.SearchTag) // 搜索tag + search.POST("/draft", http_handlers.SearchGroup.SearchDraft) // 搜索草稿 + } } return &HTTPRouter{ From 954354218927ad756dd5d9ab506e17aa08e52eb3 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Thu, 4 Jan 2024 12:10:17 +0800 Subject: [PATCH 16/18] fix --- .licenserc.yaml | 1 + go.mod | 37 +- go.sum | 43 +- .../bufcheck/bufbreaking/bufbreaking_test.go | 842 ------- .../testdata/breaking_enum_no_delete/1.proto | 33 - .../testdata/breaking_enum_no_delete/2.proto | 43 - .../testdata/breaking_enum_no_delete/buf.yaml | 19 - .../breaking_enum_value_no_delete/1.proto | 57 - .../breaking_enum_value_no_delete/2.proto | 67 - .../breaking_enum_value_no_delete/buf.yaml | 19 - .../1.proto | 60 - .../2.proto | 67 - .../buf.yaml | 19 - .../1.proto | 60 - .../2.proto | 67 - .../buf.yaml | 19 - .../breaking_enum_value_same_name/1.proto | 71 - .../breaking_enum_value_same_name/2.proto | 67 - .../breaking_enum_value_same_name/buf.yaml | 19 - .../1.proto | 62 - .../2.proto | 94 - .../buf.yaml | 19 - .../testdata/breaking_field_no_delete/1.proto | 48 - .../testdata/breaking_field_no_delete/2.proto | 75 - .../breaking_field_no_delete/buf.yaml | 19 - .../1.proto | 50 - .../2.proto | 76 - .../buf.yaml | 19 - .../1.proto | 57 - .../2.proto | 76 - .../buf.yaml | 19 - .../breaking_field_same_ctype/1.proto | 46 - .../breaking_field_same_ctype/2.proto | 66 - .../breaking_field_same_ctype/buf.yaml | 19 - .../breaking_field_same_json_name/1.proto | 79 - .../breaking_field_same_json_name/2.proto | 111 - .../breaking_field_same_json_name/buf.yaml | 19 - .../breaking_field_same_jstype/1.proto | 46 - .../breaking_field_same_jstype/2.proto | 66 - .../breaking_field_same_jstype/buf.yaml | 19 - .../breaking_field_same_label/1.proto | 66 - .../breaking_field_same_label/2.proto | 87 - .../breaking_field_same_label/buf.yaml | 19 - .../testdata/breaking_field_same_name/1.proto | 52 - .../testdata/breaking_field_same_name/2.proto | 78 - .../breaking_field_same_name/buf.yaml | 19 - .../breaking_field_same_oneof/1.proto | 76 - .../breaking_field_same_oneof/2.proto | 116 - .../breaking_field_same_oneof/buf.yaml | 19 - .../testdata/breaking_field_same_type/1.proto | 66 - .../testdata/breaking_field_same_type/2.proto | 87 - .../breaking_field_same_type/buf.yaml | 19 - .../2.proto | 101 - .../buf.yaml | 19 - .../2.proto | 104 - .../buf.yaml | 19 - .../breaking_file_no_delete/a/b/a_b.proto | 18 - .../testdata/breaking_file_no_delete/buf.yaml | 19 - .../sub/a/b/sub_a_b.proto | 18 - .../a/b/a_b.proto | 18 - .../breaking_file_no_delete_ignores/buf.yaml | 22 - .../sub/a/b/sub_a_b.proto | 18 - .../a/v1beta1/a.proto | 18 - .../breaking_file_no_delete_unstable/buf.yaml | 18 - .../breaking_file_same_package/a/a.proto | 18 - .../breaking_file_same_package/a/b/a_b.proto | 18 - .../breaking_file_same_package/buf.yaml | 19 - .../no_package.proto | 18 - .../sub/a/b/sub_a_b.proto | 18 - .../breaking_file_same_syntax/buf.yaml | 22 - .../breaking_file_same_syntax/root/a/a.proto | 18 - .../root/a/b/a_b.proto | 18 - .../root/no_package.proto | 16 - .../root/sub/a/b/sub_a_b.proto | 19 - .../breaking_file_same_values/1.proto | 38 - .../breaking_file_same_values/2.proto | 38 - .../breaking_file_same_values/buf.yaml | 19 - .../a/v1beta1/a.proto | 26 - .../buf.yaml | 20 - .../1.proto | 31 - .../2.proto | 41 - .../a/v1/1.proto | 33 - .../a/v1/2.proto | 43 - .../a/v1beta1/1.proto | 33 - .../a/v1beta1/2.proto | 43 - .../b/1.proto | 33 - .../b/2.proto | 43 - .../buf.yaml | 19 - .../1.proto | 31 - .../2.proto | 41 - .../a/v1/1.proto | 33 - .../a/v1/2.proto | 43 - .../a/v1beta1/1.proto | 33 - .../a/v1beta1/2.proto | 43 - .../b/1.proto | 33 - .../b/2.proto | 43 - .../buf.yaml | 20 - .../testdata/breaking_int_enum/1.proto | 19 - .../testdata/breaking_int_enum/2.proto | 23 - .../testdata/breaking_message_enum/1.proto | 22 - .../testdata/breaking_message_enum/2.proto | 19 - .../testdata/breaking_message_int/1.proto | 19 - .../testdata/breaking_message_int/2.proto | 19 - .../testdata/breaking_message_message/1.proto | 22 - .../testdata/breaking_message_message/2.proto | 19 - .../breaking_message_no_delete/1.proto | 27 - .../breaking_message_no_delete/2.proto | 31 - .../breaking_message_no_delete/buf.yaml | 19 - .../1.proto | 51 - .../2.proto | 22 - .../buf.yaml | 19 - .../breaking_message_same_values/1.proto | 43 - .../breaking_message_same_values/2.proto | 32 - .../breaking_message_same_values/buf.yaml | 20 - .../testdata/breaking_oneof_no_delete/1.proto | 58 - .../testdata/breaking_oneof_no_delete/2.proto | 94 - .../breaking_oneof_no_delete/buf.yaml | 19 - .../breaking_package_no_delete/a1.proto | 22 - .../breaking_package_no_delete/a2.proto | 37 - .../breaking_package_no_delete/b1.proto | 22 - .../breaking_package_no_delete/b2.proto | 44 - .../breaking_package_no_delete/buf.yaml | 19 - .../1.proto | 25 - .../2.proto | 29 - .../buf.yaml | 19 - .../breaking_reserved_enum_no_delete/1.proto | 66 - .../breaking_reserved_enum_no_delete/2.proto | 108 - .../breaking_reserved_enum_no_delete/buf.yaml | 19 - .../1.proto | 69 - .../2.proto | 111 - .../buf.yaml | 19 - .../testdata/breaking_rpc_no_delete/1.proto | 25 - .../testdata/breaking_rpc_no_delete/2.proto | 49 - .../testdata/breaking_rpc_no_delete/buf.yaml | 19 - .../testdata/breaking_rpc_same_values/1.proto | 28 - .../testdata/breaking_rpc_same_values/2.proto | 76 - .../breaking_rpc_same_values/buf.yaml | 19 - .../breaking_service_no_delete/1.proto | 20 - .../breaking_service_no_delete/2.proto | 22 - .../breaking_service_no_delete/buf.yaml | 19 - .../breaking_enum_no_delete/1.proto | 43 - .../breaking_enum_no_delete/2.proto | 43 - .../breaking_enum_value_no_delete/1.proto | 75 - .../breaking_enum_value_no_delete/2.proto | 55 - .../1.proto | 75 - .../2.proto | 55 - .../1.proto | 75 - .../2.proto | 55 - .../breaking_enum_value_same_name/1.proto | 82 - .../breaking_enum_value_same_name/2.proto | 55 - .../1.proto | 78 - .../2.proto | 78 - .../breaking_field_no_delete/1.proto | 64 - .../breaking_field_no_delete/2.proto | 64 - .../1.proto | 64 - .../2.proto | 64 - .../1.proto | 73 - .../2.proto | 64 - .../breaking_field_same_ctype/1.proto | 56 - .../breaking_field_same_ctype/2.proto | 56 - .../breaking_field_same_json_name/1.proto | 99 - .../breaking_field_same_json_name/2.proto | 91 - .../breaking_field_same_jstype/1.proto | 56 - .../breaking_field_same_jstype/2.proto | 56 - .../breaking_field_same_label/1.proto | 85 - .../breaking_field_same_label/2.proto | 70 - .../breaking_field_same_name/1.proto | 64 - .../breaking_field_same_name/2.proto | 64 - .../breaking_field_same_oneof/1.proto | 96 - .../breaking_field_same_oneof/2.proto | 96 - .../breaking_field_same_type/1.proto | 85 - .../breaking_field_same_type/2.proto | 70 - .../1.proto | 100 - .../1.proto | 103 - .../breaking_file_no_delete/buf.yaml | 34 - .../breaking_file_no_delete/root/a/a.proto | 18 - .../root/a/b/a_b.proto | 18 - .../root/no_package.proto | 16 - .../root/sub/a/b/sub_a_b.proto | 18 - .../breaking_file_no_delete_ignores/buf.yaml | 34 - .../root/a/a.proto | 18 - .../root/a/b/a_b.proto | 18 - .../root/a/c/c.proto | 18 - .../root/no_package.proto | 16 - .../root/sub/a/b/sub_a_b.proto | 18 - .../a/v1beta1/a.proto | 18 - .../a/v1beta1/b.proto | 18 - .../breaking_file_same_package/buf.yaml | 34 - .../breaking_file_same_package/root/a/a.proto | 18 - .../root/a/b/a_b.proto | 18 - .../root/no_package.proto | 16 - .../root/sub/a/b/sub_a_b.proto | 18 - .../breaking_file_same_syntax/buf.yaml | 34 - .../breaking_file_same_syntax/root/a/a.proto | 18 - .../root/a/b/a_b.proto | 18 - .../root/no_package.proto | 16 - .../root/sub/a/b/sub_a_b.proto | 18 - .../breaking_file_same_values/1.proto | 38 - .../breaking_file_same_values/2.proto | 18 - .../a/v1beta1/a.proto | 26 - .../a/v1beta1/b.proto | 26 - .../1.proto | 41 - .../2.proto | 41 - .../a/v1/1.proto | 43 - .../a/v1/2.proto | 43 - .../a/v1beta1/1.proto | 43 - .../a/v1beta1/2.proto | 43 - .../b/1.proto | 43 - .../b/2.proto | 43 - .../1.proto | 41 - .../2.proto | 41 - .../a/v1/1.proto | 43 - .../a/v1/2.proto | 43 - .../a/v1beta1/1.proto | 43 - .../a/v1beta1/2.proto | 43 - .../b/1.proto | 43 - .../b/2.proto | 43 - .../breaking_int_enum/1.proto | 22 - .../breaking_int_enum/2.proto | 19 - .../breaking_message_enum/1.proto | 19 - .../breaking_message_enum/2.proto | 22 - .../breaking_message_int/1.proto | 19 - .../breaking_message_int/2.proto | 19 - .../breaking_message_message/1.proto | 19 - .../breaking_message_message/2.proto | 22 - .../breaking_message_no_delete/1.proto | 31 - .../breaking_message_no_delete/2.proto | 31 - .../1.proto | 38 - .../2.proto | 26 - .../breaking_message_same_values/1.proto | 53 - .../breaking_message_same_values/2.proto | 23 - .../breaking_oneof_no_delete/1.proto | 80 - .../breaking_oneof_no_delete/2.proto | 80 - .../breaking_package_no_delete/a1.proto | 57 - .../breaking_package_no_delete/b1.proto | 57 - .../breaking_package_no_delete/buf.yaml | 34 - .../breaking_package_no_delete/c.proto | 18 - .../1.proto | 29 - .../2.proto | 29 - .../buf.yaml | 34 - .../breaking_reserved_enum_no_delete/1.proto | 89 - .../breaking_reserved_enum_no_delete/2.proto | 89 - .../1.proto | 92 - .../2.proto | 92 - .../breaking_rpc_no_delete/1.proto | 38 - .../breaking_rpc_no_delete/2.proto | 38 - .../breaking_rpc_same_values/1.proto | 51 - .../breaking_rpc_same_values/2.proto | 51 - .../breaking_service_no_delete/1.proto | 22 - .../breaking_service_no_delete/2.proto | 22 - .../bufpkg/bufcheck/buflint/buflint_test.go | 1015 -------- .../buflint/testdata/comment_ignores/a.proto | 91 - .../buflint/testdata/comment_ignores/b.proto | 25 - .../buflint/testdata/comment_ignores/buf.yaml | 34 - .../testdata/comment_ignores_cascade/a.proto | 88 - .../testdata/comment_ignores_cascade/b.proto | 25 - .../testdata/comment_ignores_cascade/buf.yaml | 30 - .../buflint/testdata/comments/a.proto | 297 --- .../buflint/testdata/comments/buf.yaml | 19 - .../testdata/directory_same_package/a.proto | 18 - .../testdata/directory_same_package/buf.yaml | 19 - .../directory_same_package/no_package.proto | 16 - .../directory_same_package/one/c.proto | 18 - .../directory_same_package/one/d.proto | 18 - .../testdata/enum_first_value_zero/a.proto | 93 - .../testdata/enum_first_value_zero/buf.yaml | 19 - .../testdata/enum_no_allow_alias/a.proto | 102 - .../testdata/enum_no_allow_alias/buf.yaml | 19 - .../buflint/testdata/enum_pascal_case/a.proto | 93 - .../testdata/enum_pascal_case/buf.yaml | 19 - .../testdata/enum_value_prefix/a.proto | 53 - .../testdata/enum_value_prefix/buf.yaml | 19 - .../enum_value_upper_snake_case/a.proto | 54 - .../enum_value_upper_snake_case/buf.yaml | 19 - .../testdata/enum_zero_value_suffix/a.proto | 86 - .../testdata/enum_zero_value_suffix/buf.yaml | 19 - .../enum_zero_value_suffix_custom/a.proto | 86 - .../enum_zero_value_suffix_custom/buf.yaml | 20 - .../testdata/field_lower_snake_case/a.proto | 56 - .../testdata/field_lower_snake_case/buf.yaml | 19 - .../testdata/field_no_descriptor/a.proto | 60 - .../testdata/field_no_descriptor/buf.yaml | 19 - .../testdata/file_lower_snake_case/1.proto | 18 - .../testdata/file_lower_snake_case/B.proto | 18 - .../testdata/file_lower_snake_case/Foo.proto | 18 - .../testdata/file_lower_snake_case/a.proto | 18 - .../testdata/file_lower_snake_case/aBc.proto | 18 - .../testdata/file_lower_snake_case/aBc.txt | 3 - .../testdata/file_lower_snake_case/ab.proto | 18 - .../testdata/file_lower_snake_case/ab_c.proto | 18 - .../file_lower_snake_case/ab_c_.proto | 18 - .../testdata/file_lower_snake_case/buf.yaml | 19 - .../file_lower_snake_case/fooBar.proto | 18 - .../buflint/testdata/ignores1/buf.yaml | 22 - .../testdata/ignores1/buf/bar/bar.proto | 30 - .../testdata/ignores1/buf/bar/bar2.proto | 30 - .../buflint/testdata/ignores1/buf/buf.proto | 30 - .../testdata/ignores1/buf/foo/bar/bar.proto | 30 - .../testdata/ignores1/buf/foo/baz/baz.proto | 30 - .../testdata/ignores1/buf/foo/buf.proto | 30 - .../buflint/testdata/ignores2/buf.yaml | 25 - .../testdata/ignores2/buf/bar/bar.proto | 30 - .../testdata/ignores2/buf/bar/bar2.proto | 30 - .../buflint/testdata/ignores2/buf/buf.proto | 30 - .../testdata/ignores2/buf/foo/bar/bar.proto | 30 - .../testdata/ignores2/buf/foo/baz/baz.proto | 30 - .../testdata/ignores2/buf/foo/buf.proto | 30 - .../buflint/testdata/ignores3/buf.yaml | 31 - .../testdata/ignores3/buf/bar/bar.proto | 30 - .../testdata/ignores3/buf/bar/bar2.proto | 30 - .../buflint/testdata/ignores3/buf/buf.proto | 30 - .../testdata/ignores3/buf/foo/bar/bar.proto | 30 - .../testdata/ignores3/buf/foo/baz/baz.proto | 30 - .../testdata/ignores3/buf/foo/buf.proto | 30 - .../buflint/testdata/ignores4/buf.yaml | 31 - .../testdata/ignores4/buf/bar/bar.proto | 30 - .../testdata/ignores4/buf/bar/bar2.proto | 30 - .../buflint/testdata/ignores4/buf/buf.proto | 30 - .../testdata/ignores4/buf/foo/bar/bar.proto | 30 - .../testdata/ignores4/buf/foo/baz/baz.proto | 30 - .../testdata/ignores4/buf/foo/buf.proto | 30 - .../buflint/testdata/import_no_public/a.proto | 22 - .../testdata/import_no_public/buf.yaml | 19 - .../testdata/import_no_public/one/one.proto | 21 - .../testdata/import_no_public/sub/sub1.proto | 18 - .../testdata/import_no_public/sub/sub2.proto | 18 - .../buflint/testdata/import_no_weak/a.proto | 22 - .../buflint/testdata/import_no_weak/buf.yaml | 19 - .../testdata/import_no_weak/one/one.proto | 21 - .../testdata/import_no_weak/sub/sub1.proto | 18 - .../testdata/import_no_weak/sub/sub2.proto | 18 - .../buflint/testdata/import_used/a.proto | 26 - .../buflint/testdata/import_used/buf.yaml | 19 - .../testdata/import_used/one/one.proto | 25 - .../testdata/import_used/sub/sub1.proto | 20 - .../testdata/import_used/sub/sub2.proto | 20 - .../testdata/message_pascal_case/a.proto | 37 - .../testdata/message_pascal_case/buf.yaml | 19 - .../testdata/oneof_lower_snake_case/a.proto | 102 - .../testdata/oneof_lower_snake_case/buf.yaml | 19 - .../package_defined/a/no_package.proto | 16 - .../buflint/testdata/package_defined/buf.yaml | 19 - .../testdata/package_defined/no_package.proto | 16 - .../package_directory_match/a/b/a_b.proto | 18 - .../package_directory_match/a/b/a_c.proto | 18 - .../testdata/package_directory_match/buf.yaml | 19 - .../package_directory_match/no_package.proto | 16 - .../package_directory_match/sub/a/b/a_b.proto | 18 - .../testdata/package_lower_snake_case/1.proto | 18 - .../testdata/package_lower_snake_case/2.proto | 18 - .../testdata/package_lower_snake_case/3.proto | 18 - .../testdata/package_lower_snake_case/4.proto | 18 - .../testdata/package_lower_snake_case/5.proto | 18 - .../testdata/package_lower_snake_case/6.proto | 18 - .../testdata/package_lower_snake_case/7.proto | 18 - .../testdata/package_lower_snake_case/8.proto | 18 - .../package_lower_snake_case/buf.yaml | 19 - .../package_lower_snake_case/no_package.proto | 16 - .../testdata/package_no_import_cycle/a1.proto | 20 - .../testdata/package_no_import_cycle/a2.proto | 18 - .../testdata/package_no_import_cycle/b1.proto | 20 - .../testdata/package_no_import_cycle/b2.proto | 18 - .../testdata/package_no_import_cycle/buf.yaml | 19 - .../testdata/package_no_import_cycle/c1.proto | 20 - .../testdata/package_no_import_cycle/c2.proto | 18 - .../testdata/package_no_import_cycle/d1.proto | 20 - .../testdata/package_no_import_cycle/d2.proto | 18 - .../package_no_import_cycle/none1.proto | 18 - .../package_no_import_cycle/none2.proto | 16 - .../testdata/package_same_directory/a.proto | 18 - .../testdata/package_same_directory/buf.yaml | 19 - .../package_same_directory/one/a.proto | 18 - .../buf.yaml | 19 - .../no_package.proto | 16 - .../one/no_package.proto | 16 - .../package_same_option_value/a.proto | 26 - .../package_same_option_value/b.proto | 26 - .../package_same_option_value/buf.yaml | 25 - .../package_same_option_value/sub/a.proto | 27 - .../package_same_option_value/sub/b.proto | 18 - .../testdata/package_version_suffix/buf.yaml | 19 - .../testdata/package_version_suffix/foo.proto | 18 - .../package_version_suffix/foo_bar.proto | 18 - .../foo_bar_v0beta1.proto | 18 - .../package_version_suffix/foo_bar_v1.proto | 18 - .../foo_bar_v1beta1.proto | 18 - .../foo_bar_v1test.proto | 18 - .../foo_bar_v1test_foo.proto | 18 - .../foo_bar_v1testfoo.proto | 18 - .../package_version_suffix/foo_bar_v2.proto | 18 - .../foo_bar_v2beta0.proto | 18 - .../foo_bar_vv1beta1.proto | 18 - .../package_version_suffix/no_package.proto | 16 - .../testdata/package_version_suffix/v1.proto | 18 - .../buflint/testdata/rpc_no_streaming/a.proto | 27 - .../testdata/rpc_no_streaming/buf.yaml | 20 - .../buflint/testdata/rpc_pascal_case/a.proto | 30 - .../buflint/testdata/rpc_pascal_case/buf.yaml | 19 - .../rpc_request_response_unique/a.proto | 46 - .../rpc_request_response_unique/b.proto | 24 - .../rpc_request_response_unique/buf.yaml | 19 - .../a.proto | 46 - .../b.proto | 24 - .../buf.yaml | 20 - .../a.proto | 46 - .../b.proto | 24 - .../buf.yaml | 21 - .../a.proto | 46 - .../b.proto | 24 - .../buf.yaml | 20 - .../a.proto | 46 - .../b.proto | 24 - .../buf.yaml | 20 - .../a.proto | 46 - .../b.proto | 24 - .../buf.yaml | 22 - .../testdata/rpc_standard_name/a.proto | 39 - .../testdata/rpc_standard_name/buf.yaml | 20 - .../rpc_standard_name_allow_empty/a.proto | 39 - .../rpc_standard_name_allow_empty/buf.yaml | 22 - .../testdata/service_pascal_case/a.proto | 26 - .../testdata/service_pascal_case/buf.yaml | 19 - .../buflint/testdata/service_suffix/a.proto | 25 - .../buflint/testdata/service_suffix/buf.yaml | 19 - .../testdata/service_suffix_custom/a.proto | 26 - .../testdata/service_suffix_custom/buf.yaml | 20 - .../testdata/syntax_specified/a/a.proto | 18 - .../testdata/syntax_specified/a/a2.proto | 20 - .../testdata/syntax_specified/a/a3.proto | 20 - .../testdata/syntax_specified/buf.yaml | 19 - pkg/bufman/bufpkg/bufgraph/bufgraph_test.go | 123 - .../bufgraph/testdata/basic/buf.work.yaml | 24 - .../testdata/basic/test-a/a/v1/a.proto | 28 - .../testdata/basic/test-a/a2/v1/a2.proto | 24 - .../bufgraph/testdata/basic/test-a/buf.yaml | 21 - .../testdata/basic/test-b/b/v1/b.proto | 24 - .../bufgraph/testdata/basic/test-b/buf.yaml | 19 - .../bufgraph/testdata/basic/test-c/buf.yaml | 19 - .../testdata/basic/test-c/c/v1/c.proto | 24 - .../bufgraph/testdata/basic/test-d/buf.yaml | 17 - .../testdata/basic/test-d/d/v1/d.proto | 20 - .../bufgraph/testdata/basic/test-e/buf.yaml | 19 - .../testdata/basic/test-e/e/v1/e.proto | 24 - .../bufgraph/testdata/basic/test-f/buf.yaml | 17 - .../testdata/basic/test-f/f/v1/f.proto | 20 - .../bufgraph/testdata/basic/test-g/buf.yaml | 17 - .../testdata/basic/test-g/g/v1/g.proto | 20 - .../bufimage/bufimagebuild/builder_test.go | 428 ---- .../bufimagebuild/builder_unix_test.go | 57 - .../testdata/customoptions1/a.proto | 26 - .../testdata/customoptionserror1/a.proto | 28 - .../testdata/customoptionserror1/b.proto | 25 - .../testdata/cyclicimport/a/a.proto | 20 - .../testdata/cyclicimport/b/b.proto | 20 - .../duplicatesyntheticoneofs/a1.proto | 22 - .../duplicatesyntheticoneofs/a2.proto | 22 - .../testdata/notamessagetype/a.proto | 25 - .../testdata/optionpanic/options/option.proto | 34 - .../testdata/optionpanic/proto/test.proto | 27 - .../testdata/proto3optional1/a.proto | 20 - .../bufimagebuild/testdata/semicolons/a.proto | 56 - .../testdata/spacebetweennumberandid/a.proto | 22 - .../testdata/trailingcomments/a.proto | 24 - .../bufimagemodify/bufimagemodify_test.go | 113 - .../bufimagemodify/cc_enable_arenas_test.go | 386 --- .../bufimagemodify/csharp_namespace_test.go | 628 ----- .../bufimagemodify/go_package_test.go | 688 ------ .../java_multiple_files_test.go | 429 ---- .../java_outer_classname_test.go | 410 ---- .../bufimagemodify/java_package_test.go | 633 ----- .../java_string_check_utf8_test.go | 347 --- .../bufimagemodify/objc_class_prefix_test.go | 719 ------ .../bufimagemodify/optimize_for_test.go | 665 ------ .../php_metadata_namespace_test.go | 359 --- .../bufimagemodify/php_namespace_test.go | 360 --- .../bufimagemodify/ruby_package_test.go | 588 ----- .../testdata/alloptions/a.proto | 34 - .../bufimagemodify/testdata/ccoptions/a.proto | 17 - .../bufimagemodify/testdata/ccoptions/b.proto | 18 - .../csharpoptions/double/csharp.proto | 18 - .../csharpoptions/single/csharp.proto | 18 - .../csharpoptions/single/override.proto | 19 - .../csharpoptions/triple/csharp.proto | 18 - .../csharpoptions/underscore/csharp.proto | 18 - .../testdata/emptyoptions/a.proto | 15 - .../testdata/javaemptyoptions/a.proto | 16 - .../testdata/javaoptions/java_file.proto | 21 - .../testdata/javaoptions/override.proto | 21 - .../bufimagemodify/testdata/jsoptions/a.proto | 16 - .../testdata/objcoptions/double/objc.proto | 18 - .../testdata/objcoptions/gpb/objc.proto | 18 - .../testdata/objcoptions/single/objc.proto | 18 - .../objcoptions/single/override.proto | 18 - .../testdata/objcoptions/triple/objc.proto | 18 - .../objcoptions/unversioned/objc.proto | 18 - .../testdata/packageversion/a.proto | 18 - .../testdata/packageversion/b.proto | 18 - .../testdata/phpoptions/double/php.proto | 19 - .../testdata/phpoptions/reserved/php.proto | 19 - .../testdata/phpoptions/single/override.proto | 19 - .../testdata/phpoptions/single/php.proto | 19 - .../testdata/phpoptions/triple/php.proto | 19 - .../testdata/phpoptions/underscore/php.proto | 18 - .../testdata/rubyoptions/double/ruby.proto | 18 - .../rubyoptions/single/override.proto | 18 - .../testdata/rubyoptions/single/ruby.proto | 18 - .../testdata/rubyoptions/triple/ruby.proto | 18 - .../rubyoptions/underscore/ruby.proto | 18 - .../bufimagemodify/testdata/wktimport/a.proto | 24 - .../bufimagetesting/bufimagetesting.go | 118 - .../bufimagetesting/bufimagetesting_test.go | 709 ------ .../bufimageutil/bufimageutil_test.go | 502 ---- .../bufimageutil/source_paths_remap_test.go | 211 -- .../bufimageutil/testdata/any/a.proto | 38 - .../bufimageutil/testdata/any/b.proto | 23 - .../bufimageutil/testdata/any/c1.proto | 28 - .../bufimageutil/testdata/any/c1.txtar | 69 - .../bufimageutil/testdata/any/c2.proto | 30 - .../bufimageutil/testdata/any/c2.txtar | 74 - .../bufimageutil/testdata/any/c3.proto | 33 - .../bufimageutil/testdata/any/c3.txtar | 79 - .../bufimageutil/testdata/any/c4.proto | 45 - .../bufimageutil/testdata/any/c4.txtar | 92 - .../bufimageutil/testdata/any/d.proto | 25 - .../bufimageutil/testdata/any/d.txtar | 69 - .../bufimageutil/testdata/any/e.proto | 25 - .../bufimageutil/testdata/any/e.txtar | 59 - .../bufimageutil/testdata/extensions/a.proto | 27 - .../bufimageutil/testdata/extensions/b.proto | 34 - .../extensions/extensions-excluded.txtar | 8 - .../testdata/extensions/extensions.txtar | 27 - .../bufimageutil/testdata/importmods/a.proto | 36 - .../testdata/importmods/noimports.txtar | 5 - .../testdata/importmods/public.proto | 17 - .../testdata/importmods/regular.proto | 17 - .../testdata/importmods/regular_public.txtar | 18 - .../testdata/importmods/regular_weak.txtar | 18 - .../testdata/importmods/weak.proto | 17 - .../testdata/importmods/weak_public.txtar | 18 - .../bufimageutil/testdata/nesting/a.proto | 50 - .../bufimageutil/testdata/nesting/enum.txtar | 7 - .../testdata/nesting/message.txtar | 10 - .../testdata/nesting/recursenested.txtar | 10 - .../testdata/nesting/usingother.txtar | 12 - .../bufimageutil/testdata/options/Files.txtar | 314 --- .../bufimageutil/testdata/options/a.proto | 78 - .../options/all-exclude-options.txtar | 25 - .../testdata/options/all-with-Files.txtar | 363 --- .../bufimageutil/testdata/options/all.txtar | 225 -- .../testdata/options/options.proto | 71 - .../testdata/options/pkg.Foo.txtar | 156 -- .../testdata/options/pkg.FooEnum.txtar | 100 - .../testdata/options/pkg.FooService.Do.txtar | 103 - .../testdata/options/pkg.FooService.txtar | 107 - .../bufimageutil/testdata/packages/bar.proto | 29 - .../bufimageutil/testdata/packages/baz1.proto | 39 - .../bufimageutil/testdata/packages/baz2.proto | 31 - .../testdata/packages/foo.bar.baz.txtar | 70 - .../testdata/packages/foo.bar.txtar | 11 - .../bufimageutil/testdata/packages/foo.proto | 20 - .../bufimageutil/testdata/packages/foo.txtar | 5 - .../testdata/packages/nopackage.proto | 33 - .../testdata/packages/options.proto | 30 - .../testdata/packages/other.proto | 18 - .../bufimageutil/testdata/packages/root.txtar | 99 - .../testdata/sourcecodeinfo/Bar.txtar | 798 ------- .../testdata/sourcecodeinfo/Baz.txtar | 137 -- .../testdata/sourcecodeinfo/Do.txtar | 936 -------- .../testdata/sourcecodeinfo/Foo+Ext.txtar | 700 ------ .../testdata/sourcecodeinfo/Foo.txtar | 422 ---- .../testdata/sourcecodeinfo/NestedFoo.txtar | 570 ----- .../testdata/sourcecodeinfo/Quz.txtar | 134 -- .../testdata/sourcecodeinfo/Svc.txtar | 992 -------- .../testdata/sourcecodeinfo/all.txtar | 2103 ----------------- .../testdata/sourcecodeinfo/test.proto | 169 -- pkg/bufman/bufpkg/bufimage/image_test.go | 140 -- pkg/bufman/bufpkg/bufimage/util_test.go | 203 -- pkg/bufman/bufpkg/buflock/buflock_test.go | 306 --- .../buflock/testdata/v1/failure/buf.lock | 3 - .../buflock/testdata/v1/success/buf.lock | 10 - .../buflock/testdata/v1beta1/failure/buf.lock | 2 - .../buflock/testdata/v1beta1/success/buf.lock | 9 - .../module_bucket_builder_test.go | 585 ----- .../module_bucket_builder_unix_test.go | 36 - .../module_include_builder_test.go | 200 -- .../bufmodulebuild/testdata/1/proto/a/1.proto | 15 - .../bufmodulebuild/testdata/1/proto/a/2.proto | 15 - .../bufmodulebuild/testdata/1/proto/a/3.proto | 15 - .../testdata/1/proto/a/c/1.proto | 15 - .../testdata/1/proto/a/c/2.proto | 15 - .../testdata/1/proto/a/c/3.proto | 15 - .../bufmodulebuild/testdata/1/proto/b/1.proto | 15 - .../bufmodulebuild/testdata/1/proto/b/2.proto | 15 - .../bufmodulebuild/testdata/1/proto/b/3.proto | 15 - .../bufmodulebuild/testdata/1/proto/d/1.proto | 15 - .../bufmodulebuild/testdata/1/proto/d/2.proto | 15 - .../bufmodulebuild/testdata/1/proto/d/3.proto | 15 - .../bufmodulebuild/testdata/2/a/1.proto | 15 - .../bufmodulebuild/testdata/2/a/2.proto | 15 - .../bufmodulebuild/testdata/2/a/3.proto | 15 - .../bufmodulebuild/testdata/2/b/1.proto | 15 - .../bufmodulebuild/testdata/2/b/4.proto | 15 - .../bufmodulebuild/testdata/2/b/5.proto | 15 - .../bufmodule/bufmodulebuild/testdata/3/nop | 0 .../bufmodulebuild/testdata/4/buf.md | 1 - .../bufmodulebuild/testdata/4/proto/1.proto | 15 - .../bufmodulebuild/testdata/4/proto/a/2.proto | 15 - .../bufmodulebuild/testdata/5/LICENSE | 1 - .../bufmodulebuild/testdata/5/proto/1.proto | 15 - .../bufmodulebuild/testdata/5/proto/a/2.proto | 15 - .../bufmodulebuild/testdata/6/LICENSE | 1 - .../bufmodulebuild/testdata/6/proto/1.proto | 15 - .../bufmodulebuild/testdata/6/proto/a/2.proto | 15 - .../bufpkg/bufmodule/bufmodulecache/util.go | 2 + .../bufpluginconfig/bufpluginconfig_test.go | 389 --- .../failure/invalid-empty-plugin-version.yaml | 17 - .../failure/invalid-empty-version.yaml | 18 - .../failure/invalid-multiple-registries.yaml | 30 - .../failure/invalid-plugin-version.yaml | 18 - .../success/go-empty-registry/buf.plugin.yaml | 21 - .../testdata/success/go/buf.plugin.yaml | 34 - .../testdata/success/maven/buf.plugin.yaml | 49 - .../testdata/success/npm/buf.plugin.yaml | 28 - .../testdata/success/options/buf.plugin.yaml | 18 - .../testdata/success/swift/buf.plugin.yaml | 39 - .../bufplugin/bufplugindocker/docker_test.go | 292 --- .../registry_auth_config_test.go | 56 - .../testdata/success/Dockerfile | 18 - .../bufstudioagent/plain_post_handler.go | 4 +- pkg/bufman/bufpkg/bufwasm/bufwasm_test.go | 160 -- pkg/bufman/bufpkg/bufwasm/testdata/echo.wasm | Bin 208 -> 0 bytes pkg/bufman/bufpkg/bufwasm/testdata/echo.wat | 43 - pkg/bufman/pkg/git/commit_test.go | 83 - pkg/bufman/pkg/git/git_test.go | 289 --- pkg/bufman/pkg/git/gittest/doc.go | 17 - pkg/bufman/pkg/git/gittest/gittest.go | 161 -- pkg/bufman/pkg/git/hash_test.go | 46 - pkg/bufman/pkg/git/ident_test.go | 37 - pkg/bufman/pkg/git/packed_refs_test.go | 53 - pkg/bufman/pkg/git/repository_test.go | 115 - pkg/bufman/pkg/git/testdata/packed-refs | 10 - pkg/bufman/pkg/git/tree_node_test.go | 77 - pkg/bufman/pkg/git/tree_test.go | 59 - .../github/githubtesting/archive_reader.go | 2 +- .../pkg/observabilityzap/zapexporter.go | 2 +- pkg/bufman/pkg/protoencoding/protoencoding.go | 4 +- pkg/bufman/pkg/protoencoding/resolver.go | 8 +- .../option_extension_descriptor_test.go | 2 +- .../pkg/storage/storagegit/storagegit_test.go | 82 - .../pkg/storage/storagemem/storagemem_test.go | 73 - .../pkg/storage/storageos/storageos_test.go | 69 - .../storage/storagetesting/storagetesting.go | 1521 ------------ .../storagetesting/testdata/base/1.proto | 18 - .../storagetesting/testdata/base/a/b/1.proto | 18 - .../storagetesting/testdata/base/a/b/2.proto | 18 - .../storagetesting/testdata/base/a/b/2.txt | 1 - .../storagetesting/testdata/base/a/bar.yaml | 15 - .../storagetesting/testdata/base/ab/1.proto | 18 - .../storagetesting/testdata/base/ab/2.proto | 18 - .../storagetesting/testdata/base/ab/2.txt | 1 - .../testdata/diff/a/prefix/1.txt | 2 - .../testdata/diff/a/prefix/2.txt | 1 - .../testdata/diff/b/prefix/1.txt | 2 - .../testdata/diff/b/prefix/3.txt | 0 .../storagetesting/testdata/five/root1/foo | 3 - .../testdata/five/root2/foo/bar.proto | 18 - .../testdata/four/root/a/3.proto | 18 - .../testdata/four/root/a/b/1.proto | 18 - .../testdata/four/root/a/b/2.proto | 18 - .../storage/storagetesting/testdata/link/b | 1 - .../storagetesting/testdata/link/bar.yaml | 16 - .../storagetesting/testdata/link/file.proto | 18 - .../storagetesting/testdata/one/root/1.proto | 18 - .../testdata/one/root/a/1.proto | 18 - .../storagetesting/testdata/one/root/a/1.txt | 1 - .../testdata/one/root/a/b/1.proto | 18 - .../testdata/one/root/a/b/2.proto | 18 - .../testdata/one/root/a/b/2.txt | 1 - .../testdata/one/root/a/bar.yaml | 15 - .../testdata/one/root/ab/1.proto | 18 - .../testdata/one/root/ab/2.proto | 18 - .../storagetesting/testdata/one/root/ab/2.txt | 1 - .../testdata/one/root/c/1.proto | 18 - .../storagetesting/testdata/one/root/foo.yaml | 15 - .../storagetesting/testdata/symlink_loop/a/b | 1 - .../storagetesting/testdata/symlink_loop/b/a | 1 - .../testdata/symlink_loop/file.proto | 18 - .../testdata/symlink_success/1.proto | 16 - .../storagetesting/testdata/symlink_success/a | 1 - .../testdata/symlink_success/ab | 1 - .../testdata/symlink_success/file.proto | 18 - .../storagetesting/testdata/three/a/one.proto | 15 - .../storagetesting/testdata/three/a/one.txt | 0 .../storagetesting/testdata/three/b/one.txt | 0 .../storagetesting/testdata/three/b/two.proto | 15 - .../storagetesting/testdata/two/foo.yaml | 15 - .../storagetesting/testdata/two/root1/1.proto | 18 - .../testdata/two/root1/a/1.proto | 18 - .../storagetesting/testdata/two/root1/a/1.txt | 1 - .../testdata/two/root1/a/b/1.proto | 18 - .../testdata/two/root1/a/b/2.proto | 18 - .../testdata/two/root1/a/b/2.txt | 1 - .../testdata/two/root1/a/bar.yaml | 15 - .../testdata/two/root1/ab/1.proto | 18 - .../testdata/two/root1/ab/2.proto | 18 - .../testdata/two/root1/ab/2.txt | 1 - .../testdata/two/root1/c/1.proto | 18 - .../testdata/two/root1/foo.yaml | 15 - .../storagetesting/testdata/two/root2/2.proto | 18 - .../testdata/two/root2/a/2.proto | 18 - .../storagetesting/testdata/two/root2/a/2.txt | 1 - .../testdata/two/root2/a/b/3.proto | 18 - .../testdata/two/root2/a/b/4.proto | 18 - .../testdata/two/root2/a/b/4.txt | 1 - .../testdata/two/root2/a/bat.yaml | 15 - .../testdata/two/root2/ab/3.proto | 18 - .../testdata/two/root2/ab/4.proto | 18 - .../testdata/two/root2/ab/4.txt | 1 - .../testdata/two/root2/baz.yaml | 15 - .../testdata/two/root2/c/3.proto | 18 - .../testdata/two/rootoverlap/1.proto | 18 - .../testdata/two/rootoverlap/a/1.proto | 18 - .../testdata/two/rootoverlap/a/1.txt | 1 - .../testdata/two/rootoverlap/a/b/1.proto | 18 - .../testdata/two/rootoverlap/a/b/2.proto | 18 - .../testdata/two/rootoverlap/a/b/2.txt | 1 - .../testdata/two/rootoverlap/a/bar.yaml | 15 - .../testdata/two/rootoverlap/ab/1.proto | 18 - .../testdata/two/rootoverlap/ab/2.proto | 18 - .../testdata/two/rootoverlap/ab/2.txt | 1 - .../testdata/two/rootoverlap/c/1.proto | 18 - .../testdata/two/rootoverlap/foo.yaml | 15 - pkg/bufman/pkg/stringutil/stringutil_test.go | 377 --- pkg/bufman/pkg/thread/thread_test.go | 63 - pkg/bufman/pkg/tmp/tmp_test.go | 51 - .../transport/http/httpserver/httpserver.go | 2 +- 736 files changed, 66 insertions(+), 44205 deletions(-) delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking_test.go delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/sub/a/b/sub_a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/sub/a/b/sub_a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/a/v1beta1/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/sub/a/b/sub_a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_compatible_type/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_json_compatible_type/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/sub/a/b/sub_a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/c/c.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/sub/a/b/sub_a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/sub/a/b/sub_a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/a1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/b1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/c.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/buflint_test.go delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/c.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/d.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/B.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/Foo.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.txt delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c_.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/fooBar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/buf.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/bar/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/baz/baz.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/buf.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/buf.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/bar/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/baz/baz.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/buf.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/buf.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/bar/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/baz/baz.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/buf.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/buf.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/bar/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/baz/baz.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/buf.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/one/one.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/one/one.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/one/one.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/a/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_c.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/sub/a/b/a_b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/3.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/4.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/5.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/6.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/7.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/8.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/one/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/one/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v0beta1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1beta1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test_foo.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1testfoo.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2beta0.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_vv1beta1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/no_package.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/v1.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/b.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a2.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a3.proto delete mode 100644 pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/bufgraph_test.go delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/buf.work.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a/v1/a.proto delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a2/v1/a2.proto delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/b/v1/b.proto delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/c/v1/c.proto delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/d/v1/d.proto delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/e/v1/e.proto delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/f/v1/f.proto delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/buf.yaml delete mode 100644 pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/g/v1/g.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_unix_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptions1/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/b.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/a/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/b/b.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a1.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a2.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/notamessagetype/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/options/option.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/proto/test.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/proto3optional1/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/semicolons/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/spacebetweennumberandid/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/trailingcomments/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/alloptions/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/b.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/double/csharp.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/csharp.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/override.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/triple/csharp.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/underscore/csharp.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/emptyoptions/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaemptyoptions/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/java_file.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/override.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/jsoptions/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/double/objc.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/gpb/objc.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/objc.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/override.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/triple/objc.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/unversioned/objc.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/b.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/double/php.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/reserved/php.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/override.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/php.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/triple/php.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/underscore/php.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/double/ruby.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/override.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/ruby.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/triple/ruby.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/underscore/ruby.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/wktimport/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/b.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/b.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions-excluded.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/noimports.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/public.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_public.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_weak.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak_public.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/enum.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/message.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/recursenested.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/usingother.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/Files.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/a.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-exclude-options.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-with-Files.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/options.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.Foo.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooEnum.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.Do.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/bar.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz1.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz2.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.baz.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/nopackage.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/options.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/other.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/root.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Bar.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Baz.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Do.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo+Ext.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/NestedFoo.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Quz.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Svc.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/all.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/test.proto delete mode 100644 pkg/bufman/bufpkg/bufimage/image_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/util_test.go delete mode 100644 pkg/bufman/bufpkg/buflock/buflock_test.go delete mode 100644 pkg/bufman/bufpkg/buflock/testdata/v1/failure/buf.lock delete mode 100644 pkg/bufman/bufpkg/buflock/testdata/v1/success/buf.lock delete mode 100644 pkg/bufman/bufpkg/buflock/testdata/v1beta1/failure/buf.lock delete mode 100644 pkg/bufman/bufpkg/buflock/testdata/v1beta1/success/buf.lock delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_test.go delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_unix_test.go delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder_test.go delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/2.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/3.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/2.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/3.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/2.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/3.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/2.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/3.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/2.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/3.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/4.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/5.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/3/nop delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/buf.md delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/a/2.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/LICENSE delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/a/2.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/LICENSE delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/1.proto delete mode 100644 pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/a/2.proto delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-plugin-version.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-version.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-multiple-registries.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-plugin-version.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go-empty-registry/buf.plugin.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go/buf.plugin.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/maven/buf.plugin.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/npm/buf.plugin.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/options/buf.plugin.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/swift/buf.plugin.yaml delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker_test.go delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config_test.go delete mode 100644 pkg/bufman/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile delete mode 100644 pkg/bufman/bufpkg/bufwasm/bufwasm_test.go delete mode 100644 pkg/bufman/bufpkg/bufwasm/testdata/echo.wasm delete mode 100644 pkg/bufman/bufpkg/bufwasm/testdata/echo.wat delete mode 100644 pkg/bufman/pkg/git/commit_test.go delete mode 100644 pkg/bufman/pkg/git/git_test.go delete mode 100644 pkg/bufman/pkg/git/gittest/doc.go delete mode 100644 pkg/bufman/pkg/git/gittest/gittest.go delete mode 100644 pkg/bufman/pkg/git/hash_test.go delete mode 100644 pkg/bufman/pkg/git/ident_test.go delete mode 100644 pkg/bufman/pkg/git/packed_refs_test.go delete mode 100644 pkg/bufman/pkg/git/repository_test.go delete mode 100644 pkg/bufman/pkg/git/testdata/packed-refs delete mode 100644 pkg/bufman/pkg/git/tree_node_test.go delete mode 100644 pkg/bufman/pkg/git/tree_test.go delete mode 100644 pkg/bufman/pkg/storage/storagegit/storagegit_test.go delete mode 100644 pkg/bufman/pkg/storage/storagemem/storagemem_test.go delete mode 100644 pkg/bufman/pkg/storage/storageos/storageos_test.go delete mode 100644 pkg/bufman/pkg/storage/storagetesting/storagetesting.go delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/a/bar.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/1.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/1.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/3.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/five/root1/foo delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/five/root2/foo/bar.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/3.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/link/b delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/link/bar.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/link/file.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/bar.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/c/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/one/root/foo.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/a/b delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/b/a delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/file.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/a delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/ab delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/file.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/three/b/one.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/three/b/two.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/foo.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/bar.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/c/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/foo.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/3.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/bat.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/3.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/baz.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/c/3.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/bar.yaml delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.txt delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/c/1.proto delete mode 100644 pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/foo.yaml delete mode 100644 pkg/bufman/pkg/stringutil/stringutil_test.go delete mode 100644 pkg/bufman/pkg/thread/thread_test.go delete mode 100644 pkg/bufman/pkg/tmp/tmp_test.go diff --git a/.licenserc.yaml b/.licenserc.yaml index 97b3c6b4f..4d7dd0a9d 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -83,6 +83,7 @@ header: - '**/docs/**' - '**/.nvmrc' - '**/**.txtar' + - '**/**gen.go' comment: on-failure license-location-threshold: 130 diff --git a/go.mod b/go.mod index d74483ea5..8f2b46f44 100644 --- a/go.mod +++ b/go.mod @@ -22,6 +22,8 @@ require ( github.com/AlecAivazis/survey/v2 v2.3.7 github.com/Microsoft/go-winio v0.6.1 github.com/apache/dubbo-go-hessian2 v1.12.2 + github.com/bufbuild/connect-go v1.10.0 + github.com/bufbuild/protocompile v0.5.1 github.com/buildpacks/pack v0.30.0 github.com/cenkalti/backoff v2.2.1+incompatible github.com/containers/image/v5 v5.27.0 @@ -38,8 +40,11 @@ require ( github.com/evanphx/json-patch/v5 v5.6.0 github.com/ghodss/yaml v1.0.0 github.com/gin-gonic/gin v1.9.1 + github.com/go-chi/chi/v5 v5.0.11 github.com/go-git/go-billy/v5 v5.4.1 github.com/go-git/go-git/v5 v5.8.1 + github.com/gofrs/flock v0.8.1 + github.com/gofrs/uuid/v5 v5.0.0 github.com/gogo/protobuf v1.3.2 github.com/golang-jwt/jwt/v4 v4.5.0 github.com/golang/mock v1.6.0 @@ -51,30 +56,46 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/hashicorp/go-multierror v1.1.1 github.com/heroku/color v0.0.6 + github.com/jdxcode/netrc v1.0.0 + github.com/klauspost/compress v1.16.6 github.com/kylelemons/godebug v1.1.0 github.com/mattbaird/jsonpatch v0.0.0-20230413205102-771768614e91 github.com/moby/term v0.5.0 github.com/onsi/gomega v1.27.10 github.com/ory/viper v1.7.5 github.com/pkg/errors v0.9.1 + github.com/pkg/profile v1.5.0 github.com/prometheus/client_golang v1.15.1 github.com/prometheus/common v0.44.0 + github.com/rs/cors v1.10.1 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 + github.com/tetratelabs/wazero v1.2.1 github.com/tidwall/gjson v1.14.4 github.com/vcraescu/go-paginator v1.0.0 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.15.0 go.uber.org/atomic v1.10.0 + go.uber.org/multierr v1.8.0 go.uber.org/zap v1.24.0 golang.org/x/crypto v0.14.0 + golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 + golang.org/x/mod v0.12.0 golang.org/x/net v0.17.0 + golang.org/x/sync v0.5.0 golang.org/x/term v0.13.0 + golang.org/x/tools v0.9.3 google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/mysql v1.5.1 gorm.io/driver/sqlite v1.5.2 + gorm.io/gen v0.3.24 gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55 + gorm.io/plugin/dbresolver v1.3.0 helm.sh/helm/v3 v3.12.3 k8s.io/api v0.27.3 k8s.io/apiextensions-apiserver v0.27.3 @@ -136,12 +157,11 @@ require ( github.com/aws/aws-sdk-go-v2/service/sts v1.19.2 // indirect github.com/aws/smithy-go v1.13.5 // indirect github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001-adf1bafd791a // indirect + github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.2.0 // indirect github.com/bmatcuk/doublestar/v4 v4.6.0 // indirect github.com/braydonk/yaml v0.7.0 // indirect - github.com/bufbuild/connect-go v1.10.0 // indirect - github.com/bufbuild/protocompile v0.5.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/buildpacks/imgutil v0.0.0-20230626185301-726f02e4225c // indirect github.com/buildpacks/lifecycle v0.17.0 // indirect @@ -199,7 +219,6 @@ require ( github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.2 // indirect - github.com/gofrs/uuid/v5 v5.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.0.1 // indirect @@ -231,7 +250,6 @@ require ( github.com/k0kubun/pp v3.0.1+incompatible // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/klauspost/compress v1.16.6 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/knadh/koanf v1.5.0 // indirect @@ -325,23 +343,15 @@ require ( go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect go.etcd.io/etcd/client/v3 v3.5.7 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.10.0 // indirect - go.opentelemetry.io/otel v1.15.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 // indirect go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect - go.opentelemetry.io/otel/sdk v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect - go.uber.org/multierr v1.8.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect - golang.org/x/mod v0.12.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect - golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.9.3 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect @@ -350,11 +360,8 @@ require ( gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c // indirect - gorm.io/gen v0.3.24 // indirect gorm.io/hints v1.1.0 // indirect - gorm.io/plugin/dbresolver v1.3.0 // indirect k8s.io/apiserver v0.27.3 // indirect k8s.io/cli-runtime v0.27.3 // indirect k8s.io/component-base v0.27.3 // indirect diff --git a/go.sum b/go.sum index 0c3c13331..79b819d07 100644 --- a/go.sum +++ b/go.sum @@ -574,8 +574,9 @@ github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001-adf1bafd791a h1:rW+dV12c0WD3+O4Zs8Qt4+oqnr8ecXeyg8g3yB73ZKA= github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001-adf1bafd791a/go.mod h1:1mvdZLjy932pV2fhj1jjwUSHaF5Ogq2gk5bvi/6ngEU= github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= +github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -594,8 +595,6 @@ github.com/bufbuild/connect-go v1.10.0 h1:QAJ3G9A1OYQW2Jbk3DeoJbkCxuKArrvZgDt47m github.com/bufbuild/connect-go v1.10.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8= github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg= github.com/bufbuild/protocompile v0.5.1/go.mod h1:G5iLmavmF4NsYtpZFvE3B/zFch2GIY8+wjsYLR/lc40= -github.com/bufbuild/protocompile v0.7.1 h1:Kd8fb6EshOHXNNRtYAmLAwy/PotlyFoN0iMbuwGNh0M= -github.com/bufbuild/protocompile v0.7.1/go.mod h1:+Etjg4guZoAqzVk2czwEQP12yaxLJ8DxuqCJ9qHdH94= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= @@ -708,8 +707,8 @@ github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denisenkom/go-mssqldb v0.9.0 h1:RSohk2RsiZqLZ0zCjtfn3S4Gp4exhpBWHyQ7D0yGjAk= github.com/denisenkom/go-mssqldb v0.9.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= +github.com/denisenkom/go-mssqldb v0.12.0 h1:VtrkII767ttSPNRfFekePK3sctr+joXgO58stqQbtUA= github.com/dgraph-io/ristretto v0.0.1 h1:cJwdnj42uV8Jg4+KLrYovLiCgIfz9wtWm6E6KA+1tLs= github.com/dgraph-io/ristretto v0.0.1/go.mod h1:T40EBc7CJke8TkpiYfGGKAeFjSaxuFXhuXRyumBd6RE= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= @@ -837,6 +836,8 @@ github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= +github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA= +github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-co-op/gocron v1.9.0 h1:+V+DDenw3ryB7B+tK1bAIC5p0ruw4oX9IqAsdRnGIf0= github.com/go-co-op/gocron v1.9.0/go.mod h1:DbJm9kdgr1sEvWpHCA7dFFs/PGHPMil9/97EXCRPr4k= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= @@ -917,6 +918,8 @@ github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godror/godror v0.24.2/go.mod h1:wZv/9vPiUib6tkoDl+AZ/QLf5YZgMravZ7jxH2eQWAE= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6rR7UHz84= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= @@ -933,8 +936,9 @@ github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzw github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= @@ -1008,7 +1012,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -1190,6 +1193,14 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/tdigest v0.0.1 h1:XpFptwYmnEKUqmkcDjrzffswZ3nvNeevbUSLPP/ZzIY= github.com/influxdata/tdigest v0.0.1/go.mod h1:Z0kXnxzbTC2qrx4NaIzYkE1k66+6oEDQTvL95hQFh5Y= +github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= +github.com/jackc/pgconn v1.13.0 h1:3L1XMNV2Zvca/8BYhzcRFS70Lr0WlDg16Di6SFGAbys= +github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgproto3/v2 v2.3.1 h1:nwj7qwf0S+Q7ISFfBndqeLwSwxs+4DPsbRFjECT1Y4Y= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= +github.com/jackc/pgtype v1.12.0 h1:Dlq8Qvcch7kiehm8wPGIW0W3KsCCHJnRacKW0UM8n5w= +github.com/jackc/pgx/v4 v4.17.2 h1:0Ut0rpeKwvIVbMQ1KbMBU4h6wxehBI535LK6Flheh8E= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= @@ -1198,6 +1209,8 @@ github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/U github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= +github.com/jdxcode/netrc v1.0.0 h1:tJR3fyzTcjDi22t30pCdpOT8WJ5gb32zfYE1hFNCOjk= +github.com/jdxcode/netrc v1.0.0/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= @@ -1368,6 +1381,7 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= @@ -1524,6 +1538,8 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/profile v1.5.0 h1:042Buzk+NhDI+DeSAA62RwJL8VAuZUMQZUjCsRz1Mug= +github.com/pkg/profile v1.5.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -1612,6 +1628,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= +github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rubenv/sql-migrate v1.3.1 h1:Vx+n4Du8X8VTYuXbhNxdEUoh6wiJERA0GlWocR5FrbA= github.com/rubenv/sql-migrate v1.3.1/go.mod h1:YzG/Vh82CwyhTFXy+Mf5ahAiiEOpAlHurg+23VEzcsk= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1676,8 +1694,6 @@ github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3 github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -1717,6 +1733,8 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ= +github.com/tetratelabs/wazero v1.2.1 h1:J4X2hrGzJvt+wqltuvcSjHQ7ujQxA9gb6PeMs4qlUWs= +github.com/tetratelabs/wazero v1.2.1/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -2099,8 +2117,6 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2618,16 +2634,13 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1 h1:fk72uXZyuZiTtW5tgd63jyVK6582lF61nRC/kGv6vCA= -google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= @@ -2671,10 +2684,12 @@ gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c/go.mod h1:SH2K9R+2RMjuX1C gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= gorm.io/driver/mysql v1.5.1 h1:WUEH5VF9obL/lTtzjmML/5e6VfFR/788coz2uaVCAZw= gorm.io/driver/mysql v1.5.1/go.mod h1:Jo3Xu7mMhCyj8dlrb3WoCaRd1FhsVh+yMXb1jUInf5o= +gorm.io/driver/postgres v1.4.5 h1:mTeXTTtHAgnS9PgmhN2YeUbazYpLhUI1doLnw42XUZc= gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c= gorm.io/driver/sqlite v1.1.6/go.mod h1:W8LmC/6UvVbHKah0+QOC7Ja66EaZXHwUTjgXY8YNWX8= gorm.io/driver/sqlite v1.5.2 h1:TpQ+/dqCY4uCigCFyrfnrJnrW9zjpelWVoEVNy5qJkc= gorm.io/driver/sqlite v1.5.2/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= +gorm.io/driver/sqlserver v1.4.1 h1:t4r4r6Jam5E6ejqP7N82qAJIJAht27EGT41HyPfXRw0= gorm.io/gen v0.3.24 h1:yL1RrCySwTWTQpkUkt2FCe42Xub2eaZP2tM5EQoFBNU= gorm.io/gen v0.3.24/go.mod h1:G9uxGfkfNFxPoOrV5P6KQxRMgZsQSCyp9vJP8xiKTGg= gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking_test.go b/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking_test.go deleted file mode 100644 index 47b312650..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreaking_test.go +++ /dev/null @@ -1,842 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufbreaking_test - -import ( - "context" - "path/filepath" - "testing" - "time" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestRunBreakingEnumNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_enum_no_delete", - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), - ) -} - -func TestRunBreakingEnumValueNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_enum_value_no_delete", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 8, 2, "ENUM_VALUE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 5, 15, 6, "ENUM_VALUE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 3, 25, 4, "ENUM_VALUE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 40, 1, 42, 2, "ENUM_VALUE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 48, 1, 52, 2, "ENUM_VALUE_NO_DELETE"), - ) -} - -func TestRunBreakingEnumValueNoDeleteUnlessNameReserved(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_enum_value_no_delete_unless_name_reserved", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 3, 28, 4, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 43, 1, 45, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 48, 1, 52, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED"), - ) -} - -func TestRunBreakingEnumValueNoDeleteUnlessNumberReserved(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_enum_value_no_delete_unless_number_reserved", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 3, 28, 4, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 43, 1, 45, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 48, 1, 52, 2, "ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED"), - ) -} - -func TestRunBreakingEnumValueSameName(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_enum_value_same_name", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 15, 8, 16, "ENUM_VALUE_SAME_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 20, 16, 21, "ENUM_VALUE_SAME_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 27, 19, 27, 20, "ENUM_VALUE_SAME_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 46, 16, 46, 17, "ENUM_VALUE_SAME_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 47, 18, 47, 19, "ENUM_VALUE_SAME_NAME"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 51, 16, 51, 17, "ENUM_VALUE_SAME_NAME"), - ) -} - -func TestRunBreakingExtensionMessageNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_extension_message_no_delete", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 11, 2, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 11, 2, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 11, 2, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 5, 21, 6, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 5, 21, 6, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 5, 21, 6, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 30, 3, 36, 4, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 30, 3, 36, 4, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 30, 3, 36, 4, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 73, 1, 79, 2, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 73, 1, 79, 2, "EXTENSION_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 73, 1, 79, 2, "EXTENSION_MESSAGE_NO_DELETE"), - ) -} - -func TestRunBreakingFieldNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_no_delete", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 8, 2, "FIELD_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 1, 33, 2, "FIELD_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 5, 15, 6, "FIELD_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 3, 25, 4, "FIELD_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 57, 1, 60, 2, "FIELD_NO_DELETE"), - ) -} - -func TestRunBreakingFieldNoDeleteUnlessNameReserved(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_no_delete_unless_name_reserved", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 35, 2, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 35, 2, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 3, 28, 4, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 57, 1, 61, 2, "FIELD_NO_DELETE_UNLESS_NAME_RESERVED"), - ) -} - -func TestRunBreakingFieldNoDeleteUnlessNumberReserved(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_no_delete_unless_number_reserved", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 35, 2, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 35, 2, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 3, 28, 4, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 57, 1, 61, 2, "FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED"), - ) -} - -func TestRunBreakingFieldSameCType(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_same_ctype", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 19, 6, 39, "FIELD_SAME_CTYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 3, 7, 18, "FIELD_SAME_CTYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 23, 13, 43, "FIELD_SAME_CTYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 14, 7, 14, 22, "FIELD_SAME_CTYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 21, 23, 33, "FIELD_SAME_CTYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 49, 28, 49, 48, "FIELD_SAME_CTYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 50, 28, 50, 42, "FIELD_SAME_CTYPE"), - ) -} - -func TestRunBreakingFieldSameJSONName(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_same_json_name", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 3, 6, 17, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 18, 7, 35, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 20, 8, 37, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 3, 9, 27, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 28, 10, 46, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 27, 11, 45, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 3, 12, 31, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 32, 13, 50, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 14, 31, 14, 49, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 7, 20, 21, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 21, 22, 21, 39, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 24, 22, 41, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 7, 23, 31, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 32, 24, 50, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 25, 31, 25, 49, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 26, 7, 26, 35, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 27, 36, 27, 54, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 28, 35, 28, 53, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 43, 5, 43, 19, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 44, 20, 44, 37, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 45, 22, 45, 39, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 46, 5, 46, 29, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 47, 30, 47, 48, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 48, 29, 48, 47, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 49, 5, 49, 33, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 50, 34, 50, 52, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 51, 33, 51, 51, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 92, 5, 92, 19, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 93, 20, 93, 37, "FIELD_SAME_JSON_NAME"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 94, 22, 94, 39, "FIELD_SAME_JSON_NAME"), - ) -} - -func TestRunBreakingFieldSameJSType(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_same_jstype", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 18, 6, 36, "FIELD_SAME_JSTYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 3, 7, 17, "FIELD_SAME_JSTYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 22, 13, 40, "FIELD_SAME_JSTYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 14, 7, 14, 21, "FIELD_SAME_JSTYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 20, 22, 38, "FIELD_SAME_JSTYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 49, 27, 49, 45, "FIELD_SAME_JSTYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 50, 3, 50, 26, "FIELD_SAME_JSTYPE"), - ) -} - -func TestRunBreakingFieldSameLabel(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_same_label", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 8, 26, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 3, 9, 24, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 3, 10, 19, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 3, 11, 16, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 3, 12, 18, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 3, 13, 17, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 19, 7, 19, 30, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 7, 20, 28, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 21, 7, 21, 23, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 7, 22, 20, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 7, 23, 22, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 7, 24, 21, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 36, 5, 36, 28, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 37, 5, 37, 26, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 38, 5, 38, 21, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 39, 5, 39, 18, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 40, 5, 40, 20, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 41, 5, 41, 19, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 13, 3, 13, 26, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 14, 3, 14, 24, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 70, 3, 70, 26, "FIELD_SAME_LABEL"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 71, 3, 71, 26, "FIELD_SAME_LABEL"), - ) -} - -func TestRunBreakingFieldSameName(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_same_name", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 9, 7, 13, "FIELD_SAME_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 13, 15, 17, "FIELD_SAME_NAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 26, 11, 26, 15, "FIELD_SAME_NAME"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 60, 11, 60, 15, "FIELD_SAME_NAME"), - ) -} - -func TestRunBreakingFieldSameOneof(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_same_oneof", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 3, 6, 17, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 8, 17, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 3, 11, 19, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 18, 3, 18, 17, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 3, 20, 17, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 3, 23, 19, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 37, 3, 37, 17, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 39, 3, 39, 17, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 42, 3, 42, 19, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 94, 3, 94, 17, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 96, 3, 96, 17, "FIELD_SAME_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 99, 3, 99, 19, "FIELD_SAME_ONEOF"), - ) -} - -func TestRunBreakingFieldSameType(t *testing.T) { - t.Parallel() - // TODO: double check all this - testBreaking( - t, - "breaking_field_same_type", - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 12, 8, 17, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 12, 9, 15, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 3, 11, 6, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 3, 12, 6, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 19, 16, 19, 21, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 16, 20, 19, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 7, 22, 10, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 7, 23, 10, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 36, 14, 36, 19, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 37, 14, 37, 17, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 39, 5, 39, 8, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 40, 5, 40, 8, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 64, 5, 64, 10, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 65, 5, 65, 9, "FIELD_SAME_TYPE"), - ) -} - -func TestRunBreakingFieldWireCompatibleType(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_wire_compatible_type", - bufanalysistesting.NewFileAnnotation(t, "2.proto", 31, 3, 31, 11, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 32, 3, 32, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 33, 3, 33, 8, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 34, 3, 34, 8, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 35, 3, 35, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 36, 3, 36, 10, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 3, 37, 11, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 3, 38, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 39, 3, 39, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 40, 3, 40, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 41, 3, 41, 8, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 42, 3, 42, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 43, 3, 43, 8, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 44, 3, 44, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 45, 3, 45, 7, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 78, 3, 78, 6, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 79, 3, 79, 6, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 80, 3, 80, 6, "FIELD_WIRE_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 85, 3, 85, 9, "FIELD_WIRE_COMPATIBLE_TYPE"), - ) -} - -func TestRunBreakingFieldWireJSONCompatibleType(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_field_wire_json_compatible_type", - bufanalysistesting.NewFileAnnotation(t, "2.proto", 34, 3, 34, 11, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 35, 3, 35, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 36, 3, 36, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 3, 37, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 3, 38, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 39, 3, 39, 10, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 40, 3, 40, 11, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 41, 3, 41, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 42, 3, 42, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 43, 3, 43, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 44, 3, 44, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 45, 3, 45, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 46, 3, 46, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 47, 3, 47, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 48, 3, 48, 7, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 81, 3, 81, 6, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 82, 3, 82, 6, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 83, 3, 83, 6, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 87, 3, 87, 8, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 88, 3, 88, 9, "FIELD_WIRE_JSON_COMPATIBLE_TYPE"), - ) -} - -func TestRunBreakingFileNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_file_no_delete", - bufanalysistesting.NewFileAnnotationNoLocationOrPath(t, "FILE_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocationOrPath(t, "FILE_NO_DELETE"), - ) -} - -func TestRunBreakingFileNoDeleteUnstable(t *testing.T) { - t.Parallel() - // https://github.com/ProtobufMan/bufman-cli/issues/211 - testBreaking( - t, - "breaking_file_no_delete_unstable", - ) -} - -func TestRunBreakingFileNoDeleteIgnores(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_file_no_delete_ignores", - // a/a.proto deleted but not ignored - bufanalysistesting.NewFileAnnotationNoLocationOrPath(t, "FILE_NO_DELETE"), - ) -} - -func TestRunBreakingFileSamePackage(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_file_same_package", - bufanalysistesting.NewFileAnnotation(t, "a/a.proto", 3, 1, 3, 11, "FILE_SAME_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "no_package.proto", 3, 1, 3, 11, "FILE_SAME_PACKAGE"), - ) -} - -func TestRunBreakingFileSameSyntax(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_file_same_syntax", - bufanalysistesting.NewFileAnnotation(t, "no_package.proto", 1, 1, 1, 19, "FILE_SAME_SYNTAX"), - bufanalysistesting.NewFileAnnotation(t, "sub/a/b/sub_a_b.proto", 2, 1, 2, 19, "FILE_SAME_SYNTAX"), - ) -} - -func TestRunBreakingFileSameValues(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_file_same_values", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 5, 29, "FILE_SAME_JAVA_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 1, 6, 37, "FILE_SAME_JAVA_OUTER_CLASSNAME"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 7, 36, "FILE_SAME_JAVA_MULTIPLE_FILES"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 1, 8, 27, "FILE_SAME_GO_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 1, 9, 34, "FILE_SAME_OBJC_CLASS_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 1, 10, 33, "FILE_SAME_CSHARP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 1, 11, 29, "FILE_SAME_SWIFT_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 1, 12, 33, "FILE_SAME_PHP_CLASS_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 1, 13, 30, "FILE_SAME_PHP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 14, 1, 14, 39, "FILE_SAME_PHP_METADATA_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 1, 15, 29, "FILE_SAME_RUBY_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 17, 1, 17, 39, "FILE_SAME_JAVA_STRING_CHECK_UTF8"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 18, 1, 18, 29, "FILE_SAME_OPTIMIZE_FOR"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 19, 1, 19, 36, "FILE_SAME_CC_GENERIC_SERVICES"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 20, 1, 20, 38, "FILE_SAME_JAVA_GENERIC_SERVICES"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 21, 1, 21, 36, "FILE_SAME_PY_GENERIC_SERVICES"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 1, 22, 37, "FILE_SAME_PHP_GENERIC_SERVICES"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 1, 23, 33, "FILE_SAME_CC_ENABLE_ARENAS"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 1, 3, 11, "FILE_SAME_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 5, 1, 5, 29, "FILE_SAME_JAVA_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 6, 1, 6, 37, "FILE_SAME_JAVA_OUTER_CLASSNAME"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 7, 1, 7, 35, "FILE_SAME_JAVA_MULTIPLE_FILES"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 8, 1, 8, 27, "FILE_SAME_GO_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 9, 1, 9, 34, "FILE_SAME_OBJC_CLASS_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 10, 1, 10, 33, "FILE_SAME_CSHARP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 11, 1, 11, 29, "FILE_SAME_SWIFT_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 12, 1, 12, 33, "FILE_SAME_PHP_CLASS_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 13, 1, 13, 30, "FILE_SAME_PHP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 14, 1, 14, 39, "FILE_SAME_PHP_METADATA_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 15, 1, 15, 29, "FILE_SAME_RUBY_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 17, 1, 17, 38, "FILE_SAME_JAVA_STRING_CHECK_UTF8"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 18, 1, 18, 33, "FILE_SAME_OPTIMIZE_FOR"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 19, 1, 19, 35, "FILE_SAME_CC_GENERIC_SERVICES"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 20, 1, 20, 37, "FILE_SAME_JAVA_GENERIC_SERVICES"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 21, 1, 21, 35, "FILE_SAME_PY_GENERIC_SERVICES"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 22, 1, 22, 36, "FILE_SAME_PHP_GENERIC_SERVICES"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 23, 1, 23, 33, "FILE_SAME_CC_ENABLE_ARENAS"), - ) -} - -func TestRunBreakingMessageNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_message_no_delete", - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 12, 2, "MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 10, 4, "MESSAGE_NO_DELETE"), - ) -} - -func TestRunBreakingMessageSameValues(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_message_same_values", - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 3, 6, 42, "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 3, 7, 49, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 7, 13, 53, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 7, 16, 45, "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 21, 5, 21, 44, "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 24, 5, 24, 43, "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 27, 3, 27, 49, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "2.proto", "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "2.proto", "MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 6, 3, 6, 49, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 10, 3, 10, 49, "MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR"), - ) -} - -func TestRunBreakingMessageSameRequiredFields(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_message_same_required_fields", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 7, 2, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 6, 3, 6, 27, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 1, 11, 2, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 3, 10, 27, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 1, 30, 2, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 15, 5, 17, 6, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 7, 16, 31, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 18, 5, 20, 6, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 22, 3, 24, 4, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 23, 5, 23, 29, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 27, 5, 27, 29, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 29, 3, 29, 27, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 5, 1, 7, 2, "MESSAGE_SAME_REQUIRED_FIELDS"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 6, 3, 6, 27, "MESSAGE_SAME_REQUIRED_FIELDS"), - ) -} - -func TestRunBreakingOneofNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_oneof_no_delete", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 9, 2, "ONEOF_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 13, 5, 17, 6, "ONEOF_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 26, 3, 30, 4, "ONEOF_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 75, 1, 79, 2, "ONEOF_NO_DELETE"), - ) -} - -func TestRunBreakingPackageNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_package_no_delete", - bufanalysistesting.NewFileAnnotationNoLocationOrPath(t, "PACKAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "a1.proto", "PACKAGE_SERVICE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "a2.proto", 11, 1, 16, 2, "PACKAGE_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "a2.proto", 12, 3, 14, 4, "PACKAGE_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "b1.proto", "PACKAGE_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "b1.proto", "PACKAGE_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "b1.proto", "PACKAGE_SERVICE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "b2.proto", 7, 1, 21, 2, "PACKAGE_MESSAGE_NO_DELETE"), - ) -} - -func TestRunBreakingReservedEnumNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_reserved_enum_no_delete", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 86, 1, 93, 2, "RESERVED_ENUM_NO_DELETE"), - ) -} - -func TestRunBreakingReservedMessageNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_reserved_message_no_delete", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 5, 1, 12, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 16, 5, 23, 6, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 34, 3, 41, 4, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 89, 1, 96, 2, "RESERVED_MESSAGE_NO_DELETE"), - ) -} - -func TestRunBreakingRPCNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_rpc_no_delete", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 10, 2, "RPC_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 31, 1, 34, 2, "RPC_NO_DELETE"), - ) -} - -func TestRunBreakingRPCSameValues(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_rpc_same_values", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 3, 9, 71, "RPC_SAME_CLIENT_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 18, 9, 37, "RPC_SAME_REQUEST_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 9, 48, 9, 67, "RPC_SAME_RESPONSE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 3, 10, 71, "RPC_SAME_SERVER_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 11, 10, 30, "RPC_SAME_REQUEST_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 10, 48, 10, 67, "RPC_SAME_RESPONSE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 11, 3, 11, 68, "RPC_SAME_CLIENT_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 12, 3, 12, 68, "RPC_SAME_SERVER_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 3, 37, 71, "RPC_SAME_CLIENT_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 18, 37, 37, "RPC_SAME_REQUEST_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 37, 48, 37, 67, "RPC_SAME_RESPONSE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 3, 38, 71, "RPC_SAME_SERVER_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 11, 38, 30, "RPC_SAME_REQUEST_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 38, 48, 38, 67, "RPC_SAME_RESPONSE_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 39, 3, 39, 68, "RPC_SAME_CLIENT_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 40, 3, 40, 68, "RPC_SAME_SERVER_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 45, 5, 45, 48, "RPC_SAME_IDEMPOTENCY_LEVEL"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 49, 5, 49, 43, "RPC_SAME_IDEMPOTENCY_LEVEL"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 55, 5, 55, 48, "RPC_SAME_IDEMPOTENCY_LEVEL"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 59, 5, 59, 43, "RPC_SAME_IDEMPOTENCY_LEVEL"), - ) -} - -func TestRunBreakingServiceNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_service_no_delete", - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "SERVICE_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "SERVICE_NO_DELETE"), - ) -} - -func TestRunBreakingPackageServiceNoDelete(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_package_service_no_delete", - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "PACKAGE_SERVICE_NO_DELETE"), - ) -} - -func TestRunBreakingIgnoreUnstablePackagesTrue(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_ignore_unstable_packages_true", - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 16, 2, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 12, 4, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "a/v1/1.proto", "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "a/v1/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "a/v1/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "b/1.proto", "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "b/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "b/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), - ) -} - -func TestRunBreakingIgnoreUnstablePackagesFalse(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_ignore_unstable_packages_false", - bufanalysistesting.NewFileAnnotationNoLocation(t, "1.proto", "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 7, 1, 16, 2, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 8, 3, 12, 4, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "a/v1/1.proto", "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "a/v1/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "a/v1/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "a/v1beta1/1.proto", "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "a/v1beta1/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "a/v1beta1/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "b/1.proto", "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "b/1.proto", 9, 1, 18, 2, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "b/1.proto", 10, 3, 14, 4, "ENUM_NO_DELETE"), - ) -} - -func TestRunBreakingIgnoreUnstablePackagesDeleteFile(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_ignore_unstable_packages_delete_file", - ) -} - -func TestRunBreakingIntEnum(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_int_enum", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 0, 0, 0, 0, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "1.proto", 3, 3, 3, 8, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 3, 3, 7, "FIELD_SAME_TYPE"), - ) -} - -func TestRunBreakingMessageEnum(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_message_enum", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 3, 3, 3, 6, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 0, 0, 0, 0, "ENUM_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 3, 3, 7, "FIELD_SAME_TYPE"), - ) -} - -func TestRunBreakingMessageInt(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_message_int", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 3, 3, 3, 6, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 3, 3, 8, "FIELD_SAME_TYPE"), - ) -} - -func TestRunBreakingMessageMessage(t *testing.T) { - t.Parallel() - testBreaking( - t, - "breaking_message_message", - bufanalysistesting.NewFileAnnotation(t, "1.proto", 3, 3, 3, 8, "FIELD_SAME_TYPE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 0, 0, 0, 0, "MESSAGE_NO_DELETE"), - bufanalysistesting.NewFileAnnotation(t, "2.proto", 3, 3, 3, 7, "FIELD_SAME_TYPE"), - ) -} - -func testBreaking( - t *testing.T, - relDirPath string, - expectedFileAnnotations ...bufanalysis.FileAnnotation, -) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - logger := zap.NewNop() - - previousDirPath := filepath.Join("testdata_previous", relDirPath) - dirPath := filepath.Join("testdata", relDirPath) - - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - previousReadWriteBucket, err := storageosProvider.NewReadWriteBucket( - previousDirPath, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - dirPath, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - - previousConfig := testGetConfig(t, previousReadWriteBucket) - config := testGetConfig(t, readWriteBucket) - - previousModule, err := bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( - context.Background(), - previousReadWriteBucket, - previousConfig.Build, - ) - require.NoError(t, err) - previousImage, previousFileAnnotations, err := bufimagebuild.NewBuilder( - zap.NewNop(), - bufmodule.NewNopModuleReader(), - ).Build( - ctx, - previousModule, - bufimagebuild.WithExcludeSourceCodeInfo(), - ) - require.NoError(t, err) - require.Empty(t, previousFileAnnotations) - previousImage = bufimage.ImageWithoutImports(previousImage) - - module, err := bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config.Build, - ) - require.NoError(t, err) - image, fileAnnotations, err := bufimagebuild.NewBuilder( - zap.NewNop(), - bufmodule.NewNopModuleReader(), - ).Build( - ctx, - module, - ) - require.NoError(t, err) - require.Empty(t, fileAnnotations) - image = bufimage.ImageWithoutImports(image) - - handler := bufbreaking.NewHandler(logger) - fileAnnotations, err = handler.Check( - ctx, - config.Breaking, - previousImage, - image, - ) - assert.NoError(t, err) - bufanalysistesting.AssertFileAnnotationsEqual( - t, - expectedFileAnnotations, - fileAnnotations, - ) -} - -func testGetConfig( - t *testing.T, - readBucket storage.ReadBucket, -) *bufconfig.Config { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) - defer cancel() - config, err := bufconfig.GetConfigForBucket(ctx, readBucket) - require.NoError(t, err) - return config -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/1.proto deleted file mode 100644 index 82d029608..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/1.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/2.proto deleted file mode 100644 index 4037ecdd9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/buf.yaml deleted file mode 100644 index 6895c500a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - ENUM_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/1.proto deleted file mode 100644 index 745f22630..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/1.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Two { - TWO_UNSPECIFIED = 0; - TWO_ONE = 1; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - } - enum Six { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Ten { - option allow_alias = true; - TEN_UNSPECIFIED = 0; - TEN_ONE = 1; - TEN_TWO = 1; -} - -enum Eleven { - ELEVEN_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/2.proto deleted file mode 100644 index ec34021c6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/2.proto +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum One2 { - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - NINE_UNSPECIFIED = 0; - NINE_ONE = 1; - NINE_TWO = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/buf.yaml deleted file mode 100644 index f07b9f216..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - ENUM_VALUE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/1.proto deleted file mode 100644 index 78ccfcefa..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/1.proto +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Two { - reserved "TWO_TWO"; - - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - reserved "FIVE_TWO"; - - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - reserved "SEVEN_TWO"; - - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Ten { - option allow_alias = true; - TEN_UNSPECIFIED = 0; - TEN_ONE = 1; - TEN_TWO = 1; -} - -enum Eleven { - ELEVEN_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/2.proto deleted file mode 100644 index 19693091d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/2.proto +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum One2 { - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - reserved "NINE_TWO"; - - NINE_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/buf.yaml deleted file mode 100644 index e68ada187..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_name_reserved/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - ENUM_VALUE_NO_DELETE_UNLESS_NAME_RESERVED diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/1.proto deleted file mode 100644 index abcfdc778..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/1.proto +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Two { - reserved 2 to 6; - - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - reserved 2 to 6; - - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - reserved 2 to 6; - - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Ten { - option allow_alias = true; - TEN_UNSPECIFIED = 0; - TEN_ONE = 1; - TEN_TWO = 1; -} - -enum Eleven { - ELEVEN_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/2.proto deleted file mode 100644 index ea80493e9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/2.proto +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum One2 { - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - reserved 2 to 6; - - NINE_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/buf.yaml deleted file mode 100644 index 52313a81c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_no_delete_unless_number_reserved/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - ENUM_VALUE_NO_DELETE_UNLESS_NUMBER_RESERVED diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/1.proto deleted file mode 100644 index 1ba900176..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/1.proto +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Two { - TWO_UNSPECIFIED = 0; - TWO_ONE = 1; - TWO_THREE = 2; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_THREE = 2; - } - enum Six { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_THREE = 2; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Ten { - option allow_alias = true; - TEN_UNSPECIFIED = 0; - TEN_ONE = 1; - TEN_TWO = 1; -} - -enum Eleven { - option allow_alias = true; - ELEVEN_UNSPECIFIED = 0; - ELEVEN_ONE = 1; - ELEVEN_THREE = 1; -} - -enum Twelve { - option allow_alias = true; - TWELVE_UNSPECIFIED = 0; - TWELVE_ONE = 1; - TWELVE_TWO = 1; - TWELVE_THREE = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/2.proto deleted file mode 100644 index 3b9f0d45b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/2.proto +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum One2 { - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - NINE_UNSPECIFIED = 0; - NINE_ONE = 1; - NINE_THREE = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/buf.yaml deleted file mode 100644 index dae02eaeb..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_enum_value_same_name/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - ENUM_VALUE_SAME_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/1.proto deleted file mode 100644 index b3666ec49..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/1.proto +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message Two { - extensions 100 to 200; - extensions 300; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Three { - message Four { - message Five { - extensions 100 to 200; - extensions 300; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - message Six { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - } - message Seven { - extensions 100 to 200; - extensions 300; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - message Eight { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/2.proto deleted file mode 100644 index 8ea6c2b5d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/2.proto +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message One2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Two2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - message Six2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - } - message Seven2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - message Eight2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Nine2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Nine { - extensions 100 to 200; - extensions 300; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/buf.yaml deleted file mode 100644 index cd7655aaa..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_extension_message_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - EXTENSION_MESSAGE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/1.proto deleted file mode 100644 index 22708328d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/1.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - int32 one = 1; - int32 two = 2; -} - -message Three { - message Four { - message Five { - int32 one = 1; - int32 two = 2; - } - message Six { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - int32 one = 1; - int32 two = 2; - } - message Eight { - int32 one = 1; - int32 changed_name = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/2.proto deleted file mode 100644 index f83423807..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/2.proto +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message One2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - int32 one = 1; - int32 two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/buf.yaml deleted file mode 100644 index 361a8b87c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/1.proto deleted file mode 100644 index 6c55d9745..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/1.proto +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - reserved "three"; - - int32 one = 1; -} - -message Three { - message Four { - message Five { - reserved "three"; - - int32 one = 1; - } - message Six { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - reserved "three"; - - int32 one = 1; - } - message Eight { - int32 one = 1; - int32 changed_name = 2; - int32 three = 3; - } - int32 one = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/2.proto deleted file mode 100644 index 821074ef2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/2.proto +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message One2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - reserved "three"; - - int32 one = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/buf.yaml deleted file mode 100644 index 8c6fd6a2a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_name_reserved/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_NO_DELETE_UNLESS_NAME_RESERVED diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/1.proto deleted file mode 100644 index 8b9ab369b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/1.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - reserved 3 ; - - int32 one = 1; -} - -message Three { - message Four { - message Five { - reserved 3 ; - - int32 one = 1; - } - message Six { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - reserved 3 ; - - int32 one = 1; - } - message Eight { - int32 one = 1; - int32 changed_name = 2; - int32 three = 3; - } - int32 one = 1; -} - -message Ten { - reserved 2 to 3; - reserved 5 to max; - int32 one = 1; - int32 four = 4; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/2.proto deleted file mode 100644 index 54b5790bb..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/2.proto +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message One2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - reserved 3 ; - - int32 one = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/buf.yaml deleted file mode 100644 index 464a98ad6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_no_delete_unless_number_reserved/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/1.proto deleted file mode 100644 index 81052cbc9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/1.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - string one = 1 [ctype = STRING_PIECE]; - string two = 2; -} - -message Three { - message Four { - message Five { - string one = 1 [ctype = STRING_PIECE]; - string two = 2; - } - message Six { - string one = 1; - string two = 2; - } - } - message Seven { - string one = 1 [ctype = STRING]; - string two = 2 [ctype = CORD]; - } - message Eight { - string one = 1; - string two = 2; - } - string one = 1; - string two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/2.proto deleted file mode 100644 index f124f784a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/2.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - optional string one = 1; - optional string two = 2 [ctype = CORD]; -} - -message One2 { - optional string one = 1 [ctype = STRING_PIECE]; - required string two = 2 [ctype = CORD]; -} - -message Two2 { - optional string one = 1 [ctype = STRING_PIECE]; - required string two = 2 [ctype = CORD]; -} - -message Three2 { - message Four2 { - message Five2 { - optional string one = 1 [ctype = STRING_PIECE]; - required string two = 2 [ctype = CORD]; - } - message Six2 { - optional string one = 1; - required string two = 2; - } - } - message Seven2 { - optional string one = 1; - required string two = 2; - } - message Eight2 { - optional string one = 1; - required string two = 2; - } - optional string one = 1; - required string two = 2; -} - -message Nine2 { - optional string one = 1 [ctype = STRING_PIECE]; - required string two = 2 [ctype = CORD]; -} - -message Nine { - optional string one = 1 [ctype = STRING_PIECE]; - optional string two = 2 [ctype = STRING]; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/buf.yaml deleted file mode 100644 index 4645a6aac..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_ctype/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_SAME_CTYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/1.proto deleted file mode 100644 index 5ad19246f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/1.proto +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - int32 one = 1; - int32 two = 2 [json_name = "bar"]; - int32 three = 3 [json_name = "baz"]; - repeated int32 four = 4; - repeated int32 five = 5 [json_name = "bar2"]; - repeated int32 six = 6 [json_name = "baz2"]; - map seven = 7; - map eight = 8 [json_name = "bar3"]; - map nine = 9 [json_name = "baz3"]; -} - -message Three { - message Four { - message Five { - int32 one = 1; - int32 two = 2 [json_name = "bar"]; - int32 three = 3 [json_name = "baz"]; - repeated int32 four = 4; - repeated int32 five = 5 [json_name = "bar2"]; - repeated int32 six = 6 [json_name = "baz2"]; - map seven = 7; - map eight = 8 [json_name = "bar3"]; - map nine = 9 [json_name = "baz3"]; - } - message Six { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - } - message Seven { - int32 one = 1; - int32 two = 2 [json_name = "bar"]; - int32 three = 3 [json_name = "baz"]; - repeated int32 four = 4; - repeated int32 five = 5 [json_name = "bar2"]; - repeated int32 six = 6 [json_name = "baz2"]; - map seven = 7; - map eight = 8 [json_name = "bar3"]; - map nine = 9 [json_name = "baz3"]; - } - message Eight { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/2.proto deleted file mode 100644 index d9f8751d0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/2.proto +++ /dev/null @@ -1,111 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; -} - -message One2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; -} - -message Two2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - message Six2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - } - message Seven2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - message Eight2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } -} - -message Nine { - oneof foo { - int32 one = 1; - int32 two = 2 [json_name = "bar" ]; - int32 three = 3 [json_name = "baz"]; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/buf.yaml deleted file mode 100644 index 4a734a5f0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_json_name/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_SAME_JSON_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/1.proto deleted file mode 100644 index fd2caa28c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/1.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - int64 one = 1 [jstype = JS_NUMBER]; - int64 two = 2; -} - -message Three { - message Four { - message Five { - int64 one = 1 [jstype = JS_NUMBER]; - int64 two = 2; - } - message Six { - int64 one = 1; - int64 two = 2; - } - } - message Seven { - int64 one = 1 [jstype = JS_NUMBER]; - int64 two = 2 [jstype = JS_NORMAL]; - } - message Eight { - int64 one = 1; - int64 two = 2; - } - int64 one = 1; - int64 two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/2.proto deleted file mode 100644 index e78a38540..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/2.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - optional int64 one = 1; - optional int64 two = 2 [jstype = JS_STRING]; -} - -message One2 { - optional int64 one = 1 [jstype = JS_NUMBER]; - required int64 two = 2 [jstype = JS_STRING]; -} - -message Two2 { - optional int64 one = 1 [jstype = JS_NUMBER]; - required int64 two = 2 [jstype = JS_STRING]; -} - -message Three2 { - message Four2 { - message Five2 { - optional int64 one = 1 [jstype = JS_NUMBER]; - required int64 two = 2 [jstype = JS_STRING]; - } - message Six2 { - optional int64 one = 1; - required int64 two = 2; - } - } - message Seven2 { - optional int64 one = 1; - required int64 two = 2; - } - message Eight2 { - optional int64 one = 1; - required int64 two = 2; - } - optional int64 one = 1; - required int64 two = 2; -} - -message Nine2 { - optional int64 one = 1 [jstype = JS_NUMBER]; - required int64 two = 2 [jstype = JS_STRING]; -} - -message Nine { - optional int64 one = 1 [jstype = JS_NUMBER]; - optional int64 two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/buf.yaml deleted file mode 100644 index 9d3951a1b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_jstype/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_SAME_JSTYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/1.proto deleted file mode 100644 index d7675fe85..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/1.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "2.proto"; - -message Two { - repeated int64 one = 1; - repeated Two two = 2; - int64 three = 3; - Two four = 4; - int32 five = 5; - int32 six = 6; -} - -message Three { - message Four { - message Five { - repeated int64 one = 1; - repeated Two two = 2; - int64 three = 3; - Two four = 4; - int32 five = 5; - int32 six = 6; - } - message Six { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } - } - message Seven { - repeated int64 one = 1; - repeated Two two = 2; - int64 three = 3; - Two four = 4; - int32 five = 5; - int32 six = 6; - } - message Eight { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/2.proto deleted file mode 100644 index d2541e484..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/2.proto +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message One2 { - required int32 one = 1; - required One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message Two2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message Three2 { - message Four2 { - message Five2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - message Six2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - } - message Seven2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - message Eight2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } -} - -message Nine2 { - oneof foo { - int32 one = 1; - One two = 2; - } -} - -message Nine { - oneof foo { - int64 one = 1; - Nine two = 2; - } -} - -message Ten { - repeated int64 one = 1; - required int64 two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/buf.yaml deleted file mode 100644 index f37713fe3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_label/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_SAME_LABEL diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/1.proto deleted file mode 100644 index 8468cc9fa..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/1.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - int32 one = 1; - int32 four = 2; - int32 three = 3; -} - -message Three { - message Four { - message Five { - int32 one = 1; - int32 four = 2; - int32 three = 3; - } - message Six { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - int32 one = 1; - int32 four = 2; - int32 three = 3; - } - message Eight { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/2.proto deleted file mode 100644 index 0a0b1cc06..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/2.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message One2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - oneof foo { - int32 one = 1; - int32 four = 2; - int32 three = 3; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/buf.yaml deleted file mode 100644 index 84e87a710..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_name/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_SAME_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/1.proto deleted file mode 100644 index 9daafcb83..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/1.proto +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - int32 one = 1; - oneof baz { - int32 two = 2; - } - oneof foo { - int32 three = 3; - } -} - -message Three { - message Four { - message Five { - int32 one = 1; - oneof baz { - int32 two = 2; - } - oneof foo { - int32 three = 3; - } - } - message Six { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - } - message Seven { - int32 one = 1; - oneof baz { - int32 two = 2; - } - oneof foo { - int32 three = 3; - } - } - message Eight { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/2.proto deleted file mode 100644 index 641f75132..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/2.proto +++ /dev/null @@ -1,116 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message One2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Two2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - message Six2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - } - message Seven2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - message Eight2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Nine2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Nine { - int32 one = 1; - oneof baz { - int32 two = 2; - } - oneof foo { - int32 three = 3; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/buf.yaml deleted file mode 100644 index bb0a54b70..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_oneof/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_SAME_ONEOF diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/1.proto deleted file mode 100644 index e11961f14..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/1.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "2.proto"; - -message Two { - repeated int64 one = 1; - repeated Two two = 2; - int32 three = 3; - Two four = 4; - Two five = 5; - map six = 6; -} - -message Three { - message Four { - message Five { - repeated int64 one = 1; - repeated Two two = 2; - int32 three = 3; - Two four = 4; - Two five = 5; - map six = 6; - } - message Six { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } - } - message Seven { - repeated int64 one = 1; - repeated Two two = 2; - int32 three = 3; - Two four = 4; - Two five = 5; - map six = 6; - } - message Eight { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/2.proto deleted file mode 100644 index d2541e484..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/2.proto +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message One2 { - required int32 one = 1; - required One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message Two2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message Three2 { - message Four2 { - message Five2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - message Six2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - } - message Seven2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - message Eight2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } -} - -message Nine2 { - oneof foo { - int32 one = 1; - One two = 2; - } -} - -message Nine { - oneof foo { - int64 one = 1; - Nine two = 2; - } -} - -message Ten { - repeated int64 one = 1; - required int64 two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/buf.yaml deleted file mode 100644 index 96e1ec81d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_same_type/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_SAME_TYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/2.proto deleted file mode 100644 index dbf9a27f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/2.proto +++ /dev/null @@ -1,101 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message CompatiblePrimitives { - bool bool_field_1 = 1; - int32 int32_field_1 = 2; - uint32 uint32_field_1 = 3; - int64 int64_field_1 = 4; - uint64 uint64_field_1 = 5; - - sint64 sint64_field_1 = 6; - sint32 sint32_field_1 = 7; - - sfixed32 sfixed32_field_1 = 8; - fixed32 fixed32_field_1 = 9; - - sfixed64 sfixed64_field_1 = 10; - fixed64 fixed64_field_1 = 11; - - string string_field_1 = 12; - - bytes bytes_field_1 = 14; - - float float_field_1 = 15; - - double double_field_1 = 16; -} - -message IncompatiblePrimitives { - sfixed64 sfixed64_field_1 = 1; - string string_field_1 = 2; - bytes bytes_field_1 = 3; - float float_field_1 = 4; - double double_field_1 = 5; - fixed32 fixed32_field_1 = 6; - sfixed32 sfixed32_field_1 = 7; - sint32 sint32_field_1 = 8; - sint64 sint64_field_1 = 9; - string fixed64_field_1 = 10; - int32 int32_field_1 = 11; - uint32 uint32_field_1 = 12; - int64 int64_field_1 = 14; - uint64 uint64_field_1 = 15; - bool bool_field_1 = 16; -} - -enum Baz { - BAZ_UNSPECIFIED = 0; - BAZ_ONE = 1; - BAZ_TWO = 2; -} - -message WithCompatibleEnums { - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; - } - Foo foo = 1; - Baz baz = 2; -} - -enum Bat { - BAT_UNSPECIFIED = 0; - BAT_TWO = 1; -} - -message WithIncompatibleEnums { - enum Bar { - BAR_UNSPECIFIED = 0; - BAR_TWO = 1; - } - enum Ban { - BAN_UNSPECIFIED = 0; - BAN_ONE = 1; - } - Bar bar = 1; - Bat bat = 2; - Ban ban = 3; -} - -message StringBytes { - bytes string_field_1 = 1; - string bytes_field_1 = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/buf.yaml deleted file mode 100644 index 7aaa932a0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_compatible_type/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_WIRE_COMPATIBLE_TYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/2.proto deleted file mode 100644 index 8fabe8bc9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/2.proto +++ /dev/null @@ -1,104 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message CompatiblePrimitives { - uint32 uint32_field_1 = 1; - int32 int32_field_1 = 2; - - uint64 uint64_field_1 = 3; - int64 int64_field_1 = 4; - - sfixed32 sfixed32_field_1 = 5; - fixed32 fixed32_field_1 = 6; - - sfixed64 sfixed64_field_1 = 7; - fixed64 fixed64_field_1 = 8; - - bool bool_field_1 = 9; - - sint32 sint32_field_1 = 10; - - sint64 sint64_field_1 = 11; - - string string_field_1 = 12; - - bytes bytes_field_1 = 14; - - float float_field_1 = 15; - - double double_field_1 = 16; -} - -message IncompatiblePrimitives { - sfixed64 sfixed64_field_1 = 1; - string string_field_1 = 2; - bytes bytes_field_1 = 3; - float float_field_1 = 4; - double double_field_1 = 5; - fixed32 fixed32_field_1 = 6; - sfixed32 sfixed32_field_1 = 7; - sint32 sint32_field_1 = 8; - sint64 sint64_field_1 = 9; - string fixed64_field_1 = 10; - int32 int32_field_1 = 11; - uint32 uint32_field_1 = 12; - int64 int64_field_1 = 14; - uint64 uint64_field_1 = 15; - bool bool_field_1 = 16; -} - -enum Baz { - BAZ_UNSPECIFIED = 0; - BAZ_ONE = 1; - BAZ_TWO = 2; -} - -message WithCompatibleEnums { - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; - } - Foo foo = 1; - Baz baz = 2; -} - -enum Bat { - BAT_UNSPECIFIED = 0; - BAT_TWO = 1; -} - -message WithIncompatibleEnums { - enum Bar { - BAR_UNSPECIFIED = 0; - BAR_TWO = 1; - } - enum Ban { - BAN_UNSPECIFIED = 0; - BAN_ONE = 1; - } - Bar bar = 1; - Bat bat = 2; - Ban ban = 3; -} - -message StringBytes { - bytes string_field_1 = 1; - string bytes_field_1 = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/buf.yaml deleted file mode 100644 index 1d7d0a70d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_field_wire_json_compatible_type/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FIELD_WIRE_JSON_COMPATIBLE_TYPE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/buf.yaml deleted file mode 100644 index f3249848d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FILE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/sub/a/b/sub_a_b.proto deleted file mode 100644 index 33d684be2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete/sub/a/b/sub_a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/buf.yaml deleted file mode 100644 index 9e34e4af7..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/buf.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -breaking: - use: - - FILE_NO_DELETE - ignore: - - a/c - - no_package.proto diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/sub/a/b/sub_a_b.proto deleted file mode 100644 index 33d684be2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_ignores/sub/a/b/sub_a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/a/v1beta1/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/a/v1beta1/a.proto deleted file mode 100644 index 0217e3a56..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/a/v1beta1/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/buf.yaml deleted file mode 100644 index 7029b018b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_no_delete_unstable/buf.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - ignore_unstable_packages: true diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/a.proto deleted file mode 100644 index 40d94c1b4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/buf.yaml deleted file mode 100644 index 8b85ab3f0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FILE_SAME_PACKAGE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/no_package.proto deleted file mode 100644 index 6b49d48d1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/no_package.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package c; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/sub/a/b/sub_a_b.proto deleted file mode 100644 index 33d684be2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_package/sub/a/b/sub_a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/buf.yaml deleted file mode 100644 index 0a7910420..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/buf.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -build: - roots: - - root -breaking: - use: - - FILE_SAME_SYNTAX diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/a.proto deleted file mode 100644 index 5c8aff5d4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto deleted file mode 100644 index e35a6e55f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -syntax = "proto2"; - -package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/1.proto deleted file mode 100644 index 2445aae69..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/1.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -option java_package = "bar"; -option java_outer_classname = "bar"; -option java_multiple_files = false; -option go_package = "bar"; -option objc_class_prefix = "bar"; -option csharp_namespace = "bar"; -option swift_prefix = "bar"; -option php_class_prefix = "bar"; -option php_namespace = "bar"; -option php_metadata_namespace = "bar"; -option ruby_package = "bar"; - -option java_string_check_utf8 = false; -option optimize_for = SPEED; -option cc_generic_services = false; -option java_generic_services = false; -option py_generic_services = false; -option php_generic_services = false; -option cc_enable_arenas = false; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/2.proto deleted file mode 100644 index 4e57ba6b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/2.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -option java_package = "bar"; -option java_outer_classname = "bar"; -option java_multiple_files = true; -option go_package = "bar"; -option objc_class_prefix = "bar"; -option csharp_namespace = "bar"; -option swift_prefix = "bar"; -option php_class_prefix = "bar"; -option php_namespace = "bar"; -option php_metadata_namespace = "bar"; -option ruby_package = "bar"; - -option java_string_check_utf8 = true; -option optimize_for = CODE_SIZE; -option cc_generic_services = true; -option java_generic_services = true; -option py_generic_services = true; -option php_generic_services = true; -option cc_enable_arenas = false; // the default option is true as of 3.12, so this should be changed now diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/buf.yaml deleted file mode 100644 index 66c5713f6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_file_same_values/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FILE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto deleted file mode 100644 index 0fb8fe775..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -message A {} - -enum AEnum { - A_ENUM_UNSPECIFIED = 0; -} - -service AService{} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/buf.yaml deleted file mode 100644 index deb1e7a08..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_delete_file/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -breaking: - use: - - PACKAGE - ignore_unstable_packages: true diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/1.proto deleted file mode 100644 index 5f1f13543..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/1.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/2.proto deleted file mode 100644 index c99c0a137..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/2.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/1.proto deleted file mode 100644 index bfebbeaa5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/1.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/2.proto deleted file mode 100644 index d4fc4ec69..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto deleted file mode 100644 index 33a6ef73d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto deleted file mode 100644 index da378038c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/1.proto deleted file mode 100644 index 70c17a8dd..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/1.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/2.proto deleted file mode 100644 index b536fac23..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/b/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/buf.yaml deleted file mode 100644 index 6895c500a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_false/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - ENUM_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/1.proto deleted file mode 100644 index 5f1f13543..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/1.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/2.proto deleted file mode 100644 index c99c0a137..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/2.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/1.proto deleted file mode 100644 index bfebbeaa5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/1.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/2.proto deleted file mode 100644 index d4fc4ec69..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto deleted file mode 100644 index 33a6ef73d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto deleted file mode 100644 index da378038c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/1.proto deleted file mode 100644 index 70c17a8dd..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/1.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -enum One { - ONE_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/2.proto deleted file mode 100644 index b536fac23..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/b/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/buf.yaml deleted file mode 100644 index 0929cab41..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_ignore_unstable_packages_true/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - ENUM_NO_DELETE - ignore_unstable_packages: true diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/1.proto deleted file mode 100644 index 17bca464a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/1.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo { - int32 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/2.proto deleted file mode 100644 index aebc22ed4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_int_enum/2.proto +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo2 { - Bar2 foo = 1; -} -enum Bar2 { - Blah = 0; -} - diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/1.proto deleted file mode 100644 index 5ec04926e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/1.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo { - Bar foo = 1; -} -enum Bar { - Blah = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/2.proto deleted file mode 100644 index 719db3c2b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_enum/2.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo2 { - Foo2 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/1.proto deleted file mode 100644 index 883854ba8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/1.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo { - Foo foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/2.proto deleted file mode 100644 index 9ee653d36..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_int/2.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo2 { - int32 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/1.proto deleted file mode 100644 index a6a575e30..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/1.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo { - Foo22 foo = 1; -} -message Foo22 { - int32 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/2.proto deleted file mode 100644 index 719db3c2b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_message/2.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo2 { - Foo2 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/1.proto deleted file mode 100644 index 262e5e8a7..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/1.proto +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One {} - -message Three { - message Four { - message Six {} - } - message Eight{} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/2.proto deleted file mode 100644 index 7a05834a9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/2.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 {} - -message Two2 {} - -message Three2 { - message Four2 { - message Five2 {} - message Six2 {} - } - message Seven2{} - message Eight2{} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/buf.yaml deleted file mode 100644 index 2add8600c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - MESSAGE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/1.proto deleted file mode 100644 index 336a4076a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/1.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - required string two = 2; -} - -message Two { - required string two = 2; -} - -message Three { - message Four { - message Five { - required string two = 2; - } - message Six { - // Six had a required field previously - } - } - message Seven { - required string two = 2; - } - message Eight { - // Eight had no previous required field - required string two = 2; - } - required string two = 2; -} - -message Nine { - // Nine is a new message so this should not end up being a breaking change. - required string one = 1; - required string two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/2.proto deleted file mode 100644 index 7e69d0f9c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/2.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One2 { - required string two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/buf.yaml deleted file mode 100644 index fe6ec8ae2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_required_fields/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - MESSAGE_SAME_REQUIRED_FIELDS diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/1.proto deleted file mode 100644 index c648b3d78..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/1.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - option message_set_wire_format = false; - option no_standard_descriptor_accessor = true; -} - -message Three { - message Four { - message Five { - option no_standard_descriptor_accessor = true; - } - message Six { - option message_set_wire_format = true; - extensions 4 to max; - } - } - message Seven { - option message_set_wire_format = false; - } - message Eight { - option message_set_wire_format = true; - extensions 4 to max; - } - option no_standard_descriptor_accessor = true; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/2.proto deleted file mode 100644 index a00cf9a42..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/2.proto +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One2 { - option no_standard_descriptor_accessor = true; -} - -message Two { - option no_standard_descriptor_accessor = true; -} - - -message Nine { - option message_set_wire_format = true; - extensions 4 to max; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/buf.yaml deleted file mode 100644 index 0a423e05d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_message_same_values/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - MESSAGE_NO_REMOVE_STANDARD_DESCRIPTOR_ACCESSOR - - MESSAGE_SAME_MESSAGE_SET_WIRE_FORMAT diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/1.proto deleted file mode 100644 index 6167faa34..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/1.proto +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three { - message Four { - message Five { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - } - message Seven { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/2.proto deleted file mode 100644 index f0246600f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/2.proto +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message One2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Two2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Three2 { - message Four2 { - message Five2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Six2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - } - message Seven2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Eight2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Nine2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Nine { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/buf.yaml deleted file mode 100644 index 040e21c43..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_oneof_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - ONEOF_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a1.proto deleted file mode 100644 index a2aa28186..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a1.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One {} - -service Foo {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a2.proto deleted file mode 100644 index 0ea5c8a16..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/a2.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } -} - -message Three { - message Four { - message Six {} - } - message Eight {} -} - -enum EnumTwo { - ENUM_TWO_UNSPECIFIED = 0; -} - -service Baz {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b1.proto deleted file mode 100644 index df61d48f1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b1.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -message One {} - -service Foo {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b2.proto deleted file mode 100644 index 2b8a72401..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/b2.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -message Two {} - -message Three { - message Four { - message Five { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } - } - message Six {} - } - message Seven { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } - } -} - -message Nine {} - -enum EnumTwo { - ENUM_TWO_UNSPECIFIED = 0; -} - -service Baz {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/buf.yaml deleted file mode 100644 index 2d95451e6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - PACKAGE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/1.proto deleted file mode 100644 index 1c850adbd..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/1.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message ARequest { - string key = 1; -} - -message AResponse { -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/2.proto deleted file mode 100644 index ce94d9aed..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/2.proto +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -service BService { - rpc BRPC(BRequest) returns (BResponse); -} - -message BRequest { - string key = 1; -} - -message BResponse { -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/buf.yaml deleted file mode 100644 index d33cefc7f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_package_service_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - PACKAGE_SERVICE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/1.proto deleted file mode 100644 index 15e659cac..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/1.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Two { - reserved 100 to 250; - reserved 300; - reserved "foo"; - TWO_UNSPECIFIED = 0; - TWO_ONE = 1; - TWO_TWO = 2; -} - -message Three { - message Four { - enum Five { - reserved 100 to 250; - reserved 300; - reserved "foo"; - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six { - reserved 3 to 5, 100 to 250; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - reserved 100 to 200; - reserved 300; - reserved "foo"; - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight { - reserved 3 to 5, 100 to 250; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/2.proto deleted file mode 100644 index 352843da3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/2.proto +++ /dev/null @@ -1,108 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum One2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - NINE2_UNSPECIFIED = 0; - NINE2_ONE = 1; - NINE2_TWO = 2; -} - -enum Nine { - reserved 100 to 200; - reserved 300; - reserved "foo"; - NINE_UNSPECIFIED = 0; - NINE_ONE = 1; - NINE_TWO = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/buf.yaml deleted file mode 100644 index 132ec83f2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_enum_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - RESERVED_ENUM_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/1.proto deleted file mode 100644 index e61042c13..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/1.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Two { - reserved 100 to 250; - reserved 300; - reserved "foo"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three { - message Four { - message Five { - reserved 100 to 250; - reserved 300; - reserved "foo"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six { - reserved 4 to 5, 100 to 250; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - reserved 100 to 250; - reserved 300; - reserved "foo"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight { - reserved 4 to 5, 100 to 250; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/2.proto deleted file mode 100644 index 964868a15..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/2.proto +++ /dev/null @@ -1,111 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message One2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - reserved 100 to 200; - reserved 300; - reserved "foo"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/buf.yaml deleted file mode 100644 index 88f046f31..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_reserved_message_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - RESERVED_MESSAGE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/1.proto deleted file mode 100644 index 6eda3f317..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/1.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Two { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/2.proto deleted file mode 100644 index 3317d5b3b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/2.proto +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service One { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service One2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service Two2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service Three2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service Three { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/buf.yaml deleted file mode 100644 index 0891c60fb..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - RPC_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/1.proto deleted file mode 100644 index 47614802e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/1.proto +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; - -service Two { - rpc Foo(stream google.protobuf.Any) returns (google.protobuf.Any) {} - rpc Bar(google.protobuf.Any) returns (stream google.protobuf.Any) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/2.proto deleted file mode 100644 index 50721e1ad..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/2.proto +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; - -service One { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service One2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Two2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Three2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Three { - rpc Foo(stream google.protobuf.Any) returns (google.protobuf.Any) {} - rpc Bar(google.protobuf.Any) returns (stream google.protobuf.Any) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service Four { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) { - option idempotency_level = NO_SIDE_EFFECTS; - } - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) { - option idempotency_level = IDEMPOTENT; - } -} - -service Four2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) { - option idempotency_level = NO_SIDE_EFFECTS; - } - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) { - option idempotency_level = IDEMPOTENT; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/buf.yaml deleted file mode 100644 index 385532543..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_rpc_same_values/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - except: - - SERVICE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/1.proto deleted file mode 100644 index 402950d2d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/1.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -service One {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/2.proto deleted file mode 100644 index 42bd1d112..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/2.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -service One2 {} -service Two2 {} -service Three2 {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/buf.yaml deleted file mode 100644 index df4ae8c39..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata/breaking_service_no_delete/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - SERVICE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/1.proto deleted file mode 100644 index 780bbd079..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/1.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/2.proto deleted file mode 100644 index 4037ecdd9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_no_delete/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/1.proto deleted file mode 100644 index 1bdffec89..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/1.proto +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum Two { - TWO_UNSPECIFIED = 0; - TWO_ONE = 1; - TWO_TWO = 2; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - NINE_UNSPECIFIED = 0; - NINE_ONE = 1; - NINE_TWO = 2; -} - -enum Ten { - option allow_alias = true; - TEN_UNSPECIFIED = 0; - TEN_ONE = 1; - TEN_TWO = 1; -} - -enum Eleven { - option allow_alias = true; - ELEVEN_UNSPECIFIED = 0; - ELEVEN_ONE = 1; - ELEVEN_TWO = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/2.proto deleted file mode 100644 index d66dd2150..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete/2.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One2 { - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/1.proto deleted file mode 100644 index 1bdffec89..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/1.proto +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum Two { - TWO_UNSPECIFIED = 0; - TWO_ONE = 1; - TWO_TWO = 2; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - NINE_UNSPECIFIED = 0; - NINE_ONE = 1; - NINE_TWO = 2; -} - -enum Ten { - option allow_alias = true; - TEN_UNSPECIFIED = 0; - TEN_ONE = 1; - TEN_TWO = 1; -} - -enum Eleven { - option allow_alias = true; - ELEVEN_UNSPECIFIED = 0; - ELEVEN_ONE = 1; - ELEVEN_TWO = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/2.proto deleted file mode 100644 index d66dd2150..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_name_reserved/2.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One2 { - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/1.proto deleted file mode 100644 index 1bdffec89..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/1.proto +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum Two { - TWO_UNSPECIFIED = 0; - TWO_ONE = 1; - TWO_TWO = 2; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - NINE_UNSPECIFIED = 0; - NINE_ONE = 1; - NINE_TWO = 2; -} - -enum Ten { - option allow_alias = true; - TEN_UNSPECIFIED = 0; - TEN_ONE = 1; - TEN_TWO = 1; -} - -enum Eleven { - option allow_alias = true; - ELEVEN_UNSPECIFIED = 0; - ELEVEN_ONE = 1; - ELEVEN_TWO = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/2.proto deleted file mode 100644 index d66dd2150..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_no_delete_unless_number_reserved/2.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One2 { - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/1.proto deleted file mode 100644 index 5b6dbe7cf..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/1.proto +++ /dev/null @@ -1,82 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum Two { - TWO_UNSPECIFIED = 0; - TWO_ONE = 1; - TWO_TWO = 2; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - NINE_UNSPECIFIED = 0; - NINE_ONE = 1; - NINE_TWO = 2; -} - -enum Ten { - option allow_alias = true; - TEN_UNSPECIFIED = 0; - TEN_ONE = 1; - TEN_TWO = 1; -} - -enum Eleven { - option allow_alias = true; - ELEVEN_UNSPECIFIED = 0; - ELEVEN_ONE = 1; - ELEVEN_TWO = 1; -} - -enum Twelve { - option allow_alias = true; - TWELVE_UNSPECIFIED = 0; - TWELVE_ONE = 1; - TWELVE_TWO = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/2.proto deleted file mode 100644 index d66dd2150..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_enum_value_same_name/2.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One2 { - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/1.proto deleted file mode 100644 index 4b8194c2a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/1.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Two { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Three { - message Four { - message Five { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - message Six { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - } - message Seven { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - message Eight { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Nine { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/2.proto deleted file mode 100644 index 11b0b98e4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_extension_message_no_delete/2.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Two2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - message Six2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - } - message Seven2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - message Eight2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; - } - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} - -message Nine2 { - extensions 4 to 5, 100 to 200; - extensions 300, 301, 1000 to max; - optional int32 one = 1; - optional int32 two = 2; - optional int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/1.proto deleted file mode 100644 index bc03a4574..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/1.proto +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three { - message Four { - message Five { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/2.proto deleted file mode 100644 index 175f09490..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete/2.proto +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/1.proto deleted file mode 100644 index bc03a4574..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/1.proto +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three { - message Four { - message Five { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/2.proto deleted file mode 100644 index 175f09490..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_name_reserved/2.proto +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/1.proto deleted file mode 100644 index 10614b6ea..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/1.proto +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three { - message Four { - message Five { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Ten { - int32 one = 1; - int32 two = 2; - int32 three = 3; - int32 four = 4; - int32 five = 5; - int32 six = 6; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/2.proto deleted file mode 100644 index 175f09490..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_no_delete_unless_number_reserved/2.proto +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/1.proto deleted file mode 100644 index 42f95aa74..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/1.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - string one = 1 [ctype = STRING]; - string two = 2 [ctype = CORD]; -} - -message Two { - string one = 1 [ctype = STRING]; - string two = 2 [ctype = CORD]; -} - -message Three { - message Four { - message Five { - string one = 1 [ctype = STRING]; - string two = 2 [ctype = CORD]; - } - message Six { - string one = 1; - string two = 2; - } - } - message Seven { - string one = 1; - string two = 2; - } - message Eight { - string one = 1; - string two = 2; - } - string one = 1; - string two = 2; -} - -message Nine { - string one = 1 [ctype = STRING]; - string two = 2 [ctype = CORD]; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/2.proto deleted file mode 100644 index b87daa586..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_ctype/2.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One2 { - optional string one = 1 [ctype = STRING_PIECE]; - required string two = 2 [ctype = CORD]; -} - -message Two2 { - optional string one = 1 [ctype = STRING_PIECE]; - required string two = 2 [ctype = CORD]; -} - -message Three2 { - message Four2 { - message Five2 { - optional string one = 1 [ctype = STRING_PIECE]; - required string two = 2 [ctype = CORD]; - } - message Six2 { - optional string one = 1; - required string two = 2; - } - } - message Seven2 { - optional string one = 1; - required string two = 2; - } - message Eight2 { - optional string one = 1; - required string two = 2; - } - optional string one = 1; - required string two = 2; -} - -message Nine2 { - optional string one = 1 [ctype = STRING_PIECE]; - required string two = 2 [ctype = CORD]; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/1.proto deleted file mode 100644 index 478a020c6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/1.proto +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; -} - -message Two { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; -} - -message Three { - message Four { - message Five { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "2" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "3" ]; - map nine = 9; - } - message Six { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - } - message Seven { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - message Eight { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } -} - -message Nine { - oneof foo { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/2.proto deleted file mode 100644 index bc0dbb37e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_json_name/2.proto +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; -} - -message Two2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - message Six2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - } - message Seven2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } - message Eight2 { - int32 one = 1 [json_name = "foo"]; - int32 two = 2 [json_name = "" ]; - int32 three = 3; - repeated int32 four = 4 [json_name = "bar"]; - repeated int32 five = 5 [json_name = "1" ]; - repeated int32 six = 6; - map seven = 7 [json_name = "baz"]; - map eight = 8 [json_name = "2" ]; - map nine = 9; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/1.proto deleted file mode 100644 index 2ea099090..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/1.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int64 one = 1 [jstype = JS_NORMAL]; - int64 two = 2 [jstype = JS_STRING]; -} - -message Two { - int64 one = 1 [jstype = JS_NORMAL]; - int64 two = 2 [jstype = JS_STRING]; -} - -message Three { - message Four { - message Five { - int64 one = 1 [jstype = JS_NORMAL]; - int64 two = 2 [jstype = JS_STRING]; - } - message Six { - int64 one = 1; - int64 two = 2; - } - } - message Seven { - int64 one = 1; - int64 two = 2; - } - message Eight { - int64 one = 1; - int64 two = 2; - } - int64 one = 1; - int64 two = 2; -} - -message Nine { - int64 one = 1 [jstype = JS_NORMAL]; - int64 two = 2 [jstype = JS_STRING]; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/2.proto deleted file mode 100644 index 5bdda7fd3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_jstype/2.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One2 { - optional int64 one = 1 [jstype = JS_NUMBER]; - required int64 two = 2 [jstype = JS_STRING]; -} - -message Two2 { - optional int64 one = 1 [jstype = JS_NUMBER]; - required int64 two = 2 [jstype = JS_STRING]; -} - -message Three2 { - message Four2 { - message Five2 { - optional int64 one = 1 [jstype = JS_NUMBER]; - required int64 two = 2 [jstype = JS_STRING]; - } - message Six2 { - optional int64 one = 1; - required int64 two = 2; - } - } - message Seven2 { - optional int64 one = 1; - required int64 two = 2; - } - message Eight2 { - optional int64 one = 1; - required int64 two = 2; - } - optional int64 one = 1; - required int64 two = 2; -} - -message Nine2 { - optional int64 one = 1 [jstype = JS_NUMBER]; - required int64 two = 2 [jstype = JS_STRING]; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/1.proto deleted file mode 100644 index 06e31afdb..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/1.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; -} - -message Two { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; -} - -message Three { - message Four { - message Five { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } - message Six { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } - } - message Seven { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } - message Eight { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } -} - -message Nine { - oneof foo { - int32 one = 1; - One two = 2; - } -} - -message Ten { - int64 one = 1; - int64 two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/2.proto deleted file mode 100644 index ab243f751..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_label/2.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -import "1.proto"; - -message One2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message Two2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message Three2 { - message Four2 { - message Five2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - message Six2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - } - message Seven2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - message Eight2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } -} - -message Nine2 { - oneof foo { - int32 one = 1; - One two = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/1.proto deleted file mode 100644 index bc03a4574..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/1.proto +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three { - message Four { - message Five { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/2.proto deleted file mode 100644 index 175f09490..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_name/2.proto +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/1.proto deleted file mode 100644 index 88fe3bb3d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/1.proto +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Two { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Three { - message Four { - message Five { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - message Six { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - } - message Seven { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - message Eight { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Nine { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/2.proto deleted file mode 100644 index 55e5c2238..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_oneof/2.proto +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Two2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - message Six2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - } - message Seven2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - message Eight2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; - } - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} - -message Nine2 { - oneof foo { - int32 one = 1; - } - oneof bar { - int32 two = 2; - } - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/1.proto deleted file mode 100644 index 06e31afdb..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/1.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; -} - -message Two { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; -} - -message Three { - message Four { - message Five { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } - message Six { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } - } - message Seven { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } - message Eight { - int32 one = 1; - One two = 2; - repeated int32 three = 3; - repeated One four = 4; - map five = 5; - map six = 6; - } -} - -message Nine { - oneof foo { - int32 one = 1; - One two = 2; - } -} - -message Ten { - int64 one = 1; - int64 two = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/2.proto deleted file mode 100644 index ab243f751..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_same_type/2.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -import "1.proto"; - -message One2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message Two2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; -} - -message Three2 { - message Four2 { - message Five2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - message Six2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - } - message Seven2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } - message Eight2 { - optional int32 one = 1; - optional One two = 2; - repeated int32 three = 3; - repeated One four = 4; - } -} - -message Nine2 { - oneof foo { - int32 one = 1; - One two = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_compatible_type/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_compatible_type/1.proto deleted file mode 100644 index 2065be76d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_compatible_type/1.proto +++ /dev/null @@ -1,100 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message CompatiblePrimitives { - int32 int32_field_1 = 1; - uint32 uint32_field_1 = 2; - int64 int64_field_1 = 3; - uint64 uint64_field_1 = 4; - bool bool_field_1 = 5; - - sint32 sint32_field_1 = 6; - sint64 sint64_field_1 = 7; - - fixed32 fixed32_field_1 = 8; - sfixed32 sfixed32_field_1 = 9; - - fixed64 fixed64_field_1 = 10; - sfixed64 sfixed64_field_1 = 11; - - string string_field_1 = 12; - - bytes bytes_field_1 = 14; - - float float_field_1 = 15; - - double double_field_1 = 16; -} - -message IncompatiblePrimitives { - int32 int32_field_1 = 1; - uint32 uint32_field_1 = 2; - int64 int64_field_1 = 3; - uint64 uint64_field_1 = 4; - bool bool_field_1 = 5; - sint32 sint32_field_1 = 6; - sint64 sint64_field_1 = 7; - fixed32 fixed32_field_1 = 8; - sfixed32 sfixed32_field_1 = 9; - fixed64 fixed64_field_1 = 10; - sfixed64 sfixed64_field_1 = 11; - string string_field_1 = 12; - bytes bytes_field_1 = 14; - float float_field_1 = 15; - double double_field_1 = 16; -} - - -enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; -} - -message WithCompatibleEnums { - enum Baz { - BAZ_UNSPECIFIED = 0; - BAZ_ONE = 1; - } - Foo foo = 1; - Baz baz = 2; -} - -enum Bar { - BAR_UNSPECIFIED = 0; - BAR_ONE = 1; -} - -message WithIncompatibleEnums { - enum Bat { - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - } - enum Bam { - BAM_UNSPECIFIED = 0; - BAM_ONE = 1; - } - Bar bar = 1; - Bat bat = 2; - Bam bam = 3; -} - -message StringBytes { - string string_field_1 = 1; - bytes bytes_field_1 = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_json_compatible_type/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_json_compatible_type/1.proto deleted file mode 100644 index 88b595e73..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_field_wire_json_compatible_type/1.proto +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message CompatiblePrimitives { - int32 int32_field_1 = 1; - uint32 uint32_field_1 = 2; - - int64 int64_field_1 = 3; - uint64 uint64_field_1 = 4; - - fixed32 fixed32_field_1 = 5; - sfixed32 sfixed32_field_1 = 6; - - fixed64 fixed64_field_1 = 7; - sfixed64 sfixed64_field_1 = 8; - - bool bool_field_1 = 9; - - sint32 sint32_field_1 = 10; - - sint64 sint64_field_1 = 11; - - string string_field_1 = 12; - - bytes bytes_field_1 = 14; - - float float_field_1 = 15; - - double double_field_1 = 16; -} - -message IncompatiblePrimitives { - int32 int32_field_1 = 1; - uint32 uint32_field_1 = 2; - int64 int64_field_1 = 3; - uint64 uint64_field_1 = 4; - bool bool_field_1 = 5; - sint32 sint32_field_1 = 6; - sint64 sint64_field_1 = 7; - fixed32 fixed32_field_1 = 8; - sfixed32 sfixed32_field_1 = 9; - fixed64 fixed64_field_1 = 10; - sfixed64 sfixed64_field_1 = 11; - string string_field_1 = 12; - bytes bytes_field_1 = 14; - float float_field_1 = 15; - double double_field_1 = 16; -} - - -enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; -} - -message WithCompatibleEnums { - enum Baz { - BAZ_UNSPECIFIED = 0; - BAZ_ONE = 1; - } - Foo foo = 1; - Baz baz = 2; -} - -enum Bar { - BAR_UNSPECIFIED = 0; - BAR_ONE = 1; -} - -message WithIncompatibleEnums { - enum Bat { - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - } - enum Bam { - BAM_UNSPECIFIED = 0; - BAM_ONE = 1; - } - Bar bar = 1; - Bat bat = 2; - Bam bam = 3; -} - -message StringBytes { - string string_field_1 = 1; - bytes bytes_field_1 = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/buf.yaml deleted file mode 100644 index 2c12c4d93..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/buf.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -build: - roots: - - root diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/a.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/sub/a/b/sub_a_b.proto deleted file mode 100644 index 33d684be2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete/root/sub/a/b/sub_a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/buf.yaml deleted file mode 100644 index 2c12c4d93..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/buf.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -build: - roots: - - root diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/a.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/c/c.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/c/c.proto deleted file mode 100644 index 6b49d48d1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/a/c/c.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package c; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/sub/a/b/sub_a_b.proto deleted file mode 100644 index 33d684be2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_ignores/root/sub/a/b/sub_a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/a.proto deleted file mode 100644 index 0217e3a56..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/b.proto deleted file mode 100644 index 0217e3a56..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_no_delete_unstable/a/v1beta1/b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/buf.yaml deleted file mode 100644 index 2c12c4d93..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/buf.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -build: - roots: - - root diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/a.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/sub/a/b/sub_a_b.proto deleted file mode 100644 index 33d684be2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_package/root/sub/a/b/sub_a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/buf.yaml deleted file mode 100644 index 2c12c4d93..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/buf.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -build: - roots: - - root diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/a.proto deleted file mode 100644 index 5c8aff5d4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/no_package.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/no_package.proto deleted file mode 100644 index ad4c1fe28..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto deleted file mode 100644 index 33d684be2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_syntax/root/sub/a/b/sub_a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub.a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/1.proto deleted file mode 100644 index 8ee38a6d6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/1.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -option java_package = "foo"; -option java_outer_classname = "foo"; -option java_multiple_files = true; -option go_package = "foo"; -option objc_class_prefix = "foo"; -option csharp_namespace = "foo"; -option swift_prefix = "foo"; -option php_class_prefix = "foo"; -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; -option ruby_package = "foo"; - -option java_string_check_utf8 = true; -option optimize_for = CODE_SIZE; -option cc_generic_services = true; -option java_generic_services = true; -option py_generic_services = true; -option php_generic_services = true; -option cc_enable_arenas = true; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/2.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_file_same_values/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto deleted file mode 100644 index 0fb8fe775..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/a.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -message A {} - -enum AEnum { - A_ENUM_UNSPECIFIED = 0; -} - -service AService{} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/b.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/b.proto deleted file mode 100644 index be609910a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_delete_file/a/v1beta1/b.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -message B {} - -enum BEnum { - B_ENUM_UNSPECIFIED = 0; -} - -service BService{} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/1.proto deleted file mode 100644 index bfd860826..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/1.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/2.proto deleted file mode 100644 index c99c0a137..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/2.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/1.proto deleted file mode 100644 index 2343e8e47..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/1.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/2.proto deleted file mode 100644 index d4fc4ec69..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto deleted file mode 100644 index 67d7e3d33..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/1.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto deleted file mode 100644 index da378038c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/a/v1beta1/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/1.proto deleted file mode 100644 index 2a5a09c50..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/1.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/2.proto deleted file mode 100644 index b536fac23..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_false/b/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/1.proto deleted file mode 100644 index bfd860826..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/1.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/2.proto deleted file mode 100644 index c99c0a137..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/2.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/1.proto deleted file mode 100644 index 2343e8e47..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/1.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/2.proto deleted file mode 100644 index d4fc4ec69..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto deleted file mode 100644 index 67d7e3d33..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/1.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto deleted file mode 100644 index da378038c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/a/v1beta1/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1beta1; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/1.proto deleted file mode 100644 index 2a5a09c50..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/1.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -enum One { - ONE_UNSPECIFIED = 0; -} - -enum Two { - TWO_UNSPECIFIED = 0; -} - -message Three { - message Four { - enum Five { - FIVE_UNSPECIFIED = 0; - } - enum Six { - SIX_UNSPECIFIED = 0; - } - } - enum Seven { - SEVEN_UNSPECIFIED = 0; - } - enum Eight { - EIGHT_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/2.proto deleted file mode 100644 index b536fac23..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_ignore_unstable_packages_true/b/2.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -enum One2 { - ONE_2_UNSPECIFIED = 0; -} - -enum Two2 { - TWO_2_UNSPECIFIED = 0; -} - -message Three2 { - message Four2 { - enum Five2 { - FIVE_2_UNSPECIFIED = 0; - } - enum Six2 { - SIX_2_UNSPECIFIED = 0; - } - } - enum Seven2 { - SEVEN_2_UNSPECIFIED = 0; - } - enum Eight2 { - EIGHT_2_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/1.proto deleted file mode 100644 index 5ec04926e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/1.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo { - Bar foo = 1; -} -enum Bar { - Blah = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/2.proto deleted file mode 100644 index 9ee653d36..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_int_enum/2.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo2 { - int32 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/1.proto deleted file mode 100644 index 883854ba8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/1.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo { - Foo foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/2.proto deleted file mode 100644 index dc4eb14d2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_enum/2.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo2 { - Bar2 foo = 1; -} -enum Bar2 { - Blah = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/1.proto deleted file mode 100644 index 17bca464a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/1.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo { - int32 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/2.proto deleted file mode 100644 index 719db3c2b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_int/2.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo2 { - Foo2 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/1.proto deleted file mode 100644 index 883854ba8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/1.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo { - Foo foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/2.proto deleted file mode 100644 index 14bd25ed9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_message/2.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Foo2 { - Foo22 foo = 1; -} -message Foo22 { - int32 foo = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/1.proto deleted file mode 100644 index eadfc026d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/1.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One {} - -message Two {} - -message Three { - message Four { - message Five {} - message Six {} - } - message Seven{} - message Eight{} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/2.proto deleted file mode 100644 index 7a05834a9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_no_delete/2.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 {} - -message Two2 {} - -message Three2 { - message Four2 { - message Five2 {} - message Six2 {} - } - message Seven2{} - message Eight2{} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/1.proto deleted file mode 100644 index f0b8ebefd..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/1.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - required string one = 1; -} - -message Three { - message Four { - message Five { - required string one = 1; - } - message Six { - required string one = 1; - } - } - message Seven { - required string one = 1; - } - message Eight {} - required string one = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/2.proto deleted file mode 100644 index 14eabea78..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_required_fields/2.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One2 { - required string one = 1; -} - -message Two { - required string one = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/1.proto deleted file mode 100644 index ad82ac119..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/1.proto +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - option message_set_wire_format = true; - option no_standard_descriptor_accessor = false; - extensions 4 to max; -} - -message Two { - option message_set_wire_format = true; - extensions 4 to max; -} - -message Three { - message Four { - message Five { - option message_set_wire_format = true; - option no_standard_descriptor_accessor = false; - extensions 4 to max; - } - message Six {} - } - message Seven { - option message_set_wire_format = true; - option no_standard_descriptor_accessor = false; - extensions 4 to max; - } - message Eight {} - option message_set_wire_format = true; - extensions 4 to max; -} - -message Nine { - option message_set_wire_format = true; - extensions 4 to max; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/2.proto deleted file mode 100644 index 454df8dd9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_message_same_values/2.proto +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One2 { - option message_set_wire_format = true; - extensions 4 to max; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/1.proto deleted file mode 100644 index 3fc1e3e0a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/1.proto +++ /dev/null @@ -1,80 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Two { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Three { - message Four { - message Five { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Six { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - } - message Seven { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Eight { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Nine { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/2.proto deleted file mode 100644 index 1ee57d53f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_oneof_no_delete/2.proto +++ /dev/null @@ -1,80 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Two2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Three2 { - message Four2 { - message Five2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Six2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - } - message Seven2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Eight2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} - -message Nine2 { - oneof foo { - int32 one = 1; - int32 two = 2; - int32 three = 3; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/a1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/a1.proto deleted file mode 100644 index 6f685a2ce..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/a1.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One {} - -message Two { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } -} - -message Three { - message Four { - message Five { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } - } - message Six {} - } - message Seven { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } - } - message Eight {} -} - -message Nine {} - -enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; -} - -enum EnumTwo { - ENUM_TWO_UNSPECIFIED = 0; -} - -service Foo {} -service Bar {} -service Baz {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/b1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/b1.proto deleted file mode 100644 index d6bc11894..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/b1.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -message One {} - -message Two { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } -} - -message Three { - message Four { - message Five { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } - } - message Six {} - } - message Seven { - enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; - } - } - message Eight {} -} - -message Nine {} - -enum EnumOne { - ENUM_ONE_UNSPECIFIED = 0; -} - -enum EnumTwo { - ENUM_TWO_UNSPECIFIED = 0; -} - -service Foo {} -service Bar {} -service Baz {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/buf.yaml deleted file mode 100644 index 73c7103dc..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/buf.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - FILE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/c.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/c.proto deleted file mode 100644 index 6b49d48d1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_no_delete/c.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package c; diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/1.proto deleted file mode 100644 index d7c722ec8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/1.proto +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -service AService { - rpc ARPC(ARequest) returns (AResponse); -} - -message ARequest { - string key = 1; -} - -message AResponse { -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/2.proto deleted file mode 100644 index ce94d9aed..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/2.proto +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -service BService { - rpc BRPC(BRequest) returns (BResponse); -} - -message BRequest { - string key = 1; -} - -message BResponse { -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/buf.yaml b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/buf.yaml deleted file mode 100644 index 19b6c3e07..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_package_service_no_delete/buf.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -breaking: - use: - - PACKAGE_SERVICE_NO_DELETE diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/1.proto deleted file mode 100644 index 8402c5ae4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/1.proto +++ /dev/null @@ -1,89 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - ONE_UNSPECIFIED = 0; - ONE_ONE = 1; - ONE_TWO = 2; -} - -enum Two { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - TWO_UNSPECIFIED = 0; - TWO_ONE = 1; - TWO_TWO = 2; -} - -message Three { - message Four { - enum Five { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - NINE_UNSPECIFIED = 0; - NINE_ONE = 1; - NINE_TWO = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/2.proto deleted file mode 100644 index 5696ded4a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_enum_no_delete/2.proto +++ /dev/null @@ -1,89 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum One2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - ONE2_UNSPECIFIED = 0; - ONE2_ONE = 1; - ONE2_TWO = 2; -} - -enum Two2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - TWO2_UNSPECIFIED = 0; - TWO2_ONE = 1; - TWO2_TWO = 2; -} - -message Three2 { - message Four2 { - enum Five2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - FIVE_UNSPECIFIED = 0; - FIVE_ONE = 1; - FIVE_TWO = 2; - } - enum Six2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - SIX_UNSPECIFIED = 0; - SIX_ONE = 1; - SIX_TWO = 2; - } - } - enum Seven2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - SEVEN_UNSPECIFIED = 0; - SEVEN_ONE = 1; - SEVEN_TWO = 2; - } - enum Eight2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - EIGHT_UNSPECIFIED = 0; - EIGHT_ONE = 1; - EIGHT_TWO = 2; - } -} - -enum Nine2 { - reserved 3 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - NINE2_UNSPECIFIED = 0; - NINE2_ONE = 1; - NINE2_TWO = 2; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/1.proto deleted file mode 100644 index bd230f670..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/1.proto +++ /dev/null @@ -1,92 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three { - message Four { - message Five { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/2.proto deleted file mode 100644 index 333cf83ca..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_reserved_message_no_delete/2.proto +++ /dev/null @@ -1,92 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Two2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Three2 { - message Four2 { - message Five2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Six2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - } - message Seven2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - message Eight2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; - } - int32 one = 1; - int32 two = 2; - int32 three = 3; -} - -message Nine2 { - reserved 4 to 5, 100 to 200; - reserved 300, 301, 1000 to max; - reserved "foo", "bar"; - reserved "baz"; - int32 one = 1; - int32 two = 2; - int32 three = 3; -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/1.proto deleted file mode 100644 index e60e1610a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/1.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service One { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service Two { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service Three { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/2.proto deleted file mode 100644 index 27c04e5be..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_no_delete/2.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service One2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service Two2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -service Three2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/1.proto deleted file mode 100644 index db2aad85b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/1.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service One { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Two { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Three { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Four { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) { - option idempotency_level = IDEMPOTENCY_UNKNOWN; - } - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) { - option idempotency_level = NO_SIDE_EFFECTS; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/2.proto deleted file mode 100644 index fa1cbcc7f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_rpc_same_values/2.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service One2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Two2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Three2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Baz(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bat(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} - -service Four2 { - rpc Foo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty) { - option idempotency_level = IDEMPOTENCY_UNKNOWN; - } - rpc Baz(google.protobuf.Empty) returns (google.protobuf.Empty) { - option idempotency_level = NO_SIDE_EFFECTS; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/1.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/1.proto deleted file mode 100644 index 349b2ed6a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/1.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -service One {} -service Two {} -service Three {} diff --git a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/2.proto b/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/2.proto deleted file mode 100644 index 42bd1d112..000000000 --- a/pkg/bufman/bufpkg/bufcheck/bufbreaking/testdata_previous/breaking_service_no_delete/2.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -service One2 {} -service Two2 {} -service Three2 {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/buflint_test.go b/pkg/bufman/bufpkg/bufcheck/buflint/buflint_test.go deleted file mode 100644 index 3262d5efd..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/buflint_test.go +++ /dev/null @@ -1,1015 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package buflint_test - -import ( - "context" - "path/filepath" - "testing" - "time" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis/bufanalysistesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -// Hint on how to get these: -// 1. cd into the specific directory -// 2. buf lint --error-format=json | jq '[.path, .start_line, .start_column, .end_line, .end_column, .type] | @csv' --raw-output -// or -// buf lint --error-format=json | jq -r '"bufanalysistesting.NewFileAnnotation(t, \"\(.path)\", \(.start_line|tostring), \(.start_column|tostring), \(.end_line|tostring), \(.end_column|tostring), \"\(.type)\"),"' - -func TestRunComments(t *testing.T) { - t.Parallel() - testLint( - t, - "comments", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 10, 2, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 3, 8, 28, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 3, 9, 20, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 1, 37, 2, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 3, 28, 4, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 14, 5, 17, 6, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 7, 15, 27, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 7, 16, 19, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 5, 23, 6, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 7, 19, 21, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 7, 22, 8, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 9, 21, 23, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 5, 24, 19, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 5, 27, 6, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 26, 7, 26, 21, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 32, 4, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 5, 30, 25, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 31, 5, 31, 17, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 33, 3, 33, 17, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 3, 36, 4, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 5, 35, 19, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 1, 41, 2, "COMMENT_SERVICE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 3, 40, 74, "COMMENT_RPC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 104, 1, 107, 2, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 105, 3, 105, 29, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 106, 3, 106, 21, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 109, 1, 134, 2, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 110, 3, 125, 4, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 111, 5, 114, 6, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 112, 7, 112, 27, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 113, 7, 113, 19, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 115, 5, 120, 6, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 116, 7, 116, 21, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 117, 7, 119, 8, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 118, 9, 118, 23, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 121, 5, 121, 19, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 122, 5, 124, 6, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 123, 7, 123, 21, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 126, 3, 129, 4, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 127, 5, 127, 25, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 128, 5, 128, 17, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 130, 3, 130, 17, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 131, 3, 133, 4, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 132, 5, 132, 19, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 136, 1, 139, 2, "COMMENT_SERVICE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 137, 3, 137, 74, "COMMENT_RPC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 138, 3, 138, 72, "COMMENT_RPC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 142, 1, 147, 2, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 144, 3, 144, 29, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 146, 3, 146, 21, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 150, 1, 192, 2, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 152, 3, 177, 4, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 154, 5, 159, 6, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 156, 7, 156, 27, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 158, 7, 158, 19, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 161, 5, 169, 6, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 163, 7, 163, 21, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 165, 7, 168, 8, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 167, 9, 167, 23, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 171, 5, 171, 19, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 173, 5, 176, 6, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 175, 7, 175, 21, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 179, 3, 184, 4, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 181, 5, 181, 25, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 183, 5, 183, 17, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 186, 3, 186, 17, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 188, 3, 191, 4, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 190, 5, 190, 19, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 195, 1, 200, 2, "COMMENT_SERVICE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 197, 3, 197, 74, "COMMENT_RPC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 199, 3, 199, 72, "COMMENT_RPC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 203, 1, 208, 2, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 205, 3, 205, 29, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 207, 3, 207, 21, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 211, 1, 253, 2, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 213, 3, 238, 4, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 215, 5, 220, 6, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 217, 7, 217, 27, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 219, 7, 219, 19, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 222, 5, 230, 6, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 224, 7, 224, 21, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 226, 7, 229, 8, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 228, 9, 228, 23, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 232, 5, 232, 19, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 234, 5, 237, 6, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 236, 7, 236, 21, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 240, 3, 245, 4, "COMMENT_ENUM"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 242, 5, 242, 25, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 244, 5, 244, 17, "COMMENT_ENUM_VALUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 247, 3, 247, 17, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 249, 3, 252, 4, "COMMENT_ONEOF"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 251, 5, 251, 19, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 256, 1, 261, 2, "COMMENT_SERVICE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 258, 3, 258, 74, "COMMENT_RPC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 260, 3, 260, 72, "COMMENT_RPC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 263, 1, 265, 2, "COMMENT_MESSAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 264, 3, 264, 30, "COMMENT_FIELD"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 273, 3, 273, 72, "COMMENT_RPC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 277, 3, 277, 72, "COMMENT_RPC"), - ) -} - -func TestRunDirectorySamePackage(t *testing.T) { - t.Parallel() - testLint( - t, - "directory_same_package", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 3, 1, 3, 11, "DIRECTORY_SAME_PACKAGE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "no_package.proto", "DIRECTORY_SAME_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "one/c.proto", 3, 1, 3, 11, "DIRECTORY_SAME_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "one/d.proto", 3, 1, 3, 11, "DIRECTORY_SAME_PACKAGE"), - ) -} - -func TestRunImportNoPublic(t *testing.T) { - t.Parallel() - testLint( - t, - "import_no_public", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 6, 1, 6, 32, "IMPORT_NO_PUBLIC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 7, 31, "IMPORT_NO_PUBLIC"), - bufanalysistesting.NewFileAnnotation(t, "one/one.proto", 6, 1, 6, 32, "IMPORT_NO_PUBLIC"), - ) -} - -func TestRunImportNoWeak(t *testing.T) { - t.Parallel() - testLint( - t, - "import_no_weak", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 6, 1, 6, 30, "IMPORT_NO_WEAK"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 7, 29, "IMPORT_NO_WEAK"), - bufanalysistesting.NewFileAnnotation(t, "one/one.proto", 6, 1, 6, 30, "IMPORT_NO_WEAK"), - ) -} - -func TestRunImportUsed(t *testing.T) { - t.Parallel() - testLint( - t, - "import_used", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 5, 1, 5, 25, "IMPORT_USED"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 7, 24, "IMPORT_USED"), - bufanalysistesting.NewFileAnnotation(t, "one/one.proto", 6, 1, 6, 25, "IMPORT_USED"), - ) -} - -func TestRunEnumFirstValueZero(t *testing.T) { - t.Parallel() - testLint( - t, - "enum_first_value_zero", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 13, 12, 14, "ENUM_FIRST_VALUE_ZERO"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 13, 18, 14, "ENUM_FIRST_VALUE_ZERO"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 38, 17, 38, 18, "ENUM_FIRST_VALUE_ZERO"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 17, 44, 18, "ENUM_FIRST_VALUE_ZERO"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 62, 15, 62, 16, "ENUM_FIRST_VALUE_ZERO"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 68, 15, 68, 16, "ENUM_FIRST_VALUE_ZERO"), - ) -} - -func TestRunEnumNoAllowAlias(t *testing.T) { - t.Parallel() - testLint( - t, - "enum_no_allow_alias", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 3, 12, 29, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 3, 19, 29, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 7, 41, 33, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 48, 7, 48, 33, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 68, 5, 68, 31, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 5, 75, 31, "ENUM_NO_ALLOW_ALIAS"), - ) -} - -func TestRunEnumPascalCase(t *testing.T) { - t.Parallel() - testLint( - t, - "enum_pascal_case", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 6, 16, 10, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 6, 19, 13, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 6, 22, 16, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 6, 25, 15, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 42, 10, 42, 14, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 45, 10, 45, 17, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 48, 10, 48, 20, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 51, 10, 51, 19, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 66, 8, 66, 12, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 69, 8, 69, 15, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 8, 72, 18, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 8, 75, 17, "ENUM_PASCAL_CASE"), - ) -} - -func TestRunEnumValuePrefix(t *testing.T) { - t.Parallel() - testLint( - t, - "enum_value_prefix", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 3, 10, 12, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 3, 11, 14, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 3, 12, 15, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 7, 22, 17, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 7, 23, 19, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 7, 24, 20, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 7, 25, 20, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 33, 5, 33, 15, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 5, 34, 17, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 5, 35, 18, "ENUM_VALUE_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 36, 5, 36, 18, "ENUM_VALUE_PREFIX"), - ) -} - -func TestRunEnumValueUpperSnakeCase(t *testing.T) { - t.Parallel() - testLint( - t, - "enum_value_upper_snake_case", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 3, 10, 12, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 3, 11, 17, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 3, 12, 14, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 7, 23, 16, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 7, 24, 21, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 7, 25, 18, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 5, 34, 14, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 5, 35, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 36, 5, 36, 16, "ENUM_VALUE_UPPER_SNAKE_CASE"), - ) -} - -func TestRunEnumZeroValueSuffix(t *testing.T) { - t.Parallel() - testLint( - t, - "enum_zero_value_suffix", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 14, 3, 14, 18, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 3, 18, 23, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 19, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 36, 7, 36, 22, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 7, 40, 27, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 7, 44, 23, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 56, 5, 56, 20, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 60, 5, 60, 25, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 5, 64, 21, "ENUM_ZERO_VALUE_SUFFIX"), - ) -} - -func TestRunEnumZeroValueSuffixCustom(t *testing.T) { - t.Parallel() - testLint( - t, - "enum_zero_value_suffix_custom", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 3, 18, 16, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 23, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 7, 40, 20, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 7, 44, 27, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 60, 5, 60, 18, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 5, 64, 25, "ENUM_ZERO_VALUE_SUFFIX"), - ) -} - -func TestRunFieldLowerSnakeCase(t *testing.T) { - t.Parallel() - testLint( - t, - "field_lower_snake_case", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 9, 8, 13, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 9, 9, 16, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 9, 10, 18, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 9, 11, 19, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 9, 12, 19, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 13, 20, 17, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 13, 21, 20, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 13, 22, 22, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 13, 23, 23, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 13, 24, 23, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 11, 28, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 11, 29, 18, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 11, 30, 20, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 31, 11, 31, 21, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 32, 11, 32, 21, "FIELD_LOWER_SNAKE_CASE"), - ) -} - -func TestRunFieldNoDescriptor(t *testing.T) { - t.Parallel() - testLint( - t, - "field_no_descriptor", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 6, 19, 6, 29, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 19, 7, 29, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 19, 8, 29, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 19, 9, 30, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 19, 10, 31, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 19, 11, 30, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 19, 12, 31, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 19, 13, 33, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 23, 19, 33, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 23, 20, 33, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 23, 21, 33, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 23, 22, 34, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 23, 23, 35, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 23, 24, 34, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 23, 25, 35, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 26, 23, 26, 37, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 21, 28, 31, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 21, 29, 31, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 21, 30, 31, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 31, 21, 31, 32, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 32, 21, 32, 33, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 33, 21, 33, 32, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 21, 34, 33, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 21, 35, 35, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 37, 19, 37, 29, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 38, 19, 38, 29, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 19, 39, 29, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 19, 40, 30, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 19, 41, 31, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 42, 19, 42, 30, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 43, 19, 43, 31, "FIELD_NO_DESCRIPTOR"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 19, 44, 33, "FIELD_NO_DESCRIPTOR"), - ) -} - -func TestRunFileLowerSnakeCase(t *testing.T) { - t.Parallel() - testLint( - t, - "file_lower_snake_case", - bufanalysistesting.NewFileAnnotationNoLocation(t, "B.proto", "FILE_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "Foo.proto", "FILE_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "aBc.proto", "FILE_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "ab_c_.proto", "FILE_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "fooBar.proto", "FILE_LOWER_SNAKE_CASE"), - ) -} - -func TestRunMessagePascalCase(t *testing.T) { - t.Parallel() - testLint( - t, - "message_pascal_case", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 11, 8, 15, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 11, 9, 18, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 13, 10, 23, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 14, 9, 14, 13, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 9, 15, 16, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 9, 16, 19, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 17, 9, 17, 18, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 11, 18, 15, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 19, 11, 19, 18, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 13, 20, 23, "MESSAGE_PASCAL_CASE"), - ) -} - -func TestRunOneofLowerSnakeCase(t *testing.T) { - t.Parallel() - testLint( - t, - "oneof_lower_snake_case", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 9, 12, 13, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 9, 15, 16, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 9, 18, 18, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 9, 21, 19, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 9, 24, 19, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 38, 13, 38, 17, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 13, 41, 20, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 13, 44, 22, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 47, 13, 47, 23, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 50, 13, 50, 23, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 60, 11, 60, 15, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 63, 11, 63, 18, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 66, 11, 66, 20, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 69, 11, 69, 21, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 11, 72, 21, "ONEOF_LOWER_SNAKE_CASE"), - ) -} - -func TestRunPackageDefined(t *testing.T) { - t.Parallel() - testLint( - t, - "package_defined", - bufanalysistesting.NewFileAnnotationNoLocation(t, "a/no_package.proto", "PACKAGE_DEFINED"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "no_package.proto", "PACKAGE_DEFINED"), - ) -} - -func TestRunPackageDirectoryMatch(t *testing.T) { - t.Parallel() - testLint( - t, - "package_directory_match", - bufanalysistesting.NewFileAnnotation(t, "a/b/a_c.proto", 3, 1, 3, 13, "PACKAGE_DIRECTORY_MATCH"), - bufanalysistesting.NewFileAnnotation(t, "sub/a/b/a_b.proto", 3, 1, 3, 13, "PACKAGE_DIRECTORY_MATCH"), - ) -} - -func TestRunPackageLowerSnakeCase(t *testing.T) { - t.Parallel() - testLint( - t, - "package_lower_snake_case", - bufanalysistesting.NewFileAnnotation(t, "5.proto", 3, 1, 3, 19, "PACKAGE_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "6.proto", 3, 1, 3, 19, "PACKAGE_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "7.proto", 3, 1, 3, 18, "PACKAGE_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "8.proto", 3, 1, 3, 20, "PACKAGE_LOWER_SNAKE_CASE"), - ) -} - -func TestRunPackageNoImportCycle(t *testing.T) { - t.Parallel() - testLint( - t, - "package_no_import_cycle", - bufanalysistesting.NewFileAnnotation(t, "b1.proto", 5, 1, 5, 19, "PACKAGE_NO_IMPORT_CYCLE"), - bufanalysistesting.NewFileAnnotation(t, "c1.proto", 5, 1, 5, 19, "PACKAGE_NO_IMPORT_CYCLE"), - bufanalysistesting.NewFileAnnotation(t, "d1.proto", 5, 1, 5, 19, "PACKAGE_NO_IMPORT_CYCLE"), - ) -} - -func TestRunPackageSameDirectory(t *testing.T) { - t.Parallel() - testLint( - t, - "package_same_directory", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 3, 1, 3, 11, "PACKAGE_SAME_DIRECTORY"), - bufanalysistesting.NewFileAnnotation(t, "one/a.proto", 3, 1, 3, 11, "PACKAGE_SAME_DIRECTORY"), - ) -} - -func TestRunPackageSameDirectoryNoPackage(t *testing.T) { - t.Parallel() - testLint( - t, - "package_same_directory_no_package", - bufanalysistesting.NewFileAnnotationNoLocation(t, "no_package.proto", "PACKAGE_SAME_DIRECTORY"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "one/no_package.proto", "PACKAGE_SAME_DIRECTORY"), - ) -} - -func TestRunPackageSameOptionValue(t *testing.T) { - t.Parallel() - testLint( - t, - "package_same_option_value", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 5, 1, 5, 33, "PACKAGE_SAME_CSHARP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 6, 1, 6, 35, "PACKAGE_SAME_JAVA_MULTIPLE_FILES"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 7, 1, 7, 29, "PACKAGE_SAME_JAVA_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 1, 8, 27, "PACKAGE_SAME_GO_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 1, 9, 30, "PACKAGE_SAME_PHP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 1, 10, 29, "PACKAGE_SAME_RUBY_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 1, 11, 29, "PACKAGE_SAME_SWIFT_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 5, 1, 5, 33, "PACKAGE_SAME_CSHARP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 6, 1, 6, 36, "PACKAGE_SAME_JAVA_MULTIPLE_FILES"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 7, 1, 7, 29, "PACKAGE_SAME_JAVA_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 1, 8, 27, "PACKAGE_SAME_GO_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 9, 1, 9, 30, "PACKAGE_SAME_PHP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 10, 1, 10, 29, "PACKAGE_SAME_RUBY_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 11, 1, 11, 29, "PACKAGE_SAME_SWIFT_PREFIX"), - bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 6, 1, 6, 33, "PACKAGE_SAME_CSHARP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 7, 1, 7, 35, "PACKAGE_SAME_JAVA_MULTIPLE_FILES"), - bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 8, 1, 8, 29, "PACKAGE_SAME_JAVA_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 9, 1, 9, 27, "PACKAGE_SAME_GO_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 10, 1, 10, 30, "PACKAGE_SAME_PHP_NAMESPACE"), - bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 11, 1, 11, 29, "PACKAGE_SAME_RUBY_PACKAGE"), - bufanalysistesting.NewFileAnnotation(t, "sub/a.proto", 12, 1, 12, 29, "PACKAGE_SAME_SWIFT_PREFIX"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_CSHARP_NAMESPACE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_GO_PACKAGE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_JAVA_MULTIPLE_FILES"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_JAVA_PACKAGE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_PHP_NAMESPACE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_RUBY_PACKAGE"), - bufanalysistesting.NewFileAnnotationNoLocation(t, "sub/b.proto", "PACKAGE_SAME_SWIFT_PREFIX"), - ) -} - -func TestRunPackageVersionSuffix(t *testing.T) { - t.Parallel() - testLint( - t, - "package_version_suffix", - bufanalysistesting.NewFileAnnotation(t, "foo.proto", 3, 1, 3, 13, "PACKAGE_VERSION_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "foo_bar.proto", 3, 1, 3, 17, "PACKAGE_VERSION_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "foo_bar_v0beta1.proto", 3, 1, 3, 25, "PACKAGE_VERSION_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "foo_bar_v1test_foo.proto", 3, 1, 3, 28, "PACKAGE_VERSION_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "foo_bar_v2beta0.proto", 3, 1, 3, 25, "PACKAGE_VERSION_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "foo_bar_vv1beta1.proto", 3, 1, 3, 26, "PACKAGE_VERSION_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "v1.proto", 3, 1, 3, 12, "PACKAGE_VERSION_SUFFIX"), - ) -} - -func TestRunRPCNoStreaming(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_no_streaming", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 3, 9, 88, "RPC_NO_CLIENT_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 3, 10, 89, "RPC_NO_SERVER_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 3, 11, 92, "RPC_NO_CLIENT_STREAMING"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 3, 11, 92, "RPC_NO_SERVER_STREAMING"), - ) -} - -func TestRunRPCPascalCase(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_pascal_case", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 7, 11, 11, "RPC_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 7, 12, 14, "RPC_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 7, 13, 17, "RPC_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 14, 7, 14, 16, "RPC_PASCAL_CASE"), - ) -} - -func TestRunRPCRequestResponseUnique(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_request_response_unique", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 27, 3, 27, 52, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 3, 28, 55, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 3, 30, 38, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - ) -} - -func TestRunRPCRequestResponseUniqueAllowEmptyRequests(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_request_response_unique_allow_empty_requests", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 3, 28, 55, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 3, 30, 38, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - ) -} - -func TestRunRPCRequestResponseUniqueAllowEmptyResponses(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_request_response_unique_allow_empty_responses", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 27, 3, 27, 52, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 3, 30, 38, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - ) -} - -func TestRunRPCRequestResponseUniqueAllowEmptyRequestsAndResponses(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_request_response_unique_allow_empty_requests_and_responses", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 3, 30, 38, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - ) -} - -func TestRunRPCRequestResponseUniqueAllowSame(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_request_response_unique_allow_same", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 27, 3, 27, 52, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 3, 28, 55, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 29, 3, 29, 69, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - ) -} - -func TestRunRPCRequestResponseUniqueAllowSameAndEmptyRequestResponses(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_request_response_unique_allow_same_and_empty_request_responses", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 21, 3, 21, 32, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 36, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 23, 3, 23, 35, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 34, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 25, 3, 25, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 8, 3, 8, 37, "RPC_REQUEST_RESPONSE_UNIQUE"), - ) -} - -func TestRunRPCStandardName(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_standard_name", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 19, 10, 22, "RPC_REQUEST_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 50, 11, 53, "RPC_RESPONSE_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 27, 12, 48, "RPC_REQUEST_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 66, 13, 87, "RPC_RESPONSE_STANDARD_NAME"), - ) -} - -func TestRunRPCStandardNameAllowEmpty(t *testing.T) { - t.Parallel() - testLint( - t, - "rpc_standard_name_allow_empty", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 19, 10, 22, "RPC_REQUEST_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 50, 11, 53, "RPC_RESPONSE_STANDARD_NAME"), - ) -} - -func TestRunServicePascalCase(t *testing.T) { - t.Parallel() - testLint( - t, - "service_pascal_case", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 9, 8, 13, "SERVICE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 9, 9, 16, "SERVICE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 9, 10, 19, "SERVICE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 9, 11, 18, "SERVICE_PASCAL_CASE"), - ) -} - -func TestRunServiceSuffix(t *testing.T) { - t.Parallel() - testLint( - t, - "service_suffix", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 9, 8, 13, "SERVICE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 9, 9, 16, "SERVICE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 9, 10, 21, "SERVICE_SUFFIX"), - ) -} - -func TestRunServiceSuffixCustom(t *testing.T) { - t.Parallel() - testLint( - t, - "service_suffix_custom", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 8, 9, 8, 13, "SERVICE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 9, 9, 20, "SERVICE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 10, 9, 10, 17, "SERVICE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 11, 9, 11, 17, "SERVICE_SUFFIX"), - ) -} - -func TestRunSyntaxSpecified(t *testing.T) { - t.Parallel() - testLint( - t, - "syntax_specified", - bufanalysistesting.NewFileAnnotationNoLocation(t, "a/a.proto", "SYNTAX_SPECIFIED"), - ) -} - -func TestRunIgnores1(t *testing.T) { - t.Parallel() - testLint( - t, - "ignores1", - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 9, 9, 9, 13, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 13, 6, 13, 10, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/bar/bar.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/bar/bar.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - ) -} - -func TestRunIgnores2(t *testing.T) { - t.Parallel() - testLint( - t, - "ignores2", - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - ) -} - -func TestRunIgnores3(t *testing.T) { - t.Parallel() - testLint( - t, - "ignores3", - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 9, 9, 9, 13, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 13, 6, 13, 10, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - ) -} - -func TestRunIgnores4(t *testing.T) { - t.Parallel() - testLint( - t, - "ignores4", - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 9, 9, 9, 13, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/bar/bar2.proto", 13, 6, 13, 10, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/baz/baz.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 6, 9, 6, 15, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 9, 9, 9, 12, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "buf/foo/buf.proto", 13, 6, 13, 9, "ENUM_PASCAL_CASE"), - ) -} - -func TestCommentIgnoresOff(t *testing.T) { - t.Parallel() - testLint( - t, - "comment_ignores", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 1, 9, 11, "PACKAGE_DIRECTORY_MATCH"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 1, 9, 11, "PACKAGE_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 9, 1, 9, 11, "PACKAGE_VERSION_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 12, 1, 12, 45, "IMPORT_NO_PUBLIC"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 6, 15, 13, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 17, 3, 17, 29, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 3, 20, 14, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 20, 3, 20, 14, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 22, 3, 22, 13, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 3, 24, 13, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 9, 28, 19, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 30, 11, 30, 21, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 32, 13, 32, 23, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 34, 12, 34, 19, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 36, 9, 36, 35, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 9, 39, 20, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 9, 39, 20, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 9, 41, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 43, 9, 43, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 46, 13, 46, 16, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 48, 13, 48, 16, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 50, 15, 50, 18, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 54, 11, 54, 14, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 56, 11, 56, 14, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 58, 13, 58, 16, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 62, 9, 62, 12, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 9, 64, 12, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 66, 11, 66, 14, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 71, 9, 71, 19, "SERVICE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 7, 75, 16, "RPC_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 17, 75, 38, "RPC_REQUEST_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 75, 49, 75, 70, "RPC_RESPONSE_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 5, 1, 5, 11, "PACKAGE_DIRECTORY_MATCH"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 5, 1, 5, 11, "PACKAGE_VERSION_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 9, 26, 9, 28, "ENUM_FIRST_VALUE_ZERO"), - ) -} - -func TestCommentIgnoresOn(t *testing.T) { - t.Parallel() - testLintConfigModifier( - t, - "comment_ignores", - func(config *bufconfig.Config) { - config.Lint.AllowCommentIgnores = true - }, - ) -} - -func TestCommentIgnoresCascadeOff(t *testing.T) { - t.Parallel() - testLint( - t, - "comment_ignores_cascade", - bufanalysistesting.NewFileAnnotation(t, "a.proto", 13, 6, 13, 13, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 15, 3, 15, 29, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 3, 16, 14, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 16, 3, 16, 14, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 17, 3, 17, 13, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 18, 3, 18, 13, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 24, 9, 24, 19, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 28, 11, 28, 21, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 32, 13, 32, 23, "MESSAGE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 35, 12, 35, 19, "ENUM_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 37, 9, 37, 35, "ENUM_NO_ALLOW_ALIAS"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 9, 39, 20, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 39, 9, 39, 20, "ENUM_ZERO_VALUE_SUFFIX"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 40, 9, 40, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 41, 9, 41, 19, "ENUM_VALUE_UPPER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 43, 13, 43, 16, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 44, 13, 44, 16, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 45, 15, 45, 18, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 48, 11, 48, 14, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 49, 11, 49, 14, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 50, 13, 50, 16, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 53, 9, 53, 12, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 54, 9, 54, 12, "ONEOF_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 55, 11, 55, 14, "FIELD_LOWER_SNAKE_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 63, 9, 63, 19, "SERVICE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 7, 64, 16, "RPC_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 17, 64, 38, "RPC_REQUEST_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 64, 49, 64, 70, "RPC_RESPONSE_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 68, 9, 68, 19, "SERVICE_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 7, 72, 16, "RPC_PASCAL_CASE"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 17, 72, 38, "RPC_REQUEST_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "a.proto", 72, 49, 72, 70, "RPC_RESPONSE_STANDARD_NAME"), - bufanalysistesting.NewFileAnnotation(t, "b.proto", 9, 26, 9, 28, "ENUM_FIRST_VALUE_ZERO"), - ) -} - -func TestCommentIgnoresCascadeOn(t *testing.T) { - t.Parallel() - testLintConfigModifier( - t, - "comment_ignores_cascade", - func(config *bufconfig.Config) { - config.Lint.AllowCommentIgnores = true - }, - ) -} - -func testLint( - t *testing.T, - relDirPath string, - expectedFileAnnotations ...bufanalysis.FileAnnotation, -) { - testLintConfigModifier( - t, - relDirPath, - nil, - expectedFileAnnotations..., - ) -} - -func testLintConfigModifier( - t *testing.T, - relDirPath string, - configModifier func(*bufconfig.Config), - expectedFileAnnotations ...bufanalysis.FileAnnotation, -) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - logger := zap.NewNop() - - dirPath := filepath.Join("testdata", relDirPath) - - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - dirPath, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - - config := testGetConfig(t, readWriteBucket) - if configModifier != nil { - configModifier(config) - } - - module, err := bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config.Build, - ) - require.NoError(t, err) - image, fileAnnotations, err := bufimagebuild.NewBuilder( - zap.NewNop(), - bufmodule.NewNopModuleReader(), - ).Build( - ctx, - module, - ) - require.NoError(t, err) - require.Empty(t, fileAnnotations) - image = bufimage.ImageWithoutImports(image) - - handler := buflint.NewHandler(logger) - fileAnnotations, err = handler.Check( - ctx, - config.Lint, - image, - ) - assert.NoError(t, err) - bufanalysistesting.AssertFileAnnotationsEqual( - t, - expectedFileAnnotations, - fileAnnotations, - ) -} - -func testGetConfig( - t *testing.T, - readBucket storage.ReadBucket, -) *bufconfig.Config { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) - defer cancel() - config, err := bufconfig.GetConfigForBucket(ctx, readBucket) - require.NoError(t, err) - return config -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/a.proto deleted file mode 100644 index c2ead84fe..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/a.proto +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -// To team members: I am sorry you have to read such a bad file. -// To others: Do the opposite of whatever this file does. - -// buf:lint:ignore PACKAGE_DIRECTORY_MATCH -// buf:lint:ignore PACKAGE_LOWER_SNAKE_CASE -// buf:lint:ignore PACKAGE_VERSION_SUFFIX -package A; - -// buf:lint:ignore IMPORT_NO_PUBLIC -import public "google/protobuf/empty.proto"; - -// buf:lint:ignore ENUM_PASCAL_CASE -enum enumFoo { - // buf:lint:ignore ENUM_NO_ALLOW_ALIAS - option allow_alias = true; - // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooNone = 0; - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooOne = 1; - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooTwo = 1; -} - -// buf:lint:ignore MESSAGE_PASCAL_CASE -message messageFoo { - // buf:lint:ignore MESSAGE_PASCAL_CASE - message messageBar { - // buf:lint:ignore MESSAGE_PASCAL_CASE - message messageBaz { - // buf:lint:ignore ENUM_PASCAL_CASE - enum enumFoo { - // buf:lint:ignore ENUM_NO_ALLOW_ALIAS - option allow_alias = true; - // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooNone = 0; - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooOne = 1; - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooTwo = 1; - } - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Foo = 1; - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - oneof Bar { - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Baz = 2; - } - } - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Foo = 1; - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - oneof Bar { - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Baz = 2; - } - } - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Foo = 1; - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - oneof Bar { - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Baz = 2; - } -} - -// buf:lint:ignore SERVICE_PASCAL_CASE -service serviceFoo { - // buf:lint:ignore RPC_PASCAL_CASE - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME - rpc methodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/b.proto deleted file mode 100644 index c0ec832e0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/b.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -// buf:lint:ignore PACKAGE_DIRECTORY_MATCH -// buf:lint:ignore PACKAGE_VERSION_SUFFIX -package a; - -enum EnumFoo { - // buf:lint:ignore ENUM_FIRST_VALUE_ZERO - ENUM_FOO_UNSPECIFIED = 10; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/buf.yaml deleted file mode 100644 index 694bacc44..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores/buf.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_DIRECTORY_MATCH - - PACKAGE_LOWER_SNAKE_CASE - - PACKAGE_VERSION_SUFFIX - - IMPORT_NO_PUBLIC - - ENUM_FIRST_VALUE_ZERO - - ENUM_PASCAL_CASE - - ENUM_NO_ALLOW_ALIAS - - ENUM_ZERO_VALUE_SUFFIX - - ENUM_VALUE_UPPER_SNAKE_CASE - - MESSAGE_PASCAL_CASE - - FIELD_LOWER_SNAKE_CASE - - ONEOF_LOWER_SNAKE_CASE - - SERVICE_PASCAL_CASE - - RPC_PASCAL_CASE - - RPC_REQUEST_STANDARD_NAME - - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/a.proto deleted file mode 100644 index 870222538..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/a.proto +++ /dev/null @@ -1,88 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -// To team members: I am sorry you have to read such a bad file. -// To others: Do the opposite of whatever this file does. - -package a; - -import "google/protobuf/empty.proto"; - -// buf:lint:ignore ENUM_PASCAL_CASE -// buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE -// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX -enum enumFoo { - // buf:lint:ignore ENUM_NO_ALLOW_ALIAS - option allow_alias = true; - enumFooNone = 0; - enumFooOne = 1; - enumFooTwo = 1; -} - -// buf:lint:ignore MESSAGE_PASCAL_CASE -// buf:lint:ignore FIELD_LOWER_SNAKE_CASE -// buf:lint:ignore ONEOF_LOWER_SNAKE_CASE -message messageFoo { - // buf:lint:ignore MESSAGE_PASCAL_CASE - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - message messageBar { - // buf:lint:ignore MESSAGE_PASCAL_CASE - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - message messageBaz { - // buf:lint:ignore ENUM_PASCAL_CASE - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enum enumFoo { - // buf:lint:ignore ENUM_NO_ALLOW_ALIAS - option allow_alias = true; - // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX - enumFooNone = 0; - enumFooOne = 1; - enumFooTwo = 1; - } - int64 Foo = 1; - oneof Bar { - int64 Baz = 2; - } - } - int64 Foo = 1; - oneof Bar { - int64 Baz = 2; - } - } - int64 Foo = 1; - oneof Bar { - int64 Baz = 2; - } -} - -// buf:lint:ignore SERVICE_PASCAL_CASE -// buf:lint:ignore RPC_PASCAL_CASE -// buf:lint:ignore RPC_REQUEST_STANDARD_NAME -// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME -service serviceFoo { - rpc methodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -// buf:lint:ignore SERVICE_PASCAL_CASE -service serviceBar { - // buf:lint:ignore RPC_PASCAL_CASE - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME - rpc methodBar(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/b.proto deleted file mode 100644 index 610f74f4e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/b.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -// buf:lint:ignore PACKAGE_DIRECTORY_MATCH -// buf:lint:ignore PACKAGE_VERSION_SUFFIX -package a; - -// buf:lint:ignore ENUM_FIRST_VALUE_ZERO -enum EnumFoo { - ENUM_FOO_UNSPECIFIED = 10; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/buf.yaml deleted file mode 100644 index 834b2c9ac..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comment_ignores_cascade/buf.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ENUM_FIRST_VALUE_ZERO - - ENUM_PASCAL_CASE - - ENUM_NO_ALLOW_ALIAS - - ENUM_ZERO_VALUE_SUFFIX - - ENUM_VALUE_UPPER_SNAKE_CASE - - MESSAGE_PASCAL_CASE - - FIELD_LOWER_SNAKE_CASE - - ONEOF_LOWER_SNAKE_CASE - - SERVICE_PASCAL_CASE - - RPC_PASCAL_CASE - - RPC_REQUEST_STANDARD_NAME - - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/a.proto deleted file mode 100644 index 63a9ef92b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/a.proto +++ /dev/null @@ -1,297 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -enum EnumFoo { - ENUM_FOO_UNSPECIFIED = 0; - ENUM_FOO_ONE = 1; -} - -message MessageFoo { - message MessageBar { - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - } - message MessageBaz { - int64 foo = 1; - oneof bar { - int64 baz = 2; - } - } - int64 foo = 1; - oneof bar { - int64 baz = 2; - } - } - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - } - int64 foo = 1; - oneof bar { - int64 baz = 2; - } -} - -service ServiceFoo { - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -// comment -enum EnumFoo2 { - // comment - ENUM_FOO2_UNSPECIFIED = 0; - // comment - ENUM_FOO2_ONE = 1; -} - -// comment -message MessageFoo2 { - // comment - message MessageBar { - // comment - enum Foo { - // comment - FOO_UNSPECIFIED = 0; - // comment - FOO_ONE = 1; - } - // comment - message MessageBaz { - // comment - int64 foo = 1; - // comment - oneof bar { - // comment - int64 baz = 2; - } - } - // comment - int64 foo = 1; - // comment - oneof bar { - // comment - int64 baz = 2; - } - } - // comment - enum Foo { - // comment - FOO_UNSPECIFIED = 0; - // comment - FOO_ONE = 1; - } - // comment - int64 foo = 1; - // comment - oneof bar { - // comment - int64 baz = 2; - } -} - -// comment -service ServiceFoo2 { - // comment - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - // comment - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); -} - -enum EnumFoo3 { - ENUM_FOO3_UNSPECIFIED = 0; // bad comment - ENUM_FOO3_ONE = 1; // bad comment -} // bad comment - -message MessageFoo3 { - message MessageBar { - enum Foo { - FOO_UNSPECIFIED = 0; // bad comment - FOO_ONE = 1; // bad comment - } // bad comment - message MessageBaz { - int64 foo = 1; // bad comment - oneof bar { // bad comment - int64 baz = 2; // bad comment - } // bad comment - } - int64 foo = 1; // bad comment - oneof bar { // bad comment - int64 baz = 2; // bad comment - } // bad comment - } // bad comment - enum Foo { // bad comment - FOO_UNSPECIFIED = 0; // bad comment - FOO_ONE = 1; // bad comment - } // bad comment - int64 foo = 1; // bad comment - oneof bar { // bad comment - int64 baz = 2; // bad comment - } // bad comment -} - -service ServiceFoo3 { - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} // bad comment - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); // bad comment -} - -// -enum EnumFoo4 { - // - ENUM_FOO4_UNSPECIFIED = 0; - // - ENUM_FOO4_ONE = 1; -} - -// -message MessageFoo4 { - // - message MessageBar { - // - enum Foo { - // - FOO_UNSPECIFIED = 0; - // - FOO_ONE = 1; - } - // - message MessageBaz { - // - int64 foo = 1; - // - oneof bar { - // - int64 baz = 2; - } - } - // - int64 foo = 1; - // - oneof bar { - // - int64 baz = 2; - } - } - // - enum Foo { - // - FOO_UNSPECIFIED = 0; - // - FOO_ONE = 1; - } - // - int64 foo = 1; - // - oneof bar { - // - int64 baz = 2; - } -} - -// -service ServiceFoo4 { - // - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - // - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); -} - -/* */ -enum EnumFoo5 { - /* */ - ENUM_FOO5_UNSPECIFIED = 0; - /* */ - ENUM_FOO5_ONE = 1; -} - -/* */ -message MessageFoo5 { - /* */ - message MessageBar { - /* */ - enum Foo { - /* */ - FOO_UNSPECIFIED = 0; - /* */ - FOO_ONE = 1; - } - /* */ - message MessageBaz { - /* */ - int64 foo = 1; - /* */ - oneof bar { - /* */ - int64 baz = 2; - } - } - /* */ - int64 foo = 1; - /* */ - oneof bar { - /* */ - int64 baz = 2; - } - } - /* */ - enum Foo { - /* */ - FOO_UNSPECIFIED = 0; - /* */ - FOO_ONE = 1; - } - /* */ - int64 foo = 1; - /* */ - oneof bar { - /* */ - int64 baz = 2; - } -} - -/* */ -service ServiceFoo5 { - /* */ - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - /* */ - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); -} - -message Baz { - map one = 1; -} - -// comment -service ServiceFoo6 { - // this method should pass lint - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE this method should fail lint - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); - //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE this method should also fail lint - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - // - rpc MethodBaz(google.protobuf.Empty) returns (google.protobuf.Empty); - //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - // this method should pass lint - rpc MethodBat(google.protobuf.Empty) returns (google.protobuf.Empty); -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/buf.yaml deleted file mode 100644 index 78a27778d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/comments/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - COMMENTS diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/a.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/buf.yaml deleted file mode 100644 index d5d4b0ca9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - DIRECTORY_SAME_PACKAGE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/c.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/c.proto deleted file mode 100644 index 6b49d48d1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/c.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package c; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/d.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/d.proto deleted file mode 100644 index a7c098fe2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/directory_same_package/one/d.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package d; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/a.proto deleted file mode 100644 index c5f079809..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/a.proto +++ /dev/null @@ -1,93 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; -} - -enum Bar { - BAR_ONE = 1; - BAR_UNSPECIFIED = 0; - BAR_TWO = 2; -} - -enum Baz { - BAZ_ONE = 1; - BAZ_UNSPECIFIED = 0; - BAZ_TWO = 2; -} - -enum Bat { - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; -} - -message One { - message Two { - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; - } - - enum Bar { - BAR_ONE = 1; - BAR_UNSPECIFIED = 0; - BAR_TWO = 2; - } - - enum Baz { - BAZ_ONE = 1; - BAZ_UNSPECIFIED = 0; - BAZ_TWO = 2; - } - - enum Bat { - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; - } - } - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; - } - - enum Bar { - BAR_ONE = 1; - BAR_UNSPECIFIED = 0; - BAR_TWO = 2; - } - - enum Baz { - BAZ_ONE = 1; - BAZ_UNSPECIFIED = 0; - BAZ_TWO = 2; - } - - enum Bat { - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/buf.yaml deleted file mode 100644 index e106d8026..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_first_value_zero/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ENUM_FIRST_VALUE_ZERO diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/a.proto deleted file mode 100644 index ea4cf1754..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/a.proto +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; -} - -enum Bar { - option allow_alias = true; - BAR_UNSPECIFIED = 0; - BAR_ONE = 1; - BAR_TWO = 1; -} - -enum Baz { - option allow_alias = true; - BAZ_UNSPECIFIED = 0; - BAZ_ONE = 1; - BAZ_TWO = 1; -} - -enum Bat { - option allow_alias = false; - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; -} - -message One { - message Two { - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; - } - - enum Bar { - option allow_alias = true; - BAR_UNSPECIFIED = 0; - BAR_ONE = 1; - BAR_TWO = 1; - } - - enum Baz { - option allow_alias = true; - BAZ_UNSPECIFIED = 0; - BAZ_ONE = 1; - BAZ_TWO = 1; - } - - enum Bat { - option allow_alias = false; - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; - } - } - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; - } - - enum Bar { - option allow_alias = true; - BAR_UNSPECIFIED = 0; - BAR_ONE = 1; - BAR_TWO = 1; - } - - enum Baz { - option allow_alias = true; - BAZ_UNSPECIFIED = 0; - BAZ_ONE = 1; - BAZ_TWO = 1; - } - - enum Bat { - option allow_alias = false; - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/buf.yaml deleted file mode 100644 index fc3248ab7..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_no_allow_alias/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ENUM_NO_ALLOW_ALIAS diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/a.proto deleted file mode 100644 index 05325afe3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/a.proto +++ /dev/null @@ -1,93 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Success { - SUCCESS_UNSPECIFIED = 0; -} - -enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; -} - -enum SuccessFOOThree { - SUCCESS_FOO_THREE_UNSPECIFIED = 0; -} -enum fail { - FAIL_UNSPECIFIED = 0; -} -enum failTwo { - FAIL_TWO_UNSPECIFIED = 0; -} -enum fail_three { - FAIL_THREE_UNSPECIFIED = 0; -} -enum Fail_four { - FAIL_FOUR_UNSPECIFIED = 0; -} - -message Foo { - message Bar { - enum Success { - SUCCESS_UNSPECIFIED = 0; - } - - enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; - } - - enum SuccessFOOThree { - SUCCESS_FOO_THREE_UNSPECIFIED = 0; - } - enum fail { - FAIL_UNSPECIFIED = 0; - } - enum failTwo { - FAIL_TWO_UNSPECIFIED = 0; - } - enum fail_three { - FAIL_THREE_UNSPECIFIED = 0; - } - enum Fail_four { - FAIL_FOUR_UNSPECIFIED = 0; - } - } - enum Success { - SUCCESS_UNSPECIFIED = 0; - } - - enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; - } - - enum SuccessFOOThree { - SUCCESS_FOO_THREE_UNSPECIFIED = 0; - } - enum fail { - FAIL_UNSPECIFIED = 0; - } - enum failTwo { - FAIL_TWO_UNSPECIFIED = 0; - } - enum fail_three { - FAIL_THREE_UNSPECIFIED = 0; - } - enum Fail_four { - FAIL_FOUR_UNSPECIFIED = 0; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/buf.yaml deleted file mode 100644 index ddb71b802..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_pascal_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ENUM_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/a.proto deleted file mode 100644 index 891193ab5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/a.proto +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Test { - TEST_UNSPECIFIED = 0; - TEST_SUCCESS = 1; - TEST_SUCCESS_TWO = 2; - TEST_SUCCESS_THREE_3 = 3; - TESt_FAIL = 4; - test_FAIL_5 = 5; - test__FAIL_6 = 6; -} - -message Foo { - message Bar { - enum Test1 { - TEST1_UNSPECIFIED = 0; - TEST1_SUCCESS = 1; - TEST1_SUCCESS_TWO = 2; - TEST1_SUCCESS_THREE_3 = 3; - TESt1_FAIL = 4; - test1_FAIL_5 = 5; - test1__FAIL_6 = 6; - TEST_1_FAIL_7 = 7; - } - } - enum Test1 { - TEST1_UNSPECIFIED = 0; - TEST1_SUCCESS = 1; - TEST1_SUCCESS_TWO = 2; - TEST1_SUCCESS_THREE_3 = 3; - TESt1_FAIL = 4; - test1_FAIL_5 = 5; - test1__FAIL_6 = 6; - TEST_1_FAIL_7 = 7; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/buf.yaml deleted file mode 100644 index 98c0ff54e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_prefix/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ENUM_VALUE_PREFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/a.proto deleted file mode 100644 index c03d6e1c8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/a.proto +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Test { - TEST_UNSPECIFIED = 0; - TEST_SUCCESS = 1; - TEST_SUCCESS_TWO = 2; - TEST_SUCCESS_THREE3 = 3; - TEST_FAIl = 4; - test_fail_five = 5; - testFailSix = 6; - TEST_SUCCESS_7 = 7; -} - -message Foo { - message Bar { - enum Test { - TEST_UNSPECIFIED = 0; - TEST_SUCCESS = 1; - TEST_SUCCESS_TWO = 2; - TEST_SUCCESS_THREE3 = 3; - TEST_FAIl = 4; - test_fail_five = 5; - testFailSix = 6; - TEST_SUCCESS_7 = 7; - } - } - enum Test { - TEST_UNSPECIFIED = 0; - TEST_SUCCESS = 1; - TEST_SUCCESS_TWO = 2; - TEST_SUCCESS_THREE3 = 3; - TEST_FAIl = 4; - test_fail_five = 5; - testFailSix = 6; - TEST_SUCCESS_7 = 7; - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/buf.yaml deleted file mode 100644 index 809f06f0a..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_value_upper_snake_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ENUM_VALUE_UPPER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/a.proto deleted file mode 100644 index 5d93433dd..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/a.proto +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Success { - SUCCESS_UNSPECIFIED = 0; -} - -enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; -} - -enum Fail { - FAILUNSPECIFIED = 0; -} - -enum FailTwo { - FAIL_TWO_UNSPECIFIEd = 0; -} - -enum FailThree { - FAIL_THREE_OTHER = 0; -} - -message Foo { - message Bar { - enum Success { - SUCCESS_UNSPECIFIED = 0; - } - - enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; - } - - enum Fail { - FAILUNSPECIFIED = 0; - } - - enum FailTwo { - FAIL_TWO_UNSPECIFIEd = 0; - } - - enum FailThree { - FAIL_THREE_OTHER = 0; - } - } - enum Success { - SUCCESS_UNSPECIFIED = 0; - } - - enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; - } - - enum Fail { - FAILUNSPECIFIED = 0; - } - - enum FailTwo { - FAIL_TWO_UNSPECIFIEd = 0; - } - - enum FailThree { - FAIL_THREE_OTHER = 0; - } -} - -enum SuccessThree { - SUCCESS_THREE_UNSPECIFIED = 0; - SUCCESS_THREE_ONE = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/buf.yaml deleted file mode 100644 index e0b838967..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ENUM_ZERO_VALUE_SUFFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/a.proto deleted file mode 100644 index ac0df9c05..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/a.proto +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -enum Success { - SUCCESSOTHER = 0; -} - -enum SuccessTwo { - SUCCESS_TWOOTHER = 0; -} - -enum SuccessThree { - SUCCESS_THREE_OTHER = 0; -} - -enum FailTwo { - FAIL_TWOOTHEr = 0; -} - -enum FailThree { - FAIL_TWO_UNSPECIFIED = 0; -} - -message Foo { - message Bar { - enum Success { - SUCCESSOTHER = 0; - } - - enum SuccessTwo { - SUCCESS_TWOOTHER = 0; - } - - enum SuccessThree { - SUCCESS_THREE_OTHER = 0; - } - - enum FailTwo { - FAIL_TWOOTHEr = 0; - } - - enum FailThree { - FAIL_TWO_UNSPECIFIED = 0; - } - } - enum Success { - SUCCESSOTHER = 0; - } - - enum SuccessTwo { - SUCCESS_TWOOTHER = 0; - } - - enum SuccessThree { - SUCCESS_THREE_OTHER = 0; - } - - enum FailTwo { - FAIL_TWOOTHEr = 0; - } - - enum FailThree { - FAIL_TWO_UNSPECIFIED = 0; - } -} - -enum SuccessFour { - SUCCESS_FOUROTHER = 0; - SUCCESS_FOUR_ONE = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/buf.yaml deleted file mode 100644 index 12527dbe1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/enum_zero_value_suffix_custom/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ENUM_ZERO_VALUE_SUFFIX - enum_zero_value_suffix: OTHER diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/a.proto deleted file mode 100644 index e8e416144..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/a.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - int32 success = 1; - int32 success_two = 2; - int32 Fail = 3; - int32 FailTwo = 4; - int32 failThree = 5; - int32 fail_four_ = 6; - int32 _fail_five = 7; -} - -message Two { - message Three { - message Four { - int32 success = 1; - int32 success_two = 2; - int32 Fail = 3; - int32 FailTwo = 4; - int32 failThree = 5; - int32 fail_four_ = 6; - int32 _fail_five = 7; - } - int32 success = 1; - int32 success_two = 2; - int32 Fail = 3; - int32 FailTwo = 4; - int32 failThree = 5; - int32 fail_four_ = 6; - int32 _fail_five = 7; - } -} - -message Five { - int32 success1 = 1; - int32 success_2 = 2; - int32 success3_1 = 3; - int32 success_4_1 = 4; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/buf.yaml deleted file mode 100644 index a54c003e7..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_lower_snake_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - FIELD_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/a.proto deleted file mode 100644 index a5e830d17..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/a.proto +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package a; - -message One { - optional string descriptor = 1; - optional string Descriptor = 2; - optional string descRiptor = 3; - optional string _descriptor = 4; - optional string __descriptor = 5; - optional string descriptor_ = 6; - optional string descriptor__ = 7; - optional string __descriptor__ = 8; -} - -message Two { - message Three { - message Four { - optional string descriptor = 1; - optional string Descriptor = 2; - optional string descRiptor = 3; - optional string _descriptor = 4; - optional string __descriptor = 5; - optional string descriptor_ = 6; - optional string descriptor__ = 7; - optional string __descriptor__ = 8; - } - optional string descriptor = 1; - optional string Descriptor = 2; - optional string descRiptor = 3; - optional string _descriptor = 4; - optional string __descriptor = 5; - optional string descriptor_ = 6; - optional string descriptor__ = 7; - optional string __descriptor__ = 8; - } - optional string descriptor = 1; - optional string Descriptor = 2; - optional string descRiptor = 3; - optional string _descriptor = 4; - optional string __descriptor = 5; - optional string descriptor_ = 6; - optional string descriptor__ = 7; - optional string __descriptor__ = 8; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/buf.yaml deleted file mode 100644 index 848f323bd..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/field_no_descriptor/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -lint: - use: - - FIELD_NO_DESCRIPTOR diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/1.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/B.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/B.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/B.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/Foo.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/Foo.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/Foo.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/a.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.txt b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.txt deleted file mode 100644 index 2b5e4fb7f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/aBc.txt +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c_.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c_.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/ab_c_.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/buf.yaml deleted file mode 100644 index 3443ceb17..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - FILE_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/fooBar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/fooBar.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/file_lower_snake_case/fooBar.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf.yaml deleted file mode 100644 index 1bd23349d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_DIRECTORY_MATCH - - ENUM_PASCAL_CASE - - FIELD_LOWER_SNAKE_CASE - - MESSAGE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar.proto deleted file mode 100644 index d7da730d3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.bar; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar2.proto deleted file mode 100644 index 908b2c2ee..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/bar/bar2.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.bar; - -message Foo2 { - int64 oneTwo = 1; -} - -message bar2 { - int64 three = 3; -} - -enum baz2 { - BAZ2_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/buf.proto deleted file mode 100644 index 662d5a3d6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/buf.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf; - -message Foo { - int64 oneTwo = 1; -} - -message biz { - int64 three = 3; -} - -enum buz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/bar/bar.proto deleted file mode 100644 index 253f120d0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/bar/bar.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo.bar; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/baz/baz.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/baz/baz.proto deleted file mode 100644 index 5940f22e8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/baz/baz.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo.baz; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/buf.proto deleted file mode 100644 index c3995ff14..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores1/buf/foo/buf.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo; - -message Foo { - int64 oneTwo = 1; -} - -message biz { - int64 three = 3; -} - -enum buz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf.yaml deleted file mode 100644 index a570f164d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_DIRECTORY_MATCH - - ENUM_PASCAL_CASE - - FIELD_LOWER_SNAKE_CASE - - MESSAGE_PASCAL_CASE - ignore: - - buf/bar/bar2.proto - - buf/foo diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar.proto deleted file mode 100644 index d7da730d3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.bar; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar2.proto deleted file mode 100644 index 908b2c2ee..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/bar/bar2.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.bar; - -message Foo2 { - int64 oneTwo = 1; -} - -message bar2 { - int64 three = 3; -} - -enum baz2 { - BAZ2_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/buf.proto deleted file mode 100644 index 662d5a3d6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/buf.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf; - -message Foo { - int64 oneTwo = 1; -} - -message biz { - int64 three = 3; -} - -enum buz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/bar/bar.proto deleted file mode 100644 index 253f120d0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/bar/bar.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo.bar; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/baz/baz.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/baz/baz.proto deleted file mode 100644 index 5940f22e8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/baz/baz.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo.baz; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/buf.proto deleted file mode 100644 index c3995ff14..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores2/buf/foo/buf.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo; - -message Foo { - int64 oneTwo = 1; -} - -message biz { - int64 three = 3; -} - -enum buz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf.yaml deleted file mode 100644 index 61daa4066..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1beta1 -lint: - use: - - PACKAGE_DIRECTORY_MATCH - - ENUM_PASCAL_CASE - - FIELD_LOWER_SNAKE_CASE - - MESSAGE_PASCAL_CASE - ignore_only: - ENUM_PASCAL_CASE: - - buf/bar/bar.proto - - buf/foo/bar - - buf/foo/bar - MESSAGE_PASCAL_CASE: - - buf/bar/bar.proto - STYLE_BASIC: - - buf/foo/bar diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar.proto deleted file mode 100644 index d7da730d3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.bar; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar2.proto deleted file mode 100644 index 908b2c2ee..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/bar/bar2.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.bar; - -message Foo2 { - int64 oneTwo = 1; -} - -message bar2 { - int64 three = 3; -} - -enum baz2 { - BAZ2_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/buf.proto deleted file mode 100644 index 662d5a3d6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/buf.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf; - -message Foo { - int64 oneTwo = 1; -} - -message biz { - int64 three = 3; -} - -enum buz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/bar/bar.proto deleted file mode 100644 index 253f120d0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/bar/bar.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo.bar; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/baz/baz.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/baz/baz.proto deleted file mode 100644 index 5940f22e8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/baz/baz.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo.baz; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/buf.proto deleted file mode 100644 index c3995ff14..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores3/buf/foo/buf.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo; - -message Foo { - int64 oneTwo = 1; -} - -message biz { - int64 three = 3; -} - -enum buz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf.yaml deleted file mode 100644 index 9e5a05da1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_DIRECTORY_MATCH - - ENUM_PASCAL_CASE - - FIELD_LOWER_SNAKE_CASE - - MESSAGE_PASCAL_CASE - ignore_only: - ENUM_PASCAL_CASE: - - buf/bar/bar.proto - - buf/foo/bar - - buf/foo/bar - MESSAGE_PASCAL_CASE: - - buf/bar/bar.proto - BASIC: - - buf/foo/bar diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar.proto deleted file mode 100644 index d7da730d3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.bar; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar2.proto deleted file mode 100644 index 908b2c2ee..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/bar/bar2.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.bar; - -message Foo2 { - int64 oneTwo = 1; -} - -message bar2 { - int64 three = 3; -} - -enum baz2 { - BAZ2_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/buf.proto deleted file mode 100644 index 662d5a3d6..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/buf.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf; - -message Foo { - int64 oneTwo = 1; -} - -message biz { - int64 three = 3; -} - -enum buz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/bar/bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/bar/bar.proto deleted file mode 100644 index 253f120d0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/bar/bar.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo.bar; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/baz/baz.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/baz/baz.proto deleted file mode 100644 index 5940f22e8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/baz/baz.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo.baz; - -message Foo { - int64 oneTwo = 1; -} - -message bar { - int64 three = 3; -} - -enum baz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/buf.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/buf.proto deleted file mode 100644 index c3995ff14..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/ignores4/buf/foo/buf.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package buf.foo; - -message Foo { - int64 oneTwo = 1; -} - -message biz { - int64 three = 3; -} - -enum buz { - BAZ_UNSPECIFIED = 0; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/a.proto deleted file mode 100644 index bfd0c3b66..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/a.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "sub/sub1.proto"; -import public "sub/sub2.proto"; -import public "one/one.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/buf.yaml deleted file mode 100644 index f5f706a74..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - IMPORT_NO_PUBLIC diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/one/one.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/one/one.proto deleted file mode 100644 index 25b96caa4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/one/one.proto +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package one; - -import "sub/sub1.proto"; -import public "sub/sub2.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub1.proto deleted file mode 100644 index 52821327f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub2.proto deleted file mode 100644 index 52821327f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_public/sub/sub2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/a.proto deleted file mode 100644 index 5938f9d88..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/a.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "sub/sub1.proto"; -import weak "sub/sub2.proto"; -import weak "one/one.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/buf.yaml deleted file mode 100644 index d220104ab..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - IMPORT_NO_WEAK diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/one/one.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/one/one.proto deleted file mode 100644 index f0694ab7e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/one/one.proto +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package one; - -import "sub/sub1.proto"; -import weak "sub/sub2.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub1.proto deleted file mode 100644 index 52821327f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub2.proto deleted file mode 100644 index 52821327f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_no_weak/sub/sub2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/a.proto deleted file mode 100644 index 75e0340d7..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/a.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "sub/sub1.proto"; -import "sub/sub2.proto"; -import "one/one.proto"; - -message A { - sub.Sub2 sub2 = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/buf.yaml deleted file mode 100644 index 567f1fe12..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - IMPORT_USED diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/one/one.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/one/one.proto deleted file mode 100644 index cd01c5af2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/one/one.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package one; - -import "sub/sub1.proto"; -import "sub/sub2.proto"; - -message One { - sub.Sub1 sub1 = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub1.proto deleted file mode 100644 index 2088fd0ce..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub1.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub; - -message Sub1 {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub2.proto deleted file mode 100644 index 9bb433af5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/import_used/sub/sub2.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package sub; - -message Sub2 {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/a.proto deleted file mode 100644 index 1726cbe71..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/a.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Success {} -message SuccessTwo {} -message SuccessFOOThree { - message fail {} - message failTwo { - message fail_three {} - } -} - -message fail {} -message failTwo {} -message fail_three {} -message Fail_four { - message fail {} - message failTwo { - message fail_three {} - } -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/buf.yaml deleted file mode 100644 index 3f5d52cfd..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/message_pascal_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - MESSAGE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/a.proto deleted file mode 100644 index f930c3db2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/a.proto +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message One { - oneof success { - int32 one = 1; - } - oneof success_two { - int32 two = 2; - } - oneof Fail { - int32 three = 3; - } - oneof FailTwo { - int32 four = 4; - } - oneof failThree { - int32 five = 5; - } - oneof fail_four_ { - int32 six = 6; - } - oneof _fail_five { - int32 seven = 7; - } -} - -message Two { - message Three { - message Four { - oneof success { - int32 one = 1; - } - oneof success_two { - int32 two = 2; - } - oneof Fail { - int32 three = 3; - } - oneof FailTwo { - int32 four = 4; - } - oneof failThree { - int32 five = 5; - } - oneof fail_four_ { - int32 six = 6; - } - oneof _fail_five { - int32 seven = 7; - } - } - oneof success { - int32 one = 1; - } - oneof success_two { - int32 two = 2; - } - oneof Fail { - int32 three = 3; - } - oneof FailTwo { - int32 four = 4; - } - oneof failThree { - int32 five = 5; - } - oneof fail_four_ { - int32 six = 6; - } - oneof _fail_five { - int32 seven = 7; - } - } -} - -// checking to see if the implicit oneof triggers the linter, which it should not -message Three { - message Four { - message Five { - optional string one = 1; - } - optional string one = 1; - } - optional string one = 1; -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/buf.yaml deleted file mode 100644 index f180bee43..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/oneof_lower_snake_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - ONEOF_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/a/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/a/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/a/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/buf.yaml deleted file mode 100644 index 2c040708b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_DEFINED diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_defined/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_c.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_c.proto deleted file mode 100644 index ba26086c4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/a/b/a_c.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.c; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/buf.yaml deleted file mode 100644 index fe8954512..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_DIRECTORY_MATCH diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/sub/a/b/a_b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/sub/a/b/a_b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_directory_match/sub/a/b/a_b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/1.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/2.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/3.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/3.proto deleted file mode 100644 index 7bbc98f84..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/3.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b_cde; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/4.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/4.proto deleted file mode 100644 index 6252e6967..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/4.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b_cde.f; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/5.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/5.proto deleted file mode 100644 index 2690584b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/5.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b_cdE.f; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/6.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/6.proto deleted file mode 100644 index 4618bbc7e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/6.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b_cde.F; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/7.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/7.proto deleted file mode 100644 index bbe0e6030..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/7.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.bcde.F; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/8.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/8.proto deleted file mode 100644 index 7de7c3621..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/8.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b_cde.f_; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/buf.yaml deleted file mode 100644 index 5092f2bb7..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_lower_snake_case/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a1.proto deleted file mode 100644 index 6a6b42761..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a1.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "d1.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a2.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/a2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b1.proto deleted file mode 100644 index 8a81a6228..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b1.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -import "c1.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b2.proto deleted file mode 100644 index 40d94c1b4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/b2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/buf.yaml deleted file mode 100644 index 1122f1c07..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_NO_IMPORT_CYCLE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c1.proto deleted file mode 100644 index 3b036ee60..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c1.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package c; - -import "d1.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c2.proto deleted file mode 100644 index 6b49d48d1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/c2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package c; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d1.proto deleted file mode 100644 index 15e1cdea5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d1.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package d; - -import "b2.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d2.proto deleted file mode 100644 index a7c098fe2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/d2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package d; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none1.proto deleted file mode 100644 index 5c3453117..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "b1.proto"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none2.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_no_import_cycle/none2.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/a.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/buf.yaml deleted file mode 100644 index 767a9755d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_SAME_DIRECTORY diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/one/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/one/a.proto deleted file mode 100644 index 8184ab04f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory/one/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/buf.yaml deleted file mode 100644 index 767a9755d..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_SAME_DIRECTORY diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/one/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/one/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_directory_no_package/one/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/a.proto deleted file mode 100644 index 1e0c328a2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/a.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -option csharp_namespace = "foo"; -option java_multiple_files = true; -option java_package = "foo"; -option go_package = "foo"; -option php_namespace = "foo"; -option ruby_package = "foo"; -option swift_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/b.proto deleted file mode 100644 index ce71db056..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/b.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -option csharp_namespace = "bar"; -option java_multiple_files = false; -option java_package = "bar"; -option go_package = "bar"; -option php_namespace = "bar"; -option ruby_package = "bar"; -option swift_prefix = "bar"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/buf.yaml deleted file mode 100644 index ffe76f356..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/buf.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_SAME_CSHARP_NAMESPACE - - PACKAGE_SAME_GO_PACKAGE - - PACKAGE_SAME_JAVA_MULTIPLE_FILES - - PACKAGE_SAME_JAVA_PACKAGE - - PACKAGE_SAME_PHP_NAMESPACE - - PACKAGE_SAME_RUBY_PACKAGE - - PACKAGE_SAME_SWIFT_PREFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/a.proto deleted file mode 100644 index f096acec4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/a.proto +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; - -// comment -option csharp_namespace = "foo"; -option java_multiple_files = true; -option java_package = "foo"; -option go_package = "foo"; -option php_namespace = "foo"; -option ruby_package = "foo"; -option swift_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/b.proto deleted file mode 100644 index 942b930f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_same_option_value/sub/b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/buf.yaml deleted file mode 100644 index e4dbb65ee..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - PACKAGE_VERSION_SUFFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar.proto deleted file mode 100644 index f6e89ffaf..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v0beta1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v0beta1.proto deleted file mode 100644 index 05ce82f9e..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v0beta1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.v0beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1.proto deleted file mode 100644 index 14d022824..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.v1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1beta1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1beta1.proto deleted file mode 100644 index 135f84a03..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1beta1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.v1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test.proto deleted file mode 100644 index a9035a49c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.v1test; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test_foo.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test_foo.proto deleted file mode 100644 index a08215c87..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1test_foo.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.v1test.foo; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1testfoo.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1testfoo.proto deleted file mode 100644 index 530b80332..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v1testfoo.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.v1testfoo; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2.proto deleted file mode 100644 index 3ca1eeeb4..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.v2; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2beta0.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2beta0.proto deleted file mode 100644 index 75a357d31..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_v2beta0.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.v2beta0; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_vv1beta1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_vv1beta1.proto deleted file mode 100644 index 951928da9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/foo_bar_vv1beta1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.vv1beta1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/no_package.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/no_package.proto deleted file mode 100644 index d044523b1..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/no_package.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/v1.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/v1.proto deleted file mode 100644 index 97601de87..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/package_version_suffix/v1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package v1; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/a.proto deleted file mode 100644 index c7ed67462..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/a.proto +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Foo { - rpc NoStreaming(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc RequestStreaming(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc ResponseStreaming(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} - rpc BothStreaming(stream google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/buf.yaml deleted file mode 100644 index bafdf4aae..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_no_streaming/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_NO_CLIENT_STREAMING - - RPC_NO_SERVER_STREAMING diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/a.proto deleted file mode 100644 index 22fe1a42f..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/a.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Foo { - rpc Success(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc SuccessTwo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc SuccessFOOThree(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc fail(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc failTwo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc fail_three(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Fail_four(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/buf.yaml deleted file mode 100644 index 829035ae3..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_pascal_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/a.proto deleted file mode 100644 index 9403e0d4b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/a.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -message One {} -message Two {} -message Three {} -message Four {} -message Five {} -message Six {} -message Seven {} -message Eight {} -message Nine {} -message Ten {} -message Eleven {} -message Twelve {} - -service Foo { - rpc On1(One) returns (Two) {} - rpc Tw2(Three) returns (Three) {} - rpc Thre3(Four) returns (One) {} - rpc Fou4(Five) returns (Six) {} - rpc Fiv5(Three) returns (Seven) {} - rpc Si6(Eight) returns (Nine) {} - rpc Seve7(google.protobuf.Empty) returns (Ten) {} - rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} - rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Te1(Twelve) returns (Twelve) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/b.proto deleted file mode 100644 index 295ad9ef0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/b.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -import "a.proto"; - -service Foo { - rpc Baz(a.Six) returns (a.Five) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/buf.yaml deleted file mode 100644 index a0fb66039..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_REQUEST_RESPONSE_UNIQUE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/a.proto deleted file mode 100644 index 9403e0d4b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/a.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -message One {} -message Two {} -message Three {} -message Four {} -message Five {} -message Six {} -message Seven {} -message Eight {} -message Nine {} -message Ten {} -message Eleven {} -message Twelve {} - -service Foo { - rpc On1(One) returns (Two) {} - rpc Tw2(Three) returns (Three) {} - rpc Thre3(Four) returns (One) {} - rpc Fou4(Five) returns (Six) {} - rpc Fiv5(Three) returns (Seven) {} - rpc Si6(Eight) returns (Nine) {} - rpc Seve7(google.protobuf.Empty) returns (Ten) {} - rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} - rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Te1(Twelve) returns (Twelve) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/b.proto deleted file mode 100644 index 295ad9ef0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/b.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -import "a.proto"; - -service Foo { - rpc Baz(a.Six) returns (a.Five) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/buf.yaml deleted file mode 100644 index 9f4160ecf..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_REQUEST_RESPONSE_UNIQUE - rpc_allow_google_protobuf_empty_requests: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/a.proto deleted file mode 100644 index 9403e0d4b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/a.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -message One {} -message Two {} -message Three {} -message Four {} -message Five {} -message Six {} -message Seven {} -message Eight {} -message Nine {} -message Ten {} -message Eleven {} -message Twelve {} - -service Foo { - rpc On1(One) returns (Two) {} - rpc Tw2(Three) returns (Three) {} - rpc Thre3(Four) returns (One) {} - rpc Fou4(Five) returns (Six) {} - rpc Fiv5(Three) returns (Seven) {} - rpc Si6(Eight) returns (Nine) {} - rpc Seve7(google.protobuf.Empty) returns (Ten) {} - rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} - rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Te1(Twelve) returns (Twelve) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/b.proto deleted file mode 100644 index 295ad9ef0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/b.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -import "a.proto"; - -service Foo { - rpc Baz(a.Six) returns (a.Five) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/buf.yaml deleted file mode 100644 index e6c28b879..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_requests_and_responses/buf.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_REQUEST_RESPONSE_UNIQUE - rpc_allow_google_protobuf_empty_requests: true - rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/a.proto deleted file mode 100644 index 9403e0d4b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/a.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -message One {} -message Two {} -message Three {} -message Four {} -message Five {} -message Six {} -message Seven {} -message Eight {} -message Nine {} -message Ten {} -message Eleven {} -message Twelve {} - -service Foo { - rpc On1(One) returns (Two) {} - rpc Tw2(Three) returns (Three) {} - rpc Thre3(Four) returns (One) {} - rpc Fou4(Five) returns (Six) {} - rpc Fiv5(Three) returns (Seven) {} - rpc Si6(Eight) returns (Nine) {} - rpc Seve7(google.protobuf.Empty) returns (Ten) {} - rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} - rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Te1(Twelve) returns (Twelve) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/b.proto deleted file mode 100644 index 295ad9ef0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/b.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -import "a.proto"; - -service Foo { - rpc Baz(a.Six) returns (a.Five) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/buf.yaml deleted file mode 100644 index 2fdfef1f5..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_empty_responses/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_REQUEST_RESPONSE_UNIQUE - rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/a.proto deleted file mode 100644 index 9403e0d4b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/a.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -message One {} -message Two {} -message Three {} -message Four {} -message Five {} -message Six {} -message Seven {} -message Eight {} -message Nine {} -message Ten {} -message Eleven {} -message Twelve {} - -service Foo { - rpc On1(One) returns (Two) {} - rpc Tw2(Three) returns (Three) {} - rpc Thre3(Four) returns (One) {} - rpc Fou4(Five) returns (Six) {} - rpc Fiv5(Three) returns (Seven) {} - rpc Si6(Eight) returns (Nine) {} - rpc Seve7(google.protobuf.Empty) returns (Ten) {} - rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} - rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Te1(Twelve) returns (Twelve) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/b.proto deleted file mode 100644 index 295ad9ef0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/b.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -import "a.proto"; - -service Foo { - rpc Baz(a.Six) returns (a.Five) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/buf.yaml deleted file mode 100644 index 982e82275..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_REQUEST_RESPONSE_UNIQUE - rpc_allow_same_request_response: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/a.proto deleted file mode 100644 index 9403e0d4b..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/a.proto +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -message One {} -message Two {} -message Three {} -message Four {} -message Five {} -message Six {} -message Seven {} -message Eight {} -message Nine {} -message Ten {} -message Eleven {} -message Twelve {} - -service Foo { - rpc On1(One) returns (Two) {} - rpc Tw2(Three) returns (Three) {} - rpc Thre3(Four) returns (One) {} - rpc Fou4(Five) returns (Six) {} - rpc Fiv5(Three) returns (Seven) {} - rpc Si6(Eight) returns (Nine) {} - rpc Seve7(google.protobuf.Empty) returns (Ten) {} - rpc Eigh8(Eleven) returns (google.protobuf.Empty) {} - rpc Nin9(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Te1(Twelve) returns (Twelve) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/b.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/b.proto deleted file mode 100644 index 295ad9ef0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/b.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -import "a.proto"; - -service Foo { - rpc Baz(a.Six) returns (a.Five) {} -} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/buf.yaml deleted file mode 100644 index ae25b4357..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_request_response_unique_allow_same_and_empty_request_responses/buf.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_REQUEST_RESPONSE_UNIQUE - rpc_allow_same_request_response: true - rpc_allow_google_protobuf_empty_requests: true - rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/a.proto deleted file mode 100644 index ec94fec46..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/a.proto +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Foo { - rpc Success(SuccessRequest) returns (SuccessResponse) {} - rpc AnotherSuccess(FooAnotherSuccessRequest) returns (FooAnotherSuccessResponse) {} - rpc FailRequest(Bar) returns (FailRequestResponse) {} - rpc FailResponse(FailResponseRequest) returns (Bar) {} - rpc NoAllowEmptyRequest(google.protobuf.Empty) returns (NoAllowEmptyRequestResponse) {} - rpc NoAllowEmptyResponse(NoAllowEmptyResponseRequest) returns (google.protobuf.Empty) {} -} - -message SuccessRequest {} -message SuccessResponse {} -message FooAnotherSuccessRequest {} -message FooAnotherSuccessResponse {} -message FailRequestResponse {} -message FailResponseRequest {} -message NoAllowEmptyRequestResponse {} -message NoAllowEmptyResponseRequest {} -message Bar {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/buf.yaml deleted file mode 100644 index 0e02b39ad..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_REQUEST_STANDARD_NAME - - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/a.proto deleted file mode 100644 index f015662a8..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/a.proto +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Foo { - rpc Success(SuccessRequest) returns (SuccessResponse) {} - rpc AnotherSuccess(FooAnotherSuccessRequest) returns (FooAnotherSuccessResponse) {} - rpc FailRequest(Bar) returns (FailRequestResponse) {} - rpc FailResponse(FailResponseRequest) returns (Bar) {} - rpc AllowEmptyRequest(google.protobuf.Empty) returns (AllowEmptyRequestResponse) {} - rpc AllowEmptyResponse(AllowEmptyResponseRequest) returns (google.protobuf.Empty) {} -} - -message SuccessRequest {} -message SuccessResponse {} -message FooAnotherSuccessRequest {} -message FooAnotherSuccessResponse {} -message FailRequestResponse {} -message FailResponseRequest {} -message AllowEmptyRequestResponse {} -message AllowEmptyResponseRequest {} -message Bar {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/buf.yaml deleted file mode 100644 index 62cdb21ed..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/rpc_standard_name_allow_empty/buf.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - RPC_REQUEST_STANDARD_NAME - - RPC_RESPONSE_STANDARD_NAME - rpc_allow_google_protobuf_empty_requests: true - rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/a.proto deleted file mode 100644 index 067612dd7..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/a.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -service Success {} -service SuccessTwo {} -service SuccessFOOThree {} -service fail {} -service failTwo {} -service fail_three {} -service Fail_four {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/buf.yaml deleted file mode 100644 index 65b46e133..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_pascal_case/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - SERVICE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/a.proto deleted file mode 100644 index 1f6ff4f09..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/a.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -service SuccessService {} -service SuccessTwoService {} -service SuccessThree_Service {} -service Fail {} -service FailAPI {} -service FailService_ {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/buf.yaml deleted file mode 100644 index 8efd01bf2..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - SERVICE_SUFFIX diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/a.proto deleted file mode 100644 index 79757ca87..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/a.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -service SuccessAPI {} -service SuccessTwoAPI {} -service SuccessThree_API {} -service Fail {} -service FailService {} -service FailAPI_ {} -service FailApi_ {} diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/buf.yaml deleted file mode 100644 index f346805c0..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/service_suffix_custom/buf.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - SERVICE_SUFFIX - service_suffix: API diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a.proto deleted file mode 100644 index 3fda14778..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// comment - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a2.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a2.proto deleted file mode 100644 index 1327f3ff9..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a2.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// comment - -syntax = "proto2"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a3.proto b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a3.proto deleted file mode 100644 index d7127f36c..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/a/a3.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// comment - -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/buf.yaml b/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/buf.yaml deleted file mode 100644 index 40e596cca..000000000 --- a/pkg/bufman/bufpkg/bufcheck/buflint/testdata/syntax_specified/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -lint: - use: - - SYNTAX_SPECIFIED diff --git a/pkg/bufman/bufpkg/bufgraph/bufgraph_test.go b/pkg/bufman/bufpkg/bufgraph/bufgraph_test.go deleted file mode 100644 index 3f412906d..000000000 --- a/pkg/bufman/bufpkg/bufgraph/bufgraph_test.go +++ /dev/null @@ -1,123 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufgraph - -import ( - "context" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/buf/bufwork" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufconfig" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestBasic(t *testing.T) { - t.Parallel() - - ctx := context.Background() - workspace, err := testBuildWorkspace(ctx, filepath.Join("testdata", "basic")) - require.NoError(t, err) - builder := NewBuilder( - zap.NewNop(), - bufmodule.NewNopModuleResolver(), - bufmodule.NewNopModuleReader(), - ) - graph, fileAnnotations, err := builder.Build( - ctx, - workspace.GetModules(), - BuildWithWorkspace(workspace), - ) - require.NoError(t, err) - require.Empty(t, fileAnnotations) - dotString, err := graph.DOTString(func(key Node) string { return key.String() }) - require.NoError(t, err) - require.Equal( - t, - `digraph { - - 1 [label="bsr.internal/foo/test-a"] - 2 [label="bsr.internal/foo/test-b"] - 3 [label="bsr.internal/foo/test-c"] - 4 [label="bsr.internal/foo/test-d"] - 5 [label="bsr.internal/foo/test-e"] - 6 [label="bsr.internal/foo/test-f"] - 7 [label="bsr.internal/foo/test-g"] - - 1 -> 2 - 2 -> 3 - 3 -> 4 - 1 -> 4 - 1 -> 5 - 5 -> 6 - 7 - -}`, - dotString, - ) -} - -// TODO: This entire function is all you should need to do to build workspaces, and even -// this is overly complicated because of the wonkiness of bufmodulebuild and NewWorkspace. -// We should have this in a common place for at least testing. -func testBuildWorkspace(ctx context.Context, workspacePath string) (bufmodule.Workspace, error) { - workspaceBucket, err := storageos.NewProvider().NewReadWriteBucket(workspacePath) - if err != nil { - return nil, err - } - workspaceConfig, err := bufwork.GetConfigForBucket(ctx, workspaceBucket, ".") - if err != nil { - return nil, err - } - moduleBucketBuilder := bufmodulebuild.NewModuleBucketBuilder() - namedModules := make(map[string]bufmodule.Module, len(workspaceConfig.Directories)) - allModules := make([]bufmodule.Module, 0, len(workspaceConfig.Directories)) - for _, directory := range workspaceConfig.Directories { - moduleBucket := storage.MapReadBucket( - workspaceBucket, - storage.MapOnPrefix(directory), - ) - moduleConfig, err := bufconfig.GetConfigForBucket(ctx, moduleBucket) - if err != nil { - return nil, err - } - module, err := moduleBucketBuilder.BuildForBucket( - ctx, - moduleBucket, - moduleConfig.Build, - bufmodulebuild.WithModuleIdentity( - moduleConfig.ModuleIdentity, - ), - ) - if err != nil { - return nil, err - } - if moduleConfig.ModuleIdentity != nil { - namedModules[moduleConfig.ModuleIdentity.IdentityString()] = module - } - allModules = append(allModules, module) - } - return bufmodule.NewWorkspace( - ctx, - namedModules, - allModules, - ) -} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/buf.work.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/buf.work.yaml deleted file mode 100644 index b3b101101..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/buf.work.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -directories: - - test-a - - test-b - - test-c - - test-d - - test-e - - test-f - - test-g diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a/v1/a.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a/v1/a.proto deleted file mode 100644 index 9c5282de0..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a/v1/a.proto +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a.v1; - -import "b/v1/b.proto"; -import "d/v1/d.proto"; -import "e/v1/e.proto"; - -message A { - b.v1.B b = 1; - d.v1.D d = 2; - e.v1.E e = 3; -} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a2/v1/a2.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a2/v1/a2.proto deleted file mode 100644 index b561c965f..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/a2/v1/a2.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a2.v1; - -import "e/v1/e.proto"; - -message A2 { - e.v1.E e = 3; -} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/buf.yaml deleted file mode 100644 index a7f1bd17c..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-a/buf.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: bsr.internal/foo/test-a -deps: - - bsr.internal/foo/test-b - - bsr.internal/foo/test-d - - bsr.internal/foo/test-e diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/b/v1/b.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/b/v1/b.proto deleted file mode 100644 index a929237fa..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/b/v1/b.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b.v1; - -import "c/v1/c.proto"; - -message B { - c.v1.C c = 1; -} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/buf.yaml deleted file mode 100644 index d90207697..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-b/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: bsr.internal/foo/test-b -deps: - - bsr.internal/foo/test-c diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/buf.yaml deleted file mode 100644 index b9285158c..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: bsr.internal/foo/test-c -deps: - - bsr.internal/foo/test-d diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/c/v1/c.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/c/v1/c.proto deleted file mode 100644 index 9bfc9a301..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-c/c/v1/c.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package c.v1; - -import "d/v1/d.proto"; - -message C { - d.v1.D d = 1; -} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/buf.yaml deleted file mode 100644 index 96069e725..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/buf.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: bsr.internal/foo/test-d diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/d/v1/d.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/d/v1/d.proto deleted file mode 100644 index 95c4b33fe..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-d/d/v1/d.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package d.v1; - -message D {} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/buf.yaml deleted file mode 100644 index 22e0cc18d..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/buf.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: bsr.internal/foo/test-e -deps: - - bsr.internal/foo/test-f diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/e/v1/e.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/e/v1/e.proto deleted file mode 100644 index 49f02ef14..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-e/e/v1/e.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package e.v1; - -import "f/v1/f.proto"; - -message E { - f.v1.F f = 1; -} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/buf.yaml deleted file mode 100644 index e56c05319..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/buf.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: bsr.internal/foo/test-f diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/f/v1/f.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/f/v1/f.proto deleted file mode 100644 index 8859fb553..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-f/f/v1/f.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package f.v1; - -message F {} diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/buf.yaml b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/buf.yaml deleted file mode 100644 index ec553f005..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/buf.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: bsr.internal/foo/test-g diff --git a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/g/v1/g.proto b/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/g/v1/g.proto deleted file mode 100644 index 47c3894fa..000000000 --- a/pkg/bufman/bufpkg/bufgraph/testdata/basic/test-g/g/v1/g.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package g.v1; - -message G {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_test.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_test.go deleted file mode 100644 index 7cf4316a8..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_test.go +++ /dev/null @@ -1,428 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagebuild - -import ( - "context" - "errors" - "fmt" - "path/filepath" - "sort" - "strings" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimageutil" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buftesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protosource" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/prototesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/testingextended" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/thread" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -var buftestingDirPath = filepath.Join( - "..", - "..", - "buftesting", -) - -func TestGoogleapis(t *testing.T) { - testingextended.SkipIfShort(t) - t.Parallel() - image := testBuildGoogleapis(t, true) - assert.Equal(t, buftesting.NumGoogleapisFilesWithImports, len(image.Files())) - assert.Equal( - t, - []string{ - "google/protobuf/any.proto", - "google/protobuf/api.proto", - "google/protobuf/descriptor.proto", - "google/protobuf/duration.proto", - "google/protobuf/empty.proto", - "google/protobuf/field_mask.proto", - "google/protobuf/source_context.proto", - "google/protobuf/struct.proto", - "google/protobuf/timestamp.proto", - "google/protobuf/type.proto", - "google/protobuf/wrappers.proto", - }, - testGetImageImportPaths(image), - ) - - imageWithoutImports := bufimage.ImageWithoutImports(image) - assert.Equal(t, buftesting.NumGoogleapisFiles, len(imageWithoutImports.Files())) - imageWithoutImports = bufimage.ImageWithoutImports(imageWithoutImports) - assert.Equal(t, buftesting.NumGoogleapisFiles, len(imageWithoutImports.Files())) - - imageWithSpecificNames, err := bufimage.ImageWithOnlyPathsAllowNotExist( - image, - []string{ - "google/protobuf/descriptor.proto", - "google/protobuf/api.proto", - "google/type/date.proto", - "google/foo/nonsense.proto", - }, - nil, - ) - assert.NoError(t, err) - assert.Equal( - t, - []string{ - "google/protobuf/any.proto", - "google/protobuf/api.proto", - "google/protobuf/descriptor.proto", - "google/protobuf/source_context.proto", - "google/protobuf/type.proto", - "google/type/date.proto", - }, - testGetImageFilePaths(imageWithSpecificNames), - ) - imageWithSpecificNames, err = bufimage.ImageWithOnlyPathsAllowNotExist( - image, - []string{ - "google/protobuf/descriptor.proto", - "google/protobuf/api.proto", - "google/type", - "google/foo", - }, - nil, - ) - assert.NoError(t, err) - assert.Equal( - t, - []string{ - "google/protobuf/any.proto", - "google/protobuf/api.proto", - "google/protobuf/descriptor.proto", - "google/protobuf/source_context.proto", - "google/protobuf/type.proto", - "google/protobuf/wrappers.proto", - "google/type/calendar_period.proto", - "google/type/color.proto", - "google/type/date.proto", - "google/type/dayofweek.proto", - "google/type/expr.proto", - "google/type/fraction.proto", - "google/type/latlng.proto", - "google/type/money.proto", - "google/type/postal_address.proto", - "google/type/quaternion.proto", - "google/type/timeofday.proto", - }, - testGetImageFilePaths(imageWithSpecificNames), - ) - imageWithoutImports = bufimage.ImageWithoutImports(imageWithSpecificNames) - assert.Equal( - t, - []string{ - "google/protobuf/api.proto", - "google/protobuf/descriptor.proto", - "google/type/calendar_period.proto", - "google/type/color.proto", - "google/type/date.proto", - "google/type/dayofweek.proto", - "google/type/expr.proto", - "google/type/fraction.proto", - "google/type/latlng.proto", - "google/type/money.proto", - "google/type/postal_address.proto", - "google/type/quaternion.proto", - "google/type/timeofday.proto", - }, - testGetImageFilePaths(imageWithoutImports), - ) - _, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "google/protobuf/descriptor.proto", - "google/protobuf/api.proto", - "google/type/date.proto", - "google/foo/nonsense.proto", - }, - nil, - ) - assert.Equal(t, errors.New(`path "google/foo/nonsense.proto" has no matching file in the image`), err) - _, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "google/protobuf/descriptor.proto", - "google/protobuf/api.proto", - "google/type/date.proto", - "google/foo", - }, - nil, - ) - assert.Equal(t, errors.New(`path "google/foo" has no matching file in the image`), err) - - imageWithPathsAndExcludes, err := bufimage.ImageWithOnlyPaths( - image, - []string{ - "google/type", - }, - []string{ - "google/type/calendar_period.proto", - "google/type/date.proto", - }, - ) - assert.NoError(t, err) - assert.Equal(t, - []string{ - "google/protobuf/wrappers.proto", - "google/type/color.proto", - "google/type/dayofweek.proto", - "google/type/expr.proto", - "google/type/fraction.proto", - "google/type/latlng.proto", - "google/type/money.proto", - "google/type/postal_address.proto", - "google/type/quaternion.proto", - "google/type/timeofday.proto", - }, - testGetImageFilePaths(imageWithPathsAndExcludes), - ) - - excludePaths := []string{ - "google/type/calendar_period.proto", - "google/type/quaternion.proto", - "google/type/money.proto", - "google/type/color.proto", - "google/type/date.proto", - } - imageWithExcludes, err := bufimage.ImageWithOnlyPaths(image, []string{}, excludePaths) - assert.NoError(t, err) - testImageWithExcludedFilePaths(t, imageWithExcludes, excludePaths) - - assert.Equal(t, buftesting.NumGoogleapisFilesWithImports, len(image.Files())) - // basic check to make sure there is no error at this scale - _, err = protosource.NewFilesUnstable(context.Background(), bufimageutil.NewInputFiles(image.Files())...) - assert.NoError(t, err) -} - -func TestCompareCustomOptions1(t *testing.T) { - t.Parallel() - runner := command.NewRunner() - testCompare(t, runner, "customoptions1") -} - -func TestCompareProto3Optional1(t *testing.T) { - t.Parallel() - runner := command.NewRunner() - testCompare(t, runner, "proto3optional1") -} - -func TestCompareTrailingComments(t *testing.T) { - t.Parallel() - runner := command.NewRunner() - testCompare(t, runner, "trailingcomments") -} - -func TestCustomOptionsError1(t *testing.T) { - t.Parallel() - testFileAnnotations( - t, - "customoptionserror1", - filepath.FromSlash("testdata/customoptionserror1/b.proto:9:27:field a.Baz.bat: option (a.foo).bat: field bat of a.Foo does not exist"), - ) -} - -func TestNotAMessageType(t *testing.T) { - t.Parallel() - testFileAnnotations( - t, - "notamessagetype", - filepath.FromSlash("testdata/notamessagetype/a.proto:9:11:method a.MyService.Foo: invalid request type: a.MyService.Foo is a method, not a message"), - ) -} - -func TestSpaceBetweenNumberAndID(t *testing.T) { - t.Parallel() - testFileAnnotations( - t, - "spacebetweennumberandid", - filepath.FromSlash("testdata/spacebetweennumberandid/a.proto:6:14:invalid syntax in integer value: 10to"), - filepath.FromSlash("testdata/spacebetweennumberandid/a.proto:6:14:syntax error: unexpected error, expecting int literal"), - ) -} - -func TestCyclicImport(t *testing.T) { - t.Parallel() - testFileAnnotations( - t, - "cyclicimport", - // Since the compiler is multi-threaded, order of file compilation can happen one of two ways - fmt.Sprintf(`%s:5:8:cycle found in imports: "a/a.proto" -> "b/b.proto" -> "a/a.proto" - || %s:5:8:cycle found in imports: "b/b.proto" -> "a/a.proto" -> "b/b.proto"`, - filepath.FromSlash("testdata/cyclicimport/a/a.proto"), - filepath.FromSlash("testdata/cyclicimport/b/b.proto"), - ), - ) -} - -func TestDuplicateSyntheticOneofs(t *testing.T) { - // https://github.com/ProtobufMan/bufman-cli/issues/1071 - t.Parallel() - testFileAnnotations( - t, - "duplicatesyntheticoneofs", - // Since the compiler is multi-threaded, order of file compilation can happen one of two ways - filepath.FromSlash(`testdata/duplicatesyntheticoneofs/a1.proto:5:9:symbol "a.Foo" already defined at a2.proto:5:9 - || testdata/duplicatesyntheticoneofs/a2.proto:5:9:symbol "a.Foo" already defined at a1.proto:5:9`), - filepath.FromSlash(`testdata/duplicatesyntheticoneofs/a1.proto:6:19:symbol "a.Foo._bar" already defined at a2.proto:6:19 - || testdata/duplicatesyntheticoneofs/a2.proto:6:19:symbol "a.Foo._bar" already defined at a1.proto:6:19`), - filepath.FromSlash(`testdata/duplicatesyntheticoneofs/a1.proto:6:19:symbol "a.Foo.bar" already defined at a2.proto:6:19 - || testdata/duplicatesyntheticoneofs/a2.proto:6:19:symbol "a.Foo.bar" already defined at a1.proto:6:19`), - ) -} - -func TestOptionPanic(t *testing.T) { - t.Parallel() - require.NotPanics(t, func() { - module := testGetModule(t, filepath.Join("testdata", "optionpanic")) - _, _, err := NewBuilder(zap.NewNop(), bufmodule.NewNopModuleReader()).Build( - context.Background(), - module, - ) - require.NoError(t, err) - }) -} - -func TestCompareSemicolons(t *testing.T) { - t.Parallel() - runner := command.NewRunner() - testCompare(t, runner, "semicolons") -} - -func testCompare(t *testing.T, runner command.Runner, relDirPath string) { - dirPath := filepath.Join("testdata", relDirPath) - image, fileAnnotations := testBuild(t, false, dirPath) - require.Equal(t, 0, len(fileAnnotations), fileAnnotations) - image = bufimage.ImageWithoutImports(image) - fileDescriptorSet := bufimage.ImageToFileDescriptorSet(image) - filePaths := buftesting.GetProtocFilePaths(t, dirPath, 0) - actualProtocFileDescriptorSet := buftesting.GetActualProtocFileDescriptorSet(t, runner, false, false, dirPath, filePaths) - prototesting.AssertFileDescriptorSetsEqual(t, runner, fileDescriptorSet, actualProtocFileDescriptorSet) -} - -func testBuildGoogleapis(t *testing.T, includeSourceInfo bool) bufimage.Image { - googleapisDirPath := buftesting.GetGoogleapisDirPath(t, buftestingDirPath) - image, fileAnnotations := testBuild(t, includeSourceInfo, googleapisDirPath) - require.Equal(t, 0, len(fileAnnotations), fileAnnotations) - return image -} - -func testBuild(t *testing.T, includeSourceInfo bool, dirPath string) (bufimage.Image, []bufanalysis.FileAnnotation) { - module := testGetModule(t, dirPath) - var options []BuildOption - if !includeSourceInfo { - options = append(options, WithExcludeSourceCodeInfo()) - } - image, fileAnnotations, err := NewBuilder(zap.NewNop(), bufmodule.NewNopModuleReader()).Build( - context.Background(), - module, - options..., - ) - require.NoError(t, err) - return image, fileAnnotations -} - -func testGetModule(t *testing.T, dirPath string) bufmodule.Module { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - dirPath, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - config, err := bufmoduleconfig.NewConfigV1(bufmoduleconfig.ExternalConfigV1{}) - require.NoError(t, err) - module, err := bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config, - ) - require.NoError(t, err) - return module -} - -func testGetImageFilePaths(image bufimage.Image) []string { - var fileNames []string - for _, file := range image.Files() { - fileNames = append(fileNames, file.Path()) - } - sort.Strings(fileNames) - return fileNames -} - -func testGetImageImportPaths(image bufimage.Image) []string { - var importNames []string - for _, file := range image.Files() { - if file.IsImport() { - importNames = append(importNames, file.Path()) - } - } - sort.Strings(importNames) - return importNames -} - -func testFileAnnotations(t *testing.T, relDirPath string, want ...string) { - t.Helper() - - // Allowing real parallelism makes some test expectations too complicated to express and assert - previousParallelism := thread.Parallelism() - thread.SetParallelism(1) - defer func() { - thread.SetParallelism(previousParallelism) - }() - - _, fileAnnotations := testBuild(t, false, filepath.Join("testdata", filepath.FromSlash(relDirPath))) - got := make([]string, len(fileAnnotations)) - for i, annotation := range fileAnnotations { - got[i] = annotation.String() - } - require.Equal(t, len(want), len(got)) - for i := range want { - options := strings.Split(want[i], "||") - matched := false - for _, option := range options { - option = strings.TrimSpace(option) - if got[i] == option { - matched = true - break - } - } - require.True(t, matched, "annotation at index %d: wanted %q ; got %q", i, want[i], got[i]) - } -} - -func testImageWithExcludedFilePaths(t *testing.T, image bufimage.Image, excludePaths []string) { - t.Helper() - for _, imageFile := range image.Files() { - if !imageFile.IsImport() { - for _, excludePath := range excludePaths { - assert.False(t, normalpath.EqualsOrContainsPath(excludePath, imageFile.Path(), normalpath.Relative), "paths: %s, %s", imageFile.Path(), excludePath) - } - } - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_unix_test.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_unix_test.go deleted file mode 100644 index 1d7f8e9ff..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/builder_unix_test.go +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris - -package bufimagebuild - -import ( - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buftesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/prototesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/testingextended" - "github.com/stretchr/testify/assert" - "google.golang.org/protobuf/types/descriptorpb" -) - -func TestCompareGoogleapis(t *testing.T) { - testingextended.SkipIfShort(t) - // Don't run in parallel as it allocates a lot of memory - // cannot directly compare with source code info as buf alpha protoc creates additional source - // code infos that protoc does not - image := testBuildGoogleapis(t, false) - fileDescriptorSet := bufimage.ImageToFileDescriptorSet(image) - runner := command.NewRunner() - actualProtocFileDescriptorSet := testBuildActualProtocGoogleapis(t, runner, false) - prototesting.AssertFileDescriptorSetsEqual( - t, - runner, - fileDescriptorSet, - actualProtocFileDescriptorSet, - ) -} - -func testBuildActualProtocGoogleapis(t *testing.T, runner command.Runner, includeSourceInfo bool) *descriptorpb.FileDescriptorSet { - googleapisDirPath := buftesting.GetGoogleapisDirPath(t, buftestingDirPath) - filePaths := buftesting.GetProtocFilePaths(t, googleapisDirPath, 0) - fileDescriptorSet := buftesting.GetActualProtocFileDescriptorSet(t, runner, true, includeSourceInfo, googleapisDirPath, filePaths) - assert.Equal(t, buftesting.NumGoogleapisFilesWithImports, len(fileDescriptorSet.GetFile())) - - return fileDescriptorSet -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptions1/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptions1/a.proto deleted file mode 100644 index 23ea761b4..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptions1/a.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.FieldOptions { - int32 baz = 50007; -} - -message Foo { - string bar = 1 [(baz) = 42]; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/a.proto deleted file mode 100644 index c5ff9a66e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/a.proto +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.FieldOptions { - Foo foo = 50007; -} - -message Foo { - string bar = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/b.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/b.proto deleted file mode 100644 index f54ff9b5d..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/customoptionserror1/b.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "a.proto"; - -message Baz { - // the name is actually (a.foo).bar - string bat = 1 [(a.foo).bat = 1]; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/a/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/a/a.proto deleted file mode 100644 index 59f7ddb55..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/a/a.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -import "b/b.proto"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/b/b.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/b/b.proto deleted file mode 100644 index f044d7ef0..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/cyclicimport/b/b.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package b; - -import "a/a.proto"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a1.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a1.proto deleted file mode 100644 index 325429faf..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a1.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Foo { - optional string bar = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a2.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a2.proto deleted file mode 100644 index 325429faf..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/duplicatesyntheticoneofs/a2.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -message Foo { - optional string bar = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/notamessagetype/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/notamessagetype/a.proto deleted file mode 100644 index 10177589b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/notamessagetype/a.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax="proto3"; - -package a; - -message Foo{} -message Bar{} - -service MyService{ - rpc Foo(Foo) returns (Bar); -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/options/option.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/options/option.proto deleted file mode 100644 index 57df78a69..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/options/option.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package options; - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.FileOptions { - MyOption my_option = 9999; -} - -message MyOption { - repeated MyArray my_array = 1; -} - -message MyArray { - message TestMessage { - } - map my_map = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/proto/test.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/proto/test.proto deleted file mode 100644 index 1dbf66e3a..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/optionpanic/proto/test.proto +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package proto; - -import "options/option.proto"; - -option (options.my_option) = { - my_array: { - my_map: { - } - } -}; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/proto3optional1/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/proto3optional1/a.proto deleted file mode 100644 index 1ea297ce4..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/proto3optional1/a.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -message Foo { - optional string bar = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/semicolons/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/semicolons/a.proto deleted file mode 100644 index e0f8cd74d..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/semicolons/a.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax="proto3";;;; -;;; -;package a;;;;; -; -;;;;import "google/protobuf/descriptor.proto"; -;; -; -;;extend google.protobuf.FileOptions { - bool foo = 9999999; -} -; -;message Bar { - ;;;option deprecated = true;;;; - ;;;; - int32 one = 1;;;; - ;repeated bool two = 2 [deprecated = true];; - map three = 3 [ - deprecated = false - ];;;; -};;;; -;; -;enum Baz { - ;;;;option deprecated = true;;;; - - ;DEFAULT = 0;;;; - ONE = 1;;; - TWO = 2;;;; -};;; -;; -;service BatService { -; ;option deprecated = true;;;; -; - ;rpc Bam(Bar) returns (Other);;; -; - rpc Ban(Other) returns (Bar) { - ; ;option deprecated = true;;;; - };;;; -};;;; -; -; -;;;;message Other{;;;};;;;; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/spacebetweennumberandid/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/spacebetweennumberandid/a.proto deleted file mode 100644 index d56a9a2a3..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/spacebetweennumberandid/a.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax="proto2"; - -package a; - -message Test{ - extensions 10to max; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/trailingcomments/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/trailingcomments/a.proto deleted file mode 100644 index 461639170..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/testdata/trailingcomments/a.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package a; - -// https://github.com/ProtobufMan/bufman-cli/issues/798 - -enum Foo { // first comment - FOO_UNSPECIFIED = 0; -} // second comment diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go deleted file mode 100644 index 8e0c5f13a..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go +++ /dev/null @@ -1,113 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -const ( - testImportPathPrefix = "github.com/foo/bar/private/gen/proto/go" - testRemote = "modulerepo.internal" - testRepositoryOwner = "testowner" - testRepositoryName = "testrepository" -) - -func assertFileOptionSourceCodeInfoEmpty(t *testing.T, image bufimage.Image, fileOptionPath []int32, includeSourceInfo bool) { - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - - if !includeSourceInfo { - assert.Empty(t, descriptor.SourceCodeInfo) - continue - } - - var hasFileOption bool - for _, location := range descriptor.SourceCodeInfo.Location { - if len(location.Path) > 0 && int32SliceIsEqual(location.Path, fileOptionPath) { - hasFileOption = true - break - } - } - assert.False(t, hasFileOption) - } -} - -func assertFileOptionSourceCodeInfoNotEmpty(t *testing.T, image bufimage.Image, fileOptionPath []int32) { - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - - var hasFileOption bool - for _, location := range descriptor.SourceCodeInfo.Location { - if len(location.Path) > 0 && int32SliceIsEqual(location.Path, fileOptionPath) { - hasFileOption = true - break - } - } - assert.True(t, hasFileOption) - } -} - -func testGetImage(t *testing.T, dirPath string, includeSourceInfo bool) bufimage.Image { - module := testGetModule(t, dirPath) - var options []bufimagebuild.BuildOption - if !includeSourceInfo { - options = []bufimagebuild.BuildOption{bufimagebuild.WithExcludeSourceCodeInfo()} - } - image, annotations, err := bufimagebuild.NewBuilder( - zap.NewNop(), - bufmodule.NewNopModuleReader(), - ).Build( - context.Background(), - module, - options..., - ) - require.NoError(t, err) - require.Empty(t, annotations) - return image -} - -func testGetModule(t *testing.T, dirPath string) bufmodule.Module { - storageosProvider := storageos.NewProvider() - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - dirPath, - ) - require.NoError(t, err) - moduleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - module, err := bufmodule.NewModuleForBucket( - context.Background(), - readWriteBucket, - bufmodule.ModuleWithModuleIdentityAndCommit(moduleIdentity, bufmoduletesting.TestCommit), - ) - require.NoError(t, err) - return module -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas_test.go deleted file mode 100644 index ca4804035..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/cc_enable_arenas_test.go +++ /dev/null @@ -1,386 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestCcEnableArenasEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, false, nil) - require.NoError(t, err) - modifier := NewMultiModifier( - ccEnableArenasModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, false, nil) - require.NoError(t, err) - err = ccEnableArenasModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) - require.NoError(t, err) - modifier := NewMultiModifier( - ccEnableArenasModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - continue - } - assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) - require.NoError(t, err) - err = ccEnableArenasModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - continue - } - assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - }) -} - -func TestCcEnableArenasAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - modifier := NewMultiModifier( - ccEnableArenasModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - err = ccEnableArenasModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}) - require.NoError(t, err) - modifier := NewMultiModifier( - ccEnableArenasModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) - continue - } - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}) - require.NoError(t, err) - err = ccEnableArenasModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) - continue - } - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - }) -} - -func TestCcEnableArenasCcOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "ccoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - modifier := NewMultiModifier( - ccEnableArenasModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - err = ccEnableArenasModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, ccEnableArenasPath) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}) - require.NoError(t, err) - modifier := NewMultiModifier( - ccEnableArenasModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) - continue - } - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - } - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}) - require.NoError(t, err) - err = ccEnableArenasModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.False(t, descriptor.GetOptions().GetCcEnableArenas()) - continue - } - assert.True(t, descriptor.GetOptions().GetCcEnableArenas()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, ccEnableArenasPath, false) - }) -} - -func TestCcEnableArenasWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - modifier := NewMultiModifier( - ccEnableArenasModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - assert.True(t, imageFile.Proto().GetOptions().GetCcEnableArenas()) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - ccEnableArenasModifier, err := CcEnableArenas(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - err = ccEnableArenasModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - assert.True(t, imageFile.Proto().GetOptions().GetCcEnableArenas()) - } - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace_test.go deleted file mode 100644 index 69ecf5b8c..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/csharp_namespace_test.go +++ /dev/null @@ -1,628 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "strings" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestCsharpNamespaceEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "foo"}) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - // Overwritten with "foo" in the namespace - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetCsharpNamespace()) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "foo"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - // Overwritten with "foo" in the namespace - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetCsharpNamespace()) - }) -} - -func TestCsharpNamespaceAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "bar"}) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - // Overwritten with "bar" in the namespace - assert.Equal(t, "bar", descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "bar"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - // Overwritten with "bar" in the namespace - assert.Equal(t, "bar", descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - }) -} - -func TestCsharpNamespaceOptions(t *testing.T) { - t.Parallel() - testCsharpNamespaceOptions(t, filepath.Join("testdata", "csharpoptions", "single"), "Acme.V1") - testCsharpNamespaceOptions(t, filepath.Join("testdata", "csharpoptions", "double"), "Acme.Weather.V1") - testCsharpNamespaceOptions(t, filepath.Join("testdata", "csharpoptions", "triple"), "Acme.Weather.Data.V1") - testCsharpNamespaceOptions(t, filepath.Join("testdata", "csharpoptions", "underscore"), "Acme.Weather.FooBar.V1") -} - -func testCsharpNamespaceOptions(t *testing.T, dirPath string, classPrefix string) { - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - }) - - t.Run("with SourceCodeInfo and per-file options", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, csharpNamespacePath) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"override.proto": "Acme.Override.V1"}) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "Acme.Override.V1", descriptor.GetOptions().GetCsharpNamespace()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, map[string]string{"override.proto": "Acme.Override.V1"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "Acme.Override.V1", descriptor.GetOptions().GetCsharpNamespace()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - }) -} - -func TestCsharpNamespaceWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - modifiedCsharpNamespace := "Acme.Weather.V1alpha1" - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.NotEmpty(t, descriptor.GetOptions().GetCsharpNamespace()) - assert.NotEqual(t, modifiedCsharpNamespace, descriptor.GetOptions().GetCsharpNamespace()) - continue - } - assert.Equal(t, - modifiedCsharpNamespace, - descriptor.GetOptions().GetCsharpNamespace(), - ) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - modifier := CsharpNamespace(zap.NewNop(), sweeper, nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.NotEmpty(t, descriptor.GetOptions().GetCsharpNamespace()) - assert.NotEqual(t, modifiedCsharpNamespace, descriptor.GetOptions().GetCsharpNamespace()) - continue - } - assert.Equal(t, - modifiedCsharpNamespace, - descriptor.GetOptions().GetCsharpNamespace(), - ) - } - }) -} - -func TestCsharpNamespaceWithExcept(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace( - zap.NewNop(), - sweeper, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace( - zap.NewNop(), - sweeper, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace( - zap.NewNop(), - sweeper, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"a.proto": "override"}, - ) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "", descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace( - zap.NewNop(), - sweeper, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"a.proto": "override"}, - ) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "", descriptor.GetOptions().GetCsharpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} - -func TestCsharpNamespaceWithOverride(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - overrideCsharpNamespacePrefix := "x.y.z" - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace( - zap.NewNop(), - sweeper, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideCsharpNamespacePrefix, - }, - nil, - ) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - strings.ReplaceAll(normalpath.Dir(overrideCsharpNamespacePrefix+"/"+imageFile.Path()), "/", "."), - descriptor.GetOptions().GetCsharpNamespace(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace( - zap.NewNop(), - sweeper, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideCsharpNamespacePrefix, - }, - nil, - ) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - strings.ReplaceAll(normalpath.Dir(overrideCsharpNamespacePrefix+"/"+imageFile.Path()), "/", "."), - descriptor.GetOptions().GetCsharpNamespace(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, true) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace( - zap.NewNop(), - sweeper, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideCsharpNamespacePrefix, - }, - map[string]string{"a.proto": "override"}, - ) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Proto().Name != nil && *imageFile.Proto().Name == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetCsharpNamespace()) - continue - } - assert.Equal(t, - strings.ReplaceAll(normalpath.Dir(imageFile.Path()), "/", "."), - descriptor.GetOptions().GetCsharpNamespace(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, csharpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - csharpNamespaceModifier := CsharpNamespace( - zap.NewNop(), - sweeper, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideCsharpNamespacePrefix, - }, - map[string]string{"a.proto": "override"}, - ) - - modifier := NewMultiModifier(csharpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Proto().Name != nil && *imageFile.Proto().Name == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetCsharpNamespace()) - continue - } - assert.Equal(t, - strings.ReplaceAll(normalpath.Dir(imageFile.Path()), "/", "."), - descriptor.GetOptions().GetCsharpNamespace(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package_test.go deleted file mode 100644 index 49574593a..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/go_package_test.go +++ /dev/null @@ -1,688 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "fmt" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestGoPackageError(t *testing.T) { - t.Parallel() - _, err := GoPackage(zap.NewNop(), NewFileOptionSweeper(), "", nil, nil, nil) - require.Error(t, err) -} - -func TestGoPackageEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} - -func TestGoPackageAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, goPackagePath) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{}) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, goPackagePath) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} - -func TestGoPackagePackageVersion(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "packageversion") - packageSuffix := "weatherv1alpha1" - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, goPackagePath) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - fmt.Sprintf("%s;%s", - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - packageSuffix, - ), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - fmt.Sprintf("%s;%s", - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - packageSuffix, - ), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, goPackagePath) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) - continue - } - assert.Equal(t, - fmt.Sprintf("%s;%s", - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - packageSuffix, - ), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) - continue - } - assert.Equal(t, - fmt.Sprintf("%s;%s", - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - packageSuffix, - ), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} - -func TestGoPackageWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - packageSuffix := "weatherv1alpha1" - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - modifiedGoPackage := fmt.Sprintf("%s;%s", - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - packageSuffix, - ) - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.NotEmpty(t, descriptor.GetOptions().GetGoPackage()) - assert.NotEqual(t, modifiedGoPackage, descriptor.GetOptions().GetGoPackage()) - continue - } - assert.Equal(t, - modifiedGoPackage, - descriptor.GetOptions().GetGoPackage(), - ) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage(zap.NewNop(), sweeper, testImportPathPrefix, nil, nil, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - modifiedGoPackage := fmt.Sprintf("%s;%s", - normalpath.Dir(testImportPathPrefix+"/"+imageFile.Path()), - packageSuffix, - ) - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.NotEmpty(t, descriptor.GetOptions().GetGoPackage()) - assert.NotEqual(t, modifiedGoPackage, descriptor.GetOptions().GetGoPackage()) - continue - } - assert.Equal(t, - modifiedGoPackage, - descriptor.GetOptions().GetGoPackage(), - ) - } - }) -} - -func TestGoPackageWithExcept(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage( - zap.NewNop(), - sweeper, - testImportPathPrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage( - zap.NewNop(), - sweeper, - testImportPathPrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage( - zap.NewNop(), - sweeper, - testImportPathPrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"a.proto": "override"}, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage( - zap.NewNop(), - sweeper, - testImportPathPrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"a.proto": "override"}, - ) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} - -func TestGoPackageWithOverride(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - overrideGoPackagePrefix := "github.com/foo/bar/private/private/gen/proto/go" - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage( - zap.NewNop(), - sweeper, - testImportPathPrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideGoPackagePrefix, - }, - nil, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - normalpath.Dir(overrideGoPackagePrefix+"/"+imageFile.Path()), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage( - zap.NewNop(), - sweeper, - testImportPathPrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideGoPackagePrefix, - }, - nil, - ) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - normalpath.Dir(overrideGoPackagePrefix+"/"+imageFile.Path()), - descriptor.GetOptions().GetGoPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - goPackageModifier, err := GoPackage( - zap.NewNop(), - sweeper, - testImportPathPrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideGoPackagePrefix, - }, - map[string]string{"a.proto": "override"}, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(goPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := GoPackage( - zap.NewNop(), - sweeper, - testImportPathPrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideGoPackagePrefix, - }, - map[string]string{"a.proto": "override"}, - ) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetGoPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files_test.go deleted file mode 100644 index 3c5011726..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_multiple_files_test.go +++ /dev/null @@ -1,429 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestJavaMultipleFilesEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) - require.NoError(t, err) - modifier := NewMultiModifier( - javaMultipleFilesModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}, false) - require.NoError(t, err) - modifier := NewMultiModifier( - javaMultipleFilesModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}, false) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - }) -} - -func TestJavaMultipleFilesAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) - require.NoError(t, err) - modifier := NewMultiModifier( - javaMultipleFilesModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}, false) - require.NoError(t, err) - modifier := NewMultiModifier( - javaMultipleFilesModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - continue - } - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, map[string]string{"a.proto": "false"}, false) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - continue - } - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - }) - - t.Run("with preserveExistingValue", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, true) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - continue - } - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - }) -} - -func TestJavaMultipleFilesJavaOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "javaoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, nil, false) - require.NoError(t, err) - modifier := NewMultiModifier( - javaMultipleFilesModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, nil, false) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - continue - } - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaMultipleFilesPath) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, map[string]string{"override.proto": "true"}, false) - require.NoError(t, err) - modifier := NewMultiModifier( - javaMultipleFilesModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - continue - } - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, map[string]string{"override.proto": "true"}, false) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - continue - } - assert.False(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - }) - - t.Run("with preserveExistingValue", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, false, nil, true) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetJavaMultipleFiles()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaMultipleFilesPath, false) - }) -} - -func TestJavaMultipleFilesWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) - require.NoError(t, err) - modifier := NewMultiModifier( - javaMultipleFilesModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - assert.True(t, imageFile.Proto().GetOptions().GetJavaMultipleFiles()) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - javaMultipleFilesModifier, err := JavaMultipleFiles(zap.NewNop(), sweeper, true, nil, false) - require.NoError(t, err) - err = javaMultipleFilesModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - assert.True(t, imageFile.Proto().GetOptions().GetJavaMultipleFiles()) - } - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname_test.go deleted file mode 100644 index 64c2698da..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_outer_classname_test.go +++ /dev/null @@ -1,410 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestJavaOuterClassnameEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, nil, false), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - - sweeper := NewFileOptionSweeper() - err := JavaOuterClassname(zap.NewNop(), sweeper, nil, false).Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}, false), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - - sweeper := NewFileOptionSweeper() - err := JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}, false).Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - }) - - t.Run("with preserveExistingValue", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, nil, true), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - }) -} - -func TestJavaOuterClassnameAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, nil, false), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - - sweeper := NewFileOptionSweeper() - err := JavaOuterClassname(zap.NewNop(), sweeper, nil, false).Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "AProto", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}, false), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - - sweeper := NewFileOptionSweeper() - err := JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}, false).Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - }) - - t.Run("with preserveExistingValue", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, nil, true), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) - }) -} - -func TestJavaOuterClassnameJavaOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "javaoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, nil, false), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, stringutil.ToPascalCase(normalpath.Base(imageFile.Path())), descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - - sweeper := NewFileOptionSweeper() - err := JavaOuterClassname(zap.NewNop(), sweeper, nil, false).Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, stringutil.ToPascalCase(normalpath.Base(imageFile.Path())), descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaOuterClassnamePath) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}, false), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) - continue - } - assert.Equal(t, "JavaFileProto", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - - sweeper := NewFileOptionSweeper() - err := JavaOuterClassname(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}, false).Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetJavaOuterClassname()) - continue - } - assert.Equal(t, "JavaFileProto", descriptor.GetOptions().GetJavaOuterClassname()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaOuterClassnamePath, false) - }) -} - -func TestJavaOuterClassnameWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - modifier := NewMultiModifier( - JavaOuterClassname(zap.NewNop(), sweeper, nil, false), - ModifierFunc(sweeper.Sweep), - ) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.Equal(t, javaOuterClassnameValue(imageFile), descriptor.GetOptions().GetJavaOuterClassname()) - continue - } - assert.Equal(t, - "AProto", - descriptor.GetOptions().GetJavaOuterClassname(), - ) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - err := JavaOuterClassname(zap.NewNop(), sweeper, nil, false).Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.Equal(t, javaOuterClassnameValue(imageFile), descriptor.GetOptions().GetJavaOuterClassname()) - continue - } - assert.Equal(t, - "AProto", - descriptor.GetOptions().GetJavaOuterClassname(), - ) - } - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package_test.go deleted file mode 100644 index 7046c5378..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_package_test.go +++ /dev/null @@ -1,633 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -const testJavaPackagePrefix = "com" - -func TestJavaPackageError(t *testing.T) { - t.Parallel() - _, err := JavaPackage(zap.NewNop(), NewFileOptionSweeper(), "", nil, nil, nil) - require.Error(t, err) -} - -func TestJavaPackageEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) - }) -} - -func TestJavaPackageAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"a.proto": "override"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - }) -} - -func TestJavaPackageJavaOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "javaoptions") - modifiedJavaPackage := "com.acme.weather" - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaPackagePath) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"override.proto": "override"}) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) - continue - } - assert.Equal(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage(zap.NewNop(), sweeper, testJavaPackagePrefix, nil, nil, map[string]string{"override.proto": "override"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) - continue - } - assert.Equal(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - }) -} - -func TestJavaPackageWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - javaPackagePrefix := "org" - modifiedJavaPackage := "org.acme.weather.v1alpha1" - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage(zap.NewNop(), sweeper, javaPackagePrefix, nil, nil, nil) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.NotEmpty(t, descriptor.GetOptions().GetJavaPackage()) - assert.NotEqual(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) - continue - } - assert.Equal(t, - modifiedJavaPackage, - descriptor.GetOptions().GetJavaPackage(), - ) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage(zap.NewNop(), sweeper, javaPackagePrefix, nil, nil, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.NotEmpty(t, descriptor.GetOptions().GetJavaPackage()) - assert.NotEqual(t, modifiedJavaPackage, descriptor.GetOptions().GetJavaPackage()) - continue - } - assert.Equal(t, - modifiedJavaPackage, - descriptor.GetOptions().GetJavaPackage(), - ) - } - }) -} - -func TestJavaPackageWithExcept(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "javaemptyoptions") - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage( - zap.NewNop(), - sweeper, - testJavaPackagePrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage( - zap.NewNop(), - sweeper, - testJavaPackagePrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage( - zap.NewNop(), - sweeper, - testJavaPackagePrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"a.proto": "override"}, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage( - zap.NewNop(), - sweeper, - testJavaPackagePrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"a.proto": "override"}, - ) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - }) -} - -func TestJavaPackageWithOverride(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "javaemptyoptions") - overrideJavaPackagePrefix := "foo.bar" - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage( - zap.NewNop(), - sweeper, - testJavaPackagePrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideJavaPackagePrefix, - }, - nil, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - overrideJavaPackagePrefix+"."+descriptor.GetPackage(), - descriptor.GetOptions().GetJavaPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage( - zap.NewNop(), - sweeper, - testJavaPackagePrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideJavaPackagePrefix, - }, - nil, - ) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - overrideJavaPackagePrefix+"."+descriptor.GetPackage(), - descriptor.GetOptions().GetJavaPackage(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - - sweeper := NewFileOptionSweeper() - javaPackageModifier, err := JavaPackage( - zap.NewNop(), - sweeper, - testJavaPackagePrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideJavaPackagePrefix, - }, - map[string]string{"a.proto": "override"}, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(javaPackageModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaPackage( - zap.NewNop(), - sweeper, - testJavaPackagePrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{ - testModuleIdentity: overrideJavaPackagePrefix, - }, - map[string]string{"a.proto": "override"}, - ) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetJavaPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaPackagePath, false) - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8_test.go deleted file mode 100644 index 705c6e179..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/java_string_check_utf8_test.go +++ /dev/null @@ -1,347 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestJavaStringCheckUtf8EmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, true) - - sweeper := NewFileOptionSweeper() - JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, nil) - require.NoError(t, err) - modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, true) - - sweeper := NewFileOptionSweeper() - JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) - require.NoError(t, err) - modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - }) -} - -func TestJavaStringCheckUtf8AllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) - - sweeper := NewFileOptionSweeper() - JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, nil) - require.NoError(t, err) - modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) - - sweeper := NewFileOptionSweeper() - JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) - require.NoError(t, err) - modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - continue - } - assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, false, map[string]string{"a.proto": "true"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - continue - } - assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - }) -} - -func TestJavaStringCheckUtf8JavaOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "javaoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) - - sweeper := NewFileOptionSweeper() - JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, javaStringCheckUtf8Path) - - sweeper := NewFileOptionSweeper() - JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, map[string]string{"override.proto": "false"}) - require.NoError(t, err) - modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - continue - } - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, javaStringCheckUtf8Path, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, map[string]string{"override.proto": "false"}) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - continue - } - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - }) -} - -func TestJavaStringCheckUtf8WellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - JavaStringCheckUtf8Modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - modifier := NewMultiModifier(JavaStringCheckUtf8Modifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - continue - } - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - modifier, err := JavaStringCheckUtf8(zap.NewNop(), sweeper, true, nil) - require.NoError(t, err) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.False(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - continue - } - assert.True(t, descriptor.GetOptions().GetJavaStringCheckUtf8()) - } - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix_test.go deleted file mode 100644 index b8a6cb47e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/objc_class_prefix_test.go +++ /dev/null @@ -1,719 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestObjcClassPrefixEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) - - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"a.proto": "override"}) - - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - require.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - require.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - }) -} - -func TestObjcClassPrefixAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) - - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"a.proto": "override"}) - - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) -} - -func TestObjcClassPrefixObjcOptions(t *testing.T) { - t.Parallel() - testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "single"), "AXX") - testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "double"), "AWX") - testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "triple"), "AWD") - testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "unversioned"), "AWD") - testObjcClassPrefixOptions(t, filepath.Join("testdata", "objcoptions", "gpb"), "GPX") -} - -func testObjcClassPrefixOptions(t *testing.T, dirPath string, classPrefix string) { - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) - - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"override.proto": "override"}) - - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, map[string]string{"override.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) -} - -func TestObjcClassPrefixWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - modifiedObjcClassPrefix := "AWX" - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) - - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.NotEmpty(t, descriptor.GetOptions().GetObjcClassPrefix()) - assert.NotEqual(t, modifiedObjcClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, - modifiedObjcClassPrefix, - descriptor.GetOptions().GetObjcClassPrefix(), - ) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - modifier := ObjcClassPrefix(zap.NewNop(), sweeper, "", nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - assert.NotEmpty(t, descriptor.GetOptions().GetObjcClassPrefix()) - assert.NotEqual(t, modifiedObjcClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, - modifiedObjcClassPrefix, - descriptor.GetOptions().GetObjcClassPrefix(), - ) - } - }) -} - -func TestObjcClassPrefixWithDefault(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "objcoptions", "single") - defaultClassPrefix := "DEFAULT" - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - nil, - nil, - nil, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, defaultClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - nil, - nil, - nil, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, defaultClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - nil, - nil, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, defaultClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - nil, - nil, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, defaultClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) -} - -func TestObjcClassPrefixWithExcept(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "objcoptions", "single") - defaultClassPrefix := "DEFAULT" - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - // Should still be non-empty because the module is skipped. - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - // Should still be non-empty because the module is skipped. - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) -} - -func TestObjcClassPrefixWithOverride(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "objcoptions", "single") - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - defaultClassPrefix := "DEFAULT" - overrideClassPrefix := "MODULE_OVERRIDE" - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideClassPrefix}, - nil, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, overrideClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideClassPrefix}, - nil, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, overrideClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, objcClassPrefixPath) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideClassPrefix}, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, overrideClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - - sweeper := NewFileOptionSweeper() - objcClassPrefixModifier := ObjcClassPrefix( - zap.NewNop(), - sweeper, - defaultClassPrefix, - nil, - map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideClassPrefix}, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(objcClassPrefixModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetObjcClassPrefix()) - continue - } - assert.Equal(t, overrideClassPrefix, descriptor.GetOptions().GetObjcClassPrefix()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, objcClassPrefixPath, false) - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for_test.go deleted file mode 100644 index a218e83b9..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/optimize_for_test.go +++ /dev/null @@ -1,665 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "google.golang.org/protobuf/types/descriptorpb" -) - -func TestOptimizeForEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, nil) - require.NoError(t, err) - modifier := NewMultiModifier( - optimizeForModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, nil) - require.NoError(t, err) - err = optimizeForModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, map[string]string{"a.proto": "SPEED"}) - require.NoError(t, err) - modifier := NewMultiModifier( - optimizeForModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - continue - } - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, map[string]string{"a.proto": "SPEED"}) - require.NoError(t, err) - err = optimizeForModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - continue - } - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - }) -} - -func TestOptimizeForAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, nil) - require.NoError(t, err) - modifier := NewMultiModifier( - optimizeForModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, nil) - require.NoError(t, err) - err = optimizeForModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, map[string]string{"a.proto": "SPEED"}) - require.NoError(t, err) - modifier := NewMultiModifier( - optimizeForModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - continue - } - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_LITE_RUNTIME, nil, nil, map[string]string{"a.proto": "SPEED"}) - require.NoError(t, err) - err = optimizeForModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - continue - } - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - }) -} - -func TestOptimizeForCcOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "ccoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, nil) - require.NoError(t, err) - modifier := NewMultiModifier( - optimizeForModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, nil) - require.NoError(t, err) - err = optimizeForModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, optimizeForPath) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, map[string]string{"a.proto": "LITE_RUNTIME"}) - require.NoError(t, err) - modifier := NewMultiModifier( - optimizeForModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - continue - } - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - } - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, map[string]string{"a.proto": "LITE_RUNTIME"}) - require.NoError(t, err) - err = optimizeForModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, descriptorpb.FileOptions_LITE_RUNTIME, descriptor.GetOptions().GetOptimizeFor()) - continue - } - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, optimizeForPath, false) - }) -} - -func TestOptimizeForWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, nil) - require.NoError(t, err) - modifier := NewMultiModifier( - optimizeForModifier, - ModifierFunc(sweeper.Sweep), - ) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor(zap.NewNop(), sweeper, descriptorpb.FileOptions_SPEED, nil, nil, nil) - require.NoError(t, err) - err = optimizeForModifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, descriptorpb.FileOptions_SPEED, descriptor.GetOptions().GetOptimizeFor()) - } - }) -} - -func TestOptimizeForWithExcept(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor( - zap.NewNop(), - sweeper, - descriptorpb.FileOptions_CODE_SIZE, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor( - zap.NewNop(), - sweeper, - descriptorpb.FileOptions_CODE_SIZE, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor( - zap.NewNop(), - sweeper, - descriptorpb.FileOptions_CODE_SIZE, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{ - "a.proto": "LITE_RUNTIME", - }, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor( - zap.NewNop(), - sweeper, - descriptorpb.FileOptions_CODE_SIZE, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{ - "a.proto": "SPEED", - }, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} - -func TestOptimizeForWithOverride(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - overrideOptimizeFor := descriptorpb.FileOptions_LITE_RUNTIME - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor( - zap.NewNop(), - sweeper, - descriptorpb.FileOptions_CODE_SIZE, - nil, - map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode{ - testModuleIdentity: overrideOptimizeFor, - }, - nil, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - overrideOptimizeFor, - descriptor.GetOptions().GetOptimizeFor(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor( - zap.NewNop(), - sweeper, - descriptorpb.FileOptions_CODE_SIZE, - nil, - map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode{ - testModuleIdentity: overrideOptimizeFor, - }, - nil, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - overrideOptimizeFor, - descriptor.GetOptions().GetOptimizeFor(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor( - zap.NewNop(), - sweeper, - descriptorpb.FileOptions_CODE_SIZE, - nil, - map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode{ - testModuleIdentity: overrideOptimizeFor, - }, - map[string]string{ - "a.proto": "CODE_SIZE", - }, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - descriptorpb.FileOptions_CODE_SIZE, - descriptor.GetOptions().GetOptimizeFor(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - - sweeper := NewFileOptionSweeper() - optimizeForModifier, err := OptimizeFor( - zap.NewNop(), - sweeper, - descriptorpb.FileOptions_CODE_SIZE, - nil, - map[bufmoduleref.ModuleIdentity]descriptorpb.FileOptions_OptimizeMode{ - testModuleIdentity: overrideOptimizeFor, - }, - map[string]string{ - "a.proto": "CODE_SIZE", - }, - ) - require.NoError(t, err) - - modifier := NewMultiModifier(optimizeForModifier, ModifierFunc(sweeper.Sweep)) - err = modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, - descriptorpb.FileOptions_CODE_SIZE, - descriptor.GetOptions().GetOptimizeFor(), - ) - } - assertFileOptionSourceCodeInfoEmpty(t, image, goPackagePath, false) - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace_test.go deleted file mode 100644 index c24a75d4e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_metadata_namespace_test.go +++ /dev/null @@ -1,359 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestPhpMetadataNamespaceEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, true) - - sweeper := NewFileOptionSweeper() - phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, true) - - sweeper := NewFileOptionSweeper() - phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) - - modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - require.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - require.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) - }) -} - -func TestPhpMetadataNamespaceAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) - - sweeper := NewFileOptionSweeper() - phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetPhpMetadataNamespace()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetPhpMetadataNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) - - sweeper := NewFileOptionSweeper() - phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetPhpMetadataNamespace()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetPhpMetadataNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - }) -} - -func TestPhpMetadataNamespaceOptions(t *testing.T) { - t.Parallel() - testPhpMetadataNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "single"), `Acme\V1\GPBMetadata`) - testPhpMetadataNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "double"), `Acme\Weather\V1\GPBMetadata`) - testPhpMetadataNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "triple"), `Acme\Weather\Data\V1\GPBMetadata`) - testPhpMetadataNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "reserved"), `Acme\Error_\V1\GPBMetadata`) -} - -func testPhpMetadataNamespaceOptions(t *testing.T, dirPath string, classPrefix string) { - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) - - sweeper := NewFileOptionSweeper() - phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpMetadataNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpMetadataNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpMetadataNamespacePath) - - sweeper := NewFileOptionSweeper() - phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}) - - modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpMetadataNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetPhpMetadataNamespace()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpMetadataNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpMetadataNamespacePath, false) - }) -} - -func TestPhpMetadataNamespaceWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - modifiedPhpMetadataNamespace := `Acme\Weather\V1alpha1\GPBMetadata` - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - phpMetadataNamespaceModifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpMetadataNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - // php_namespace is unset for the well-known types - assert.Empty(t, descriptor.GetOptions().GetPhpMetadataNamespace()) - continue - } - assert.Equal(t, - modifiedPhpMetadataNamespace, - descriptor.GetOptions().GetPhpMetadataNamespace(), - ) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpMetadataNamespace(zap.NewNop(), sweeper, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - // php_namespace is unset for the well-known types - assert.Empty(t, descriptor.GetOptions().GetPhpMetadataNamespace()) - continue - } - assert.Equal(t, - modifiedPhpMetadataNamespace, - descriptor.GetOptions().GetPhpMetadataNamespace(), - ) - } - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace_test.go deleted file mode 100644 index 27c7a6389..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/php_namespace_test.go +++ /dev/null @@ -1,360 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestPhpNamespaceEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) - - sweeper := NewFileOptionSweeper() - phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpNamespace(zap.NewNop(), sweeper, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) - - sweeper := NewFileOptionSweeper() - phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) - - modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) - }) -} - -func TestPhpNamespaceAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) - - sweeper := NewFileOptionSweeper() - phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetPhpNamespace()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpNamespace(zap.NewNop(), sweeper, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetPhpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) - - sweeper := NewFileOptionSweeper() - phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) - - modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetPhpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetPhpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - }) -} - -func TestPhpNamespaceOptions(t *testing.T) { - t.Parallel() - testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "single"), `Acme\V1`) - testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "double"), `Acme\Weather\V1`) - testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "triple"), `Acme\Weather\Data\V1`) - testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "reserved"), `Acme\Error_\V1`) - testPhpNamespaceOptions(t, filepath.Join("testdata", "phpoptions", "underscore"), `Acme\Weather\FooBar\V1`) -} - -func testPhpNamespaceOptions(t *testing.T, dirPath string, classPrefix string) { - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) - - sweeper := NewFileOptionSweeper() - phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpNamespace(zap.NewNop(), sweeper, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, phpNamespacePath) - - sweeper := NewFileOptionSweeper() - phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}) - - modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpNamespace(zap.NewNop(), sweeper, map[string]string{"override.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetPhpNamespace()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetPhpNamespace()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, phpNamespacePath, false) - }) -} - -func TestPhpNamespaceWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - modifiedPhpNamespace := `Acme\Weather\V1alpha1` - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - phpNamespaceModifier := PhpNamespace(zap.NewNop(), sweeper, nil) - - modifier := NewMultiModifier(phpNamespaceModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - // php_namespace is unset for the well-known types - assert.Empty(t, descriptor.GetOptions().GetPhpNamespace()) - continue - } - assert.Equal(t, - modifiedPhpNamespace, - descriptor.GetOptions().GetPhpNamespace(), - ) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - modifier := PhpNamespace(zap.NewNop(), sweeper, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - // php_namespace is unset for the well-known types - assert.Empty(t, descriptor.GetOptions().GetPhpNamespace()) - continue - } - assert.Equal(t, - modifiedPhpNamespace, - descriptor.GetOptions().GetPhpNamespace(), - ) - } - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package_test.go b/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package_test.go deleted file mode 100644 index dbc51a6a1..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/ruby_package_test.go +++ /dev/null @@ -1,588 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagemodify - -import ( - "context" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestRubyPackageEmptyOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "emptyoptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) - - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "override"}) - - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - require.Equal(t, 1, len(image.Files())) - descriptor := image.Files()[0].Proto() - assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) - }) -} - -func TestRubyPackageAllOptions(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "alloptions") - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) - - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, "foo", descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "override"}) - - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) - }) - - t.Run("without SourceCodeInfo and with per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"a.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "a.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) - continue - } - assert.Equal(t, "foo", descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - }) -} - -func TestRubyPackageOptions(t *testing.T) { - t.Parallel() - testRubyPackageOptions(t, filepath.Join("testdata", "rubyoptions", "single"), `Acme::V1`) - testRubyPackageOptions(t, filepath.Join("testdata", "rubyoptions", "double"), `Acme::Weather::V1`) - testRubyPackageOptions(t, filepath.Join("testdata", "rubyoptions", "triple"), `Acme::Weather::Data::V1`) - testRubyPackageOptions(t, filepath.Join("testdata", "rubyoptions", "underscore"), `Acme::Weather::FooBar::V1`) -} - -func testRubyPackageOptions(t *testing.T, dirPath string, classPrefix string) { - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) - - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, classPrefix, descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - }) - - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"override.proto": "override"}) - - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, map[string]string{"override.proto": "override"}) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) - continue - } - assert.Equal(t, classPrefix, descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - }) -} - -func TestRubyPackageWellKnownTypes(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "wktimport") - modifiedRubyPackage := `Acme::Weather::V1alpha1` - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) - - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - // php_namespace is unset for the well-known types - assert.Empty(t, descriptor.GetOptions().GetRubyPackage()) - continue - } - assert.Equal(t, - modifiedRubyPackage, - descriptor.GetOptions().GetRubyPackage(), - ) - } - }) - - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - - sweeper := NewFileOptionSweeper() - modifier := RubyPackage(zap.NewNop(), sweeper, nil, nil, nil) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if isWellKnownType(context.Background(), imageFile) { - // php_namespace is unset for the well-known types - assert.Empty(t, descriptor.GetOptions().GetRubyPackage()) - continue - } - assert.Equal(t, - modifiedRubyPackage, - descriptor.GetOptions().GetRubyPackage(), - ) - } - }) -} - -func TestRubyPackageExcept(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "rubyoptions", "single") - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage( - zap.NewNop(), - sweeper, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, true), image) - // Still not empty, because the module is in except - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - }) - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage( - zap.NewNop(), - sweeper, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - nil, - ) - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - }) - t.Run("with SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage( - zap.NewNop(), - sweeper, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - // not modified even though a file has override, because the module is in except - assert.Equal(t, testGetImage(t, dirPath, true), image) - // Still not empty, because the module is in except - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - }) - t.Run("without SourceCodeInfo and per-file overrides", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage( - zap.NewNop(), - sweeper, - []bufmoduleref.ModuleIdentity{testModuleIdentity}, - nil, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.Equal(t, testGetImage(t, dirPath, false), image) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - }) -} - -func TestRubyPackageOverride(t *testing.T) { - t.Parallel() - dirPath := filepath.Join("testdata", "rubyoptions", "single") - overrideRubyPackage := "MODULE" - testModuleIdentity, err := bufmoduleref.NewModuleIdentity( - testRemote, - testRepositoryOwner, - testRepositoryName, - ) - require.NoError(t, err) - t.Run("with SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage( - zap.NewNop(), - sweeper, - nil, - map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideRubyPackage}, - nil, - ) - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, overrideRubyPackage, descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) - }) - t.Run("without SourceCodeInfo", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage( - zap.NewNop(), - sweeper, - nil, - map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideRubyPackage}, - nil, - ) - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - assert.Equal(t, overrideRubyPackage, descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - }) - t.Run("with SourceCodeInfo with per-file override", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, true) - assertFileOptionSourceCodeInfoNotEmpty(t, image, rubyPackagePath) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage( - zap.NewNop(), - sweeper, - nil, - map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideRubyPackage}, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, true), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) - continue - } - assert.Equal(t, overrideRubyPackage, descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, true) - }) - t.Run("without SourceCodeInfo and per-file override", func(t *testing.T) { - t.Parallel() - image := testGetImage(t, dirPath, false) - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - - sweeper := NewFileOptionSweeper() - rubyPackageModifier := RubyPackage( - zap.NewNop(), - sweeper, - nil, - map[bufmoduleref.ModuleIdentity]string{testModuleIdentity: overrideRubyPackage}, - map[string]string{"override.proto": "override"}, - ) - modifier := NewMultiModifier(rubyPackageModifier, ModifierFunc(sweeper.Sweep)) - err := modifier.Modify( - context.Background(), - image, - ) - require.NoError(t, err) - assert.NotEqual(t, testGetImage(t, dirPath, false), image) - - for _, imageFile := range image.Files() { - descriptor := imageFile.Proto() - if imageFile.Path() == "override.proto" { - assert.Equal(t, "override", descriptor.GetOptions().GetRubyPackage()) - continue - } - assert.Equal(t, overrideRubyPackage, descriptor.GetOptions().GetRubyPackage()) - } - assertFileOptionSourceCodeInfoEmpty(t, image, rubyPackagePath, false) - }) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/alloptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/alloptions/a.proto deleted file mode 100644 index ee529a1a1..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/alloptions/a.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -option csharp_namespace = "foo"; -option go_package = "foo"; -option java_package = "foo"; -option java_outer_classname = "foo"; -option objc_class_prefix = "foo"; -option php_class_prefix = "foo"; -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; -option ruby_package = "foo"; -option swift_prefix = "foo"; - -option optimize_for = SPEED; -option cc_enable_arenas = false; -option cc_generic_services = false; -option java_generic_services = false; -option java_multiple_files = false; -option java_string_check_utf8 = false; -option php_generic_services = false; -option py_generic_services = false; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/a.proto deleted file mode 100644 index ce742f655..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/a.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -option cc_enable_arenas = false; -option optimize_for = LITE_RUNTIME; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/b.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/b.proto deleted file mode 100644 index f10536080..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/ccoptions/b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -option cc_enable_arenas = false; -option optimize_for = LITE_RUNTIME; - diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/double/csharp.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/double/csharp.proto deleted file mode 100644 index 95ccc3ca0..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/double/csharp.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.v1; - -option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/csharp.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/csharp.proto deleted file mode 100644 index 9f24e197b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/csharp.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.v1; - -option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/override.proto deleted file mode 100644 index 97c467161..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/single/override.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.v1; - -option csharp_namespace = "foo"; - diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/triple/csharp.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/triple/csharp.proto deleted file mode 100644 index a33f0c6af..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/triple/csharp.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.data.v1; - -option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/underscore/csharp.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/underscore/csharp.proto deleted file mode 100644 index 04af2dcdb..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/csharpoptions/underscore/csharp.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.foo_bar.v1; - -option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/emptyoptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/emptyoptions/a.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/emptyoptions/a.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaemptyoptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaemptyoptions/a.proto deleted file mode 100644 index 5e08634a0..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaemptyoptions/a.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package foo; \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/java_file.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/java_file.proto deleted file mode 100644 index 7ff66d17b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/java_file.proto +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather; - -option java_multiple_files = true; -option java_string_check_utf8 = false; -option java_package = "foo"; -option java_outer_classname = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/override.proto deleted file mode 100644 index 7ff66d17b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/javaoptions/override.proto +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather; - -option java_multiple_files = true; -option java_string_check_utf8 = false; -option java_package = "foo"; -option java_outer_classname = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/jsoptions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/jsoptions/a.proto deleted file mode 100644 index 164a62215..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/jsoptions/a.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -option optimize_for = CODE_SIZE; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/double/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/double/objc.proto deleted file mode 100644 index b36da56d8..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/double/objc.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.v1; - -option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/gpb/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/gpb/objc.proto deleted file mode 100644 index d652eb8db..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/gpb/objc.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.protobuf.bla.v1; - -option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/objc.proto deleted file mode 100644 index a06d424b5..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/objc.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.v1; - -option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/override.proto deleted file mode 100644 index a06d424b5..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/single/override.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.v1; - -option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/triple/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/triple/objc.proto deleted file mode 100644 index 68d1ca9ed..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/triple/objc.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.data.v1; - -option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/unversioned/objc.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/unversioned/objc.proto deleted file mode 100644 index 210a09d4a..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/objcoptions/unversioned/objc.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.data; - -option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/a.proto deleted file mode 100644 index 40591e773..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/a.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package weather.v1alpha1; - -option go_package = "weather"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/b.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/b.proto deleted file mode 100644 index 40591e773..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/packageversion/b.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package weather.v1alpha1; - -option go_package = "weather"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/double/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/double/php.proto deleted file mode 100644 index e1b0bbca4..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/double/php.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/reserved/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/reserved/php.proto deleted file mode 100644 index 97fd823c7..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/reserved/php.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.error.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/override.proto deleted file mode 100644 index 7e72bd6da..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/override.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/php.proto deleted file mode 100644 index 7e72bd6da..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/single/php.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/triple/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/triple/php.proto deleted file mode 100644 index 4aad53502..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/triple/php.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.data.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/underscore/php.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/underscore/php.proto deleted file mode 100644 index b66f5a59e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/phpoptions/underscore/php.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.foo_bar.v1; - -option php_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/double/ruby.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/double/ruby.proto deleted file mode 100644 index 841d0d81b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/double/ruby.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.v1; - -option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/override.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/override.proto deleted file mode 100644 index f4882660f..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/override.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.v1; - -option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/ruby.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/ruby.proto deleted file mode 100644 index f4882660f..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/single/ruby.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.v1; - -option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/triple/ruby.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/triple/ruby.proto deleted file mode 100644 index fa49eb673..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/triple/ruby.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.data.v1; - -option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/underscore/ruby.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/underscore/ruby.proto deleted file mode 100644 index 49d522919..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/rubyoptions/underscore/ruby.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package acme.weather.foo_bar.v1; - -option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/wktimport/a.proto b/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/wktimport/a.proto deleted file mode 100644 index 672a4edd2..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagemodify/testdata/wktimport/a.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package acme.weather.v1alpha1; - -import "google/protobuf/timestamp.proto"; - -message Container { - google.protobuf.Timestamp timestamp = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting.go b/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting.go deleted file mode 100644 index b100420e0..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting.go +++ /dev/null @@ -1,118 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagetesting - -import ( - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protodescriptor" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" -) - -// NewImageFile returns a new ImageFile for testing. -// -// TODO: moduleIdentity and commit should be options. -func NewImageFile( - t testing.TB, - fileDescriptor protodescriptor.FileDescriptor, - moduleIdentity bufmoduleref.ModuleIdentity, - commit string, - externalPath string, - isImport bool, - isSyntaxUnspecified bool, - unusedDependencyIndexes []int32, -) bufimage.ImageFile { - imageFile, err := bufimage.NewImageFile( - fileDescriptor, - moduleIdentity, - commit, - externalPath, - isImport, - isSyntaxUnspecified, - unusedDependencyIndexes, - ) - require.NoError(t, err) - return imageFile -} - -// NewProtoImageFile returns a new *imagev1.ImageFile for testing. -// -// This is also a protodescriptor.FileDescriptor. -func NewProtoImageFile( - t testing.TB, - path string, - importPaths ...string, -) *imagev1.ImageFile { - return &imagev1.ImageFile{ - Name: proto.String(path), - Dependency: importPaths, - BufExtension: &imagev1.ImageFileExtension{ - IsImport: proto.Bool(false), - IsSyntaxUnspecified: proto.Bool(false), - }, - } -} - -// NewProtoImageFileIsImport returns a new *imagev1.ImageFile for testing that is an import. -// -// This is also a protodescriptor.FileDescriptor. -func NewProtoImageFileIsImport( - t testing.TB, - path string, - importPaths ...string, -) *imagev1.ImageFile { - return &imagev1.ImageFile{ - Name: proto.String(path), - Dependency: importPaths, - BufExtension: &imagev1.ImageFileExtension{ - IsImport: proto.Bool(true), - IsSyntaxUnspecified: proto.Bool(false), - }, - } -} - -// AssertImageFilesEqual asserts the expected ImageFiles equal the actual ImageFiles. -func AssertImageFilesEqual(t testing.TB, expected []bufimage.ImageFile, actual []bufimage.ImageFile) { - expectedNormalizedImageFiles := normalizeImageFiles(t, expected) - actualNormalizedImageFiles := normalizeImageFiles(t, actual) - assert.Equal(t, expectedNormalizedImageFiles, actualNormalizedImageFiles) -} - -func normalizeImageFiles(t testing.TB, imageFiles []bufimage.ImageFile) []bufimage.ImageFile { - normalizedImageFiles := make([]bufimage.ImageFile, len(imageFiles)) - for i, imageFile := range imageFiles { - normalizedImageFiles[i] = NewImageFile( - t, - NewProtoImageFile( - t, - imageFile.FileDescriptor().GetName(), - imageFile.FileDescriptor().GetDependency()..., - ), - imageFile.ModuleIdentity(), - imageFile.Commit(), - imageFile.ExternalPath(), - imageFile.IsImport(), - imageFile.IsSyntaxUnspecified(), - imageFile.UnusedDependencyIndexes(), - ) - } - return normalizedImageFiles -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go b/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go deleted file mode 100644 index e632818ba..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagetesting/bufimagetesting_test.go +++ /dev/null @@ -1,709 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagetesting - -import ( - "fmt" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/testing/protocmp" - "google.golang.org/protobuf/types/descriptorpb" - "google.golang.org/protobuf/types/pluginpb" -) - -func BenchmarkNewImageWithOnlyPathsAllowNotExistFileOnly(b *testing.B) { - var imageFiles []bufimage.ImageFile - for i := 0; i < 3000; i++ { - imageFiles = append( - imageFiles, - NewImageFile( - b, - NewProtoImageFile( - b, - fmt.Sprintf("a%d.proto/a%d.proto", i, i), - ), - nil, - "", - fmt.Sprintf("foo/two/a%d.proto/a%d.proto", i, i), - false, - false, - nil, - ), - ) - } - image, err := bufimage.NewImage(imageFiles) - require.NoError(b, err) - b.ResetTimer() - for n := 0; n < b.N; n++ { - newImage, err := bufimage.ImageWithOnlyPathsAllowNotExist(image, []string{"a1.proto/a1.proto"}, nil) - // this does increase the time but we're just looking for order of magnitude - // between this and the below benchmark function - require.NoError(b, err) - require.Equal(b, 1, len(newImage.Files())) - } -} - -func BenchmarkNewImageWithOnlyPathsAllowNotExistDirOnly(b *testing.B) { - var imageFiles []bufimage.ImageFile - for i := 0; i < 3000; i++ { - imageFiles = append( - imageFiles, - NewImageFile( - b, - NewProtoImageFile( - b, - fmt.Sprintf("a%d.proto/a%d.proto", i, i), - ), - nil, - "", - fmt.Sprintf("foo/two/a%d.proto/a%d.proto", i, i), - false, - false, - nil, - ), - ) - } - image, err := bufimage.NewImage(imageFiles) - require.NoError(b, err) - b.ResetTimer() - for n := 0; n < b.N; n++ { - newImage, err := bufimage.ImageWithOnlyPathsAllowNotExist(image, []string{"a1.proto"}, nil) - require.NoError(b, err) - require.Equal(b, 1, len(newImage.Files())) - } -} - -func TestBasic(t *testing.T) { - t.Parallel() - - protoImageFileImport := NewProtoImageFileIsImport( - t, - "import.proto", - ) - protoImageFileWellKnownTypeImport := NewProtoImageFileIsImport( - t, - "google/protobuf/timestamp.proto", - ) - protoImageFileAA := NewProtoImageFile( - t, - "a/a.proto", - ) - protoImageFileAB := NewProtoImageFile( - t, - "a/b.proto", - "import.proto", - "google/protobuf/timestamp.proto", - ) - protoImageFileBA := NewProtoImageFile( - t, - "b/a.proto", - "a/a.proto", - "a/b.proto", - ) - protoImageFileBB := NewProtoImageFile( - t, - "b/b.proto", - "a/a.proto", - "a/b.proto", - "b/a.proto", - ) - protoImageFileOutlandishDirectoryName := NewProtoImageFile( - t, - "d/d.proto/d.proto", - "import.proto", - ) - - fileImport := NewImageFile( - t, - protoImageFileImport, - nil, - "", - "some/import/import.proto", - true, - false, - nil, - ) - fileWellKnownTypeImport := NewImageFile( - t, - protoImageFileWellKnownTypeImport, - nil, - "", - "google/protobuf/timestamp.proto", - true, - false, - nil, - ) - fileOneAA := NewImageFile( - t, - protoImageFileAA, - nil, - "", - "foo/one/a/a.proto", - false, - false, - nil, - ) - fileOneAB := NewImageFile( - t, - protoImageFileAB, - nil, - "", - "foo/one/a/b.proto", - false, - false, - nil, - ) - fileTwoBA := NewImageFile( - t, - protoImageFileBA, - nil, - "", - "foo/two/b/a.proto", - false, - false, - nil, - ) - fileTwoBB := NewImageFile( - t, - protoImageFileBB, - nil, - "", - "foo/two/b/b.proto", - false, - false, - nil, - ) - fileOutlandishDirectoryName := NewImageFile( - t, - protoImageFileOutlandishDirectoryName, - nil, - "", - "foo/three/d/d.proto/d.proto", - false, - false, - nil, - ) - - image, err := bufimage.NewImage( - []bufimage.ImageFile{ - fileOneAA, - fileImport, - fileWellKnownTypeImport, - fileOneAB, - fileTwoBA, - fileTwoBB, - fileOutlandishDirectoryName, - }, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - NewImageFile(t, protoImageFileBB, nil, "", "foo/two/b/b.proto", false, false, nil), - NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), - }, - image.Files(), - ) - require.NotNil(t, image.GetFile("a/a.proto")) - require.Nil(t, image.GetFile("one/a/a.proto")) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - NewImageFile(t, protoImageFileBB, nil, "", "foo/two/b/b.proto", false, false, nil), - NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), - }, - bufimage.ImageWithoutImports(image).Files(), - ) - - newImage, err := bufimage.ImageWithOnlyPaths( - image, - []string{ - "b/a.proto", - "a/b.proto", - }, - nil, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", true, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - }, - newImage.Files(), - ) - - _, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "b/a.proto", - "a/b.proto", - "foo.proto", - }, - nil, - ) - require.Error(t, err) - - newImage, err = bufimage.ImageWithOnlyPathsAllowNotExist( - image, - []string{ - "b/a.proto", - "a/b.proto", - "foo.proto", - }, - nil, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", true, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - }, - newImage.Files(), - ) - newImage, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "a", - }, - nil, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - }, - newImage.Files(), - ) - newImage, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "b", - }, - nil, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", true, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", true, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - NewImageFile(t, protoImageFileBB, nil, "", "foo/two/b/b.proto", false, false, nil), - }, - newImage.Files(), - ) - newImage, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "a", - "b/a.proto", - }, - nil, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - }, - newImage.Files(), - ) - _, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "a", - "b/a.proto", - "c", - }, - nil, - ) - require.Error(t, err) - newImage, err = bufimage.ImageWithOnlyPathsAllowNotExist( - image, - []string{ - "a", - "b/a.proto", - "c", - }, - nil, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - }, - newImage.Files(), - ) - newImage, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "a", - "b/a.proto", - "d/d.proto/d.proto", - }, - nil, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), - }, - newImage.Files(), - ) - newImage, err = bufimage.ImageWithOnlyPaths( - image, - []string{ - "a", - "b/a.proto", - "d/d.proto", - }, - nil, - ) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), - }, - newImage.Files(), - ) - - protoImage := &imagev1.Image{ - File: []*imagev1.ImageFile{ - protoImageFileAA, - protoImageFileImport, - protoImageFileWellKnownTypeImport, - protoImageFileAB, - protoImageFileBA, - protoImageFileBB, - protoImageFileOutlandishDirectoryName, - }, - } - newImage, err = bufimage.NewImageForProto(protoImage) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "b/a.proto", false, false, nil), - NewImageFile(t, protoImageFileBB, nil, "", "b/b.proto", false, false, nil), - NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "d/d.proto/d.proto", false, false, nil), - }, - newImage.Files(), - ) - diff := cmp.Diff(protoImage, bufimage.ImageToProtoImage(newImage), protocmp.Transform()) - require.Equal(t, "", diff) - fileDescriptorSet := &descriptorpb.FileDescriptorSet{ - File: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileAA), - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), - testProtoImageFileToFileDescriptorProto(protoImageFileAB), - testProtoImageFileToFileDescriptorProto(protoImageFileBA), - testProtoImageFileToFileDescriptorProto(protoImageFileBB), - testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), - }, - } - diff = cmp.Diff(fileDescriptorSet, bufimage.ImageToFileDescriptorSet(image), protocmp.Transform()) - require.Equal(t, "", diff) - codeGeneratorRequest := &pluginpb.CodeGeneratorRequest{ - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileAA), - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), - testProtoImageFileToFileDescriptorProto(protoImageFileAB), - testProtoImageFileToFileDescriptorProto(protoImageFileBA), - testProtoImageFileToFileDescriptorProto(protoImageFileBB), - testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "a/a.proto", - "a/b.proto", - "b/a.proto", - "b/b.proto", - "d/d.proto/d.proto", - }, - } - diff = cmp.Diff( - codeGeneratorRequest, - bufimage.ImageToCodeGeneratorRequest(image, "foo", nil, false, false), - protocmp.Transform(), - ) - require.Equal(t, "", diff) - - // verify that includeWellKnownTypes is a no-op if includeImports is false - diff = cmp.Diff( - codeGeneratorRequest, - bufimage.ImageToCodeGeneratorRequest(image, "foo", nil, false, true), - protocmp.Transform(), - ) - require.Equal(t, "", diff) - - codeGeneratorRequestIncludeImports := &pluginpb.CodeGeneratorRequest{ - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileAA), - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), - testProtoImageFileToFileDescriptorProto(protoImageFileAB), - testProtoImageFileToFileDescriptorProto(protoImageFileBA), - testProtoImageFileToFileDescriptorProto(protoImageFileBB), - testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "a/a.proto", - "import.proto", - // no WKT - "a/b.proto", - "b/a.proto", - "b/b.proto", - "d/d.proto/d.proto", - }, - } - diff = cmp.Diff( - codeGeneratorRequestIncludeImports, - bufimage.ImageToCodeGeneratorRequest(image, "foo", nil, true, false), - protocmp.Transform(), - ) - require.Equal(t, "", diff) - newImage, err = bufimage.NewImageForCodeGeneratorRequest(codeGeneratorRequest) - require.NoError(t, err) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "a/b.proto", false, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "b/a.proto", false, false, nil), - NewImageFile(t, protoImageFileBB, nil, "", "b/b.proto", false, false, nil), - NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "d/d.proto/d.proto", false, false, nil), - }, - newImage.Files(), - ) - codeGeneratorRequestIncludeImportsAndWellKnownTypes := &pluginpb.CodeGeneratorRequest{ - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileAA), - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), - testProtoImageFileToFileDescriptorProto(protoImageFileAB), - testProtoImageFileToFileDescriptorProto(protoImageFileBA), - testProtoImageFileToFileDescriptorProto(protoImageFileBB), - testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "a/a.proto", - "import.proto", - "google/protobuf/timestamp.proto", - "a/b.proto", - "b/a.proto", - "b/b.proto", - "d/d.proto/d.proto", - }, - } - diff = cmp.Diff( - codeGeneratorRequestIncludeImportsAndWellKnownTypes, - bufimage.ImageToCodeGeneratorRequest(image, "foo", nil, true, true), - protocmp.Transform(), - ) - require.Equal(t, "", diff) - // imagesByDir and multiple Image tests - imagesByDir, err := bufimage.ImageByDir(image) - require.NoError(t, err) - require.Equal(t, 3, len(imagesByDir)) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", false, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", false, false, nil), - }, - imagesByDir[0].Files(), - ) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileAA, nil, "", "foo/one/a/a.proto", true, false, nil), - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileWellKnownTypeImport, nil, "", "google/protobuf/timestamp.proto", true, false, nil), - NewImageFile(t, protoImageFileAB, nil, "", "foo/one/a/b.proto", true, false, nil), - NewImageFile(t, protoImageFileBA, nil, "", "foo/two/b/a.proto", false, false, nil), - NewImageFile(t, protoImageFileBB, nil, "", "foo/two/b/b.proto", false, false, nil), - }, - imagesByDir[1].Files(), - ) - AssertImageFilesEqual( - t, - []bufimage.ImageFile{ - NewImageFile(t, protoImageFileImport, nil, "", "some/import/import.proto", true, false, nil), - NewImageFile(t, protoImageFileOutlandishDirectoryName, nil, "", "foo/three/d/d.proto/d.proto", false, false, nil), - }, - imagesByDir[2].Files(), - ) - codeGeneratorRequests := []*pluginpb.CodeGeneratorRequest{ - { - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileAA), - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), - testProtoImageFileToFileDescriptorProto(protoImageFileAB), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "a/a.proto", - "a/b.proto", - }, - }, - { - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileAA), - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), - testProtoImageFileToFileDescriptorProto(protoImageFileAB), - testProtoImageFileToFileDescriptorProto(protoImageFileBA), - testProtoImageFileToFileDescriptorProto(protoImageFileBB), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "b/a.proto", - "b/b.proto", - }, - }, - { - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "d/d.proto/d.proto", - }, - }, - } - requestsFromImages := bufimage.ImagesToCodeGeneratorRequests(imagesByDir, "foo", nil, false, false) - require.Equal(t, len(codeGeneratorRequests), len(requestsFromImages)) - for i := range codeGeneratorRequests { - diff = cmp.Diff(codeGeneratorRequests[i], requestsFromImages[i], protocmp.Transform()) - require.Equal(t, "", diff) - } - codeGeneratorRequestsIncludeImports := []*pluginpb.CodeGeneratorRequest{ - { - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileAA), - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), - testProtoImageFileToFileDescriptorProto(protoImageFileAB), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "a/a.proto", - "import.proto", - "a/b.proto", - }, - }, - { - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileAA), - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileWellKnownTypeImport), - testProtoImageFileToFileDescriptorProto(protoImageFileAB), - testProtoImageFileToFileDescriptorProto(protoImageFileBA), - testProtoImageFileToFileDescriptorProto(protoImageFileBB), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "b/a.proto", - "b/b.proto", - }, - }, - { - ProtoFile: []*descriptorpb.FileDescriptorProto{ - testProtoImageFileToFileDescriptorProto(protoImageFileImport), - testProtoImageFileToFileDescriptorProto(protoImageFileOutlandishDirectoryName), - }, - Parameter: proto.String("foo"), - FileToGenerate: []string{ - "d/d.proto/d.proto", - }, - }, - } - requestsFromImages = bufimage.ImagesToCodeGeneratorRequests(imagesByDir, "foo", nil, true, false) - require.Equal(t, len(codeGeneratorRequestsIncludeImports), len(requestsFromImages)) - for i := range codeGeneratorRequestsIncludeImports { - diff = cmp.Diff(codeGeneratorRequestsIncludeImports[i], requestsFromImages[i], protocmp.Transform()) - require.Equal(t, "", diff) - } -} - -func testProtoImageFileToFileDescriptorProto(imageFile *imagev1.ImageFile) *descriptorpb.FileDescriptorProto { - return &descriptorpb.FileDescriptorProto{ - Name: imageFile.Name, - Dependency: imageFile.Dependency, - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil_test.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil_test.go deleted file mode 100644 index 0679f0519..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/bufimageutil_test.go +++ /dev/null @@ -1,502 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimageutil - -import ( - "bytes" - "context" - "fmt" - "io" - "sort" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/protoencoding" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/jhump/protoreflect/desc" - "github.com/jhump/protoreflect/desc/protoprint" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "go.uber.org/zap/zaptest" - "golang.org/x/tools/txtar" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/types/descriptorpb" -) - -// IF YOU HAVE ANY FAILING TESTS IN HERE, ESPECIALLY AFTER A PROTOC UPGRADE, -// SWITCH THIS TO TRUE, TURN OFF PARALLEL TESTING, RE-RUN THE TESTS AND THEN SWITCH BACK TO FALSE. -const shouldUpdateExpectations = false - -func TestOptions(t *testing.T) { - t.Parallel() - t.Run("message", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/options", []string{"pkg.Foo"}, "pkg.Foo.txtar") - }) - t.Run("enum", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/options", []string{"pkg.FooEnum"}, "pkg.FooEnum.txtar") - }) - t.Run("service", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/options", []string{"pkg.FooService"}, "pkg.FooService.txtar") - }) - t.Run("method", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/options", []string{"pkg.FooService.Do"}, "pkg.FooService.Do.txtar") - }) - t.Run("all", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/options", []string{"pkg.Foo", "pkg.FooEnum", "pkg.FooService"}, "all.txtar") - }) - t.Run("exclude-options", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/options", []string{"pkg.Foo", "pkg.FooEnum", "pkg.FooService"}, "all-exclude-options.txtar", WithExcludeCustomOptions()) - }) - t.Run("files", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/options", []string{"Files"}, "Files.txtar") - }) - t.Run("all-with-files", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/options", []string{"pkg.Foo", "pkg.FooEnum", "pkg.FooService", "Files"}, "all-with-Files.txtar") - }) -} - -func TestNesting(t *testing.T) { - t.Parallel() - t.Run("message", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/nesting", []string{"pkg.Foo"}, "message.txtar") - }) - t.Run("recursenested", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/nesting", []string{"pkg.Foo.NestedFoo.NestedNestedFoo"}, "recursenested.txtar") - }) - t.Run("enum", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/nesting", []string{"pkg.FooEnum"}, "enum.txtar") - }) - t.Run("usingother", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/nesting", []string{"pkg.Baz"}, "usingother.txtar") - }) -} - -func TestImportModifiers(t *testing.T) { - t.Parallel() - t.Run("regular_weak", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/importmods", []string{"ImportRegular", "ImportWeak"}, "regular_weak.txtar") - }) - t.Run("weak_public", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/importmods", []string{"ImportWeak", "ImportPublic"}, "weak_public.txtar") - }) - t.Run("regular_public", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/importmods", []string{"ImportRegular", "ImportPublic"}, "regular_public.txtar") - }) - t.Run("noimports", func(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/importmods", []string{"NoImports"}, "noimports.txtar") - }) -} - -func TestExtensions(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/extensions", []string{"pkg.Foo"}, "extensions.txtar") - runDiffTest(t, "testdata/extensions", []string{"pkg.Foo"}, "extensions-excluded.txtar", WithExcludeKnownExtensions()) -} - -func TestPackages(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/packages", []string{""}, "root.txtar") - runDiffTest(t, "testdata/packages", []string{"foo"}, "foo.txtar") - runDiffTest(t, "testdata/packages", []string{"foo.bar"}, "foo.bar.txtar") - runDiffTest(t, "testdata/packages", []string{"foo.bar.baz"}, "foo.bar.baz.txtar") -} - -func TestAny(t *testing.T) { - t.Parallel() - runDiffTest(t, "testdata/any", []string{"ExtendedAnySyntax"}, "c1.txtar") - runDiffTest(t, "testdata/any", []string{"ExtendedAnySyntax_InField"}, "c2.txtar") - runDiffTest(t, "testdata/any", []string{"ExtendedAnySyntax_InList"}, "c3.txtar") - runDiffTest(t, "testdata/any", []string{"ExtendedAnySyntax_InMap"}, "c4.txtar") - runDiffTest(t, "testdata/any", []string{"NormalMessageSyntaxValidType"}, "d.txtar") - runDiffTest(t, "testdata/any", []string{"NormalMessageSyntaxInvalidType"}, "e.txtar") -} - -func TestSourceCodeInfo(t *testing.T) { - t.Parallel() - noExts := []ImageFilterOption{WithExcludeCustomOptions(), WithExcludeKnownExtensions()} - runSourceCodeInfoTest(t, "foo.bar.Foo", "Foo.txtar", noExts...) - runSourceCodeInfoTest(t, "foo.bar.Foo", "Foo+Ext.txtar") - runSourceCodeInfoTest(t, "foo.bar.Foo.NestedFoo", "NestedFoo.txtar", noExts...) - runSourceCodeInfoTest(t, "foo.bar.Bar", "Bar.txtar", noExts...) - runSourceCodeInfoTest(t, "foo.bar.Baz", "Baz.txtar", noExts...) - runSourceCodeInfoTest(t, "foo.bar.Quz", "Quz.txtar", noExts...) - runSourceCodeInfoTest(t, "foo.bar.Svc", "Svc.txtar", noExts...) - runSourceCodeInfoTest(t, "foo.bar.Svc.Do", "Do.txtar", noExts...) - runSourceCodeInfoTest(t, "foo.bar", "all.txtar") -} - -func TestTransitivePublic(t *testing.T) { - t.Parallel() - ctx := context.Background() - bucket, err := storagemem.NewReadBucket(map[string][]byte{ - "a.proto": []byte(`syntax = "proto3";package a;message Foo{}`), - "b.proto": []byte(`syntax = "proto3";package b;import public "a.proto";message Bar {}`), - "c.proto": []byte(`syntax = "proto3";package c;import "b.proto";message Baz{ a.Foo foo = 1; }`), - }) - require.NoError(t, err) - module, err := bufmodule.NewModuleForBucket(ctx, bucket) - require.NoError(t, err) - image, analysis, err := bufimagebuild.NewBuilder( - zaptest.NewLogger(t), - bufmodule.NewNopModuleReader(), - ).Build( - ctx, - module, - bufimagebuild.WithExcludeSourceCodeInfo(), - ) - require.NoError(t, err) - require.Empty(t, analysis) - - filteredImage, err := ImageFilteredByTypes(image, "c.Baz") - require.NoError(t, err) - - _, err = desc.CreateFileDescriptorsFromSet(bufimage.ImageToFileDescriptorSet(filteredImage)) - require.NoError(t, err) -} - -func TestTypesFromMainModule(t *testing.T) { - t.Parallel() - - ctx := context.Background() - moduleIdentityString := "buf.build/repo/main" - moduleIdentity, err := bufmoduleref.ModuleIdentityForString(moduleIdentityString) - require.NoError(t, err) - moduleIdentityDepString := "buf.build/repo/dep" - moduleIdentityDep, err := bufmoduleref.ModuleIdentityForString(moduleIdentityDepString) - require.NoError(t, err) - bucket := storagemem.NewReadWriteBucket() - require.NoError(t, storage.PutPath(ctx, bucket, "a.proto", []byte(`syntax = "proto3";import "b.proto";package pkg;message Foo { dependency.Dep bar = 1;}`))) - require.NoError(t, bufmoduletesting.WriteTestLockFileToBucket(ctx, bucket, moduleIdentityDepString)) - module, err := bufmodule.NewModuleForBucket(ctx, bucket, bufmodule.ModuleWithModuleIdentity(moduleIdentity)) - require.NoError(t, err) - bucketDep, err := storagemem.NewReadBucket(map[string][]byte{ - "b.proto": []byte(`syntax = "proto3";package dependency; message Dep{}`), - }) - require.NoError(t, err) - moduleDep, err := bufmodule.NewModuleForBucket(ctx, bucketDep, bufmodule.ModuleWithModuleIdentity(moduleIdentityDep)) - require.NoError(t, err) - image, analysis, err := bufimagebuild.NewBuilder( - zaptest.NewLogger(t), - bufmoduletesting.NewTestModuleReader( - map[string]bufmodule.Module{ - moduleIdentityDep.IdentityString(): moduleDep, - }, - ), - ).Build( - ctx, - module, - bufimagebuild.WithExcludeSourceCodeInfo(), - ) - require.NoError(t, err) - require.Empty(t, analysis) - - _, err = ImageFilteredByTypes(image, "dependency.Dep") - require.Error(t, err) - assert.ErrorIs(t, err, ErrImageFilterTypeIsImport) - - // allowed if we specify option - _, err = ImageFilteredByTypesWithOptions(image, []string{"dependency.Dep"}, WithAllowFilterByImportedType()) - require.NoError(t, err) - - _, err = ImageFilteredByTypes(image, "nonexisting") - require.Error(t, err) - assert.ErrorIs(t, err, ErrImageFilterTypeNotFound) -} - -func getImage(ctx context.Context, logger *zap.Logger, testdataDir string, options ...bufimagebuild.BuildOption) (storage.ReadWriteBucket, bufimage.Image, error) { - bucket, err := storageos.NewProvider().NewReadWriteBucket(testdataDir) - if err != nil { - return nil, nil, err - } - module, err := bufmodule.NewModuleForBucket( - ctx, - storage.MapReadBucket(bucket, storage.MatchPathExt(".proto")), - ) - if err != nil { - return nil, nil, err - } - builder := bufimagebuild.NewBuilder(logger, bufmodule.NewNopModuleReader()) - image, analysis, err := builder.Build( - ctx, - module, - options..., - ) - if err != nil { - return nil, nil, err - } - if len(analysis) > 0 { - return nil, nil, fmt.Errorf("%d errors in source when building", len(analysis)) - } - return bucket, image, nil -} - -func runDiffTest(t *testing.T, testdataDir string, typenames []string, expectedFile string, opts ...ImageFilterOption) { - ctx := context.Background() - bucket, image, err := getImage(ctx, zaptest.NewLogger(t), testdataDir, bufimagebuild.WithExcludeSourceCodeInfo()) - require.NoError(t, err) - - filteredImage, err := ImageFilteredByTypesWithOptions(image, typenames, opts...) - require.NoError(t, err) - assert.NotNil(t, image) - assert.True(t, imageIsDependencyOrdered(filteredImage), "image files not in dependency order") - - // We may have filtered out custom options from the set in the step above. However, the options messages - // still contain extension fields that refer to the custom options, as a result of building the image. - // So we serialize and then de-serialize, and use only the filtered results to parse extensions. That - // way, the result will omit custom options that aren't present in the filtered set (as they will be - // considered unrecognized fields). - resolver, err := protoencoding.NewResolver(bufimage.ImageToFileDescriptors(filteredImage)...) - require.NoError(t, err) - data, err := proto.Marshal(bufimage.ImageToFileDescriptorSet(filteredImage)) - require.NoError(t, err) - fileDescriptorSet := &descriptorpb.FileDescriptorSet{} - err = proto.UnmarshalOptions{Resolver: resolver}.Unmarshal(data, fileDescriptorSet) - require.NoError(t, err) - - reflectDescriptors, err := desc.CreateFileDescriptorsFromSet(fileDescriptorSet) - require.NoError(t, err) - archive := &txtar.Archive{} - printer := protoprint.Printer{ - SortElements: true, - Compact: true, - } - for fname, d := range reflectDescriptors { - fileBuilder := &bytes.Buffer{} - require.NoError(t, printer.PrintProtoFile(d, fileBuilder), "expected no error while printing %q", fname) - archive.Files = append( - archive.Files, - txtar.File{ - Name: fname, - Data: fileBuilder.Bytes(), - }, - ) - } - sort.SliceStable(archive.Files, func(i, j int) bool { - return archive.Files[i].Name < archive.Files[j].Name - }) - generated := txtar.Format(archive) - checkExpectation(t, ctx, generated, bucket, expectedFile) -} - -func checkExpectation(t *testing.T, ctx context.Context, actual []byte, bucket storage.ReadWriteBucket, expectedFile string) { - if shouldUpdateExpectations { - writer, err := bucket.Put(ctx, expectedFile) - require.NoError(t, err) - _, err = writer.Write(actual) - require.NoError(t, err) - require.NoError(t, writer.Close()) - } else { - expectedReader, err := bucket.Get(ctx, expectedFile) - require.NoError(t, err) - expected, err := io.ReadAll(expectedReader) - require.NoError(t, err) - assert.Equal(t, string(expected), string(actual)) - } -} - -func runSourceCodeInfoTest(t *testing.T, typename string, expectedFile string, opts ...ImageFilterOption) { - ctx := context.Background() - bucket, image, err := getImage(ctx, zaptest.NewLogger(t), "testdata/sourcecodeinfo") - require.NoError(t, err) - - filteredImage, err := ImageFilteredByTypesWithOptions(image, []string{typename}, opts...) - require.NoError(t, err) - - imageFile := filteredImage.GetFile("test.proto") - sourceCodeInfo := imageFile.FileDescriptor().GetSourceCodeInfo() - actual, err := protoencoding.NewJSONMarshaler(nil, protoencoding.JSONMarshalerWithIndent()).Marshal(sourceCodeInfo) - require.NoError(t, err) - - checkExpectation(t, ctx, actual, bucket, expectedFile) - - resolver, err := protoencoding.NewResolver(bufimage.ImageToFileDescriptors(filteredImage)...) - require.NoError(t, err) - file, err := resolver.FindFileByPath("test.proto") - require.NoError(t, err) - examineComments(t, file) -} - -func imageIsDependencyOrdered(image bufimage.Image) bool { - seen := make(map[string]struct{}) - for _, file := range image.Files() { - for _, importName := range file.Proto().Dependency { - if _, ok := seen[importName]; !ok { - return false - } - } - seen[file.Path()] = struct{}{} - } - return true -} - -func examineComments(t *testing.T, file protoreflect.FileDescriptor) { - examineCommentsInTypeContainer(t, file, file) - svcs := file.Services() - for i, numSvcs := 0, svcs.Len(); i < numSvcs; i++ { - svc := svcs.Get(i) - examineComment(t, file, svc) - methods := svc.Methods() - for j, numMethods := 0, methods.Len(); j < numMethods; j++ { - method := methods.Get(j) - examineComment(t, file, method) - } - } -} - -type typeContainer interface { - Messages() protoreflect.MessageDescriptors - Enums() protoreflect.EnumDescriptors - Extensions() protoreflect.ExtensionDescriptors -} - -func examineCommentsInTypeContainer(t *testing.T, file protoreflect.FileDescriptor, descriptor typeContainer) { - msgs := descriptor.Messages() - for i, numMsgs := 0, msgs.Len(); i < numMsgs; i++ { - msg := msgs.Get(i) - examineComment(t, file, msg) - fields := msg.Fields() - for j, numFields := 0, fields.Len(); j < numFields; j++ { - field := fields.Get(j) - examineComment(t, file, field) - } - oneofs := msg.Oneofs() - for j, numOneofs := 0, oneofs.Len(); j < numOneofs; j++ { - oneof := oneofs.Get(j) - examineComment(t, file, oneof) - } - examineCommentsInTypeContainer(t, file, msg) - } - enums := descriptor.Enums() - for i, numEnums := 0, enums.Len(); i < numEnums; i++ { - enum := enums.Get(i) - examineComment(t, file, enum) - vals := enum.Values() - for j, numVals := 0, vals.Len(); j < numVals; j++ { - val := vals.Get(j) - examineComment(t, file, val) - } - } - exts := descriptor.Extensions() - for i, numExts := 0, exts.Len(); i < numExts; i++ { - ext := exts.Get(i) - examineComment(t, file, ext) - } -} - -func examineComment(t *testing.T, file protoreflect.FileDescriptor, descriptor protoreflect.Descriptor) { - loc := file.SourceLocations().ByDescriptor(descriptor) - if loc.LeadingComments == "" { - // Messages that are only present because they are namespaces that contains a retained - // type will not have a comment. So we can skip the comment check for that case. - if msg, ok := descriptor.(protoreflect.MessageDescriptor); ok && msg.Fields().Len() == 0 { - return - } - } - // Verify we got the correct location by checking that the comment contains the element's name - require.Contains(t, loc.LeadingComments, string(descriptor.Name())) -} - -func BenchmarkFilterImage_WithoutSourceCodeInfo(b *testing.B) { - benchmarkFilterImage(b, bufimagebuild.WithExcludeSourceCodeInfo()) -} - -func BenchmarkFilterImage_WithSourceCodeInfo(b *testing.B) { - benchmarkFilterImage(b) -} - -func benchmarkFilterImage(b *testing.B, opts ...bufimagebuild.BuildOption) { - benchmarkCases := []*struct { - folder string - image bufimage.Image - types []string - }{ - { - folder: "testdata/extensions", - types: []string{"pkg.Foo"}, - }, - { - folder: "testdata/importmods", - types: []string{"ImportRegular", "ImportWeak", "ImportPublic", "NoImports"}, - }, - { - folder: "testdata/nesting", - types: []string{"pkg.Foo", "pkg.Foo.NestedFoo.NestedNestedFoo", "pkg.Baz", "pkg.FooEnum"}, - }, - { - folder: "testdata/options", - types: []string{"pkg.Foo", "pkg.FooEnum", "pkg.FooService", "pkg.FooService.Do"}, - }, - } - ctx := context.Background() - for _, benchmarkCase := range benchmarkCases { - _, image, err := getImage(ctx, zaptest.NewLogger(b), benchmarkCase.folder, opts...) - require.NoError(b, err) - benchmarkCase.image = image - } - b.ResetTimer() - - i := 0 - for { - for _, benchmarkCase := range benchmarkCases { - for _, typeName := range benchmarkCase.types { - // filtering is destructive, so we have to make a copy - b.StopTimer() - imageFiles := make([]bufimage.ImageFile, len(benchmarkCase.image.Files())) - for j, file := range benchmarkCase.image.Files() { - clone, ok := proto.Clone(file.Proto()).(*descriptorpb.FileDescriptorProto) - require.True(b, ok) - var err error - imageFiles[j], err = bufimage.NewImageFile(clone, nil, "", "", false, false, nil) - require.NoError(b, err) - } - image, err := bufimage.NewImage(imageFiles) - require.NoError(b, err) - b.StartTimer() - - _, err = ImageFilteredByTypes(image, typeName) - require.NoError(b, err) - i++ - if i == b.N { - return - } - } - } - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap_test.go b/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap_test.go deleted file mode 100644 index 990024d20..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/source_paths_remap_test.go +++ /dev/null @@ -1,211 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimageutil - -import ( - "fmt" - "math/rand" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestSourcePathsRemapTrie_Insert(t *testing.T) { - t.Parallel() - expectedSlices := [][]string{ - {"4"}, - {"4", "1 -> -1"}, - {"4", "2 -> 1"}, - {"4", "2 -> 1", "2"}, - {"4", "2 -> 1", "2", "0 -> -1"}, - {"4", "2 -> 1", "2", "1 -> 0"}, - {"4", "2 -> 1", "2", "1 -> 0", "8"}, - {"4", "2 -> 1", "2", "1 -> 0", "8", "3 -> -1"}, - {"4", "2 -> 1", "2", "1 -> 0", "8", "4 -> -1"}, - {"4", "2 -> 1", "2", "1 -> 0", "8", "5 -> 3"}, - {"4", "2 -> 1", "2", "1 -> 0", "8", "6 -> 4"}, - {"4", "2 -> 1", "2", "1 -> 0", "8", "7 -> 5"}, - {"4", "3 -> 2"}, - {"4", "4 -> 3"}, - {"4", "5 -> -1"}, - } - t.Run("in order", func(t *testing.T) { - t.Parallel() - trie := createTrie(nil) - slices := asSlices(trie) - require.Equal(t, expectedSlices, slices) - }) - // shuffle a few times and make sure the trie is always constructed correctly - for i := 0; i < 5; i++ { - rnd := rand.New(rand.NewSource(int64(i))) - t.Run(fmt.Sprintf("random order %d", i), func(t *testing.T) { - t.Parallel() - trie := createTrie(func(ops []insertionOp) []insertionOp { - shuffle(rnd, ops) - return ops - }) - slices := asSlices(trie) - require.Equal(t, expectedSlices, slices) - }) - } -} - -func TestSourcePathsRemapTrie_NewPath(t *testing.T) { - t.Parallel() - trie := createTrie(nil) - // make sure the items in the trie construct correct new path - path, noComment := trie.newPath([]int32{4, 1}) - require.Nil(t, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 2}) - require.Equal(t, []int32{4, 1}, path) - require.True(t, noComment) - path, noComment = trie.newPath([]int32{4, 2, 2, 0}) - require.Nil(t, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 2, 2, 1}) - require.Equal(t, []int32{4, 1, 2, 0}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 3}) - require.Nil(t, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 4}) - require.Nil(t, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 5}) - require.Equal(t, []int32{4, 1, 2, 0, 8, 3}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 6}) - require.Equal(t, []int32{4, 1, 2, 0, 8, 4}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 7}) - require.Equal(t, []int32{4, 1, 2, 0, 8, 5}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 3}) - require.Equal(t, []int32{4, 2}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 4}) - require.Equal(t, []int32{4, 3}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 5}) - require.Nil(t, path) - require.False(t, noComment) - - // items not in the trie or not re-written remain unchanged - path, noComment = trie.newPath([]int32{0, 1, 2, 3}) - require.Equal(t, []int32{0, 1, 2, 3}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 0, 3, 2, 8, 5}) - require.Equal(t, []int32{4, 0, 3, 2, 8, 5}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 6}) - require.Equal(t, []int32{4, 6}, path) - require.False(t, noComment) - // items that are descendants of re-written items are also changed - path, noComment = trie.newPath([]int32{4, 2, 2, 1, 8, 5, 5, 9, 4, 4}) - require.Equal(t, []int32{4, 1, 2, 0, 8, 3, 5, 9, 4, 4}, path) - require.False(t, noComment) - path, noComment = trie.newPath([]int32{4, 4, 9, 4, 3, 5}) - require.Equal(t, []int32{4, 3, 9, 4, 3, 5}, path) - require.False(t, noComment) - // items that are descendants of deleted items are also deleted - path, noComment = trie.newPath([]int32{4, 5, 1, 3, 4, 5}) - require.Nil(t, path) - require.False(t, noComment) -} - -type insertionOp struct { - oldPath []int32 - newIndex int32 -} - -func createTrie(permutation func([]insertionOp) []insertionOp) *sourcePathsRemapTrie { - // Test data has the following source info path changes - // 4,1 -> deleted - // 4,2 -> 4,1 *no comment - // 4,2,2,0 -> deleted - // 4,2,2,1 -> 4,1,2,0 - // 4,2,2,1,8,3 -> deleted - // 4,2,2,1,8,4 -> deleted - // 4,2,2,1,8,5 -> 4,1,2,0,8,3 - // 4,2,2,1,8,6 -> 4,1,2,0,8,4 - // 4,2,2,1,8,7 -> 4,1,2,0,8,5 - // 4,3 -> 4,2 - // 4,4 -> 4,3 - // 4,5 -> deleted - // Test data is sorted (unless permutation function rearranges) - ops := []insertionOp{ - {[]int32{4, 1}, -1}, - {[]int32{4, 2}, 1}, - {[]int32{4, 2}, -2}, - {[]int32{4, 2, 2, 0}, -1}, - {[]int32{4, 2, 2, 1}, 0}, - {[]int32{4, 2, 2, 1, 8, 3}, -1}, - {[]int32{4, 2, 2, 1, 8, 4}, -1}, - {[]int32{4, 2, 2, 1, 8, 5}, 3}, - {[]int32{4, 2, 2, 1, 8, 6}, 4}, - {[]int32{4, 2, 2, 1, 8, 7}, 5}, - {[]int32{4, 3}, 2}, - {[]int32{4, 4}, 3}, - {[]int32{4, 5}, -1}, - } - if permutation != nil { - ops = permutation(ops) - } - trie := &sourcePathsRemapTrie{} - for _, op := range ops { - if op.newIndex == -2 { - trie.markNoComment(op.oldPath) - continue - } - trie.markMoved(op.oldPath, op.newIndex) - } - return trie -} - -func shuffle[T any](rnd *rand.Rand, slice []T) { - for i := range slice { - pick := rnd.Intn(len(slice)-i) + i - if i != pick { - slice[i], slice[pick] = slice[pick], slice[i] - } - } -} - -func asSlices(t *sourcePathsRemapTrie) [][]string { - var result [][]string - for _, child := range *t { - toSlices(child, nil, &result) - } - return result -} - -func toSlices(t *sourcePathsRemapTrieNode, soFar []string, result *[][]string) { - if t.oldIndex == t.newIndex { - soFar = append(soFar, fmt.Sprintf("%d", t.oldIndex)) - } else { - soFar = append(soFar, fmt.Sprintf("%d -> %d", t.oldIndex, t.newIndex)) - } - clone := make([]string, len(soFar)) - copy(clone, soFar) - *result = append(*result, clone) - if len(t.children) == 0 { - return - } - for _, child := range t.children { - toSlices(child, soFar, result) - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/a.proto deleted file mode 100644 index db4f2af00..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/a.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "google/protobuf/any.proto"; -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.MessageOptions { - google.protobuf.Any extra = 10101; - AnyInField extra_in_field = 10102; - AnyInList extra_in_list = 10103; - AnyInMap extra_in_map = 10104; -} - -message AnyInField { - google.protobuf.Any any = 1; -} - -message AnyInList { - repeated google.protobuf.Any list_any = 1; -} - -message AnyInMap { - map map = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/b.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/b.proto deleted file mode 100644 index c52b6782b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/b.proto +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.baz; - -message Foo { - string name = 1; - int32 id = 2; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.proto deleted file mode 100644 index 9c6b01784..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.proto +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "a.proto"; -import "b.proto"; - -message ExtendedAnySyntax { - option (extra) = { - [type.googleapis.com/foo.bar.baz.Foo]: { - name: "Bob Loblaw" - id: 42 - } - }; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.txtar deleted file mode 100644 index dcde9a132..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c1.txtar +++ /dev/null @@ -1,69 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "google/protobuf/any.proto"; -import "google/protobuf/descriptor.proto"; -extend google.protobuf.MessageOptions { - google.protobuf.Any extra = 10101; -} --- b.proto -- -syntax = "proto3"; -package foo.bar.baz; -message Foo { - string name = 1; - int32 id = 2; -} --- c1.proto -- -syntax = "proto3"; -import "a.proto"; -import "b.proto"; -message ExtendedAnySyntax { - option (extra) = { - [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } - }; -} --- google/protobuf/any.proto -- -syntax = "proto3"; -package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/anypb"; -option java_multiple_files = true; -option java_outer_classname = "AnyProto"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -message Any { - string type_url = 1; - bytes value = 2; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.proto deleted file mode 100644 index ac7dd0999..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "a.proto"; -import "b.proto"; - -message ExtendedAnySyntax_InField { - option (extra_in_field) = { - any: { - [type.googleapis.com/foo.bar.baz.Foo]: { - name: "Bob Loblaw" - id: 42 - } - } - }; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.txtar deleted file mode 100644 index 55249e9be..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c2.txtar +++ /dev/null @@ -1,74 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "google/protobuf/any.proto"; -import "google/protobuf/descriptor.proto"; -message AnyInField { - google.protobuf.Any any = 1; -} -extend google.protobuf.MessageOptions { - AnyInField extra_in_field = 10102; -} --- b.proto -- -syntax = "proto3"; -package foo.bar.baz; -message Foo { - string name = 1; - int32 id = 2; -} --- c2.proto -- -syntax = "proto3"; -import "a.proto"; -import "b.proto"; -message ExtendedAnySyntax_InField { - option (extra_in_field) = { - any: { - [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } - } - }; -} --- google/protobuf/any.proto -- -syntax = "proto3"; -package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/anypb"; -option java_multiple_files = true; -option java_outer_classname = "AnyProto"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -message Any { - string type_url = 1; - bytes value = 2; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.proto deleted file mode 100644 index 7f60d196b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "a.proto"; -import "b.proto"; - -message ExtendedAnySyntax_InList { - option (extra_in_list) = { - list_any: { - [type.googleapis.com/ExtendedAnySyntax_InList]: {} - } - list_any: { - [type.googleapis.com/foo.bar.baz.Foo]: { - name: "Bob Loblaw" - id: 42 - } - } - }; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.txtar deleted file mode 100644 index 8810e901a..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c3.txtar +++ /dev/null @@ -1,79 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "google/protobuf/any.proto"; -import "google/protobuf/descriptor.proto"; -message AnyInList { - repeated google.protobuf.Any list_any = 1; -} -extend google.protobuf.MessageOptions { - AnyInList extra_in_list = 10103; -} --- b.proto -- -syntax = "proto3"; -package foo.bar.baz; -message Foo { - string name = 1; - int32 id = 2; -} --- c3.proto -- -syntax = "proto3"; -import "a.proto"; -import "b.proto"; -message ExtendedAnySyntax_InList { - option (extra_in_list) = { - list_any: [ - { - [type.googleapis.com/ExtendedAnySyntax_InList]: { } - }, - { - [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } - } - ] - }; -} --- google/protobuf/any.proto -- -syntax = "proto3"; -package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/anypb"; -option java_multiple_files = true; -option java_outer_classname = "AnyProto"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -message Any { - string type_url = 1; - bytes value = 2; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.proto deleted file mode 100644 index 33ab273a2..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.proto +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "a.proto"; -import "b.proto"; - -message ExtendedAnySyntax_InMap { - option (extra_in_map) = { - map: [ - { - key: "foo" - value: { - any: { - [type.googleapis.com/ExtendedAnySyntax_InMap]: {} - } - } - }, - { - key: "bar" - value: { - any: { - [type.googleapis.com/foo.bar.baz.Foo]: { - name: "Bob Loblaw" - id: 42 - } - } - } - } - ] - }; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.txtar deleted file mode 100644 index 169d5ec24..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/c4.txtar +++ /dev/null @@ -1,92 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "google/protobuf/any.proto"; -import "google/protobuf/descriptor.proto"; -message AnyInField { - google.protobuf.Any any = 1; -} -message AnyInMap { - map map = 1; -} -extend google.protobuf.MessageOptions { - AnyInMap extra_in_map = 10104; -} --- b.proto -- -syntax = "proto3"; -package foo.bar.baz; -message Foo { - string name = 1; - int32 id = 2; -} --- c4.proto -- -syntax = "proto3"; -import "a.proto"; -import "b.proto"; -message ExtendedAnySyntax_InMap { - option (extra_in_map) = { - map: [ - { - key: "bar", - value: { - any: { - [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } - } - } - }, - { - key: "foo", - value: { - any: { - [type.googleapis.com/ExtendedAnySyntax_InMap]: { } - } - } - } - ] - }; -} --- google/protobuf/any.proto -- -syntax = "proto3"; -package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/anypb"; -option java_multiple_files = true; -option java_outer_classname = "AnyProto"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -message Any { - string type_url = 1; - bytes value = 2; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.proto deleted file mode 100644 index 1db57f72e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "a.proto"; - -message NormalMessageSyntaxValidType { - option (extra) = { - type_url: "type.googleapis.com/foo.bar.baz.Foo" - value: "\x0a\x0a\x42\x6f\x62\x20\x4c\x6f\x62\x6c\x61\x77\x10\x2a" - }; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.txtar deleted file mode 100644 index c8d3538d6..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/d.txtar +++ /dev/null @@ -1,69 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "google/protobuf/any.proto"; -import "google/protobuf/descriptor.proto"; -extend google.protobuf.MessageOptions { - google.protobuf.Any extra = 10101; -} --- b.proto -- -syntax = "proto3"; -package foo.bar.baz; -message Foo { - string name = 1; - int32 id = 2; -} --- d.proto -- -syntax = "proto3"; -import "a.proto"; -import "b.proto"; -message NormalMessageSyntaxValidType { - option (extra) = { - [type.googleapis.com/foo.bar.baz.Foo]: { name: "Bob Loblaw", id: 42 } - }; -} --- google/protobuf/any.proto -- -syntax = "proto3"; -package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/anypb"; -option java_multiple_files = true; -option java_outer_classname = "AnyProto"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -message Any { - string type_url = 1; - bytes value = 2; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.proto deleted file mode 100644 index 6dfb315a2..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "a.proto"; - -message NormalMessageSyntaxInvalidType { - option (extra) = { - type_url: "type.googleapis.com/blah.blah.Blah" - value: "\x01\x02\x03\x04" - }; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.txtar deleted file mode 100644 index a8a3669a7..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/any/e.txtar +++ /dev/null @@ -1,59 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "google/protobuf/any.proto"; -import "google/protobuf/descriptor.proto"; -extend google.protobuf.MessageOptions { - google.protobuf.Any extra = 10101; -} --- e.proto -- -syntax = "proto3"; -import "a.proto"; -message NormalMessageSyntaxInvalidType { - option (extra) = { type_url: "type.googleapis.com/blah.blah.Blah", value: "\001\002\003\004" }; -} --- google/protobuf/any.proto -- -syntax = "proto3"; -package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/anypb"; -option java_multiple_files = true; -option java_outer_classname = "AnyProto"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -message Any { - string type_url = 1; - bytes value = 2; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/a.proto deleted file mode 100644 index b170923bf..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/a.proto +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; -package pkg; - -message Foo { - optional string a = 1; - optional Foo b = 2; - extensions 10 to max; -} - -extend Foo { - optional string extended = 11; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/b.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/b.proto deleted file mode 100644 index b24394b1f..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/b.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; -package other; -import "a.proto"; - -message Embedded { - extend pkg.Foo { - optional Embedded from_other_file = 12; - } - - optional string foo = 1; -} - -message Referenced { - optional string x = 1; -} - -extend pkg.Foo { - optional Referenced from_other_file = 13; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions-excluded.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions-excluded.txtar deleted file mode 100644 index d5d4528e9..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions-excluded.txtar +++ /dev/null @@ -1,8 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -message Foo { - optional string a = 1; - optional Foo b = 2; - extensions 10 to max; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions.txtar deleted file mode 100644 index c3a1965db..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/extensions/extensions.txtar +++ /dev/null @@ -1,27 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -message Foo { - optional string a = 1; - optional Foo b = 2; - extensions 10 to max; -} -extend Foo { - optional string extended = 11; -} --- b.proto -- -syntax = "proto2"; -package other; -import "a.proto"; -message Embedded { - optional string foo = 1; - extend pkg.Foo { - optional Embedded from_other_file = 12; - } -} -message Referenced { - optional string x = 1; -} -extend pkg.Foo { - optional Referenced from_other_file = 13; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/a.proto deleted file mode 100644 index 826fde97b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/a.proto +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "regular.proto"; -import weak "weak.proto"; -import public "public.proto"; - -message ImportRegular { - Regular x = 1; -} - -message ImportWeak { - Weak x = 1; -} - -message ImportPublic { - Public x = 1; -} - -message NoImports { - string x = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/noimports.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/noimports.txtar deleted file mode 100644 index 1e006a090..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/noimports.txtar +++ /dev/null @@ -1,5 +0,0 @@ --- a.proto -- -syntax = "proto3"; -message NoImports { - string x = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/public.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/public.proto deleted file mode 100644 index 001d803de..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/public.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Public {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular.proto deleted file mode 100644 index ff6701563..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Regular {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_public.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_public.txtar deleted file mode 100644 index 239e32847..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_public.txtar +++ /dev/null @@ -1,18 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "public.proto"; -import "regular.proto"; -message ImportPublic { - Public x = 1; -} -message ImportRegular { - Regular x = 1; -} --- public.proto -- -syntax = "proto3"; -message Public { -} --- regular.proto -- -syntax = "proto3"; -message Regular { -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_weak.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_weak.txtar deleted file mode 100644 index 044fa6209..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/regular_weak.txtar +++ /dev/null @@ -1,18 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "regular.proto"; -import weak "weak.proto"; -message ImportRegular { - Regular x = 1; -} -message ImportWeak { - Weak x = 1; -} --- regular.proto -- -syntax = "proto3"; -message Regular { -} --- weak.proto -- -syntax = "proto3"; -message Weak { -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak.proto deleted file mode 100644 index 54ba30be9..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -message Weak {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak_public.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak_public.txtar deleted file mode 100644 index 09433d551..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/importmods/weak_public.txtar +++ /dev/null @@ -1,18 +0,0 @@ --- a.proto -- -syntax = "proto3"; -import "public.proto"; -import weak "weak.proto"; -message ImportPublic { - Public x = 1; -} -message ImportWeak { - Weak x = 1; -} --- public.proto -- -syntax = "proto3"; -message Public { -} --- weak.proto -- -syntax = "proto3"; -message Weak { -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/a.proto deleted file mode 100644 index ebb448a38..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/a.proto +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -package pkg; - -message Foo { - message NestedFoo { - message NestedNestedFoo { - string nested_nested_x = 1; - } - string nested_x = 1; - } - - message NestedButNotUsed { - string nested_but_not_used = 1; - } - string x = 1; - NestedFoo nested_foo = 2; -} - -enum FooEnum { - FOO_ENUM_X = 0; - FOO_ENUM_Y = 1; -} - -message Bar { - enum NestedBarEnum { - NESTED_BAR_ENUM_X = 0; - NESTED_BAR_ENUM_Y = 1; - } - FooEnum foo_enum = 1; - Foo.NestedFoo nested_foo = 2; -} - -message Baz { - Bar.NestedBarEnum nested_bar_enum = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/enum.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/enum.txtar deleted file mode 100644 index 36b9f3da9..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/enum.txtar +++ /dev/null @@ -1,7 +0,0 @@ --- a.proto -- -syntax = "proto3"; -package pkg; -enum FooEnum { - FOO_ENUM_X = 0; - FOO_ENUM_Y = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/message.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/message.txtar deleted file mode 100644 index 0c02c7645..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/message.txtar +++ /dev/null @@ -1,10 +0,0 @@ --- a.proto -- -syntax = "proto3"; -package pkg; -message Foo { - string x = 1; - NestedFoo nested_foo = 2; - message NestedFoo { - string nested_x = 1; - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/recursenested.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/recursenested.txtar deleted file mode 100644 index 4fe6961c8..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/recursenested.txtar +++ /dev/null @@ -1,10 +0,0 @@ --- a.proto -- -syntax = "proto3"; -package pkg; -message Foo { - message NestedFoo { - message NestedNestedFoo { - string nested_nested_x = 1; - } - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/usingother.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/usingother.txtar deleted file mode 100644 index 83eada7da..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/nesting/usingother.txtar +++ /dev/null @@ -1,12 +0,0 @@ --- a.proto -- -syntax = "proto3"; -package pkg; -message Bar { - enum NestedBarEnum { - NESTED_BAR_ENUM_X = 0; - NESTED_BAR_ENUM_Y = 1; - } -} -message Baz { - Bar.NestedBarEnum nested_bar_enum = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/Files.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/Files.txtar deleted file mode 100644 index 68ef47716..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/Files.txtar +++ /dev/null @@ -1,314 +0,0 @@ --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message DescriptorProto { - optional string name = 1; - repeated FieldDescriptorProto field = 2; - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - repeated ExtensionRange extension_range = 5; - repeated FieldDescriptorProto extension = 6; - optional MessageOptions options = 7; - repeated OneofDescriptorProto oneof_decl = 8; - repeated ReservedRange reserved_range = 9; - repeated string reserved_name = 10; - message ExtensionRange { - optional int32 start = 1; - optional int32 end = 2; - optional ExtensionRangeOptions options = 3; - } - message ReservedRange { - optional int32 start = 1; - optional int32 end = 2; - } -} -message EnumDescriptorProto { - optional string name = 1; - repeated EnumValueDescriptorProto value = 2; - optional EnumOptions options = 3; - repeated EnumReservedRange reserved_range = 4; - repeated string reserved_name = 5; - message EnumReservedRange { - optional int32 start = 1; - optional int32 end = 2; - } -} -message EnumOptions { - optional bool allow_alias = 2; - optional bool deprecated = 3 [default = false]; - optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 5; -} -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - optional EnumValueOptions options = 3; -} -message EnumValueOptions { - optional bool deprecated = 1 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message ExtensionRangeOptions { - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message FieldDescriptorProto { - optional string name = 1; - optional string extendee = 2; - optional int32 number = 3; - optional Label label = 4; - optional Type type = 5; - optional string type_name = 6; - optional string default_value = 7; - optional FieldOptions options = 8; - optional int32 oneof_index = 9; - optional string json_name = 10; - optional bool proto3_optional = 17; - enum Label { - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - } - enum Type { - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; - TYPE_SINT64 = 18; - } -} -message FieldOptions { - optional CType ctype = 1 [default = STRING]; - optional bool packed = 2; - optional bool deprecated = 3 [default = false]; - optional bool lazy = 5 [default = false]; - optional JSType jstype = 6 [default = JS_NORMAL]; - optional bool weak = 10 [default = false]; - optional bool unverified_lazy = 15 [default = false]; - optional bool debug_redact = 16 [default = false]; - optional OptionRetention retention = 17; - optional OptionTargetType target = 18; - repeated UninterpretedOption uninterpreted_option = 999; - enum CType { - STRING = 0; - CORD = 1; - STRING_PIECE = 2; - } - enum JSType { - JS_NORMAL = 0; - JS_STRING = 1; - JS_NUMBER = 2; - } - enum OptionRetention { - RETENTION_UNKNOWN = 0; - RETENTION_RUNTIME = 1; - RETENTION_SOURCE = 2; - } - enum OptionTargetType { - TARGET_TYPE_UNKNOWN = 0; - TARGET_TYPE_FILE = 1; - TARGET_TYPE_EXTENSION_RANGE = 2; - TARGET_TYPE_MESSAGE = 3; - TARGET_TYPE_FIELD = 4; - TARGET_TYPE_ONEOF = 5; - TARGET_TYPE_ENUM = 6; - TARGET_TYPE_ENUM_ENTRY = 7; - TARGET_TYPE_SERVICE = 8; - TARGET_TYPE_METHOD = 9; - } - extensions 1000 to max; - reserved 4; -} -message FileDescriptorProto { - optional string name = 1; - optional string package = 2; - repeated string dependency = 3; - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - optional FileOptions options = 8; - optional SourceCodeInfo source_code_info = 9; - repeated int32 public_dependency = 10; - repeated int32 weak_dependency = 11; - optional string syntax = 12; - optional string edition = 13; -} -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} -message FileOptions { - optional string java_package = 1; - optional string java_outer_classname = 8; - optional OptimizeMode optimize_for = 9 [default = SPEED]; - optional bool java_multiple_files = 10 [default = false]; - optional string go_package = 11; - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - optional bool deprecated = 23 [default = false]; - optional bool java_string_check_utf8 = 27 [default = false]; - optional bool cc_enable_arenas = 31 [default = true]; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - optional string swift_prefix = 39; - optional string php_class_prefix = 40; - optional string php_namespace = 41; - optional bool php_generic_services = 42 [default = false]; - optional string php_metadata_namespace = 44; - optional string ruby_package = 45; - repeated UninterpretedOption uninterpreted_option = 999; - enum OptimizeMode { - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - extensions 1000 to max; - reserved 38; -} -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message MethodDescriptorProto { - optional string name = 1; - optional string input_type = 2; - optional string output_type = 3; - optional MethodOptions options = 4; - optional bool client_streaming = 5 [default = false]; - optional bool server_streaming = 6 [default = false]; -} -message MethodOptions { - optional bool deprecated = 33 [default = false]; - optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; - repeated UninterpretedOption uninterpreted_option = 999; - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; - IDEMPOTENT = 2; - } - extensions 1000 to max; -} -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; -} -message OneofOptions { - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - optional ServiceOptions options = 3; -} -message ServiceOptions { - optional bool deprecated = 33 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message SourceCodeInfo { - repeated Location location = 1; - message Location { - repeated int32 path = 1 [packed = true]; - repeated int32 span = 2 [packed = true]; - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -message Files { - google.protobuf.FileDescriptorSet files = 1; -} -message UnusedOption { - string foo = 1; -} -message UsedOption { - string foo = 1; - extend google.protobuf.FileOptions { - optional UsedOption file_foo = 50000; - optional UnusedOption file_bar = 50001; - optional string file_baz = 50002; - } -} -extend google.protobuf.EnumOptions { - optional UsedOption enum_foo = 50000; - optional UnusedOption enum_bar = 50001; - optional string enum_baz = 50002; -} -extend google.protobuf.EnumValueOptions { - optional UsedOption enum_value_foo = 50000; - optional UnusedOption enum_value_bar = 50001; - optional string enum_value_baz = 50002; -} -extend google.protobuf.FieldOptions { - optional UsedOption field_foo = 50000; - optional UnusedOption field_bar = 50001; - optional string field_baz = 50002; -} -extend google.protobuf.MessageOptions { - optional UsedOption message_foo = 50000; - optional UnusedOption message_bar = 50001; - optional string message_baz = 50002; -} -extend google.protobuf.MethodOptions { - optional UsedOption method_foo = 50000; - optional UnusedOption method_bar = 50001; - optional string method_baz = 50002; -} -extend google.protobuf.OneofOptions { - optional UsedOption oneof_foo = 50000; - optional UnusedOption oneof_bar = 50001; - optional string oneof_baz = 50002; -} -extend google.protobuf.ServiceOptions { - optional UsedOption service_foo = 50000; - optional UnusedOption service_bar = 50001; - optional string service_baz = 50002; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/a.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/a.proto deleted file mode 100644 index 5f9d243a4..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/a.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; -package pkg; -import "options.proto"; - -option (UsedOption.file_foo).foo = "str"; -option (UsedOption.file_baz) = "str"; - -message Foo { - option (message_foo).foo = "str"; - option (message_baz) = "str"; - - optional string foo = 1 [ - (field_foo).foo = "str", - (field_baz) = "str", - jstype = JS_STRING - ]; - - oneof testOneof { - option (oneof_foo).foo = "str"; - option (oneof_baz) = "str"; - - string bar = 2; - bytes baz = 3; - } - - extensions 10 to max; -} - -enum FooEnum { - option (enum_foo).foo = "str"; - option (enum_baz) = "str"; - option deprecated = true; - - FOO_ENUM_X = 0; - FOO_ENUM_Y = 1 [ - (enum_value_foo).foo = "str", - (enum_value_baz) = "str" - ]; -} - -message Empty{} - -service FooService { - option (service_foo).foo = "str"; - option (service_baz) = "str"; - - rpc Do(Empty) returns (Empty) { - option (method_foo).foo = "str"; - option (method_baz) = "str"; - }; - - rpc DoNot(Empty) returns (Empty) { - option (method_foo).foo = "str"; - option (method_baz) = "str"; - }; -} - -extend Foo { - optional string extension = 11 [ - (field_foo).foo = "str", - (field_baz) = "str" - ]; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-exclude-options.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-exclude-options.txtar deleted file mode 100644 index 052623406..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-exclude-options.txtar +++ /dev/null @@ -1,25 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -message Empty { -} -message Foo { - optional string foo = 1 [jstype = JS_STRING]; - oneof testOneof { - string bar = 2; - bytes baz = 3; - } - extensions 10 to max; -} -enum FooEnum { - option deprecated = true; - FOO_ENUM_X = 0; - FOO_ENUM_Y = 1; -} -service FooService { - rpc Do ( Empty ) returns ( Empty ); - rpc DoNot ( Empty ) returns ( Empty ); -} -extend Foo { - optional string extension = 11; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-with-Files.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-with-Files.txtar deleted file mode 100644 index 96c065f61..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all-with-Files.txtar +++ /dev/null @@ -1,363 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -import "options.proto"; -option (UsedOption.file_baz) = "str"; -option (UsedOption.file_foo) = { foo: "str" }; -message Empty { -} -message Foo { - option (message_baz) = "str"; - option (message_foo) = { foo: "str" }; - optional string foo = 1 [ - jstype = JS_STRING, - (field_baz) = "str", - (field_foo) = { foo: "str" } - ]; - oneof testOneof { - option (oneof_baz) = "str"; - option (oneof_foo) = { foo: "str" }; - string bar = 2; - bytes baz = 3; - } - extensions 10 to max; -} -enum FooEnum { - option deprecated = true; - option (enum_baz) = "str"; - option (enum_foo) = { foo: "str" }; - FOO_ENUM_X = 0; - FOO_ENUM_Y = 1 [ - (enum_value_baz) = "str", - (enum_value_foo) = { foo: "str" } - ]; -} -service FooService { - option (service_baz) = "str"; - option (service_foo) = { foo: "str" }; - rpc Do ( Empty ) returns ( Empty ) { - option (method_baz) = "str"; - option (method_foo) = { foo: "str" }; - } - rpc DoNot ( Empty ) returns ( Empty ) { - option (method_baz) = "str"; - option (method_foo) = { foo: "str" }; - } -} -extend Foo { - optional string extension = 11 [(field_baz) = "str", (field_foo) = { foo: "str" }]; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message DescriptorProto { - optional string name = 1; - repeated FieldDescriptorProto field = 2; - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - repeated ExtensionRange extension_range = 5; - repeated FieldDescriptorProto extension = 6; - optional MessageOptions options = 7; - repeated OneofDescriptorProto oneof_decl = 8; - repeated ReservedRange reserved_range = 9; - repeated string reserved_name = 10; - message ExtensionRange { - optional int32 start = 1; - optional int32 end = 2; - optional ExtensionRangeOptions options = 3; - } - message ReservedRange { - optional int32 start = 1; - optional int32 end = 2; - } -} -message EnumDescriptorProto { - optional string name = 1; - repeated EnumValueDescriptorProto value = 2; - optional EnumOptions options = 3; - repeated EnumReservedRange reserved_range = 4; - repeated string reserved_name = 5; - message EnumReservedRange { - optional int32 start = 1; - optional int32 end = 2; - } -} -message EnumOptions { - optional bool allow_alias = 2; - optional bool deprecated = 3 [default = false]; - optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 5; -} -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - optional EnumValueOptions options = 3; -} -message EnumValueOptions { - optional bool deprecated = 1 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message ExtensionRangeOptions { - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message FieldDescriptorProto { - optional string name = 1; - optional string extendee = 2; - optional int32 number = 3; - optional Label label = 4; - optional Type type = 5; - optional string type_name = 6; - optional string default_value = 7; - optional FieldOptions options = 8; - optional int32 oneof_index = 9; - optional string json_name = 10; - optional bool proto3_optional = 17; - enum Label { - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - } - enum Type { - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; - TYPE_SINT64 = 18; - } -} -message FieldOptions { - optional CType ctype = 1 [default = STRING]; - optional bool packed = 2; - optional bool deprecated = 3 [default = false]; - optional bool lazy = 5 [default = false]; - optional JSType jstype = 6 [default = JS_NORMAL]; - optional bool weak = 10 [default = false]; - optional bool unverified_lazy = 15 [default = false]; - optional bool debug_redact = 16 [default = false]; - optional OptionRetention retention = 17; - optional OptionTargetType target = 18; - repeated UninterpretedOption uninterpreted_option = 999; - enum CType { - STRING = 0; - CORD = 1; - STRING_PIECE = 2; - } - enum JSType { - JS_NORMAL = 0; - JS_STRING = 1; - JS_NUMBER = 2; - } - enum OptionRetention { - RETENTION_UNKNOWN = 0; - RETENTION_RUNTIME = 1; - RETENTION_SOURCE = 2; - } - enum OptionTargetType { - TARGET_TYPE_UNKNOWN = 0; - TARGET_TYPE_FILE = 1; - TARGET_TYPE_EXTENSION_RANGE = 2; - TARGET_TYPE_MESSAGE = 3; - TARGET_TYPE_FIELD = 4; - TARGET_TYPE_ONEOF = 5; - TARGET_TYPE_ENUM = 6; - TARGET_TYPE_ENUM_ENTRY = 7; - TARGET_TYPE_SERVICE = 8; - TARGET_TYPE_METHOD = 9; - } - extensions 1000 to max; - reserved 4; -} -message FileDescriptorProto { - optional string name = 1; - optional string package = 2; - repeated string dependency = 3; - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - optional FileOptions options = 8; - optional SourceCodeInfo source_code_info = 9; - repeated int32 public_dependency = 10; - repeated int32 weak_dependency = 11; - optional string syntax = 12; - optional string edition = 13; -} -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} -message FileOptions { - optional string java_package = 1; - optional string java_outer_classname = 8; - optional OptimizeMode optimize_for = 9 [default = SPEED]; - optional bool java_multiple_files = 10 [default = false]; - optional string go_package = 11; - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - optional bool deprecated = 23 [default = false]; - optional bool java_string_check_utf8 = 27 [default = false]; - optional bool cc_enable_arenas = 31 [default = true]; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - optional string swift_prefix = 39; - optional string php_class_prefix = 40; - optional string php_namespace = 41; - optional bool php_generic_services = 42 [default = false]; - optional string php_metadata_namespace = 44; - optional string ruby_package = 45; - repeated UninterpretedOption uninterpreted_option = 999; - enum OptimizeMode { - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - extensions 1000 to max; - reserved 38; -} -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message MethodDescriptorProto { - optional string name = 1; - optional string input_type = 2; - optional string output_type = 3; - optional MethodOptions options = 4; - optional bool client_streaming = 5 [default = false]; - optional bool server_streaming = 6 [default = false]; -} -message MethodOptions { - optional bool deprecated = 33 [default = false]; - optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; - repeated UninterpretedOption uninterpreted_option = 999; - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; - IDEMPOTENT = 2; - } - extensions 1000 to max; -} -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; -} -message OneofOptions { - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - optional ServiceOptions options = 3; -} -message ServiceOptions { - optional bool deprecated = 33 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message SourceCodeInfo { - repeated Location location = 1; - message Location { - repeated int32 path = 1 [packed = true]; - repeated int32 span = 2 [packed = true]; - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -message Files { - google.protobuf.FileDescriptorSet files = 1; -} -message UnusedOption { - string foo = 1; -} -message UsedOption { - string foo = 1; - extend google.protobuf.FileOptions { - optional UsedOption file_foo = 50000; - optional UnusedOption file_bar = 50001; - optional string file_baz = 50002; - } -} -extend google.protobuf.EnumOptions { - optional UsedOption enum_foo = 50000; - optional UnusedOption enum_bar = 50001; - optional string enum_baz = 50002; -} -extend google.protobuf.EnumValueOptions { - optional UsedOption enum_value_foo = 50000; - optional UnusedOption enum_value_bar = 50001; - optional string enum_value_baz = 50002; -} -extend google.protobuf.FieldOptions { - optional UsedOption field_foo = 50000; - optional UnusedOption field_bar = 50001; - optional string field_baz = 50002; -} -extend google.protobuf.MessageOptions { - optional UsedOption message_foo = 50000; - optional UnusedOption message_bar = 50001; - optional string message_baz = 50002; -} -extend google.protobuf.MethodOptions { - optional UsedOption method_foo = 50000; - optional UnusedOption method_bar = 50001; - optional string method_baz = 50002; -} -extend google.protobuf.OneofOptions { - optional UsedOption oneof_foo = 50000; - optional UnusedOption oneof_bar = 50001; - optional string oneof_baz = 50002; -} -extend google.protobuf.ServiceOptions { - optional UsedOption service_foo = 50000; - optional UnusedOption service_bar = 50001; - optional string service_baz = 50002; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all.txtar deleted file mode 100644 index a8c47bfac..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/all.txtar +++ /dev/null @@ -1,225 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -import "options.proto"; -option (UsedOption.file_baz) = "str"; -option (UsedOption.file_foo) = { foo: "str" }; -message Empty { -} -message Foo { - option (message_baz) = "str"; - option (message_foo) = { foo: "str" }; - optional string foo = 1 [ - jstype = JS_STRING, - (field_baz) = "str", - (field_foo) = { foo: "str" } - ]; - oneof testOneof { - option (oneof_baz) = "str"; - option (oneof_foo) = { foo: "str" }; - string bar = 2; - bytes baz = 3; - } - extensions 10 to max; -} -enum FooEnum { - option deprecated = true; - option (enum_baz) = "str"; - option (enum_foo) = { foo: "str" }; - FOO_ENUM_X = 0; - FOO_ENUM_Y = 1 [ - (enum_value_baz) = "str", - (enum_value_foo) = { foo: "str" } - ]; -} -service FooService { - option (service_baz) = "str"; - option (service_foo) = { foo: "str" }; - rpc Do ( Empty ) returns ( Empty ) { - option (method_baz) = "str"; - option (method_foo) = { foo: "str" }; - } - rpc DoNot ( Empty ) returns ( Empty ) { - option (method_baz) = "str"; - option (method_foo) = { foo: "str" }; - } -} -extend Foo { - optional string extension = 11 [(field_baz) = "str", (field_foo) = { foo: "str" }]; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message EnumOptions { - optional bool allow_alias = 2; - optional bool deprecated = 3 [default = false]; - optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 5; -} -message EnumValueOptions { - optional bool deprecated = 1 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message FieldOptions { - optional CType ctype = 1 [default = STRING]; - optional bool packed = 2; - optional bool deprecated = 3 [default = false]; - optional bool lazy = 5 [default = false]; - optional JSType jstype = 6 [default = JS_NORMAL]; - optional bool weak = 10 [default = false]; - optional bool unverified_lazy = 15 [default = false]; - optional bool debug_redact = 16 [default = false]; - optional OptionRetention retention = 17; - optional OptionTargetType target = 18; - repeated UninterpretedOption uninterpreted_option = 999; - enum CType { - STRING = 0; - CORD = 1; - STRING_PIECE = 2; - } - enum JSType { - JS_NORMAL = 0; - JS_STRING = 1; - JS_NUMBER = 2; - } - enum OptionRetention { - RETENTION_UNKNOWN = 0; - RETENTION_RUNTIME = 1; - RETENTION_SOURCE = 2; - } - enum OptionTargetType { - TARGET_TYPE_UNKNOWN = 0; - TARGET_TYPE_FILE = 1; - TARGET_TYPE_EXTENSION_RANGE = 2; - TARGET_TYPE_MESSAGE = 3; - TARGET_TYPE_FIELD = 4; - TARGET_TYPE_ONEOF = 5; - TARGET_TYPE_ENUM = 6; - TARGET_TYPE_ENUM_ENTRY = 7; - TARGET_TYPE_SERVICE = 8; - TARGET_TYPE_METHOD = 9; - } - extensions 1000 to max; - reserved 4; -} -message FileOptions { - optional string java_package = 1; - optional string java_outer_classname = 8; - optional OptimizeMode optimize_for = 9 [default = SPEED]; - optional bool java_multiple_files = 10 [default = false]; - optional string go_package = 11; - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - optional bool deprecated = 23 [default = false]; - optional bool java_string_check_utf8 = 27 [default = false]; - optional bool cc_enable_arenas = 31 [default = true]; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - optional string swift_prefix = 39; - optional string php_class_prefix = 40; - optional string php_namespace = 41; - optional bool php_generic_services = 42 [default = false]; - optional string php_metadata_namespace = 44; - optional string ruby_package = 45; - repeated UninterpretedOption uninterpreted_option = 999; - enum OptimizeMode { - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - extensions 1000 to max; - reserved 38; -} -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message MethodOptions { - optional bool deprecated = 33 [default = false]; - optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; - repeated UninterpretedOption uninterpreted_option = 999; - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; - IDEMPOTENT = 2; - } - extensions 1000 to max; -} -message OneofOptions { - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message ServiceOptions { - optional bool deprecated = 33 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -message UsedOption { - string foo = 1; - extend google.protobuf.FileOptions { - optional UsedOption file_foo = 50000; - optional string file_baz = 50002; - } -} -extend google.protobuf.EnumOptions { - optional UsedOption enum_foo = 50000; - optional string enum_baz = 50002; -} -extend google.protobuf.EnumValueOptions { - optional UsedOption enum_value_foo = 50000; - optional string enum_value_baz = 50002; -} -extend google.protobuf.FieldOptions { - optional UsedOption field_foo = 50000; - optional string field_baz = 50002; -} -extend google.protobuf.MessageOptions { - optional UsedOption message_foo = 50000; - optional string message_baz = 50002; -} -extend google.protobuf.MethodOptions { - optional UsedOption method_foo = 50000; - optional string method_baz = 50002; -} -extend google.protobuf.OneofOptions { - optional UsedOption oneof_foo = 50000; - optional string oneof_baz = 50002; -} -extend google.protobuf.ServiceOptions { - optional UsedOption service_foo = 50000; - optional string service_baz = 50002; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/options.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/options.proto deleted file mode 100644 index d0cad0f7d..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/options.proto +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; - -message UnusedOption { - string foo = 1; -} - -message UsedOption { - extend google.protobuf.FileOptions { - optional UsedOption file_foo = 50000; - optional UnusedOption file_bar = 50001; - optional string file_baz = 50002; - } - - string foo = 1; -} - -extend google.protobuf.MessageOptions { - optional UsedOption message_foo = 50000; - optional UnusedOption message_bar = 50001; - optional string message_baz = 50002; -} -extend google.protobuf.FieldOptions { - optional UsedOption field_foo = 50000; - optional UnusedOption field_bar = 50001; - optional string field_baz = 50002; -} -extend google.protobuf.OneofOptions { - optional UsedOption oneof_foo = 50000; - optional UnusedOption oneof_bar = 50001; - optional string oneof_baz = 50002; -} -extend google.protobuf.EnumOptions { - optional UsedOption enum_foo = 50000; - optional UnusedOption enum_bar = 50001; - optional string enum_baz = 50002; -} -extend google.protobuf.EnumValueOptions { - optional UsedOption enum_value_foo = 50000; - optional UnusedOption enum_value_bar = 50001; - optional string enum_value_baz = 50002; -} -extend google.protobuf.ServiceOptions { - optional UsedOption service_foo = 50000; - optional UnusedOption service_bar = 50001; - optional string service_baz = 50002; -} -extend google.protobuf.MethodOptions { - optional UsedOption method_foo = 50000; - optional UnusedOption method_bar = 50001; - optional string method_baz = 50002; -} - -message Files { - google.protobuf.FileDescriptorSet files = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.Foo.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.Foo.txtar deleted file mode 100644 index 0859ec338..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.Foo.txtar +++ /dev/null @@ -1,156 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -import "options.proto"; -option (UsedOption.file_baz) = "str"; -option (UsedOption.file_foo) = { foo: "str" }; -message Foo { - option (message_baz) = "str"; - option (message_foo) = { foo: "str" }; - optional string foo = 1 [ - jstype = JS_STRING, - (field_baz) = "str", - (field_foo) = { foo: "str" } - ]; - oneof testOneof { - option (oneof_baz) = "str"; - option (oneof_foo) = { foo: "str" }; - string bar = 2; - bytes baz = 3; - } - extensions 10 to max; -} -extend Foo { - optional string extension = 11 [(field_baz) = "str", (field_foo) = { foo: "str" }]; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message FieldOptions { - optional CType ctype = 1 [default = STRING]; - optional bool packed = 2; - optional bool deprecated = 3 [default = false]; - optional bool lazy = 5 [default = false]; - optional JSType jstype = 6 [default = JS_NORMAL]; - optional bool weak = 10 [default = false]; - optional bool unverified_lazy = 15 [default = false]; - optional bool debug_redact = 16 [default = false]; - optional OptionRetention retention = 17; - optional OptionTargetType target = 18; - repeated UninterpretedOption uninterpreted_option = 999; - enum CType { - STRING = 0; - CORD = 1; - STRING_PIECE = 2; - } - enum JSType { - JS_NORMAL = 0; - JS_STRING = 1; - JS_NUMBER = 2; - } - enum OptionRetention { - RETENTION_UNKNOWN = 0; - RETENTION_RUNTIME = 1; - RETENTION_SOURCE = 2; - } - enum OptionTargetType { - TARGET_TYPE_UNKNOWN = 0; - TARGET_TYPE_FILE = 1; - TARGET_TYPE_EXTENSION_RANGE = 2; - TARGET_TYPE_MESSAGE = 3; - TARGET_TYPE_FIELD = 4; - TARGET_TYPE_ONEOF = 5; - TARGET_TYPE_ENUM = 6; - TARGET_TYPE_ENUM_ENTRY = 7; - TARGET_TYPE_SERVICE = 8; - TARGET_TYPE_METHOD = 9; - } - extensions 1000 to max; - reserved 4; -} -message FileOptions { - optional string java_package = 1; - optional string java_outer_classname = 8; - optional OptimizeMode optimize_for = 9 [default = SPEED]; - optional bool java_multiple_files = 10 [default = false]; - optional string go_package = 11; - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - optional bool deprecated = 23 [default = false]; - optional bool java_string_check_utf8 = 27 [default = false]; - optional bool cc_enable_arenas = 31 [default = true]; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - optional string swift_prefix = 39; - optional string php_class_prefix = 40; - optional string php_namespace = 41; - optional bool php_generic_services = 42 [default = false]; - optional string php_metadata_namespace = 44; - optional string ruby_package = 45; - repeated UninterpretedOption uninterpreted_option = 999; - enum OptimizeMode { - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - extensions 1000 to max; - reserved 38; -} -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message OneofOptions { - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -message UsedOption { - string foo = 1; - extend google.protobuf.FileOptions { - optional UsedOption file_foo = 50000; - optional string file_baz = 50002; - } -} -extend google.protobuf.FieldOptions { - optional UsedOption field_foo = 50000; - optional string field_baz = 50002; -} -extend google.protobuf.MessageOptions { - optional UsedOption message_foo = 50000; - optional string message_baz = 50002; -} -extend google.protobuf.OneofOptions { - optional UsedOption oneof_foo = 50000; - optional string oneof_baz = 50002; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooEnum.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooEnum.txtar deleted file mode 100644 index 67c79649d..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooEnum.txtar +++ /dev/null @@ -1,100 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -import "options.proto"; -option (UsedOption.file_baz) = "str"; -option (UsedOption.file_foo) = { foo: "str" }; -enum FooEnum { - option deprecated = true; - option (enum_baz) = "str"; - option (enum_foo) = { foo: "str" }; - FOO_ENUM_X = 0; - FOO_ENUM_Y = 1 [ - (enum_value_baz) = "str", - (enum_value_foo) = { foo: "str" } - ]; -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message EnumOptions { - optional bool allow_alias = 2; - optional bool deprecated = 3 [default = false]; - optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 5; -} -message EnumValueOptions { - optional bool deprecated = 1 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message FileOptions { - optional string java_package = 1; - optional string java_outer_classname = 8; - optional OptimizeMode optimize_for = 9 [default = SPEED]; - optional bool java_multiple_files = 10 [default = false]; - optional string go_package = 11; - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - optional bool deprecated = 23 [default = false]; - optional bool java_string_check_utf8 = 27 [default = false]; - optional bool cc_enable_arenas = 31 [default = true]; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - optional string swift_prefix = 39; - optional string php_class_prefix = 40; - optional string php_namespace = 41; - optional bool php_generic_services = 42 [default = false]; - optional string php_metadata_namespace = 44; - optional string ruby_package = 45; - repeated UninterpretedOption uninterpreted_option = 999; - enum OptimizeMode { - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - extensions 1000 to max; - reserved 38; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -message UsedOption { - string foo = 1; - extend google.protobuf.FileOptions { - optional UsedOption file_foo = 50000; - optional string file_baz = 50002; - } -} -extend google.protobuf.EnumOptions { - optional UsedOption enum_foo = 50000; - optional string enum_baz = 50002; -} -extend google.protobuf.EnumValueOptions { - optional UsedOption enum_value_foo = 50000; - optional string enum_value_baz = 50002; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.Do.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.Do.txtar deleted file mode 100644 index 3afb6143d..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.Do.txtar +++ /dev/null @@ -1,103 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -import "options.proto"; -option (UsedOption.file_baz) = "str"; -option (UsedOption.file_foo) = { foo: "str" }; -message Empty { -} -service FooService { - option (service_baz) = "str"; - option (service_foo) = { foo: "str" }; - rpc Do ( Empty ) returns ( Empty ) { - option (method_baz) = "str"; - option (method_foo) = { foo: "str" }; - } -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message FileOptions { - optional string java_package = 1; - optional string java_outer_classname = 8; - optional OptimizeMode optimize_for = 9 [default = SPEED]; - optional bool java_multiple_files = 10 [default = false]; - optional string go_package = 11; - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - optional bool deprecated = 23 [default = false]; - optional bool java_string_check_utf8 = 27 [default = false]; - optional bool cc_enable_arenas = 31 [default = true]; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - optional string swift_prefix = 39; - optional string php_class_prefix = 40; - optional string php_namespace = 41; - optional bool php_generic_services = 42 [default = false]; - optional string php_metadata_namespace = 44; - optional string ruby_package = 45; - repeated UninterpretedOption uninterpreted_option = 999; - enum OptimizeMode { - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - extensions 1000 to max; - reserved 38; -} -message MethodOptions { - optional bool deprecated = 33 [default = false]; - optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; - repeated UninterpretedOption uninterpreted_option = 999; - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; - IDEMPOTENT = 2; - } - extensions 1000 to max; -} -message ServiceOptions { - optional bool deprecated = 33 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -message UsedOption { - string foo = 1; - extend google.protobuf.FileOptions { - optional UsedOption file_foo = 50000; - optional string file_baz = 50002; - } -} -extend google.protobuf.MethodOptions { - optional UsedOption method_foo = 50000; - optional string method_baz = 50002; -} -extend google.protobuf.ServiceOptions { - optional UsedOption service_foo = 50000; - optional string service_baz = 50002; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.txtar deleted file mode 100644 index 7175dc688..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/options/pkg.FooService.txtar +++ /dev/null @@ -1,107 +0,0 @@ --- a.proto -- -syntax = "proto2"; -package pkg; -import "options.proto"; -option (UsedOption.file_baz) = "str"; -option (UsedOption.file_foo) = { foo: "str" }; -message Empty { -} -service FooService { - option (service_baz) = "str"; - option (service_foo) = { foo: "str" }; - rpc Do ( Empty ) returns ( Empty ) { - option (method_baz) = "str"; - option (method_foo) = { foo: "str" }; - } - rpc DoNot ( Empty ) returns ( Empty ) { - option (method_baz) = "str"; - option (method_foo) = { foo: "str" }; - } -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message FileOptions { - optional string java_package = 1; - optional string java_outer_classname = 8; - optional OptimizeMode optimize_for = 9 [default = SPEED]; - optional bool java_multiple_files = 10 [default = false]; - optional string go_package = 11; - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - optional bool deprecated = 23 [default = false]; - optional bool java_string_check_utf8 = 27 [default = false]; - optional bool cc_enable_arenas = 31 [default = true]; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - optional string swift_prefix = 39; - optional string php_class_prefix = 40; - optional string php_namespace = 41; - optional bool php_generic_services = 42 [default = false]; - optional string php_metadata_namespace = 44; - optional string ruby_package = 45; - repeated UninterpretedOption uninterpreted_option = 999; - enum OptimizeMode { - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - extensions 1000 to max; - reserved 38; -} -message MethodOptions { - optional bool deprecated = 33 [default = false]; - optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; - repeated UninterpretedOption uninterpreted_option = 999; - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; - IDEMPOTENT = 2; - } - extensions 1000 to max; -} -message ServiceOptions { - optional bool deprecated = 33 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -message UsedOption { - string foo = 1; - extend google.protobuf.FileOptions { - optional UsedOption file_foo = 50000; - optional string file_baz = 50002; - } -} -extend google.protobuf.MethodOptions { - optional UsedOption method_foo = 50000; - optional string method_baz = 50002; -} -extend google.protobuf.ServiceOptions { - optional UsedOption service_foo = 50000; - optional string service_baz = 50002; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/bar.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/bar.proto deleted file mode 100644 index 7b98073a1..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/bar.proto +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar; - -message MessageInBar { -} - -enum EnumInBar { - UNSET = 0; -} - -service ServiceInBar { - rpc Bar(MessageInBar) returns (MessageInBar); -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz1.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz1.proto deleted file mode 100644 index 2ebffa6b6..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz1.proto +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.baz; - -message Foo { - enum Enum { - VALUE0 = 0; VALUE1 = 1; VALUE2 = 2; - } - Enum en = 1; - string name = 2; - oneof loc { - string address = 3; - uint32 zip_code = 4; - uint64 other_xref = 5; - } -} - -message Bar { - map attributes = 1; -} - -service BazService { - rpc GetBaz(Foo) returns (Bar); -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz2.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz2.proto deleted file mode 100644 index 904632174..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/baz2.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo.bar.baz; - -import "nopackage.proto"; - -message Empty {} - -enum AlmostEmpty { - UNSET = 0; -} - -service NoOp { - option (svc_option_str) = "blah"; - rpc Nothing(Empty) returns (Empty); -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.baz.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.baz.txtar deleted file mode 100644 index c01b3acb0..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.baz.txtar +++ /dev/null @@ -1,70 +0,0 @@ --- baz1.proto -- -syntax = "proto3"; -package foo.bar.baz; -message Bar { - map attributes = 1; -} -message Foo { - Enum en = 1; - string name = 2; - oneof loc { - string address = 3; - uint32 zip_code = 4; - uint64 other_xref = 5; - } - enum Enum { - VALUE0 = 0; - VALUE1 = 1; - VALUE2 = 2; - } -} -service BazService { - rpc GetBaz ( Foo ) returns ( Bar ); -} --- baz2.proto -- -syntax = "proto3"; -package foo.bar.baz; -import "options.proto"; -message Empty { -} -enum AlmostEmpty { - UNSET = 0; -} -service NoOp { - option (svc_option_str) = "blah"; - rpc Nothing ( Empty ) returns ( Empty ); -} --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message ServiceOptions { - optional bool deprecated = 33 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -extend google.protobuf.ServiceOptions { - string svc_option_str = 30000; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.txtar deleted file mode 100644 index f9e01d5fe..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.bar.txtar +++ /dev/null @@ -1,11 +0,0 @@ --- bar.proto -- -syntax = "proto3"; -package foo.bar; -message MessageInBar { -} -enum EnumInBar { - UNSET = 0; -} -service ServiceInBar { - rpc Bar ( MessageInBar ) returns ( MessageInBar ); -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.proto deleted file mode 100644 index b05811222..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; - -message MessageInFoo {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.txtar deleted file mode 100644 index 600d08f5a..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/foo.txtar +++ /dev/null @@ -1,5 +0,0 @@ --- foo.proto -- -syntax = "proto3"; -package foo; -message MessageInFoo { -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/nopackage.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/nopackage.proto deleted file mode 100644 index 36d3208b0..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/nopackage.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "google/protobuf/descriptor.proto"; -import public "options.proto"; - -option (file_option_str) = "foo"; - -message Foo { - option (msg_option_str) = "foo"; - oneof x { - string bar = 1; - string baz = 2; - } -} - -extend google.protobuf.ExtensionRangeOptions { - int64 rand = 30000; -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/options.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/options.proto deleted file mode 100644 index 86a94fd4b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/options.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.FileOptions { - string file_option_str = 30000; -} - -extend google.protobuf.MessageOptions { - string msg_option_str = 30000; -} - -extend google.protobuf.ServiceOptions { - string svc_option_str = 30000; -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/other.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/other.proto deleted file mode 100644 index 1deb4ca21..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/other.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package other; \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/root.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/root.txtar deleted file mode 100644 index 29791ff9e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/packages/root.txtar +++ /dev/null @@ -1,99 +0,0 @@ --- google/protobuf/descriptor.proto -- -syntax = "proto2"; -package google.protobuf; -option cc_enable_arenas = true; -option csharp_namespace = "Google.Protobuf.Reflection"; -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_outer_classname = "DescriptorProtos"; -option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; -option optimize_for = SPEED; -message ExtensionRangeOptions { - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message FileOptions { - optional string java_package = 1; - optional string java_outer_classname = 8; - optional OptimizeMode optimize_for = 9 [default = SPEED]; - optional bool java_multiple_files = 10 [default = false]; - optional string go_package = 11; - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - optional bool deprecated = 23 [default = false]; - optional bool java_string_check_utf8 = 27 [default = false]; - optional bool cc_enable_arenas = 31 [default = true]; - optional string objc_class_prefix = 36; - optional string csharp_namespace = 37; - optional string swift_prefix = 39; - optional string php_class_prefix = 40; - optional string php_namespace = 41; - optional bool php_generic_services = 42 [default = false]; - optional string php_metadata_namespace = 44; - optional string ruby_package = 45; - repeated UninterpretedOption uninterpreted_option = 999; - enum OptimizeMode { - SPEED = 1; - CODE_SIZE = 2; - LITE_RUNTIME = 3; - } - extensions 1000 to max; - reserved 38; -} -message MessageOptions { - optional bool message_set_wire_format = 1 [default = false]; - optional bool no_standard_descriptor_accessor = 2 [default = false]; - optional bool deprecated = 3 [default = false]; - optional bool map_entry = 7; - optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; - reserved 4, 5, 6, 8, 9; -} -message ServiceOptions { - optional bool deprecated = 33 [default = false]; - repeated UninterpretedOption uninterpreted_option = 999; - extensions 1000 to max; -} -message UninterpretedOption { - repeated NamePart name = 2; - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } -} --- nopackage.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -import "options.proto"; -option (file_option_str) = "foo"; -message Foo { - option (msg_option_str) = "foo"; - oneof x { - string bar = 1; - string baz = 2; - } -} -extend google.protobuf.ExtensionRangeOptions { - int64 rand = 30000; -} --- options.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -extend google.protobuf.FileOptions { - string file_option_str = 30000; -} -extend google.protobuf.MessageOptions { - string msg_option_str = 30000; -} -extend google.protobuf.ServiceOptions { - string svc_option_str = 30000; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Bar.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Bar.txtar deleted file mode 100644 index 4a5ec4e85..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Bar.txtar +++ /dev/null @@ -1,798 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 4, - 0 - ], - "span": [ - 40, - 0, - 89, - 1 - ], - "leadingComments": " Keep if Foo: comment on message Foo\n", - "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", - "leadingDetachedComments": [ - " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" - ] - }, - { - "path": [ - 4, - 0, - 1 - ], - "span": [ - 40, - 8, - 11 - ] - }, - { - "path": [ - 4, - 0, - 7 - ], - "span": [ - 46, - 2, - 26 - ] - }, - { - "path": [ - 4, - 0, - 7, - 10101 - ], - "span": [ - 46, - 2, - 26 - ], - "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 0, - 2, - 0 - ], - "span": [ - 49, - 2, - 27 - ], - "leadingComments": " Keep if Foo: comment on field name\n" - }, - { - "path": [ - 4, - 0, - 2, - 0, - 4 - ], - "span": [ - 49, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 5 - ], - "span": [ - 49, - 11, - 17 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 1 - ], - "span": [ - 49, - 18, - 22 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 3 - ], - "span": [ - 49, - 25, - 26 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1 - ], - "span": [ - 51, - 2, - 26 - ], - "leadingComments": " Keep if Foo: comment on field bits\n" - }, - { - "path": [ - 4, - 0, - 2, - 1, - 4 - ], - "span": [ - 51, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 5 - ], - "span": [ - 51, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 1 - ], - "span": [ - 51, - 17, - 21 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 3 - ], - "span": [ - 51, - 24, - 25 - ] - }, - { - "path": [ - 4, - 0, - 9 - ], - "span": [ - 54, - 2, - 20 - ], - "leadingComments": " Keep if Foo: comment on reserved range\n" - }, - { - "path": [ - 4, - 0, - 9, - 0 - ], - "span": [ - 54, - 11, - 19 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 1 - ], - "span": [ - 54, - 11, - 13 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 2 - ], - "span": [ - 54, - 17, - 19 - ] - }, - { - "path": [ - 4, - 0, - 10 - ], - "span": [ - 56, - 2, - 31 - ], - "leadingComments": " Keep if Foo: comment on reserved names\n" - }, - { - "path": [ - 4, - 0, - 10, - 0 - ], - "span": [ - 56, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 10, - 1 - ], - "span": [ - 56, - 18, - 23 - ] - }, - { - "path": [ - 4, - 0, - 10, - 2 - ], - "span": [ - 56, - 25, - 30 - ] - }, - { - "path": [ - 4, - 0, - 5 - ], - "span": [ - 58, - 2, - 24 - ], - "leadingComments": " Keep if Foo: comment on extension range\n" - }, - { - "path": [ - 4, - 0, - 5, - 0 - ], - "span": [ - 58, - 13, - 23 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 1 - ], - "span": [ - 58, - 13, - 16 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 2 - ], - "span": [ - 58, - 20, - 23 - ] - }, - { - "path": [ - 4, - 1 - ], - "span": [ - 95, - 0, - 105, - 1 - ], - "leadingComments": " Keep if Bar: comment on message Bar\n", - "leadingDetachedComments": [ - " \"Keep if Bar\" are also kept for Svc and Svc.Do since those\n elements depend on Bar.\n" - ] - }, - { - "path": [ - 4, - 1, - 1 - ], - "span": [ - 95, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0 - ], - "span": [ - 97, - 2, - 23 - ], - "leadingComments": " Keep if Bar: comment on field foo\n" - }, - { - "path": [ - 4, - 1, - 2, - 0, - 4 - ], - "span": [ - 97, - 2, - 10 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 6 - ], - "span": [ - 97, - 11, - 14 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 1 - ], - "span": [ - 97, - 15, - 18 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 3 - ], - "span": [ - 97, - 21, - 22 - ] - }, - { - "path": [ - 4, - 1, - 8, - 0 - ], - "span": [ - 99, - 2, - 104, - 3 - ], - "leadingComments": " Keep if Bar: comment on oneof status\n" - }, - { - "path": [ - 4, - 1, - 8, - 0, - 1 - ], - "span": [ - 99, - 8, - 14 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1 - ], - "span": [ - 101, - 4, - 16 - ], - "leadingComments": " Keep if Bar: comment on field baz\n" - }, - { - "path": [ - 4, - 1, - 2, - 1, - 6 - ], - "span": [ - 101, - 4, - 7 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 1 - ], - "span": [ - 101, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 3 - ], - "span": [ - 101, - 14, - 15 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2 - ], - "span": [ - 103, - 4, - 16 - ], - "leadingComments": " Keep if Bar: comment on field quz\n" - }, - { - "path": [ - 4, - 1, - 2, - 2, - 6 - ], - "span": [ - 103, - 4, - 7 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2, - 1 - ], - "span": [ - 103, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2, - 3 - ], - "span": [ - 103, - 14, - 15 - ] - }, - { - "path": [ - 5, - 0 - ], - "span": [ - 111, - 0, - 114, - 1 - ], - "leadingComments": " Keep if Baz: comment on enum Baz\n", - "leadingDetachedComments": [ - " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" - ] - }, - { - "path": [ - 5, - 0, - 1 - ], - "span": [ - 111, - 5, - 8 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0 - ], - "span": [ - 113, - 2, - 22 - ], - "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 0, - 2, - 0, - 1 - ], - "span": [ - 113, - 2, - 17 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0, - 2 - ], - "span": [ - 113, - 20, - 21 - ] - }, - { - "path": [ - 5, - 1 - ], - "span": [ - 117, - 0, - 120, - 1 - ], - "leadingComments": " Keep if Quz: comment on enum Quz\n" - }, - { - "path": [ - 5, - 1, - 1 - ], - "span": [ - 117, - 5, - 8 - ] - }, - { - "path": [ - 5, - 1, - 2, - 0 - ], - "span": [ - 119, - 2, - 22 - ], - "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 1, - 2, - 0, - 1 - ], - "span": [ - 119, - 2, - 17 - ] - }, - { - "path": [ - 5, - 1, - 2, - 0, - 2 - ], - "span": [ - 119, - 20, - 21 - ] - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Baz.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Baz.txtar deleted file mode 100644 index 44c12138c..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Baz.txtar +++ /dev/null @@ -1,137 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 5, - 0 - ], - "span": [ - 111, - 0, - 114, - 1 - ], - "leadingComments": " Keep if Baz: comment on enum Baz\n", - "leadingDetachedComments": [ - " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" - ] - }, - { - "path": [ - 5, - 0, - 1 - ], - "span": [ - 111, - 5, - 8 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0 - ], - "span": [ - 113, - 2, - 22 - ], - "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 0, - 2, - 0, - 1 - ], - "span": [ - 113, - 2, - 17 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0, - 2 - ], - "span": [ - 113, - 20, - 21 - ] - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Do.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Do.txtar deleted file mode 100644 index 6dc8c818b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Do.txtar +++ /dev/null @@ -1,936 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 4, - 0 - ], - "span": [ - 40, - 0, - 89, - 1 - ], - "leadingComments": " Keep if Foo: comment on message Foo\n", - "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", - "leadingDetachedComments": [ - " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" - ] - }, - { - "path": [ - 4, - 0, - 1 - ], - "span": [ - 40, - 8, - 11 - ] - }, - { - "path": [ - 4, - 0, - 7 - ], - "span": [ - 46, - 2, - 26 - ] - }, - { - "path": [ - 4, - 0, - 7, - 10101 - ], - "span": [ - 46, - 2, - 26 - ], - "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 0, - 2, - 0 - ], - "span": [ - 49, - 2, - 27 - ], - "leadingComments": " Keep if Foo: comment on field name\n" - }, - { - "path": [ - 4, - 0, - 2, - 0, - 4 - ], - "span": [ - 49, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 5 - ], - "span": [ - 49, - 11, - 17 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 1 - ], - "span": [ - 49, - 18, - 22 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 3 - ], - "span": [ - 49, - 25, - 26 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1 - ], - "span": [ - 51, - 2, - 26 - ], - "leadingComments": " Keep if Foo: comment on field bits\n" - }, - { - "path": [ - 4, - 0, - 2, - 1, - 4 - ], - "span": [ - 51, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 5 - ], - "span": [ - 51, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 1 - ], - "span": [ - 51, - 17, - 21 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 3 - ], - "span": [ - 51, - 24, - 25 - ] - }, - { - "path": [ - 4, - 0, - 9 - ], - "span": [ - 54, - 2, - 20 - ], - "leadingComments": " Keep if Foo: comment on reserved range\n" - }, - { - "path": [ - 4, - 0, - 9, - 0 - ], - "span": [ - 54, - 11, - 19 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 1 - ], - "span": [ - 54, - 11, - 13 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 2 - ], - "span": [ - 54, - 17, - 19 - ] - }, - { - "path": [ - 4, - 0, - 10 - ], - "span": [ - 56, - 2, - 31 - ], - "leadingComments": " Keep if Foo: comment on reserved names\n" - }, - { - "path": [ - 4, - 0, - 10, - 0 - ], - "span": [ - 56, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 10, - 1 - ], - "span": [ - 56, - 18, - 23 - ] - }, - { - "path": [ - 4, - 0, - 10, - 2 - ], - "span": [ - 56, - 25, - 30 - ] - }, - { - "path": [ - 4, - 0, - 5 - ], - "span": [ - 58, - 2, - 24 - ], - "leadingComments": " Keep if Foo: comment on extension range\n" - }, - { - "path": [ - 4, - 0, - 5, - 0 - ], - "span": [ - 58, - 13, - 23 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 1 - ], - "span": [ - 58, - 13, - 16 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 2 - ], - "span": [ - 58, - 20, - 23 - ] - }, - { - "path": [ - 4, - 1 - ], - "span": [ - 95, - 0, - 105, - 1 - ], - "leadingComments": " Keep if Bar: comment on message Bar\n", - "leadingDetachedComments": [ - " \"Keep if Bar\" are also kept for Svc and Svc.Do since those\n elements depend on Bar.\n" - ] - }, - { - "path": [ - 4, - 1, - 1 - ], - "span": [ - 95, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0 - ], - "span": [ - 97, - 2, - 23 - ], - "leadingComments": " Keep if Bar: comment on field foo\n" - }, - { - "path": [ - 4, - 1, - 2, - 0, - 4 - ], - "span": [ - 97, - 2, - 10 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 6 - ], - "span": [ - 97, - 11, - 14 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 1 - ], - "span": [ - 97, - 15, - 18 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 3 - ], - "span": [ - 97, - 21, - 22 - ] - }, - { - "path": [ - 4, - 1, - 8, - 0 - ], - "span": [ - 99, - 2, - 104, - 3 - ], - "leadingComments": " Keep if Bar: comment on oneof status\n" - }, - { - "path": [ - 4, - 1, - 8, - 0, - 1 - ], - "span": [ - 99, - 8, - 14 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1 - ], - "span": [ - 101, - 4, - 16 - ], - "leadingComments": " Keep if Bar: comment on field baz\n" - }, - { - "path": [ - 4, - 1, - 2, - 1, - 6 - ], - "span": [ - 101, - 4, - 7 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 1 - ], - "span": [ - 101, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 3 - ], - "span": [ - 101, - 14, - 15 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2 - ], - "span": [ - 103, - 4, - 16 - ], - "leadingComments": " Keep if Bar: comment on field quz\n" - }, - { - "path": [ - 4, - 1, - 2, - 2, - 6 - ], - "span": [ - 103, - 4, - 7 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2, - 1 - ], - "span": [ - 103, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2, - 3 - ], - "span": [ - 103, - 14, - 15 - ] - }, - { - "path": [ - 5, - 0 - ], - "span": [ - 111, - 0, - 114, - 1 - ], - "leadingComments": " Keep if Baz: comment on enum Baz\n", - "leadingDetachedComments": [ - " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" - ] - }, - { - "path": [ - 5, - 0, - 1 - ], - "span": [ - 111, - 5, - 8 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0 - ], - "span": [ - 113, - 2, - 22 - ], - "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 0, - 2, - 0, - 1 - ], - "span": [ - 113, - 2, - 17 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0, - 2 - ], - "span": [ - 113, - 20, - 21 - ] - }, - { - "path": [ - 5, - 1 - ], - "span": [ - 117, - 0, - 120, - 1 - ], - "leadingComments": " Keep if Quz: comment on enum Quz\n" - }, - { - "path": [ - 5, - 1, - 1 - ], - "span": [ - 117, - 5, - 8 - ] - }, - { - "path": [ - 5, - 1, - 2, - 0 - ], - "span": [ - 119, - 2, - 22 - ], - "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 1, - 2, - 0, - 1 - ], - "span": [ - 119, - 2, - 17 - ] - }, - { - "path": [ - 5, - 1, - 2, - 0, - 2 - ], - "span": [ - 119, - 20, - 21 - ] - }, - { - "path": [ - 6, - 0 - ], - "span": [ - 141, - 0, - 153, - 1 - ], - "leadingComments": " Keep if Svc: comment on service Svc\n" - }, - { - "path": [ - 6, - 0, - 1 - ], - "span": [ - 141, - 8, - 11 - ] - }, - { - "path": [ - 6, - 0, - 3 - ], - "span": [ - 143, - 2, - 29 - ] - }, - { - "path": [ - 6, - 0, - 3, - 10101 - ], - "span": [ - 143, - 2, - 29 - ], - "leadingComments": " Keep if Svc: comment on option\n" - }, - { - "path": [ - 6, - 0, - 2, - 0 - ], - "span": [ - 146, - 2, - 149, - 3 - ], - "leadingComments": " Keep if Svc.Do: comment on rpc Do\n" - }, - { - "path": [ - 6, - 0, - 2, - 0, - 1 - ], - "span": [ - 146, - 6, - 8 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 2 - ], - "span": [ - 146, - 9, - 12 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 3 - ], - "span": [ - 146, - 23, - 26 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 4 - ], - "span": [ - 148, - 4, - 47 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 4, - 34 - ], - "span": [ - 148, - 4, - 47 - ], - "leadingComments": " Keep if Svc.Do: comment on option\n" - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo+Ext.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo+Ext.txtar deleted file mode 100644 index bb2fb5dee..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo+Ext.txtar +++ /dev/null @@ -1,700 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 3, - 0 - ], - "span": [ - 10, - 0, - 42 - ], - "leadingComments": " Keep if ext: comment on import descriptor.proto\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 7 - ], - "span": [ - 19, - 0, - 22, - 1 - ], - "leadingComments": " Keep if ext: comment on extend block\n" - }, - { - "path": [ - 7, - 0 - ], - "span": [ - 21, - 2, - 33 - ], - "leadingComments": " Keep if ext: comment on custom option bizniz\n" - }, - { - "path": [ - 7, - 0, - 2 - ], - "span": [ - 19, - 7, - 37 - ] - }, - { - "path": [ - 7, - 0, - 4 - ], - "span": [ - 21, - 2, - 10 - ] - }, - { - "path": [ - 7, - 0, - 5 - ], - "span": [ - 21, - 11, - 17 - ] - }, - { - "path": [ - 7, - 0, - 1 - ], - "span": [ - 21, - 18, - 24 - ] - }, - { - "path": [ - 7, - 0, - 3 - ], - "span": [ - 21, - 27, - 32 - ] - }, - { - "path": [ - 7 - ], - "span": [ - 25, - 0, - 28, - 1 - ], - "leadingComments": " Keep if ext: comment on extend block\n" - }, - { - "path": [ - 4, - 0 - ], - "span": [ - 40, - 0, - 89, - 1 - ], - "leadingComments": " Keep if Foo: comment on message Foo\n", - "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", - "leadingDetachedComments": [ - " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" - ] - }, - { - "path": [ - 4, - 0, - 1 - ], - "span": [ - 40, - 8, - 11 - ] - }, - { - "path": [ - 4, - 0, - 7 - ], - "span": [ - 46, - 2, - 26 - ] - }, - { - "path": [ - 4, - 0, - 7, - 10101 - ], - "span": [ - 46, - 2, - 26 - ], - "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 0, - 2, - 0 - ], - "span": [ - 49, - 2, - 27 - ], - "leadingComments": " Keep if Foo: comment on field name\n" - }, - { - "path": [ - 4, - 0, - 2, - 0, - 4 - ], - "span": [ - 49, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 5 - ], - "span": [ - 49, - 11, - 17 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 1 - ], - "span": [ - 49, - 18, - 22 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 3 - ], - "span": [ - 49, - 25, - 26 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1 - ], - "span": [ - 51, - 2, - 26 - ], - "leadingComments": " Keep if Foo: comment on field bits\n" - }, - { - "path": [ - 4, - 0, - 2, - 1, - 4 - ], - "span": [ - 51, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 5 - ], - "span": [ - 51, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 1 - ], - "span": [ - 51, - 17, - 21 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 3 - ], - "span": [ - 51, - 24, - 25 - ] - }, - { - "path": [ - 4, - 0, - 9 - ], - "span": [ - 54, - 2, - 20 - ], - "leadingComments": " Keep if Foo: comment on reserved range\n" - }, - { - "path": [ - 4, - 0, - 9, - 0 - ], - "span": [ - 54, - 11, - 19 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 1 - ], - "span": [ - 54, - 11, - 13 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 2 - ], - "span": [ - 54, - 17, - 19 - ] - }, - { - "path": [ - 4, - 0, - 10 - ], - "span": [ - 56, - 2, - 31 - ], - "leadingComments": " Keep if Foo: comment on reserved names\n" - }, - { - "path": [ - 4, - 0, - 10, - 0 - ], - "span": [ - 56, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 10, - 1 - ], - "span": [ - 56, - 18, - 23 - ] - }, - { - "path": [ - 4, - 0, - 10, - 2 - ], - "span": [ - 56, - 25, - 30 - ] - }, - { - "path": [ - 4, - 0, - 5 - ], - "span": [ - 58, - 2, - 24 - ], - "leadingComments": " Keep if Foo: comment on extension range\n" - }, - { - "path": [ - 4, - 0, - 5, - 0 - ], - "span": [ - 58, - 13, - 23 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 1 - ], - "span": [ - 58, - 13, - 16 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 2 - ], - "span": [ - 58, - 20, - 23 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0 - ], - "span": [ - 61, - 2, - 88, - 3 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 1 - ], - "span": [ - 61, - 10, - 19 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 7 - ], - "span": [ - 67, - 4, - 28 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 7, - 10101 - ], - "span": [ - 67, - 4, - 28 - ], - "leadingComments": " Keep if Foo + ext | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 6 - ], - "span": [ - 84, - 4, - 87, - 5 - ], - "leadingComments": " Keep if Foo + ext: comment on extend block\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 6, - 0 - ], - "span": [ - 86, - 6, - 32 - ], - "leadingComments": " Keep if Foo + ext: comment on extension blah\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 6, - 0, - 2 - ], - "span": [ - 84, - 11, - 14 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 6, - 0, - 4 - ], - "span": [ - 86, - 6, - 14 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 6, - 0, - 5 - ], - "span": [ - 86, - 15, - 20 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 6, - 0, - 1 - ], - "span": [ - 86, - 21, - 25 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 6, - 0, - 3 - ], - "span": [ - 86, - 28, - 31 - ] - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo.txtar deleted file mode 100644 index aa63fa39a..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Foo.txtar +++ /dev/null @@ -1,422 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 4, - 0 - ], - "span": [ - 40, - 0, - 89, - 1 - ], - "leadingComments": " Keep if Foo: comment on message Foo\n", - "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", - "leadingDetachedComments": [ - " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" - ] - }, - { - "path": [ - 4, - 0, - 1 - ], - "span": [ - 40, - 8, - 11 - ] - }, - { - "path": [ - 4, - 0, - 7 - ], - "span": [ - 46, - 2, - 26 - ] - }, - { - "path": [ - 4, - 0, - 7, - 10101 - ], - "span": [ - 46, - 2, - 26 - ], - "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 0, - 2, - 0 - ], - "span": [ - 49, - 2, - 27 - ], - "leadingComments": " Keep if Foo: comment on field name\n" - }, - { - "path": [ - 4, - 0, - 2, - 0, - 4 - ], - "span": [ - 49, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 5 - ], - "span": [ - 49, - 11, - 17 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 1 - ], - "span": [ - 49, - 18, - 22 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 3 - ], - "span": [ - 49, - 25, - 26 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1 - ], - "span": [ - 51, - 2, - 26 - ], - "leadingComments": " Keep if Foo: comment on field bits\n" - }, - { - "path": [ - 4, - 0, - 2, - 1, - 4 - ], - "span": [ - 51, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 5 - ], - "span": [ - 51, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 1 - ], - "span": [ - 51, - 17, - 21 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 3 - ], - "span": [ - 51, - 24, - 25 - ] - }, - { - "path": [ - 4, - 0, - 9 - ], - "span": [ - 54, - 2, - 20 - ], - "leadingComments": " Keep if Foo: comment on reserved range\n" - }, - { - "path": [ - 4, - 0, - 9, - 0 - ], - "span": [ - 54, - 11, - 19 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 1 - ], - "span": [ - 54, - 11, - 13 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 2 - ], - "span": [ - 54, - 17, - 19 - ] - }, - { - "path": [ - 4, - 0, - 10 - ], - "span": [ - 56, - 2, - 31 - ], - "leadingComments": " Keep if Foo: comment on reserved names\n" - }, - { - "path": [ - 4, - 0, - 10, - 0 - ], - "span": [ - 56, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 10, - 1 - ], - "span": [ - 56, - 18, - 23 - ] - }, - { - "path": [ - 4, - 0, - 10, - 2 - ], - "span": [ - 56, - 25, - 30 - ] - }, - { - "path": [ - 4, - 0, - 5 - ], - "span": [ - 58, - 2, - 24 - ], - "leadingComments": " Keep if Foo: comment on extension range\n" - }, - { - "path": [ - 4, - 0, - 5, - 0 - ], - "span": [ - 58, - 13, - 23 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 1 - ], - "span": [ - 58, - 13, - 16 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 2 - ], - "span": [ - 58, - 20, - 23 - ] - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/NestedFoo.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/NestedFoo.txtar deleted file mode 100644 index 749b5a818..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/NestedFoo.txtar +++ /dev/null @@ -1,570 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 3, - 0 - ], - "span": [ - 16, - 0, - 40 - ], - "leadingComments": " Keep if NestedFoo: comment on import any.proto\n" - }, - { - "path": [ - 4, - 0 - ], - "span": [ - 40, - 0, - 89, - 1 - ] - }, - { - "path": [ - 4, - 0, - 1 - ], - "span": [ - 40, - 8, - 11 - ] - }, - { - "path": [ - 4, - 0, - 7 - ], - "span": [ - 46, - 2, - 26 - ] - }, - { - "path": [ - 4, - 0, - 7, - 10101 - ], - "span": [ - 46, - 2, - 26 - ], - "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 0, - 3, - 0 - ], - "span": [ - 61, - 2, - 88, - 3 - ], - "leadingComments": " Keep if NestedFoo: comment on message NestedFoo\n", - "trailingComments": " We keep the following comment for Foo + ext because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 1 - ], - "span": [ - 61, - 10, - 19 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 7 - ], - "span": [ - 67, - 4, - 28 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 7, - 10101 - ], - "span": [ - 67, - 4, - 28 - ], - "leadingComments": " Keep if Foo + ext | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 0 - ], - "span": [ - 69, - 4, - 28 - ], - "leadingComments": " Keep if NestedFoo: comment on field uid\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 0, - 4 - ], - "span": [ - 69, - 4, - 12 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 0, - 5 - ], - "span": [ - 69, - 13, - 19 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 0, - 1 - ], - "span": [ - 69, - 20, - 23 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 0, - 3 - ], - "span": [ - 69, - 26, - 27 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 1 - ], - "span": [ - 71, - 4, - 42 - ], - "leadingComments": " Keep if NestedFoo: comment on field meta\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 1, - 4 - ], - "span": [ - 71, - 4, - 12 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 1, - 6 - ], - "span": [ - 71, - 13, - 32 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 1, - 1 - ], - "span": [ - 71, - 33, - 37 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 1, - 3 - ], - "span": [ - 71, - 40, - 41 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 2 - ], - "span": [ - 73, - 4, - 29 - ], - "leadingComments": " Keep if NestedFoo: comment on field state\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 2, - 4 - ], - "span": [ - 73, - 4, - 12 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 2, - 6 - ], - "span": [ - 73, - 13, - 18 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 2, - 1 - ], - "span": [ - 73, - 19, - 24 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 2, - 2, - 3 - ], - "span": [ - 73, - 27, - 28 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 4, - 0 - ], - "span": [ - 76, - 4, - 81, - 5 - ], - "leadingComments": " Keep if NestedFoo: comment on enum State\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 4, - 0, - 1 - ], - "span": [ - 76, - 9, - 14 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 4, - 0, - 2, - 0 - ], - "span": [ - 78, - 6, - 28 - ], - "leadingComments": " Keep if NestedFoo: comment on enum value STATE_UNSPECIFIED\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 4, - 0, - 2, - 0, - 1 - ], - "span": [ - 78, - 6, - 23 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 4, - 0, - 2, - 0, - 2 - ], - "span": [ - 78, - 26, - 27 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 4, - 0, - 2, - 1 - ], - "span": [ - 80, - 6, - 21 - ], - "leadingComments": " Keep if NestedFoo: comment on enum value STATE_GOOD\n" - }, - { - "path": [ - 4, - 0, - 3, - 0, - 4, - 0, - 2, - 1, - 1 - ], - "span": [ - 80, - 6, - 16 - ] - }, - { - "path": [ - 4, - 0, - 3, - 0, - 4, - 0, - 2, - 1, - 2 - ], - "span": [ - 80, - 19, - 20 - ] - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Quz.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Quz.txtar deleted file mode 100644 index 20a4c7223..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Quz.txtar +++ /dev/null @@ -1,134 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 5, - 0 - ], - "span": [ - 117, - 0, - 120, - 1 - ], - "leadingComments": " Keep if Quz: comment on enum Quz\n" - }, - { - "path": [ - 5, - 0, - 1 - ], - "span": [ - 117, - 5, - 8 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0 - ], - "span": [ - 119, - 2, - 22 - ], - "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 0, - 2, - 0, - 1 - ], - "span": [ - 119, - 2, - 17 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0, - 2 - ], - "span": [ - 119, - 20, - 21 - ] - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Svc.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Svc.txtar deleted file mode 100644 index 876719864..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/Svc.txtar +++ /dev/null @@ -1,992 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 4, - 0 - ], - "span": [ - 40, - 0, - 89, - 1 - ], - "leadingComments": " Keep if Foo: comment on message Foo\n", - "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", - "leadingDetachedComments": [ - " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" - ] - }, - { - "path": [ - 4, - 0, - 1 - ], - "span": [ - 40, - 8, - 11 - ] - }, - { - "path": [ - 4, - 0, - 7 - ], - "span": [ - 46, - 2, - 26 - ] - }, - { - "path": [ - 4, - 0, - 7, - 10101 - ], - "span": [ - 46, - 2, - 26 - ], - "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 0, - 2, - 0 - ], - "span": [ - 49, - 2, - 27 - ], - "leadingComments": " Keep if Foo: comment on field name\n" - }, - { - "path": [ - 4, - 0, - 2, - 0, - 4 - ], - "span": [ - 49, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 5 - ], - "span": [ - 49, - 11, - 17 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 1 - ], - "span": [ - 49, - 18, - 22 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 3 - ], - "span": [ - 49, - 25, - 26 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1 - ], - "span": [ - 51, - 2, - 26 - ], - "leadingComments": " Keep if Foo: comment on field bits\n" - }, - { - "path": [ - 4, - 0, - 2, - 1, - 4 - ], - "span": [ - 51, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 5 - ], - "span": [ - 51, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 1 - ], - "span": [ - 51, - 17, - 21 - ] - }, - { - "path": [ - 4, - 0, - 2, - 1, - 3 - ], - "span": [ - 51, - 24, - 25 - ] - }, - { - "path": [ - 4, - 0, - 9 - ], - "span": [ - 54, - 2, - 20 - ], - "leadingComments": " Keep if Foo: comment on reserved range\n" - }, - { - "path": [ - 4, - 0, - 9, - 0 - ], - "span": [ - 54, - 11, - 19 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 1 - ], - "span": [ - 54, - 11, - 13 - ] - }, - { - "path": [ - 4, - 0, - 9, - 0, - 2 - ], - "span": [ - 54, - 17, - 19 - ] - }, - { - "path": [ - 4, - 0, - 10 - ], - "span": [ - 56, - 2, - 31 - ], - "leadingComments": " Keep if Foo: comment on reserved names\n" - }, - { - "path": [ - 4, - 0, - 10, - 0 - ], - "span": [ - 56, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 10, - 1 - ], - "span": [ - 56, - 18, - 23 - ] - }, - { - "path": [ - 4, - 0, - 10, - 2 - ], - "span": [ - 56, - 25, - 30 - ] - }, - { - "path": [ - 4, - 0, - 5 - ], - "span": [ - 58, - 2, - 24 - ], - "leadingComments": " Keep if Foo: comment on extension range\n" - }, - { - "path": [ - 4, - 0, - 5, - 0 - ], - "span": [ - 58, - 13, - 23 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 1 - ], - "span": [ - 58, - 13, - 16 - ] - }, - { - "path": [ - 4, - 0, - 5, - 0, - 2 - ], - "span": [ - 58, - 20, - 23 - ] - }, - { - "path": [ - 4, - 1 - ], - "span": [ - 95, - 0, - 105, - 1 - ], - "leadingComments": " Keep if Bar: comment on message Bar\n", - "leadingDetachedComments": [ - " \"Keep if Bar\" are also kept for Svc and Svc.Do since those\n elements depend on Bar.\n" - ] - }, - { - "path": [ - 4, - 1, - 1 - ], - "span": [ - 95, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0 - ], - "span": [ - 97, - 2, - 23 - ], - "leadingComments": " Keep if Bar: comment on field foo\n" - }, - { - "path": [ - 4, - 1, - 2, - 0, - 4 - ], - "span": [ - 97, - 2, - 10 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 6 - ], - "span": [ - 97, - 11, - 14 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 1 - ], - "span": [ - 97, - 15, - 18 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 3 - ], - "span": [ - 97, - 21, - 22 - ] - }, - { - "path": [ - 4, - 1, - 8, - 0 - ], - "span": [ - 99, - 2, - 104, - 3 - ], - "leadingComments": " Keep if Bar: comment on oneof status\n" - }, - { - "path": [ - 4, - 1, - 8, - 0, - 1 - ], - "span": [ - 99, - 8, - 14 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1 - ], - "span": [ - 101, - 4, - 16 - ], - "leadingComments": " Keep if Bar: comment on field baz\n" - }, - { - "path": [ - 4, - 1, - 2, - 1, - 6 - ], - "span": [ - 101, - 4, - 7 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 1 - ], - "span": [ - 101, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 3 - ], - "span": [ - 101, - 14, - 15 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2 - ], - "span": [ - 103, - 4, - 16 - ], - "leadingComments": " Keep if Bar: comment on field quz\n" - }, - { - "path": [ - 4, - 1, - 2, - 2, - 6 - ], - "span": [ - 103, - 4, - 7 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2, - 1 - ], - "span": [ - 103, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 2, - 2, - 3 - ], - "span": [ - 103, - 14, - 15 - ] - }, - { - "path": [ - 5, - 0 - ], - "span": [ - 111, - 0, - 114, - 1 - ], - "leadingComments": " Keep if Baz: comment on enum Baz\n", - "leadingDetachedComments": [ - " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" - ] - }, - { - "path": [ - 5, - 0, - 1 - ], - "span": [ - 111, - 5, - 8 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0 - ], - "span": [ - 113, - 2, - 22 - ], - "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 0, - 2, - 0, - 1 - ], - "span": [ - 113, - 2, - 17 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0, - 2 - ], - "span": [ - 113, - 20, - 21 - ] - }, - { - "path": [ - 5, - 1 - ], - "span": [ - 117, - 0, - 120, - 1 - ], - "leadingComments": " Keep if Quz: comment on enum Quz\n" - }, - { - "path": [ - 5, - 1, - 1 - ], - "span": [ - 117, - 5, - 8 - ] - }, - { - "path": [ - 5, - 1, - 2, - 0 - ], - "span": [ - 119, - 2, - 22 - ], - "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 1, - 2, - 0, - 1 - ], - "span": [ - 119, - 2, - 17 - ] - }, - { - "path": [ - 5, - 1, - 2, - 0, - 2 - ], - "span": [ - 119, - 20, - 21 - ] - }, - { - "path": [ - 6, - 0 - ], - "span": [ - 141, - 0, - 153, - 1 - ], - "leadingComments": " Keep if Svc: comment on service Svc\n" - }, - { - "path": [ - 6, - 0, - 1 - ], - "span": [ - 141, - 8, - 11 - ] - }, - { - "path": [ - 6, - 0, - 3 - ], - "span": [ - 143, - 2, - 29 - ] - }, - { - "path": [ - 6, - 0, - 3, - 10101 - ], - "span": [ - 143, - 2, - 29 - ], - "leadingComments": " Keep if Svc: comment on option\n" - }, - { - "path": [ - 6, - 0, - 2, - 0 - ], - "span": [ - 146, - 2, - 149, - 3 - ], - "leadingComments": " Keep if Svc.Do: comment on rpc Do\n" - }, - { - "path": [ - 6, - 0, - 2, - 0, - 1 - ], - "span": [ - 146, - 6, - 8 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 2 - ], - "span": [ - 146, - 9, - 12 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 3 - ], - "span": [ - 146, - 23, - 26 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 4 - ], - "span": [ - 148, - 4, - 47 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 4, - 34 - ], - "span": [ - 148, - 4, - 47 - ], - "leadingComments": " Keep if Svc.Do: comment on option\n" - }, - { - "path": [ - 6, - 0, - 2, - 1 - ], - "span": [ - 152, - 2, - 30 - ], - "leadingComments": " Keep if Svc: comment on rpc Dont\n" - }, - { - "path": [ - 6, - 0, - 2, - 1, - 1 - ], - "span": [ - 152, - 6, - 10 - ] - }, - { - "path": [ - 6, - 0, - 2, - 1, - 2 - ], - "span": [ - 152, - 11, - 14 - ] - }, - { - "path": [ - 6, - 0, - 2, - 1, - 3 - ], - "span": [ - 152, - 25, - 28 - ] - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/all.txtar b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/all.txtar deleted file mode 100644 index 3d08341ef..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/all.txtar +++ /dev/null @@ -1,2103 +0,0 @@ -{ - "location": [ - { - "span": [ - 1, - 0, - 153, - 1 - ] - }, - { - "path": [ - 12 - ], - "span": [ - 1, - 0, - 18 - ], - "leadingComments": " Keep 1: comment on syntax\n" - }, - { - "path": [ - 2 - ], - "span": [ - 4, - 0, - 16 - ], - "leadingComments": " Keep 2: comment on package\n" - }, - { - "path": [ - 8 - ], - "span": [ - 7, - 0, - 34 - ] - }, - { - "path": [ - 8, - 11 - ], - "span": [ - 7, - 0, - 34 - ], - "leadingComments": " Keep 3: comment on option\n" - }, - { - "path": [ - 3, - 0 - ], - "span": [ - 10, - 0, - 42 - ], - "leadingComments": " Keep if ext: comment on import descriptor.proto\n" - }, - { - "path": [ - 11, - 0 - ], - "span": [ - 13, - 7, - 11 - ] - }, - { - "path": [ - 3, - 1 - ], - "span": [ - 16, - 0, - 40 - ], - "leadingComments": " Keep if NestedFoo: comment on import any.proto\n" - }, - { - "path": [ - 7 - ], - "span": [ - 19, - 0, - 22, - 1 - ], - "leadingComments": " Keep if ext: comment on extend block\n" - }, - { - "path": [ - 7, - 0 - ], - "span": [ - 21, - 2, - 33 - ], - "leadingComments": " Keep if ext: comment on custom option bizniz\n" - }, - { - "path": [ - 7, - 0, - 2 - ], - "span": [ - 19, - 7, - 37 - ] - }, - { - "path": [ - 7, - 0, - 4 - ], - "span": [ - 21, - 2, - 10 - ] - }, - { - "path": [ - 7, - 0, - 5 - ], - "span": [ - 21, - 11, - 17 - ] - }, - { - "path": [ - 7, - 0, - 1 - ], - "span": [ - 21, - 18, - 24 - ] - }, - { - "path": [ - 7, - 0, - 3 - ], - "span": [ - 21, - 27, - 32 - ] - }, - { - "path": [ - 7 - ], - "span": [ - 25, - 0, - 28, - 1 - ], - "leadingComments": " Keep if ext: comment on extend block\n" - }, - { - "path": [ - 7, - 1 - ], - "span": [ - 27, - 2, - 35 - ], - "leadingComments": " Keep if ext + Svc: comment on custom option fizzbuzz\n" - }, - { - "path": [ - 7, - 1, - 2 - ], - "span": [ - 25, - 7, - 37 - ] - }, - { - "path": [ - 7, - 1, - 4 - ], - "span": [ - 27, - 2, - 10 - ] - }, - { - "path": [ - 7, - 1, - 5 - ], - "span": [ - 27, - 11, - 17 - ] - }, - { - "path": [ - 7, - 1, - 1 - ], - "span": [ - 27, - 18, - 26 - ] - }, - { - "path": [ - 7, - 1, - 3 - ], - "span": [ - 27, - 29, - 34 - ] - }, - { - "path": [ - 4, - 0 - ], - "span": [ - 31, - 0, - 34, - 1 - ], - "leadingComments": " Keep if all: comment on message Frobnitz\n" - }, - { - "path": [ - 4, - 0, - 1 - ], - "span": [ - 31, - 8, - 16 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0 - ], - "span": [ - 33, - 2, - 25 - ], - "leadingComments": " Keep if all: comment on field xyz\n" - }, - { - "path": [ - 4, - 0, - 2, - 0, - 4 - ], - "span": [ - 33, - 2, - 10 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 5 - ], - "span": [ - 33, - 11, - 16 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 1 - ], - "span": [ - 33, - 17, - 20 - ] - }, - { - "path": [ - 4, - 0, - 2, - 0, - 3 - ], - "span": [ - 33, - 23, - 24 - ] - }, - { - "path": [ - 4, - 1 - ], - "span": [ - 40, - 0, - 89, - 1 - ], - "leadingComments": " Keep if Foo: comment on message Foo\n", - "trailingComments": " We keep the following comment for NestedFoo because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n", - "leadingDetachedComments": [ - " \"Keep if Foo\" are also kept for Bar, Svc, and Svc.Do since those\n elements depend on Foo.\n" - ] - }, - { - "path": [ - 4, - 1, - 1 - ], - "span": [ - 40, - 8, - 11 - ] - }, - { - "path": [ - 4, - 1, - 7 - ], - "span": [ - 46, - 2, - 26 - ] - }, - { - "path": [ - 4, - 1, - 7, - 10101 - ], - "span": [ - 46, - 2, - 26 - ], - "leadingComments": " Keep if Foo | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 1, - 2, - 0 - ], - "span": [ - 49, - 2, - 27 - ], - "leadingComments": " Keep if Foo: comment on field name\n" - }, - { - "path": [ - 4, - 1, - 2, - 0, - 4 - ], - "span": [ - 49, - 2, - 10 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 5 - ], - "span": [ - 49, - 11, - 17 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 1 - ], - "span": [ - 49, - 18, - 22 - ] - }, - { - "path": [ - 4, - 1, - 2, - 0, - 3 - ], - "span": [ - 49, - 25, - 26 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1 - ], - "span": [ - 51, - 2, - 26 - ], - "leadingComments": " Keep if Foo: comment on field bits\n" - }, - { - "path": [ - 4, - 1, - 2, - 1, - 4 - ], - "span": [ - 51, - 2, - 10 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 5 - ], - "span": [ - 51, - 11, - 16 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 1 - ], - "span": [ - 51, - 17, - 21 - ] - }, - { - "path": [ - 4, - 1, - 2, - 1, - 3 - ], - "span": [ - 51, - 24, - 25 - ] - }, - { - "path": [ - 4, - 1, - 9 - ], - "span": [ - 54, - 2, - 20 - ], - "leadingComments": " Keep if Foo: comment on reserved range\n" - }, - { - "path": [ - 4, - 1, - 9, - 0 - ], - "span": [ - 54, - 11, - 19 - ] - }, - { - "path": [ - 4, - 1, - 9, - 0, - 1 - ], - "span": [ - 54, - 11, - 13 - ] - }, - { - "path": [ - 4, - 1, - 9, - 0, - 2 - ], - "span": [ - 54, - 17, - 19 - ] - }, - { - "path": [ - 4, - 1, - 10 - ], - "span": [ - 56, - 2, - 31 - ], - "leadingComments": " Keep if Foo: comment on reserved names\n" - }, - { - "path": [ - 4, - 1, - 10, - 0 - ], - "span": [ - 56, - 11, - 16 - ] - }, - { - "path": [ - 4, - 1, - 10, - 1 - ], - "span": [ - 56, - 18, - 23 - ] - }, - { - "path": [ - 4, - 1, - 10, - 2 - ], - "span": [ - 56, - 25, - 30 - ] - }, - { - "path": [ - 4, - 1, - 5 - ], - "span": [ - 58, - 2, - 24 - ], - "leadingComments": " Keep if Foo: comment on extension range\n" - }, - { - "path": [ - 4, - 1, - 5, - 0 - ], - "span": [ - 58, - 13, - 23 - ] - }, - { - "path": [ - 4, - 1, - 5, - 0, - 1 - ], - "span": [ - 58, - 13, - 16 - ] - }, - { - "path": [ - 4, - 1, - 5, - 0, - 2 - ], - "span": [ - 58, - 20, - 23 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0 - ], - "span": [ - 61, - 2, - 88, - 3 - ], - "leadingComments": " Keep if NestedFoo: comment on message NestedFoo\n", - "trailingComments": " We keep the following comment for Foo + ext because we don't\n discard options or option comments even if we're only retaining\n a message as a namespace for another retained element.\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 1 - ], - "span": [ - 61, - 10, - 19 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 7 - ], - "span": [ - 67, - 4, - 28 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 7, - 10101 - ], - "span": [ - 67, - 4, - 28 - ], - "leadingComments": " Keep if Foo + ext | NestedFoo: comment on option\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 0 - ], - "span": [ - 69, - 4, - 28 - ], - "leadingComments": " Keep if NestedFoo: comment on field uid\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 0, - 4 - ], - "span": [ - 69, - 4, - 12 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 0, - 5 - ], - "span": [ - 69, - 13, - 19 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 0, - 1 - ], - "span": [ - 69, - 20, - 23 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 0, - 3 - ], - "span": [ - 69, - 26, - 27 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 1 - ], - "span": [ - 71, - 4, - 42 - ], - "leadingComments": " Keep if NestedFoo: comment on field meta\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 1, - 4 - ], - "span": [ - 71, - 4, - 12 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 1, - 6 - ], - "span": [ - 71, - 13, - 32 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 1, - 1 - ], - "span": [ - 71, - 33, - 37 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 1, - 3 - ], - "span": [ - 71, - 40, - 41 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 2 - ], - "span": [ - 73, - 4, - 29 - ], - "leadingComments": " Keep if NestedFoo: comment on field state\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 2, - 4 - ], - "span": [ - 73, - 4, - 12 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 2, - 6 - ], - "span": [ - 73, - 13, - 18 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 2, - 1 - ], - "span": [ - 73, - 19, - 24 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 2, - 2, - 3 - ], - "span": [ - 73, - 27, - 28 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 4, - 0 - ], - "span": [ - 76, - 4, - 81, - 5 - ], - "leadingComments": " Keep if NestedFoo: comment on enum State\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 4, - 0, - 1 - ], - "span": [ - 76, - 9, - 14 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 4, - 0, - 2, - 0 - ], - "span": [ - 78, - 6, - 28 - ], - "leadingComments": " Keep if NestedFoo: comment on enum value STATE_UNSPECIFIED\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 4, - 0, - 2, - 0, - 1 - ], - "span": [ - 78, - 6, - 23 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 4, - 0, - 2, - 0, - 2 - ], - "span": [ - 78, - 26, - 27 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 4, - 0, - 2, - 1 - ], - "span": [ - 80, - 6, - 21 - ], - "leadingComments": " Keep if NestedFoo: comment on enum value STATE_GOOD\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 4, - 0, - 2, - 1, - 1 - ], - "span": [ - 80, - 6, - 16 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 4, - 0, - 2, - 1, - 2 - ], - "span": [ - 80, - 19, - 20 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 6 - ], - "span": [ - 84, - 4, - 87, - 5 - ], - "leadingComments": " Keep if Foo + ext: comment on extend block\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 6, - 0 - ], - "span": [ - 86, - 6, - 32 - ], - "leadingComments": " Keep if Foo + ext: comment on extension blah\n" - }, - { - "path": [ - 4, - 1, - 3, - 0, - 6, - 0, - 2 - ], - "span": [ - 84, - 11, - 14 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 6, - 0, - 4 - ], - "span": [ - 86, - 6, - 14 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 6, - 0, - 5 - ], - "span": [ - 86, - 15, - 20 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 6, - 0, - 1 - ], - "span": [ - 86, - 21, - 25 - ] - }, - { - "path": [ - 4, - 1, - 3, - 0, - 6, - 0, - 3 - ], - "span": [ - 86, - 28, - 31 - ] - }, - { - "path": [ - 4, - 2 - ], - "span": [ - 95, - 0, - 105, - 1 - ], - "leadingComments": " Keep if Bar: comment on message Bar\n", - "leadingDetachedComments": [ - " \"Keep if Bar\" are also kept for Svc and Svc.Do since those\n elements depend on Bar.\n" - ] - }, - { - "path": [ - 4, - 2, - 1 - ], - "span": [ - 95, - 8, - 11 - ] - }, - { - "path": [ - 4, - 2, - 2, - 0 - ], - "span": [ - 97, - 2, - 23 - ], - "leadingComments": " Keep if Bar: comment on field foo\n" - }, - { - "path": [ - 4, - 2, - 2, - 0, - 4 - ], - "span": [ - 97, - 2, - 10 - ] - }, - { - "path": [ - 4, - 2, - 2, - 0, - 6 - ], - "span": [ - 97, - 11, - 14 - ] - }, - { - "path": [ - 4, - 2, - 2, - 0, - 1 - ], - "span": [ - 97, - 15, - 18 - ] - }, - { - "path": [ - 4, - 2, - 2, - 0, - 3 - ], - "span": [ - 97, - 21, - 22 - ] - }, - { - "path": [ - 4, - 2, - 8, - 0 - ], - "span": [ - 99, - 2, - 104, - 3 - ], - "leadingComments": " Keep if Bar: comment on oneof status\n" - }, - { - "path": [ - 4, - 2, - 8, - 0, - 1 - ], - "span": [ - 99, - 8, - 14 - ] - }, - { - "path": [ - 4, - 2, - 2, - 1 - ], - "span": [ - 101, - 4, - 16 - ], - "leadingComments": " Keep if Bar: comment on field baz\n" - }, - { - "path": [ - 4, - 2, - 2, - 1, - 6 - ], - "span": [ - 101, - 4, - 7 - ] - }, - { - "path": [ - 4, - 2, - 2, - 1, - 1 - ], - "span": [ - 101, - 8, - 11 - ] - }, - { - "path": [ - 4, - 2, - 2, - 1, - 3 - ], - "span": [ - 101, - 14, - 15 - ] - }, - { - "path": [ - 4, - 2, - 2, - 2 - ], - "span": [ - 103, - 4, - 16 - ], - "leadingComments": " Keep if Bar: comment on field quz\n" - }, - { - "path": [ - 4, - 2, - 2, - 2, - 6 - ], - "span": [ - 103, - 4, - 7 - ] - }, - { - "path": [ - 4, - 2, - 2, - 2, - 1 - ], - "span": [ - 103, - 8, - 11 - ] - }, - { - "path": [ - 4, - 2, - 2, - 2, - 3 - ], - "span": [ - 103, - 14, - 15 - ] - }, - { - "path": [ - 5, - 0 - ], - "span": [ - 111, - 0, - 114, - 1 - ], - "leadingComments": " Keep if Baz: comment on enum Baz\n", - "leadingDetachedComments": [ - " \"Keep if Baz\" and \"Keep if Quz\" are also kept for Bar, Svc, and Svc.Do\n since those elements depend on Baz and Quz.\n" - ] - }, - { - "path": [ - 5, - 0, - 1 - ], - "span": [ - 111, - 5, - 8 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0 - ], - "span": [ - 113, - 2, - 22 - ], - "leadingComments": " Keep if Baz: comment on enum value BAZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 0, - 2, - 0, - 1 - ], - "span": [ - 113, - 2, - 17 - ] - }, - { - "path": [ - 5, - 0, - 2, - 0, - 2 - ], - "span": [ - 113, - 20, - 21 - ] - }, - { - "path": [ - 5, - 1 - ], - "span": [ - 117, - 0, - 120, - 1 - ], - "leadingComments": " Keep if Quz: comment on enum Quz\n" - }, - { - "path": [ - 5, - 1, - 1 - ], - "span": [ - 117, - 5, - 8 - ] - }, - { - "path": [ - 5, - 1, - 2, - 0 - ], - "span": [ - 119, - 2, - 22 - ], - "leadingComments": " Keep if Quz: comment on enum value QUZ_UNSPECIFIED\n" - }, - { - "path": [ - 5, - 1, - 2, - 0, - 1 - ], - "span": [ - 119, - 2, - 17 - ] - }, - { - "path": [ - 5, - 1, - 2, - 0, - 2 - ], - "span": [ - 119, - 20, - 21 - ] - }, - { - "path": [ - 4, - 3 - ], - "span": [ - 123, - 0, - 126, - 1 - ], - "leadingComments": " Keep if all: comment on message Buzz\n" - }, - { - "path": [ - 4, - 3, - 1 - ], - "span": [ - 123, - 8, - 12 - ] - }, - { - "path": [ - 4, - 3, - 2, - 0 - ], - "span": [ - 125, - 2, - 24 - ], - "leadingComments": " Keep if all: comment on field s\n" - }, - { - "path": [ - 4, - 3, - 2, - 0, - 4 - ], - "span": [ - 125, - 2, - 10 - ] - }, - { - "path": [ - 4, - 3, - 2, - 0, - 5 - ], - "span": [ - 125, - 11, - 17 - ] - }, - { - "path": [ - 4, - 3, - 2, - 0, - 1 - ], - "span": [ - 125, - 18, - 19 - ] - }, - { - "path": [ - 4, - 3, - 2, - 0, - 3 - ], - "span": [ - 125, - 22, - 23 - ] - }, - { - "path": [ - 4, - 4 - ], - "span": [ - 129, - 0, - 132, - 1 - ], - "leadingComments": " Keep if all: comment on message Bedazzle\n" - }, - { - "path": [ - 4, - 4, - 1 - ], - "span": [ - 129, - 8, - 16 - ] - }, - { - "path": [ - 4, - 4, - 2, - 0 - ], - "span": [ - 131, - 2, - 24 - ], - "leadingComments": " Keep if all: comment on field t\n" - }, - { - "path": [ - 4, - 4, - 2, - 0, - 4 - ], - "span": [ - 131, - 2, - 10 - ] - }, - { - "path": [ - 4, - 4, - 2, - 0, - 5 - ], - "span": [ - 131, - 11, - 17 - ] - }, - { - "path": [ - 4, - 4, - 2, - 0, - 1 - ], - "span": [ - 131, - 18, - 19 - ] - }, - { - "path": [ - 4, - 4, - 2, - 0, - 3 - ], - "span": [ - 131, - 22, - 23 - ] - }, - { - "path": [ - 6, - 0 - ], - "span": [ - 135, - 0, - 138, - 1 - ], - "leadingComments": " Keep if all: comment on service BuzzService\n" - }, - { - "path": [ - 6, - 0, - 1 - ], - "span": [ - 135, - 8, - 19 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0 - ], - "span": [ - 137, - 2, - 41 - ], - "leadingComments": " Keep if all: comment on method BuzzyBuzz\n" - }, - { - "path": [ - 6, - 0, - 2, - 0, - 1 - ], - "span": [ - 137, - 6, - 15 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 2 - ], - "span": [ - 137, - 16, - 20 - ] - }, - { - "path": [ - 6, - 0, - 2, - 0, - 3 - ], - "span": [ - 137, - 31, - 39 - ] - }, - { - "path": [ - 6, - 1 - ], - "span": [ - 141, - 0, - 153, - 1 - ], - "leadingComments": " Keep if Svc: comment on service Svc\n" - }, - { - "path": [ - 6, - 1, - 1 - ], - "span": [ - 141, - 8, - 11 - ] - }, - { - "path": [ - 6, - 1, - 3 - ], - "span": [ - 143, - 2, - 29 - ] - }, - { - "path": [ - 6, - 1, - 3, - 10101 - ], - "span": [ - 143, - 2, - 29 - ], - "leadingComments": " Keep if Svc: comment on option\n" - }, - { - "path": [ - 6, - 1, - 2, - 0 - ], - "span": [ - 146, - 2, - 149, - 3 - ], - "leadingComments": " Keep if Svc.Do: comment on rpc Do\n" - }, - { - "path": [ - 6, - 1, - 2, - 0, - 1 - ], - "span": [ - 146, - 6, - 8 - ] - }, - { - "path": [ - 6, - 1, - 2, - 0, - 2 - ], - "span": [ - 146, - 9, - 12 - ] - }, - { - "path": [ - 6, - 1, - 2, - 0, - 3 - ], - "span": [ - 146, - 23, - 26 - ] - }, - { - "path": [ - 6, - 1, - 2, - 0, - 4 - ], - "span": [ - 148, - 4, - 47 - ] - }, - { - "path": [ - 6, - 1, - 2, - 0, - 4, - 34 - ], - "span": [ - 148, - 4, - 47 - ], - "leadingComments": " Keep if Svc.Do: comment on option\n" - }, - { - "path": [ - 6, - 1, - 2, - 1 - ], - "span": [ - 152, - 2, - 30 - ], - "leadingComments": " Keep if Svc: comment on rpc Dont\n" - }, - { - "path": [ - 6, - 1, - 2, - 1, - 1 - ], - "span": [ - 152, - 6, - 10 - ] - }, - { - "path": [ - 6, - 1, - 2, - 1, - 2 - ], - "span": [ - 152, - 11, - 14 - ] - }, - { - "path": [ - 6, - 1, - 2, - 1, - 3 - ], - "span": [ - 152, - 25, - 28 - ] - } - ] -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/test.proto b/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/test.proto deleted file mode 100644 index 7a3f7a929..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimageutil/testdata/sourcecodeinfo/test.proto +++ /dev/null @@ -1,169 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Keep 1: comment on syntax -syntax = "proto2"; - -// Keep 2: comment on package -package foo.bar; - -// Keep 3: comment on option -option go_package = "foo.bar/baz"; - -// Keep if ext: comment on import descriptor.proto -import "google/protobuf/descriptor.proto"; - -// No keep -import weak "google/protobuf/struct.proto"; - -// Keep if NestedFoo: comment on import any.proto -import weak "google/protobuf/any.proto"; - -// Keep if ext: comment on extend block -extend google.protobuf.MessageOptions { - // Keep if ext: comment on custom option bizniz - optional string bizniz = 10101; -} - -// Keep if ext: comment on extend block -extend google.protobuf.ServiceOptions { - // Keep if ext + Svc: comment on custom option fizzbuzz - optional string fizzbuzz = 10101; -} - -// Keep if all: comment on message Frobnitz -message Frobnitz { - // Keep if all: comment on field xyz - optional bytes xyz = 1; -} - -// "Keep if Foo" are also kept for Bar, Svc, and Svc.Do since those -// elements depend on Foo. - -// Keep if Foo: comment on message Foo -message Foo { - // We keep the following comment for NestedFoo because we don't - // discard options or option comments even if we're only retaining - // a message as a namespace for another retained element. - - // Keep if Foo | NestedFoo: comment on option - option (bizniz) = "abc"; - - // Keep if Foo: comment on field name - optional string name = 1; - // Keep if Foo: comment on field bits - repeated int64 bits = 2; - - // Keep if Foo: comment on reserved range - reserved 10 to 20; - // Keep if Foo: comment on reserved names - reserved "abc", "def", "ghi"; - // Keep if Foo: comment on extension range - extensions 100 to max; - - // Keep if NestedFoo: comment on message NestedFoo - message NestedFoo { - // We keep the following comment for Foo + ext because we don't - // discard options or option comments even if we're only retaining - // a message as a namespace for another retained element. - - // Keep if Foo + ext | NestedFoo: comment on option - option (bizniz) = "abc"; - // Keep if NestedFoo: comment on field uid - optional uint64 uid = 1; - // Keep if NestedFoo: comment on field meta - repeated google.protobuf.Any meta = 2; - // Keep if NestedFoo: comment on field state - optional State state = 3; - - // Keep if NestedFoo: comment on enum State - enum State { - // Keep if NestedFoo: comment on enum value STATE_UNSPECIFIED - STATE_UNSPECIFIED = 0; - // Keep if NestedFoo: comment on enum value STATE_GOOD - STATE_GOOD = 1; - } - - // Keep if Foo + ext: comment on extend block - extend Foo { - // Keep if Foo + ext: comment on extension blah - repeated bytes blah = 101; - } - } -} - -// "Keep if Bar" are also kept for Svc and Svc.Do since those -// elements depend on Bar. - -// Keep if Bar: comment on message Bar -message Bar { - // Keep if Bar: comment on field foo - optional Foo foo = 1; - // Keep if Bar: comment on oneof status - oneof status { - // Keep if Bar: comment on field baz - Baz baz = 2; - // Keep if Bar: comment on field quz - Quz quz = 3; - } -} - -// "Keep if Baz" and "Keep if Quz" are also kept for Bar, Svc, and Svc.Do -// since those elements depend on Baz and Quz. - -// Keep if Baz: comment on enum Baz -enum Baz { - // Keep if Baz: comment on enum value BAZ_UNSPECIFIED - BAZ_UNSPECIFIED = 0; -} - -// Keep if Quz: comment on enum Quz -enum Quz { - // Keep if Quz: comment on enum value QUZ_UNSPECIFIED - QUZ_UNSPECIFIED = 0; -} - -// Keep if all: comment on message Buzz -message Buzz { - // Keep if all: comment on field s - optional string s = 1; -} - -// Keep if all: comment on message Bedazzle -message Bedazzle { - // Keep if all: comment on field t - optional string t = 1; -} - -// Keep if all: comment on service BuzzService -service BuzzService { - // Keep if all: comment on method BuzzyBuzz - rpc BuzzyBuzz(Buzz) returns (Bedazzle); -} - -// Keep if Svc: comment on service Svc -service Svc { - // Keep if Svc: comment on option - option (fizzbuzz) = "wxyz"; - - // Keep if Svc.Do: comment on rpc Do - rpc Do(Foo) returns (Bar) { - // Keep if Svc.Do: comment on option - option idempotency_level = NO_SIDE_EFFECTS; - } - - // Keep if Svc: comment on rpc Dont - rpc Dont(Foo) returns (Bar); -} \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufimage/image_test.go b/pkg/bufman/bufpkg/bufimage/image_test.go deleted file mode 100644 index ae9d60b02..000000000 --- a/pkg/bufman/bufpkg/bufimage/image_test.go +++ /dev/null @@ -1,140 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimage - -import ( - "testing" - - imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" -) - -func TestMergeImagesWithImports(t *testing.T) { - t.Parallel() - firstProtoImage := &imagev1.Image{ - File: []*imagev1.ImageFile{ - { - Syntax: proto.String("proto3"), - Name: proto.String("a.proto"), - Dependency: []string{"b.proto"}, - }, - { - Syntax: proto.String("proto3"), - Name: proto.String("b.proto"), - BufExtension: &imagev1.ImageFileExtension{ - IsImport: proto.Bool(true), - }, - }, - { - Syntax: proto.String("proto3"), - Name: proto.String("c.proto"), - BufExtension: &imagev1.ImageFileExtension{ - IsImport: proto.Bool(true), - }, - }, - }, - } - secondProtoImage := &imagev1.Image{ - File: []*imagev1.ImageFile{ - { - Syntax: proto.String("proto3"), - Name: proto.String("b.proto"), - }, - }, - } - - firstImage, err := NewImageForProto(firstProtoImage) - require.NoError(t, err) - secondImage, err := NewImageForProto(secondProtoImage) - require.NoError(t, err) - mergedImage, err := MergeImages(firstImage, secondImage) - require.NoError(t, err) - - imageFiles := mergedImage.Files() - require.Len(t, imageFiles, 3) - assert.False(t, mergedImage.GetFile("a.proto").IsImport()) - assert.False(t, mergedImage.GetFile("b.proto").IsImport()) - assert.True(t, mergedImage.GetFile("c.proto").IsImport()) -} - -func TestMergeImagesWithDuplicateFile(t *testing.T) { - t.Parallel() - firstProtoImage := &imagev1.Image{ - File: []*imagev1.ImageFile{ - { - Syntax: proto.String("proto3"), - Name: proto.String("a.proto"), - }, - }, - } - secondProtoImage := &imagev1.Image{ - File: []*imagev1.ImageFile{ - { - Syntax: proto.String("proto3"), - Name: proto.String("a.proto"), - }, - }, - } - - firstImage, err := NewImageForProto(firstProtoImage) - require.NoError(t, err) - secondImage, err := NewImageForProto(secondProtoImage) - require.NoError(t, err) - _, err = MergeImages(firstImage, secondImage) - require.Error(t, err) -} - -func TestMergeImagesOrdered(t *testing.T) { - t.Parallel() - firstProtoImage := &imagev1.Image{ - File: []*imagev1.ImageFile{ - { - Syntax: proto.String("proto3"), - Name: proto.String("a.proto"), - }, - { - Syntax: proto.String("proto3"), - Name: proto.String("b.proto"), - }, - }, - } - secondProtoImage := &imagev1.Image{ - File: []*imagev1.ImageFile{ - { - Syntax: proto.String("proto3"), - Name: proto.String("c.proto"), - }, - { - Syntax: proto.String("proto3"), - Name: proto.String("d.proto"), - }, - }, - } - - firstImage, err := NewImageForProto(firstProtoImage) - require.NoError(t, err) - secondImage, err := NewImageForProto(secondProtoImage) - require.NoError(t, err) - image, err := MergeImages(firstImage, secondImage) - require.NoError(t, err) - var paths []string - for _, imageFile := range image.Files() { - paths = append(paths, imageFile.Path()) - } - assert.Equal(t, []string{"a.proto", "b.proto", "c.proto", "d.proto"}, paths) -} diff --git a/pkg/bufman/bufpkg/bufimage/util_test.go b/pkg/bufman/bufpkg/bufimage/util_test.go deleted file mode 100644 index 266f5005d..000000000 --- a/pkg/bufman/bufpkg/bufimage/util_test.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimage - -import ( - "bytes" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - imagev1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/image/v1" - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/testing/protocmp" - "google.golang.org/protobuf/types/descriptorpb" -) - -func TestStripBufExtensionField(t *testing.T) { - t.Parallel() - file := &imagev1.ImageFile{ - BufExtension: &imagev1.ImageFileExtension{ - IsImport: proto.Bool(true), - UnusedDependency: []int32{1, 3, 5}, - ModuleInfo: &imagev1.ModuleInfo{ - Name: &imagev1.ModuleName{ - Remote: proto.String("buf.build"), - Owner: proto.String("foo"), - Repository: proto.String("bar"), - }, - Commit: proto.String("1234981234123412341234"), - }, - }, - } - dataToBeStripped, err := proto.Marshal(file) - require.NoError(t, err) - - otherData := protowire.AppendTag(nil, 122, protowire.BytesType) - otherData = protowire.AppendBytes(otherData, []byte{1, 18, 28, 123, 5, 3, 1}) - otherData = protowire.AppendTag(otherData, 123, protowire.VarintType) - otherData = protowire.AppendVarint(otherData, 23456) - otherData = protowire.AppendTag(otherData, 124, protowire.Fixed32Type) - otherData = protowire.AppendFixed32(otherData, 23456) - otherData = protowire.AppendTag(otherData, 125, protowire.Fixed64Type) - otherData = protowire.AppendFixed64(otherData, 23456) - otherData = protowire.AppendTag(otherData, 126, protowire.StartGroupType) - { - otherData = protowire.AppendTag(otherData, 1, protowire.VarintType) - otherData = protowire.AppendVarint(otherData, 123) - otherData = protowire.AppendTag(otherData, 2, protowire.BytesType) - otherData = protowire.AppendBytes(otherData, []byte("foo-bar-baz")) - } - otherData = protowire.AppendTag(otherData, 126, protowire.EndGroupType) - - testCases := []struct { - name string - input []byte - expectedOutput []byte - }{ - { - name: "nothing to strip", - input: otherData, - expectedOutput: otherData, - }, - { - name: "nothing left after strip", - input: dataToBeStripped, - expectedOutput: []byte{}, - }, - { - name: "stripped field at start", - input: bytes.Join([][]byte{dataToBeStripped, otherData}, nil), - expectedOutput: otherData, - }, - { - name: "stripped field at end", - input: bytes.Join([][]byte{otherData, dataToBeStripped}, nil), - expectedOutput: otherData, - }, - { - name: "stripped field in the middle", - input: bytes.Join([][]byte{otherData, dataToBeStripped, otherData}, nil), - expectedOutput: bytes.Repeat(otherData, 2), - }, - } - for i := range testCases { - testCase := testCases[i] - t.Run(testCase.name, func(t *testing.T) { - t.Parallel() - stripped := stripBufExtensionField(testCase.input) - require.Equal(t, testCase.expectedOutput, []byte(stripped)) - }) - } -} - -func TestImageToProtoPreservesUnrecognizedFields(t *testing.T) { - t.Parallel() - fileDescriptor := &descriptorpb.FileDescriptorProto{ - Name: proto.String("foo/bar/baz.proto"), - Package: proto.String("foo.bar.baz"), - Syntax: proto.String("proto3"), - MessageType: []*descriptorpb.DescriptorProto{ - { - Name: proto.String("Foo"), - Field: []*descriptorpb.FieldDescriptorProto{ - { - Name: proto.String("id"), - Number: proto.Int32(1), - Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), - Type: descriptorpb.FieldDescriptorProto_TYPE_INT64.Enum(), - JsonName: proto.String("id"), - }, - { - Name: proto.String("name"), - Number: proto.Int32(2), - Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), - Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), - JsonName: proto.String("name"), - }, - }, - }, - }, - } - otherData := protowire.AppendTag(nil, 122, protowire.BytesType) - otherData = protowire.AppendBytes(otherData, []byte{1, 18, 28, 123, 5, 3, 1}) - otherData = protowire.AppendTag(otherData, 123, protowire.VarintType) - otherData = protowire.AppendVarint(otherData, 23456) - otherData = protowire.AppendTag(otherData, 124, protowire.Fixed32Type) - otherData = protowire.AppendFixed32(otherData, 23456) - fileDescriptor.ProtoReflect().SetUnknown(otherData) - - module, err := bufmoduleref.ModuleIdentityForString("buf.build/foo/bar") - require.NoError(t, err) - imageFile, err := NewImageFile( - fileDescriptor, - module, - "1234123451235", - "foo/bar/baz.proto", - false, - false, - nil, - ) - require.NoError(t, err) - - protoImageFile := imageFileToProtoImageFile(imageFile) - // make sure unrecognized bytes survived - require.Equal(t, otherData, []byte(protoImageFile.ProtoReflect().GetUnknown())) - - // now round-trip it back through - imageFileBytes, err := proto.Marshal(protoImageFile) - require.NoError(t, err) - - roundTrippedFileDescriptor := &descriptorpb.FileDescriptorProto{} - err = proto.Unmarshal(imageFileBytes, roundTrippedFileDescriptor) - require.NoError(t, err) - // unrecognized now includes image file's buf extension - require.Greater(t, len(roundTrippedFileDescriptor.ProtoReflect().GetUnknown()), len(otherData)) - - // if we go back through an image file, we should strip out the - // buf extension unknown bytes but preserve the rest - module, err = bufmoduleref.ModuleIdentityForString("buf.build/abc/def") - require.NoError(t, err) - // NB: intentionally different metadata - imageFile, err = NewImageFile( - fileDescriptor, - module, - "987654321", - "abc/def/xyz.proto", - false, - true, - []int32{1, 2, 3}, - ) - require.NoError(t, err) - - protoImageFile = imageFileToProtoImageFile(imageFile) - // make sure unrecognized bytes survived and extraneous buf extension is not present - require.Equal(t, otherData, []byte(protoImageFile.ProtoReflect().GetUnknown())) - - // double-check via round-trip, to make sure resulting image file equals the input - // (to verify that the original unknown bytes byf extension didn't interfere) - imageFileBytes, err = proto.Marshal(protoImageFile) - require.NoError(t, err) - - roundTrippedImageFile := &imagev1.ImageFile{} - err = proto.Unmarshal(imageFileBytes, roundTrippedImageFile) - require.NoError(t, err) - - diff := cmp.Diff(protoImageFile, roundTrippedImageFile, protocmp.Transform()) - require.Empty(t, diff) -} diff --git a/pkg/bufman/bufpkg/buflock/buflock_test.go b/pkg/bufman/bufpkg/buflock/buflock_test.go deleted file mode 100644 index da9d6fc50..000000000 --- a/pkg/bufman/bufpkg/buflock/buflock_test.go +++ /dev/null @@ -1,306 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package buflock_test - -import ( - "bytes" - "context" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buflock" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/encoding" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/manifest" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestReadConfigV1Beta1(t *testing.T) { - t.Parallel() - testReadConfig(t, "v1beta1") -} - -func TestReadConfigV1(t *testing.T) { - t.Parallel() - testReadConfig(t, "v1") -} - -func testReadConfig(t *testing.T, version string) { - successConfig := &buflock.Config{ - Dependencies: []buflock.Dependency{ - { - Remote: "bufbuild.test", - Owner: "acme", - Repository: "weather", - Commit: "e9191fcdc2294e2f8f3b82c528fc90a8", - }, - }, - } - ctx := context.Background() - provider := storageos.NewProvider() - readBucket, err := provider.NewReadWriteBucket(filepath.Join("testdata", version, "success")) - require.NoError(t, err) - config, err := buflock.ReadConfig(ctx, readBucket) - require.NoError(t, err) - require.Equal(t, successConfig, config) - - readBucket, err = provider.NewReadWriteBucket(filepath.Join("testdata", version, "failure")) - require.NoError(t, err) - _, err = buflock.ReadConfig(ctx, readBucket) - require.Error(t, err) -} - -func TestWriteReadConfig(t *testing.T) { - t.Parallel() - tmpDir := t.TempDir() - readWriteBucket, err := storageos.NewProvider().NewReadWriteBucket(tmpDir) - require.NoError(t, err) - testConfig := &buflock.Config{ - Dependencies: []buflock.Dependency{ - { - Remote: "buf.build", - Owner: "test1", - Repository: "foob1", - Commit: bufmoduletesting.TestCommit, - }, - { - Remote: "buf.build", - Owner: "test2", - Repository: "foob2", - Commit: bufmoduletesting.TestCommit, - }, - }, - } - err = buflock.WriteConfig(context.Background(), readWriteBucket, testConfig) - require.NoError(t, err) - - readConfig, err := buflock.ReadConfig(context.Background(), readWriteBucket) - require.NoError(t, err) - require.Equal(t, testConfig, readConfig) -} - -func TestWriteReadEmptyConfig(t *testing.T) { - t.Parallel() - tmpDir := t.TempDir() - readWriteBucket, err := storageos.NewProvider().NewReadWriteBucket(tmpDir) - require.NoError(t, err) - err = buflock.WriteConfig(context.Background(), readWriteBucket, &buflock.Config{}) - require.NoError(t, err) - - readConfig, err := buflock.ReadConfig(context.Background(), readWriteBucket) - require.NoError(t, err) - require.Equal(t, &buflock.Config{}, readConfig) -} - -// TODO: Write fuzz tester for the invariant ReadConfig(WriteConfig(file)) == file. - -func TestParseV1Beta1Config(t *testing.T) { - t.Parallel() - tmpDir := t.TempDir() - readWriteBucket, err := storageos.NewProvider().NewReadWriteBucket(tmpDir) - require.NoError(t, err) - testConfig := &buflock.Config{ - Dependencies: []buflock.Dependency{ - { - Remote: "buf.build", - Owner: "test1", - Repository: "foob1", - Commit: bufmoduletesting.TestCommit, - }, - { - Remote: "buf.build", - Owner: "test2", - Repository: "foob2", - Commit: bufmoduletesting.TestCommit, - }, - }, - } - writeObjectCloser, err := readWriteBucket.Put(context.Background(), buflock.ExternalConfigFilePath) - require.NoError(t, err) - t.Cleanup(func() { - require.NoError(t, writeObjectCloser.Close()) - }) - v1beta1Config := &buflock.ExternalConfigV1Beta1{ - Deps: []buflock.ExternalConfigDependencyV1Beta1{ - buflock.ExternalConfigDependencyV1Beta1ForDependency(testConfig.Dependencies[0]), - buflock.ExternalConfigDependencyV1Beta1ForDependency(testConfig.Dependencies[1]), - }, - } - err = encoding.NewYAMLEncoder(writeObjectCloser).Encode(v1beta1Config) - require.NoError(t, err) - - readConfig, err := buflock.ReadConfig(context.Background(), readWriteBucket) - require.NoError(t, err) - require.Equal(t, testConfig, readConfig) -} - -func TestParseNoConfig(t *testing.T) { - t.Parallel() - emptyReadBucket := storagemem.NewReadWriteBucket() - readConfig, err := buflock.ReadConfig(context.Background(), emptyReadBucket) - require.NoError(t, err) - require.Empty(t, readConfig) -} - -func TestParseIncompleteConfig(t *testing.T) { - t.Parallel() - tmpDir := t.TempDir() - readWriteBucket, err := storageos.NewProvider().NewReadWriteBucket(tmpDir) - require.NoError(t, err) - testConfig := &buflock.Config{ - Dependencies: []buflock.Dependency{ - { - Remote: "buf.build", - Owner: "test1", - Repository: "foob1", - Commit: bufmoduletesting.TestCommit, - }, - }, - } - configBytes, err := encoding.MarshalYAML(&buflock.ExternalConfigV1{ - Version: buflock.V1Version, - Deps: []buflock.ExternalConfigDependencyV1{ - buflock.ExternalConfigDependencyV1ForDependency(testConfig.Dependencies[0]), - }, - }) - require.NoError(t, err) - err = storage.PutPath(context.Background(), readWriteBucket, buflock.ExternalConfigFilePath, configBytes) - require.NoError(t, err) - - readConfig, err := buflock.ReadConfig(context.Background(), readWriteBucket) - require.NoError(t, err) - require.Equal(t, testConfig, readConfig) - - err = buflock.WriteConfig(context.Background(), readWriteBucket, readConfig) - require.NoError(t, err) - - // And again after using the proper WriteConfig - readConfig, err = buflock.ReadConfig(context.Background(), readWriteBucket) - require.NoError(t, err) - require.Equal(t, testConfig, readConfig) -} - -func TestDependencyForExternalConfigDependencyV1(t *testing.T) { - t.Parallel() - digester, err := manifest.NewDigester(manifest.DigestTypeShake256) - require.NoError(t, err) - nullDigest, err := digester.Digest(&bytes.Buffer{}) - require.NoError(t, err) - testDependencyForExternalConfigDependencyV1( - t, - "typical", - buflock.ExternalConfigDependencyV1{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - Digest: nullDigest.String(), - }, - buflock.Dependency{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - Digest: nullDigest.String(), - }, - ) - testDependencyForExternalConfigDependencyV1( - t, - "no digest", - buflock.ExternalConfigDependencyV1{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - }, - buflock.Dependency{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - }, - ) - testDependencyForExternalConfigDependencyV1( - t, - "filter out b1 hash", - buflock.ExternalConfigDependencyV1{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - Digest: "b1-gLO3B_5ClhdU52w1gMOxk4GokvCoM1OqjarxMfjStGQ=", - }, - buflock.Dependency{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - }, - ) - testDependencyForExternalConfigDependencyV1( - t, - "filter out b3 hash", - buflock.ExternalConfigDependencyV1{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - Digest: "b3-j7iu4iVzYQUFr97mbq2PNAlM5UjEnjtwEas0q7g4DVM", - }, - buflock.Dependency{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - }, - ) - testDependencyForExternalConfigDependencyV1( - t, - "don't filter out non-b1/b3 invalid hashes", - buflock.ExternalConfigDependencyV1{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - Digest: "shake256:abcd", - }, - buflock.Dependency{ - Remote: "remote", - Owner: "owner", - Repository: "repository", - Commit: "aabbccd", - Digest: "shake256:abcd", - }, - ) -} - -func testDependencyForExternalConfigDependencyV1( - t *testing.T, - desc string, - in buflock.ExternalConfigDependencyV1, - expect buflock.Dependency, -) { - t.Helper() - t.Run(desc, func(t *testing.T) { - t.Parallel() - actual := buflock.DependencyForExternalConfigDependencyV1(in) - assert.Equal(t, expect, actual) - }) -} diff --git a/pkg/bufman/bufpkg/buflock/testdata/v1/failure/buf.lock b/pkg/bufman/bufpkg/buflock/testdata/v1/failure/buf.lock deleted file mode 100644 index 0d7637a3b..000000000 --- a/pkg/bufman/bufpkg/buflock/testdata/v1/failure/buf.lock +++ /dev/null @@ -1,3 +0,0 @@ -version: v1 -deps: - - remote-invalid: bufbuild.test diff --git a/pkg/bufman/bufpkg/buflock/testdata/v1/success/buf.lock b/pkg/bufman/bufpkg/buflock/testdata/v1/success/buf.lock deleted file mode 100644 index 1afa13ba5..000000000 --- a/pkg/bufman/bufpkg/buflock/testdata/v1/success/buf.lock +++ /dev/null @@ -1,10 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v1 -deps: - - remote: bufbuild.test - owner: acme - repository: weather - commit: e9191fcdc2294e2f8f3b82c528fc90a8 - branch: main - digest: b1-gLO3B_5ClhdU52w1gMOxk4GokvCoM1OqjarxMfjStGQ= - create_time: 2000-01-01T00:00:00.000000Z diff --git a/pkg/bufman/bufpkg/buflock/testdata/v1beta1/failure/buf.lock b/pkg/bufman/bufpkg/buflock/testdata/v1beta1/failure/buf.lock deleted file mode 100644 index 640afb903..000000000 --- a/pkg/bufman/bufpkg/buflock/testdata/v1beta1/failure/buf.lock +++ /dev/null @@ -1,2 +0,0 @@ -deps: - - remote-invalid: bufbuild.test diff --git a/pkg/bufman/bufpkg/buflock/testdata/v1beta1/success/buf.lock b/pkg/bufman/bufpkg/buflock/testdata/v1beta1/success/buf.lock deleted file mode 100644 index bf7359dd3..000000000 --- a/pkg/bufman/bufpkg/buflock/testdata/v1beta1/success/buf.lock +++ /dev/null @@ -1,9 +0,0 @@ -# Generated by buf. DO NOT EDIT. -deps: - - remote: bufbuild.test - owner: acme - repository: weather - commit: e9191fcdc2294e2f8f3b82c528fc90a8 - branch: main - digest: b1-gLO3B_5ClhdU52w1gMOxk4GokvCoM1OqjarxMfjStGQ= - create_time: 2000-01-01T00:00:00.000000Z diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_test.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_test.go deleted file mode 100644 index 56927a582..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_test.go +++ /dev/null @@ -1,585 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufmodulebuild - -import ( - "context" - "io" - "path/filepath" - "strings" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/bufbreaking/bufbreakingconfig" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufcheck/buflint/buflintconfig" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestBucketGetFileInfos1(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1( - bufmoduleconfig.ExternalConfigV1{ - Excludes: []string{"proto/b"}, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/1", - config, - bufmoduletesting.NewFileInfo(t, "proto/a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/c/1.proto", "testdata/1/proto/a/c/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/c/2.proto", "testdata/1/proto/a/c/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/c/3.proto", "testdata/1/proto/a/c/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), - ) -} - -func TestBucketGetFileInfos2(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1( - bufmoduleconfig.ExternalConfigV1{ - Excludes: []string{"proto/a"}, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/1", - config, - bufmoduletesting.NewFileInfo(t, "proto/b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), - ) -} - -func TestBucketGetFileInfo3(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1( - bufmoduleconfig.ExternalConfigV1{ - Excludes: []string{"proto/a/c"}, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/1", - config, - bufmoduletesting.NewFileInfo(t, "proto/a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), - ) -} - -func TestBucketGetFileInfos4(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1( - bufmoduleconfig.ExternalConfigV1{ - Excludes: []string{ - "proto/a/c", - "proto/d", - }, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/1", - config, - bufmoduletesting.NewFileInfo(t, "proto/a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), - ) -} - -func TestBucketGetAllFileInfos5(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1( - bufmoduleconfig.ExternalConfigV1{}, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/3", - config, - ) -} - -func TestConfigV1Beta1BucketGetFileInfos1(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1Beta1( - bufmoduleconfig.ExternalConfigV1Beta1{ - Roots: []string{ - "proto", - }, - Excludes: []string{ - "proto/b", - }, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/1", - config, - bufmoduletesting.NewFileInfo(t, "a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/c/1.proto", "testdata/1/proto/a/c/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/c/2.proto", "testdata/1/proto/a/c/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/c/3.proto", "testdata/1/proto/a/c/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), - ) -} - -func TestConfigV1Beta1BucketGetFileInfos2(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1Beta1( - bufmoduleconfig.ExternalConfigV1Beta1{ - Roots: []string{ - "proto", - }, - Excludes: []string{ - "proto/a", - }, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/1", - config, - bufmoduletesting.NewFileInfo(t, "b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), - ) -} - -func TestConfigV1Beta1BucketGetFileInfo3(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1Beta1( - bufmoduleconfig.ExternalConfigV1Beta1{ - Roots: []string{ - "proto", - }, - Excludes: []string{ - "proto/a/c", - }, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/1", - config, - bufmoduletesting.NewFileInfo(t, "a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), - ) -} - -func TestConfigV1Beta1BucketGetFileInfos4(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1Beta1( - bufmoduleconfig.ExternalConfigV1Beta1{ - Roots: []string{ - "proto", - }, - Excludes: []string{ - "proto/a/c", - "proto/d", - }, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/1", - config, - bufmoduletesting.NewFileInfo(t, "a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), - ) -} - -func TestConfigV1Beta1BucketGetAllFileInfos5(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1Beta1( - bufmoduleconfig.ExternalConfigV1Beta1{ - Roots: []string{ - ".", - }, - }, - ) - require.NoError(t, err) - testBucketGetFileInfos( - t, - "testdata/3", - config, - ) -} - -func TestConfigV1Beta1BucketGetAllFileInfosError1(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1Beta1( - bufmoduleconfig.ExternalConfigV1Beta1{ - Roots: []string{ - "a", - "b", - }, - }, - ) - require.NoError(t, err) - testBucketGetAllFileInfosError( - t, - "testdata/2", - config, - nil, - ) -} - -func TestConfigV1Beta1BucketGetFileInfosForExternalPathsError1(t *testing.T) { - t.Parallel() - config, err := bufmoduleconfig.NewConfigV1Beta1( - bufmoduleconfig.ExternalConfigV1Beta1{ - Roots: []string{ - "a", - "b", - }, - }, - ) - require.NoError(t, err) - testBucketGetFileInfosForExternalPathsError( - t, - "testdata/2", - config, - []string{ - "testdata/2/a/1.proto", - "testdata/2/a/2.proto", - "testdata/2/a/3.proto", - "testdata/2/b/1.proto", - "testdata/2/b/4.proto", - }, - ) -} - -func TestDocumentation(t *testing.T) { - t.Parallel() - testDocumentationBucket( - t, - "testdata/4", - bufmodule.DefaultDocumentationPath, - bufmoduletesting.NewFileInfo(t, "proto/1.proto", "testdata/4/proto/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/4/proto/a/2.proto", false, nil, ""), - ) -} - -func TestLicense(t *testing.T) { - t.Parallel() - testLicenseBucket( - t, - "testdata/5", - "Test Module License", - bufmoduletesting.NewFileInfo(t, "proto/1.proto", "testdata/5/proto/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/5/proto/a/2.proto", false, nil, ""), - ) -} - -func TestConfigInclusion(t *testing.T) { - t.Parallel() - t.Run("buf.yaml", func(t *testing.T) { - t.Parallel() - testConfigInclusion(t, "buf.yaml") - }) - t.Run("buf.mod", func(t *testing.T) { - t.Parallel() - testConfigInclusion(t, "buf.mod") - }) -} - -func testConfigInclusion(t *testing.T, confname string) { - // bucket creation - bufyaml := ` -version: v1 -breaking: - ignore_unstable_packages: true -lint: - allow_comment_ignores: true -` - ctx := context.Background() - bucket, err := memBucket(ctx, - confname, bufyaml, - "a/1.proto", "", - ) - require.NoError(t, err) - - // build - config, err := bufmoduleconfig.NewConfigV1( - bufmoduleconfig.ExternalConfigV1{}, - ) - require.NoError(t, err) - module, err := NewModuleBucketBuilder().BuildForBucket( - ctx, - bucket, - config, - ) - require.NoError(t, err) - require.NotNil(t, module) - - // assert: one proto consumed - fileInfos, err := module.TargetFileInfos(ctx) - assert.NoError(t, err) - assert.Len(t, fileInfos, 1) - - // assert: breaking and lint configuration exists - zeroBreaking := bufbreakingconfig.NewConfigV1( - bufbreakingconfig.ExternalConfigV1{}, - ) - assert.NotEqual(t, zeroBreaking, module.BreakingConfig(), "empty BreakingConfig") - zeroLint := buflintconfig.NewConfigV1( - buflintconfig.ExternalConfigV1{}, - ) - assert.NotEqual(t, zeroLint, module.LintConfig(), "empty LintConfig") -} - -func memBucket(ctx context.Context, pathcontent ...string) (storage.ReadBucket, error) { - membucket := storagemem.NewReadWriteBucket() - for i := 0; i < len(pathcontent); i += 2 { - fh, err := membucket.Put(ctx, pathcontent[i]) - if err != nil { - return nil, err - } - _, err = io.Copy(fh, strings.NewReader(pathcontent[i+1])) - if err != nil { - return nil, err - } - fh.Close() - } - return membucket, nil -} - -func testBucketGetFileInfos( - t *testing.T, - relDir string, - config *bufmoduleconfig.Config, - expectedFileInfos ...bufmoduleref.FileInfo, -) { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - relDir, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - module, err := NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config, - ) - require.NoError(t, err) - fileInfos, err := module.SourceFileInfos(context.Background()) - assert.NoError(t, err) - assert.Equal( - t, - expectedFileInfos, - fileInfos, - ) - if len(expectedFileInfos) > 1 { - expectedFileInfos = expectedFileInfos[:len(expectedFileInfos)-1] - bucketRelPaths := make([]string, len(expectedFileInfos)) - for i, expectedFileInfo := range expectedFileInfos { - bucketRelExternalPath, err := filepath.Rel(relDir, expectedFileInfo.ExternalPath()) - require.NoError(t, err) - bucketRelPath, err := normalpath.NormalizeAndValidate(bucketRelExternalPath) - require.NoError(t, err) - bucketRelPaths[i] = bucketRelPath - } - module, err := NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config, - WithPaths(bucketRelPaths), - ) - require.NoError(t, err) - fileInfos, err := module.TargetFileInfos(context.Background()) - assert.NoError(t, err) - assert.Equal( - t, - expectedFileInfos, - fileInfos, - ) - } -} - -func testBucketGetAllFileInfosError( - t *testing.T, - relDir string, - config *bufmoduleconfig.Config, - expectedSpecificError error, -) { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - relDir, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - module, err := NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config, - ) - require.NoError(t, err) - _, err = module.SourceFileInfos(context.Background()) - if expectedSpecificError != nil { - assert.Equal(t, expectedSpecificError, err) - } else { - assert.Error(t, err) - } -} - -func testBucketGetFileInfosForExternalPathsError( - t *testing.T, - relDir string, - config *bufmoduleconfig.Config, - externalPaths []string, -) { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - relDir, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - bucketRelPaths := make([]string, len(externalPaths)) - for i, externalPath := range externalPaths { - bucketRelExternalPath, err := filepath.Rel(relDir, externalPath) - require.NoError(t, err) - bucketRelPath, err := normalpath.NormalizeAndValidate(bucketRelExternalPath) - require.NoError(t, err) - bucketRelPaths[i] = bucketRelPath - } - _, err = NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config, - WithPaths(bucketRelPaths), - ) - assert.Error(t, err) -} - -func testDocumentationBucket( - t *testing.T, - relDir string, - expectedDocPath string, - expectedFileInfos ...bufmoduleref.FileInfo, -) { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - relDir, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - config, err := bufmoduleconfig.NewConfigV1( - bufmoduleconfig.ExternalConfigV1{}, - ) - require.NoError(t, err) - module, err := NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config, - ) - require.NoError(t, err) - require.NotNil(t, module) - assert.NotEmpty(t, module.Documentation()) - assert.Equal(t, expectedDocPath, module.DocumentationPath()) - fileInfos, err := module.TargetFileInfos(context.Background()) - assert.NoError(t, err) - assert.Equal( - t, - expectedFileInfos, - fileInfos, - ) -} - -func testLicenseBucket( - t *testing.T, - relDir string, - expectedLicense string, - expectedFileInfos ...bufmoduleref.FileInfo, -) { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - relDir, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - config, err := bufmoduleconfig.NewConfigV1( - bufmoduleconfig.ExternalConfigV1{}, - ) - require.NoError(t, err) - module, err := NewModuleBucketBuilder().BuildForBucket( - context.Background(), - readWriteBucket, - config, - ) - require.NoError(t, err) - require.NotNil(t, module) - assert.NotEmpty(t, module.License()) - assert.Equal(t, expectedLicense, module.License()) - fileInfos, err := module.TargetFileInfos(context.Background()) - assert.NoError(t, err) - assert.Equal( - t, - expectedFileInfos, - fileInfos, - ) -} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_unix_test.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_unix_test.go deleted file mode 100644 index 21444b684..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_bucket_builder_unix_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris - -package bufmodulebuild - -import ( - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" -) - -func TestLicenseSymlink(t *testing.T) { - t.Parallel() - testLicenseBucket( - t, - "testdata/6", - "Test Module License", // expecting the same license with testdata/5 as it symlink to the license there - bufmoduletesting.NewFileInfo(t, "proto/1.proto", "testdata/6/proto/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "proto/a/2.proto", "testdata/6/proto/a/2.proto", false, nil, ""), - ) -} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder_test.go b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder_test.go deleted file mode 100644 index a94c283a7..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/module_include_builder_test.go +++ /dev/null @@ -1,200 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufmodulebuild - -import ( - "context" - "fmt" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduletesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestIncludeGetFileInfos1(t *testing.T) { - t.Parallel() - testIncludeGetFileInfos( - t, - "testdata/1", - []string{ - "proto", - }, - bufmoduletesting.NewFileInfo(t, "a/1.proto", "testdata/1/proto/a/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/2.proto", "testdata/1/proto/a/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/3.proto", "testdata/1/proto/a/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/c/1.proto", "testdata/1/proto/a/c/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/c/2.proto", "testdata/1/proto/a/c/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "a/c/3.proto", "testdata/1/proto/a/c/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/1.proto", "testdata/1/proto/b/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/2.proto", "testdata/1/proto/b/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "b/3.proto", "testdata/1/proto/b/3.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/1.proto", "testdata/1/proto/d/1.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/2.proto", "testdata/1/proto/d/2.proto", false, nil, ""), - bufmoduletesting.NewFileInfo(t, "d/3.proto", "testdata/1/proto/d/3.proto", false, nil, ""), - ) -} - -func TestIncludeGetFileInfos2(t *testing.T) { - t.Parallel() - testIncludeGetFileInfos( - t, - "testdata/3", - []string{ - ".", - }, - ) -} - -func TestIncludeGetFileInfosForExternalPathsError1(t *testing.T) { - t.Parallel() - testIncludeGetFileInfosForExternalPathsError( - t, - "testdata/2", - []string{ - "a", - "b", - }, - []string{ - "testdata/2/a/1.proto", - "testdata/2/a/2.proto", - "testdata/2/a/3.proto", - "testdata/2/b/1.proto", - "testdata/2/b/4.proto", - }, - ) -} - -func testIncludeGetFileInfos( - t *testing.T, - relDir string, - relRoots []string, - expectedFileInfos ...bufmoduleref.FileInfo, -) { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - for _, isAbs := range []bool{true, false} { - isAbs := isAbs - expectedFileInfos := expectedFileInfos - if isAbs { - expectedFileInfos = fileInfosToAbs(t, expectedFileInfos) - } - t.Run(fmt.Sprintf("abs=%v", isAbs), func(t *testing.T) { - t.Parallel() - includeDirPaths := testIncludeDirPaths(t, relDir, relRoots, isAbs) - module, err := NewModuleIncludeBuilder(zap.NewNop(), storageosProvider).BuildForIncludes( - context.Background(), - includeDirPaths, - ) - require.NoError(t, err) - fileInfos, err := module.SourceFileInfos(context.Background()) - assert.NoError(t, err) - assert.Equal( - t, - expectedFileInfos, - fileInfos, - ) - if len(expectedFileInfos) > 1 { - expectedFileInfos = expectedFileInfos[:len(expectedFileInfos)-1] - filePaths := make([]string, len(expectedFileInfos)) - for i := 0; i < len(expectedFileInfos); i++ { - filePaths[i] = expectedFileInfos[i].ExternalPath() - } - module, err := NewModuleIncludeBuilder(zap.NewNop(), storageosProvider).BuildForIncludes( - context.Background(), - includeDirPaths, - WithPaths(filePaths), - ) - require.NoError(t, err) - fileInfos, err := module.TargetFileInfos(context.Background()) - assert.NoError(t, err) - assert.Equal( - t, - expectedFileInfos, - fileInfos, - ) - } - }) - } -} - -func testIncludeGetFileInfosForExternalPathsError( - t *testing.T, - relDir string, - relRoots []string, - externalPaths []string, -) { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - for _, isAbs := range []bool{true, false} { - isAbs := isAbs - t.Run(fmt.Sprintf("abs=%v", isAbs), func(t *testing.T) { - t.Parallel() - includeDirPaths := testIncludeDirPaths(t, relDir, relRoots, isAbs) - _, err := NewModuleIncludeBuilder(zap.NewNop(), storageosProvider).BuildForIncludes( - context.Background(), - includeDirPaths, - WithPaths(externalPaths), - ) - assert.Error(t, err) - }) - } -} - -func testIncludeDirPaths( - t *testing.T, - relDir string, - relRoots []string, - isAbs bool, -) []string { - includeDirPaths := make([]string, len(relRoots)) - for i, relRoot := range relRoots { - includeDirPaths[i] = normalpath.Unnormalize(normalpath.Join(relDir, relRoot)) - } - if isAbs { - for i, includeDirPath := range includeDirPaths { - absIncludeDirPath, err := filepath.Abs(includeDirPath) - require.NoError(t, err) - includeDirPaths[i] = absIncludeDirPath - } - } - return includeDirPaths -} - -// fileInfosToAbs converts the external paths to absolute. -func fileInfosToAbs(t *testing.T, fileInfos []bufmoduleref.FileInfo) []bufmoduleref.FileInfo { - if fileInfos == nil { - return nil - } - newFileInfos := make([]bufmoduleref.FileInfo, len(fileInfos)) - for i, fileInfo := range fileInfos { - absExternalPath, err := normalpath.NormalizeAndAbsolute(fileInfo.ExternalPath()) - require.NoError(t, err) - newFileInfo := bufmoduletesting.NewFileInfo( - t, - fileInfo.Path(), - absExternalPath, - fileInfo.IsImport(), - nil, - "", - ) - newFileInfos[i] = newFileInfo - } - return newFileInfos -} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/2.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/2.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/3.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/3.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/2.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/2.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/3.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/a/c/3.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/2.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/2.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/3.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/b/3.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/2.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/2.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/3.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/1/proto/d/3.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/2.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/2.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/3.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/3.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/a/3.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/4.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/4.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/4.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/5.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/5.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/2/b/5.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/3/nop b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/3/nop deleted file mode 100644 index e69de29bb..000000000 diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/buf.md b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/buf.md deleted file mode 100644 index d2e86f30f..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/buf.md +++ /dev/null @@ -1 +0,0 @@ -# Test Module Documentation diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/a/2.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/4/proto/a/2.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/LICENSE b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/LICENSE deleted file mode 100644 index f07de0e8e..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/LICENSE +++ /dev/null @@ -1 +0,0 @@ -Test Module License \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/a/2.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/5/proto/a/2.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/LICENSE b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/LICENSE deleted file mode 100644 index 0f3baae22..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../5/LICENSE \ No newline at end of file diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/1.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/1.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/1.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/a/2.proto b/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/a/2.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulebuild/testdata/6/proto/a/2.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go index 7eb8c7333..1493a4283 100644 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go @@ -18,8 +18,10 @@ package bufmodulecache import ( "context" "fmt" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" + "github.com/bufbuild/connect-go" "go.uber.org/zap" ) diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go deleted file mode 100644 index d1725aac9..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go +++ /dev/null @@ -1,389 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufpluginconfig - -import ( - "context" - "math" - "os" - "path/filepath" - "sort" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufplugin/bufpluginref" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" -) - -func TestGetConfigForBucket(t *testing.T) { - t.Parallel() - storageosProvider := storageos.NewProvider() - readWriteBucket, err := storageosProvider.NewReadWriteBucket(filepath.Join("testdata", "success", "go")) - require.NoError(t, err) - pluginConfig, err := GetConfigForBucket(context.Background(), readWriteBucket) - require.NoError(t, err) - pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/library/go-grpc") - require.NoError(t, err) - pluginDependency, err := bufpluginref.PluginReferenceForString("buf.build/library/go:v1.28.0", 1) - require.NoError(t, err) - require.Equal( - t, - &Config{ - Name: pluginIdentity, - PluginVersion: "v1.2.0", - SourceURL: "https://github.com/grpc/grpc-go", - Description: "Generates Go language bindings of services in protobuf definition files for gRPC.", - Dependencies: []bufpluginref.PluginReference{ - pluginDependency, - }, - OutputLanguages: []string{"go"}, - Registry: &RegistryConfig{ - Go: &GoRegistryConfig{ - MinVersion: "1.18", - Deps: []*GoRegistryDependencyConfig{ - { - Module: "google.golang.org/grpc", - Version: "v1.32.0", - }, - }, - }, - Options: map[string]string{ - "separate_package": "true", - }, - }, - SPDXLicenseID: "Apache-2.0", - LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE", - }, - pluginConfig, - ) -} - -func TestParsePluginConfigGoYAML(t *testing.T) { - t.Parallel() - pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "go", "buf.plugin.yaml")) - require.NoError(t, err) - pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/library/go-grpc") - require.NoError(t, err) - pluginDependency, err := bufpluginref.PluginReferenceForString("buf.build/library/go:v1.28.0", 1) - require.NoError(t, err) - require.Equal( - t, - &Config{ - Name: pluginIdentity, - PluginVersion: "v1.2.0", - SourceURL: "https://github.com/grpc/grpc-go", - Description: "Generates Go language bindings of services in protobuf definition files for gRPC.", - Dependencies: []bufpluginref.PluginReference{ - pluginDependency, - }, - OutputLanguages: []string{"go"}, - Registry: &RegistryConfig{ - Go: &GoRegistryConfig{ - MinVersion: "1.18", - Deps: []*GoRegistryDependencyConfig{ - { - Module: "google.golang.org/grpc", - Version: "v1.32.0", - }, - }, - }, - Options: map[string]string{ - "separate_package": "true", - }, - }, - SPDXLicenseID: "Apache-2.0", - LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE", - }, - pluginConfig, - ) -} - -func TestParsePluginConfigGoYAMLOverrideRemote(t *testing.T) { - t.Parallel() - pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "go", "buf.plugin.yaml"), WithOverrideRemote("buf.mydomain.com")) - require.NoError(t, err) - pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.mydomain.com/library/go-grpc") - require.NoError(t, err) - pluginDependency, err := bufpluginref.PluginReferenceForString("buf.mydomain.com/library/go:v1.28.0", 1) - require.NoError(t, err) - assert.Equal(t, pluginIdentity, pluginConfig.Name) - require.Len(t, pluginConfig.Dependencies, 1) - assert.Equal(t, pluginDependency, pluginConfig.Dependencies[0]) -} - -func TestParsePluginConfigNPMYAML(t *testing.T) { - t.Parallel() - pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "npm", "buf.plugin.yaml")) - require.NoError(t, err) - pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/protocolbuffers/js") - require.NoError(t, err) - require.Equal( - t, - &Config{ - Name: pluginIdentity, - PluginVersion: "v1.0.0", - OutputLanguages: []string{"typescript"}, - Registry: &RegistryConfig{ - NPM: &NPMRegistryConfig{ - ImportStyle: "commonjs", - Deps: []*NPMRegistryDependencyConfig{ - { - Package: "grpc-web", - Version: "^1.3.1", - }, - { - Package: "@types/google-protobuf", - Version: "^3.15.6", - }, - }, - }, - }, - SPDXLicenseID: "BSD-3-Clause", - }, - pluginConfig, - ) -} - -func TestParsePluginConfigMavenYAML(t *testing.T) { - t.Parallel() - pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "maven", "buf.plugin.yaml")) - require.NoError(t, err) - pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/grpc/java") - require.NoError(t, err) - pluginDep, err := bufpluginref.PluginReferenceForString("buf.build/protocolbuffers/java:v22.2", 0) - require.NoError(t, err) - require.Equal( - t, - &Config{ - Name: pluginIdentity, - Dependencies: []bufpluginref.PluginReference{pluginDep}, - PluginVersion: "v1.0.0", - OutputLanguages: []string{"java"}, - Registry: &RegistryConfig{ - Maven: &MavenRegistryConfig{ - Compiler: MavenCompilerConfig{ - Java: MavenCompilerJavaConfig{ - Encoding: "UTF-8", - Release: 11, - Source: 8, - Target: 17, - }, - Kotlin: MavenCompilerKotlinConfig{ - APIVersion: "1.8", - JVMTarget: "9", - LanguageVersion: "1.7", - Version: "1.8.0", - }, - }, - Deps: []MavenDependencyConfig{ - { - GroupID: "io.grpc", - ArtifactID: "grpc-core", - Version: "1.52.1", - }, - { - GroupID: "io.grpc", - ArtifactID: "grpc-protobuf", - Version: "1.52.1", - }, - { - GroupID: "io.grpc", - ArtifactID: "grpc-stub", - Version: "1.52.1", - }, - { - GroupID: "io.grpc", - ArtifactID: "protoc-gen-grpc-java", - Version: "1.52.1", - Classifier: "linux-x86_64", - Extension: "exe", - }, - }, - AdditionalRuntimes: []MavenRuntimeConfig{ - { - Name: "lite", - Deps: []MavenDependencyConfig{ - { - GroupID: "io.grpc", - ArtifactID: "grpc-core", - Version: "1.52.1", - }, - { - GroupID: "io.grpc", - ArtifactID: "grpc-protobuf-lite", - Version: "1.52.1", - }, - { - GroupID: "io.grpc", - ArtifactID: "grpc-stub", - Version: "1.52.1", - }, - { - GroupID: "io.grpc", - ArtifactID: "protoc-gen-grpc-java", - Version: "1.52.1", - Classifier: "linux-x86_64", - Extension: "exe", - }, - }, - Options: []string{ - "lite", - }, - }, - }, - }, - }, - SPDXLicenseID: "BSD-3-Clause", - }, - pluginConfig, - ) -} - -func TestParsePluginConfigSwiftYAML(t *testing.T) { - t.Parallel() - pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "swift", "buf.plugin.yaml")) - require.NoError(t, err) - pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/bufbuild/connect-swift") - require.NoError(t, err) - pluginDep, err := bufpluginref.PluginReferenceForString("buf.build/apple/swift:v1.21.0", 0) - require.NoError(t, err) - require.Equal( - t, - &Config{ - Name: pluginIdentity, - PluginVersion: "v0.5.0", - SourceURL: "https://github.com/bufbuild/connect-swift", - Description: "Idiomatic gRPC & Connect RPCs for Swift.", - Dependencies: []bufpluginref.PluginReference{pluginDep}, - OutputLanguages: []string{"swift"}, - Registry: &RegistryConfig{ - Swift: &SwiftRegistryConfig{ - Dependencies: []SwiftRegistryDependencyConfig{ - { - Source: "https://github.com/apple/swift-protobuf.git", - Package: "swift-protobuf", - Version: "1.21.0", - Products: []string{"SwiftProtobuf"}, - SwiftVersions: []string{".v5"}, - Platforms: SwiftRegistryDependencyPlatformConfig{ - MacOS: "v10_15", - IOS: "v10_15", - TVOS: "v10_15", - WatchOS: "v10_15", - }, - }, - }, - }, - }, - SPDXLicenseID: "Apache-2.0", - LicenseURL: "https://github.com/bufbuild/connect-swift/blob/0.5.0/LICENSE", - }, - pluginConfig, - ) -} - -func TestParsePluginConfigOptionsYAML(t *testing.T) { - t.Parallel() - pluginConfig, err := ParseConfig(filepath.Join("testdata", "success", "options", "buf.plugin.yaml")) - require.NoError(t, err) - pluginIdentity, err := bufpluginref.PluginIdentityForString("buf.build/protocolbuffers/java") - require.NoError(t, err) - require.Equal( - t, - &Config{ - Name: pluginIdentity, - PluginVersion: "v2.0.0", - }, - pluginConfig, - ) -} - -func TestParsePluginConfigMultipleRegistryConfigsYAML(t *testing.T) { - t.Parallel() - _, err := ParseConfig(filepath.Join("testdata", "failure", "invalid-multiple-registries.yaml")) - require.Error(t, err) -} - -func TestParsePluginConfigEmptyVersionYAML(t *testing.T) { - t.Parallel() - _, err := ParseConfig(filepath.Join("testdata", "failure", "invalid-empty-version.yaml")) - require.Error(t, err) -} - -func TestParsePluginConfigGoNoDepsOrMinVersion(t *testing.T) { - t.Parallel() - cfg, err := ParseConfig(filepath.Join("testdata", "success", "go-empty-registry", "buf.plugin.yaml")) - require.NoError(t, err) - assert.NotNil(t, cfg.Registry) - assert.NotNil(t, cfg.Registry.Go) - assert.Equal(t, &GoRegistryConfig{}, cfg.Registry.Go) -} - -func TestPluginOptionsRoundTrip(t *testing.T) { - t.Parallel() - assertPluginOptionsRoundTrip(t, nil) - assertPluginOptionsRoundTrip(t, map[string]string{}) - assertPluginOptionsRoundTrip(t, map[string]string{ - "option-1": "value-1", - "option-2": "value-2", - "option-no-value-3": "", - }) -} - -func assertPluginOptionsRoundTrip(t testing.TB, options map[string]string) { - optionsSlice := PluginOptionsToOptionsSlice(options) - assert.True(t, sort.SliceIsSorted(optionsSlice, func(i, j int) bool { - return optionsSlice[i] < optionsSlice[j] - })) - assert.Equal(t, options, OptionsSliceToPluginOptions(optionsSlice)) -} - -func TestGetConfigForDataInvalidDependency(t *testing.T) { - t.Parallel() - validConfig, err := os.ReadFile(filepath.Join("testdata", "success", "go", "buf.plugin.yaml")) - require.NoError(t, err) - // Valid dependencies - verifyDependencies(t, validConfig, false, ExternalDependency{Plugin: "buf.build/library/go:v1.27.1"}) - verifyDependencies(t, validConfig, false, ExternalDependency{Plugin: "buf.build/library/go:v1.27.1-rc.1"}) - // Invalid dependencies - verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "library/go:v1.28.0"}) - verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go"}) - verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "other.buf.build/library/go:v1.28.0"}) - verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go:1.28.0"}) - verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go:v1.28.0", Revision: -1}) - verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go:v1.28.0", Revision: math.MaxInt32 + 1}) - // duplicate dependencies (doesn't matter if version differs) - verifyDependencies(t, validConfig, true, ExternalDependency{Plugin: "buf.build/library/go:v1.28.0"}, ExternalDependency{Plugin: "buf.build/library/go:v1.27.0", Revision: 1}) -} - -func verifyDependencies(t testing.TB, validConfigBytes []byte, fail bool, invalidDependencies ...ExternalDependency) { - t.Helper() - // make a defensive copy of a valid parsed config - var cloned *ExternalConfig - err := yaml.Unmarshal(validConfigBytes, &cloned) - require.NoError(t, err) - cloned.Deps = append([]ExternalDependency{}, invalidDependencies...) - yamlBytes, err := yaml.Marshal(cloned) - require.NoError(t, err) - _, err = GetConfigForData(context.Background(), yamlBytes) - if fail { - assert.Error(t, err) - } else { - assert.NoError(t, err) - } -} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-plugin-version.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-plugin-version.yaml deleted file mode 100644 index a6681bde5..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-plugin-version.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/protocolbuffers/go diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-version.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-version.yaml deleted file mode 100644 index 0e2b1b9aa..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-empty-version.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: -name: buf.build/protocolbuffers/go -plugin_version: v1.5.0 diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-multiple-registries.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-multiple-registries.yaml deleted file mode 100644 index a424e33a8..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-multiple-registries.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/protocolbuffers/go -plugin_version: v1.5.0 -registry: - npm: - deps: - - package: @types/google-protobuf - version: ^3.15.6 - go: - min_version: 1.18 - maven: - deps: - - group_id: "io.grpc" - artifact_id: "grpc-protobuf" - version: "1.52.1" diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-plugin-version.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-plugin-version.yaml deleted file mode 100644 index 4911d7ae3..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/failure/invalid-plugin-version.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/protocolbuffers/go -plugin_version: foo diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go-empty-registry/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go-empty-registry/buf.plugin.yaml deleted file mode 100644 index 9d1e04cbd..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go-empty-registry/buf.plugin.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/library/go -plugin_version: v1.28.1 -output_languages: [go] -registry: - go: {} diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go/buf.plugin.yaml deleted file mode 100644 index 6310777b5..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/go/buf.plugin.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/library/go-grpc -plugin_version: v1.2.0 -source_url: https://github.com/grpc/grpc-go -description: Generates Go language bindings of services in protobuf definition files for gRPC. -deps: - - plugin: buf.build/library/go:v1.28.0 - revision: 1 -output_languages: [go] -registry: - go: - min_version: 1.18 - deps: - - module: google.golang.org/grpc - version: v1.32.0 - opts: - - separate_package=true -spdx_license_id: Apache-2.0 -license_url: https://github.com/grpc/grpc-go/blob/master/LICENSE diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/maven/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/maven/buf.plugin.yaml deleted file mode 100644 index e917913ea..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/maven/buf.plugin.yaml +++ /dev/null @@ -1,49 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/grpc/java -plugin_version: v1.0.0 -output_languages: [java] -deps: - - plugin: buf.build/protocolbuffers/java:v22.2 -registry: - maven: - compiler: - java: - encoding: UTF-8 - release: 11 - source: 8 - target: 17 - kotlin: - api_version: 1.8 - jvm_target: 9 - language_version: 1.7 - version: 1.8.0 - deps: - - "io.grpc:grpc-core:1.52.1" - - "io.grpc:grpc-protobuf:1.52.1" - - "io.grpc:grpc-stub:1.52.1" - - "io.grpc:protoc-gen-grpc-java:1.52.1:linux-x86_64@exe" - additional_runtimes: - - name: lite - deps: - - "io.grpc:grpc-core:1.52.1" - - "io.grpc:grpc-protobuf-lite:1.52.1" - - "io.grpc:grpc-stub:1.52.1" - - "io.grpc:protoc-gen-grpc-java:1.52.1:linux-x86_64@exe" - opts: - - lite -spdx_license_id: bsd-3-clause diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/npm/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/npm/buf.plugin.yaml deleted file mode 100644 index ebfd62989..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/npm/buf.plugin.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/protocolbuffers/js -plugin_version: v1.0.0 -output_languages: [typescript] -registry: - npm: - import_style: commonjs - deps: - - package: "grpc-web" - version: "^1.3.1" - - package: "@types/google-protobuf" - version: "^3.15.6" -spdx_license_id: bsd-3-clause diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/options/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/options/buf.plugin.yaml deleted file mode 100644 index 1f6241b57..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/options/buf.plugin.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/protocolbuffers/java -plugin_version: v2.0.0 diff --git a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/swift/buf.plugin.yaml b/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/swift/buf.plugin.yaml deleted file mode 100644 index 66c38bf09..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufpluginconfig/testdata/success/swift/buf.plugin.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: v1 -name: buf.build/bufbuild/connect-swift -plugin_version: v0.5.0 -source_url: https://github.com/bufbuild/connect-swift -description: Idiomatic gRPC & Connect RPCs for Swift. -deps: - - plugin: buf.build/apple/swift:v1.21.0 -output_languages: - - swift -registry: - swift: - deps: - - source: https://github.com/apple/swift-protobuf.git - package: swift-protobuf - products: [SwiftProtobuf] - version: 1.21.0 - swift_versions: [".v5"] - platforms: - macos: v10_15 - ios: v10_15 - tvos: v10_15 - watchos: v10_15 -spdx_license_id: Apache-2.0 -license_url: https://github.com/bufbuild/connect-swift/blob/0.5.0/LICENSE diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker_test.go b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker_test.go deleted file mode 100644 index 8c7d20d40..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/docker_test.go +++ /dev/null @@ -1,292 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufplugindocker - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" - "net/http/httptest" - "os" - "os/exec" - "path/filepath" - "regexp" - "runtime" - "strings" - "sync" - "testing" - "time" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" - "github.com/docker/docker/api/types" - "github.com/docker/docker/client" - "github.com/docker/docker/pkg/jsonmessage" - "github.com/docker/docker/pkg/stringid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "golang.org/x/net/http2" - "golang.org/x/net/http2/h2c" -) - -const ( - dockerVersion = "1.41" -) - -var imagePattern = regexp.MustCompile("^(?P[^/]+/[^/]+/[^/:]+)(?::(?P[^/]+))?(?:/(?P[^/]+))?$") - -func TestPushSuccess(t *testing.T) { - t.Parallel() - server := newDockerServer(t, dockerVersion) - listenerAddr := server.httpServer.Listener.Addr().String() - dockerClient := createClient(t, WithHost("tcp://"+listenerAddr), WithVersion(dockerVersion)) - image, err := buildDockerPlugin(t, "testdata/success/Dockerfile", listenerAddr+"/library/go") - require.Nilf(t, err, "failed to build docker plugin") - require.NotEmpty(t, image) - pushResponse, err := dockerClient.Push(context.Background(), image, &RegistryAuthConfig{}) - require.Nilf(t, err, "failed to push docker plugin") - require.NotNil(t, pushResponse) - assert.NotEmpty(t, pushResponse.Digest) -} - -func TestPushError(t *testing.T) { - t.Parallel() - server := newDockerServer(t, dockerVersion) - // Send back an error on ImagePush (still return 200 OK). - server.pushErr = errors.New("failed to push image") - listenerAddr := server.httpServer.Listener.Addr().String() - dockerClient := createClient(t, WithHost("tcp://"+listenerAddr), WithVersion(dockerVersion)) - image, err := buildDockerPlugin(t, "testdata/success/Dockerfile", listenerAddr+"/library/go") - require.Nilf(t, err, "failed to build docker plugin") - require.NotEmpty(t, image) - _, err = dockerClient.Push(context.Background(), image, &RegistryAuthConfig{}) - require.NotNil(t, err, "expected error") - assert.Equal(t, server.pushErr.Error(), err.Error()) -} - -func TestMain(m *testing.M) { - var dockerEnabled bool - if cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()); err == nil { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - if _, err := cli.Ping(ctx); err == nil { - dockerEnabled = true - } - _ = cli.Close() - } - if dockerEnabled && runtime.GOOS == "windows" { - // Windows runners don't support building Linux images - need to disable for now. - dockerEnabled = false - } - // call flag.Parse() here if TestMain uses flags - if dockerEnabled { - os.Exit(m.Run()) - } -} - -func createClient(t testing.TB, options ...ClientOption) Client { - t.Helper() - logger, err := zap.NewDevelopment() - require.Nilf(t, err, "failed to create zap logger") - dockerClient, err := NewClient(logger, "buf-cli-1.11.0", options...) - require.Nilf(t, err, "failed to create client") - t.Cleanup(func() { - if err := dockerClient.Close(); err != nil { - t.Errorf("failed to close client: %v", err) - } - }) - return dockerClient -} - -func buildDockerPlugin(t testing.TB, dockerfilePath string, pluginIdentity string) (string, error) { - t.Helper() - docker, err := exec.LookPath("docker") - if err != nil { - return "", err - } - imageName := fmt.Sprintf("%s:%s", pluginIdentity, stringid.GenerateRandomID()) - cmd := command.NewRunner() - envContainer, err := app.NewEnvContainerForOS() - require.NoError(t, err) - if err := cmd.Run( - context.Background(), - docker, - command.RunWithArgs("build", "-t", imageName, "."), - command.RunWithDir(filepath.Dir(dockerfilePath)), - command.RunWithStdout(os.Stdout), - command.RunWithStderr(os.Stderr), - command.RunWithEnv(app.EnvironMap(envContainer)), - ); err != nil { - return "", err - } - t.Logf("created image: %s", imageName) - t.Cleanup(func() { - if err := cmd.Run( - context.Background(), - docker, - command.RunWithArgs("rmi", "--force", imageName), - command.RunWithDir(filepath.Dir(dockerfilePath)), - command.RunWithStdout(os.Stdout), - command.RunWithStderr(os.Stderr), - ); err != nil { - t.Logf("failed to remove temporary docker image: %v", err) - } - }) - return imageName, nil -} - -// dockerServer allows testing some failure flows by simulating the responses to Docker CLI commands. -type dockerServer struct { - httpServer *httptest.Server - h2Server *http2.Server - h2Handler http.Handler - t testing.TB - versionPrefix string - pushErr error - // protects builtImages - mu sync.RWMutex - pushedImages map[string]*pushedImage -} - -type pushedImage struct { - tags []string -} - -func newDockerServer(t testing.TB, version string) *dockerServer { - t.Helper() - versionPrefix := "/v" + version - dockerServer := &dockerServer{ - t: t, - pushedImages: make(map[string]*pushedImage), - versionPrefix: versionPrefix, - } - mux := http.NewServeMux() - mux.HandleFunc(versionPrefix+"/images/", dockerServer.imagesHandler) - mux.HandleFunc("/_ping", func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "application/json") - if err := json.NewEncoder(w).Encode(&types.Ping{APIVersion: version}); err != nil { - t.Fatalf("failed to encode response: %v", err) - } - }) - dockerServer.h2Server = &http2.Server{} - dockerServer.h2Handler = h2c.NewHandler(mux, dockerServer.h2Server) - dockerServer.httpServer = httptest.NewUnstartedServer(dockerServer.h2Handler) - dockerServer.httpServer.Start() - t.Cleanup(dockerServer.httpServer.Close) - return dockerServer -} - -func (d *dockerServer) imagesHandler(w http.ResponseWriter, r *http.Request) { - if _, err := io.Copy(io.Discard, r.Body); err != nil { - d.t.Error("failed to discard body:", err) - } - pathSuffix := strings.TrimPrefix(r.URL.Path, d.versionPrefix+"/images/") - submatches := imagePattern.FindStringSubmatch(pathSuffix) - if len(submatches) == 0 { - w.WriteHeader(http.StatusBadRequest) - return - } - image, tag, operation := submatches[1], submatches[2], submatches[3] - // ImageInspectWithRaw - if r.Method == http.MethodGet && operation == "json" { - d.mu.RLock() - defer d.mu.RUnlock() - foundImageID := d.findImageIDFromName(image + ":" + tag) - if len(foundImageID) == 0 { - http.NotFound(w, r) - return - } - if err := json.NewEncoder(w).Encode(&types.ImageInspect{ - ID: "sha256:" + foundImageID, - RepoTags: d.pushedImages[foundImageID].tags, - }); err != nil { - d.t.Error("failed to encode image inspect response:", err) - } - return - } - // ImageRemove - if r.Method == http.MethodDelete { - d.mu.Lock() - defer d.mu.Unlock() - foundImageID := d.findImageIDFromName(image + ":" + tag) - if len(foundImageID) == 0 { - http.NotFound(w, r) - return - } - delete(d.pushedImages, foundImageID) - if err := json.NewEncoder(w).Encode([]types.ImageDeleteResponseItem{ - {Deleted: "sha256:" + foundImageID}, - }); err != nil { - d.t.Error("failed to encode image delete response:", err) - } - return - } - // ImagePush - w.WriteHeader(http.StatusOK) - if d.pushErr != nil { - d.writeError(w, d.pushErr) - return - } - d.mu.Lock() - defer d.mu.Unlock() - if _, ok := d.pushedImages[image]; !ok { - d.pushedImages[image] = &pushedImage{} - } - imageTag := r.URL.Query()["tag"][0] - d.pushedImages[image].tags = append(d.pushedImages[image].tags, imageTag) - auxJSON, err := json.Marshal(map[string]any{ - "Tag": imageTag, - "Digest": "sha256:" + stringid.GenerateRandomID(), - "Size": 123, - }) - if err != nil { - d.writeError(w, err) - return - } - if err := json.NewEncoder(w).Encode(&jsonmessage.JSONMessage{ - Progress: &jsonmessage.JSONProgress{}, - Aux: (*json.RawMessage)(&auxJSON), - }); err != nil { - d.t.Error("failed to write JSON:", err) - } - if _, err := w.Write([]byte("\r\n")); err != nil { - d.t.Error("failed to write CRLF:", err) - } -} - -func (d *dockerServer) findImageIDFromName(name string) string { - for imageID, builtImageInfo := range d.pushedImages { - for _, imageTag := range builtImageInfo.tags { - if imageTag == name { - return imageID - } - } - } - return "" -} - -func (d *dockerServer) writeError(w http.ResponseWriter, err error) { - if err := json.NewEncoder(w).Encode(&jsonmessage.JSONMessage{Error: &jsonmessage.JSONError{Message: err.Error()}}); err != nil { - d.t.Error("failed to write json message:", err) - } - if _, err := w.Write([]byte{'\r', '\n'}); err != nil { - d.t.Error("failed to write CRLF", err) - } -} diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config_test.go b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config_test.go deleted file mode 100644 index ff59cc534..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/registry_auth_config_test.go +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufplugindocker - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestRegistryAuthMarshalJSON(t *testing.T) { - t.Parallel() - auth := RegistryAuthConfig{ - Username: "someuser", - Password: "somepass", - Email: "someemail@buf.build", - ServerAddress: "buf.build", - } - encoded, err := json.Marshal(auth) - require.NoError(t, err) - var decoded RegistryAuthConfig - err = json.Unmarshal(encoded, &decoded) - require.NoError(t, err) - assert.Equal(t, auth, decoded) -} - -func TestRegistryAuthToFromHeader(t *testing.T) { - t.Parallel() - auth := RegistryAuthConfig{ - Username: "someuser", - Password: "somepass", - Email: "someemail@buf.build", - ServerAddress: "buf.build", - } - encoded, err := auth.ToHeader() - require.NoError(t, err) - var decoded RegistryAuthConfig - err = decoded.fromHeader(encoded) - require.NoError(t, err) - assert.Equal(t, auth, decoded) -} diff --git a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile b/pkg/bufman/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile deleted file mode 100644 index f80657ed4..000000000 --- a/pkg/bufman/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM alpine:3.18.2 - -RUN echo "success" diff --git a/pkg/bufman/bufpkg/bufstudioagent/plain_post_handler.go b/pkg/bufman/bufpkg/bufstudioagent/plain_post_handler.go index 294b46bdf..fcdbdf36f 100644 --- a/pkg/bufman/bufpkg/bufstudioagent/plain_post_handler.go +++ b/pkg/bufman/bufpkg/bufstudioagent/plain_post_handler.go @@ -200,7 +200,7 @@ func (i *plainPostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { }) return } - i.logger.Sugar().Warn( + i.Logger.Warn( "non_connect_unary_error", zap.Error(err), ) @@ -249,7 +249,7 @@ func (i *plainPostHandler) writeProtoMessage(w http.ResponseWriter, message prot i.B64Encoding.Encode(responseB64Bytes, responseProtoBytes) w.Header().Set("Content-Type", "text/plain") if n, err := w.Write(responseB64Bytes); n != len(responseB64Bytes) && err != nil { - i.logger.Sugar().Error( + i.Logger.Error( "write_error", zap.Int("expected_bytes", len(responseB64Bytes)), zap.Int("actual_bytes", n), diff --git a/pkg/bufman/bufpkg/bufwasm/bufwasm_test.go b/pkg/bufman/bufpkg/bufwasm/bufwasm_test.go deleted file mode 100644 index a662fa973..000000000 --- a/pkg/bufman/bufpkg/bufwasm/bufwasm_test.go +++ /dev/null @@ -1,160 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufwasm - -import ( - "bytes" - "context" - _ "embed" - "errors" - "io" - "sync" - "testing" - - wasmpluginv1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/wasmplugin/v1" - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/testing/protocmp" -) - -// echoWasm is a basic wasm file that echos the first 100 bytes from stdin -// before exitting with exit code 11. It serves as a valid wasm file to executed -// during test and manipulate for section reading. -// -// Regenerate it using "wat2wasm echo.wat -o echo.wasm" -// -// For more complex tests, we need to check in bulkier wasm files and add more -// complex toolchains to build them. Since we don't need to re-test wazero here, -// this should suffice for now. -// -//go:embed testdata/echo.wasm -var echoWasm []byte - -func TestSectionEncodeDecode(t *testing.T) { - t.Parallel() - ctx := context.Background() - executor, err := NewPluginExecutor(t.TempDir()) - require.NoError(t, err) - plugin, err := executor.CompilePlugin(ctx, echoWasm) - require.NoError(t, err) - defer func() { - require.NoError(t, plugin.Close()) - }() - assert.Nil(t, plugin.ExecConfig) - - metadataProto := &wasmpluginv1.ExecConfig{ - WasmAbi: wasmpluginv1.WasmABI_WASM_ABI_WASI_SNAPSHOT_PREVIEW1, - Args: []string{"some", "params"}, - } - bufSectionBytes, err := EncodeBufSection(metadataProto) - require.NoError(t, err) - - wasmFileWithBufSection := make([]byte, 0, len(echoWasm)+len(bufSectionBytes)) - wasmFileWithBufSection = append(wasmFileWithBufSection, echoWasm...) - wasmFileWithBufSection = append(wasmFileWithBufSection, bufSectionBytes...) - - plugin, err = executor.CompilePlugin(ctx, wasmFileWithBufSection) - require.NoError(t, err) - defer func() { - require.NoError(t, plugin.Close()) - }() - assert.Empty(t, cmp.Diff(plugin.ExecConfig, metadataProto, protocmp.Transform())) -} - -func TestPluginExecutor(t *testing.T) { - t.Parallel() - ctx := context.Background() - executor, err := NewPluginExecutor(t.TempDir()) - require.NoError(t, err) - plugin, err := executor.CompilePlugin(ctx, echoWasm) - require.NoError(t, err) - defer func() { - require.NoError(t, plugin.Close()) - }() - assert.Nil(t, plugin.ExecConfig) - - stdin := bytes.NewBufferString("foo") - stdout := bytes.NewBuffer(nil) - err = executor.Run(ctx, plugin, stdin, stdout) - pluginErr := new(PluginExecutionError) - require.ErrorAs(t, err, &pluginErr) - assert.Equal(t, uint32(11), pluginErr.Exitcode) - assert.Equal(t, "foo", stdout.String()) -} - -func TestParallelPlugins(t *testing.T) { - t.Parallel() - ctx := context.Background() - executor, err := NewPluginExecutor(t.TempDir()) - require.NoError(t, err) - plugin, err := executor.CompilePlugin(ctx, echoWasm) - require.NoError(t, err) - defer func() { - require.NoError(t, plugin.Close()) - }() - assert.Nil(t, plugin.ExecConfig) - - n := 2 - errors := make([]error, n) - stdOuts := make([]*bytes.Buffer, n) - var wg sync.WaitGroup - for i := 0; i < n; i++ { - i := i - wg.Add(1) - go func() { - defer wg.Done() - stdOut := bytes.NewBuffer(nil) - stdOuts[i] = stdOut - errors[i] = executor.Run(ctx, plugin, bytes.NewBufferString("foo"), stdOut) - }() - } - wg.Wait() - - for i := 0; i < n; i++ { - pluginErr := new(PluginExecutionError) - require.ErrorAs(t, errors[i], &pluginErr) - assert.Equal(t, uint32(11), pluginErr.Exitcode) - assert.Equal(t, "foo", stdOuts[i].String()) - } -} - -func BenchmarkPluginRun(b *testing.B) { - ctx := context.Background() - executor, err := NewPluginExecutor(b.TempDir()) - if err != nil { - b.Fatal(err) - } - plugin, err := executor.CompilePlugin(ctx, echoWasm) - if err != nil { - b.Fatal(err) - } - defer func() { - require.NoError(b, plugin.Close()) - }() - if plugin.ExecConfig != nil { - b.Fatal("expected no plugin.ExecConfig") - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - err := executor.Run(ctx, plugin, bytes.NewBufferString("foo"), io.Discard) - pluginErr := new(PluginExecutionError) - if ok := errors.As(err, &pluginErr); !ok || pluginErr.Exitcode != 11 { - b.Fatal(err) - } - } -} diff --git a/pkg/bufman/bufpkg/bufwasm/testdata/echo.wasm b/pkg/bufman/bufpkg/bufwasm/testdata/echo.wasm deleted file mode 100644 index 8f8e21cac228f05b76380a2746b07fb40f273172..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 208 zcmZ{aK@Ng26b0Y^ML==U#KZ+xFfQDWaGduw`NC8*~hc^B 1680571785 -0700 -committer Alice 1680636827 -0700 - -Hello World -`)) - require.NoError(t, err) - assert.Equal(t, - "43848150a6f5f6d76eeef6e0f69eb46290eefab6", - commit.Hash().String(), - ) - assert.Equal(t, - "5edab9f970913225f985d9673ac19d61d36f0942", - commit.Tree().String(), - ) - require.Equal(t, 1, len(commit.Parents())) - assert.Equal(t, - "aa4f1392d3ee58eacc4c34badd506d83239669ca", - commit.Parents()[0].String(), - ) - assert.Equal(t, - "Bob", - commit.Author().Name(), - ) - assert.Equal(t, - "bob@buf.build", - commit.Author().Email(), - ) - assert.Equal(t, - int64(1680571785), - commit.Author().Timestamp().Unix(), - "Bob commit time", - ) - assert.Equal(t, - "Alice", - commit.Committer().Name(), - ) - assert.Equal(t, - "alice@buf.build", - commit.Committer().Email(), - ) - assert.Equal(t, - int64(1680636827), - commit.Committer().Timestamp().Unix(), - "Alice commit time", - ) - assert.Equal(t, - "Hello World", - commit.Message(), - ) -} diff --git a/pkg/bufman/pkg/git/git_test.go b/pkg/bufman/pkg/git/git_test.go deleted file mode 100644 index 79e5ae558..000000000 --- a/pkg/bufman/pkg/git/git_test.go +++ /dev/null @@ -1,289 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package git - -import ( - "context" - "errors" - "net/http/cgi" - "net/http/httptest" - "os" - "os/exec" - "path/filepath" - "strings" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/app" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -func TestGitCloner(t *testing.T) { - t.Parallel() - ctx := context.Background() - container, err := app.NewContainerForOS() - require.NoError(t, err) - runner := command.NewRunner() - originDir, workDir := createGitDirs(ctx, t, container, runner) - - t.Run("default", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 1, nil, false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 2", string(content), "expected the commit on local-branch to be checked out") - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - _, err = storage.ReadPath(ctx, readBucket, "submodule/test.proto") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("default_submodule", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 1, nil, true) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 2", string(content), "expected the commit on local-branch to be checked out") - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - content, err = storage.ReadPath(ctx, readBucket, "submodule/test.proto") - require.NoError(t, err) - assert.Equal(t, "// submodule", string(content)) - }) - - t.Run("main", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewBranchName("main"), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 1", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("origin/main", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewBranchName("origin/main"), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 3", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("origin/remote-branch", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewBranchName("origin/remote-branch"), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 4", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("remote-tag", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewTagName("remote-tag"), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 4", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("branch_and_main_ref", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 2, NewRefNameWithBranch("HEAD~", "main"), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 0", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("branch_and_ref", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 2, NewRefNameWithBranch("local-branch~", "local-branch"), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 1", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("HEAD", func(t *testing.T) { - t.Parallel() - readBucket := readBucketForName(ctx, t, runner, workDir, 1, NewRefName("HEAD"), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 2", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("commit-local", func(t *testing.T) { - t.Parallel() - revParseBytes, err := command.RunStdout(ctx, container, runner, "git", "-C", workDir, "rev-parse", "HEAD~") - require.NoError(t, err) - readBucket := readBucketForName(ctx, t, runner, workDir, 2, NewRefName(strings.TrimSpace(string(revParseBytes))), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 1", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) - - t.Run("commit-remote", func(t *testing.T) { - t.Parallel() - revParseBytes, err := command.RunStdout(ctx, container, runner, "git", "-C", originDir, "rev-parse", "remote-branch~") - require.NoError(t, err) - readBucket := readBucketForName(ctx, t, runner, workDir, 2, NewRefNameWithBranch(strings.TrimSpace(string(revParseBytes)), "origin/remote-branch"), false) - - content, err := storage.ReadPath(ctx, readBucket, "test.proto") - require.NoError(t, err) - assert.Equal(t, "// commit 3", string(content)) - _, err = readBucket.Stat(ctx, "nonexistent") - assert.True(t, storage.IsNotExist(err)) - }) -} - -func readBucketForName(ctx context.Context, t *testing.T, runner command.Runner, path string, depth uint32, name Name, recurseSubmodules bool) storage.ReadBucket { - t.Helper() - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - cloner := NewCloner(zap.NewNop(), storageosProvider, runner, ClonerOptions{}) - envContainer, err := app.NewEnvContainerForOS() - require.NoError(t, err) - - readWriteBucket := storagemem.NewReadWriteBucket() - err = cloner.CloneToBucket( - ctx, - envContainer, - "file://"+filepath.Join(path, ".git"), - depth, - readWriteBucket, - CloneToBucketOptions{ - Mapper: storage.MatchPathExt(".proto"), - Name: name, - RecurseSubmodules: recurseSubmodules, - }, - ) - require.NoError(t, err) - return readWriteBucket -} - -func createGitDirs( - ctx context.Context, - t *testing.T, - container app.EnvStdioContainer, - runner command.Runner, -) (string, string) { - tmpDir := t.TempDir() - - submodulePath := filepath.Join(tmpDir, "submodule") - require.NoError(t, os.MkdirAll(submodulePath, os.ModePerm)) - runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "init") - runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "config", "user.email", "tests@buf.build") - runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "config", "user.name", "Buf go tests") - runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "checkout", "-b", "main") - require.NoError(t, os.WriteFile(filepath.Join(submodulePath, "test.proto"), []byte("// submodule"), 0o600)) - runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "add", "test.proto") - runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "commit", "-m", "commit 0") - - gitExecPath, err := command.RunStdout(ctx, container, runner, "git", "--exec-path") - require.NoError(t, err) - t.Log(filepath.Join(string(gitExecPath), "git-http-backend")) - // https://git-scm.com/docs/git-http-backend#_description - f, err := os.Create(filepath.Join(submodulePath, ".git", "git-daemon-export-ok")) - require.NoError(t, err) - require.NoError(t, f.Close()) - server := httptest.NewServer(&cgi.Handler{ - Path: filepath.Join(strings.TrimSpace(string(gitExecPath)), "git-http-backend"), - Dir: submodulePath, - Env: []string{"GIT_PROJECT_ROOT=" + submodulePath}, - }) - t.Cleanup(server.Close) - submodulePath = server.URL - - originPath := filepath.Join(tmpDir, "origin") - require.NoError(t, os.MkdirAll(originPath, 0o777)) - runCommand(ctx, t, container, runner, "git", "-C", originPath, "init") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "config", "user.email", "tests@buf.build") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "config", "user.name", "Buf go tests") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "checkout", "-b", "main") - require.NoError(t, os.WriteFile(filepath.Join(originPath, "test.proto"), []byte("// commit 0"), 0o600)) - runCommand(ctx, t, container, runner, "git", "-C", originPath, "add", "test.proto") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "commit", "-m", "commit 0") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "submodule", "add", submodulePath, "submodule") - require.NoError(t, os.WriteFile(filepath.Join(originPath, "test.proto"), []byte("// commit 1"), 0o600)) - runCommand(ctx, t, container, runner, "git", "-C", originPath, "add", "test.proto") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "commit", "-m", "commit 1") - - workPath := filepath.Join(tmpDir, "workdir") - runCommand(ctx, t, container, runner, "git", "clone", originPath, workPath) - runCommand(ctx, t, container, runner, "git", "-C", workPath, "config", "user.email", "tests@buf.build") - runCommand(ctx, t, container, runner, "git", "-C", workPath, "config", "user.name", "Buf go tests") - runCommand(ctx, t, container, runner, "git", "-C", workPath, "checkout", "-b", "local-branch") - require.NoError(t, os.WriteFile(filepath.Join(workPath, "test.proto"), []byte("// commit 2"), 0o600)) - runCommand(ctx, t, container, runner, "git", "-C", workPath, "commit", "-a", "-m", "commit 2") - - require.NoError(t, os.WriteFile(filepath.Join(originPath, "test.proto"), []byte("// commit 3"), 0o600)) - runCommand(ctx, t, container, runner, "git", "-C", originPath, "add", "test.proto") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "commit", "-m", "commit 3") - - runCommand(ctx, t, container, runner, "git", "-C", originPath, "checkout", "-b", "remote-branch") - require.NoError(t, os.WriteFile(filepath.Join(originPath, "test.proto"), []byte("// commit 4"), 0o600)) - runCommand(ctx, t, container, runner, "git", "-C", originPath, "add", "test.proto") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "commit", "-m", "commit 4") - runCommand(ctx, t, container, runner, "git", "-C", originPath, "tag", "remote-tag") - - runCommand(ctx, t, container, runner, "git", "-C", workPath, "fetch", "origin") - return originPath, workPath -} - -func runCommand( - ctx context.Context, - t *testing.T, - container app.EnvStdioContainer, - runner command.Runner, - name string, - args ...string, -) { - t.Helper() - output, err := command.RunStdout(ctx, container, runner, name, args...) - if err != nil { - var exitErr *exec.ExitError - var stdErr []byte - if errors.As(err, &exitErr) { - stdErr = exitErr.Stderr - } - assert.FailNow(t, err.Error(), "stdout: %s\nstderr: %s", output, stdErr) - } -} diff --git a/pkg/bufman/pkg/git/gittest/doc.go b/pkg/bufman/pkg/git/gittest/doc.go deleted file mode 100644 index c3d7c5a22..000000000 --- a/pkg/bufman/pkg/git/gittest/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package gittest provides testing utilities for git repositories. -package gittest diff --git a/pkg/bufman/pkg/git/gittest/gittest.go b/pkg/bufman/pkg/git/gittest/gittest.go deleted file mode 100644 index 35140d7e4..000000000 --- a/pkg/bufman/pkg/git/gittest/gittest.go +++ /dev/null @@ -1,161 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package gittest - -import ( - "bytes" - "context" - "io" - "os" - "path" - "path/filepath" - "strings" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" - "github.com/stretchr/testify/require" -) - -const DefaultBranch = "master" - -func ScaffoldGitRepository(t *testing.T) git.Repository { - runner := command.NewRunner() - dir := scaffoldGitRepository(t, runner) - dotGitPath := path.Join(dir, git.DotGitDir) - repo, err := git.OpenRepository(dotGitPath, runner, git.OpenRepositoryWithBaseBranch(DefaultBranch)) - require.NoError(t, err) - t.Cleanup(func() { - require.NoError(t, repo.Close()) - }) - return repo -} - -// the resulting Git repo looks like so: -// -// . -// ├── proto -// │ ├── acme -// │ │ ├── grocerystore -// │ │ │ └── v1 -// │ │ │ ├── c.proto -// │ │ │ ├── d.proto -// │ │ │ ├── g.proto -// │ │ │ └── h.proto -// │ │ └── petstore -// │ │ └── v1 -// │ │ ├── a.proto -// │ │ ├── b.proto -// │ │ ├── e.proto -// │ │ └── f.proto -// │ └── buf.yaml -// └── randomBinary (+x) -func scaffoldGitRepository(t *testing.T, runner command.Runner) string { - dir := t.TempDir() - - // (0) setup local and remote - runInDir(t, runner, dir, "mkdir", "local", "remote") - remote := path.Join(dir, "remote") - runInDir(t, runner, remote, "git", "init", "--bare") - runInDir(t, runner, remote, "git", "config", "user.name", "Buf TestBot") - runInDir(t, runner, remote, "git", "config", "user.email", "testbot@buf.build") - local := path.Join(dir, "local") - runInDir(t, runner, local, "git", "init") - runInDir(t, runner, local, "git", "config", "user.name", "Buf TestBot") - runInDir(t, runner, local, "git", "config", "user.email", "testbot@buf.build") - runInDir(t, runner, local, "git", "remote", "add", "origin", remote) - - // (1) commit in main branch - writeFiles(t, local, map[string]string{ - "randomBinary": "some executable", - "proto/buf.yaml": "some buf.yaml", - "proto/acme/petstore/v1/a.proto": "cats", - "proto/acme/petstore/v1/b.proto": "animals", - "proto/acme/grocerystore/v1/c.proto": "toysrus", - "proto/acme/grocerystore/v1/d.proto": "petsrus", - }) - runInDir(t, runner, local, "chmod", "+x", "randomBinary") - runInDir(t, runner, local, "git", "add", ".") - runInDir(t, runner, local, "git", "commit", "-m", "initial commit") - runInDir(t, runner, local, "git", "tag", "release/v1") - runInDir(t, runner, local, "git", "push", "--follow-tags", "-u", "-f", "origin", DefaultBranch) - - // (2) branch off main and begin work - runInDir(t, runner, local, "git", "checkout", "-b", "smian/branch1") - writeFiles(t, local, map[string]string{ - "proto/acme/petstore/v1/e.proto": "loblaws", - "proto/acme/petstore/v1/f.proto": "merchant of venice", - }) - runInDir(t, runner, local, "git", "add", ".") - runInDir(t, runner, local, "git", "commit", "-m", "branch1") - runInDir(t, runner, local, "git", "tag", "-m", "for testing", "branch/v1") - runInDir(t, runner, local, "git", "push", "--follow-tags", "origin", "smian/branch1") - - // (3) branch off branch and begin work - runInDir(t, runner, local, "git", "checkout", "-b", "smian/branch2") - writeFiles(t, local, map[string]string{ - "proto/acme/grocerystore/v1/g.proto": "hamlet", - "proto/acme/grocerystore/v1/h.proto": "bethoven", - }) - runInDir(t, runner, local, "git", "add", ".") - runInDir(t, runner, local, "git", "commit", "-m", "branch2") - runInDir(t, runner, local, "git", "tag", "-m", "for testing", "branch/v2") - runInDir(t, runner, local, "git", "push", "--follow-tags", "origin", "smian/branch2") - - // (4) merge first branch - runInDir(t, runner, local, "git", "checkout", DefaultBranch) - runInDir(t, runner, local, "git", "merge", "--squash", "smian/branch1") - runInDir(t, runner, local, "git", "commit", "-m", "second commit") - runInDir(t, runner, local, "git", "tag", "v2") - runInDir(t, runner, local, "git", "push", "--follow-tags") - - // (5) pack some refs - runInDir(t, runner, local, "git", "pack-refs", "--all") - runInDir(t, runner, local, "git", "repack") - - // (6) merge second branch - runInDir(t, runner, local, "git", "checkout", DefaultBranch) - runInDir(t, runner, local, "git", "merge", "--squash", "smian/branch2") - runInDir(t, runner, local, "git", "commit", "-m", "third commit") - runInDir(t, runner, local, "git", "tag", "v3.0") - runInDir(t, runner, local, "git", "push", "--follow-tags") - - return local -} - -func runInDir(t *testing.T, runner command.Runner, dir string, cmd string, args ...string) { - stderr := bytes.NewBuffer(nil) - err := runner.Run( - context.Background(), - cmd, - command.RunWithArgs(args...), - command.RunWithDir(dir), - command.RunWithStderr(stderr), - ) - if err != nil { - t.Logf("run %q", strings.Join(append([]string{cmd}, args...), " ")) - _, err := io.Copy(os.Stderr, stderr) - require.NoError(t, err) - } - require.NoError(t, err) -} - -func writeFiles(t *testing.T, dir string, files map[string]string) { - for path, contents := range files { - require.NoError(t, os.MkdirAll(filepath.Join(dir, filepath.Dir(path)), 0o700)) - require.NoError(t, os.WriteFile(filepath.Join(dir, path), []byte(contents), 0o600)) - } -} diff --git a/pkg/bufman/pkg/git/hash_test.go b/pkg/bufman/pkg/git/hash_test.go deleted file mode 100644 index b6ef845fd..000000000 --- a/pkg/bufman/pkg/git/hash_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package git - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestParseHashFromHex(t *testing.T) { - t.Parallel() - - const hex = "5edab9f970913225f985d9673ac19d61d36f0942" - - id, err := parseHashFromHex(hex) - - require.NoError(t, err) - require.Equal(t, id.Hex(), hex) - require.Equal(t, id.Raw(), []byte{0x5e, 0xda, 0xb9, 0xf9, 0x70, 0x91, 0x32, 0x25, 0xf9, 0x85, 0xd9, 0x67, 0x3a, 0xc1, 0x9d, 0x61, 0xd3, 0x6f, 0x9, 0x42}) -} - -func TestNewHashFromBytes(t *testing.T) { - t.Parallel() - - bytes := []byte{0x5e, 0xda, 0xb9, 0xf9, 0x70, 0x91, 0x32, 0x25, 0xf9, 0x85, 0xd9, 0x67, 0x3a, 0xc1, 0x9d, 0x61, 0xd3, 0x6f, 0x9, 0x42} - - id, err := newHashFromBytes(bytes) - - require.NoError(t, err) - require.Equal(t, id.Hex(), "5edab9f970913225f985d9673ac19d61d36f0942") - require.Equal(t, id.Raw(), bytes) -} diff --git a/pkg/bufman/pkg/git/ident_test.go b/pkg/bufman/pkg/git/ident_test.go deleted file mode 100644 index 22804de5e..000000000 --- a/pkg/bufman/pkg/git/ident_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package git - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestParseIdent(t *testing.T) { - t.Parallel() - - ident, err := parseIdent([]byte("Foo 1680571785 +0445")) - - require.NoError(t, err) - location := time.FixedZone("UTC+0445", 4*60*60+45*60) - assert.Equal(t, ident.Name(), "Foo") - assert.Equal(t, ident.Email(), "bar@baz") - assert.Equal(t, ident.Timestamp(), time.Unix(1680571785, 0).In(location)) - assert.Equal(t, ident.Timestamp().Unix(), int64(1680571785)) -} diff --git a/pkg/bufman/pkg/git/packed_refs_test.go b/pkg/bufman/pkg/git/packed_refs_test.go deleted file mode 100644 index 84089973d..000000000 --- a/pkg/bufman/pkg/git/packed_refs_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package git - -import ( - "os" - "path" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestReadPackedRefs(t *testing.T) { - t.Parallel() - - allBytes, err := os.ReadFile(path.Join("testdata", "packed-refs")) - require.NoError(t, err) - - branches, tags, err := parsePackedRefs(allBytes) - - require.NoError(t, err) - hexBranches := map[string]string{} - for branch, hash := range branches { - hexBranches[branch] = hash.Hex() - } - hexTags := map[string]string{} - for tag, hash := range tags { - hexTags[tag] = hash.Hex() - } - assert.Equal(t, hexBranches, map[string]string{ - "main": "45c2edc61040013349e094663e492996e0c044e3", - "paralleltest": "1fddd89116e24df213d43b7d837f5dd29ee9cbf0", - }) - assert.Equal(t, hexTags, map[string]string{ - "v0.1.0": "157c7ae554844ff7ae178536ec10787b5b74b5db", - "v0.2.0": "ace9301f315979bd053b7658c017391fe1af8804", - "v1.10.0": "ebb191e8268db7cee389e3abb0d1edc1852337a3", - }) -} diff --git a/pkg/bufman/pkg/git/repository_test.go b/pkg/bufman/pkg/git/repository_test.go deleted file mode 100644 index 2f60da071..000000000 --- a/pkg/bufman/pkg/git/repository_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package git_test - -import ( - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git/gittest" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestTags(t *testing.T) { - t.Parallel() - - repo := gittest.ScaffoldGitRepository(t) - var tags []string - err := repo.ForEachTag(func(tag string, commitHash git.Hash) error { - tags = append(tags, tag) - - commit, err := repo.Objects().Commit(commitHash) - require.NoError(t, err) - switch tag { - case "release/v1": - assert.Equal(t, commit.Message(), "initial commit") - case "branch/v1": - assert.Equal(t, commit.Message(), "branch1") - case "branch/v2": - assert.Equal(t, commit.Message(), "branch2") - case "v2": - assert.Equal(t, commit.Message(), "second commit") - case "v3.0": - assert.Equal(t, commit.Message(), "third commit") - default: - assert.Failf(t, "unknown tag", tag) - } - - return nil - }) - - require.NoError(t, err) - require.ElementsMatch(t, tags, []string{ - "release/v1", - "branch/v1", - "branch/v2", - "v2", - "v3.0", - }) -} - -func TestCommits(t *testing.T) { - t.Parallel() - - repo := gittest.ScaffoldGitRepository(t) - var commits []git.Commit - err := repo.ForEachCommit(gittest.DefaultBranch, func(c git.Commit) error { - commits = append(commits, c) - return nil - }) - - require.NoError(t, err) - require.Len(t, commits, 3) - assert.Empty(t, commits[0].Parents()) - assert.Equal(t, commits[0].Message(), "initial commit") - assert.Contains(t, commits[1].Parents(), commits[0].Hash()) - assert.Equal(t, commits[1].Message(), "second commit") - assert.Contains(t, commits[2].Parents(), commits[1].Hash()) - assert.Equal(t, commits[2].Message(), "third commit") -} - -func TestBranches(t *testing.T) { - t.Parallel() - - repo := gittest.ScaffoldGitRepository(t) - var branches []string - err := repo.ForEachBranch(func(branch string, headHash git.Hash) error { - branches = append(branches, branch) - - commit, err := repo.Objects().Commit(headHash) - require.NoError(t, err) - switch branch { - case "master": - assert.Equal(t, commit.Message(), "third commit") - case "smian/branch1": - assert.Equal(t, commit.Message(), "branch1") - case "smian/branch2": - assert.Equal(t, commit.Message(), "branch2") - default: - assert.Failf(t, "unknown branch", branch) - } - - return nil - }) - - require.NoError(t, err) - require.ElementsMatch(t, branches, []string{ - "master", - "smian/branch1", - "smian/branch2", - }) -} diff --git a/pkg/bufman/pkg/git/testdata/packed-refs b/pkg/bufman/pkg/git/testdata/packed-refs deleted file mode 100644 index d47a72249..000000000 --- a/pkg/bufman/pkg/git/testdata/packed-refs +++ /dev/null @@ -1,10 +0,0 @@ -# pack-refs with: peeled fully-peeled sorted -45c2edc61040013349e094663e492996e0c044e3 refs/remotes/origin/main -1fddd89116e24df213d43b7d837f5dd29ee9cbf0 refs/remotes/origin/paralleltest -27523d9000238e0f7fb35d6052d10016852beee3 refs/remotes/otherorigin/main -959e716b38b179bd5a4e7edfc549db2e30df3c8e refs/remotes/otherorigin/paralleltest -4acbbca27c6d7bc0f4027c1897f89da140789e55 refs/tags/v0.1.0 -^157c7ae554844ff7ae178536ec10787b5b74b5db -ebb191e8268db7cee389e3abb0d1edc1852337a3 refs/tags/v1.10.0 -170e69af5a7a768c5d3be15e4734919ea051188d refs/tags/v0.2.0 -^ace9301f315979bd053b7658c017391fe1af8804 diff --git a/pkg/bufman/pkg/git/tree_node_test.go b/pkg/bufman/pkg/git/tree_node_test.go deleted file mode 100644 index 4ab8300c2..000000000 --- a/pkg/bufman/pkg/git/tree_node_test.go +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package git - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestParseFileMode(t *testing.T) { - t.Parallel() - - tests := []struct { - desc string - mode ObjectMode - txt string - expectErr bool - }{ - { - desc: "zero value", - expectErr: true, - }, - { - desc: "file", - mode: ModeFile, - txt: "100644", - }, - { - desc: "exe", - mode: ModeExe, - txt: "100755", - }, - { - desc: "directory", - mode: ModeDir, - txt: "040000", - }, - { - desc: "symlink", - mode: ModeSymlink, - txt: "120000", - }, - { - desc: "submodule", - mode: ModeSubmodule, - txt: "160000", - }, - } - - for i := range tests { - test := tests[i] - t.Run(test.desc, func(t *testing.T) { - t.Parallel() - mode, err := parseObjectMode([]byte(test.txt)) - if test.expectErr { - assert.Error(t, err) - } else { - assert.NoError(t, err) - assert.Equal(t, test.mode, mode) - } - }) - } -} diff --git a/pkg/bufman/pkg/git/tree_test.go b/pkg/bufman/pkg/git/tree_test.go deleted file mode 100644 index 8456a8eee..000000000 --- a/pkg/bufman/pkg/git/tree_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package git - -import ( - "encoding/base64" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestParseTree(t *testing.T) { - t.Parallel() - - /* - This is generated using the following procedure: - ```sh - ➜ git init - ➜ touch .gitignore a.proto b - ➜ mkdir c && touch c/d.proto - ➜ git add * && git add --chmod +x b - ➜ git commit -m 'initial commit' - ``` - Then simply `git cat-file` the tree at HEAD and encode to base64. - */ - bytes, err := base64.StdEncoding.DecodeString("MTAwNjQ0IGEucHJvdG8A5p3im7LR1kNLiymud1rYwuSMU5ExMDA3NTUgYgDmneKbstHWQ0uLKa53WtjC5IxTkTQwMDAwIGMAXEw7X4b6IGAIGHO/LwaXPdE5gys=") - require.NoError(t, err) - hash, err := parseHashFromHex("43848150a6f5f6d76eeef6e0f69eb46290eefab6") - require.NoError(t, err) - - tree, err := parseTree(hash, bytes) - - assert.NoError(t, err) - assert.Equal(t, tree.Hash(), hash) - assert.Len(t, tree.Nodes(), 3) - assert.Equal(t, tree.Nodes()[0].Hash().Hex(), "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391") - assert.Equal(t, tree.Nodes()[0].Name(), "a.proto") - assert.Equal(t, tree.Nodes()[0].Mode(), ModeFile) - assert.Equal(t, tree.Nodes()[1].Hash().Hex(), "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391") - assert.Equal(t, tree.Nodes()[1].Name(), "b") - assert.Equal(t, tree.Nodes()[1].Mode(), ModeExe) - assert.Equal(t, tree.Nodes()[2].Hash().Hex(), "5c4c3b5f86fa2060081873bf2f06973dd139832b") - assert.Equal(t, tree.Nodes()[2].Name(), "c") - assert.Equal(t, tree.Nodes()[2].Mode(), ModeDir) -} diff --git a/pkg/bufman/pkg/github/githubtesting/archive_reader.go b/pkg/bufman/pkg/github/githubtesting/archive_reader.go index 5537b8d8e..806ca6097 100644 --- a/pkg/bufman/pkg/github/githubtesting/archive_reader.go +++ b/pkg/bufman/pkg/github/githubtesting/archive_reader.go @@ -50,7 +50,7 @@ func newArchiveReader( httpClient *http.Client, ) *archiveReader { return &archiveReader{ - logger: logger.Sugar().Named("githubtesting"), + logger: logger.Named("githubtesting"), storageosProvider: storageosProvider, httpClient: httpClient, } diff --git a/pkg/bufman/pkg/observabilityzap/zapexporter.go b/pkg/bufman/pkg/observabilityzap/zapexporter.go index d7564b4e6..382d9172a 100644 --- a/pkg/bufman/pkg/observabilityzap/zapexporter.go +++ b/pkg/bufman/pkg/observabilityzap/zapexporter.go @@ -39,7 +39,7 @@ func (z *zapExporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpa if !span.SpanContext().IsSampled() { continue } - if checkedEntry := z.logger.Sugar().Check(zap.DebugLevel, span.Name()); checkedEntry != nil { + if checkedEntry := z.logger.Check(zap.DebugLevel, span.Name()); checkedEntry != nil { fields := []zap.Field{ zap.Duration("duration", span.EndTime().Sub(span.StartTime())), } diff --git a/pkg/bufman/pkg/protoencoding/protoencoding.go b/pkg/bufman/pkg/protoencoding/protoencoding.go index bc4c5c86f..8d371bad9 100644 --- a/pkg/bufman/pkg/protoencoding/protoencoding.go +++ b/pkg/bufman/pkg/protoencoding/protoencoding.go @@ -26,8 +26,8 @@ import ( // Resolver can resolve files, messages, enums, and extensions. type Resolver interface { protodesc.Resolver - protoregistryv1alpha1.ExtensionTypeResolver - protoregistryv1alpha1.MessageTypeResolver + protoregistry.ExtensionTypeResolver + protoregistry.MessageTypeResolver FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) } diff --git a/pkg/bufman/pkg/protoencoding/resolver.go b/pkg/bufman/pkg/protoencoding/resolver.go index b81d6720c..948c18d25 100644 --- a/pkg/bufman/pkg/protoencoding/resolver.go +++ b/pkg/bufman/pkg/protoencoding/resolver.go @@ -38,7 +38,7 @@ func newResolver(fileDescriptors ...protodescriptor.FileDescriptor) (Resolver, e if err != nil { return nil, err } - types := &protoregistryv1alpha1.Types{} + types := &protoregistry.Types{} var rangeErr error files.RangeFiles(func(fileDescriptor protoreflect.FileDescriptor) bool { if err := registerDescriptors(types, fileDescriptor); err != nil { @@ -54,8 +54,8 @@ func newResolver(fileDescriptors ...protodescriptor.FileDescriptor) (Resolver, e } type resolver struct { - *protoregistryv1alpha1.Files - *protoregistryv1alpha1.Types + *protoregistry.Files + *protoregistry.Types } type descriptorContainer interface { @@ -64,7 +64,7 @@ type descriptorContainer interface { Extensions() protoreflect.ExtensionDescriptors } -func registerDescriptors(types *protoregistryv1alpha1.Types, container descriptorContainer) error { +func registerDescriptors(types *protoregistry.Types, container descriptorContainer) error { messageDescriptors := container.Messages() for i, messagesLen := 0, messageDescriptors.Len(); i < messagesLen; i++ { messageDescriptor := messageDescriptors.Get(i) diff --git a/pkg/bufman/pkg/protosource/option_extension_descriptor_test.go b/pkg/bufman/pkg/protosource/option_extension_descriptor_test.go index df32322e2..437be7b01 100644 --- a/pkg/bufman/pkg/protosource/option_extension_descriptor_test.go +++ b/pkg/bufman/pkg/protosource/option_extension_descriptor_test.go @@ -139,7 +139,7 @@ func makeCustomOption(t *testing.T, tag int32) protoreflect.ExtensionType { }, }, } - fileDescriptor, err := protodesc.NewFile(fileDescriptorProto, protoregistryv1alpha1.GlobalFiles) + fileDescriptor, err := protodesc.NewFile(fileDescriptorProto, protoregistry.GlobalFiles) require.NoError(t, err) return dynamicpb.NewExtensionType(fileDescriptor.Extensions().Get(0)) } diff --git a/pkg/bufman/pkg/storage/storagegit/storagegit_test.go b/pkg/bufman/pkg/storage/storagegit/storagegit_test.go deleted file mode 100644 index 952aaa473..000000000 --- a/pkg/bufman/pkg/storage/storagegit/storagegit_test.go +++ /dev/null @@ -1,82 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package storagegit - -import ( - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/git/gittest" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagetesting" - "github.com/stretchr/testify/require" -) - -func TestNewBucketAtTreeHash(t *testing.T) { - t.Parallel() - - repo := gittest.ScaffoldGitRepository(t) - provider := NewProvider(repo.Objects()) - // get last commit - var commit git.Commit - require.NoError(t, repo.ForEachCommit(repo.BaseBranch(), func(c git.Commit) error { - commit = c - return nil - })) - require.NotNil(t, commit) - bucket, err := provider.NewReadBucket(commit.Tree()) - require.NoError(t, err) - - storagetesting.AssertPaths( - t, - bucket, - "", - "proto/acme/grocerystore/v1/c.proto", - "proto/acme/grocerystore/v1/d.proto", - "proto/acme/grocerystore/v1/g.proto", - "proto/acme/grocerystore/v1/h.proto", - "proto/acme/petstore/v1/a.proto", - "proto/acme/petstore/v1/b.proto", - "proto/acme/petstore/v1/e.proto", - "proto/acme/petstore/v1/f.proto", - "proto/buf.yaml", - "randomBinary", - ) - storagetesting.AssertObjectInfo( - t, - bucket, - "proto/acme/grocerystore/v1/c.proto", - normalpath.Unnormalize("proto/acme/grocerystore/v1/c.proto"), - ) - storagetesting.AssertNotExist(t, bucket, "random-path") - storagetesting.AssertPathToContent( - t, - bucket, - "", - map[string]string{ - "proto/acme/grocerystore/v1/c.proto": "toysrus", - "proto/acme/grocerystore/v1/d.proto": "petsrus", - "proto/acme/grocerystore/v1/g.proto": "hamlet", - "proto/acme/grocerystore/v1/h.proto": "bethoven", - "proto/acme/petstore/v1/a.proto": "cats", - "proto/acme/petstore/v1/b.proto": "animals", - "proto/acme/petstore/v1/e.proto": "loblaws", - "proto/acme/petstore/v1/f.proto": "merchant of venice", - "proto/buf.yaml": "some buf.yaml", - "randomBinary": "some executable", - }, - ) -} diff --git a/pkg/bufman/pkg/storage/storagemem/storagemem_test.go b/pkg/bufman/pkg/storage/storagemem/storagemem_test.go deleted file mode 100644 index 070fd793c..000000000 --- a/pkg/bufman/pkg/storage/storagemem/storagemem_test.go +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package storagemem_test - -import ( - "context" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagemem" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagetesting" - "github.com/stretchr/testify/require" -) - -var storagetestingDirPath = filepath.Join("..", "storagetesting") - -func TestMem(t *testing.T) { - t.Parallel() - storagetesting.RunTestSuite( - t, - storagetestingDirPath, - testNewReadBucket, - testNewWriteBucket, - testWriteBucketToReadBucket, - ) -} - -func testNewReadBucket(t *testing.T, dirPath string, storageosProvider storageos.Provider) (storage.ReadBucket, storagetesting.GetExternalPathFunc) { - osBucket, err := storageosProvider.NewReadWriteBucket( - dirPath, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - readWriteBucket := storagemem.NewReadWriteBucket() - _, err = storage.Copy( - context.Background(), - osBucket, - readWriteBucket, - storage.CopyWithExternalPaths(), - ) - require.NoError(t, err) - return readWriteBucket, func(t *testing.T, rootPath string, path string) string { - // Join calls Clean - return normalpath.Unnormalize(normalpath.Join(rootPath, path)) - } -} - -func testNewWriteBucket(*testing.T, storageos.Provider) storage.WriteBucket { - return storagemem.NewReadWriteBucket() -} - -func testWriteBucketToReadBucket(t *testing.T, writeBucket storage.WriteBucket) storage.ReadBucket { - // hacky - readWriteBucket, ok := writeBucket.(storage.ReadWriteBucket) - require.True(t, ok) - return readWriteBucket -} diff --git a/pkg/bufman/pkg/storage/storageos/storageos_test.go b/pkg/bufman/pkg/storage/storageos/storageos_test.go deleted file mode 100644 index e081b4be4..000000000 --- a/pkg/bufman/pkg/storage/storageos/storageos_test.go +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package storageos_test - -import ( - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/normalpath" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagetesting" - "github.com/stretchr/testify/require" -) - -var storagetestingDirPath = filepath.Join("..", "storagetesting") - -func TestOS(t *testing.T) { - t.Parallel() - storagetesting.RunTestSuite( - t, - storagetestingDirPath, - testNewReadBucket, - testNewWriteBucket, - testWriteBucketToReadBucket, - ) -} - -func testNewReadBucket(t *testing.T, dirPath string, storageosProvider storageos.Provider) (storage.ReadBucket, storagetesting.GetExternalPathFunc) { - osBucket, err := storageosProvider.NewReadWriteBucket( - dirPath, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - return osBucket, func(t *testing.T, rootPath string, path string) string { - // Join calls Clean - return normalpath.Unnormalize(normalpath.Join(rootPath, path)) - } -} - -func testNewWriteBucket(t *testing.T, storageosProvider storageos.Provider) storage.WriteBucket { - tmpDir := t.TempDir() - osBucket, err := storageosProvider.NewReadWriteBucket( - tmpDir, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - require.NoError(t, err) - return osBucket -} - -func testWriteBucketToReadBucket(t *testing.T, writeBucket storage.WriteBucket) storage.ReadBucket { - // hacky - readWriteBucket, ok := writeBucket.(storage.ReadWriteBucket) - require.True(t, ok) - return readWriteBucket -} diff --git a/pkg/bufman/pkg/storage/storagetesting/storagetesting.go b/pkg/bufman/pkg/storage/storagetesting/storagetesting.go deleted file mode 100644 index c6145e619..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/storagetesting.go +++ /dev/null @@ -1,1521 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package storagetesting implements testing utilities and integration tests for storage. -package storagetesting - -import ( - "bytes" - "context" - "fmt" - "io" - "os" - "path/filepath" - "runtime" - "sort" - "strconv" - "sync" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storagearchive" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageutil" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/stringutil" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/tmp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" -) - -const ( - // testProtoContent is the content of every .proto file in the testing directory. - testProtoContent = `syntax = "proto3"; - -package foo; -` - // testTxtContent is the content of every .txt file in the testing directory. - testTxtContent = `foo -` - // testYAMLContent is the content of every .yaml file in the testing directory. - testYAMLContent = `` -) - -// AssertNotExist asserts the path has the expected ObjectInfo. -func AssertNotExist( - t *testing.T, - readBucket storage.ReadBucket, - path string, -) { - _, err := readBucket.Stat(context.Background(), path) - assert.Error(t, err) - assert.True(t, storage.IsNotExist(err)) -} - -// AssertObjectInfo asserts the path has the expected ObjectInfo. -func AssertObjectInfo( - t *testing.T, - readBucket storage.ReadBucket, - path string, - externalPath string, -) { - objectInfo, err := readBucket.Stat(context.Background(), path) - require.NoError(t, err) - AssertObjectInfoEqual( - t, - storageutil.NewObjectInfo( - path, - externalPath, - ), - objectInfo, - ) -} - -// AssertObjectInfoEqual asserts the two ObjectInfos are equal. -func AssertObjectInfoEqual( - t *testing.T, - expected storage.ObjectInfo, - actual storage.ObjectInfo, -) { - assert.Equal(t, expected.Path(), actual.Path()) - assert.Equal(t, expected.ExternalPath(), actual.ExternalPath()) -} - -// AssertPathToContent asserts the content. -func AssertPathToContent( - t *testing.T, - readBucket storage.ReadBucket, - walkPrefix string, - expectedPathToContent map[string]string, -) { - var paths []string - require.NoError(t, readBucket.Walk( - context.Background(), - walkPrefix, - func(objectInfo storage.ObjectInfo) error { - paths = append(paths, objectInfo.Path()) - return nil - }, - )) - require.Equal(t, len(paths), len(stringutil.SliceToUniqueSortedSlice(paths))) - assert.Equal(t, len(expectedPathToContent), len(paths), paths) - for _, path := range paths { - expectedContent, ok := expectedPathToContent[path] - assert.True(t, ok, path) - _, err := readBucket.Stat(context.Background(), path) - require.NoError(t, err, path) - readObjectCloser, err := readBucket.Get(context.Background(), path) - require.NoError(t, err, path) - data, err := io.ReadAll(readObjectCloser) - assert.NoError(t, err, path) - assert.NoError(t, readObjectCloser.Close()) - assert.Equal(t, expectedContent, string(data)) - } -} - -// AssertPaths asserts the paths. -func AssertPaths( - t *testing.T, - readBucket storage.ReadBucket, - walkPrefix string, - expectedPaths ...string, -) { - var paths []string - require.NoError(t, readBucket.Walk( - context.Background(), - walkPrefix, - func(objectInfo storage.ObjectInfo) error { - paths = append(paths, objectInfo.Path()) - return nil - }, - )) - sort.Strings(paths) - assert.Equal(t, stringutil.SliceToUniqueSortedSlice(expectedPaths), paths) -} - -// GetExternalPathFunc can be used to get the external path of -// a path given the root path. -type GetExternalPathFunc func(*testing.T, string, string) string - -// RunTestSuite runs the test suite. -// -// storagetestingDirPath is the path to this directory. -// newReadBucket takes a path to a directory. -func RunTestSuite( - t *testing.T, - storagetestingDirPath string, - newReadBucket func(*testing.T, string, storageos.Provider) (storage.ReadBucket, GetExternalPathFunc), - newWriteBucket func(*testing.T, storageos.Provider) storage.WriteBucket, - writeBucketToReadBucket func(*testing.T, storage.WriteBucket) storage.ReadBucket, -) { - oneDirPath := filepath.Join(storagetestingDirPath, "testdata", "one") - twoDirPath := filepath.Join(storagetestingDirPath, "testdata", "two") - threeDirPath := filepath.Join(storagetestingDirPath, "testdata", "three") - fourDirPath := filepath.Join(storagetestingDirPath, "testdata", "four") - fiveDirPath := filepath.Join(storagetestingDirPath, "testdata", "five") - symlinkSuccessDirPath := filepath.Join(storagetestingDirPath, "testdata", "symlink_success") - symlinkLoopDirPath := filepath.Join(storagetestingDirPath, "testdata", "symlink_loop") - defaultProvider := storageos.NewProvider() - runner := command.NewRunner() - - for _, prefix := range []string{ - "", - ".", - "./", - } { - prefix := prefix - t.Run(fmt.Sprintf("root-%q", prefix), func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - AssertPathToContent( - t, - readBucket, - prefix, - map[string]string{ - "root/a/b/1.proto": testProtoContent, - "root/a/b/2.proto": testProtoContent, - "root/a/b/2.txt": testTxtContent, - "root/ab/1.proto": testProtoContent, - "root/ab/2.proto": testProtoContent, - "root/ab/2.txt": testTxtContent, - "root/a/1.proto": testProtoContent, - "root/a/1.txt": testTxtContent, - "root/a/bar.yaml": testYAMLContent, - "root/c/1.proto": testProtoContent, - "root/1.proto": testProtoContent, - "root/foo.yaml": testYAMLContent, - }, - ) - }) - } - - t.Run("map-1", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - readBucket = storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root"), - ) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "a/b/1.proto": testProtoContent, - "a/b/2.proto": testProtoContent, - "a/b/2.txt": testTxtContent, - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "ab/2.txt": testTxtContent, - "a/1.proto": testProtoContent, - "a/bar.yaml": testYAMLContent, - "a/1.txt": testTxtContent, - "c/1.proto": testProtoContent, - "1.proto": testProtoContent, - "foo.yaml": testYAMLContent, - }, - ) - }) - - t.Run("map-2", func(t *testing.T) { - t.Parallel() - readBucket, getExternalPathFunc := newReadBucket(t, oneDirPath, defaultProvider) - readBucket = storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root/a"), - ) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "b/1.proto": testProtoContent, - "b/2.proto": testProtoContent, - "b/2.txt": testTxtContent, - "1.proto": testProtoContent, - "bar.yaml": testYAMLContent, - "1.txt": testTxtContent, - }, - ) - AssertObjectInfo( - t, - readBucket, - "1.proto", - getExternalPathFunc(t, oneDirPath, filepath.Join("root", "a", "1.proto")), - ) - readBucket = storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("b"), - ) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "1.proto": testProtoContent, - "2.proto": testProtoContent, - "2.txt": testTxtContent, - }, - ) - AssertObjectInfo( - t, - readBucket, - "1.proto", - getExternalPathFunc(t, oneDirPath, filepath.Join("root", "a", "b", "1.proto")), - ) - }) - - t.Run("map-3", func(t *testing.T) { - t.Parallel() - readBucket, getExternalPathFunc := newReadBucket(t, oneDirPath, defaultProvider) - readBucket = storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root/ab"), - ) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "1.proto": testProtoContent, - "2.proto": testProtoContent, - "2.txt": testTxtContent, - }, - ) - AssertObjectInfo( - t, - readBucket, - "1.proto", - getExternalPathFunc(t, oneDirPath, filepath.Join("root", "ab", "1.proto")), - ) - readBucket = storage.MapReadBucket( - readBucket, - storage.MatchOr( - storage.MatchPathExt(".txt"), - storage.MatchPathEqual("2.proto"), - ), - ) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "2.proto": testProtoContent, - "2.txt": testTxtContent, - }, - ) - AssertObjectInfo( - t, - readBucket, - "2.proto", - getExternalPathFunc(t, oneDirPath, filepath.Join("root", "ab", "2.proto")), - ) - }) - - t.Run("multi-all", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) - readBucketMulti := storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root1"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root2"), - ), - ) - AssertPathToContent( - t, - readBucketMulti, - "", - map[string]string{ - // root1 - "a/b/1.proto": testProtoContent, - "a/b/2.proto": testProtoContent, - "a/b/2.txt": testTxtContent, - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "ab/2.txt": testTxtContent, - "a/1.proto": testProtoContent, - "a/1.txt": testTxtContent, - "a/bar.yaml": testYAMLContent, - "c/1.proto": testProtoContent, - "1.proto": testProtoContent, - "foo.yaml": testYAMLContent, - // root2 - "a/b/3.proto": testProtoContent, - "a/b/4.proto": testProtoContent, - "a/b/4.txt": testTxtContent, - "ab/3.proto": testProtoContent, - "ab/4.proto": testProtoContent, - "ab/4.txt": testTxtContent, - "a/2.proto": testProtoContent, - "a/2.txt": testTxtContent, - "a/bat.yaml": testYAMLContent, - "c/3.proto": testProtoContent, - "2.proto": testProtoContent, - "baz.yaml": testYAMLContent, - }, - ) - }) - - t.Run("multi-overlapping-files-error", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) - readBucketMulti := storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root1"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("rootoverlap"), - ), - ) - _, err := readBucketMulti.Get( - context.Background(), - "a/b/1.proto", - ) - assert.Error(t, err) - assert.True(t, storage.IsExistsMultipleLocations(err)) - _, err = readBucketMulti.Stat( - context.Background(), - "a/b/1.proto", - ) - assert.Error(t, err) - assert.True(t, storage.IsExistsMultipleLocations(err)) - err = readBucketMulti.Walk( - context.Background(), - "", - func(storage.ObjectInfo) error { - return nil - }, - ) - assert.Error(t, err) - assert.True(t, storage.IsExistsMultipleLocations(err)) - }) - - // this is testing that if we have i.e. protoc -I root/a -I root - // that even if this is an error in our world, this is not a problem - // in terms of storage buckets - t.Run("multi-overlapping-dirs-success", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, fourDirPath, defaultProvider) - readBucketMulti := storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root/a"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root"), - ), - ) - AssertPathToContent( - t, - readBucketMulti, - "", - map[string]string{ - "a/b/1.proto": testProtoContent, - "a/b/2.proto": testProtoContent, - "a/3.proto": testProtoContent, - "b/1.proto": testProtoContent, - "b/2.proto": testProtoContent, - "3.proto": testProtoContent, - }, - ) - }) - - // this is testing that two roots can have a file with the same - // name, but one could be a directory and the other could be a - // regular file. - t.Run("multi-dir-file-collision", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, fiveDirPath, defaultProvider) - readBucketMulti := storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root1"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root2"), - ), - ) - AssertPathToContent( - t, - readBucketMulti, - "", - map[string]string{ - // root1 - "foo": testProtoContent, - // root2 - "foo/bar.proto": testProtoContent, - }, - ) - }) - - for _, testCase := range []struct { - name string - prefix string - stripComponentCount uint32 - newReadBucketFunc func(*testing.T) storage.ReadBucket - mappers []storage.Mapper - expectedPathToContent map[string]string - }{ - { - name: "proto-and-single-file", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - mappers: []storage.Mapper{ - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqual("root/foo.yaml"), - ), - }, - expectedPathToContent: map[string]string{ - "root/a/b/1.proto": testProtoContent, - "root/a/b/2.proto": testProtoContent, - "root/ab/1.proto": testProtoContent, - "root/ab/2.proto": testProtoContent, - "root/a/1.proto": testProtoContent, - "root/c/1.proto": testProtoContent, - "root/1.proto": testProtoContent, - "root/foo.yaml": testYAMLContent, - }, - }, - { - name: "proto-and-single-file-walk-prefix-root-a", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - prefix: "root/a", - mappers: []storage.Mapper{ - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqual("foo.yaml"), - ), - }, - expectedPathToContent: map[string]string{ - "root/a/b/1.proto": testProtoContent, - "root/a/b/2.proto": testProtoContent, - "root/a/1.proto": testProtoContent, - }, - }, - { - name: "proto-and-single-file-walk-prefix-root-a-2", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - prefix: "./root/a", - mappers: []storage.Mapper{ - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqual("foo.yaml"), - ), - }, - expectedPathToContent: map[string]string{ - "root/a/b/1.proto": testProtoContent, - "root/a/b/2.proto": testProtoContent, - "root/a/1.proto": testProtoContent, - }, - }, - { - name: "proto-and-single-file-strip-components", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - stripComponentCount: 1, - mappers: []storage.Mapper{ - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqual("a/bar.yaml"), - ), - }, - expectedPathToContent: map[string]string{ - "a/b/1.proto": testProtoContent, - "a/b/2.proto": testProtoContent, - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "a/1.proto": testProtoContent, - "c/1.proto": testProtoContent, - "1.proto": testProtoContent, - "a/bar.yaml": testYAMLContent, - }, - }, - { - name: "proto-and-single-file-map-prefix-root-a", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - mappers: []storage.Mapper{ - storage.MapOnPrefix("root/a"), - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqual("bar.yaml"), - ), - }, - expectedPathToContent: map[string]string{ - "b/1.proto": testProtoContent, - "b/2.proto": testProtoContent, - "1.proto": testProtoContent, - "bar.yaml": testYAMLContent, - }, - }, - { - name: "proto-and-single-file-map-prefix-a-strip-components", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - stripComponentCount: 1, - mappers: []storage.Mapper{ - storage.MapOnPrefix("a"), - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqual("bar.yaml"), - ), - }, - expectedPathToContent: map[string]string{ - "b/1.proto": testProtoContent, - "b/2.proto": testProtoContent, - "1.proto": testProtoContent, - "bar.yaml": testYAMLContent, - }, - }, - { - name: "all", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - mappers: []storage.Mapper{ - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathExt(".txt"), - storage.MatchPathExt(".yaml"), - ), - }, - expectedPathToContent: map[string]string{ - "root/a/b/1.proto": testProtoContent, - "root/a/b/2.proto": testProtoContent, - "root/a/b/2.txt": testTxtContent, - "root/ab/1.proto": testProtoContent, - "root/ab/2.proto": testProtoContent, - "root/ab/2.txt": testTxtContent, - "root/a/1.proto": testProtoContent, - "root/a/1.txt": testTxtContent, - "root/a/bar.yaml": testYAMLContent, - "root/c/1.proto": testProtoContent, - "root/1.proto": testProtoContent, - "root/foo.yaml": testYAMLContent, - }, - }, - { - name: "proto-and-single-file-not-equal-or-contained-map-prefix", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - mappers: []storage.Mapper{ - storage.MapOnPrefix("root"), - storage.MatchNot( - storage.MatchPathContained("a"), - ), - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqualOrContained("foo.yaml"), - ), - }, - expectedPathToContent: map[string]string{ - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "c/1.proto": testProtoContent, - "1.proto": testProtoContent, - "foo.yaml": testYAMLContent, - }, - }, - { - name: "proto-and-single-file-not-equal-or-contained-map-prefix-and", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - mappers: []storage.Mapper{ - storage.MapOnPrefix("root"), - storage.MatchAnd( - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqualOrContained("foo.yaml"), - ), - storage.MatchNot( - storage.MatchPathContained("a"), - ), - ), - }, - expectedPathToContent: map[string]string{ - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "c/1.proto": testProtoContent, - "1.proto": testProtoContent, - "foo.yaml": testYAMLContent, - }, - }, - { - name: "proto-and-single-file-not-equal-or-contained-map-prefix-and-2", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - mappers: []storage.Mapper{ - storage.MapOnPrefix("root"), - storage.MatchAnd( - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqual("foo.yaml"), - ), - storage.MatchNot( - storage.MatchOr( - storage.MatchPathEqualOrContained("a"), - storage.MatchPathEqualOrContained("c"), - ), - ), - ), - }, - expectedPathToContent: map[string]string{ - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "1.proto": testProtoContent, - "foo.yaml": testYAMLContent, - }, - }, - { - name: "proto-and-single-file-not-equal-or-contained-map-prefix-and-3", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - mappers: []storage.Mapper{ - storage.MapOnPrefix("root"), - storage.MatchAnd( - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathEqual("foo.yaml"), - ), - storage.MatchNot( - storage.MatchPathEqualOrContained("a"), - ), - storage.MatchNot( - storage.MatchPathEqualOrContained("c"), - ), - ), - }, - expectedPathToContent: map[string]string{ - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "1.proto": testProtoContent, - "foo.yaml": testYAMLContent, - }, - }, - { - name: "proto-and-single-file-not-equal-or-contained-map-prefix-chained", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - return readBucket - }, - mappers: []storage.Mapper{ - storage.MapOnPrefix("root"), - storage.MapOnPrefix("ab"), - storage.MatchPathExt(".proto"), - }, - expectedPathToContent: map[string]string{ - "1.proto": testProtoContent, - "2.proto": testProtoContent, - }, - }, - { - name: "multi-all", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) - return storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root1"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root2"), - ), - ) - }, - mappers: []storage.Mapper{ - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathExt(".txt"), - storage.MatchPathExt(".yaml"), - ), - }, - expectedPathToContent: map[string]string{ - // root1 - "a/b/1.proto": testProtoContent, - "a/b/2.proto": testProtoContent, - "a/b/2.txt": testTxtContent, - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "ab/2.txt": testTxtContent, - "a/1.proto": testProtoContent, - "a/1.txt": testTxtContent, - "a/bar.yaml": testYAMLContent, - "c/1.proto": testProtoContent, - "1.proto": testProtoContent, - "foo.yaml": testYAMLContent, - // root2 - "a/b/3.proto": testProtoContent, - "a/b/4.proto": testProtoContent, - "a/b/4.txt": testTxtContent, - "ab/3.proto": testProtoContent, - "ab/4.proto": testProtoContent, - "ab/4.txt": testTxtContent, - "a/2.proto": testProtoContent, - "a/2.txt": testTxtContent, - "a/bat.yaml": testYAMLContent, - "c/3.proto": testProtoContent, - "2.proto": testProtoContent, - "baz.yaml": testYAMLContent, - }, - }, - { - name: "multi-map-on-prefix", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) - return storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root1"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root2"), - ), - ) - }, - mappers: []storage.Mapper{ - storage.MapOnPrefix("a"), - }, - expectedPathToContent: map[string]string{ - // root1 - "b/1.proto": testProtoContent, - "b/2.proto": testProtoContent, - "b/2.txt": testTxtContent, - "1.proto": testProtoContent, - "1.txt": testTxtContent, - "bar.yaml": testYAMLContent, - // root2 - "b/3.proto": testProtoContent, - "b/4.proto": testProtoContent, - "b/4.txt": testTxtContent, - "2.proto": testProtoContent, - "2.txt": testTxtContent, - "bat.yaml": testYAMLContent, - }, - }, - { - name: "multi-map-on-prefix-filter", - newReadBucketFunc: func(t *testing.T) storage.ReadBucket { - readBucket, _ := newReadBucket(t, twoDirPath, defaultProvider) - return storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root1"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root2"), - ), - ) - }, - mappers: []storage.Mapper{ - storage.MapOnPrefix("a"), - storage.MatchOr( - storage.MatchPathExt(".proto"), - storage.MatchPathExt(".txt"), - ), - }, - expectedPathToContent: map[string]string{ - // root1 - "b/1.proto": testProtoContent, - "b/2.proto": testProtoContent, - "b/2.txt": testTxtContent, - "1.proto": testProtoContent, - "1.txt": testTxtContent, - // root2 - "b/3.proto": testProtoContent, - "b/4.proto": testProtoContent, - "b/4.txt": testTxtContent, - "2.proto": testProtoContent, - "2.txt": testTxtContent, - }, - }, - } { - testCase := testCase - if testCase.stripComponentCount == 0 { - t.Run(fmt.Sprintf("copy-%s", testCase.name), func(t *testing.T) { - t.Parallel() - readBucket := testCase.newReadBucketFunc(t) - readBucket = storage.MapReadBucket(readBucket, testCase.mappers...) - writeBucket := newWriteBucket(t, defaultProvider) - _, err := storage.Copy( - context.Background(), - readBucket, - writeBucket, - ) - require.NoError(t, err) - readBucket = writeBucketToReadBucket(t, writeBucket) - AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) - }) - t.Run(fmt.Sprintf("tar-mapper-read-%s", testCase.name), func(t *testing.T) { - t.Parallel() - readBucket := testCase.newReadBucketFunc(t) - readBucket = storage.MapReadBucket(readBucket, testCase.mappers...) - writeBucket := newWriteBucket(t, defaultProvider) - buffer := bytes.NewBuffer(nil) - require.NoError(t, storagearchive.Tar( - context.Background(), - readBucket, - buffer, - )) - require.NoError(t, storagearchive.Untar( - context.Background(), - buffer, - writeBucket, - nil, - testCase.stripComponentCount, - )) - readBucket = writeBucketToReadBucket(t, writeBucket) - AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) - }) - t.Run(fmt.Sprintf("zip-mapper-read-%s", testCase.name), func(t *testing.T) { - t.Parallel() - readBucket := testCase.newReadBucketFunc(t) - readBucket = storage.MapReadBucket(readBucket, testCase.mappers...) - writeBucket := newWriteBucket(t, defaultProvider) - buffer := bytes.NewBuffer(nil) - require.NoError(t, storagearchive.Zip( - context.Background(), - readBucket, - buffer, - true, - )) - data := buffer.Bytes() - require.NoError(t, storagearchive.Unzip( - context.Background(), - bytes.NewReader(data), - int64(len(data)), - writeBucket, - nil, - testCase.stripComponentCount, - )) - readBucket = writeBucketToReadBucket(t, writeBucket) - AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) - }) - } - t.Run(fmt.Sprintf("tar-mapper-write-%s", testCase.name), func(t *testing.T) { - t.Parallel() - readBucket := testCase.newReadBucketFunc(t) - writeBucket := newWriteBucket(t, defaultProvider) - buffer := bytes.NewBuffer(nil) - require.NoError(t, storagearchive.Tar( - context.Background(), - readBucket, - buffer, - )) - require.NoError(t, storagearchive.Untar( - context.Background(), - buffer, - writeBucket, - storage.MapChain(testCase.mappers...), - testCase.stripComponentCount, - )) - readBucket = writeBucketToReadBucket(t, writeBucket) - AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) - }) - t.Run(fmt.Sprintf("zip-mapper-write%s", testCase.name), func(t *testing.T) { - t.Parallel() - readBucket := testCase.newReadBucketFunc(t) - writeBucket := newWriteBucket(t, defaultProvider) - buffer := bytes.NewBuffer(nil) - require.NoError(t, storagearchive.Zip( - context.Background(), - readBucket, - buffer, - true, - )) - data := buffer.Bytes() - require.NoError(t, storagearchive.Unzip( - context.Background(), - bytes.NewReader(data), - int64(len(data)), - writeBucket, - storage.MapChain(testCase.mappers...), - testCase.stripComponentCount, - )) - readBucket = writeBucketToReadBucket(t, writeBucket) - AssertPathToContent(t, readBucket, testCase.prefix, testCase.expectedPathToContent) - }) - } - - t.Run("diff", func(t *testing.T) { - t.Parallel() - diffDirPathA := filepath.Join(storagetestingDirPath, "testdata", "diff", "a") - diffDirPathB := filepath.Join(storagetestingDirPath, "testdata", "diff", "b") - readBucketA, getExternalPathFuncA := newReadBucket(t, diffDirPathA, defaultProvider) - readBucketB, getExternalPathFuncB := newReadBucket(t, diffDirPathB, defaultProvider) - readBucketA = storage.MapReadBucket(readBucketA, storage.MapOnPrefix("prefix")) - readBucketB = storage.MapReadBucket(readBucketB, storage.MapOnPrefix("prefix")) - externalPathPrefixA := getExternalPathFuncA(t, diffDirPathA, "prefix") + string(os.PathSeparator) - externalPathPrefixB := getExternalPathFuncB(t, diffDirPathB, "prefix") + string(os.PathSeparator) - a1TxtPath := filepath.ToSlash(externalPathPrefixA + "1.txt") - b1TxtPath := filepath.ToSlash(externalPathPrefixB + "1.txt") - a2TxtPath := filepath.ToSlash(externalPathPrefixA + "2.txt") - b2TxtPath := filepath.ToSlash(externalPathPrefixB + "2.txt") - - diff, err := storage.DiffBytes( - context.Background(), - runner, - readBucketA, - readBucketB, - storage.DiffWithSuppressTimestamps(), - storage.DiffWithExternalPaths(), - storage.DiffWithExternalPathPrefixes( - externalPathPrefixA, - externalPathPrefixB, - ), - ) - - // This isn't great, but it tests the exact behavior of the diff - // functionality. Headers are always "ToSlash" paths and `\n`. The - // contents of the diff are platform dependent. - diff1 := `@@ -1,2 +1,2 @@ --aaaa - bbbb -+cccc -` - diff2 := `@@ -1 +0,0 @@ --dddd -` - expectDiff := fmt.Sprintf( - `diff -u %s %s ---- %s -+++ %s -%sdiff -u %s %s ---- %s -+++ %s -%s`, - a1TxtPath, - b1TxtPath, - a1TxtPath, - b1TxtPath, - diff1, - a2TxtPath, - b2TxtPath, - a2TxtPath, - b2TxtPath, - diff2, - ) - - require.NoError(t, err) - assert.Equal( - t, - expectDiff, - string(diff), - ) - }) - - t.Run("overlap-success", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, threeDirPath, defaultProvider) - readBucket = storage.MapReadBucket(readBucket, storage.MatchPathExt(".proto")) - readBucket = storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("a"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("b"), - ), - ) - allPaths, err := storage.AllPaths( - context.Background(), - readBucket, - "", - ) - require.NoError(t, err) - assert.Equal( - t, - []string{ - "one.proto", - "two.proto", - }, - allPaths, - ) - }) - - t.Run("overlap-error", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, threeDirPath, defaultProvider) - readBucket = storage.MapReadBucket( - storage.MultiReadBucket( - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("a"), - ), - storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("b"), - ), - ), - storage.MatchPathExt(".proto"), - ) - _, err := storage.AllPaths( - context.Background(), - readBucket, - "", - ) - assert.True(t, storage.IsExistsMultipleLocations(err)) - }) - - t.Run("map-write-bucket", func(t *testing.T) { - t.Parallel() - writeBucket := newWriteBucket(t, defaultProvider) - mapWriteBucket := storage.MapWriteBucket( - writeBucket, - storage.MapOnPrefix("a/b/c"), - ) - writeObjectCloser, err := mapWriteBucket.Put( - context.Background(), - "hello", - ) - require.NoError(t, err) - _, err = writeObjectCloser.Write([]byte("abcd")) - require.NoError(t, err) - require.NoError(t, writeObjectCloser.Close()) - readBucket := writeBucketToReadBucket(t, writeBucket) - data, err := storage.ReadPath( - context.Background(), - readBucket, - "a/b/c/hello", - ) - require.NoError(t, err) - require.Equal(t, "abcd", string(data)) - }) - - t.Run("absolute-path-read-error", func(t *testing.T) { - t.Parallel() - - absolutePath := "/absolute/path" - if runtime.GOOS == "windows" { - absolutePath = "C:\\Fake\\Absolute\\Path" - } - expectErr := fmt.Sprintf("%s: expected to be relative", absolutePath) - - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - _, err := readBucket.Get(context.Background(), absolutePath) - require.EqualError(t, err, expectErr, "should be using storageutil.ValidatePath on Get") - _, err = readBucket.Stat(context.Background(), absolutePath) - require.EqualError(t, err, expectErr, "should be using storageutil.ValidatePath on Stat") - err = readBucket.Walk(context.Background(), absolutePath, nil) - require.EqualError(t, err, expectErr, "should be using storageutil.ValidatePrefix on Walk") - }) - - t.Run("absolute-path-write-error", func(t *testing.T) { - t.Parallel() - - absolutePath := "/absolute/path" - if runtime.GOOS == "windows" { - absolutePath = "C:\\Fake\\Absolute\\Path" - } - expectErr := fmt.Sprintf("%s: expected to be relative", absolutePath) - - writeBucket := newWriteBucket(t, defaultProvider) - _, err := writeBucket.Put(context.Background(), absolutePath) - require.EqualError(t, err, expectErr, "should be using normalize.NormalizeAndValidate on Put") - err = writeBucket.Delete(context.Background(), absolutePath) - require.EqualError(t, err, expectErr, "should be using normalize.NormalizeAndValidate on Delete") - }) - - t.Run("root-path-error", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - _, err := readBucket.Get(context.Background(), ".") - require.EqualError(t, err, "cannot use root", "should be using storageutil.ValidatePath on Get") - _, err = readBucket.Stat(context.Background(), ".") - require.EqualError(t, err, "cannot use root", "should be using storageutil.ValidatePath on Stat") - }) - - t.Run("write-bucket-put-delete", func(t *testing.T) { - t.Parallel() - writeBucket := newWriteBucket(t, defaultProvider) - err := writeBucket.Delete(context.Background(), "hello") - require.True(t, storage.IsNotExist(err)) - writeObjectCloser, err := writeBucket.Put( - context.Background(), - "hello", - ) - require.NoError(t, err) - _, err = writeObjectCloser.Write([]byte("abcd")) - require.NoError(t, err) - require.NoError(t, writeObjectCloser.Close()) - err = writeBucket.Delete(context.Background(), "hello") - require.NoError(t, err) - err = writeBucket.Delete(context.Background(), "hello") - require.True(t, storage.IsNotExist(err)) - writeObjectCloser, err = writeBucket.Put( - context.Background(), - "hello", - ) - require.NoError(t, err) - _, err = writeObjectCloser.Write([]byte("abcd")) - require.NoError(t, err) - require.NoError(t, writeObjectCloser.Close()) - err = writeBucket.Delete(context.Background(), "hello") - require.NoError(t, err) - err = writeBucket.Delete(context.Background(), "hello") - require.True(t, storage.IsNotExist(err)) - }) - - t.Run("write-bucket-put-delete-all", func(t *testing.T) { - t.Parallel() - ctx := context.Background() - writeBucket := newWriteBucket(t, defaultProvider) - // this test starts with this data in the bucket, and then - // deletes it over time in different ways - pathToData := map[string]string{ - "a.txt": testTxtContent, - "b/d.txt": testTxtContent, - "b/d/e.txt": testTxtContent, - "b/d/f.txt": testTxtContent, - "c.d/e.txt": testTxtContent, - "c.de/f.txt": testTxtContent, - "g.txt": testTxtContent, - } - for path, data := range pathToData { - err := storage.PutPath(ctx, writeBucket, path, []byte(data)) - require.NoError(t, err) - } - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err := writeBucket.DeleteAll(ctx, "h") - require.NoError(t, err) - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err = writeBucket.DeleteAll(ctx, "b/d/e.txt") - require.NoError(t, err) - delete(pathToData, "b/d/e.txt") - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err = writeBucket.DeleteAll(ctx, "b/d") - require.NoError(t, err) - delete(pathToData, "b/d/f.txt") - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err = writeBucket.DeleteAll(ctx, "b") - require.NoError(t, err) - delete(pathToData, "b/d.txt") - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err = writeBucket.DeleteAll(ctx, "a.txt") - require.NoError(t, err) - delete(pathToData, "a.txt") - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err = writeBucket.DeleteAll(ctx, "c.d") - require.NoError(t, err) - delete(pathToData, "c.d/e.txt") - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err = writeBucket.DeleteAll(ctx, "c.d") - require.NoError(t, err) - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err = writeBucket.DeleteAll(ctx, "c.de") - require.NoError(t, err) - delete(pathToData, "c.de/f.txt") - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - err = writeBucket.DeleteAll(ctx, "") - require.NoError(t, err) - delete(pathToData, "g.txt") - AssertPathToContent( - t, - writeBucketToReadBucket(t, writeBucket), - "", - pathToData, - ) - }) - - t.Run("walk-prefixed-bucket-should-not-error", func(t *testing.T) { - t.Parallel() - writeBucket := newWriteBucket(t, defaultProvider) - readBucket := writeBucketToReadBucket(t, writeBucket) - mappedReadBucket := storage.MapReadBucket(readBucket, storage.MapOnPrefix("prefix")) - err := mappedReadBucket.Walk(context.Background(), "", func(_ storage.ObjectInfo) error { - return nil - }) - require.NoError(t, err) - }) - - t.Run("symlink_success_no_symlinks", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, symlinkSuccessDirPath, defaultProvider) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "file.proto": testProtoContent, - }, - ) - }) - t.Run("symlink_success_follow_symlinks", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket( - t, - symlinkSuccessDirPath, - storageos.NewProvider( - storageos.ProviderWithSymlinks(), - ), - ) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "1.proto": testProtoContent, - "a/b/1.proto": testProtoContent, - "a/b/2.proto": testProtoContent, - "a/b/2.txt": testTxtContent, - "a/bar.yaml": testYAMLContent, - "a/file.proto": testProtoContent, - "ab/1.proto": testProtoContent, - "ab/2.proto": testProtoContent, - "ab/2.txt": testTxtContent, - "file.proto": testProtoContent, - }, - ) - }) - t.Run("symlink_loop_no_symlinks", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket(t, symlinkLoopDirPath, defaultProvider) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "file.proto": testProtoContent, - }, - ) - }) - t.Run("symlink_loop_follow_symlinks", func(t *testing.T) { - t.Parallel() - readBucket, _ := newReadBucket( - t, - symlinkLoopDirPath, - storageos.NewProvider( - storageos.ProviderWithSymlinks(), - ), - ) - AssertPathToContent( - t, - readBucket, - "", - map[string]string{ - "file.proto": testProtoContent, - }, - ) - }) - t.Run("is_empty", func(t *testing.T) { - t.Parallel() - ctx := context.Background() - - readBucket, _ := newReadBucket(t, oneDirPath, defaultProvider) - isEmpty, err := storage.IsEmpty(ctx, readBucket, "") - require.NoError(t, err) - require.False(t, isEmpty) - isEmpty, err = storage.IsEmpty(ctx, readBucket, "root/a") - require.NoError(t, err) - require.False(t, isEmpty) - - tmpDir, err := tmp.NewDir() - require.NoError(t, err) - readBucket, _ = newReadBucket(t, tmpDir.AbsPath(), defaultProvider) - isEmpty, err = storage.IsEmpty(ctx, readBucket, "") - require.NoError(t, err) - require.True(t, isEmpty) - err = os.WriteFile(filepath.Join(tmpDir.AbsPath(), "foo.txt"), []byte("foo"), 0o600) - require.NoError(t, err) - // need to make a new readBucket since the old one won't necessarily have the foo.txt - // file in it, ie in-memory buckets - readBucket, _ = newReadBucket(t, tmpDir.AbsPath(), defaultProvider) - isEmpty, err = storage.IsEmpty(ctx, readBucket, "") - require.NoError(t, err) - require.False(t, isEmpty) - isEmpty, err = storage.IsEmpty( - ctx, - storage.MapReadBucket(readBucket, storage.MatchPathExt(".proto")), - "", - ) - require.NoError(t, err) - require.True(t, isEmpty) - require.NoError(t, tmpDir.Close()) - }) - t.Run("no-external-path", func(t *testing.T) { - t.Parallel() - readBucket, getExternalPathFunc := newReadBucket(t, oneDirPath, defaultProvider) - readBucket = storage.MapReadBucket( - readBucket, - storage.MapOnPrefix("root/a"), - ) - AssertObjectInfo( - t, - readBucket, - "1.proto", - getExternalPathFunc(t, oneDirPath, filepath.Join("root", "a", "1.proto")), - ) - readBucket = storage.NoExternalPathReadBucket(readBucket) - AssertObjectInfo( - t, - readBucket, - "1.proto", - "1.proto", - ) - }) - t.Run("limit-write-bucket", func(t *testing.T) { - t.Parallel() - writeBucket := newWriteBucket(t, defaultProvider) - readBucket := writeBucketToReadBucket(t, writeBucket) - const limit = 2048 - limitedWriteBucket := storage.LimitWriteBucket(writeBucket, limit) - var ( - wg sync.WaitGroup - writtenBytes atomic.Int64 - triedBytes atomic.Int64 - ) - for i := 0; i < 10; i++ { - wg.Add(1) - go func(i int) { - defer wg.Done() - data := bytes.Repeat([]byte("b"), i*100) - path := strconv.Itoa(i) - triedBytes.Add(int64(len(data))) - err := storage.PutPath(context.Background(), limitedWriteBucket, path, data) - if err != nil { - assert.True(t, storage.IsWriteLimitReached(err)) - return - } - readData, err := storage.ReadPath(context.Background(), readBucket, path) - assert.NoError(t, err) - assert.Equal(t, readData, data) - writtenBytes.Add(int64(len(data))) - }(i) - } - wg.Wait() - require.Greater(t, triedBytes.Load(), int64(limit)) - assert.LessOrEqual(t, writtenBytes.Load(), int64(limit)) - }) - t.Run("limit-untar-file-size", func(t *testing.T) { - t.Parallel() - writeBucket := newWriteBucket(t, defaultProvider) - const limit = 2048 - files := map[string][]byte{ - "within": bytes.Repeat([]byte{0}, limit-1), - "at": bytes.Repeat([]byte{0}, limit), - "exceeds": bytes.Repeat([]byte{0}, limit+1), - "match-file": bytes.Repeat([]byte{0}, limit-1), - } - for path, data := range files { - err := storage.PutPath(context.Background(), writeBucket, path, data) - require.NoError(t, err) - } - var buffer bytes.Buffer - err := storagearchive.Tar(context.Background(), writeBucketToReadBucket(t, writeBucket), &buffer) - require.NoError(t, err) - writeBucket = newWriteBucket(t, defaultProvider) - tarball := bytes.NewReader(buffer.Bytes()) - err = storagearchive.Untar(context.Background(), tarball, writeBucket, nil, 0, storagearchive.WithMaxFileSizeUntarOption(limit)) - assert.ErrorIs(t, err, storagearchive.ErrFileSizeLimit) - _, err = tarball.Seek(0, io.SeekStart) - require.NoError(t, err) - err = storagearchive.Untar(context.Background(), tarball, writeBucket, nil, 0) - assert.NoError(t, err) - _, err = tarball.Seek(0, io.SeekStart) - require.NoError(t, err) - err = storagearchive.Untar(context.Background(), tarball, writeBucket, nil, 0, storagearchive.WithMaxFileSizeUntarOption(limit+1)) - assert.NoError(t, err) - err = storagearchive.Untar( - context.Background(), - tarball, - writeBucket, - storage.MatchPathEqual("match-file"), - 0, - storagearchive.WithMaxFileSizeUntarOption(limit), - ) - assert.NoError(t, err) - }) -} diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/base/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/b/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/bar.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/base/a/bar.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/base/ab/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/1.txt deleted file mode 100644 index 64e09eead..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/1.txt +++ /dev/null @@ -1,2 +0,0 @@ -aaaa -bbbb diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/2.txt deleted file mode 100644 index b9a1dd099..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/a/prefix/2.txt +++ /dev/null @@ -1 +0,0 @@ -dddd diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/1.txt deleted file mode 100644 index 223badc7e..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/1.txt +++ /dev/null @@ -1,2 +0,0 @@ -bbbb -cccc diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/3.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/diff/b/prefix/3.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/five/root1/foo b/pkg/bufman/pkg/storage/storagetesting/testdata/five/root1/foo deleted file mode 100644 index 69605d73a..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/five/root1/foo +++ /dev/null @@ -1,3 +0,0 @@ -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/five/root2/foo/bar.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/five/root2/foo/bar.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/five/root2/foo/bar.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/3.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/3.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/3.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/four/root/a/b/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/link/b b/pkg/bufman/pkg/storage/storagetesting/testdata/link/b deleted file mode 100644 index f7f964f73..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/link/b +++ /dev/null @@ -1 +0,0 @@ -../base/a/b \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/link/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/link/bar.yaml deleted file mode 100644 index 490a5eb33..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/link/bar.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -../base/a/bar.yaml \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/link/file.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/link/file.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/link/file.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/1.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/b/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/bar.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/a/bar.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/ab/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/c/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/c/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/c/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/foo.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/foo.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/one/root/foo.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/a/b b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/a/b deleted file mode 100644 index 42532fe13..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/a/b +++ /dev/null @@ -1 +0,0 @@ -../b \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/b/a b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/b/a deleted file mode 100644 index 82f488f26..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/b/a +++ /dev/null @@ -1 +0,0 @@ -../a \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/file.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/file.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_loop/file.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/1.proto deleted file mode 100644 index b75f37911..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/1.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -../base/1.proto \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/a b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/a deleted file mode 100644 index f48f654b2..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/a +++ /dev/null @@ -1 +0,0 @@ -../link \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/ab b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/ab deleted file mode 100644 index d19fa240b..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/ab +++ /dev/null @@ -1 +0,0 @@ -../base/ab \ No newline at end of file diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/file.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/file.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/symlink_success/file.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/three/a/one.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/one.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/one.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/two.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/two.proto deleted file mode 100644 index 12bf8a0cd..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/three/b/two.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/foo.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/foo.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/foo.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/1.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/b/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/bar.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/a/bar.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/ab/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/c/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/c/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/c/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/foo.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/foo.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root1/foo.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/3.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/3.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/3.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/b/4.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/bat.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/bat.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/a/bat.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/3.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/3.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/3.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/ab/4.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/baz.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/baz.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/baz.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/c/3.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/c/3.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/root2/c/3.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/1.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/b/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/bar.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/bar.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/a/bar.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.txt b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/ab/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/c/1.proto b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/c/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/c/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/foo.yaml b/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/foo.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/storage/storagetesting/testdata/two/rootoverlap/foo.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/stringutil/stringutil_test.go b/pkg/bufman/pkg/stringutil/stringutil_test.go deleted file mode 100644 index b94502bf3..000000000 --- a/pkg/bufman/pkg/stringutil/stringutil_test.go +++ /dev/null @@ -1,377 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package stringutil - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestToLowerSnakeCase(t *testing.T) { - t.Parallel() - assert.Equal(t, "", ToLowerSnakeCase("")) - assert.Equal(t, "", ToLowerSnakeCase(" ")) - assert.Equal(t, "", ToLowerSnakeCase("_")) - assert.Equal(t, "", ToLowerSnakeCase("__")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("PascalCase")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase(" PascalCase")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("PascalCase ")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("pascalCase")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("PascalCase_")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("_PascalCase")) - assert.Equal(t, "pascal_case_hello", ToLowerSnakeCase("PascalCase__Hello")) - assert.Equal(t, "json_pascal", ToLowerSnakeCase("JSONPascal")) - assert.Equal(t, "foo_json_pascal", ToLowerSnakeCase("FooJSONPascal")) - assert.Equal(t, "json_pascal_json", ToLowerSnakeCase("JSONPascalJSON")) - assert.Equal(t, "v1", ToLowerSnakeCase("v1")) - assert.Equal(t, "v1beta1", ToLowerSnakeCase("v1beta1")) - assert.Equal(t, "v1beta_1", ToLowerSnakeCase("v1beta_1")) - assert.Equal(t, "v_1", ToLowerSnakeCase("v1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "v_1beta_1", ToLowerSnakeCase("v1beta1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "pascal_case1", ToLowerSnakeCase("PascalCase1")) - assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("PascalCase_1")) - assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("PascalCase1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "foo_json1_pascal", ToLowerSnakeCase("FooJSON1Pascal")) - assert.Equal(t, "foo_json_1_pascal", ToLowerSnakeCase("FooJSON_1Pascal")) - assert.Equal(t, "foo_json_1_pascal", ToLowerSnakeCase("FooJSON1Pascal", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "pascal_case1", ToLowerSnakeCase("pascal_case1")) - assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("pascal_case_1")) - assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("pascal_case1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "pascal_case_1", ToLowerSnakeCase("pascal_case_1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase("foo_bar_baz")) - assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase("_foo_bar_baz_")) - assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase("foo_bar__baz")) - assert.Equal(t, "pascal_case_hello", ToLowerSnakeCase("PascalCase--Hello")) - assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase("_foo-bar-baz_")) - assert.Equal(t, "foo_bar_baz", ToLowerSnakeCase(" Foo Bar _Baz")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("pascal_case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("pascalCase")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase(" pascal_case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase(" pascal_case ")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("pascal_case ")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("Pascal_case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("__Pascal___case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("__Pascal___case__")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("Pascal___case__")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("Pascal-case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("Pascal case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase(" Pascal case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("PASCAL_case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("__PASCAL___case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("__PASCAL___case__")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("PASCAL___case__")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("PASCAL-case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase("PASCAL case")) - assert.Equal(t, "pascal_case", ToLowerSnakeCase(" PASCAL case")) -} - -func TestToUpperSnakeCase(t *testing.T) { - t.Parallel() - assert.Equal(t, "", ToUpperSnakeCase("")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PascalCase")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("pascalCase")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PascalCase_")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("_PascalCase")) - assert.Equal(t, "PASCAL_CASE_HELLO", ToUpperSnakeCase("PascalCase__Hello")) - assert.Equal(t, "JSON_PASCAL", ToUpperSnakeCase("JSONPascal")) - assert.Equal(t, "FOO_JSON_PASCAL", ToUpperSnakeCase("FooJSONPascal")) - assert.Equal(t, "PASCAL_CASE1", ToUpperSnakeCase("PascalCase1")) - assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PascalCase_1")) - assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PascalCase1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "FOO_JSON1_PASCAL", ToUpperSnakeCase("FooJSON1Pascal")) - assert.Equal(t, "FOO_JSON_1_PASCAL", ToUpperSnakeCase("FooJSON_1Pascal")) - assert.Equal(t, "FOO_JSON_1_PASCAL", ToUpperSnakeCase("FooJSON1Pascal", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "PASCAL_CASE1", ToUpperSnakeCase("pascal_case1")) - assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("pascal_case_1")) - assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("pascal_case1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("pascal_case_1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "PASCAL_CASE1", ToUpperSnakeCase("PASCAL_CASE1")) - assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PASCAL_CASE_1")) - assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PASCAL_CASE1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "PASCAL_CASE_1", ToUpperSnakeCase("PASCAL_CASE_1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "V1", ToUpperSnakeCase("v1")) - assert.Equal(t, "V1BETA1", ToUpperSnakeCase("v1beta1")) - assert.Equal(t, "V_1", ToUpperSnakeCase("v1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "V_1BETA_1", ToUpperSnakeCase("v1beta1", SnakeCaseWithNewWordOnDigits())) - assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase("foo_bar_baz")) - assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase("_foo_bar_baz_")) - assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase("foo_bar__baz")) - assert.Equal(t, "PASCAL_CASE_HELLO", ToUpperSnakeCase("PascalCase--Hello")) - assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase("_foo-bar-baz_")) - assert.Equal(t, "FOO_BAR_BAZ", ToUpperSnakeCase(" Foo Bar _Baz")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("pascal_case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("pascalCase")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase(" pascal_case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase(" pascal_case ")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("pascal_case ")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("Pascal_case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("__Pascal___case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("__Pascal___case__")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("Pascal___case__")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("Pascal-case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("Pascal case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase(" Pascal case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL_case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("__PASCAL___case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("__PASCAL___case__")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL___case__")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL-case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase(" PASCAL case")) - assert.Equal(t, "PASCAL_CASE", ToUpperSnakeCase("PASCAL_case")) -} - -func TestToPascalCase(t *testing.T) { - t.Parallel() - assert.Equal(t, "", ToPascalCase("")) - assert.Equal(t, "", ToPascalCase(" ")) - assert.Equal(t, "PascalCase", ToPascalCase("pascal_case")) - assert.Equal(t, "PascalCase", ToPascalCase("pascalCase")) - assert.Equal(t, "PascalCase", ToPascalCase(" pascal_case")) - assert.Equal(t, "PascalCase", ToPascalCase(" pascal_case ")) - assert.Equal(t, "PascalCase", ToPascalCase("pascal_case ")) - assert.Equal(t, "PascalCase", ToPascalCase("Pascal_case")) - assert.Equal(t, "PascalCase", ToPascalCase("__Pascal___case")) - assert.Equal(t, "PascalCase", ToPascalCase("__Pascal___case__")) - assert.Equal(t, "PascalCase", ToPascalCase("Pascal___case__")) - assert.Equal(t, "PascalCase", ToPascalCase("Pascal-case")) - assert.Equal(t, "PascalCase", ToPascalCase("Pascal case")) - assert.Equal(t, "PascalCase", ToPascalCase(" Pascal case")) - assert.Equal(t, "PASCALCase", ToPascalCase("PASCAL_case")) - assert.Equal(t, "PASCALCase", ToPascalCase("__PASCAL___case")) - assert.Equal(t, "PASCALCase", ToPascalCase("__PASCAL___case__")) - assert.Equal(t, "PASCALCase", ToPascalCase("PASCAL___case__")) - assert.Equal(t, "PASCALCase", ToPascalCase("PASCAL-case")) - assert.Equal(t, "PASCALCase", ToPascalCase("PASCAL case")) - assert.Equal(t, "PASCALCase", ToPascalCase(" PASCAL case")) - assert.Equal(t, "PascalCase", ToPascalCase("PascalCase")) - assert.Equal(t, "PascalCase", ToPascalCase("pascalCase")) - assert.Equal(t, "PascalCase", ToPascalCase("PascalCase_")) - assert.Equal(t, "PascalCase", ToPascalCase("_PascalCase")) - assert.Equal(t, "PascalCaseHello", ToPascalCase("PascalCase__Hello")) - assert.Equal(t, "JSONPascal", ToPascalCase("JSONPascal")) - assert.Equal(t, "FooJSONPascal", ToPascalCase("FooJSONPascal")) - assert.Equal(t, "PascalCase1", ToPascalCase("PascalCase1")) - assert.Equal(t, "FooJSON1Pascal", ToPascalCase("FooJSON1Pascal")) - assert.Equal(t, "FooBarBaz", ToPascalCase("foo_bar_baz")) - assert.Equal(t, "FooBarBaz", ToPascalCase("_foo_bar_baz_")) - assert.Equal(t, "FooBarBaz", ToPascalCase("foo_bar__baz")) - assert.Equal(t, "PascalCaseHello", ToPascalCase("PascalCase--Hello")) - assert.Equal(t, "FooBarBaz", ToPascalCase("_foo-bar-baz_")) - assert.Equal(t, "FooBarBaz", ToPascalCase(" Foo Bar _Baz")) - assert.Equal(t, "FooBarBaz", ToPascalCase(" Foo.Bar.Baz")) - assert.Equal(t, "FooBarBaz", ToPascalCase("foo_bar.baz")) -} - -func TestJoinSliceQuoted(t *testing.T) { - t.Parallel() - assert.Equal(t, ``, JoinSliceQuoted(nil, ", ")) - assert.Equal(t, ``, JoinSliceQuoted([]string{}, ", ")) - assert.Equal(t, `"a"`, JoinSliceQuoted([]string{"a"}, ", ")) - assert.Equal(t, `"a", "b"`, JoinSliceQuoted([]string{"a", "b"}, ", ")) - assert.Equal(t, `"a", "b", "c"`, JoinSliceQuoted([]string{"a", "b", "c"}, ", ")) -} - -func TestSliceToHumanString(t *testing.T) { - t.Parallel() - assert.Equal(t, ``, SliceToHumanString(nil)) - assert.Equal(t, ``, SliceToHumanString([]string{})) - assert.Equal(t, `a`, SliceToHumanString([]string{"a"})) - assert.Equal(t, `a and b`, SliceToHumanString([]string{"a", "b"})) - assert.Equal(t, `a, b, and c`, SliceToHumanString([]string{"a", "b", "c"})) -} - -func TestSliceToHumanStringQuoted(t *testing.T) { - t.Parallel() - assert.Equal(t, ``, SliceToHumanStringQuoted(nil)) - assert.Equal(t, ``, SliceToHumanStringQuoted([]string{})) - assert.Equal(t, `"a"`, SliceToHumanStringQuoted([]string{"a"})) - assert.Equal(t, `"a" and "b"`, SliceToHumanStringQuoted([]string{"a", "b"})) - assert.Equal(t, `"a", "b", and "c"`, SliceToHumanStringQuoted([]string{"a", "b", "c"})) -} - -func TestSliceToHumanStringOr(t *testing.T) { - t.Parallel() - assert.Equal(t, ``, SliceToHumanStringOr(nil)) - assert.Equal(t, ``, SliceToHumanStringOr([]string{})) - assert.Equal(t, `a`, SliceToHumanStringOr([]string{"a"})) - assert.Equal(t, `a or b`, SliceToHumanStringOr([]string{"a", "b"})) - assert.Equal(t, `a, b, or c`, SliceToHumanStringOr([]string{"a", "b", "c"})) -} - -func TestSliceToHumanStringOrQuoted(t *testing.T) { - t.Parallel() - assert.Equal(t, ``, SliceToHumanStringOrQuoted(nil)) - assert.Equal(t, ``, SliceToHumanStringOrQuoted([]string{})) - assert.Equal(t, `"a"`, SliceToHumanStringOrQuoted([]string{"a"})) - assert.Equal(t, `"a" or "b"`, SliceToHumanStringOrQuoted([]string{"a", "b"})) - assert.Equal(t, `"a", "b", or "c"`, SliceToHumanStringOrQuoted([]string{"a", "b", "c"})) -} - -func TestSliceToUniqueSortedSlice(t *testing.T) { - t.Parallel() - assert.Equal(t, []string{}, SliceToUniqueSortedSlice(nil)) - assert.Equal(t, []string{}, SliceToUniqueSortedSlice([]string{})) - assert.Equal(t, []string{"Are", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats"})) - assert.Equal(t, []string{"Are", "are", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats", "are"})) - assert.Equal(t, []string{"Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats", "Are", "Bats"})) - assert.Equal(t, []string{"", "Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats", "", "Are", "Bats", ""})) - assert.Equal(t, []string{"", " ", "Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSlice([]string{"bats", "Are", "cats", "", "Are", "Bats", "", " "})) - assert.Equal(t, []string{""}, SliceToUniqueSortedSlice([]string{"", ""})) - assert.Equal(t, []string{""}, SliceToUniqueSortedSlice([]string{""})) -} - -func TestSliceToUniqueSortedSliceFilterEmptyStrings(t *testing.T) { - t.Parallel() - assert.Equal(t, []string{}, SliceToUniqueSortedSliceFilterEmptyStrings(nil)) - assert.Equal(t, []string{}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{})) - assert.Equal(t, []string{"Are", "bats", "cats"}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"bats", "Are", "cats"})) - assert.Equal(t, []string{"Are", "are", "bats", "cats"}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"bats", "Are", "cats", "are"})) - assert.Equal(t, []string{"Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"bats", "Are", "cats", "Are", "Bats"})) - assert.Equal(t, []string{"Are", "Bats", "bats", "cats"}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"bats", "Are", "cats", "", "Are", "Bats", ""})) - assert.Equal(t, []string{}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{"", "", " "})) - assert.Equal(t, []string{}, SliceToUniqueSortedSliceFilterEmptyStrings([]string{""})) -} - -func TestSliceElementsContained(t *testing.T) { - t.Parallel() - assert.True(t, SliceElementsContained(nil, nil)) - assert.True(t, SliceElementsContained([]string{}, []string{})) - assert.True(t, SliceElementsContained(nil, []string{})) - assert.True(t, SliceElementsContained([]string{}, nil)) - assert.True(t, SliceElementsContained([]string{"one"}, []string{"one"})) - assert.True(t, SliceElementsContained([]string{"one", "two"}, []string{"one"})) - assert.True(t, SliceElementsContained([]string{"one", "two"}, []string{"two"})) - assert.True(t, SliceElementsContained([]string{"one", "two"}, []string{"one", "two"})) - assert.True(t, SliceElementsContained([]string{"one", "two"}, []string{"two", "one"})) - assert.False(t, SliceElementsContained([]string{"one", "two"}, []string{"three"})) - assert.False(t, SliceElementsContained([]string{}, []string{"three"})) - assert.False(t, SliceElementsContained([]string{"one"}, []string{"one", "two"})) - assert.False(t, SliceElementsContained([]string{"two"}, []string{"one", "two"})) -} - -func TestSliceToChunks(t *testing.T) { - t.Parallel() - testSliceToChunks( - t, - []string{"are"}, - 1, - []string{"are"}, - ) - testSliceToChunks( - t, - []string{"are", "bats", "cats", "do", "eagle"}, - 1, - []string{"are"}, - []string{"bats"}, - []string{"cats"}, - []string{"do"}, - []string{"eagle"}, - ) - testSliceToChunks( - t, - []string{"are", "bats", "cats", "do", "eagle"}, - 2, - []string{"are", "bats"}, - []string{"cats", "do"}, - []string{"eagle"}, - ) - testSliceToChunks( - t, - []string{"are", "bats", "cats", "do", "eagle"}, - 3, - []string{"are", "bats", "cats"}, - []string{"do", "eagle"}, - ) - testSliceToChunks( - t, - []string{"are", "bats", "cats", "do", "eagle"}, - 6, - []string{"are", "bats", "cats", "do", "eagle"}, - ) - testSliceToChunks( - t, - nil, - 0, - ) -} - -func testSliceToChunks(t *testing.T, input []string, chunkSize int, expected ...[]string) { - assert.Equal(t, expected, SliceToChunks(input, chunkSize)) -} - -func TestAlphanumeric(t *testing.T) { - t.Parallel() - assert.True(t, IsAlphanumeric('0')) - assert.False(t, IsAlphanumeric('.')) -} - -func TestIsAlpha(t *testing.T) { - t.Parallel() - assert.True(t, IsAlpha('r')) - assert.True(t, IsAlpha('A')) - assert.True(t, IsAlpha('Z')) - assert.True(t, IsAlpha('a')) - assert.True(t, IsAlpha('z')) - assert.False(t, IsAlpha('.')) - assert.False(t, IsAlpha('0')) - assert.False(t, IsAlpha('9')) - assert.False(t, IsAlpha('!')) -} - -func TestIsLowerAlpha(t *testing.T) { - t.Parallel() - assert.True(t, IsLowerAlpha('r')) - assert.False(t, IsLowerAlpha('R')) -} - -func TestIsUpperAlpha(t *testing.T) { - t.Parallel() - assert.True(t, IsUpperAlpha('R')) - assert.False(t, IsUpperAlpha('r')) -} - -func TestIsNumeric(t *testing.T) { - t.Parallel() - assert.True(t, IsNumeric('0')) - assert.False(t, IsNumeric('r')) -} - -func TestIsLowerAlphanumeric(t *testing.T) { - t.Parallel() - assert.True(t, IsLowerAlphanumeric('0')) - assert.True(t, IsLowerAlphanumeric('r')) - assert.True(t, IsLowerAlphanumeric('a')) - assert.True(t, IsLowerAlphanumeric('z')) - assert.True(t, IsLowerAlphanumeric('9')) - assert.False(t, IsLowerAlphanumeric('R')) - assert.False(t, IsLowerAlphanumeric('A')) - assert.False(t, IsLowerAlphanumeric('Z')) - assert.False(t, IsLowerAlphanumeric('!')) -} - -func TestIsAlphanumeric(t *testing.T) { - t.Parallel() - require.True(t, IsAlphanumeric('A')) - require.True(t, IsAlphanumeric('Z')) - require.True(t, IsAlphanumeric('a')) - require.True(t, IsAlphanumeric('z')) - require.True(t, IsAlphanumeric('0')) - require.True(t, IsAlphanumeric('9')) - require.False(t, IsAlphanumeric('!')) -} diff --git a/pkg/bufman/pkg/thread/thread_test.go b/pkg/bufman/pkg/thread/thread_test.go deleted file mode 100644 index d1dab4207..000000000 --- a/pkg/bufman/pkg/thread/thread_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package thread - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "go.uber.org/atomic" -) - -func TestParallelizeWithImmediateCancellation(t *testing.T) { - t.Parallel() - // The bulk of the code relies on subtle timing that's difficult to - // reproduce, but we can test the most basic use case. - t.Run("RegularRun", func(t *testing.T) { - t.Parallel() - const jobsToExecute = 10 - var ( - executed atomic.Int64 - jobs = make([]func(context.Context) error, 0, jobsToExecute) - ) - for i := 0; i < jobsToExecute; i++ { - jobs = append(jobs, func(_ context.Context) error { - executed.Inc() - return nil - }) - } - err := Parallelize(context.Background(), jobs) - assert.NoError(t, err) - assert.Equal(t, int64(jobsToExecute), executed.Load(), "jobs executed") - }) - t.Run("WithCtxCancellation", func(t *testing.T) { - t.Parallel() - var executed atomic.Int64 - var jobs []func(context.Context) error - for i := 0; i < 10; i++ { - jobs = append(jobs, func(_ context.Context) error { - executed.Inc() - return nil - }) - } - ctx, cancel := context.WithCancel(context.Background()) - cancel() - err := Parallelize(ctx, jobs) - assert.Error(t, err) - assert.Equal(t, int64(0), executed.Load(), "jobs executed") - }) -} diff --git a/pkg/bufman/pkg/tmp/tmp_test.go b/pkg/bufman/pkg/tmp/tmp_test.go deleted file mode 100644 index 1490d227f..000000000 --- a/pkg/bufman/pkg/tmp/tmp_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tmp - -import ( - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestFile(t *testing.T) { - t.Parallel() - tmpFile, err := NewFileWithData([]byte("foo")) - require.NoError(t, err) - assert.True(t, filepath.IsAbs(tmpFile.AbsPath())) - data, err := os.ReadFile(tmpFile.AbsPath()) - assert.NoError(t, err) - assert.Equal(t, "foo", string(data)) - assert.NoError(t, tmpFile.Close()) - _, err = os.ReadFile(tmpFile.AbsPath()) - assert.Error(t, err) -} - -func TestDir(t *testing.T) { - t.Parallel() - tmpDir, err := NewDir() - require.NoError(t, err) - assert.True(t, filepath.IsAbs(tmpDir.AbsPath())) - fileInfo, err := os.Lstat(tmpDir.AbsPath()) - assert.NoError(t, err) - assert.True(t, fileInfo.IsDir()) - assert.NoError(t, tmpDir.Close()) - _, err = os.Lstat(tmpDir.AbsPath()) - assert.Error(t, err) -} diff --git a/pkg/bufman/pkg/transport/http/httpserver/httpserver.go b/pkg/bufman/pkg/transport/http/httpserver/httpserver.go index d136496f3..7109f3f09 100644 --- a/pkg/bufman/pkg/transport/http/httpserver/httpserver.go +++ b/pkg/bufman/pkg/transport/http/httpserver/httpserver.go @@ -116,7 +116,7 @@ func Run( for _, option := range options { option(s) } - stdLogger, err := zap.NewStdLogAt(logger.Sugar().Named("httpserver"), zap.ErrorLevel) + stdLogger, err := zap.NewStdLogAt(logger.Named("httpserver"), zap.ErrorLevel) if err != nil { return err } From f46a51eceffc16f4ba9e9692dffa6472a9b9b1d8 Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Thu, 4 Jan 2024 19:53:58 +0800 Subject: [PATCH 17/18] fix lint --- go.sum | 2 + .../bufimagebuildtesting.go | 238 --------------- .../bufimagebuildtesting_unix_test.go | 57 ---- .../corpus/alloptions.txtar | 20 -- .../corpus/ccoptions.txtar | 3 - .../corpus/comment_ignores.txtar | 101 ------ .../corpus/comment_ignores_cascade.txtar | 89 ------ .../corpus/comments.txtar | 288 ------------------ .../corpus/csharpoptions.txtar | 12 - .../corpus/customoptions1.txtar | 12 - .../corpus/customoptionserror1.txtar | 25 -- .../corpus/directory_same_package.txtar | 19 -- .../bufimagebuildtesting/corpus/empty.txtar | 2 - .../corpus/emptyoptions.txtar | 1 - .../corpus/enum_first_value_zero.txtar | 84 ----- .../corpus/enum_pascal_case.txtar | 84 ----- .../corpus/enum_value_prefix.txtar | 44 --- .../corpus/enum_value_upper_snake_case.txtar | 45 --- .../corpus/enum_zero_value_suffix.txtar | 77 ----- .../enum_zero_value_suffix_custom.txtar | 78 ----- .../bufimagebuildtesting/corpus/ex1.txtar | 13 - .../bufimagebuildtesting/corpus/ex2.txtar | 32 -- .../bufimagebuildtesting/corpus/ex3.txtar | 18 -- .../corpus/field_lower_snake_case.txtar | 47 --- .../corpus/field_no_descriptor.txtar | 51 ---- .../corpus/file_lower_snake_case.txtar | 45 --- .../corpus/import_no_public.txtar | 28 -- .../corpus/import_no_weak.txtar | 28 -- .../corpus/import_used.txtar | 40 --- .../corpus/javaoptions.txtar | 7 - .../corpus/jsoptions.txtar | 2 - .../corpus/message_pascal_case.txtar | 28 -- .../corpus/objcoptions.txtar | 20 -- .../corpus/oneof_lower_snake_case.txtar | 93 ------ .../corpus/optionpanic.txtar | 33 -- .../corpus/package_defined.txtar | 9 - .../corpus/package_directory_match.txtar | 19 -- .../corpus/package_lower_snake_case.txtar | 39 --- .../corpus/package_same_directory.txtar | 13 - .../package_same_directory_no_package.txtar | 9 - .../corpus/package_same_option_value.txtar | 52 ---- .../corpus/package_version_suffix.txtar | 55 ---- .../corpus/packageversion.txtar | 4 - .../corpus/phpoptions.txtar | 20 -- .../corpus/proto3optional1.txtar | 6 - .../corpus/rpc_no_streaming.txtar | 19 -- .../corpus/rpc_pascal_case.txtar | 21 -- .../corpus/rpc_standard_name.txtar | 31 -- .../rpc_standard_name_allow_empty.txtar | 33 -- .../corpus/rubyoptions.txtar | 12 - .../corpus/semicolons.txtar | 42 --- .../corpus/service_pascal_case.txtar | 17 -- .../corpus/service_suffix.txtar | 16 - .../corpus/service_suffix_custom.txtar | 18 -- .../bufimagebuildtesting/corpus/simple.txtar | 2 - .../corpus/syntax_specified.txtar | 21 -- .../bufimagebuildtesting/corpus/test.txtar | 58 ---- .../corpus/wktimport.txtar | 10 - .../bufpkg/bufmodule/bufmodulecache/util.go | 1 + pkg/bufman/constant/const.go | 5 +- pkg/bufman/core/lru/lru.go | 3 +- pkg/bufman/core/search/db_search.go | 3 +- pkg/bufman/core/storage/db_storage.go | 3 +- pkg/bufman/handlers/grpc_handlers/search.go | 47 --- pkg/bufman/mapper/commit_mapper.go | 19 +- pkg/bufman/model/file.go | 12 +- .../filepathextended_unix_test.go | 143 --------- .../filepathextended/testdata/base/1.proto | 18 -- .../testdata/base/a/b/1.proto | 18 -- .../testdata/base/a/b/2.proto | 18 -- .../filepathextended/testdata/base/a/b/2.txt | 1 - .../filepathextended/testdata/base/a/bar.yaml | 15 - .../filepathextended/testdata/base/ab/1.proto | 18 -- .../filepathextended/testdata/base/ab/2.proto | 18 -- .../filepathextended/testdata/base/ab/2.txt | 1 - .../pkg/filepathextended/testdata/link/b | 1 - .../filepathextended/testdata/link/bar.yaml | 16 - .../filepathextended/testdata/link/file.proto | 18 -- .../testdata/symlink_loop/a/b | 1 - .../testdata/symlink_loop/b/a | 1 - .../testdata/symlink_loop/file.proto | 18 -- .../testdata/symlink_success/1.proto | 16 - .../testdata/symlink_success/a | 1 - .../testdata/symlink_success/ab | 1 - .../testdata/symlink_success/file.proto | 18 -- pkg/bufman/pkg/protosource/file.go | 2 + 86 files changed, 33 insertions(+), 2695 deletions(-) delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting_unix_test.go delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/alloptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ccoptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores_cascade.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comments.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/csharpoptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptions1.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptionserror1.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/directory_same_package.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/empty.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/emptyoptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_first_value_zero.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_pascal_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_prefix.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_upper_snake_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix_custom.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex1.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex2.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex3.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_lower_snake_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_no_descriptor.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/file_lower_snake_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_public.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_weak.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_used.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/javaoptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/jsoptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/message_pascal_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/objcoptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/oneof_lower_snake_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/optionpanic.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_defined.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_directory_match.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_lower_snake_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory_no_package.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_option_value.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_version_suffix.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/packageversion.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/phpoptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/proto3optional1.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_no_streaming.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_pascal_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name_allow_empty.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rubyoptions.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/semicolons.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_pascal_case.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix_custom.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/simple.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/syntax_specified.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/test.txtar delete mode 100644 pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/wktimport.txtar delete mode 100644 pkg/bufman/handlers/grpc_handlers/search.go delete mode 100644 pkg/bufman/pkg/filepathextended/filepathextended_unix_test.go delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/1.proto delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/a/b/1.proto delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.proto delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.txt delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/a/bar.yaml delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/ab/1.proto delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/ab/2.proto delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/base/ab/2.txt delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/link/b delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/link/bar.yaml delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/link/file.proto delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_loop/a/b delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_loop/b/a delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_loop/file.proto delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_success/1.proto delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_success/a delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_success/ab delete mode 100644 pkg/bufman/pkg/filepathextended/testdata/symlink_success/file.proto diff --git a/go.sum b/go.sum index 79b819d07..ae70f39a6 100644 --- a/go.sum +++ b/go.sum @@ -2634,6 +2634,8 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting.go deleted file mode 100644 index 84bfba3fd..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting.go +++ /dev/null @@ -1,238 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package bufimagebuildtesting - -import ( - "context" - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufanalysis" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufimage/bufimagebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmodulebuild" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleconfig" - "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/buftesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/prototesting" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/storage/storageos" - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/tmp" - "go.uber.org/multierr" - "go.uber.org/zap" - "golang.org/x/tools/txtar" - "google.golang.org/protobuf/types/descriptorpb" -) - -// Fuzz is the entrypoint for the fuzzer. -// We use https://github.com/dvyukov/go-fuzz for fuzzing. -// Please follow the instructions -// in their README for help with running the fuzz targets. -func Fuzz(data []byte) int { - ctx := context.Background() - runner := command.NewRunner() - result, err := fuzz(ctx, runner, data) - if err != nil { - // data was invalid in some way - return -1 - } - return result.panicOrN(ctx) -} - -func fuzz(ctx context.Context, runner command.Runner, data []byte) (_ *fuzzResult, retErr error) { - dir, err := tmp.NewDir() - if err != nil { - return nil, err - } - defer func() { - retErr = multierr.Append(retErr, dir.Close()) - }() - if err := untxtar(data, dir.AbsPath()); err != nil { - return nil, err - } - - filePaths, err := buftesting.GetProtocFilePathsErr(ctx, dir.AbsPath(), 0) - if err != nil { - return nil, err - } - - actualProtocFileDescriptorSet, protocErr := prototesting.GetProtocFileDescriptorSet( - ctx, - runner, - []string{dir.AbsPath()}, - filePaths, - false, - false, - ) - - image, bufAnnotations, bufErr := fuzzBuild(ctx, dir.AbsPath()) - return newFuzzResult( - runner, - bufAnnotations, - bufErr, - protocErr, - actualProtocFileDescriptorSet, - image, - ), nil -} - -// fuzzBuild does a builder.Build for a fuzz test. -func fuzzBuild(ctx context.Context, dirPath string) (bufimage.Image, []bufanalysis.FileAnnotation, error) { - module, err := fuzzGetModule(ctx, dirPath) - if err != nil { - return nil, nil, err - } - builder := bufimagebuild.NewBuilder(zap.NewNop(), bufmodule.NewNopModuleReader()) - opt := bufimagebuild.WithExcludeSourceCodeInfo() - return builder.Build(ctx, module, opt) -} - -// fuzzGetModule gets the bufmodule.Module for a fuzz test. -func fuzzGetModule(ctx context.Context, dirPath string) (bufmodule.Module, error) { - storageosProvider := storageos.NewProvider(storageos.ProviderWithSymlinks()) - readWriteBucket, err := storageosProvider.NewReadWriteBucket( - dirPath, - storageos.ReadWriteBucketWithSymlinksIfSupported(), - ) - if err != nil { - return nil, err - } - config, err := bufmoduleconfig.NewConfigV1(bufmoduleconfig.ExternalConfigV1{}) - if err != nil { - return nil, err - } - return bufmodulebuild.NewModuleBucketBuilder().BuildForBucket( - ctx, - readWriteBucket, - config, - ) -} - -// txtarParse is a wrapper around txtar.Parse that will turn panics into errors. -// This is necessary because of an issue where txtar.Parse can panic on invalid data. Because data is generated by the -// fuzzer, it will occasionally generate data that causes this panic. -// See https://github.com/golang/go/issues/47193 -func txtarParse(data []byte) (_ *txtar.Archive, retErr error) { - defer func() { - if p := recover(); p != nil { - retErr = fmt.Errorf("panic from txtar.Parse: %v", p) - } - }() - return txtar.Parse(data), nil -} - -// untxtar extracts txtar data to destDirPath. -func untxtar(data []byte, destDirPath string) error { - archive, err := txtarParse(data) - if err != nil { - return err - } - if len(archive.Files) == 0 { - return fmt.Errorf("txtar contains no files") - } - for _, file := range archive.Files { - dirPath := filepath.Dir(file.Name) - if dirPath != "" { - if err := os.MkdirAll(filepath.Join(destDirPath, dirPath), 0o700); err != nil { - return err - } - } - if err := os.WriteFile( - filepath.Join(destDirPath, file.Name), - file.Data, - 0o600, - ); err != nil { - return err - } - } - return nil -} - -type fuzzResult struct { - runner command.Runner - bufAnnotations []bufanalysis.FileAnnotation - bufErr error - protocErr error - actualProtocFileDescriptorSet *descriptorpb.FileDescriptorSet - image bufimage.Image -} - -func newFuzzResult( - runner command.Runner, - bufAnnotations []bufanalysis.FileAnnotation, - bufErr error, - protocErr error, - actualProtocFileDescriptorSet *descriptorpb.FileDescriptorSet, - image bufimage.Image, -) *fuzzResult { - return &fuzzResult{ - runner: runner, - bufAnnotations: bufAnnotations, - bufErr: bufErr, - protocErr: protocErr, - actualProtocFileDescriptorSet: actualProtocFileDescriptorSet, - image: image, - } -} - -// panicOrN panics if there is an error or returns the appropriate value for Fuzz to return. -func (f *fuzzResult) panicOrN(ctx context.Context) int { - if err := f.error(ctx); err != nil { - panic(err.Error()) - } - // This will return 1 for valid protobufs and 0 for invalid in order to encourage the fuzzer to generate more - // realistic looking data. - if f.protocErr == nil { - return 1 - } - return 0 -} - -// error returns an error that should cause Fuzz to panic. -func (f *fuzzResult) error(ctx context.Context) error { - if f.protocErr != nil { - if f.bufErr == nil && len(f.bufAnnotations) == 0 { - return fmt.Errorf("protoc has error but buf does not: %v", f.protocErr) - } - return nil - } - if f.bufErr != nil { - return fmt.Errorf("buf has error but protoc does not: %v", f.bufErr) - } - if len(f.bufAnnotations) > 0 { - return fmt.Errorf("buf has file annotations but protoc has no error: %v", f.bufAnnotations) - } - image := bufimage.ImageWithoutImports(f.image) - fileDescriptorSet := bufimage.ImageToFileDescriptorSet(image) - - diff, err := prototesting.DiffFileDescriptorSetsJSON( - ctx, - f.runner, - fileDescriptorSet, - f.actualProtocFileDescriptorSet, - "buf", - "protoc", - ) - if err != nil { - return fmt.Errorf("error diffing results: %v", err) - } - if strings.TrimSpace(diff) != "" { - return fmt.Errorf("protoc and buf have different results: %v", diff) - } - return nil -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting_unix_test.go b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting_unix_test.go deleted file mode 100644 index 44453fa20..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/bufimagebuildtesting_unix_test.go +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris - -package bufimagebuildtesting - -import ( - "context" - "io/fs" - "os" - "path/filepath" - "testing" - - "github.com/apache/dubbo-kubernetes/pkg/bufman/pkg/command" - "github.com/stretchr/testify/require" -) - -func TestCorpus(t *testing.T) { - t.Parallel() - // To focus on just one test in the corpus, put its file name here. Don't forget to revert before committing. - focus := "" - ctx := context.Background() - runner := command.NewRunner() - require.NoError(t, filepath.Walk("corpus", func(path string, info fs.FileInfo, err error) error { - if err != nil { - return err - } - if info.IsDir() { - return nil - } - if focus != "" && info.Name() != focus { - return nil - } - t.Run(info.Name(), func(t *testing.T) { - data, err := os.ReadFile(filepath.Join("corpus", info.Name())) - require.NoError(t, err) - result, err := fuzz(ctx, runner, data) - require.NoError(t, err) - require.NoError(t, result.error(ctx)) - }) - return nil - })) -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/alloptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/alloptions.txtar deleted file mode 100644 index b03fa8a0b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/alloptions.txtar +++ /dev/null @@ -1,20 +0,0 @@ --- a.proto -- -option csharp_namespace = "foo"; -option go_package = "foo"; -option java_package = "foo"; -option java_outer_classname = "foo"; -option objc_class_prefix = "foo"; -option php_class_prefix = "foo"; -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; -option ruby_package = "foo"; -option swift_prefix = "foo"; - -option optimize_for = SPEED; -option cc_enable_arenas = false; -option cc_generic_services = false; -option java_generic_services = false; -option java_multiple_files = false; -option java_string_check_utf8 = false; -option php_generic_services = false; -option py_generic_services = false; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ccoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ccoptions.txtar deleted file mode 100644 index a78b272be..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ccoptions.txtar +++ /dev/null @@ -1,3 +0,0 @@ --- a.proto -- -option cc_enable_arenas = false; -option optimize_for = LITE_RUNTIME; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores.txtar deleted file mode 100644 index 4cd3847cb..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores.txtar +++ /dev/null @@ -1,101 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -// To team members: I am sorry you have to read such a bad file. -// To others: Do the opposite of whatever this file does. - -// buf:lint:ignore PACKAGE_DIRECTORY_MATCH -// buf:lint:ignore PACKAGE_LOWER_SNAKE_CASE -// buf:lint:ignore PACKAGE_VERSION_SUFFIX -package A; - -// buf:lint:ignore IMPORT_NO_PUBLIC -import public "google/protobuf/empty.proto"; - -// buf:lint:ignore ENUM_PASCAL_CASE -enum enumFoo { - // buf:lint:ignore ENUM_NO_ALLOW_ALIAS - option allow_alias = true; - // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooNone = 0; - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooOne = 1; - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooTwo = 1; -} - -// buf:lint:ignore MESSAGE_PASCAL_CASE -message messageFoo { - // buf:lint:ignore MESSAGE_PASCAL_CASE - message messageBar { - // buf:lint:ignore MESSAGE_PASCAL_CASE - message messageBaz { - // buf:lint:ignore ENUM_PASCAL_CASE - enum enumFoo { - // buf:lint:ignore ENUM_NO_ALLOW_ALIAS - option allow_alias = true; - // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooNone = 0; - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooOne = 1; - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enumFooTwo = 1; - } - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Foo = 1; - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - oneof Bar { - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Baz = 2; - } - } - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Foo = 1; - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - oneof Bar { - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Baz = 2; - } - } - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Foo = 1; - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - oneof Bar { - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - int64 Baz = 2; - } -} - -// buf:lint:ignore SERVICE_PASCAL_CASE -service serviceFoo { - // buf:lint:ignore RPC_PASCAL_CASE - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - rpc methodFoo( - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - google.protobuf.Empty - ) returns ( - // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME - google.protobuf.Empty - ) {} -} --- buf.yaml -- -version: v1 -lint: - use: - - PACKAGE_DIRECTORY_MATCH - - PACKAGE_LOWER_SNAKE_CASE - - PACKAGE_VERSION_SUFFIX - - IMPORT_NO_PUBLIC - - ENUM_PASCAL_CASE - - ENUM_NO_ALLOW_ALIAS - - ENUM_ZERO_VALUE_SUFFIX - - ENUM_VALUE_UPPER_SNAKE_CASE - - MESSAGE_PASCAL_CASE - - FIELD_LOWER_SNAKE_CASE - - ONEOF_LOWER_SNAKE_CASE - - SERVICE_PASCAL_CASE - - RPC_PASCAL_CASE - - RPC_REQUEST_STANDARD_NAME - - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores_cascade.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores_cascade.txtar deleted file mode 100644 index 862c7c8ee..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comment_ignores_cascade.txtar +++ /dev/null @@ -1,89 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -// To team members: I am sorry you have to read such a bad file. -// To others: Do the opposite of whatever this file does. - -package a; - -import "google/protobuf/empty.proto"; - -// buf:lint:ignore ENUM_PASCAL_CASE -// buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE -enum enumFoo { - // buf:lint:ignore ENUM_NO_ALLOW_ALIAS - option allow_alias = true; - // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX - enumFooNone = 0; - enumFooOne = 1; - enumFooTwo = 1; -} - -// buf:lint:ignore MESSAGE_PASCAL_CASE -// buf:lint:ignore FIELD_LOWER_SNAKE_CASE -// buf:lint:ignore ONEOF_LOWER_SNAKE_CASE -message messageFoo { - // buf:lint:ignore MESSAGE_PASCAL_CASE - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - message messageBar { - // buf:lint:ignore MESSAGE_PASCAL_CASE - // buf:lint:ignore FIELD_LOWER_SNAKE_CASE - // buf:lint:ignore ONEOF_LOWER_SNAKE_CASE - message messageBaz { - // buf:lint:ignore ENUM_PASCAL_CASE - // buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - enum enumFoo { - // buf:lint:ignore ENUM_NO_ALLOW_ALIAS - option allow_alias = true; - // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX - enumFooNone = 0; - enumFooOne = 1; - enumFooTwo = 1; - } - int64 Foo = 1; - oneof Bar { - int64 Baz = 2; - } - } - int64 Foo = 1; - oneof Bar { - int64 Baz = 2; - } - } - int64 Foo = 1; - oneof Bar { - int64 Baz = 2; - } -} - -// buf:lint:ignore SERVICE_PASCAL_CASE -// buf:lint:ignore RPC_PASCAL_CASE -// buf:lint:ignore RPC_REQUEST_STANDARD_NAME -// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME -service serviceFoo { - rpc methodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -// buf:lint:ignore SERVICE_PASCAL_CASE -service serviceBar { - // buf:lint:ignore RPC_PASCAL_CASE - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME - rpc methodBar(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} --- buf.yaml -- -version: v1 -lint: - use: - - ENUM_PASCAL_CASE - - ENUM_NO_ALLOW_ALIAS - - ENUM_ZERO_VALUE_SUFFIX - - ENUM_VALUE_UPPER_SNAKE_CASE - - MESSAGE_PASCAL_CASE - - FIELD_LOWER_SNAKE_CASE - - ONEOF_LOWER_SNAKE_CASE - - SERVICE_PASCAL_CASE - - RPC_PASCAL_CASE - - RPC_REQUEST_STANDARD_NAME - - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comments.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comments.txtar deleted file mode 100644 index b856a6529..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/comments.txtar +++ /dev/null @@ -1,288 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -enum EnumFoo { - ENUM_FOO_UNSPECIFIED = 0; - ENUM_FOO_ONE = 1; -} - -message MessageFoo { - message MessageBar { - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - } - message MessageBaz { - int64 foo = 1; - oneof bar { - int64 baz = 2; - } - } - int64 foo = 1; - oneof bar { - int64 baz = 2; - } - } - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - } - int64 foo = 1; - oneof bar { - int64 baz = 2; - } -} - -service ServiceFoo { - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} - -// comment -enum EnumFoo2 { - // comment - ENUM_FOO2_UNSPECIFIED = 0; - // comment - ENUM_FOO2_ONE = 1; -} - -// comment -message MessageFoo2 { - // comment - message MessageBar { - // comment - enum Foo { - // comment - FOO_UNSPECIFIED = 0; - // comment - FOO_ONE = 1; - } - // comment - message MessageBaz { - // comment - int64 foo = 1; - // comment - oneof bar { - // comment - int64 baz = 2; - } - } - // comment - int64 foo = 1; - // comment - oneof bar { - // comment - int64 baz = 2; - } - } - // comment - enum Foo { - // comment - FOO_UNSPECIFIED = 0; - // comment - FOO_ONE = 1; - } - // comment - int64 foo = 1; - // comment - oneof bar { - // comment - int64 baz = 2; - } -} - -// comment -service ServiceFoo2 { - // comment - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - // comment - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); -} - -enum EnumFoo3 { - ENUM_FOO3_UNSPECIFIED = 0; // bad comment - ENUM_FOO3_ONE = 1; // bad comment -} // bad comment - -message MessageFoo3 { - message MessageBar { - enum Foo { - FOO_UNSPECIFIED = 0; // bad comment - FOO_ONE = 1; // bad comment - } // bad comment - message MessageBaz { - int64 foo = 1; // bad comment - oneof bar { // bad comment - int64 baz = 2; // bad comment - } // bad comment - } - int64 foo = 1; // bad comment - oneof bar { // bad comment - int64 baz = 2; // bad comment - } // bad comment - } // bad comment - enum Foo { // bad comment - FOO_UNSPECIFIED = 0; // bad comment - FOO_ONE = 1; // bad comment - } // bad comment - int64 foo = 1; // bad comment - oneof bar { // bad comment - int64 baz = 2; // bad comment - } // bad comment -} - -service ServiceFoo3 { - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} // bad comment - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); // bad comment -} - -// -enum EnumFoo4 { - // - ENUM_FOO4_UNSPECIFIED = 0; - // - ENUM_FOO4_ONE = 1; -} - -// -message MessageFoo4 { - // - message MessageBar { - // - enum Foo { - // - FOO_UNSPECIFIED = 0; - // - FOO_ONE = 1; - } - // - message MessageBaz { - // - int64 foo = 1; - // - oneof bar { - // - int64 baz = 2; - } - } - // - int64 foo = 1; - // - oneof bar { - // - int64 baz = 2; - } - } - // - enum Foo { - // - FOO_UNSPECIFIED = 0; - // - FOO_ONE = 1; - } - // - int64 foo = 1; - // - oneof bar { - // - int64 baz = 2; - } -} - -// -service ServiceFoo4 { - // - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - // - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); -} - -/* */ -enum EnumFoo5 { - /* */ - ENUM_FOO5_UNSPECIFIED = 0; - /* */ - ENUM_FOO5_ONE = 1; -} - -/* */ -message MessageFoo5 { - /* */ - message MessageBar { - /* */ - enum Foo { - /* */ - FOO_UNSPECIFIED = 0; - /* */ - FOO_ONE = 1; - } - /* */ - message MessageBaz { - /* */ - int64 foo = 1; - /* */ - oneof bar { - /* */ - int64 baz = 2; - } - } - /* */ - int64 foo = 1; - /* */ - oneof bar { - /* */ - int64 baz = 2; - } - } - /* */ - enum Foo { - /* */ - FOO_UNSPECIFIED = 0; - /* */ - FOO_ONE = 1; - } - /* */ - int64 foo = 1; - /* */ - oneof bar { - /* */ - int64 baz = 2; - } -} - -/* */ -service ServiceFoo5 { - /* */ - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - /* */ - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); -} - -message Baz { - map one = 1; -} - -// comment -service ServiceFoo6 { - // this method should pass lint - rpc MethodFoo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE this method should fail lint - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - rpc MethodBar(google.protobuf.Empty) returns (google.protobuf.Empty); - //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE this method should also fail lint - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - // - rpc MethodBaz(google.protobuf.Empty) returns (google.protobuf.Empty); - //buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE - // buf:lint:ignore RPC_REQUEST_STANDARD_NAME - // this method should pass lint - rpc MethodBat(google.protobuf.Empty) returns (google.protobuf.Empty); -} --- buf.yaml -- -version: v1 -lint: - use: - - COMMENTS diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/csharpoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/csharpoptions.txtar deleted file mode 100644 index 47b56582f..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/csharpoptions.txtar +++ /dev/null @@ -1,12 +0,0 @@ --- double/csharp.proto -- -package acme.weather.v1; - -option csharp_namespace = "foo"; --- single/csharp.proto -- -package acme.v1; - -option csharp_namespace = "foo"; --- triple/csharp.proto -- -package acme.weather.data.v1; - -option csharp_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptions1.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptions1.txtar deleted file mode 100644 index d94fdd3af..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptions1.txtar +++ /dev/null @@ -1,12 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.FieldOptions { - int32 baz = 50007; -} - -message Foo { - string bar = 1 [(baz) = 42]; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptionserror1.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptionserror1.txtar deleted file mode 100644 index fb76398d5..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/customoptionserror1.txtar +++ /dev/null @@ -1,25 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.FieldOptions { - Foo foo = 50007; -} - -message Foo { - string bar = 1; -} --- b.proto -- -syntax = "proto3"; - -package a; - -import "a.proto"; - -message Baz { - // the name is actually (a.foo).bar - string bat = 1 [(a.foo).bat = 1]; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/directory_same_package.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/directory_same_package.txtar deleted file mode 100644 index d9c3ea8df..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/directory_same_package.txtar +++ /dev/null @@ -1,19 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; --- buf.yaml -- -version: v1 -lint: - use: - - DIRECTORY_SAME_PACKAGE --- no_package.proto -- -syntax = "proto3"; --- one/c.proto -- -syntax = "proto3"; - -package c; --- one/d.proto -- -syntax = "proto3"; - -package d; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/empty.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/empty.txtar deleted file mode 100644 index ae352de7d..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/empty.txtar +++ /dev/null @@ -1,2 +0,0 @@ --- 0.proto -- -syntax = "proto2"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/emptyoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/emptyoptions.txtar deleted file mode 100644 index 79dc29f49..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/emptyoptions.txtar +++ /dev/null @@ -1 +0,0 @@ --- a.proto -- diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_first_value_zero.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_first_value_zero.txtar deleted file mode 100644 index 6f2520ad5..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_first_value_zero.txtar +++ /dev/null @@ -1,84 +0,0 @@ --- a.proto -- -syntax = "proto2"; - -package a; - -enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; -} - -enum Bar { - BAR_ONE = 1; - BAR_UNSPECIFIED = 0; - BAR_TWO = 2; -} - -enum Baz { - BAZ_ONE = 1; - BAZ_UNSPECIFIED = 0; - BAZ_TWO = 2; -} - -enum Bat { - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; -} - -message One { - message Two { - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; - } - - enum Bar { - BAR_ONE = 1; - BAR_UNSPECIFIED = 0; - BAR_TWO = 2; - } - - enum Baz { - BAZ_ONE = 1; - BAZ_UNSPECIFIED = 0; - BAZ_TWO = 2; - } - - enum Bat { - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; - } - } - enum Foo { - FOO_UNSPECIFIED = 0; - FOO_ONE = 1; - FOO_TWO = 2; - } - - enum Bar { - BAR_ONE = 1; - BAR_UNSPECIFIED = 0; - BAR_TWO = 2; - } - - enum Baz { - BAZ_ONE = 1; - BAZ_UNSPECIFIED = 0; - BAZ_TWO = 2; - } - - enum Bat { - BAT_UNSPECIFIED = 0; - BAT_ONE = 1; - BAT_TWO = 2; - } -} --- buf.yaml -- -version: v1 -lint: - use: - - ENUM_FIRST_VALUE_ZERO diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_pascal_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_pascal_case.txtar deleted file mode 100644 index 9e34e3c75..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_pascal_case.txtar +++ /dev/null @@ -1,84 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -enum Success { - SUCCESS_UNSPECIFIED = 0; -} - -enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; -} - -enum SuccessFOOThree { - SUCCESS_FOO_THREE_UNSPECIFIED = 0; -} -enum fail { - FAIL_UNSPECIFIED = 0; -} -enum failTwo { - FAIL_TWO_UNSPECIFIED = 0; -} -enum fail_three { - FAIL_THREE_UNSPECIFIED = 0; -} -enum Fail_four { - FAIL_FOUR_UNSPECIFIED = 0; -} - -message Foo { - message Bar { - enum Success { - SUCCESS_UNSPECIFIED = 0; - } - - enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; - } - - enum SuccessFOOThree { - SUCCESS_FOO_THREE_UNSPECIFIED = 0; - } - enum fail { - FAIL_UNSPECIFIED = 0; - } - enum failTwo { - FAIL_TWO_UNSPECIFIED = 0; - } - enum fail_three { - FAIL_THREE_UNSPECIFIED = 0; - } - enum Fail_four { - FAIL_FOUR_UNSPECIFIED = 0; - } - } - enum Success { - SUCCESS_UNSPECIFIED = 0; - } - - enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; - } - - enum SuccessFOOThree { - SUCCESS_FOO_THREE_UNSPECIFIED = 0; - } - enum fail { - FAIL_UNSPECIFIED = 0; - } - enum failTwo { - FAIL_TWO_UNSPECIFIED = 0; - } - enum fail_three { - FAIL_THREE_UNSPECIFIED = 0; - } - enum Fail_four { - FAIL_FOUR_UNSPECIFIED = 0; - } -} --- buf.yaml -- -version: v1 -lint: - use: - - ENUM_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_prefix.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_prefix.txtar deleted file mode 100644 index 46d9f5fa4..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_prefix.txtar +++ /dev/null @@ -1,44 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -enum Test { - TEST_UNSPECIFIED = 0; - TEST_SUCCESS = 1; - TEST_SUCCESS_TWO = 2; - TEST_SUCCESS_THREE_3 = 3; - TESt_FAIL = 4; - test_FAIL_5 = 5; - test__FAIL_6 = 6; -} - -message Foo { - message Bar { - enum Test1 { - TEST1_UNSPECIFIED = 0; - TEST1_SUCCESS = 1; - TEST1_SUCCESS_TWO = 2; - TEST1_SUCCESS_THREE_3 = 3; - TESt1_FAIL = 4; - test1_FAIL_5 = 5; - test1__FAIL_6 = 6; - TEST_1_FAIL_7 = 7; - } - } - enum Test1 { - TEST1_UNSPECIFIED = 0; - TEST1_SUCCESS = 1; - TEST1_SUCCESS_TWO = 2; - TEST1_SUCCESS_THREE_3 = 3; - TESt1_FAIL = 4; - test1_FAIL_5 = 5; - test1__FAIL_6 = 6; - TEST_1_FAIL_7 = 7; - } -} --- buf.yaml -- -version: v1 -lint: - use: - - ENUM_VALUE_PREFIX diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_upper_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_upper_snake_case.txtar deleted file mode 100644 index fbe4e8c80..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_value_upper_snake_case.txtar +++ /dev/null @@ -1,45 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -enum Test { - TEST_UNSPECIFIED = 0; - TEST_SUCCESS = 1; - TEST_SUCCESS_TWO = 2; - TEST_SUCCESS_THREE3 = 3; - TEST_FAIl = 4; - test_fail_five = 5; - testFailSix = 6; - TEST_SUCCESS_7 = 7; -} - -message Foo { - message Bar { - enum Test { - TEST_UNSPECIFIED = 0; - TEST_SUCCESS = 1; - TEST_SUCCESS_TWO = 2; - TEST_SUCCESS_THREE3 = 3; - TEST_FAIl = 4; - test_fail_five = 5; - testFailSix = 6; - TEST_SUCCESS_7 = 7; - } - } - enum Test { - TEST_UNSPECIFIED = 0; - TEST_SUCCESS = 1; - TEST_SUCCESS_TWO = 2; - TEST_SUCCESS_THREE3 = 3; - TEST_FAIl = 4; - test_fail_five = 5; - testFailSix = 6; - TEST_SUCCESS_7 = 7; - } -} --- buf.yaml -- -version: v1 -lint: - use: - - ENUM_VALUE_UPPER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix.txtar deleted file mode 100644 index 8eb1ab717..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix.txtar +++ /dev/null @@ -1,77 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -enum Success { - SUCCESS_UNSPECIFIED = 0; -} - -enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; -} - -enum Fail { - FAILUNSPECIFIED = 0; -} - -enum FailTwo { - FAIL_TWO_UNSPECIFIEd = 0; -} - -enum FailThree { - FAIL_THREE_OTHER = 0; -} - -message Foo { - message Bar { - enum Success { - SUCCESS_UNSPECIFIED = 0; - } - - enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; - } - - enum Fail { - FAILUNSPECIFIED = 0; - } - - enum FailTwo { - FAIL_TWO_UNSPECIFIEd = 0; - } - - enum FailThree { - FAIL_THREE_OTHER = 0; - } - } - enum Success { - SUCCESS_UNSPECIFIED = 0; - } - - enum SuccessTwo { - SUCCESS_TWO_UNSPECIFIED = 0; - } - - enum Fail { - FAILUNSPECIFIED = 0; - } - - enum FailTwo { - FAIL_TWO_UNSPECIFIEd = 0; - } - - enum FailThree { - FAIL_THREE_OTHER = 0; - } -} - -enum SuccessThree { - SUCCESS_THREE_UNSPECIFIED = 0; - SUCCESS_THREE_ONE = 1; -} --- buf.yaml -- -version: v1 -lint: - use: - - ENUM_ZERO_VALUE_SUFFIX diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix_custom.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix_custom.txtar deleted file mode 100644 index be3038333..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/enum_zero_value_suffix_custom.txtar +++ /dev/null @@ -1,78 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -enum Success { - SUCCESSOTHER = 0; -} - -enum SuccessTwo { - SUCCESS_TWOOTHER = 0; -} - -enum SuccessThree { - SUCCESS_THREE_OTHER = 0; -} - -enum FailTwo { - FAIL_TWOOTHEr = 0; -} - -enum FailThree { - FAIL_TWO_UNSPECIFIED = 0; -} - -message Foo { - message Bar { - enum Success { - SUCCESSOTHER = 0; - } - - enum SuccessTwo { - SUCCESS_TWOOTHER = 0; - } - - enum SuccessThree { - SUCCESS_THREE_OTHER = 0; - } - - enum FailTwo { - FAIL_TWOOTHEr = 0; - } - - enum FailThree { - FAIL_TWO_UNSPECIFIED = 0; - } - } - enum Success { - SUCCESSOTHER = 0; - } - - enum SuccessTwo { - SUCCESS_TWOOTHER = 0; - } - - enum SuccessThree { - SUCCESS_THREE_OTHER = 0; - } - - enum FailTwo { - FAIL_TWOOTHEr = 0; - } - - enum FailThree { - FAIL_TWO_UNSPECIFIED = 0; - } -} - -enum SuccessFour { - SUCCESS_FOUROTHER = 0; - SUCCESS_FOUR_ONE = 1; -} --- buf.yaml -- -version: v1 -lint: - use: - - ENUM_ZERO_VALUE_SUFFIX - enum_zero_value_suffix: OTHER diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex1.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex1.txtar deleted file mode 100644 index d44da6f1e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex1.txtar +++ /dev/null @@ -1,13 +0,0 @@ --- 0.proto -- -syntax = "proto2"; -message Sensor { - required string name = 1; - required double temperature = 2; - required int32 humidity = 3; - - enum SwitchLevel { - CLOSED = 0; - OPEN = 1; - } - required SwitchLevel door = 5; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex2.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex2.txtar deleted file mode 100644 index 733b87d9b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex2.txtar +++ /dev/null @@ -1,32 +0,0 @@ --- 0.proto -- -syntax = "proto2"; - -enum MyEnum -{ - Default = 0; - Variant1 = 1; - Variant100 = 100; -} - -message Test { - required string f1 = 1; - required int64 f2 = 2; - repeated uint64 fa = 3; - repeated int32 fb = 4; - repeated int32 fc = 5 [packed = true]; - repeated Pair pairs = 6; - optional bytes bbbb = 7; - - extensions 100 to max; -} - -message Pair { - required string key = 1; - optional string value = 2; -} - -extend Test { - optional bool gtt = 100; - optional double gtg = 101; - repeated MyEnum someEnum = 102; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex3.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex3.txtar deleted file mode 100644 index 3716116e1..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/ex3.txtar +++ /dev/null @@ -1,18 +0,0 @@ --- 0.proto -- -syntax = "proto3"; -import "google/protobuf/descriptor.proto"; -message Input { - string name = 1; - int32 id = 2; // Unique ID number for this person. - Address add = 3; - repeated PhoneNumber phones = 4; //List - - message PhoneNumber { - string number = 1; - } - - message Address { - string zip = 1; - string street = 2; - } -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_lower_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_lower_snake_case.txtar deleted file mode 100644 index c8d042739..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_lower_snake_case.txtar +++ /dev/null @@ -1,47 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -message One { - int32 success = 1; - int32 success_two = 2; - int32 Fail = 3; - int32 FailTwo = 4; - int32 failThree = 5; - int32 fail_four_ = 6; - int32 _fail_five = 7; -} - -message Two { - message Three { - message Four { - int32 success = 1; - int32 success_two = 2; - int32 Fail = 3; - int32 FailTwo = 4; - int32 failThree = 5; - int32 fail_four_ = 6; - int32 _fail_five = 7; - } - int32 success = 1; - int32 success_two = 2; - int32 Fail = 3; - int32 FailTwo = 4; - int32 failThree = 5; - int32 fail_four_ = 6; - int32 _fail_five = 7; - } -} - -message Five { - int32 success1 = 1; - int32 success_2 = 2; - int32 success3_1 = 3; - int32 success_4_1 = 4; -} --- buf.yaml -- -version: v1 -lint: - use: - - FIELD_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_no_descriptor.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_no_descriptor.txtar deleted file mode 100644 index 45cdd95ec..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/field_no_descriptor.txtar +++ /dev/null @@ -1,51 +0,0 @@ --- a.proto -- -syntax = "proto2"; - -package a; - -message One { - optional string descriptor = 1; - optional string Descriptor = 2; - optional string descRiptor = 3; - optional string _descriptor = 4; - optional string __descriptor = 5; - optional string descriptor_ = 6; - optional string descriptor__ = 7; - optional string __descriptor__ = 8; -} - -message Two { - message Three { - message Four { - optional string descriptor = 1; - optional string Descriptor = 2; - optional string descRiptor = 3; - optional string _descriptor = 4; - optional string __descriptor = 5; - optional string descriptor_ = 6; - optional string descriptor__ = 7; - optional string __descriptor__ = 8; - } - optional string descriptor = 1; - optional string Descriptor = 2; - optional string descRiptor = 3; - optional string _descriptor = 4; - optional string __descriptor = 5; - optional string descriptor_ = 6; - optional string descriptor__ = 7; - optional string __descriptor__ = 8; - } - optional string descriptor = 1; - optional string Descriptor = 2; - optional string descRiptor = 3; - optional string _descriptor = 4; - optional string __descriptor = 5; - optional string descriptor_ = 6; - optional string descriptor__ = 7; - optional string __descriptor__ = 8; -} --- buf.yaml -- -version: v1beta1 -lint: - use: - - FIELD_NO_DESCRIPTOR diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/file_lower_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/file_lower_snake_case.txtar deleted file mode 100644 index 38a840f61..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/file_lower_snake_case.txtar +++ /dev/null @@ -1,45 +0,0 @@ --- 1.proto -- -syntax = "proto3"; - -package a; --- B.proto -- -syntax = "proto3"; - -package a.b; --- Foo.proto -- -syntax = "proto3"; - -package a.b; --- a.proto -- -syntax = "proto3"; - -package a.b; --- aBc.proto -- -syntax = "proto3"; - -package a.b; --- aBc.txt -- -syntax = "proto3"; - -package a.b; --- ab.proto -- -syntax = "proto3"; - -package a.b; --- ab_c.proto -- -syntax = "proto3"; - -package a.b; --- ab_c_.proto -- -syntax = "proto3"; - -package a.b; --- buf.yaml -- -version: v1 -lint: - use: - - FILE_LOWER_SNAKE_CASE --- fooBar.proto -- -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_public.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_public.txtar deleted file mode 100644 index 7030cba97..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_public.txtar +++ /dev/null @@ -1,28 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "sub/sub1.proto"; -import public "sub/sub2.proto"; -import public "one/one.proto"; --- buf.yaml -- -version: v1 -lint: - use: - - IMPORT_NO_PUBLIC --- one/one.proto -- -syntax = "proto3"; - -package one; - -import "sub/sub1.proto"; -import public "sub/sub2.proto"; --- sub/sub1.proto -- -syntax = "proto3"; - -package sub; --- sub/sub2.proto -- -syntax = "proto3"; - -package sub; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_weak.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_weak.txtar deleted file mode 100644 index ea4f636d9..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_no_weak.txtar +++ /dev/null @@ -1,28 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "sub/sub1.proto"; -import weak "sub/sub2.proto"; -import weak "one/one.proto"; --- buf.yaml -- -version: v1 -lint: - use: - - IMPORT_NO_WEAK --- one/one.proto -- -syntax = "proto3"; - -package one; - -import "sub/sub1.proto"; -import weak "sub/sub2.proto"; --- sub/sub1.proto -- -syntax = "proto3"; - -package sub; --- sub/sub2.proto -- -syntax = "proto3"; - -package sub; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_used.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_used.txtar deleted file mode 100644 index 27c175217..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/import_used.txtar +++ /dev/null @@ -1,40 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "sub/sub1.proto"; -import "sub/sub2.proto"; -import "one/one.proto"; - -message A { - sub.Sub2 sub2 = 1; -} --- buf.yaml -- -version: v1 -lint: - use: - - IMPORT_USED --- one/one.proto -- -syntax = "proto3"; - -package one; - -import "sub/sub1.proto"; -import "sub/sub2.proto"; - -message One { - sub.Sub1 sub1 = 1; -} --- sub/sub1.proto -- -syntax = "proto3"; - -package sub; - -message Sub1 {} --- sub/sub2.proto -- -syntax = "proto3"; - -package sub; - -message Sub2 {} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/javaoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/javaoptions.txtar deleted file mode 100644 index 868d0da7b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/javaoptions.txtar +++ /dev/null @@ -1,7 +0,0 @@ --- java_file.proto -- -package acme.weather; - -option java_multiple_files = true; -option java_string_check_utf8 = false; -option java_package = "foo"; -option java_outer_classname = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/jsoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/jsoptions.txtar deleted file mode 100644 index d12d7f2a8..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/jsoptions.txtar +++ /dev/null @@ -1,2 +0,0 @@ --- a.proto -- -option optimize_for = CODE_SIZE; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/message_pascal_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/message_pascal_case.txtar deleted file mode 100644 index 93401ca76..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/message_pascal_case.txtar +++ /dev/null @@ -1,28 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -message Success {} -message SuccessTwo {} -message SuccessFOOThree { - message fail {} - message failTwo { - message fail_three {} - } -} - -message fail {} -message failTwo {} -message fail_three {} -message Fail_four { - message fail {} - message failTwo { - message fail_three {} - } -} --- buf.yaml -- -version: v1 -lint: - use: - - MESSAGE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/objcoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/objcoptions.txtar deleted file mode 100644 index e3ee5b27b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/objcoptions.txtar +++ /dev/null @@ -1,20 +0,0 @@ --- double/objc.proto -- -package acme.weather.v1; - -option objc_class_prefix = "foo"; --- gpb/objc.proto -- -package google.protobuf.bla.v1; - -option objc_class_prefix = "foo"; --- single/objc.proto -- -package acme.v1; - -option objc_class_prefix = "foo"; --- triple/objc.proto -- -package acme.weather.data.v1; - -option objc_class_prefix = "foo"; --- unversioned/objc.proto -- -package acme.weather.data; - -option objc_class_prefix = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/oneof_lower_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/oneof_lower_snake_case.txtar deleted file mode 100644 index c2567fcd3..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/oneof_lower_snake_case.txtar +++ /dev/null @@ -1,93 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -message One { - oneof success { - int32 one = 1; - } - oneof success_two { - int32 two = 2; - } - oneof Fail { - int32 three = 3; - } - oneof FailTwo { - int32 four = 4; - } - oneof failThree { - int32 five = 5; - } - oneof fail_four_ { - int32 six = 6; - } - oneof _fail_five { - int32 seven = 7; - } -} - -message Two { - message Three { - message Four { - oneof success { - int32 one = 1; - } - oneof success_two { - int32 two = 2; - } - oneof Fail { - int32 three = 3; - } - oneof FailTwo { - int32 four = 4; - } - oneof failThree { - int32 five = 5; - } - oneof fail_four_ { - int32 six = 6; - } - oneof _fail_five { - int32 seven = 7; - } - } - oneof success { - int32 one = 1; - } - oneof success_two { - int32 two = 2; - } - oneof Fail { - int32 three = 3; - } - oneof FailTwo { - int32 four = 4; - } - oneof failThree { - int32 five = 5; - } - oneof fail_four_ { - int32 six = 6; - } - oneof _fail_five { - int32 seven = 7; - } - } -} - -// checking to see if the implicit oneof triggers the linter, which it should not -message Three { - message Four { - message Five { - optional string one = 1; - } - optional string one = 1; - } - optional string one = 1; -} --- buf.yaml -- -version: v1 -lint: - use: - - ONEOF_LOWER_SNAKE_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/optionpanic.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/optionpanic.txtar deleted file mode 100644 index 8ee42f8cc..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/optionpanic.txtar +++ /dev/null @@ -1,33 +0,0 @@ --- options/option.proto -- -syntax = "proto3"; - -package options; - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.FileOptions { - MyOption my_option = 9999; -} - -message MyOption { - repeated MyArray my_array = 1; -} - -message MyArray { - message TestMessage { - } - map my_map = 1; -} --- proto/test.proto -- -syntax = "proto3"; - -package proto; - -import "options/option.proto"; - -option (options.my_option) = { - my_array: { - my_map: { - } - } -}; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_defined.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_defined.txtar deleted file mode 100644 index 1bbb399bd..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_defined.txtar +++ /dev/null @@ -1,9 +0,0 @@ --- a/no_package.proto -- -syntax = "proto3"; --- buf.yaml -- -version: v1 -lint: - use: - - PACKAGE_DEFINED --- no_package.proto -- -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_directory_match.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_directory_match.txtar deleted file mode 100644 index ae5452a18..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_directory_match.txtar +++ /dev/null @@ -1,19 +0,0 @@ --- a/b/a_b.proto -- -syntax = "proto3"; - -package a.b; --- a/b/a_c.proto -- -syntax = "proto3"; - -package a.c; --- buf.yaml -- -version: v1 -lint: - use: - - PACKAGE_DIRECTORY_MATCH --- no_package.proto -- -syntax = "proto3"; --- sub/a/b/a_b.proto -- -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_lower_snake_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_lower_snake_case.txtar deleted file mode 100644 index 456e28672..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_lower_snake_case.txtar +++ /dev/null @@ -1,39 +0,0 @@ --- 1.proto -- -syntax = "proto3"; - -package a; --- 2.proto -- -syntax = "proto3"; - -package a.b; --- 3.proto -- -syntax = "proto3"; - -package a.b_cde; --- 4.proto -- -syntax = "proto3"; - -package a.b_cde.f; --- 5.proto -- -syntax = "proto3"; - -package a.b_cdE.f; --- 6.proto -- -syntax = "proto3"; - -package a.b_cde.F; --- 7.proto -- -syntax = "proto3"; - -package a.bcde.F; --- 8.proto -- -syntax = "proto3"; - -package a.b_cde.f_; --- buf.yaml -- -version: v1 -lint: - use: - - PACKAGE_LOWER_SNAKE_CASE --- no_package.proto -- -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory.txtar deleted file mode 100644 index 8950fca4b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory.txtar +++ /dev/null @@ -1,13 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; --- buf.yaml -- -version: v1 -lint: - use: - - PACKAGE_SAME_DIRECTORY --- one/a.proto -- -syntax = "proto3"; - -package a; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory_no_package.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory_no_package.txtar deleted file mode 100644 index f0b626361..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_directory_no_package.txtar +++ /dev/null @@ -1,9 +0,0 @@ --- buf.yaml -- -version: v1 -lint: - use: - - PACKAGE_SAME_DIRECTORY --- no_package.proto -- -syntax = "proto3"; --- one/no_package.proto -- -syntax = "proto3"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_option_value.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_option_value.txtar deleted file mode 100644 index 3e5243813..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_same_option_value.txtar +++ /dev/null @@ -1,52 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -option csharp_namespace = "foo"; -option java_multiple_files = true; -option java_package = "foo"; -option go_package = "foo"; -option php_namespace = "foo"; -option ruby_package = "foo"; -option swift_prefix = "foo"; --- b.proto -- -syntax = "proto3"; - -package a; - -option csharp_namespace = "bar"; -option java_multiple_files = false; -option java_package = "bar"; -option go_package = "bar"; -option php_namespace = "bar"; -option ruby_package = "bar"; -option swift_prefix = "bar"; --- buf.yaml -- -version: v1 -lint: - use: - - PACKAGE_SAME_CSHARP_NAMESPACE - - PACKAGE_SAME_GO_PACKAGE - - PACKAGE_SAME_JAVA_MULTIPLE_FILES - - PACKAGE_SAME_JAVA_PACKAGE - - PACKAGE_SAME_PHP_NAMESPACE - - PACKAGE_SAME_RUBY_PACKAGE - - PACKAGE_SAME_SWIFT_PREFIX --- sub/a.proto -- -syntax = "proto3"; - -package a.b; - -// comment -option csharp_namespace = "foo"; -option java_multiple_files = true; -option java_package = "foo"; -option go_package = "foo"; -option php_namespace = "foo"; -option ruby_package = "foo"; -option swift_prefix = "foo"; --- sub/b.proto -- -syntax = "proto3"; - -package a.b; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_version_suffix.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_version_suffix.txtar deleted file mode 100644 index 16937721e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/package_version_suffix.txtar +++ /dev/null @@ -1,55 +0,0 @@ --- buf.yaml -- -version: v1 -lint: - use: - - PACKAGE_VERSION_SUFFIX --- foo.proto -- -syntax = "proto3"; - -package foo; --- foo_bar.proto -- -syntax = "proto3"; - -package foo.bar; --- foo_bar_v0beta1.proto -- -syntax = "proto3"; - -package foo.bar.v0beta1; --- foo_bar_v1.proto -- -syntax = "proto3"; - -package foo.bar.v1; --- foo_bar_v1beta1.proto -- -syntax = "proto3"; - -package foo.bar.v1beta1; --- foo_bar_v1test.proto -- -syntax = "proto3"; - -package foo.bar.v1test; --- foo_bar_v1test_foo.proto -- -syntax = "proto3"; - -package foo.bar.v1test.foo; --- foo_bar_v1testfoo.proto -- -syntax = "proto3"; - -package foo.bar.v1testfoo; --- foo_bar_v2.proto -- -syntax = "proto3"; - -package foo.bar.v2; --- foo_bar_v2beta0.proto -- -syntax = "proto3"; - -package foo.bar.v2beta0; --- foo_bar_vv1beta1.proto -- -syntax = "proto3"; - -package foo.bar.vv1beta1; --- no_package.proto -- -syntax = "proto3"; --- v1.proto -- -syntax = "proto3"; - -package v1; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/packageversion.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/packageversion.txtar deleted file mode 100644 index b9c02557e..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/packageversion.txtar +++ /dev/null @@ -1,4 +0,0 @@ --- a.proto -- -package weather.v1alpha1; - -option go_package = "weather"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/phpoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/phpoptions.txtar deleted file mode 100644 index a3d4f3bb7..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/phpoptions.txtar +++ /dev/null @@ -1,20 +0,0 @@ --- double/php.proto -- -package acme.weather.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; --- reserved/php.proto -- -package acme.error.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; --- single/php.proto -- -package acme.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; --- triple/php.proto -- -package acme.weather.data.v1; - -option php_namespace = "foo"; -option php_metadata_namespace = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/proto3optional1.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/proto3optional1.txtar deleted file mode 100644 index 05561edf8..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/proto3optional1.txtar +++ /dev/null @@ -1,6 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -message Foo { - optional string bar = 1; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_no_streaming.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_no_streaming.txtar deleted file mode 100644 index 9ed82f320..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_no_streaming.txtar +++ /dev/null @@ -1,19 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Foo { - rpc NoStreaming(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc RequestStreaming(stream google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc ResponseStreaming(google.protobuf.Empty) returns (stream google.protobuf.Empty) {} - rpc BothStreaming(stream google.protobuf.Empty) returns (stream google.protobuf.Empty) {} -} --- buf.yaml -- -version: v1 -lint: - use: - - RPC_NO_CLIENT_STREAMING - - RPC_NO_SERVER_STREAMING diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_pascal_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_pascal_case.txtar deleted file mode 100644 index 208e29d24..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_pascal_case.txtar +++ /dev/null @@ -1,21 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Foo { - rpc Success(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc SuccessTwo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc SuccessFOOThree(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc fail(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc failTwo(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc fail_three(google.protobuf.Empty) returns (google.protobuf.Empty) {} - rpc Fail_four(google.protobuf.Empty) returns (google.protobuf.Empty) {} -} --- buf.yaml -- -version: v1 -lint: - use: - - RPC_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name.txtar deleted file mode 100644 index 11a51647c..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name.txtar +++ /dev/null @@ -1,31 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Foo { - rpc Success(SuccessRequest) returns (SuccessResponse) {} - rpc AnotherSuccess(FooAnotherSuccessRequest) returns (FooAnotherSuccessResponse) {} - rpc FailRequest(Bar) returns (FailRequestResponse) {} - rpc FailResponse(FailResponseRequest) returns (Bar) {} - rpc NoAllowEmptyRequest(google.protobuf.Empty) returns (NoAllowEmptyRequestResponse) {} - rpc NoAllowEmptyResponse(NoAllowEmptyResponseRequest) returns (google.protobuf.Empty) {} -} - -message SuccessRequest {} -message SuccessResponse {} -message FooAnotherSuccessRequest {} -message FooAnotherSuccessResponse {} -message FailRequestResponse {} -message FailResponseRequest {} -message NoAllowEmptyRequestResponse {} -message NoAllowEmptyResponseRequest {} -message Bar {} --- buf.yaml -- -version: v1 -lint: - use: - - RPC_REQUEST_STANDARD_NAME - - RPC_RESPONSE_STANDARD_NAME diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name_allow_empty.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name_allow_empty.txtar deleted file mode 100644 index f5f18a8c5..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rpc_standard_name_allow_empty.txtar +++ /dev/null @@ -1,33 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -import "google/protobuf/empty.proto"; - -service Foo { - rpc Success(SuccessRequest) returns (SuccessResponse) {} - rpc AnotherSuccess(FooAnotherSuccessRequest) returns (FooAnotherSuccessResponse) {} - rpc FailRequest(Bar) returns (FailRequestResponse) {} - rpc FailResponse(FailResponseRequest) returns (Bar) {} - rpc AllowEmptyRequest(google.protobuf.Empty) returns (AllowEmptyRequestResponse) {} - rpc AllowEmptyResponse(AllowEmptyResponseRequest) returns (google.protobuf.Empty) {} -} - -message SuccessRequest {} -message SuccessResponse {} -message FooAnotherSuccessRequest {} -message FooAnotherSuccessResponse {} -message FailRequestResponse {} -message FailResponseRequest {} -message AllowEmptyRequestResponse {} -message AllowEmptyResponseRequest {} -message Bar {} --- buf.yaml -- -version: v1 -lint: - use: - - RPC_REQUEST_STANDARD_NAME - - RPC_RESPONSE_STANDARD_NAME - rpc_allow_google_protobuf_empty_requests: true - rpc_allow_google_protobuf_empty_responses: true diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rubyoptions.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rubyoptions.txtar deleted file mode 100644 index ddeb0c03c..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/rubyoptions.txtar +++ /dev/null @@ -1,12 +0,0 @@ --- double/ruby.proto -- -package acme.weather.v1; - -option ruby_package = "foo"; --- single/ruby.proto -- -package acme.v1; - -option ruby_package = "foo"; --- triple/ruby.proto -- -package acme.weather.data.v1; - -option ruby_package = "foo"; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/semicolons.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/semicolons.txtar deleted file mode 100644 index 55a9c6e2b..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/semicolons.txtar +++ /dev/null @@ -1,42 +0,0 @@ --- a.proto -- -syntax="proto3";;;; -;;; -;package a;;;;; -; -;;;;import "google/protobuf/descriptor.proto"; -;; -; -;;extend google.protobuf.FileOptions { - bool foo = 9999999; -} -; -;message Bar { - ;;;option deprecated = true;;;; - ;;;; - int32 one = 1;;;; - ;repeated bool two = 2 [deprecated = true];; - map three = 3 [ - deprecated = false - ];;;; -};;;; -;; -;enum Baz { - ;;;;option deprecated = true;;;; - - ;DEFAULT = 0;;;; - ONE = 1;;; - TWO = 2;;;; -};;; -;; -;service BatService { -; ;option deprecated = true;;;; -; - ;rpc Bam(Bar) returns (Other);;; -; - rpc Ban(Other) returns (Bar) { - ; ;option deprecated = true;;;; - };;;; -};;;; -; -; -;;;;message Other{;;;};;;;; diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_pascal_case.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_pascal_case.txtar deleted file mode 100644 index e6ee433ed..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_pascal_case.txtar +++ /dev/null @@ -1,17 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -service Success {} -service SuccessTwo {} -service SuccessFOOThree {} -service fail {} -service failTwo {} -service fail_three {} -service Fail_four {} --- buf.yaml -- -version: v1 -lint: - use: - - SERVICE_PASCAL_CASE diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix.txtar deleted file mode 100644 index 36195e060..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix.txtar +++ /dev/null @@ -1,16 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -service SuccessService {} -service SuccessTwoService {} -service SuccessThree_Service {} -service Fail {} -service FailAPI {} -service FailService_ {} --- buf.yaml -- -version: v1 -lint: - use: - - SERVICE_SUFFIX diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix_custom.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix_custom.txtar deleted file mode 100644 index 287662ae8..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/service_suffix_custom.txtar +++ /dev/null @@ -1,18 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package a; - -service SuccessAPI {} -service SuccessTwoAPI {} -service SuccessThree_API {} -service Fail {} -service FailService {} -service FailAPI_ {} -service FailApi_ {} --- buf.yaml -- -version: v1 -lint: - use: - - SERVICE_SUFFIX - service_suffix: API diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/simple.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/simple.txtar deleted file mode 100644 index 12338f991..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/simple.txtar +++ /dev/null @@ -1,2 +0,0 @@ --- .proto -- -message A{} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/syntax_specified.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/syntax_specified.txtar deleted file mode 100644 index cbbeb83a1..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/syntax_specified.txtar +++ /dev/null @@ -1,21 +0,0 @@ --- a/a.proto -- -// comment - -package a; --- a/a2.proto -- -// comment - -syntax = "proto2"; - -package a; --- a/a3.proto -- -// comment - -syntax = "proto3"; - -package a; --- buf.yaml -- -version: v1 -lint: - use: - - SYNTAX_SPECIFIED diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/test.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/test.txtar deleted file mode 100644 index 3fd493ae0..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/test.txtar +++ /dev/null @@ -1,58 +0,0 @@ --- 0.proto -- -syntax = "proto3"; - -package a.v1; - -option go_package = "av1"; - -// ServiceDefinition is a service definition. -service ServiceDefinition { - // Method does a thing. - rpc Method(MethodRequest) returns (MethodResponse) {} - rpc OtherMethod(MethodRequest) returns (MethodResponse); -} - -message MethodRequest { - // field is a protobuf message field - string field = 1 [ - json_name = "foo" - ]; -} - -message MethodResponse { - // field is a protobuf message field - string field = 1; -} --- 1.proto -- -syntax = "proto3"; - -package b.v1; - -import "google/protobuf/timestamp.proto"; -import "2.proto"; - -option go_package = "bv1"; - -message OtherMessage { - bytes other_field = 1 [ - (c.v1.foo) = "bar" - ]; - google.protobuf.Timestamp time_field = 2 [ - (c.v1.foo) = "baz" - ]; -} - -enum EnumType { - ENUM_TYPE_UNSPECIFIED = 0; - ENUM_TYPE_ONE = 1; -} --- 2.proto -- -syntax = "proto2"; - -package c.v1; - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.FieldOptions { - optional string foo = 50001; -} diff --git a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/wktimport.txtar b/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/wktimport.txtar deleted file mode 100644 index b8bad5ede..000000000 --- a/pkg/bufman/bufpkg/bufimage/bufimagebuild/bufimagebuildtesting/corpus/wktimport.txtar +++ /dev/null @@ -1,10 +0,0 @@ --- a.proto -- -syntax = "proto3"; - -package acme.weather.v1alpha1; - -import "google/protobuf/timestamp.proto"; - -message Container { - google.protobuf.Timestamp timestamp = 1; -} diff --git a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go index 1493a4283..8b991c35a 100644 --- a/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go +++ b/pkg/bufman/bufpkg/bufmodule/bufmodulecache/util.go @@ -18,6 +18,7 @@ package bufmodulecache import ( "context" "fmt" + registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" "github.com/apache/dubbo-kubernetes/pkg/bufman/bufpkg/bufmodule/bufmoduleref" diff --git a/pkg/bufman/constant/const.go b/pkg/bufman/constant/const.go index 2a630b69a..c4bb9fc3f 100644 --- a/pkg/bufman/constant/const.go +++ b/pkg/bufman/constant/const.go @@ -29,10 +29,13 @@ const ( AuthPrefix = "Bearer" TokenLength = 16 CommitLength = 32 - UserIDKey = "user_id" DefaultBranch = "main" ) +type userIDKeyType struct{} + +var UserIDKey userIDKeyType + const ( FileSavaDir = "blobs" ) diff --git a/pkg/bufman/core/lru/lru.go b/pkg/bufman/core/lru/lru.go index 6705ba1db..3c644de7c 100644 --- a/pkg/bufman/core/lru/lru.go +++ b/pkg/bufman/core/lru/lru.go @@ -54,7 +54,7 @@ func (l *Lru) Add(key interface{}, val interface{}) error { l.mu.Lock() defer l.mu.Unlock() - if e, ok := l.cache[key]; ok { //以及存在 + if e, ok := l.cache[key]; ok { // 以及存在 e.Value.(*Node).Val = val l.l.MoveToFront(e) return nil @@ -131,5 +131,4 @@ func (l *Lru) Del(key interface{}) { } } } - } diff --git a/pkg/bufman/core/search/db_search.go b/pkg/bufman/core/search/db_search.go index 8b87fae8b..f0b4e77ae 100644 --- a/pkg/bufman/core/search/db_search.go +++ b/pkg/bufman/core/search/db_search.go @@ -23,8 +23,7 @@ import ( "github.com/apache/dubbo-kubernetes/pkg/bufman/model" ) -type DBSearcherImpl struct { -} +type DBSearcherImpl struct{} func NewDBSearcher() *DBSearcherImpl { return &DBSearcherImpl{} diff --git a/pkg/bufman/core/storage/db_storage.go b/pkg/bufman/core/storage/db_storage.go index fc8d04af5..13fc399db 100644 --- a/pkg/bufman/core/storage/db_storage.go +++ b/pkg/bufman/core/storage/db_storage.go @@ -24,8 +24,7 @@ import ( "github.com/apache/dubbo-kubernetes/pkg/bufman/model" ) -type DBStorageHelperImpl struct { -} +type DBStorageHelperImpl struct{} func NewDBStorageHelper() *DBStorageHelperImpl { return &DBStorageHelperImpl{} diff --git a/pkg/bufman/handlers/grpc_handlers/search.go b/pkg/bufman/handlers/grpc_handlers/search.go deleted file mode 100644 index 16c14fcc9..000000000 --- a/pkg/bufman/handlers/grpc_handlers/search.go +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package grpc_handlers - -import ( - "context" - - registryv1alpha1 "github.com/apache/dubbo-kubernetes/pkg/bufman/gen/proto/go/registry/v1alpha1" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type SearchServiceHandler struct { - registryv1alpha1.UnimplementedSearchServiceServer -} - -func (SearchServiceHandler) SearchUser(ctx context.Context, req *registryv1alpha1.SearchUserRequest) (*registryv1alpha1.SearchUserResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SearchUser not implemented") -} -func (SearchServiceHandler) SearchRepository(ctx context.Context, req *registryv1alpha1.SearchRepositoryRequest) (*registryv1alpha1.SearchRepositoryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SearchRepository not implemented") -} -func (SearchServiceHandler) SearchLastCommitByContent(ctx context.Context, req *registryv1alpha1.SearchLastCommitByContentRequest) (*registryv1alpha1.SearchLastCommitByContentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SearchLastCommitByContent not implemented") -} -func (SearchServiceHandler) SearchCurationPlugin(ctx context.Context, req *registryv1alpha1.SearchCuratedPluginRequest) (*registryv1alpha1.SearchCuratedPluginResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SearchCurationPlugin not implemented") -} -func (SearchServiceHandler) SearchTag(ctx context.Context, req *registryv1alpha1.SearchTagRequest) (*registryv1alpha1.SearchTagResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SearchTag not implemented") -} -func (SearchServiceHandler) SearchDraft(ctx context.Context, req *registryv1alpha1.SearchDraftRequest) (*registryv1alpha1.SearchDraftResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SearchDraft not implemented") -} diff --git a/pkg/bufman/mapper/commit_mapper.go b/pkg/bufman/mapper/commit_mapper.go index 11d68b84d..1daf002fe 100644 --- a/pkg/bufman/mapper/commit_mapper.go +++ b/pkg/bufman/mapper/commit_mapper.go @@ -165,20 +165,27 @@ func (c *CommitMapperImpl) FindByRepositoryIDAndReference(repositoryID string, r } func (c *CommitMapperImpl) FindByRepositoryNameAndReference(repositoryID string, reference string) (*model.Commit, error) { - var commit *model.Commit - var err error if reference == "" || reference == constant.DefaultBranch { - commit, err = c.FindLastByRepositoryID(repositoryID) + commit, err := c.FindLastByRepositoryID(repositoryID) + if err != nil { + return nil, err + } + + return commit, nil } else if len(reference) == constant.CommitLength { // 查询commit - commit, err = c.FindByRepositoryIDAndCommitName(repositoryID, reference) - if err != nil { + commit, err := c.FindByRepositoryIDAndCommitName(repositoryID, reference) + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return nil, err } + + if commit != nil { + return commit, nil + } } // 查询tag - commit, err = c.FindByRepositoryIDAndTagName(repositoryID, reference) + commit, err := c.FindByRepositoryIDAndTagName(repositoryID, reference) if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return nil, err } diff --git a/pkg/bufman/model/file.go b/pkg/bufman/model/file.go index 500df6ee1..71c342625 100644 --- a/pkg/bufman/model/file.go +++ b/pkg/bufman/model/file.go @@ -50,17 +50,21 @@ type FileBlob struct { type CommitFiles []*CommitFile func (commitFiles *CommitFiles) ToProtoFileInfo() *registryv1alpha1.FileInfo { + if commitFiles == nil { + return nil + } + root := ®istryv1alpha1.FileInfo{ Path: ".", IsDir: true, } for i := 0; i < len(*commitFiles); i++ { - fileBlob := (*commitFiles)[i] - if commitFiles == nil { - fileBlob = &CommitFile{} + commitFile := (*commitFiles)[i] + if commitFile == nil { + commitFile = &CommitFile{} } - doToProtoFileInfo(root, fileBlob.FileName) + doToProtoFileInfo(root, commitFile.FileName) } return root diff --git a/pkg/bufman/pkg/filepathextended/filepathextended_unix_test.go b/pkg/bufman/pkg/filepathextended/filepathextended_unix_test.go deleted file mode 100644 index 4e5fd8aeb..000000000 --- a/pkg/bufman/pkg/filepathextended/filepathextended_unix_test.go +++ /dev/null @@ -1,143 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Matching the unix-like build tags in the Golang source i.e. https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/file_unix.go#L6 - -//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris - -package filepathextended - -import ( - "os" - "path/filepath" - "sort" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestRealClean(t *testing.T) { - t.Parallel() - path, err := RealClean("../filepathextended") - assert.NoError(t, err) - assert.Equal(t, ".", path) - path, err = RealClean("../filepathextended/foo") - assert.NoError(t, err) - assert.Equal(t, "foo", path) - path, err = RealClean("/foo") - assert.NoError(t, err) - assert.Equal(t, "/foo", path) - path, err = RealClean("/foo/../bar") - assert.NoError(t, err) - assert.Equal(t, "/bar", path) -} - -func TestWalkSymlinkSuccessNoSymlinks(t *testing.T) { - t.Parallel() - filePaths, err := testWalkGetRegularFilePaths( - filepath.Join("testdata", "symlink_success"), - ) - require.NoError(t, err) - require.Equal( - t, - []string{ - "file.proto", - }, - filePaths, - ) -} - -func TestWalkSymlinkSuccessSymlinks(t *testing.T) { - t.Parallel() - filePaths, err := testWalkGetRegularFilePaths( - filepath.Join("testdata", "symlink_success"), - WalkWithSymlinks(), - ) - require.NoError(t, err) - require.Equal( - t, - []string{ - "1.proto", - "a/b/1.proto", - "a/b/2.proto", - "a/b/2.txt", - "a/bar.yaml", - "a/file.proto", - "ab/1.proto", - "ab/2.proto", - "ab/2.txt", - "file.proto", - }, - filePaths, - ) -} - -func TestWalkSymlinkLoopNoSymlinks(t *testing.T) { - t.Parallel() - filePaths, err := testWalkGetRegularFilePaths( - filepath.Join("testdata", "symlink_loop"), - ) - require.NoError(t, err) - require.Equal( - t, - []string{ - "file.proto", - }, - filePaths, - ) -} - -func TestWalkSymlinkLoopSymlinks(t *testing.T) { - t.Parallel() - filePaths, err := testWalkGetRegularFilePaths( - filepath.Join("testdata", "symlink_loop"), - WalkWithSymlinks(), - ) - require.NoError(t, err) - require.Equal( - t, - []string{ - "file.proto", - }, - filePaths, - ) -} - -func testWalkGetRegularFilePaths(dirPath string, options ...WalkOption) ([]string, error) { - var filePaths []string - if err := Walk( - dirPath, - func(path string, fileInfo os.FileInfo, err error) error { - if err != nil { - return err - } - if fileInfo.Mode().IsRegular() { - relPath, err := filepath.Rel(dirPath, path) - if err != nil { - return err - } - filePaths = append(filePaths, relPath) - } - return nil - }, - options..., - ); err != nil { - return nil, err - } - sort.Strings(filePaths) - return filePaths, nil -} diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/1.proto b/pkg/bufman/pkg/filepathextended/testdata/base/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/base/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/1.proto b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.proto b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.txt b/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/base/a/b/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/a/bar.yaml b/pkg/bufman/pkg/filepathextended/testdata/base/a/bar.yaml deleted file mode 100644 index 8eece6f60..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/base/a/bar.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/ab/1.proto b/pkg/bufman/pkg/filepathextended/testdata/base/ab/1.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/base/ab/1.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.proto b/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.txt b/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.txt deleted file mode 100644 index 257cc5642..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/base/ab/2.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/pkg/bufman/pkg/filepathextended/testdata/link/b b/pkg/bufman/pkg/filepathextended/testdata/link/b deleted file mode 100644 index f7f964f73..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/link/b +++ /dev/null @@ -1 +0,0 @@ -../base/a/b \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/link/bar.yaml b/pkg/bufman/pkg/filepathextended/testdata/link/bar.yaml deleted file mode 100644 index 490a5eb33..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/link/bar.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -../base/a/bar.yaml \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/link/file.proto b/pkg/bufman/pkg/filepathextended/testdata/link/file.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/link/file.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/a/b b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/a/b deleted file mode 100644 index 42532fe13..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/a/b +++ /dev/null @@ -1 +0,0 @@ -../b \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/b/a b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/b/a deleted file mode 100644 index 82f488f26..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/b/a +++ /dev/null @@ -1 +0,0 @@ -../a \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/file.proto b/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/file.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/symlink_loop/file.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/1.proto b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/1.proto deleted file mode 100644 index b75f37911..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/1.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -../base/1.proto \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/a b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/a deleted file mode 100644 index f48f654b2..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/a +++ /dev/null @@ -1 +0,0 @@ -../link \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/ab b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/ab deleted file mode 100644 index d19fa240b..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/ab +++ /dev/null @@ -1 +0,0 @@ -../base/ab \ No newline at end of file diff --git a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/file.proto b/pkg/bufman/pkg/filepathextended/testdata/symlink_success/file.proto deleted file mode 100644 index ef220af48..000000000 --- a/pkg/bufman/pkg/filepathextended/testdata/symlink_success/file.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package foo; diff --git a/pkg/bufman/pkg/protosource/file.go b/pkg/bufman/pkg/protosource/file.go index 4e9e7bd06..81d0d19df 100644 --- a/pkg/bufman/pkg/protosource/file.go +++ b/pkg/bufman/pkg/protosource/file.go @@ -385,6 +385,7 @@ func (f *file) populateEnum( f.descriptor.locationStore, ), enumDescriptorProto.GetOptions().GetAllowAlias(), + // nolint:staticcheck // SA1004 ignore this! enumDescriptorProto.GetOptions().GetDeprecatedLegacyJsonFieldConflicts(), enumDescriptorProto.GetOptions().GetDeprecated(), getEnumAllowAliasPath(enumIndex, nestedMessageIndexes...), @@ -482,6 +483,7 @@ func (f *file) populateMessage( descriptorProto.GetOptions().GetMapEntry(), descriptorProto.GetOptions().GetMessageSetWireFormat(), descriptorProto.GetOptions().GetNoStandardDescriptorAccessor(), + // nolint:staticcheck // SA1004 ignore this! descriptorProto.GetOptions().GetDeprecatedLegacyJsonFieldConflicts(), descriptorProto.GetOptions().GetDeprecated(), getMessageMessageSetWireFormatPath(topLevelMessageIndex, nestedMessageIndexes...), From 771f105c3eccbc6bc141b27a419a967959b4570b Mon Sep 17 00:00:00 2001 From: dawnzzz <635441876@qq.com> Date: Tue, 9 Jan 2024 20:39:38 +0800 Subject: [PATCH 18/18] fix lint --- pkg/bufman/pkg/transport/http/httpserver/httpserver.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/bufman/pkg/transport/http/httpserver/httpserver.go b/pkg/bufman/pkg/transport/http/httpserver/httpserver.go index 7109f3f09..523e56a88 100644 --- a/pkg/bufman/pkg/transport/http/httpserver/httpserver.go +++ b/pkg/bufman/pkg/transport/http/httpserver/httpserver.go @@ -148,7 +148,9 @@ func Run( <-ctx.Done() start := time.Now() logger.Sugar().Info("shutdown_starting", zap.Duration("shutdown_timeout", s.shutdownTimeout)) - defer logger.Sugar().Info("shutdown_finished", zap.Duration("duration", time.Since(start))) + defer func() { + logger.Sugar().Info("shutdown_finished", zap.Duration("duration", time.Since(start))) + }() if s.shutdownTimeout != 0 { ctx, cancel := context.WithTimeout(context.Background(), s.shutdownTimeout) defer cancel()